Comic Book Setup - Part 1 This tutorial shows you how to set up a comic book type magazine for character animation. This Setup is the one used to create the target poses used in the Blended Comic Book tutorial.
A Taste of Maya
In this tutorial: ■
Using the Wrap Deformer
■
Using Wire Deformers
■
Clustering Curve CVs as Animation Handles
■
Creating a Reset Pose Shelf Button
■
Strategies for Blend Shape Target Creation
Comic Book Setup
Note:
Questions? visit www.aliaswavefront.com/tasteofmaya
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install. Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
Character Control The animator’s job is to bring life to an object. When you animate you have clear ideas of how the object/ person/animal will move. To create this movement, your character must be manipulated into sequences of poses. Before you can animate your character, the character must be setup. This setup is much like creating a puppet that will be able to perform movements based on input from the animator. Maya provides a powerful suite of tools to do this type of work. In this tutorial you will work with Maya’s deformer tools to create a control mechanism for the comic book. This setup will allow you to move the comic book into human-like poses.
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
Scene file descriptions:
comicsetupstart.ma : This is the scene file you will start with. It contains a textured comic book object and some curves. comicsetupdone.ma : This scene file contains the finished example of the comic book ready for animation or blend shape target creation. Comic Book Cover Texture The source image for the comic book cover texture is located in the sourceimages directory. You may have to reestablish the path to this texture in the Hyper Shade Editor. This process is shown below. Source images for textures should be referenced automatically when the project structure is established. You may have to establish this path the first time you open a scene file however.
Wrap Deformer The wrap deformer lets you use any object as a deforming object. Other deformers in Maya such as the lattice deformer work from a predefined shape such as a cube. The wrap deformer can be a NURBS or polygonal surface in any shape you need. In this tutorial you will work with a NURBS plane as a wrap deformer. Think of the wrap deformer as an object that will control the object/s it is connected to.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
When working with an object that is made up of more than one surface it is better to simplify this group of objects down to a single surface or deformable shape. One way to do this is to create a Wrap deformer object. 1 Open comicBookStart.ma ■ Select File → Open Scene ... Select comicsetupstart.ma ■
Press Open
This file contains three objects under the group node comicBookGroup: comicBookObject, wrapPlane and wireCurves.
comicsetupstart.ma configuration and contents comicBookObject is a group node that contains the NURBS surfaces that make up the comic book. This object started life as a NURBS cube. The comicBook object has been texture mapped. Press the 5 key for shaded display, 6 key for texture shaded and the 7 key for textures with lighting in the perspective view. The wrapPlane object is a NURBS plane that has been scaled to fit just around the comicBook. Inside the comicBookGroup is another group named wireCurves. This group contains several curves that you will use as wire deformers for shaping the comicBook into various poses later in this tutorial.
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
Comic Book Cover Texture If the comic book frontCover texture does not appear on the magazine cover you will need to establish the path to this source image. ■ In Hypershade/Visor double click the frontCover material from the Visor’s Materials folder.
frontCover material in the Attribute Editor ■
Use the Attribute Editor to edit the material called frontCover. The frontCover material has a file texture connected to the Color attribute.
■
Navigate to the file1 texture node by pressing on the righthand side arrow button for the Color attribute.
file1 texture attached to the frontCover Color attribute
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
The Image Name attribute will need the absolute path to the comicBook.iff image located in the sourceimages directory. ■
Click on the folder icon then navigate to the sourceimages directory.
■
Select comicBook.iff and press Open.
2 Create a wrap deformer for the comicBook To simplify the deformation applied to the multiple comic book surfaces you will apply a wrap deformer. ■ ■
■
Open the Outliner, Window → Outliner... If it is not already displayed. In the Outliner Ctrl LMB select the comicBookObject then the wrapPlane objects. Make sure to expand the comicBookGroup to get to the comicBookObject group in the Outliner. Select Deform → Create Wrap (the deform menu is found under the Animation menu sets). This will create a wrap deformer between the wrapPlane and the comicBookObject group.
The order of your selection is important. You can tell which object is the wrap by seeing which object gets a base object added to it. In this case a new object called wrapPlaneBase is created indicating that the wrapPlane is the wrap deformer. If you find that you have selected objects in the wrong order, simply press z to undo and reverse your selection order and try it again.
Tip:
The comicBook group is now being controlled by the wrapPlane shape. To move or deform the comicBook objects you will move or deform the wrapPlane object. This single surface is a much simpler object to manipulate. 3 Test the wrap deformer You should test the wrap deformer. ■
Select the wrapPlane object in the Outliner.
■
Press F8 to enter component mode. You should see the CVs of the wrapPlane displayed. If not check your component pickmask settings to ensure that the CVs are pickable. The pickmask is located on the status line and is also known as the selection mask. From this portion of the status line you can select which objects or components of objects are selectable and/or which are masked from selection. See the fundamentals tutorial for more information on this powerful feature of Maya.
Note:
■
LMB drag select a CV on the wrapPlane object.
■
Press w to display the transform manipulator
■
Translate the CV and confirm that the comicBook object follows along. Press z to undo.
You could begin building targets by “tweaking” these CVs into a pose then duplicating the comicBook group to form a snapshot of this pose. But to make the process a little easier you are going to create a more generalized method of tweaking using wire deformers and clusters.
Wire Deformer Another Maya deformer is the Wire Deformer. This deformer turns a NURBS curve into a object that will deform a surface much like a wire inside a piece of cloth.
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
1 Create wire deformers between the wireCurves and the wrapPlane using the Wire Tool. Selection order is not used for envoking this function. You will select the objects as you are prompted by the tool. This is the difference between Selection/Action and Tool methods of working in Maya. ■
Select Deform → Wire Tool... The bottom of the Maya window contains a line called the Help Line. You can toggle this section of the UI under the Options menu. The Help Line provides tips and usages for tools and selection operations. The Wire Tool will prompt you to select the object you want the curve to deform first.
■
Select the wrapPlane in the Outliner Press Enter to validate the selection. Note that the Help Line prompts you to then select the curves
■
Ctrl select the wire curves in the Outliner. These curves are located under the wireCurves group. Press Enter to validate the selection
The curves will now deform the wrapPlane as you move them. To move the curves you will cluster the curve CVs. The clusters will, in a sense, move the curve CVs’ positioning up into worldspace. This will make it easier to control the curve CVs’ transformation and allow for keyframing of the curve CVs. ■
Once you have created your wire curves you can hide or template the wrapPlane. Templating the wrapPlane will keep a wire version visible but not selectable. Hiding the wrapPlane will keep it out of view and only selectable in the Outliner.
■
To see the objects and curves clearly, use wireframe mode by pressing the 4 key.
■
In the Outliner select the wrapPlane and press Display → Object Components → Templates this will turn the wrapPlane object into a templated object, one that is visible but not selectable.
2 Cluster the CVs of the wire curves A cluster is a grouping of curve or surface CVs (Control Vertices). A cluster is a very basic deformer. It is used for various jobs that entail moving curve or surface CVs. You will use them in this example as a method of controlling the wire deformer curve CVs. ■
Select topWireCurve and press F8 to toggle to component mode.
■
LMB drag select the two edgemost CVs on the topWireCurve curve. For example the two adjacent curve CVs in the upper righthand corner. Select Deform → Create Cluster
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Comic Book Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
Pattern of Cluster assignments to wire curve CVs, note center clusters are clustering 3 CVs each.
When you create the cluster the selection of the curve will be cleared. You will need to select the curve in the Outliner again and press F8 twice to get back to component mode for CV selection. Use the “g” hotkey to repeat the last command once you have selected the next CVs to be clustered. In this case the Deform → Create Cluster command will be repeated on the selected CVs.
Tip:
■
Repeat this for the rest of the CVs on this curve using the above image as a guide. Use the “g” hotkey to “repeat last command”, to speed up your workflow.
■
Repeat this for the other CVs on the mid and bottom curves in the following manner: Edge CVs: The two edge CVs of each curve get a cluster Center CVs: The center three CVs of each curve get a cluster Mid curve CVs: The CV between the center and the edge gets a cluster. See the figure above but also experiment with different configurations.
Note:
The curves provided for making the wire deformers have been tweaked or shaped into the curved pattern in order to better control the surface they are associated with. It is a subtle thing that provides a little more control over the wrapPlane surface.
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
More about Clusters Although the cluster is a deformer, you can also think of the cluster as moving the CV components up into world space. Using the cluster deformer in this manner you can think of it as a handle for components. A handle that can have keyframes applied to it and animated as any other object. You can apply a cluster to surface CVs as well as curve CVs. You can also adjust the weight of the deformation on a per CV basis. With surface clustered CVs you can use Artisan and it’s paint weights technology to adjust these weights. A cluster can also behave according to to its parent. The Relative attribute on a cluster controls this behavior. This attribute when turned on lets you parent the cluster to another object without creating a double transformation. For this tutorial it will not be a factor but if you wanted to parent the clusters to the magazine so that they travelled along with the comic book you would need to set this attribute to on. 3 Test the Clustered CVs The setup is complete for this character. The next task is to see if the character can get in the necessary poses. ■
Make sure you are in object mode by pressing the F8 key.
■
Adjust the pick mask to only allow selection of Cluster deformers.
Pick Mask ■
In the Pick Mask select All Objects Off.
■
In the Pick Mask deformer button RMB pulldown select Clusters. Now with only clusters as selectable objects you can quickly select the clusters and translate them to form your poses. This prevents you from accidentally selecting other objects like the curves or comic book surfaces.
4 Group the Clusters To make the file a little easier to control you will group the clusters you just created. ■
In the Outliner, shift select the clusters then select Edit → Group . This will create a group of the clusters.
■
Rename this group as clustersGroup.
To get the clusters back to the default undeformed positions: ■
select the clustersGroup then select Modify → Reset Transformations This will reset the group and its children back to the position that they were created at or < 0, 0, 0 > translation in X, Y, and Z. Later you will create a shelf button that will do this quickly.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
Adjust settings to the wrap and wire for best results Here are the settings for the attributes of the wrap and wire deformers. You should also experiment with these settings to see what the valid range of values is and how they affect the deformation. ■
Place the comic book into a somewhat exagerated pose by translating some of the clusters to form bends and folds.
■
Switch to the Channel Box from Options → Channel Box.
■
Select the wrapPlane object.
Channel Box of wrapPlane object showing Dropoff, Wrap Samples and wire attributes Wrap When you create a wrap deformer the object that is the wrap gets two attributes added to it. You can see these attributes in the channel box when the wrapPlane is selected: Dropoff: This attribute controls how the wrap influence diminishes over distance. Values between 4 and 8 seems to work fairly well but you can also see what happens at a value of 20.
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
Wrap Samples: This attribute controls how accurately the wrap is deforming the surface or surfaces. The higher the value the more accurate the deformation will follow but also more slowly as this increases the computational overhead. A value of 15 is fairly accurate without too much calculation. Higher sample values can slow down performance. Wire When you create a wire deformer using one or many curves a deformer object is created called a wire. Sometimes it may be hard to get at this node. You can usually find it as a related tab in the Attribute Editor when you select one of the curves that you are using as a wire deformer. You can also see it as an Output node in the Channel Box. This is the preferred method of accessing related nodes and attributes. Dropoff Distance: Each curve in the wire deformer has an entry for dropoff distance. In this case you will see 3 attributes [0], [1], [2]. A value of 6 in each of these seems to work pretty good but again, experiment with these settings. Envelope: This attribute controls the amount of influence the wire will have on the surface. Typically this value is kept at 1 but if you needed to exagerate the influence or decrease the influence you can adjust it here. Rotation: This attribute controls the amount of rotation that the surface will get normal to the curve. Experiment with this attribute, you may find that in certain poses it will help the surface follow the curve’s bend without twisting too much. Valid values are from 0 to 1.
Making a Cluster Reset Shelf Button You can also make a shelf button that selects all of your Clusters and performs the Reset Transformation with one button click. A shelf button is a command or series of commands that have been recorded as a macro and are executed by selecting the associated icon that appears on a shelf. The following steps will take you through creating and using a shelf button to reset your comic book clusters to their default positions. 1 Create a shelf button for Reset Transformations ■ Hold down the Shift, Ctrl and Alt keys at the same time that you select Modify → Reset Transformations from the main menu. You cannot use the Hotbox representation of the main menus in this manner to create a shelf button.
Note:
This will create a shelf button for this command on the currently displayed shelf. 2 Edit the Shelf Button Command ■ Select Options → Customize UI → Shelves... ■
from this menu select Shelf Contents tab and then the Reset Transformations button that you have created.
■
Select the Edit Commands tab, this displays the MEL commands that are executed when you press the shelf button.
You need to add the “selection of your clusters” part of the command. ■
Open the Script Editor, either by pressing the button in the far bottom righthand corner of Maya or by Window → General Editors → Script Editor.
■
In the Outliner select the clustersGroup group. The action is reflected in the Script Editor as: select -r clustersGroup;
■
LMB drag to select this entire line of text (including the semi colon “;” at the end of the line).
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
Questions? visit www.aliaswavefront.com/tasteofmaya
Comic Book Setup
When it is highlighted MMB drag it to the Shelves editor above the Reset Transformation command also known as makeIdentity. (You may have to press the enter key before the makeIdentity command to make room for the select -r... command to go above.) ■
Here is what the two commands in the shelf button editor will look like: select -r clustersGroup; makeIdentity;
■
Now add a selection clear command. Under the makeIdentity line add: select -cl;
Note that if you LMB drag select nothing in the perspecive view this is the command that is echoed to the Script Editor. ■
You should now have three lines: select -r clustersGroup; makeIdentity; select -cl;
■
Once you have the command looking right then press the enter key on the “numeric” keypad to validate. Press Save All Shelves to save the shelves to the Maya preferences.
Test the operation by translating some clusters and then press this shelf button to make sure it is working as intended. You can build and edit shelf buttons in this manner to create handy “macros” for often repeated commands and series of commands.
Finished Scene File comicsetupdone.ma The scene file comicsetupdone.ma is also provided as a finished version of the setup steps you have just completed. For the following steps and in the future, to work from a finished setup use this scene file.
Building Blendshape Targets You now have a character that is setup and ready to animate. You can simply begin moving the clusters and keyframing their position. In this manner you can animate the comic book into many actions and performances. You can also record these poses as blend shapes targets. In the Blended Comic Book tutorial you see the results of creating these targets as a library of movement or as an in-between sequence. The process of building blendshape animation involves creating blendshape targets that the base object will deform into. Typically, duplicates of the base object that form the candidate targets will have identical topology. This is desireable and will make the deformations smoother but also note that Maya will do blendshapes between objects that do not have identical topology or a one to one correlation between each objects geometric configuration, i.e. Vertice count, vertice position etc... The following steps show you the beginning of the process. 1 Duplicate the comicBookObject as the base object. You will need a comicBook to act as the base object. This comicBook will be the one that is animated with blendshape animation. ■
Reset the clusters back to their default or un-deforming position.
12 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
■
■
Comic Book Setup
Select the comicBookObject group and press Ctrl d or select Edit → Duplicate to make a copy of the comicBookObject in its rest pose. Rename this group as comicBookBase
2 Pose the comicBookObject using the clusters Now pose the character into poses that you can blend between. Think in terms of moving only a localized area like the hand to form a pose, the waist, the head, the foot. You will be adding these poses together so avoid having two poses that both move the same part of the character. This would result in double or summed movement and may not work the way you intended. This is the process for building Individual targets. ■
Create a pose and then duplicate the comicBookObject group and translate this copy to a place behind your work area. Rename this group to something meaningful.
■
Reset the clusters back to their default position.
■
Pose the comic book again and duplicate the comicBookObject group again.
■
Repeat this process until you have several target posed groups.
Two strategies for working with blend shapes Blend shape targets can be used individually or as in-betweens. ■
Individual targets
The first strategy is to create individual movements that can be added together to form poses. For example you could create a target that just has the arm move and another target that has the leg move. When you create a blend shape using the default settings, a slider is created for each target. By combining these two targets you can put the character into the needed pose. This technique allows for reuse of targets to create many different poses. ■
In-Between targets
With this strategy you create a series of poses that complete a motion. When you create the blend shape you specify “In-Between” in the Create Blend Shape Option Box. This will create a single slider that transitions through each target. Workflows for target creation: Individual 1. Create a pose and then duplicate the comicBookObject group and translate this copy to a place behind your work area. Rename this group to something meaningful about the part of the object you are deforming,( ie. headBending). 2. Reset the clusters back to their default position. 3. Pose the comic book again and duplicate the comicBookObject group again. 4. Repeat this process until you have several target posed groups that will lead into one another and not overlap too much. In-Between 1. Create a pose then duplicate the comicBookObject group, translate this copy to a place behind your work area. Rename this group to a numbered pose to identify the sequence order. 2. Translate the clusters to the next pose in the sequence. 3. Duplicate the comicBookObject group, translate and rename this group to the next numbered sequence. 4. Repeat until the poses have been created to complete the performance.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 13
Comic Book Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
CONCLUSION There are many ways to animate a character in Maya. Each of Maya’s deformers has its strengths and because you can layer these deformers you have several options for getting the shape to go where you want it to go. Create simple control handles that quickly let you put the character where you want it. If you find that you need more control then add it in. But it is usually best to keep things simple at first. Learn each deformer’s attributes and what they control. Work on very simple mockups first. Then apply what you have learned to the full model. Work with the blend shapes created from this setup: The Blended Comic Book tutorial available on the Discover Maya CD uses targets created by this setup technique in blend shape animation. The comic book serves a tennis ball takes a bow and even morphs into an anvil in this tutorial.
14 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Blended Comic Book - Part 2 This tutorial shows you how to use Maya’s blend shape deformer tools to animate a comic book.
A Taste of Maya
In this tutorial: ■
Creating individual and in-between blend shape animation
■
Keyframing blend shape animation
■
Deleting and Editing blend shapes
■
Strategies for creating blend shape targets
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
Note:
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install. Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
Comic Book / Magazine animation Applying animal characteristics to a normally in-animate object is a time honored and much demanded animation job. Advertisers often ask for their products to become actors in commercial and print pieces. In this tutorial you will create two types of blend shape animation using provided target poses. You will then animate between these poses. A second tutorial called Comic Book Setup has been created that explores the techniques used for setting up the magazine for character control. This is the character setup that was used to create the character based blend shape targets you will be working with in the following tutorial. Scene file descriptions:
comicbookstart.ma : This is the scene file you will start with. It contains groups of posed objects you will use to blend between. comicbookanim.ma : This scene file contains blend shape animation using all of the provided target poses. comicbookserve.ma, comicbookbow.ma, comicbookothers.ma : These scene files contain the comic book with various blend shapes applied matching the progression of this tutorial. Layers: The duplicated posed targets of the comic book in these Maya scene files have been organized into layers. These layers can be made visible by accessing the layer bar, Options → Layer Bar. To toggle the visibility of each layer press the RMB (Right Mouse Button) on the layer button, and select Visible. Comic Book Cover Texture: The source image for the comic book cover texture is located in the sourceimages directory. You may have to re-establish the path to this texture in the Hyper Shade Editor. This process is shown below.
Blendshape Animation Blend shape animation in Maya is the technique of deforming a “base” object by blending through a series of “target” objects. These “target” objects are deformed into the poses that the “base” object will assume or morph into. The blendshape is then keyframed at the desired pose at the desired time.
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
Blend Shape Editor Window Blend shape workflow in brief:
1. Create the object that will undergo blend shape animation (In this example it will be a comic book). 2. Make multiple copies of the object (comic book) and deform them into poses. The posed copies are called targets. The original object that is undeformed but is going to have the blendshape applied to it is called the base. 3. Apply the Blend Shape deformer to the targets and base objects. 4. Open the Blend Shape Editor, Window → Animation Editors → Blend Shape... adjust and keyframe the mix of blend shape target sliders. 5. Adjust keyframes and animation curves in the Graph Editor for smooth motion and blending. Local and World Blend Shapes: Blend shapes can blend between objects and only use the local space or component shape deviation or they can also include the world space transformations in each target. In this tutorial we will use the local space blend shape interpolation for blending between target poses.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
comicbookstart.ma objects and layers
Creating Blend Shape Deformer Animation In the following tutorial steps you will be working with the blend shape deformer to create blend shape animation using provided target objects. 1 Open comicBookStart.ma scene file ■ Start Maya ■
Select File → Open Scene ... Navigate to the location on your hard drive where you have copied the project files from the CDROM. The scenes directory is where you will find maya scene files.
■
Select comicbookstart.ma
■
Press Open
This file contains several objects and groups of objects: comicBookBase bowPoses servePoses
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
heartBeatPoses otherPoses Open the Outliner to view these object groups as well as lighting and camera objects. These objects are actually groups of objects. In the Outliner you can LMB on the + sign to the left of the object name to open the nested objects. These objects may be parents of other objects as well. The comicBook object has been texture mapped. Press the 5 key for shaded display, 6 key for texture shaded and the 7 key for textures with lighting in the perspective view. Comic Book Cover Texture If the comic book frontCover texture does not appear on the magazine cover you will need to establish the path to this source image. When you have your project directory setup correctly, sourceimages like this one should be referenced automatically. You may need to establish this path when using these scene files with the evaluation copy of Maya for the first time. ■
In the Hypershade/Visor window select the frontCover material from the Visor’s Materials folder.
frontCover material in the Attribute Editor ■
Use the Attribute Editor to edit the material called frontCover. The frontCover material has a file texture connected to the Color attribute.
■
Navigate to the file1 texture node by pressing on the righthand side arrow button for the Color attribute.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
file1 texture attached to the frontCover Color attribute The Image Name attribute will need the absolute path to the comicBook.iff image located in the sourceimages directory. ■
Click on the folder icon then navigate to the sourceimages directory.
■
Select comicBook.iff and press Open.
You should see the comic book cover texture appear when you are in shaded texture mode. (Press 6)
Blend Shape Targets for Serve Poses
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
2 Create a blend shape between the serve targets and the comicBookBase objects. Create a blend shape relationship between the bow targets and the comicBookBase objects. Selection order is important. ■
In the Layer Bar RMB toggle Visibiltiy for the ServePoses layer to see these objects in the viewport. If the Layer Bar is not visible select Options → Layer Bar from the main menu.
■
In the Outliner open the servePoses group to see its contents. There are several groups each listed in order servePose1, servePose2, etc.... These groups will be the targets for the blend shape.
■
Select these target groups in the Outliner by holding down the Ctrl key and LMB selecting each one or Shift select the top group in the list then the bottom group in the list to select these groups/objects quickly and in order.
■
With the Ctrl key pressed select the comicBookBase group to add this to the selected objects list last.
This order of selection is important. The targets first and the base object last. The order of target selection will also determine the order of target slider or target position in the blend shape. ■ ■
In the Main Menu select Animation as the menu set. (Left hand upper corner) Select Deform → Create Blend Shape ❐ option box. Confirm that Blend Shape is reset to the default values by pressing Reset. The default settings will make “Individual” targeted sliders. But we want to do an “In-Between” blend shape first. Later we will do an “individual” blend shape. Select “In-Between” check box so that it is checked. Press Create to create the blend shape.
■
Open the blend shape editor Select Window → Animation Editors → Blend Shape ... A blend shape slider should be created in this window. Adjust the slider through its range to see the base object morph between the series of target poses.
Blend Shape for Serve In-Between Poses 3 Keyframe the blend shape sliders to animate through the poses By adjusting the slider and keyframing its value you can control the speed in which poses and blends between poses occur.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
To change time LMB drag in the Time Slider time line. The current time field will reflect the current frame. Once a pose has been reached at the proper time, keyframe the slider by pressing the Key button in the blend shape window. ■
Adjust the current time in the time slider. Key the poses for the desired time until you have a rough animation sequence. If you just want a linear progression through the pose set a keyframe at frame 1 with a slider value of 0, change current time to frame 90 and set the slider to a value of 1 and press key. You may have to adjust the Range Slider, expanding the playback range to 1 - 90 frames.
■
Press the play button to see the progression through the poses over time.
Deleting Target Shapes If you are happy with the blend shapes being derived from the targets you can delete the targets and still retain the blend shape animation. The deformation information is retained in the blend shape when you delete blend shape targets. This can reduce the size of your Maya file. To get the deleted target back, you could set the base object in the pose with the blend shape slider then duplicate the base object. To edit the blend shape you will use the same type of selection/action. For example to delete a blend shape slider you would select the target that corresponds to the slider then the base object and then select Deform → Edit Blend Shape → Add/Remove/Swap to edit the blend shape in the manner necessary.
Note:
Two strategies for working with blend shapes Blend shape targets can be used as In-Betweens or as individual targets. ■
In-Between targets With this strategy you create a series of poses that complete a motion. When you create the blend shape you specify “In-Between” in the Create Blend Shape Option Box. This will create a single slider that transitions through each target. This is what you just did to make the comic book serve the ball.
■
Individual targets This strategy involves creating individual movements that can be combined together to form poses. For example you could create a target that just has the arm moved or posed and another target that has the leg moved or posed. When you create a blend shape using the default or individual settings, a slider is created for each target. By combining these two targets you can put the character into the needed poses. This technique allows for reuse of targets to create many different poses by combining them. You need to be careful in selecting how you transform between some poses. They may not be compatible without using some sort of transition pose.
1 Change the Time Slider range If you have created animation and would like the following blendshape animation to occur after the keys you have created then adjust the range slider farther down the timeline ■
If your first blendshape animation runs from frames 1 to 90 then set the range slider to run from 90 to 180. You can do this in the Playback Start Time and Playback End Time fields of the Range Slider. You may have to increase the End Time field to a value greater then your Playback End Time, in this case greater than 180.
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
2 Create “Individual” blend shapes using the bow poses Now you will create a blend shape that uses individual target poses. You will animate the base object by blending in a combination of target poses. ■
On the Layer Bar toggle visibility for the ServePoses to hidden the BowPoses to Visible.
■
In the Outliner open the bowPoses group
■
Shift Select from top to bottom the bowPose groups: headPose, rt_shoulderPose, rt_armPose, etc....
■
Ctrl select the comicBookBase object last.
■
Targets and base should be all selected at this point. Select Deform → Create Blend Shape ❐ to open the option box.
■
Press Reset to reset the options to the default settings. Note that In-Between is not checked. Press Create
Blend Shape for Comic Book Bow below the serve Blend Shape. The default settings for blend shape will create blend shape sliders for each individual target you have selected. Each of these sliders will contribute to the shape of the base object. If the comicBookBase object looks a little chunky texture-wise press 3 to increase the display smoothness. 3 Animate the Blend Shape Adjust and key the individual slider values to form poses that will create animation on the comic book. The targets that have been provided are designed to work for the character to take a bow. ■
Open the blend shape window to view the individual blend shape sliders. Select Window → Animation Editors → Blend Shape ...
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
Adjust each slider to see how they work together. ■
In the same manner as the earlier steps, key the slider value against different frames. Another handy feature of the Blend Shape editor is the KeyAll button. This lets you apply a key on all the sliders at once at the current frame.
Tip:
You can work in a rough manner and clean up the animation in the graph editor. Note that some targets may not flow smoothly into each other and also that some poses will add to each other and require mid-range values to compensate.You may find that you cannot get to a pose without the need for some additional inbetween target poses. The second tutorial that is related to this example explains how to setup the comic book as a character for quickly creating these target poses. 4 Create Blend Shapes using the other provided target objects The scene file also contains two more groups of targets, hearBeatPoses and otherPoses. ■
In the Outliner open the heartBeatPoses groups and the otherPoses groups. To view these targets in the viewport toggle on their respective Layers.
■
Shift Select from top to bottom the heartBeatPoses groups.
■
Ctrl select the comicBookBase object last.
■
Targets and base should be all selected at this point. Select Deform → Create Blend Shape ❐ to open the option box.
■
Press Reset to reset the options to the default settings. Note that In-Between is not checked.
■
Select In-Between so that it is checked. Press Create
■
Repeat this process for the otherPoses group but do not use In-Between.
You should have 4 blendshapes in your scene and the ability to blend the comicBook into many different poses and shapes.
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Blended Comic Book
Heart Blend Shape Applied to the Comic Book Workflows for target creation: Individual 1. Create a pose and then duplicate the comicBookObject group and translate this copy to a place behind your work area. Rename this group to something meaningful about the part of the object you are deforming,( ie. headBending). 2. Reset the clusters back to their default position. 3. Pose the comic book again and duplicate the comicBookObject group again. 4. Repeat this process until you have several target posed groups that will lead into one another and not overlap too much. In-Between 1. Create a pose then duplicate the comicBookObject group, translate this copy to a place behind your work area. Rename this group to a numbered pose to identify the sequence order. 2. Translate the clusters to the next pose in the sequence. 3. Duplicate the comicBookObject group, translate and rename this group to the next numbered sequence. 4. Repeat until the poses have been created to complete the performance.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
Blended Comic Book
Questions? visit www.aliaswavefront.com/tasteofmaya
CONCLUSION The power of Maya’s blend shapes comes from quickly creating morphing and blending between objects of like or disimilar shapes. There are many ways to animate a character in Maya. Each of Maya’s deformers has its strengths and because you can layer these deformers you have several options for getting the shape to go where you want it to go. Blend shape animation can be broken down into two basic techniques: 1. Each portion of the shape is blended individually, this is a common technique for blending facial animation. A blend for each facial muscle. 2. The entire shape is blended into complete poses, happy face, sad face, mouth phonems, and other expression based shapes. Learn How the Target Poses used in this tutorial were created: The Comic Book Setup tutorial further illustrates Maya’s powerful deformer tools. Layering deformers to create a structure that is easy to control is the goal of this tutorial. The target poses used in the bow and serve blend shape were created using the character setup you will learn in the Comic Book Setup tutorial.
12 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Expressions
Expressions 3 Introducing Expressions About expressions
12
Where you create expressions
4 Quick Start
11
13
15
Preparing for the examples
15
Creating a simple expression
17
Controlling multiple attributes of an object Controlling attributes in two objects Controlling attributes conditionally Notes on the predefined time variable
5 Expression Syntax Expressions and MEL
32 43
46 47
49
Static attributes
49
Dynamic attributes
49
Custom attributes Attribute names
50 51
Data types of attributes
51
Assigning a value to an attribute Variables
28
45
Elements of an expression Attributes
23
55
56
Data types of variables Predefined variables Custom variables
57 57
59
Using Maya: Hypergraph, Sets & Expressions
3
Expressions Contents Constants
62
Arithmetic, logic, and relational operators Arithmetic operators
63
Relational operators
65
Logical operators Operator precedence
67 68
Conditional statements if statements
69
69
if-else statements
70
else if statements
71
General syntax rules
73
Comments in expressions Programming features
75
75
Notes for C programmers
75
Expression language keywords Flow control statements Flow control errors String usage
63
76
77
88
90
Shortcut assignment operators
91
Shortcut increment and decrement operators Arrays
93
Boolean symbolic constants Common expression errors
95
Error message format
95
Common error messages
6 Editing Expressions Finding expressions
97
99
99
Finding by expression name Finding by selected object
4
95
100 101
Using Maya: Hypergraph, Sets & Expressions
92
Expressions Contents Finding by item type
102
Using the Selection list
103
Filtering attributes from the Selection list Editing an expression in the text field Deleting and copying text
104
105
105
Clearing the expression text field
106
Reloading an expression’s previous contents Editing an expression with a text editor
106
Using an editor listed in the Editor menu
107
Using an editor not listed in the Editor menu Changing an editor’s operation settings Selecting an editor for default startup Creating a new expression Deleting an expression
106
109
110 110
111
112
Using attribute names in expressions
112
Using attribute name abbreviations
113
Omitting an object name in expressions
115
Combining the abbreviation techniques
116
7 Beyond the Basics
117
How often an expression executes
118
Using custom attributes in expressions
118
Displaying attribute and variable contents Reproducing randomness
123
123
Speeding expression execution
127
Reducing redundant expression execution
130
Removing an attribute from an expression
131
Disconnecting an attribute
132
Displaying disconnected attributes in expressions
132
Connecting an attribute to a symbolic placeholder
135
Using Maya: Hypergraph, Sets & Expressions
5
Expressions Contents Renaming an object
136
Executing MEL commands in an expression Understanding path names
137
140
Understanding unexpected attribute values Values after rewinding Increment operations
141
141 142
Data type conversions
143
8 Particle Expressions
147
Understanding particle expressions
148
Understanding creation expression execution Setting the dynamics start frame
149
Setting attributes for initial state usage Writing creation expressions
149 150
150
Understanding runtime expression execution Writing runtime expressions
152
153
Working with particle attributes
159
Adding dynamic attributes
159
Understanding per particle and per object attributes Understanding initial state attributes
160
162
Example of assigning to a dynamic per particle attribute Example of assigning to a dynamic per object attribute Assigning to a custom attribute
Using creation expression values in a runtime expression Working with position, velocity, and acceleration 178
Working with emitted particles Working with collisions
6
183
183
Working with specific particles
167
169
Assigning to a particle array attribute of different length
Working with color
164
189
Using Maya: Hypergraph, Sets & Expressions
175
172 174
Expressions Contents Assigning to vectors and vector arrays List of particle shape attributes
9 Functions
193
196
203
Understanding functions Function syntax
205
206
Data types
208
Understanding function examples in this chapter Limit functions
209
abs
209
ceil
210
floor clamp
210 211
min
212
max
212
sign
212
trunc
213
Exponential functions exp
214
log
214
log10
215
sqrt
215
Trigonometric functions cosd sin sind tan tand
214
214
pow
cos
208
216
216 218 219 224 224 225
Using Maya: Hypergraph, Sets & Expressions
7
Expressions Contents acos
225
acosd
226
asin
226
asind
226
atan
227
atand
227
atan2
227
atan2d
228
hypot
228
Vector functions
229
angle
229
cross
230
dot
231
mag rot
231 232
unit
233
Conversion functions
234
deg_to_rad
234
rad_to_deg
234
hsv_to_rgb
235
rgb_to_hsv
235
Array functions clear
236
236
size
237
sort
237
Random number functions gauss
239
noise
241
dnoise rand
242 243
sphrand
8
239
244
Using Maya: Hypergraph, Sets & Expressions
Expressions Contents seed
246
Curve functions linstep
249 249
smoothstep hermite
254
General commands eval
259
print
261
system
252 259
263
Other functions and commands
264
Using Maya: Hypergraph, Sets & Expressions
9
Expressions Contents
10
Using Maya: Hypergraph, Sets & Expressions
3
Introducing Expressions Expressions are instructions you type to control an object attribute over time. An attribute is a characteristic of an object, for instance, X scale, Y translate, visibility, and so on. Though you can create an expression to animate attributes for any purpose, they’re ideal for attributes that change incrementally, randomly, or rhythmically over time.
An expression gives the manta ray’s wings a fluid, rhythmic motion.
Expressions
Eric Saindon
Expressions are also useful for linking attributes between different objects— where a change in one attribute alters the behavior of the other. For instance, you can make the rotation of a tire dependent on the forward or backward movement of a car. This chapter has the following topics: •
“About expressions” on page 12
•
“Where you create expressions” on page 13
Using Maya: Hypergraph, Sets & Expressions
11
Introducing Expressions About expressions
About expressions Expressions offer an alternative to difficult keyframing tasks. In keyframing, you set the values of attributes at selected keyframes in the animation, and Maya interpolates the action between the keyframes. With expressions, you write a formula, then Maya performs the action as the animation plays. Expressions are often as simple as a few words or lines. In the following example expressions, note the variation in length and detail (rather than their purpose).
Example Ball.translateX = Cube.translateX + 4;
Example if (frame == 1) Cone.scaleY = 1; else { Cone.scaleY = (0.25 + sin(time)) * 3; print(Cone.scaleY + "\n"); }
Though many expressions look like math or a programming language, you don’t need to be a mathematician or programmer to learn how to use them. If you’re fond of programming, expressions offer unlimited animation techniques that would challenge the skill of keyframing experts. You can use an expression to animate any keyable, unlocked object attribute for any frame range. You can also use an expression to control per particle or per object attributes. Per particle attributes control each particle of an object individually. Per object attributes control all particles of an object collectively. You cannot apply an expression to an attribute already animated with any of these techniques:
12
•
keys
•
set driven key
•
constraint
•
motion path
Using Maya: Hypergraph, Sets & Expressions
Introducing Expressions Where you create expressions •
another expression
•
any other direct connection If you do so, you’ll see an error message in the Script Editor and the Command Line’s response area. Though you can’t control a single attribute with two of the preceding techniques, you can control one attribute with keyframes, another with an expression, another with a constraint, and so on. Also, you can use a single expression to assign values to several attributes of one or more objects.
Where you create expressions You create and edit an expression in the Expression Editor. There are several ways to start the Expression Editor: From the main menu bar or Hotbox, choose Window→Expression Editor.
•
From the Channel Box, click the right mouse button in an attribute text field and select Expressions.
•
From the Attribute Editor, click the right mouse button in an attribute text field and select Create New Expression, Edit Expression, or Expression Editor. You cannot start the Expression Editor from every attribute text field in the Channel Box and Attribute Editor. Use Window→Expression Editor if necessary.
Using Maya: Hypergraph, Sets & Expressions
13
Expressions
•
Introducing Expressions Where you create expressions The Expression Editor follows:
Expression text field
The expression text field expands as you type text, so you can write expressions of unlimited length. You can also edit expressions with a text editor such as jot by selecting it from the Editor pull-down menu above the text field.
14
Using Maya: Hypergraph, Sets & Expressions
4
Quick Start The easiest way to learn about expressions is to work through examples. For this reason, we provide the following introductory lessons. Expressions that control particle attributes are more complex than for other objects. For examples, see Chapter 8, “Particle Expressions.”
You can use an expression to link attributes in different objects—so a change in one attribute alters the behavior of the other.
Expressions
In this chapter, you’ll learn about the following topics: •
“Creating a simple expression” on page 17
•
“Controlling multiple attributes of an object” on page 23
•
“Controlling attributes in two objects” on page 28
•
“Controlling attributes conditionally” on page 32
•
“Notes on the predefined time variable” on page 43
Preparing for the examples A few preparatory steps will simplify your understanding of the examples in this chapter. Before starting the examples, do these steps:
To prepare for the examples: 1
Select Options→General Preferences. Using Maya: Hypergraph, Sets & Expressions
15
Quick Start Preparing for the examples The General Preferences window appears. Drag either side of the General Preferences window to expand its width. You must do this to display the Units tab in the window. 2
Click the Units tab.
3
In the Units tab, make sure Time is set to Film (24 fps). This makes your animation play at the default rate of 24 frames per second.
4
In the General Preferences window, choose the Animation tab.
5
Enter 0 for the starting frame of the Time Slider and the Range Slider, and enter 300 for the ending frame of the Time Slider and Range Slider.
Important For the lessons to work correctly, you must enter 0 for the starting frame of the Time Slider and Range Slider. Press your keyboard’s Enter key after each entry. Rewind the animation to frame 0. After doing the lessons, read “Notes on the predefined time variable” on page 43 for details on why the lessons require the starting frame to be 0. Specifying a range of 300 frames gives ample time to see the effects you’ll create in the examples. 6
In the General Preferences window, click Save and Close.
7
At the top edge of the workspace, select Shading→Smooth Shade All to display all objects you create in the scene with smooth shading. This will enhance the look of the objects you create in the examples.
8
16
From the menu bar, choose Window→Expression Editor to display the Expression Editor.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 9
Make sure these default Expression Editor menu options are selected: Select Filter→By Object/Attribute Name Object Filter→Selected Objects Attribute Filter→All “Finding expressions” in Chapter 6 gives details on these options.
Creating a simple expression The following steps show how to control an attribute of a single object. An attribute is a characteristic of an object, for example, X scale, Y scale, X rotation, and so on. In this example, you’ll learn how to stretch a sphere along its Y-axis by controlling its scaleY attribute as the animation plays.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. This creates a NURBS sphere with an X scale, Y scale, and Z scale of 1. In the Channel Box or elsewhere, name the sphere Ball.
3
Select Display→NURBS Smoothness→Fine to set Ball’s display smoothness to fine resolution. Maya displays the object with extra polygons to make it look smoother in the workspace. This doesn’t affect the underlying model’s geometry. It alters only its display.
4
Rewind the animation to frame 0.
Using Maya: Hypergraph, Sets & Expressions
17
Expressions
2
Quick Start Creating a simple expression
To create the expression: 1
Make sure Ball is selected.
2
Choose Window→Expression Editor to display the Expression Editor. The selected object’s name, Ball, is highlighted in the Objects list of the Expression Editor.
3
Enter ScaleBallHeight in the Expression Name box. Entering an expression name lets you find the expression easily in a later work session if you decide to alter it. Use alphabetical and numerical characters for expression names. If you use space characters or special characters such as a hyphen (-), Maya deletes them or replaces them with an underscore character (_) after you finish creating the expression.
4
Notice the Attributes list. It displays Ball’s keyable, unlocked attributes—the attributes you’ll most likely want to animate with an expression. Use the scroll bar to see the entire list.
5
Enter this expression in the expression text field:
Ball.scaleY = time + 1;
Enter the expression with the same upper and lowercase spelling shown. Entries in the expression field are type case sensitive. The semicolon (;) signifies the end of the expression statement. Each statement in an expression must end with a semicolon. The only exception is when the expression has a single statement. An error message appears in the Script Editor and Command Line’s response area if the expression has incorrect syntax or typing mistakes. Edit text the same way you edit other text fields in Maya.
18
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 6
Click Create to compile the expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. Clicking this button also executes the expression for the current frame. The expression sets Ball’s scaleY attribute to the value of time + 1. Ball.scaleY is the full name of the attribute. A period separates the name of the object and attribute. You must spell them with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. See “Using attribute names in expressions” in Chapter 6 for more details. The word time is a predefined variable in Maya that updates as an animation plays. It contains the elapsed number of seconds from the first frame to the current frame. The value increases with the increasing frame number. At the default animation playback rate of 24 frames per second, time has these values, rounded to four decimal places: Time (seconds)
0
0
1
0.0417
2
0.0833
3
0.125
24
1.0
240
10.0
Expressions
Frame
If you ever need to change the playback rate, you can do so by choosing Options→General Preferences. Expand the General Preferences window, display the Units folder, and choose the desired rate from the Time menu. Regardless of what animation playback rate you choose, you can find the time elapsed in the animation at any frame with this formula:
frame time = --------------rate For example, if the frame rate is 24 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.25. Using Maya: Hypergraph, Sets & Expressions
19
Quick Start Creating a simple expression If the frame rate is 30 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 30, which equals 0.0333. At frame 6, elapsed time is 6 divided by 30, which equals 0.2.
To see the result of the expression: 1
Rewind and play the animation. Ball’s scaleY attribute increases as the time increases: Frame
Time (seconds)
Ball.scaleY (time + 1)
0
0
1
1
0.0417
1.0417
2
0.0833
1.0833
3
0.125
1.125
24
1.0
2.0
240
10.0
11.0
Maya executes the expression each frame. This causes the object size to scale along its Y-axis, stretching its height during playback.
The scaling is smooth because the geometry stretches in synch with the small time increments of the animation playback.
20
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 2
Stop and rewind the animation. Rewinding the animation returns Ball to its original shape. This occurs because the expression executes with time equal to 0. The value of time + 1 is 1, the original scaleY value of Ball.
3
Play the animation. This repeats the increasing scale.
4
Stop and rewind the animation.
5
Close the Expression Editor window. This complete the steps to creating an expression. To further your understanding of expressions, we’ve included the following steps to show how to edit the expression you just completed.
To edit the expression: Suppose you decide that Ball scales too quickly as the animation plays. You can change the expression to see how the animation looks when you scale Ball half as fast. 1
Choose Window→Expression Editor to display the Expression Editor again. You can find the expression you created earlier by: remembering the name of the expression
•
remembering the name of the object and attribute you controlled with the expression
•
examining each expression in the scene that’s controlled by an expression In this example, you’ll find the expression ScaleBallHeight by its name. See Chapter 6, “Editing Expressions” for details on the other methods.
2
Choose Select Filter→By Expression Name.
3
Click ScaleBallHeight in the Expressions list. The expression appears in the expression text field.
Using Maya: Hypergraph, Sets & Expressions
21
Expressions
•
Quick Start Creating a simple expression
Ball.scaleY = time + 1;
4
Change the previous expression to this: Ball.scaleY = time/2 + 1;
Use the same editing techniques you use with other text fields in Maya. By dividing time by 2, you’ll make the Y scaling increase half as fast as with the previous version of the expression. 5
Click Edit to compile the modified expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. After being compiled, the expression executes for the current frame. Clicking the Edit button does the same action as clicking the Create button. The Create button exists only for new expressions. The Edit button replaces the Create button when you display an existing expression.
To see the result of the edited expression: 1
Play the animation. Ball scales its Y dimension half as fast as with the previous expression contents.
2
Stop and rewind the animation. Feel free to experiment with other values in the expression. This concludes the first example. Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
22
name an expression and type it in the expression text field
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object •
compile an expression to a form Maya can execute
•
work with the predefined variable time
•
find an expression you previously created
•
modify an expression
Controlling multiple attributes of an object You can use a single expression to control two or more attributes of an object. In the following steps, you’ll use an expression to increase the X, Y, and Z scale attributes of a sphere as the animation plays.
Expressions
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. This creates a NURBS sphere with an X scale, Y scale, and Z scale of 1.
2
In the Channel Box or elsewhere, name the sphere Planet.
3
Select Display→NURBS Smoothness→Fine to set the Planet’s display smoothness to fine resolution.
4
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
5
Rewind the animation to frame 0.
To create the expression: 1
Select the Planet object. Planet becomes the selected object in the Expression Editor.
2
In the Expression Editor, enter ScalePlanet in the Expression Name box. Using Maya: Hypergraph, Sets & Expressions
23
Quick Start Controlling multiple attributes of an object This names the expression so you can find it more easily later. 3
Enter these statements in the expression text field:
The expression has three statements. Each statement sets an attribute to the value of the predefined variable time. 4
Click Create to compile the expression. An error message appears in the Script Editor and Command Line’s response area if the expression has incorrect syntax. Planet disappears because clicking Create also executes the expression at the current frame after compiling. At frame 0, time is 0, so the value of the scaleX, scaleY, and scaleZ attributes becomes 0. Planet has no size, so it disappears.
To see the result of the expression: 1
Play the animation. The expression executes each frame, so Planet grows quickly as the animation plays.
24
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object
Because animation playback increases time, the value of Planet’s scaleX, scaleY, and scaleZ attributes increase at the rate of the increasing time. The object increases its scale until the last frame of the Time Slider plays. 2
Stop and rewind the animation. The following two series of steps show how to see the same result with other methods.
To see the result by linking attribute values: 1
Change the expression to this: Expressions
Planet.scaleX = time; Planet.scaleY = Planet.scaleX; Planet.scaleZ = Planet.scaleX;
2
Click Edit to compile the expression.
3
Play the animation. The expression works the same as the previous one. The first statement sets Planet.scaleX to the value of time. The second statement sets Planet.scaleY to the value of Planet.scaleX. Because you’ve set Planet.scaleX to the value of time, Planet.scaleY also has the value of time. You’re simply transferring one attribute’s value to another. The third statement also sets Planet.scaleZ to the value of the attribute Planet.scaleX.
Using Maya: Hypergraph, Sets & Expressions
25
Quick Start Controlling multiple attributes of an object The advantage of this expression is that if you assign a different value to Planet.scaleX in the first statement, the second and third statements automatically receive the new value. In other words, you’ve linked Planet.scaleY and Planet.scaleZ to the value of Planet.scaleX—whatever its value is. 4
Stop and rewind the animation.
5
In the first statement of the expression, divide time by 5 as follows: Planet.scaleX = time/5; Planet.scaleY = Planet.scaleX; Planet.scaleZ = Planet.scaleX;
6
Click Edit to compile the expression.
7
Play the animation. Planet increases its scale attributes one-fifth as fast of the previous expression. By assigning the value of Planet.scaleX to Planet.scaleY and Planet.scaleZ, Planet.scaleY and Planet.scaleZ were automatically assigned the value time/ 5 in the second and third statements.
8
Stop and rewind the animation. You can get the same result using a variable in an expression.
To see the results using a variable: 1
Change the expression to this: float $increment; $increment = time/5; Planet.scaleX = $increment; Planet.scaleY = $increment; Planet.scaleZ = $increment;
The expression has the same result as the previous one. The first statement defines a variable named $increment to be used as storage for the value of a time increment. You define it as a floating point number—a number that can have a decimal point. The second statement assigns $increment the value of time divided by 5. As the animation plays and the time increases each frame, the value of $increment increases by the value of time divided by 5. The $increment therefore increases in smaller units than time increases.
26
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object The next three statements assign the contents of $increment to the three scale attributes of Planet. The scale attributes therefore receive the value of time divided by 5 each frame. This makes the object increase uniformly in scale slowly as the animation plays. 2
Click Edit.
3
Play the animation. The result is the same as with the previous expression
4
Stop and rewind the animation. You can make a change to the variable assignment in the second statement without altering the other statements.
To modify the variable: 1
Change the expression to this: float $increment; $increment = time * 2; Planet.scaleX = $increment; Planet.scaleY = $increment; Planet.scaleZ = $increment;
Click Edit.
3
Play the animation. Because you assigned time * 2 to the variable $increment, the expression sets all three attributes to the value of time * 2 as the animation plays. This makes the three scale attributes increase at a rate twice as fast as would occur if you assigned them the value of time alone.
4
Stop and rewind the animation. This concludes the example. Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
link multiple attributes of the same object with a single expression
•
use a variable you defined in an expression
•
modify a single assignment to an attribute without changing other statements
Using Maya: Hypergraph, Sets & Expressions
27
Expressions
2
Quick Start Controlling attributes in two objects
Controlling attributes in two objects You can write an expression to control attributes in two or more objects. In the following steps, you’ll create a cylinder and cone, then rotate each around its local X-axis as the animation plays. In other words, each object will spin around in place.
To see an object’s local rotation axes, select the object, then choose Display→Object Components→Local Rotation Axes.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Cone.
2
In the Channel Box or elsewhere, name it Cone.
3
Choose Primitives→Create NURBS→Cylinder from the Modeling menu.
4
In the Channel Box or elsewhere, name the cylinder Can. The exact translation and scale of Cone and Can is unimportant in this example. Give them roughly the same translation and scale as in the above figure.
5
Select both objects, then choose Display→NURBS Smoothness→Fine. This sets the display smoothness of both objects to fine resolution.
28
6
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
7
Rewind the animation to frame 0.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes in two objects
To create the expression: 1
Select Can. To control attributes in both objects, you can select either object to write the expression. In fact, any object or node in a scene can be selected when you write an expression to control an object other than a particle object. For details on creating expressions to control particles, see Chapter 8, “Particle Expressions.”
2
In the Expression Editor, enter RotCanAndCone in the Expression Name box. This names the expression so you can find it more easily later.
3
Enter this expression: Can.rotateX = time * 10; Cone.rotateX = time * 10;
This assigns Can’s rotateX attribute and Cone’s rotateX attribute to the value of time multiplied by 10. 4
Click Create to compile the expression.
To see the results: 1
Play the animation. Expressions
Each object rotates around its local X-axis by the degree value resulting from time * 10. After 1 second, for example, the rotateX attribute of each object is one degree times 10, or 10 degrees. After 2 seconds, it’s 2 degrees times 10, or 20 degrees. Maya works in degree angle units, by default. You can change the angular units to radians by choosing Options→General Preferences and displaying the Units folder.
Using Maya: Hypergraph, Sets & Expressions
29
Quick Start Controlling attributes in two objects With the animation playing at 24 frames per second, each object’s rotateX attribute has these values: Frame
Time
Can.rotateX (degrees)
0
0
0
1
0.0417
0.417
2
0.0833
0.833
3
0.125
1.25
24
1.0
10
240
10.0
100
The values in this chapter are rounded to four significant digits. The actual values might have many more digits. To see the degree value of Can.rotateX at different frames, select Can, display the Channel Box, and stop the animation at selected frames. The Channel Box updates its values after you stop the animation. To see the degree value of Cone.rotateX at different frames, select Cone instead of Can. The Channel Box displays values for the selected object. 2
Stop and rewind the animation. You can edit the expression to make Can rotate slower than Cone.
To get different results: 1
Change to the expression to this: Can.rotateX = time * 5; Cone.rotateX = time * 10;
2
Click Edit to compile the expression.
3
Play the animation. Can rotates half as fast as Cone as the animation plays.
30
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes in two objects
4
Stop and rewind the animation.
5
Close the Expression Editor window. This concludes the example. This example showed how to write a single expression to control attributes of two different objects. However, you could have written two expressions, one that rotates Can and one that rotates Cone. The advantage of creating separate expressions is that you’ll have two expression names, each presumably named after the object and attribute you’re controlling. Having two expression names makes it easier to find the expression that controls the desired attribute.
Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
control rotateX attributes in two objects using the same expression
•
increase the rotation of each object in synch with animation time
•
rotate one object at half the speed of the other object
Using Maya: Hypergraph, Sets & Expressions
31
Expressions
The advantage of using a single expression to control the attributes is that all statements are in a single expression. You don’t need to edit two expressions.
Quick Start Controlling attributes conditionally
Controlling attributes conditionally You can write an expression that takes different actions depending on the value of attributes or variables it examines as an animation plays. In the following steps, you’ll increase the scale of a sphere for the first two seconds of animation, then stop scaling and move it in a global Y-axis direction for the remainder of the animation.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. By default, this creates a NURBS sphere at the origin with an X scale, Y scale, and Z scale of 1.
2
From the Channel Box or elsewhere, name the sphere Balloon.
3
Select Display→NURBS Smoothness→Fine to set Balloon’s display smoothness to fine resolution.
4
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
5
Rewind the animation to frame 0.
To create the expression: 1
Select Balloon.
2
In the Expression Editor, enter RisingBalloon in the Expression Name box.
3
Enter this expression: if (time < 2) Balloon.scaleY = time;
This expression is an if statement. The if keyword causes the expression to make a decision based on a comparison of two or more items. In this case, the expression compares the value of time to the value 2.
32
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally
Important When you compare the value of time to a number in an expression, Maya interprets time as seconds rather than milliseconds, minutes, or any other unit of time. In the example, Maya interprets 2 as 2 seconds. The expression checks whether the value of time is less than two seconds. If so, it does the assignment Balloon.scaleY = time. If time is not less than two seconds, the assignment doesn’t occur. Notice the indentation of Balloon.scaleY = time under if (time < 2). Maya ignores all indentation, extra spaces, and blank lines between statements. We used the indentation to make the expression easier to read. You could have also written the expression as follows: if (time < 2) Balloon.scaleY = time;
This isn’t as easy to read. Consistent, organized spacing is a good habit to develop. This book shows examples of good spacing style. 4
Click Create to compile the expression. Balloon flattens. Expressions
The expression executes when you click the Create button. Because the animation is at frame 0, animation time is 0. Because time is less than 2, Maya sets Balloon.scaleY equal to the value of time, which equals 0. A scaleY value of 0 flattens the object in the Y dimension. 5
Play the animation. The flattened Balloon’s scale increases along its Y-axis. It inflates as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
33
Quick Start Controlling attributes conditionally
At 2 seconds, Balloon stops inflating. An expression executes each frame as an animation plays. The if statement sets the scaleY attribute of Balloon to the value of time each frame when the time is less than 2. When time equals 2 or more, the if condition is no longer true. The statement that follows it, Balloon.scaleY = time, no longer executes. The value of the scaleY attribute stays at the last value it had before time became 2, specifically, 1.9583. At 2 seconds of animation time and every moment thereafter, scaleY continues to be 1.9583. Recall that this example uses a frame rate of 24 frames/second. The time and Balloon.scaleY have these values at various frames: Frame
Time (seconds)
Balloon.scaleY (time)
0
0
0
1
0.0417
0.0417
2
0.0833
0.0833
3
0.125
0.125
24
1.0
1.0
47
1.96
1.9583
48
2.0
1.9583
49
2.04
1.9583
The if statement’s condition, (time < 2), is a comparison. The condition must be surrounded by parentheses to isolate it from assignment that follows it.
34
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally The < in the condition is a relational operator. A relational operator tests how one value relates to another. In the example, the < tested whether time is less than 2. Besides the < operator shown in this example, there are several other relational operators such as >, >=, ==, and so on. See “Arithmetic, logic, and relational operators” in Chapter 5. 6
Stop and rewind the animation. Balloon flattens again because the scaleY attribute becomes 0 when you rewind the animation. Time is 0, so scaleY is 0. You can make Balloon rise after it inflates by adding a second if statement to the expression.
To add another if statement to the expression: 1
Change the expression to this: if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time;
Click Edit to compile the expression.
3
Play the animation. Balloon inflates for 2 seconds. After 2 seconds, Balloon stops inflating and its position skips from a Y-axis position of 0 to 2. You’ll eliminate the motion skip in a later step. The second if statement increases the translateY position of Balloon after the animation time rises above two seconds. The >= symbols mean greater than or equal to. Whenever time is greater than or equal to 2, the expression assigns Balloon’s translateY the value of time. The translateY value therefore increases for the rest of your animation’s playback range. Notice that a semicolon ends each statement. Forgetting a semicolon after each statement causes a syntax error, and the changes you’ve made to the expression won’t take effect.
Using Maya: Hypergraph, Sets & Expressions
35
Expressions
2
Quick Start Controlling attributes conditionally
Important Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might make you believe your editing changes took effect. 4
Stop and rewind the animation. Balloon flattens but doesn’t return to the origin. (If Balloon has risen out of view, adjust your camera to see it.)
Balloon doesn’t return to the origin because the expression doesn’t assign Balloon a starting point for the beginning of the animation. 5
To make Balloon return to the origin, change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time;
The new first statement sets Balloon.translateY to 0 whenever time equals 0. The == symbols mean is equal to. In conditional statements, be careful to type == rather than =. The = symbol means assign the value to.
36
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally Note that you can put the three statements in any order in this example. When Maya plays each frame, it executes each statement in the expression in the order listed. In this example, the statements work independently, so their order doesn’t matter. We put the statements in the order of time execution because it’s easier to see the logic of the expression. If you ever need to change the expression, you’ll be able to grasp the expression’s actions more quickly. 6
Click Edit.
7
Stop and rewind the animation again. The flattened Balloon returns to its correct position at the origin.
8
Play the animation. Balloon inflates for two seconds, then rises. Expressions
As mentioned before, Balloon skips from Y-axis position 0 to 2 after two seconds of animation play. You can eliminate the skipping and make Balloon rise smoothly from the origin.
To eliminate the motion skip: 1
Stop and rewind the animation.
2
Change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time - 2;
3
Click Edit.
4
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
37
Quick Start Controlling attributes conditionally Balloon inflates for 2 seconds, then rises slowly with time from its position at the origin. When time is greater than or equal to 2, the translateY position of Balloon becomes 2 minus 2, which is 0. As time increases beyond 2 seconds, the translateY position increases in the same increments that time increases.
5
Stop and rewind the animation. The expression achieved the desired result, but it’s more complicated than necessary. You can use an if-else statement to make the statement more compact and easier to read.
To use an else statement instead of multiple if statements: 1
Change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; else Balloon.translateY = time - 2;
2
Click Edit.
3
Play the animation. The else keyword sets Balloon.translateY to time - 2 when (time < 2) is false. In English terms, the combination of the if and else statements says, “If time is less than two seconds, set Balloon.scaleY to the value of time. Otherwise (when time is greater than or equal to two seconds), set Balloon.translateY to time minus two.”
38
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally At any instant in the animation’s playback, either Balloon.scaleY = time executes or Balloon.translateY = time - 2 executes. Under no circumstances can they both execute. The else statement executes only when the if condition that precedes it is false. Note that we added a blank line between the first if statement and the if-else statement combination. This has no effect on the execution of the statements. We put it there to emphasize that the two if statements are unrelated. The first if statement executes whenever time equals 0. It is unrelated to the if-else statements. Using else statements instead of multiple if statements makes an expression simpler to read. If you use an if-else construction instead of a lengthy list of if statements, you’ll also improve the execution speed of the expression. This improves your animation’s playback and rendering speed. Either expression is valid. If using the if-else construction seems confusing, stick with multiple if statements. You can accomplish most expression animation tasks with several if statements strung after one another. 4
Stop and rewind the animation. You can refine the expression to make it even easier to read. Expressions
To make the expression easier to read: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time; } else Balloon.translateY = time - 2;
We removed this statement from the previous version of the expression: if (time == 0) Balloon.translateY = 0;
In its place, we put the statement Balloon.scaleY = time in a segment enclosed by the braces { and }. Maya evaluates both the statements between the braces if the condition (time < 2) is true. 2
Click Edit. Using Maya: Hypergraph, Sets & Expressions
39
Quick Start Controlling attributes conditionally 3
Play the animation. The animation plays exactly as before with the new expression. When the animation time is less than two seconds, not only does Maya set Balloon.scaleY to time, it sets Balloon.translateY to 0. Balloon has a position at the origin until the animation time is greater than or equal to 2 seconds. Setting Ball.translateY to 0 here instead of in a separate if statement makes the expression easier to read and comprehend. As in the previous version of the expression, if time is greater than or equal to 2, Maya executes the else statement. Note that you can put multiple statements between braces for an else statement, just as you do for an if statement.
4
Stop and rewind the animation. You can further refine the animation’s appearance by expanding Balloon more slowly.
To slow Balloon’s expansion: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2;
Only one statement is different, Balloon.scaleY = time * 0.6. The asterisk (*) multiplies time by 0.6.
40
2
Click Edit.
3
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally
The scaleY attribute increases at 60% of the value of time, so Balloon expands slower during playback. (The number 0.6 equals 60%.) By the time Balloon starts to rise, it has expanded to the size of a typical balloon. How do you know whether to multiply time by 0.6 or some other number? You don’t. In cases like this, you need to experiment. For example, you might multiply by various percentages such as 0.2, 0.5, 0.75, and finally 0.6. The 0.6 creates a life-like balloon shape at two seconds. 4
Stop and rewind the animation. You can further refine Balloon’s appearance by eliminating the flattened Balloon that appears at the origin when you rewind the animation. You can also scale Balloon at different rates along each of its three axes. Expressions
To further refine Balloon’s appearance: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; Balloon.scaleX = time * 0.5; Balloon.scaleZ = time * 0.5; } else Balloon.translateY = time - 2;
2
Click Edit. Balloon disappears from view because its scale attributes are 0. The scaleX, scaleY, and scaleZ attributes are 0 at frame 0 because time is 0. Any number multiplied by 0 is 0.
3
Play the animation. Using Maya: Hypergraph, Sets & Expressions
41
Quick Start Controlling attributes conditionally As time increases, the value of Balloon’s scale attributes increase. Because the expression sets scaleX and scaleZ to 50% of the value of time, these dimensions scale slower than scaleY, which is set to 60% of the value of time. Balloon scales faster in height than in width or depth. This is true for many real balloons.
4
Stop and rewind the animation. This concludes the example.
Summary Using an expression is a combination of logic and experimentation. Problem solving starts with breaking a task into smaller problems you can solve and later refine. In this lesson, you learned how to:
42
•
control an attribute conditionally with an if statement
•
use good spacing and indentation for expressions
•
use relational operators such as <, <=, and ==
•
use multiple if statements to control different conditions
•
use an if-else statement in place of multiple if statements to make an expression easier to read and comprehend
•
refine an expression with a combination of analysis and experimentation
Using Maya: Hypergraph, Sets & Expressions
Quick Start Notes on the predefined time variable In the preceding examples we didn’t include comments in expressions because we explained them line by line. When you write your own expressions, include comments with statements to help document how the expression works. This will help you or someone else understand how your expression works later if the need to enhance it arises. See “Comments in expressions” in Chapter 5.
Notes on the predefined time variable The lessons in this chapter use a starting frame number of 0. In your work, you’ll typically create an animation with a starting frame number of 1. Because the examples use Maya’s default frame rate of 24 frames per second, time is 0.0417 at frame 1. Because of this small offset from 0, the examples would have required more steps and instructions to work with frame 1 as the starting frame. For instance, in the first example of the chapter, suppose you set the starting frame of the animation to 1. The expression in the example follows: Ball.scaleY = time + 1;
This discrepancy means the Ball scaleY is larger than its scaleX and scaleZ attributes in the first frame of the animation. Though the difference is not substantial in this example, other cases might be more significant. To start your animation at frame 1 and get the same result as the example, you can subtract 0.0417 from the attribute: Ball.scaleY = (time - 0.0417) + 1;
When you rewind the animation, the expression sets Ball’s scaleY value to (0.0417 - 0.0417) + 1. This equals 1, its original scaleY value. When you use the predefined time variable, be aware of the starting frame number and the associated time value.
Using Maya: Hypergraph, Sets & Expressions
43
Expressions
If you rewind the animation, the expression executes and sets the initial value of Ball’s scaleY attribute to time + 1, which equals 0.0417 + 1, or 1.0417. Because Ball’s scaleY attribute was 1 when you created it, rewinding the animation sets scaleY to a value 0.0417 larger than its initial value.
Quick Start Notes on the predefined time variable After doing the lessons in this chapter, remember to change your Time Slider’s starting frame, ending frame, and frame rate to the desired values when you start other projects. To do this, select Options→General Preferences and display the appropriate tabs in the General Preferences window.
44
Using Maya: Hypergraph, Sets & Expressions
5
Expression Syntax Expressions use the syntax of the Maya Embedded Language (MEL). Though MEL is a scripting language, you’ll find the syntax easy to learn even if you’ve never programmed. Mastering the rules of syntax is essential to writing expressions without errors.
Tristan Ikuta
This chapter describes the following topics: •
“Expressions and MEL” on page 46
•
“Elements of an expression” on page 47
•
“Attributes” on page 49
•
“Variables” on page 56
•
“Constants” on page 62
•
“Arithmetic, logic, and relational operators” on page 63
•
“Operator precedence” on page 68
•
“Conditional statements” on page 69
•
“General syntax rules” on page 73
•
“Comments in expressions” on page 75 Using Maya: Hypergraph, Sets & Expressions
45
Expressions
You can use an expression to rotate each child joint based on the root joint’s keyframed rotation.
Expression Syntax Expressions and MEL •
“Programming features” on page 75
•
“Common expression errors” on page 95
Expressions and MEL Expressions have a different purpose from MEL commands and MEL scripts. You enter a MEL command to do a single action, for example, to create a sphere. A MEL script is a list of commands you create to do a sequence of actions, for instance, create a wall-shaped object and apply a brick texture to it. Because you store a MEL script in a file on disk, you can run a script in different scenes and different work sessions, whether today or next year. An expression animates one or more attributes over time in a single scene. By default, an expression executes each frame as an animation plays. After you create an expression, it executes whenever you play the animation— including when you play the animation after saving, closing, and reopening the scene. A MEL command or script is not part of a scene after you execute it. You must execute it again to repeat the action. Sometimes it’s useful to exectute MEL commands and scripts in expressions. See “Executing MEL commands in an expression” on page 137 for details. Action
Typical use
MEL command
Does one action
MEL script
Does several actions
Expression
Animates attribute values as an animation plays
The following pages describe expression syntax elements such as arithmetic operators you can use to set and compare attributes. If you have trouble understanding the syntax descriptions, refer to a C programming guide for beginners. Except for attribute names, the syntax elements have the same definitions as their counterparts in C. Attribute names do not exist in C. If you’re familiar with a programming language such as C, Pascal, or Basic, be sure to see “Programming features” on page 75.
46
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Elements of an expression
Elements of an expression An expression is made of one or more statements. Statements follow the rules of algebra, so they’ll seem familiar if you’ve studied math. Each statement has several elements as in the following example: Assignment operator Arithmetic operator Attribute name
Function Constant
Ball.rotateZ = sin(time) + 6;
Terminator
Statement Variable
Detailed explanations follow the summary definitions: Attribute name The name of the attribute set by the statement. In the
example, Ball.rotateZ is the attribute name of the rotateZ attribute of an object named Ball. Assignment operator
A special word that you provide with an entry called an argument. In this example, the argument is time. Based on the value of the argument, Maya does a calculation for the function and returns a new value or takes some other action. In the example, the function sin(time) returns the sine of the value of time, which evaluates to a number between -1 and 1. Maya has many convenient built-in functions and commands that do math calculations, conversions, and so on. See Chapter 9 for details.
Using Maya: Hypergraph, Sets & Expressions
47
Expressions
Function
The = to the right of an attribute name. This symbol assigns the attribute the result of the statement on the right side of =. In the example, Ball.rotateZ receives the value of the statement sin(time) + 6. (Ignore what this assignment does; it’s for illustration only.) You can also use = to assign a value to a variable.
Expression Syntax Elements of an expression A variable is a symbolic name that stands for a changing value. You can assign a value to a variable or read a variable’s value. The variable time is a predefined Maya variable that contains the animation time at the current frame. You can read but not set the value of time.
Variable
Arithmetic, logic, or relational operator An operation such as + or < (less than). Constant
An unchanging number, for example, 6.1 or 90.
Terminator
A semicolon (;) that marks the end of a statement. An expression can have an unlimited number of statements. You must end each statement with a semicolon.
Each expression usually has an attribute name, assignment operator (=), expression value assigned to the attribute, and a statement terminator (;). Other elements are optional.
Example Here’s an expression with the fewest elements possible: Value assigned
Ball.scaleY = 5;
The expression has an attribute, assignment operator (=), value assigned to the attribute, and a statement terminator (;). The expression sets Ball’s Y scale to 5 grid units. When you play the animation, Ball’s Y scale stays fixed at 5 regardless of the Y scale value you gave it when you created it.
48
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes
Attributes An attribute is a characteristic of an object or other item in a scene. There are many ways to set attributes in Maya—with the Attribute Editor, Channel Box, menu selections, and of course, expressions. You can set attributes to control virtually anything in your animation. There are three types of attributes you work with in Maya: •
static
•
dynamic
•
custom Static and dynamic attributes have a predefined purpose. They are standard attributes Maya provides for objects and items that make up a scene. Custom attributes are attributes you define for an object.
Static attributes Static attributes are attributes an object has by default. They exist the moment you create the object and throughout its lifetime.
Expressions
For example, the transform node of a NURBS sphere has static attributes scaleX, scaleY, scaleZ, rotateX, and so on. You can set the values of these attributes with the Attribute Editor, Channel Box, expressions, and other techniques after you create the object.
Dynamic attributes Dynamic attributes have predefined names and purposes, but Maya adds them to an object in response to your user interface selections. For example, suppose you create a particle object and display its particle shape folder in the Attribute Editor. If you click one of the following buttons in the Add Dynamic Attributes section of the Attribute Editor, Maya adds a dynamic attribute to the node:
Clicking the General button lets you add a custom attribute (see the next topic). Clicking any of the other buttons lets you add one or more dynamic attributes with names that are the same or similar to the button name. Using Maya: Hypergraph, Sets & Expressions
49
Expression Syntax Attributes An object has no dynamic attributes unless your actions cause Maya to add them to the object. By adding only required attributes, Maya runs faster. When you add a dynamic attribute to an object, the attribute appears in the Attribute editor for the selected object or node.
Note Because soft body geometry is a particle shape node coupled with geometry, a soft body has the same static and dynamic attributes as a particle object.
Custom attributes Custom attributes are attributes you optionally add from the New folder of the Add Attribute window.
50
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes Such attributes have no direct effect on any characteristic of an object. They’re often used to control a combination of other attributes. You might also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes. When you add a custom attribute to an object, it appears in the Attribute Editor and Channel Box for the object or node. Though custom attributes are dynamically added to an object, we refer to them as custom to distinguish them from the built-in dynamic attributes. See “Assigning to a custom attribute” in Chapter 8 for details on how to add and use a custom attribute.
Attribute names Static, dynamic, and custom attributes follow the same naming conventions and represent the same types of data. A full attribute name has this format: object.attribute where object is the name of the object node, and attribute is the name of the attribute. A period (.) separates the name of the object and attribute.
See “Using attribute names in expressions” in Chapter 6 for more details.
Example Ball.scaleY
Data types of attributes Each attribute has a data type that specifies the type of values you can use to control it in an expression. This is true for static, dynamic, and custom attributes.
Using Maya: Hypergraph, Sets & Expressions
51
Expressions
You must spell the object and attribute name with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. You cannot spell attribute names with the common English spellings shown in the Attribute Editor or by default in the Channel Box.
Expression Syntax Attributes Attributes you’ll work with in expressions have these data types: Data type
Meaning
Example attribute
Example data
float
floating point numbers
Balloon.scaleY
-2.3333333333
integer
signed whole numbers
Ball.sections
16
Boolean
on or off selection
Ball.visibility
on
The most common attribute data type is floating point. In mathematics, floating point numbers are also called real numbers. Often, such numbers have a decimal point. Booleans are also common data types in attributes. Integer data types are rarely used. Particle shape nodes have these additional attribute data types: Data type
Meaning
Example attribute
Example data
vector array
array of vectors
FireShape.position
<<3.2, 7.7, 9.1>> <<4.5, 9.2, 3.1>> <<3.8, 4.4, 2.1>>
float array
array of floating point numbers
FireShape.lifespan
1.333 1.666 2.333 1.333
Note Scientists often refer to a vector as a quantity that specifies both a magnitude and direction. In Maya, a vector is simply a related group of three floating point numbers that set an attribute or variable.
52
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes Vector array data types are useful for animating position, velocity, acceleration, color, and other particle attributes made of three components. Float array attributes are useful for setting lifespan, opacity, and other particle attributes that have a single number value. Attributes having a vector array or float array data type are also called per particle attributes. See Chapter 8 for details on working with particle attributes. If you have programming experience, note that for vector array data types, Maya represents the specified attribute for each particle of the object with a single element of an array. Each element is made of three floating point numbers. In a float array, Maya represents the specified attribute for each particle with a vector array element that’s a floating point number.
Note In expressions, you must type a vector in double angle brackets (<< >>). For example, type <<3,0,5>> for a vector having 3, 0, and 5 as its left, middle, and right component.
Data types of static and dynamic attributes
Using Maya: Hypergraph, Sets & Expressions
Expressions
Static and dynamic attributes have predefined data types. To learn the attribute’s data type, select the node containing it. In the Attribute Editor, find the attribute name and examine its data format.
53
Expression Syntax Attributes Here’s an example display of attributes with floating point, Boolean, and integer data types:
Floating point
Boolean Integer
A floating point attribute shows a value that includes a decimal point. Most numerical attributes in Maya are floating point. A Boolean attribute has a checkbox or other user interface item for turning it on or off. An integer attribute has no decimal point. Integer attributes are rare in Maya. The data type of an attribute limits what type of value you can enter for the attribute in the Attribute Editor and in expressions. For example, because a directional light’s Depth Map Filter Size attribute is an integer, you cannot enter a decimal point in its text entry box or assign it a decimal quantity in an expression. For a floating point attribute, you can omit the decimal point. The Attribute Editor automatically inserts a decimal point in the attribute’s text field after you press the Enter key. For example, if you type 3 for a floating point entry, the Attribute Editor replaces 3 with 3.0000.
54
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes An expression also automatically converts an integer to a floating point value when appropriate. See “Data type conversions” in Chapter 7 for details. Only particle objects, not geometric objects, have vector array and float array attributes. The static vector array attributes for particle objects are position, velocity, and acceleration. These are also called per particle attributes because you can set the attribute for each particle to different values. Maya has other attribute data types that are irrelevant to the use of expressions. For example, Maya has a matrix data type that is useful only in MEL scripting and API programming.
Data types of custom attributes When you add a custom attribute to an object with Modify→Add Attribute, you choose whether its data type is floating point, integer, Boolean, or vector. Vector attributes are commonly used with particle shape nodes.
Assigning a value to an attribute You assign a value to an attribute using the = assignment operator. Static and dynamic attributes have data types established by Maya. You do not define their data type.
You can assign a value to any attribute. If the attribute is dynamic or custom, though, you must add the attribute to the object before you can assign it a value in an expression. Become familiar with the purpose of an attribute by working with it in the Attribute Editor, Channel Box, or other parts of Maya before assigning it a value in an expression. It’s best to know the behavior you can expect from the attribute in case you write your expression incorrectly.
Note For rigid bodies, you can read but not write the velocity, angularVelocity, and force attributes.
Using Maya: Hypergraph, Sets & Expressions
55
Expressions
Because you choose the data type of custom attributes when you add them with Modify→Add Attribute, you do not define their data type either.
Expression Syntax Variables
Assigning to a float or integer attribute An assignment operation is a statement, so you must terminate it with a semicolon (;).
Examples Cone.scaleY = 5.3;
This assigns 5.3 to the floating point scaleY attribute of Cone. Ball.translateY = time;
This assigns the value of time to the floating point translateY attribute of Ball. Ball.scaleX = Ball.scaleY = Ball.scaleZ = 2;
This assigns 2 to the floating point scaleX, scaleY, and scaleZ attributes of Ball. As the example shows, you can use an assignment operator several times in a statement to set multiple attributes to the same value.
Assigning to a vector attribute You can assign values to all three components of a vector attribute, or just to a single component. See “Assigning to vectors and vector arrays” in Chapter 8 for details on assigning values to vector attributes. Only particle shape nodes have vector attributes. Note that you cannot assign a vector to three related scalar attributes such as scaleX, scaleY, and scaleZ. For example, you can’t do this: Ball.scale = <<1,2,0>>;
You must assign to each attribute separately: Ball.scaleX = 1; Ball.scaleY = 2; Ball.scaleZ = 0;
Variables A variable is a symbolic name that stands for a constant or changing value. There are two types of variables, predefined and custom. Maya creates and maintains predefined variables. Custom variables are variables you can create to store data in an expression.
56
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables Keep in mind that attributes, not variables, set object and component behavior in Maya. You can use variables to as temporary storage for working with the attributes.
Data types of variables Variables can be one of these types of data: Data type
Meaning
Examples
Defining keyword
float
floating point numbers
392.6, -0.667
float
integer
signed whole numbers
10, -5, 0
int
vector
vector made of three floating point numbers
<<3.2, 7.7, 9.1>>
vector
string
one or more characters
“What’s up, chief?”
string
The most common data type of variables is floating point. Integer data types are rarely used. Booleans are commonly used in attributes, but not allowed in variables. Vector variables are useful in expressions for particle shape attributes.
For a custom variable you create in an expression, you must declare the data type as described in “Custom variables” on page 59.
Predefined variables Maya maintains values in two predefined variables as an animation plays: Variable
Contents
Data type
frame
number of frames the animation has played
float
time
time in seconds the animation has played
float
Using Maya: Hypergraph, Sets & Expressions
57
Expressions
Animators with programming experience sometimes use string variables. Quote marks (" ") are required with strings. See “String usage” on page 90 for details.
Expression Syntax Variables Your expressions can read, but not set, the value of time and frame. These variables are floating point values that are useful for animating an attribute as an animation plays. The time updates as an animation plays. It contains the elapsed number of seconds from the first frame to the current frame. The value increases with the increasing frame number. At the default animation playback rate of 24 frames per second, time has these values, rounded to four decimal places: Frame
Time (seconds)
0
0
1
0.0417
2
0.0833
3
0.125
24
1.0
240
10.0
If you need to change the playback rate, choose Options→General Preferences. Expand the General Preferences window, display the Units folder, and choose the desired rate from the Time menu. Regardless of what animation playback rate you choose, you can find the time elapsed in the animation at any frame with this formula:
frame time = --------------rate For example, if the frame rate is 24 frames/second, and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.25. If the frame rate is 30 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 30, which equals 0.0333. At frame 6, elapsed time is 6 divided by 30, which equals 0.2.
58
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables There’s an advantage to writing an expression using the value of time rather than frame: You won’t need to modify your expression if you change your animation’s frame rate. Note that time is always 0 at frame 0. As each frame plays, the time increases in increments resulting from the frame rate. It’s impossible to set time to a value other than 0 at frame 0. If you set Maya’s frame range to begin at a negative number, time has a negative value.
Examples Ball.translateY = time/2;
This sets the Ball’s Y translation equal to the value of time divided by 2 as the animation plays. This make the Ball move in a Y direction as the animation time increases. Ball.scaleY = frame/2;
This sets the Ball’s Y scale equal to the value of frame divided by 2 as the animation plays. The Ball scales along its Y axis as the animation frame number increases.
Custom variables
Though programming languages use such variables abundantly, you might not need to use them at all in many expressions.
Declaring variables Each custom variable name must begin with a dollar sign character ($). After the $, you can use alphabetical, numerical, and underscore characters. You cannot include spaces in the names. Variable names are type case sensitive. In other words, $temp is a different variable name than $Temp.
Using Maya: Hypergraph, Sets & Expressions
59
Expressions
You can declare and use variables to store a constant or changing value. These work like their counterparts in programming languages and spreadsheet programs.
Expression Syntax Variables
Examples float $object_height;
This declares $object_height as a floating point variable. int $counter;
This declares $counter as an integer. vector $top_velocity;
This declares $top_position as a vector variable.
Assigning a value to an integer or float variable To assign a value to a variable, you use = as an assignment operator. An assignment operation is a statement, so you must end it with a semicolon (;).
Examples float $counter = 5.3;
This declares a floating point variable named $counter and gives it an initial value of 5.3. $height = 6;
This declares a floating point variable named $height and gives it an initial value of 6. This example shows you can skip declaring the variable’s data type. When you assign a variable a value, Maya assumes the variable is floating point unless you specify a different data type. $pi = 3.1415927; $twist = $pi;
These statements show you can assign the value of one variable to another variable. The first statement assigns 3.1415927 to $pi. The second statement assigns the contents of $pi, 3.1415927, to $twist.
60
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables
Important If you misspell an existing declared variable name and assign it a value, a syntax error won’t be generated for the undeclared variable. Because Maya automatically provides a data type for an undeclared variable if it’s on the left side of the assignment operator, the misspelled variable will be interpreted as a newly added variable. Undeclared variables on the right side of the assignment operator do generate error messages. Check spellings of variables if your expression isn’t working as expected. In the following example, the misspelling in the final statement generates an error but not the misspelling in the statement before it: int $start; int $end; int $interrupt; $starrrt = 1; $end = $interrupppt;
Assigning a value to a vector variable You can assign values to all three components of a vector variable, or just to a single component. Expressions
See “Assigning to vectors and vector arrays” in Chapter 8 for details on assigning values to vector variables. Such variables are useful for working with particle shape node attributes.
Using custom variables globally Typically, you’ll use variables within a single expression. If you want to create and maintain a custom variable in one expression, but use it in another expression, you must declare it as a global variable.
Example global float $counter;
You can thereafter set or read the value of this variable in any other expression in the scene. If you create a variable with the same name in two expressions, the two variables are separate and unrelated. For example, suppose you create a variable named $timer in two expressions. Assigning a value to one of the $timer variables has no effect on the other’s value. Using Maya: Hypergraph, Sets & Expressions
61
Expression Syntax Constants If you declare and initialize a global variable in a single statement, you can initialize it to a numerical constant or string only.
Examples global float $counter = 3;
This initializes $counter to 3. global float $counter = time;
This causes an error because time is a variable. If you declare and initialize a global variable in a single statement, the statement executes only when Maya compiles the expression. Maya compiles an expression when you click the Create or Edit button in the Expression Editor, or when you open a scene containing a previously created expression.
Example global float $counter = 3; print($counter+"\n"); $counter = 1000; print($counter+"\n");
When Maya compiles the expression, it sets $counter to 3, prints 3, sets $counter to 1000, then prints 1000. During playback, each execution of the expression skips the first statement, so $counter never receives the value 3. The expression prints 1000, sets $counter to 1000 again, and prints 1000 again.
Constants A constant is an unchanging number or variable.
Examples Ball.translateY = 6.1.
This statement sets Ball’s translateY attribute to the constant number 6.1. float $pi = 3.1415927; Ball.rotateY = $pi;
These statements set the value of Ball’s rotateY attribute to the value of the variable $pi. The variable $pi represents the constant 3.1415927.
62
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators
Arithmetic, logic, and relational operators You can use the following operator symbols to add, subtract, multiply, compare, and do other actions to variables and attributes.
Arithmetic operators Symbol
Meaning
Used with these data types
+
plus
integer, float, vector, string
-
minus or negation
integer, float, vector
*
for integers and floats: multiply for vectors: dot product
integer, float, vector
/
divided by
integer, float
%
remainder of division
integer, float
Integers and floats
Examples Car.translateX = time / 2.0;
This moves the Car in an X direction as the time increases in the animation. By dividing time by 2.0, you move the object half as fast as if you used time alone. Car.translateX = 7 % 3;
This assigns Car.translateX the value 1, the remainder of 7 divided by 3. The number 7 divided by 3 equals 2 with a remainder of 1. Car.translateX = 8.8 % 4.2;
This assigns Car.translateX the value 0.4, the remainder of 8.8 divided by 4.2. The number 8.8 divided by 4.2 equals 2 with a remainder of 0.4. Car.translateX = 0.5 % 3;
Using Maya: Hypergraph, Sets & Expressions
63
Expressions
For integer and floating point attributes and variables, the above arithmetic operators work according to the rules of basic math. Note that the modulus operator (%) calculates the remainder of division.
Expression Syntax Arithmetic, logic, and relational operators This assigns Car.translateX the value 0.5, the remainder of 0.5 divided by 3. The number 0.5 divided by 3 equals 0, with a remainder of 0.5.
Vectors For operations between vector attributes and variables, the * operator performs the dot product. The dot product multiplies corresponding components of each vector, then adds the components to create a single floating point number result. For + and - operators, each component of one vector is operated on by its counterpart component in the other vector. For operations between a vector and an integer or floating point number, each component of the vector is operated on by the integer or floating point number.
Examples Suppose you’ve initialized these vectors: vector $A = <<1,2,3>>; vector $B = <<2,3,4>>; vector $C; float $myfloat;
You then use the following statements (in different expressions, not in sequential order): $C = $A + $B;
This assigns $C the value << 3, 5, 7>>. $C = $B - $A;
This assigns $C the value <<1, 1, 1>>. $myfloat = $A * $B;
This assigns $myfloat the value (1*2) + (2*3) + (3*4), which equals 20. Multiplying two vectors gives the dot product of the vectors. $C = 3 * $A;
This assigns $C the value <<3, 6, 9>>. Each component of the vector is multiplied by 3 to create a vector result.
64
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators
Strings For details on how to use the + operator with strings, see “String usage” on page 90.
Note Maya handles integer and Boolean attributes in an expression mathematically as floating point numbers. After the expression executes, Maya converts the floating point number to the proper data type. If your expression does arithmetic on an integer or Boolean attribute and you display the attribute’s contents in the Script Editor, you’ll see floating point values. After the expression executes, Maya assigns an appropriate integer or Boolean value to the attributes you set in the expression text field. Maya handles integer and Boolean variables within an expression mathematically as integer and Boolean data types.
Relational operators You’ll often use relational operators to compare the value of variables and attributes in conditional statements. See “Conditional statements” on page 69. Meaning
Used with these data types
<
less than
integer, float, vector
>
greater than
integer, float, vector
==
equal to
integer, float, vector
!=
not equal to
integer, float, vector
>=
greater than or equal to
integer, float, vector
<=
less than or equal to
integer, float, vector
Expressions
Symbol
Integers and floats For integer and floating point attributes and variables, the above relational operators work according to the rules of algebra.
Using Maya: Hypergraph, Sets & Expressions
65
Expression Syntax Arithmetic, logic, and relational operators
Examples if (time > 10) Sphere.translateX = 3;
When the animation time is greater than 10 seconds of play, the expression sets the Sphere’s translateX attribute to 3. It stays fixed in this position thereafter. See “Conditional statements” on page 69 for details on the if condition in this and following examples. if (Ball.scaleY == 3) Cone.scaleY = 6;
If Ball’s scaleY attribute is equal to 3, Maya sets Cone’s scaleY attribute to 6.
Important Be careful to type == rather than = for the equal to operator. For example, suppose you type if (Ball.scaleY = 3) in the previous example. Rather than test whether Ball.scaleY is equal to 3, the statement assigns 3 to Ball.scaleY. Maya evaluates the assignment statement Ball.scaleY = 3 as a true condition, so it executes Cone.scaleY = 6. This statement doesn’t cause an error message, but it gives unintended results.
Vectors If you use the == or != operators between two vector attributes or variables, Maya compares the corresponding components of each vector. In contrast, the >, >=, <, and <= operators compare the magnitude of two vectors. Use this formula to calculate a vector’s magnitude: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components of the vector.
Examples vector $A = <<1,2,3>>; vector $B = <<1,2,3>>; if ($A == $B) Sphere.translateX = 3;
66
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Operator precedence Notice that each condition is grouped in parentheses, and the pair of conditions are enclosed again in parentheses. If you use multiple conditions with logical operators, you must enclose all the conditions in parentheses for the if statement. If you omit the outer pair of parentheses as in the following example, an error message occurs: if (time > 5) && (time < 10) Ball.scaleZ = time;
Example 2 if ((Ball.translateX < 5) || (Ball.translateY > 10)) Ball.scaleZ = time;
This sets Ball’s scaleZ attribute to the value of time in either of two conditions: when Ball’s translateX attribute is less than 5 or greater than 10.
Operator precedence The precedence of operators in expressions follows: Highest
() [] ! ++ - * / % ^
+
Lowest
-
< <= > >= == != && || = += -= *= /=
This figure includes operators used mainly by individuals experienced in programming. See “Programming features” on page 75 for details. In the figure, operators on the same row have equal precedence. If a statement has two or more operators from the same row, the operator furthest to the left is evaluated first. The parentheses at the top of the figure are for grouping a condition or elements of a statement. As shown in a following example, parentheses are useful for altering the order of operator evaluation.
68
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Conditional statements
Examples Ball.scaleY = 8 + 2 * 4;
This assigns Ball.scaleY the value 16. Ball.scaleY = (8 + 2) * 4;
This assigns Ball.scaleY the value 40. Ball.scaleY = 8 + 6 - 4;
This assigns Ball.scaleY the value 10. The + executes first because it’s further to the left in the statement than the -.
Conditional statements Conditional statements set one attribute or variable based on the condition of another attribute or variable. For example, you might increase the scale of a balloon after frame 48 plays. The if and if-else statements are the most commonly used conditional statements in expressions. You’ll often use relational and logical operators in conditional statements. See page 65 and page 67 for details. Expressions
If you have programming experience, be aware you can use loop and flow control statements such as while and for. See “Programming features” on page 75.
if statements The if conditional statement has this format: if ( condition ) statement;
If condition is true, statement executes.
Example if (time > 3) Ball.scaleY = 2;
This sets the scale of Ball’s scaleY attribute to 2 after the animation plays three seconds.
Using Maya: Hypergraph, Sets & Expressions
69
Expression Syntax Conditional statements
if-else statements The if-else conditional statement has the following format: if ( condition ) statement1; else statement2;
If condition is true, statement1 executes. Otherwise statement2 executes.
Example 1: Simple if-else statement if (time > 3) Ball.scaleY = 2; else Ball.scaleY = 1;
This sets Ball’s scaleY attribute to 2 if animation time is greater than 3 seconds. If animation time is less than 3, scaleY is set to 1. You can use more than one statement after a condition with this format: if ( condition ) { statement; statement; } else { statement; statement; }
Notice you must enclose the multiple statements between braces ({ }).
Example 2: Braces in if-else statement if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else { Balloon.translateY = time - 2; Balloon.scaleY = 1; }
70
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Conditional statements If the animation time is less than 2 seconds, the expression sets Balloon’s translateY attribute to 0, and sets its scaleY attribute to the value of time multiplied by 0.6. If animation time is greater than or equal to 2 seconds, the expression sets Balloon’s translateY attribute to time minus 2, and sets its scaleY attribute to 1.
Important You cannot set the same attribute in two different expressions. If you try to do so, an error message results and your second expression has no effect.
else if statements The else if statement works with the if-else conditional statement and has this format: if (condition1 ) statement1; else if ( condition2 ) statement2;
If condition1 is true, statement1 executes and the else if statement after it is skipped.
You can add an else condition to the previous format as follows: if (condition1 ) statement1; else if ( condition2 ) statement2; else statement3;
If neither condition is true, statement3 executes.
Using Maya: Hypergraph, Sets & Expressions
71
Expressions
If condition1 is false, the else if statement executes. If condition2 is true, statement2 executes. If neither condition is true, neither statement executes.
Expression Syntax Conditional statements
Example if (time < 3) Ball.scaleY = else if ((time >= 3) Ball.scaleY = else Ball.scaleY =
1; && (time =< 6)) 2; 3;
This sets Ball’s scaleY attribute to 1 if animation time is less than 3 seconds. If animation time is between 3 and 6 seconds, scaleY is 2. Otherwise, when time is greater than 6 seconds, scaleY is 3. Note that you can add multiple else if statements and multiple statements within braces ({ }) using this format: if (condition1 ) { statement; statement; } else if ( condition2 ) { statement; statement; } else if ( condition3 ) { statement; statement; } else if ( condition4 ) { statement; statement; } else { statement; statement; }
72
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax General syntax rules
General syntax rules Use these guidelines to avoid syntax errors while writing expressions: •
Terminate each statement in an expression with a semicolon (;). Here’s an example expression with two statements: if (time < 3) nurbsSphere1.translateX = time/2; else nurbsSphere1.translateX = time*3;
A semicolon marks the end of each statement. •
Enclose each conditional item in an expression within parentheses. In the preceding example, (time < 3) is a conditional item enclosed in parentheses.
•
Match each opening parenthesis with a closing parenthesis. For example, this statement causes an error: Ball.rotateZ = deg_to_rad(-6 * (floor(time));
If you look closely, you’ll see that there are three opening parentheses, but only two closing parentheses. The next statement causes no error: Ball.rotateZ = deg_to_rad(-6 * (floor(time)));
•
Expressions
There are three matching closing parentheses for the three opening parentheses. When you use { and } as opening and closing braces, make sure you use them in matching pairs: if (time > 3) { Ball.rotateZ = deg_to_rad(-6 * (floor(time)); Ball.rotateY = Ball.rotateZ * 3; }
•
Enclose a vector in double angle brackets as in this example: <<3,4,8>>
Spaces before and after the numbers and commas are optional. •
Begin any variable you use with a dollar sign ($), and do not to use spaces or special characters other than underscores in the name. Here’s an acceptable example: float $my_Rotate; $my_Rotate = 3.14;
Using Maya: Hypergraph, Sets & Expressions
73
Expression Syntax General syntax rules •
In conditional statements, be careful to type == rather than = for the equal to operator. The = symbol means assign the value. For example, make sure you type: if (Ball.scaleY == 3) Cone.scaleY = 6;
instead of this: if (Ball.scaleY = 3) Cone.scaleY = 6;
•
You can use as many spaces, tab characters, and blank lines as you like when separating words, operators, or statements. Maya ignores white space in an expression. For example, suppose you’ve written this expression: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2;
Though the following expression has different spacing and is unpleasant to read, Maya interprets the expression the same as the previous one. if(time<2){Balloon.translateY=0; Balloon.scaleY=time*0.6;} else Balloon.translateY=time-2;
You must include at least one space between any two keywords, variables, or attribute names (or combination of these). So a space is required after the else keyword but in no other place in this expression. To simplify spacing considerations, remember to put at least one space before and after a keyword, variable, operator, attribute, assignment operator, and so on. Consistent use of white space makes expressions easier to read. Examples throughout this chapter show examples of good spacing style.
74
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Comments in expressions
Comments in expressions Add comments to your expressions to explain the purpose of each statement within. You’ll appreciate this later if you need to modify the expression. Maya ignores comments.
To add a comment to the right of a one-line statement: Enter two forward slashes (//) at the end of the statement, then enter the comment: Ball.translateX = time; // Moves ball in X dir. with time
To write a multi-line comment: Enter two forward slashes (//) before the comment: // This is an example of a // comment spanning two lines.
Programming features Expressions
The following topics describe programming features available in expressions. Discussion is brief and assumes you’re familiar with programming. Most of the syntax features described work like their C counterparts.
Notes for C programmers Some important differences between expression and C syntax follow: •
A C program consists of one or more functions, each containing multiple statements. An expression is simply a single block of statements. You don’t declare main( ) or your own functions in an expression. You also don’t include the C standard library of functions. You will, though, sometimes include a built-in Maya function such as sin( ) to accomplish time-saving tasks. See Chapter 9, “Functions,” for details.
•
After you type an expression in the Expression Editor, clicking the Create or Edit button compiles the expression.
•
The first character of variables must be a dollar sign ($).
•
ANSI C has 32 keywords. The expression language has less, as listed in the following topic. Using Maya: Hypergraph, Sets & Expressions
75
Expression Syntax Programming features •
Maya’s integer data type has the same numerical range as ANSI C’s integer data type, -2,147,483,648 to 2,147,483,648.
•
Maya’s float data type has the same numerical range as ANSI C’s double data type.
Expression language keywords The expression language keywords follow:
Data type keywords int
float
vector
string
matrix
on
off
true
false
in
Boolean constant keywords yes
no
Flow control keywords if
else
for
while
do
break
continue
default
switch
case
source
catch
alias
Other keywords global
return
proc
The return, proc, and matrix keywords are useful for writing MEL scripts, not for expressions. Other keywords above are described throughout this chapter. Type keywords in lowercase letters exactly as shown. Do not name a custom attribute with any of these keywords.
76
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Flow control statements Besides the if and if-else statements described previously, you can control the flow of statement execution with while, do, for, break, continue, and ?: instructions. These work like their C language counterparts. You’ll often use logical and relational operators in conditional statements. See page 65 and page 67 for details.
Important Using a while, do, or for loop incorrectly might halt Maya. See “Flow control errors” on page 88 for details.
while A while loop has this format: while ( condition ) { statement; statement; ... }
Example float $test = 0; while ($test < 5) { print("$test equals: " +$test+"\n"); $test = $test + 1; }
Using Maya: Hypergraph, Sets & Expressions
77
Expressions
Use condition to compare variable, attribute, or constant values. If condition is true, Maya executes each statement between braces. Maya then evaluates condition again. If true, it executes each statement again. This cycle continues until condition is false, whereupon execution resumes with the statement after the loop.
Expression Syntax Programming features This expression displays the following lines in the Script Editor: $test $test $test $test $test
equals: equals: equals: equals: equals:
0 1 2 3 4
These lines are followed by a status message similar to this: expression -e -s "
" -o Ball -an 1 Expr
This message indicates that a MEL command executed when you clicked the Create or Edit button in the Expression Editor. Specifically, an expression command executed. This is unrelated to the exact statements in the expression.
do A do loop has this format: do
{ statement; statement; ... }
while (condition);
Here Maya executes each statement between braces, then evaluates condition. The condition compares variable, attribute, or constant values. If condition is true, each statement executes again. The loop terminates when condition is false. In contrast to a while loop, a do loop executes the statements in the loop at least once. It tests the termination condition after the loop. A while loop tests the termination condition before executing the statements in the loop.
Example float $test = 0; do
{ print("$test equals: " +$test+"\n"); $test = $test + 1; } while ($test < 5);
78
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features This expression displays the following lines in the Script Editor: $test $test $test $test $test
equals: equals: equals: equals: equals:
0 1 2 3 4
for A for loop has this format: for (initialization; condition; change of condition) { statement; statement; ... }
A for loop evaluates the termination condition before executing each statement. The condition compares variable, attribute, or constant values.
Example float $i;
Expressions
for ($i = 0; $i < 5; $i = $i + 1) { print("$i equals: " +$i+"\n"); }
This expression displays the following lines in the Script Editor: $i $i $i $i $i
equals: equals: equals: equals: equals:
0 1 2 3 4
break The break instruction exits a loop from any point within its body, bypassing the normal termination at the loop’s beginning or end. Expression execution resumes at the next statement after the loop. You can use a break instruction with a while, do, or for loop.
Using Maya: Hypergraph, Sets & Expressions
79
Expression Syntax Programming features
Example float $f = 0; while( $f < 10 ) { print("$f equals: "+$f+"\n"); if ( $f > 5 ) break; $f = $f + 1; }
This expression displays the following lines in the Script Editor: $f $f $f $f $f $f $f
equals: equals: equals: equals: equals: equals: equals:
0 1 2 3 4 5 6
Suppose the example didn’t have this statement: if ($f > 5) break;
The loop would execute ten times and display the numbers 0 through 9. The break statement terminates the loop after $f is greater than 5. So the expression displays only numbers 0 through 6.
continue The continue instruction works inside loops. It forces the next iteration of the loop to occur, skipping any statements between itself and the loop’s test condition. The condition compares variable, attribute, or constant values.
80
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example float $f = 0; for( $f = 0; $f < 10; $f = $f + 1) { print("$f equals: "+$f+"\n"); if( $f > 5 ) continue; print(" got here.\n"); }
This expression displays the following lines in the Script Editor: 0 here. 1 here. 2 here. 3 here. 4 here. 5 here. 6 7 8 9
Expressions
$f equals: got $f equals: got $f equals: got $f equals: got $f equals: got $f equals: got $f equals: $f equals: $f equals: $f equals:
Suppose the example didn’t have this statement: if( $f > 5 ) continue;
The loop would display got here after each line of $f equals: n. Maya ignores the continue instruction until $f increases to a value greater than 5. When $f becomes 6 or greater, the continue instruction executes and skips the remaining statement in the loop, so got here isn’t printed.
for-in The for-in loop is a specialized for loop that simplifies manipulation of all elements of an array. A for-in loop with an array element variable lets you omit the initialization, condition, and change of condition components of a for loop. Using Maya: Hypergraph, Sets & Expressions
81
Expression Syntax Programming features The for-in loop has this format: for (array-element in array) { statement; statement; ... }
Example string $carType[3] = {"Porsche", "Ferrari", "Fiesta"}; string $car; for ($car in $carType) { print("I want a new "); print($car + ".\n"); }
The expression displays this in the Script Editor: I want a new Porsche. I want a new Ferrari. I want a new Fiesta.
The loop executes three times, once for each array element in $carType. The first loop execution copies array element $carType[0] into $car, then prints, “I want a new Porsche.” Array element $carType[0] is Porsche. The second loop execution copies $carType[1] into $car, then prints the second line shown. The third execution copies $carType[2] into $car, then prints the third line shown. When the for-in statement finishes reading all array elements, the loop terminates.
82
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
switch A switch instruction executes one of several groups of statements based on a control value. The control value can be a variable value or an attribute other than an array (per particle) attribute. The format follows:
The switch executes with a variable control-value. If the variable contents match value1, value2, or another value in the switch, the statements under the associated case statement execute. The control-value can be an int, float, string, or vector. Be careful if you use a float control-value. Because of the way floating point arithmetic rounds numerals, a case value might fail to match a control-value as you expect. A break statement within a switch causes execution to skip subsequent case statement groups within the switch instruction.
Using Maya: Hypergraph, Sets & Expressions
83
Expressions
switch (control-value) { case value1: statement; statement; ... break; case value2: statement; statement; ... break; case value3: statement; statement; ... break; ... default: statement; statement; ... break; }
Expression Syntax Programming features
Example 1: Break statement within a switch int $sway = rand(3); switch ($sway) { case 0: print("Case 0\n"); // Executes if $sway = 0 break; case 1: print("Case 1\n"); // Executes if $sway = 1 break; case 2: while (rand(10) < 7)// These statements print("I say!\n");// execute only print("Case 2\n");// if $sway = 2 break; }
When the expression executes a few times, it might display this random selection of entries in the Script Editor: Case 0 Case 1 I say! I say! I say! Case 2 Case 0 Case 1
The last case instruction in a switch doesn’t need a break statement because the switch is finished. Still, it’s best to add the break statement to avoid future problems that might result from adding other cases to the switch. For details on the purpose of rand(3), see “rand” on page 243.
84
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example 2: Omitted break statement within a switch The following expression omits a break statement to make the switch continue execution after the first case: int $argo = rand(2); switch ($argo) { case 0: print("Food\n"); // Runs if $argo is 0. case 1: print("Fight\n");// Runs if $argo is 0 or 1. break; }
When the expression executes a few times, it might display this random selection of entries in the Script Editor: Fight Fight Fight Food Fight Food
Whenever Food appears, Fight also appears after it. Fight can appear without Food being displayed.
int $argo = rand(4); switch ($argo) { case 0: case 1: print("Food\n"); // Runs if $argo is 0 or 1 case 2: case 3: print("Fight\n");// Runs if $argo is 2 or 3 break; }
This works like the preceding expression, except that a match of 0 or 1 displays Food and Fight, and a match of 2 or 3 displays Fight.
Using Maya: Hypergraph, Sets & Expressions
85
Expressions
Note that you can make more than one case statement execute the same statements:
Expression Syntax Programming features
Example You can use the default keyword to make a block of statements execute when none of the case values match the control value label. Generally, you put this label after all the case statements, though you can put it anywhere in the switch statement. If the switch has no default label and none of the case values match the control value, the switch does nothing. vector $mgb = <<1,1,0>>; switch ($mgb) { case <<0,1,1>>: print("Who?\n");// Runs if $mgb is <<0,1,1>> break; case <<1,0,1>>: print("What?\n");//Runs if $mgb is <<1,0,1>> break; default: print("Why?\n"); // Executes if $mgb is not break; // <<0,1,1>> or <<1,0,1>> }
The expression executes the default case, which displays the following line in the Script Editor: Why?
?: operator The ?: operator lets you write a shorthand if-else statement to set an attribute or variable in one statement. Because of its cryptic appearance, many programming style experts suggest not using it. Here’s its format: attribute = condition? statement1: statement2;
The condition compares variable, attribute, or constant values. If condition is true, Maya evaluates statement1 and assigns its value to attribute. (You can also assign the statement’s value to a variable.) Maya evaluates either statement1 or statement2, never both. You can optionally enclose statement1 and statement2 in parentheses to make the expression easier to read.
86
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example Balloon.scaleY = (time < 2) ? time / 2: time * 2;
This statement sets Balloon’s scaleY attribute to time divided by 2 if time is less than 2, and time multiplied by 2 if time is greater than or equal to 2. This causes the scaleY attribute to increase slower for the first two seconds than after two seconds. This is the same as the following if-else statement: if (time < 2) Balloon.scaleY = time / 2; else Balloon.scaleY = time * 2;
Use this format because it’s easier to read.
Important If you use an integer value as statement1 and a floating point value as statement2, the ?: operator truncates the floating point value of statement2 to an integer. In the expression Balloon.scaleY = (time < 2) ? 0: time;, for example, 0 is an integer, and time is a floating point value. When time is 2 seconds or more, Maya sets Balloon’s scaleY attribute to the integer value of time.
If you have problems using the ?: operator, use an if-else statement instead.
! operator You can use the not logical operator (!) with integer, float, and vector data types. For vector values, ! is true only when the vector magnitude is 0. A vector’s magnitude is the value resulting from this equation: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components of the vector.
Using Maya: Hypergraph, Sets & Expressions
87
Expressions
Because Maya sets scaleY to the integer value of time (without the decimal part), scaleY jumps in one-second increments at time 2, 3, 4, and so on.
Expression Syntax Programming features
Examples if (!$count) Ball.scaleY = 2;
The !$count condition is true only if $count is 0. If true, Ball.scaleY is set to 2. vector $myvector = <<0,0,0>>; if (!$myvector) Ball.scaleY = 2;
Because the magnitude of $myvector is 0, the !$myvector condition is true and Ball.scaleY is set to 2.
Flow control errors The following topics describe solutions to common mistakes in expression flow control statements.
Modifying variable values in test conditions If you use a while, do, or for loop in an expression, remember to change the variable or attribute being tested in the test condition of the loop. Failing to do so can halt Maya operation.
Example 1 Suppose you create an object named Balloon and decide to use a while loop to increase its Y scaling after three seconds of animation play. while (time > 3) Balloon.scaleY = time;
Though you might think this expression sets Balloon’s scaleY attribute to the increasing value of time after the animation time exceeds 3 seconds, it actually halts Maya operation as soon as time exceeds 3. At that moment, the while condition is true, so the while loop statement Balloon.scaleY = time executes repeatedly and endlessly. Even though a statement sets an attribute within an expression, Maya updates the attribute only after the expression finishes executing. Because the expression never finishes executing, Maya halts. Unless you change Balloon.scaleY within the while loop to a value less than or equal to 3, the statement executes infinitely.
88
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features To get the desired result without halting Maya, use this expression: if (time > 3) Balloon.scaleY = time;
Example 2 Suppose you create objects named Cone and Ball, then use a while statement to link the Ball’s translateY attribute to the Cone’s translateY attribute: while (Cone.translateY > 0) Ball.translateY = Cone.translateY;
At first glance, the expression seems to set Ball’s translateY position to the value of the Cone’s translateY position whenever Cone’s translateY is greater than 0. In fact, the expression halts Maya as soon as you translate the Cone to a Y position greater than 0. At that moment, the while condition is true, so the while loop statement Ball.translateY = Cone.translateY executes endlessly. Nothing you do in the user interface can change the Cone’s translateY position. It stays at translateY value of 0. Unless you change Cone.translateY within the while loop to a value less than or equal to 0, the statement executes infinitely.
if (Cone.translateY > 0) Ball.translateY = Cone.translateY;
Comparing floating point values to 0 with == If you use the == operator to compare a floating point variable or attribute to 0, your expression might not work correctly. This typically occurs when you assume the value returned by a built-in function such as cosd will be exactly 0.
Example float $x = cosd(90); if ($x == 0) print("This equals 0.\n"); else print("This doesn’t equal 0.\n");
Using Maya: Hypergraph, Sets & Expressions
89
Expressions
To get the desired result without halting Maya, use this expression:
Expression Syntax Programming features The expression displays the following text: This doesn’t equal 0.
Though the cosine of 90 degrees is mathematically 0, the cosd(90) function returns the value 6.123e-17, which is extremely close to 0 but not exactly equal. Though the number for practical purposes is the same as 0, it’s stored in the computer as a fractional quantity above 0 because of the way computers handle floating point numbers. To fix the problem, compare the values as in this expression: float $x = cosd(90); if (($x > -0.0001) && ($x < 0.0001)) print("This equals 0.\n"); else print("This doesn’t equal 0.\n");
The expression displays the following text: This equals 0.
By checking that $x is between -0.0001 and 0.0001, the appropriate print statement executes. The value returned by cosd(90) is so close to 0 that it’s within the small range specified in the if statement’s numerical comparison.
String usage A string is a sequence of alphabetical, numerical, and special characters. You can display strings in the Script Editor, for example, to check the contents of attributes or variables. You can also create strings in the Expression Editor to execute MEL commands in an expression. See Chapter 7 for details. Guidelines for using strings follow: •
Enclose a literal string with double quotes as in this example: print("asteroid2");
This displays the following text: asteroid2
•
You can use the + operator to concatenate strings as in this example: print("Ball’s scaleY attribute equals: " + Ball.scaleY);
90
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features This displays the following text: Ball’s scaleY attribute equals: 0.3333333333
•
The following table lists how Maya converts data types if you use arithmetic operators with strings in an expression. Arithmetic operation
Resulting data type
string operator integer
string
string operator float
string
string operator vector
string
For example, suppose you type the following statement: print("Hi there, "+007);
This displays the following text: Hi there, 007
•
If you’re familiar with C programming, be aware you can assign a string to a vector as in these examples: vector $i = (vector) "<<1,2,3>>";
Expressions
vector $i = vector ("<<1,2,3>>");
•
You can execute a MEL command in an expression statement. See “Executing MEL commands in an expression” in Chapter 7.
Shortcut assignment operators You can use shorthand assignment operators to save typing time compared to their longhand counterparts. In place of a statement like this: $height = $height + 3;
You can use this statement: $height += 3;
Using Maya: Hypergraph, Sets & Expressions
91
Expression Syntax Programming features The following table shows the shorthand operators and the valid data types for each. The shorthand operators work like their counterparts in C. Symbol
Data type
+=
integer, float, vector, string
-=
integer, float, vector
/=
integer, float, vector
*=
integer, float, vector
%=
integer, float
Do not insert a space between the operator and =.
Example $counter += 1;
This adds 1 to $counter each time the statement executes.
Shortcut increment and decrement operators You can use the ++ and -- shortcut increment and decrement operators to increase or decrease floating point and integer variables by 1. The following table shows the shortcut syntax and its equivalent expanded syntax: Shortcut syntax
Expanded syntax
++variable;
variable = variable + 1;
--variable;
variable = variable - 1;
variable++;
variable = variable + 1;
variable--;
variable = variable - 1;
When the increment or decrement operator precedes the variable, the increment or decrement occurs before the statement executes. When the operator follows the variable, the increment or decrement occurs after the statement executes.
92
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Examples float float $crab $crab $crab
$eel = 32.3; $crab = $eel++; = $eel--; = --$eel; = ++$eel;
// // // //
$crab $crab $crab $crab
= = = =
32.3; 33.3; 31.3; 32.3;
$eel $eel $eel $eel
= = = =
33.3; 32.3; 31.3; 32.3;
Important To avoid unexpected results, do not use more than one shortcut increment or decrement operator on the same variable in the same statement. The evaluation order of the operators is unpredictable.
Arrays You can create arrays of float, vector, integer, or string values. You can clear an array using a clear function. You can find the size of an array with the size function. See “Array functions” in Chapter 9 for details.
Expressions
When you assign a value in an array, Maya reserves memory for all elements less than that number. This means you can exceed the capacity of your computer with a single array declaration. For example, do not use a statement like this: $newarray[12312323123] = 1;
Examples: Defining an array float $myarray[]; vector $myposition[]; int $p[];
Note that an array expands its size automatically as you assign values to its elements. You don’t need to declare its size. If your array assignment exceeds the size of the array, the array expands to that size. If you reference an element of the array beyond the array size, a 0 is returned. Suppose you include these statements in an expression: int $p []; $p[1500] = 3; $p[2000] = 5;
Using Maya: Hypergraph, Sets & Expressions
93
Expression Syntax Programming features The second statement makes the array contain 1501 elements and assigns element 1500 the value 3. The third statement expands the array to 2001 elements and assigns element 2000 the value 5.
Example: Initializing and printing an array’s contents float $fa[]; print("$fa size: "+size($fa)+"\n"); for( $i = 0; $i < 10; $i = $i + 1) { $fa[$i] = $i; print($fa[$i]+"\n"); } print("fa size: "+size($fa)+"\n");
This expression displays the following: $fa size: 0 0 1 2 3 4 5 6 7 8 9 $fa size: 10
The first statement creates an array of floating point variables named $fa[ ]. The next statement displays the size of the array, which has 0 elements after its definition. The for loop executes the statements between the braces 10 times, once for each increment of $i from 0 to 9. The first statement between the braces ({ }) initializes and sets the value of one element of the array. Array element $fa[0] is set to floating point value 0, element $fa[1] is set to 1, element $fa[2] is set to 2, and so on. The print statement between the braces displays the value of each element of the array after you initialize it. In other words, the Script Editor displays 0 through 9.
94
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Common expression errors The for loop stops executing after $i becomes equal to 10. Then the final print statement displays the number of elements of the initialized array, 10. The array increased in size as you assigned values to its elements.
Boolean symbolic constants You can use the symbolic constants on, true, or yes for the Boolean numeric value 1. You can use off, false, or no to represent 0. Be aware that on, true, and yes are equal only to 1. They aren’t equal to nonzero values.
Example if (Monster.visibility == on) Lance.scaleY = time / 3;
This causes Lance’s scaleY attribute to increase only if Monster’s visibility attribute is on. The on represents 1. print(3 + on);
This displays 4 in the Script Editor. Again, on represents the value 1.
Common expression errors
Logic errors are mistakes in your reasoning that cause unexpected animation results. The syntax of your expression is valid, but errors in your logic prevent Maya from doing what you intended. In the worst cases, Maya might halt operation because your statements lock it into a permanent loop. Because Maya can’t detect logic errors, it can’t display error messages. As such, these errors are harder to find and require more analysis to solve. To resolve logic errors, it’s often helpful to display the contents of relevant attributes and variables. See “Displaying attribute and variable contents” in Chapter 7.
Error message format A syntax error displays one or more messages in the Script Editor.
Using Maya: Hypergraph, Sets & Expressions
95
Expressions
There are two types of errors you can make when writing expressions: syntax errors and logic errors. Syntax errors include mistakes in spelling, incomplete attribute names, omitted semicolons, and other oversights that prevent the expression from compiling and executing. For syntax errors, Maya explains the error in a message to the Script Editor.
Expression Syntax Common expression errors
You’ll often need to scroll or increase the size of the Script Editor to see an entire message. When the Script Editor displays a syntax error, the response area of the Command Line displays the same error with a red background.
Command line’s response area turns red if error occurs
If an expression executes a valid statement after the erring statement, the error message with the red background flashes briefly. You won’t notice it unless you’re looking directly at it and have quick eyes. The best way to know when an error has occurred is to look for a new message prefixed by // Error: in the Script Editor.
96
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Common expression errors Before clicking the Create or Edit button to create an expression, you might want to select Edit→Clear History in the Script Editor to remove previous messages in the window. This makes it easier to see when a new error message appears.
Common error messages Here are some common syntax errors and their explanations: Attribute not found or variable missing '$': Ball.goof.
You misspelled an attribute name, the attribute doesn’t exist in the scene, or you forgot to prefix a variable name with $. Attribute of a particle object can only be used with dynExpression command: particleShape1.position
You used a particle array attribute in the expression, but a particle shape node is not the Selected Object in the Expression Editor. A particle shape node must be selected to use particle array attributes. A particle array attribute is also called a per particle attribute. Attribute already controlled by an expression, keyframe, or other connection: Balloon.tx.
•
set driven key
•
constraint
•
motion path
•
another expression
•
any other direct connection More than one attribute name matches. Must use unique path name: Ball.tx.
You used an object.attribute name that exists in two or more parent objects. Two objects in a scene can have the same object name if they have different parent objects. For example, a scene might have a child of GroupA named Ball.tx and a different child of GroupB named Ball.tx. If you write a statement such as “Ball.tx = time;”, Maya won’t know which Ball.tx to set.
Using Maya: Hypergraph, Sets & Expressions
97
Expressions
You tried to set the value of an attribute that has already been set by one of these techniques:
Expression Syntax Common expression errors To eliminate the error in this example, you must enter the full pathname of the attribute as GroupA|Ball.tx. The pipe symbol (|) specifies that the object to its left is the parent of the object on the right. Cannot set 'time' or 'frame'
You can read the value of the predefined time and frame variables, but you cannot set them. Attributes must be of float, integer, or boolean types: Ball.worldMatrix
You tried to set or read the value of an attribute that was a string or matrix type. For instance, you might have tried to use an attribute named translate rather than translateX, translateY, or translateZ attribute. In the error message above, worldMatrix is an attribute that exists for transforms, but you can’t use it. It’s for Maya’s internal use. Cannot divide by zero
You tried to divide by an attribute or variable that equals 0. This typically happens in an expression statement that divides by an object’s translateX, translateY, or translateZ attribute when the Snap to grids button is on and you drag the object to past the X-, Y- or Z-axis. When Snap to grids is on, the translateX, translateY, or translateZ attribute becomes exactly equal to 0 at the point where you drag the object across the axis. To prevent this error, turn Snap to grids off. With snapping off, the attribute is unlikely to become exactly 0 as you drag across the axis.
Note If you compile an expression for a particle shape node and see the same error message once for each particle in the object, it’s likely that some attribute name, variable, or function is undefined or misspelled.
98
Using Maya: Hypergraph, Sets & Expressions
6
Editing Expressions The Expression Editor offers convenient techniques for editing the text of expressions. There are filters that help you search for expressions you previously created, as well as techniques for entering and modifying the text of an expression.
You can edit an expression directly in the text box or with a text editor such as vi.
This chapter describes the following topics: “Finding expressions” on page 99
•
“Editing an expression in the text field” on page 105
•
“Editing an expression with a text editor” on page 106
•
“Creating a new expression” on page 111
•
“Deleting an expression” on page 112
•
“Using attribute names in expressions” on page 112
Expressions
•
Finding expressions After you’ve created an expression, you might decide later to alter it to create a different animation result. To edit an expression, you display it in the Expression Editor. The following sections describe how to find and display an expression for editing.
Using Maya: Hypergraph, Sets & Expressions
99
Editing Expressions Finding expressions
Finding by expression name To find an expression, you can choose from a list of all expressions in the scene.
To search for an expression by name: 1
From the Expression Editor, choose Select Filter→By Expression Name. An Expressions list appears in the Expression Editor. This list shows all expressions created for the scene.
List of expressions
2
Click the expression in the list. The expression contents appear in the expression text field. If you don’t remember the name of the expression, click each name on the list until the desired expression appears in the expression text field.
Note For a particle shape node, you can create a creation expression, a runtime expression, or both. Both expressions are listed under a single name—the name of the particle shape node. You can’t name or rename such expressions. To find such expressions, look for the particle shape node’s name in the Expressions list. Click the appropriate Runtime or Creation checkbox to display the desired expression.
100
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Finding expressions
Finding by selected object If you can’t remember the name you gave an expression, you can find it by selecting the affected object. For a nonparticle shape node, you can also select an affected attribute from the Attributes list to narrow the search for the expression.
To search for an expression by object and attribute name: 1
Select the object or other node in the Outliner, Hypergraph, or workspace.
2
Choose Select Filter→By Object/Attribute Name in the Expression Editor. This is the default search setting for the Expression Editor.
3
Choose Object Filter→Selected Objects. The selected object’s name and appropriate attributes appear in the window.
Object name Object’s attributes
For an object other than a particle shape node, click the name of the attribute controlled by the expression. If you’ve forgotten the name of the attribute controlled by the expression, choose Attribute Filter→Connected to Expressions. The Attributes list displays only the attributes controlled by expressions for the selected object. Click each attribute in the Attributes list until you see the desired expression in the expression text field. You can’t write a different expression for each attribute of a particle shape as you can for other types of objects. Because you can write only one creation expression and one runtime expression per particle shape, you don’t need to select an attribute from the Expression Editor’s Attributes list. See “Understanding particle expressions” on page 148 for details on particle expressions.
Using Maya: Hypergraph, Sets & Expressions
101
Expressions
4
Editing Expressions Finding expressions
Note The Attributes list shows only unlocked, keyable attributes. You can choose whether an attribute is keyable or locked with View→Object→ Editors→Channel Control. To write an expression for any nonkeyable attribute not shown in the list, enter object.attribute name in the Selected Obj & Attr text box.
Finding by item type You can find an expression based on the type of object or item the expression affects. For example, if you can’t remember an expression’s name but remember you applied it to a shader node, you can narrow your search to expressions that control shader nodes in the scene.
To search for an expression by item type: 1
In the Expression Editor, choose Select Filter→By Object/Attribute Name.
2
From the Object Filter menu, select the type of object or item the expression affects.
3
Choose Attribute Filter→Connected to Expressions.
4
Select the affected object or item from the Objects list.
5
Select the affected attribute from the Attributes list. The expression that controls the attribute appears in the expression text field.
Example Suppose you’ve written an expression that controls the rotateZ attribute of a spotlight transform node named Searchlight. Do this to find the expression: 1
Choose Select Filter→By Object/Attribute name.
2
Select Object Filter→Transforms. Note that you don’t select Object Filter→Lights in this example. The rotateZ attribute is an attribute of a light’s transform node, not of the light object itself.
102
3
Choose Attribute Filter→Connected to Expressions.
4
Select the object Searchlight from the Objects list.
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Finding expressions 5
Click rotateZ from the Attributes list. The expression appears in the expression text field.
Using the Selection list The Expression Editor displays a Selection list by default. This list displays either a list of objects and attributes, or a list of expressions you’ve created. To display the list of objects and attributes, choose Select Filter→By Object/ Attribute Name. This is the default display. To display the list of expressions you’ve created in the scene, choose Select Filter→By Expression Name.
Selection list triangle
Expressions list
Expressions
Using the Objects and Attributes list The objects listed in the Objects list depend on which entry you’ve selected from the Object Filter menu. If you select Object Filter→Lights, for instance, all lights in the scene appear in the list. The appropriate attributes of the object selected in the Objects list appear in the Attributes list. For example, if spotLightShape1 is selected in the Objects list, the attributes of spotLightShape1 appear in the list. When searching for an expression to edit, you can click an object and attribute from this list to find and display an expression that affects the chosen attribute. You can edit the displayed expression in the expression text field.
Using Maya: Hypergraph, Sets & Expressions
103
Editing Expressions Finding expressions For a particle shape node, you don’t need to select an attribute from the Attributes list. You can create only one creation expression and one runtime expression per particle shape node. The same expression appears for each attribute. When you create a new expression, you can click an object from this list to choose the default object to which the expression applies. When you select the default object in the Expression Editor, you can skip omit the object name and period that’s part of a full attribute name (see “Omitting an object name in expressions” on page 115.)
Using the Expressions list The Expressions list shows all expressions you’ve created in the scene. When searching for an expression to edit, click an expression from this list to display and edit its contents.
Hiding the Selection list You can hide the Selection list to lessen clutter in the window. To do so, click the triangle next to Selection (see previous figure). This triangle collapses and expands the list.
Filtering attributes from the Selection list If a selected object has several attributes controlled by expressions but you’re not sure which attributes, you can select a filter to list only attributes controlled by an expression.
To filter attributes from the Attributes list: 1
Select the object containing the attributes.
2
Choose Select Filter→By Object/Attribute Name.
3
Choose Object Filter→Selected Objects.
4
Choose Attribute Filter→Connected to Expressions. Only the object’s attributes controlled by expressions appear in the Attributes list. To see all attributes you can control with an expression again, choose Attribute Filter→All.
104
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression in the text field
Editing an expression in the text field The Expression Editor provides techniques for deleting and copying text in the expression text field. There are also techniques for clearing and restoring the text of an expression.
Expression text field
Important
Deleting and copying text To delete text: 1
Drag the mouse to select the text.
2
Press your keyboard’s Backspace key to delete it.
To copy and paste text: 1
Drag the mouse to select the text to be copied.
2
At the point in the text where you want to copy the text, click with the middle mouse button. This technique takes a little practice. If you find this frustrating, you might prefer using a text editor native to your operating system, for example, vi or jot. See “Editing an expression with a text editor” on page 106.
Using Maya: Hypergraph, Sets & Expressions
105
Expressions
If you close the Expression Editor window without successfully compiling an expression with the Create or Edit button, Maya discards any editing changes you’ve made to the expression.
Editing Expressions Editing an expression with a text editor
Clearing the expression text field You can erase the entire expression text field by clicking a button rather than dragging and deleting text.
To clear the expression text field: Click the Clear button.
Important To erase an expression and make sure its previous contents no longer control an attribute, click the Edit button after clicking the Clear button.
Reloading an expression’s previous contents Clicking the Create or Edit button compiles an expression. If you’ve made an editing change and haven’t yet clicked the Edit button, you can reload the previous expression if you don’t like the results.
To reload the expression: Click the Reload button. This restores the expression to the contents last present when you clicked the Create or Edit button.
Editing an expression with a text editor From the Expression Editor, you can start a text editor such as vi to create and edit an expression. Text editors have features useful for editing big expressions. When you start the text editor for an expression, you can edit only that expression with that instance of the text editor. However, you can start the text editor once for each of several expressions if you want to examine or edit several expressions at the same time. Once you start a text editor for an expression, the Expression Editor’s text field dims to indicate you can’t work there while the text editor runs. You can, though, work in the expression text field for another expression.
106
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression with a text editor There is no file on disk you can edit independently of the Expression Editor. When you use the text editor through the Expression Editor, you’re working with a temporary file that’s linked to the expression stored in the scene. You can, however, read an independent text file containing expression text into the temporary file. If you save an expression without specifying a filename, Maya reads the saved expression and stores it with the scene. You’ll see it dimmed in the expression text field while you’re working with the text editor. When you close the text editor, the expression text field entry no longer is dim. The text expression field becomes active after you close the text editor. If you quit the text editor without saving the expression, Maya does nothing. Because the expression hasn’t changed, Maya’s copy of the expression doesn’t need to change either.
Tip You can use a text editor to save an expression to a filename in the directory of your choice. This gives you a way to archive an expression you want to use in a different scene.
Using an editor listed in the Editor menu Expressions
By default, you can start one of these editors from the Editor menu in the Expressions Editor: •
jot
•
vi
•
vim
•
xemacs To run a different editor, see “Using an editor not listed in the Editor menu” on page 109.
To start an editor listed in the menu: 1
From the Editor pull-down menu in the Expression Editor, select an editor.
2
Double-click an object name, expression name, or attribute name from the Selection list.
Using Maya: Hypergraph, Sets & Expressions
107
Editing Expressions Editing an expression with a text editor The editor appears. An example display of vi follows:
The editor’s title bar shows a filename that’s temporarily created while you work on the expression. When you write or save the file, its contents are copied to the Maya scene containing the expression. The expression text field is inactive while the text editor is open. You can optionally close the Expression Editor window. If you single-click the name of an object, attribute, or expression, the text editor doesn’t appear. You can single-click to browse the contents in the expression text field without opening a text editor. If you double-click an attribute that’s already been assigned a value in an expression, the expression that controls that attribute appears in the text editor. For nonparticle expressions, you can assign to any attribute in the scene, not just to the double-clicked attribute. In fact, you don’t even need to work with the double-clicked attribute at all. If you double-click an attribute that has not yet been assigned a value, the text editor appears with no contents. If you double-click that attribute again, a new instance of the editor appears. After you assign a value to an attribute in an expression, you can start the editor only once for the attribute.
108
3
Create or edit the expression with the editor.
4
Save the file.
5
Confirm that the Expression Editor detected no syntax errors.
6
Quit the editor.
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression with a text editor
Note If you’ve created a UNIX command alias for jot, vi, vim, or xemacs, the Expression Editor tries to launch this command. If the arguments provided in the command alias are unusable by the Expression Editor, the editor might operate unexpectedly or fail to launch. Avoid using an alias to customize your editor’s operation settings. Do the steps in “Changing an editor’s operation settings” on page 110.
Using an editor not listed in the Editor menu If your workstation has a text editor that’s not listed in the Editor menu, you can use it after doing a few preliminary UNIX system administration tasks.
To start an unlisted editor: 1
In your UNIX .cshrc file, set the WINEDITOR environment variable to specify the desired editor and options. See “Changing an editor’s operation settings” on page 110 for examples. You can choose any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor).
2
Log out and log into your user account.
3
Restart Maya.
4
Choose Other from the Editor pull-down menu.
5
Double-click an object name, expression name, or attribute name from the Selection list. The editor appears.
6
Create or edit the expression with the editor.
7
Save the file.
8
Confirm that the Expression Editor detected no syntax errors.
9
Quit the editor.
Using Maya: Hypergraph, Sets & Expressions
109
Expressions
If the editor normally appears in the shell where you launched it, you must make the WINEDITOR setting display the editor in a shell.
Editing Expressions Editing an expression with a text editor
Changing an editor’s operation settings Maya launches the editors listed in the Editor menu with default operation settings. You can change the operation settings with a few preliminary system administration tasks.
To change an editor’s operation settings: 1
Set the WINEDITOR environment variable to specify the desired editor options. You can choose any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor). For example, jot requires the option -f, vim requires -g -f, and xemacs requires the option -nw. An example of setting WINEDITOR for vi follows: setenv WINEDITOR “xwsh -name mayaEditor -e vi”
An example for vim follows: setenv WINEDITOR “xwsh -geometry 80x57+350+130 -bg 97 -e vim”
2
Log out and log into your user account.
3
Restart Maya.
4
Choose Other from the Editor pull-down menu.
5
Double-click an object name, expression name, or attribute name from the Selection list. The editor appears.
6
Create or edit the expression with the editor.
7
Save the file.
8
Confirm that the Expression Editor detected no syntax errors.
9
Quit the editor.
Selecting an editor for default startup You can make an external text editor start by default each time you start a text editor.
110
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Creating a new expression
To start an editor by default: 1
Choose Options→UI Preferences.
2
In the UI Preferences window, click the Misc folder.
3
Choose the editor in the Expression Editor menu. To choose an editor specified with the WINEDITOR environment variable, select Other.
4
Click Save Changes to close the window.
5
In the Expression Editor, double-click an object name, expression name, or attribute name from the Selection list. The editor appears. The next time you start the Expression Editor, the editor’s name appears in the Editor pull-down menu by default. If you’ve chosen different text editors in UI Preferences and the Editor menu, the one chosen in UI Preferences appears.
Important If you’ve specified a text editor through Options→UI Preferences or with the Expression Editor’s Editor menu, starting the Expression Editor from the Channel Box or Attribute Editor displays the text editor instead of the Expression Editor.
Creating a new expression You can create a new expression after you’ve been editing an existing one.
To create a new expression: 1
Make sure you click the Create or Edit button to compile the existing expression.
2
Choose Select Filter→By Expression Name.
3
Click the New Expression button. This clears the Expression Name box and expression text field so you can create a new expression.
Using Maya: Hypergraph, Sets & Expressions
111
Expressions
Note the text editor appears when you click the New Expression button.
Editing Expressions Deleting an expression When you create the expression, the Expression Editor associates the object name with the expression. This means you can narrow your search for the expression using the object’s name in addition to the expression name. You do not need to select an attribute in the Attributes list. You can associate the expression with an object only. For a particle shape node, you don’t need to select an attribute, as you can create only one creation expression and one runtime expression per particle shape. For nonparticle shape objects, you can create one expression per attribute.
Deleting an expression If you want to stop an expression from controlling attributes, you can delete the expression.
To delete an expression: 1
Display it in the Expression Editor.
2
Click the Delete button.
Using attribute names in expressions A full attribute name has this format: object.attribute where object is the name of the object node and attribute is the name of the attribute. A period separates the name of the object and attribute. Object and attribute names are case-sensitive. You must spell them with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. You cannot spell attribute names with the common English spellings shown in the Attribute Editor or by default in the Channel Box. The following topics show how you can abbreviate attribute names to save typing time.
112
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Using attribute names in expressions
Using attribute name abbreviations You can use an abbreviation in place of any full attribute name in the expression text field.
Example In place of this: Ball.translateY = time;
you can type this: Ball.ty = time;
Each attribute has at least one acceptable abbreviation. Here are some commonly used attribute name abbreviations for several types of object transform nodes: Abbreviation
translateX
tx
translateY
ty
translateZ
tz
rotateX
rx
rotateY
ry
rotateZ
rz
scaleX
sx
scaleY
sy
scaleZ
sz
visibility
v
Expressions
Long name
To see the abbreviations for attributes that can be keyframed: 1
Select the object or item containing the desired attributes.
2
Turn on Options→Channel Box to display the Channel Box.
Using Maya: Hypergraph, Sets & Expressions
113
Editing Expressions Using attribute names in expressions Common English equivalents for the long attribute names appear in the Channel Box by default. These names are different than the names you must use in the expression text field. If you use the long attribute name, use the name that appears in the Attributes list of the Expression Editor. Do not use the common English language equivalents displayed in the Channel Box.
Use either attribute long names or abbreviated names in expressions
Do not use these common English names
3
From the Channels menu at the top of the Channel Box, select Channel Names→Short. The abbreviated attribute names replace the common English attribute names in the Channel Box.
114
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Using attribute names in expressions
To see abbreviations for other attributes: Execute this MEL command in the Script Editor: listAttr -sn objectname
where objectname is the name of the object or other node.
Note After you click Create or Edit to compile an expression, Maya converts all attribute abbreviations in the expression to the full attribute name.
Omitting an object name in expressions If you select an object as the Default Object in the Expression Editor, you can omit the object name and period that’s part of a full attribute name.
Example Suppose you’ve selected Ball as the Default Object. In place of this: Ball.translateY = time;
you can type this: Expressions
translateY = time;
Maya interprets translateY as belonging to Ball, the object listed in the Default Object text box of the Expression Editor.
To make an object the Default Object: Enter the object’s name in the Default Object text box. By default, the selected object is also the default object. You can omit the object name only for attributes of the object in the Default Object text box. The Default Object text box is dim when a particle shape node is the selected object in the Expression Editor. Because a particle shape node’s attributes can be controlled by only one creation expression and one runtime expression, the particle shape node is always the default object when it is the selected object.
Using Maya: Hypergraph, Sets & Expressions
115
Editing Expressions Using attribute names in expressions
Combining the abbreviation techniques You can combine the abbreviation techniques mentioned in the two previous topics to minimize typing.
Example Suppose you’ve selected Ball as the Default Object. In place of this: Ball.translateY = time;
you can type this: ty = time;
Maya interprets ty as being the translateY attribute of Ball, the object listed in the Default Object text box of the Expression Editor. Attributes of other objects must be spelled out with the full object and attribute name.
116
Using Maya: Hypergraph, Sets & Expressions
7
Beyond the Basics This chapter describes advanced concepts for writing expressions. Unless otherwise noted, the topics within apply to expressions for attributes of all objects, including particles. For additional details on working with particles, see Chapter 8, “Particle Expressions.”
Rob Tesdahl
This chapter describes the following topics: •
“How often an expression executes” on page 118
•
“Using custom attributes in expressions” on page 118
•
“Displaying attribute and variable contents” on page 123
•
“Reproducing randomness” on page 123
•
“Speeding expression execution” on page 127
•
“Reducing redundant expression execution” on page 130
•
“Removing an attribute from an expression” on page 131
•
“Disconnecting an attribute” on page 132 Using Maya: Hypergraph, Sets & Expressions
117
Expressions
The falling cube is a soft body with goal and springs. As its points move below the floor, an expression assigns them a goal weight of 0. The cube appears to melt as it passes through the floor.
Beyond the Basics How often an expression executes •
“Renaming an object” on page 136
•
“Executing MEL commands in an expression” on page 137
•
“Understanding path names” on page 140
•
“Understanding unexpected attribute values” on page 141
How often an expression executes After you’ve typed an expression in the Expression Editor, you click the Create or Edit button to compile the expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. After being compiled, the expression executes for the current frame. When you select an object other than a particle shape node, the Expression Editor displays an Always Evaluate checkbox that affects when an expression executes. If you select a particle shape node, the Expression Editor dims this checkbox. For details on particle shape node expressions, see Chapter 8, “Particle Expressions”). Generally an expression executes whenever the current animation time or frame changes. For example, an expression executes when you rewind or play the animation. The expression executes once for each time the animation frame or time changes. An expression also generally executes when your interaction with Maya makes use of an attribute in the expression. For example, if your expression assigns a sphere’s translateX attribute to another attribute and you move the sphere in an X-axis direction, the expression executes upon each increment of the sphere’s movement. Occasionally, it’s useful to turn off Always Evaluate to diminish redundant expression execution and speed Maya operation. Before doing this, it’s best to understand the subtle details of expression execution. See “Reducing redundant expression execution” on page 130 for details.
Using custom attributes in expressions It’s often helpful to add a custom attribute to an object and use it in an expression. You can use a custom attribute to control a combination of other attributes. You can also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes.
118
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Using custom attributes in expressions Custom attributes have no direct effect on any characteristic of an object. See “Assigning to a custom attribute” in Chapter 8 for details on how to add and use a custom attribute with particles.
Example Suppose you’ve given a NURBS sphere named Planet a circular, orbiting motion in the XY plane with this expression: Planet.tx = sin(time); Planet.ty = cos(time);
Expressions
Planet orbits the origin at a radius of 1 unit. In the following steps, you’ll create a custom attribute named distance to increase the radius of Planet’s orbit over time.
Note The small balls in the preceding figure show the circular path of Planet. They’re in the figure only to help you visualize the motion. They aren’t part of the animation or expression.
To add a custom attribute to alter the orbit: 1
Select Planet.
2
Choose Modify→Add Attribute.
Using Maya: Hypergraph, Sets & Expressions
119
Beyond the Basics Using custom attributes in expressions
3
In the Add Attribute window, enter distance in the Attribute Name text box.
4
Make sure Make attribute keyable is on.
5
Set Data Type to Float, and Attribute Type to Scalar.
6
Set Minimum to 1, Maximum to 10, and Default to 4. Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value displayed for the attribute. An expression isn’t bound by the Minimum and Maximum values. The attribute receives whatever value you assign it in the expression. The expression can read the Default value or any other value you set in the Attribute Editor or Channel Box.
7
120
Click Add to add the attribute, then close the Add Attribute window.
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Using custom attributes in expressions The distance attribute appears in the Attributes list of the Expression Editor for Planet. You can now set or read the value of the attribute in any expression. 8
Edit the expression to this: Planet.tx = distance * sin(time); Planet.ty = distance * cos(time);
Multiplying the sin(time) and the cos(time) by the distance attribute makes Planet circle the origin at a distance specified by the value of the distance attribute. See Chapter 9 for details on the sin and cos functions.
You can make the expression control the distance attribute over time. 9
Edit the expression to this: distance = time; Planet.tx = distance * sin(time); Planet.ty = distance * cos(time);
By setting distance to the value of time, Planet’s orbiting distance increases as playback time increases. Planet moves in a steady outward spiral as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
121
Expressions
Because you gave the distance attribute a default value of 4 when you added it to Planet, playing the animation makes Planet circle the origin at a distance of 4 grid units from the origin.
Beyond the Basics Using custom attributes in expressions
Instead of using an expression to control distance, you can keyframe its value over time. For example, by keyframing a distance value of 1 at frame 1 and a value of 10 at frame 200, Planet moves in a steady outbound spiral as you play the 200 frames. Planet’s distance increases in a linear interpolation from 1 to 10 as the animation plays. You can animate the distance attribute with keyframes or with an expression, not with both.
Tip If an expression controls an attribute and you want to control it with keyframes instead, delete all statements that assign values to the attribute, then click the Edit button. Use the Channel Box to reset the attribute’s value to an initial value, then set keyframes as desired. If keyframes control an attribute and you want to control it with an expression instead, click the attribute’s text box in the Channel Box, then choose Channels→Delete Selected. Assign values to the attribute name in an expression as desired.
122
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Displaying attribute and variable contents
Displaying attribute and variable contents The predefined print( ) function displays attribute contents, variable contents, and other strings in the Script Editor. This is often helpful for debugging an expression. See “print” on page 261 for more details. Note that for a nonparticle expression consisting of only print statements, Always Evaluate must be on in the Expression Editor for the expression to execute.
Reproducing randomness If you execute the rand, sphrand, and gauss functions repeatedly in an expression, Maya returns a sequence of random numbers. (See “Random number functions” on page 239 for details on these functions.) Each time you rewind and play your animation, the sequence of random numbers is different. Often, you’ll want to generate a sequence of random numbers that repeats each time your animation plays. For instance, suppose you use the rand function to assign a random radius to each particle in a stream of emitted particles rendered as Spheres. By default, Maya gives the particles a different sequence of random radius values each time your animation plays.
Important When you set a seed value in an expression or MEL script, the seed value affects the rand, sphrand, and gauss functions in other expressions and MEL scripts. Such functions are affected by this seed value in all scenes you open subsequently in the current work session. This seed value is unrelated to the Seed option available through Settings→Dynamics Controller in the Dynamics menus. The seed function therefore doesn’t affect randomness created with dynamics.
Using Maya: Hypergraph, Sets & Expressions
123
Expressions
To create the same radius values each time the animation plays, you can use the seed function in an expression before the rand, sphrand, or gauss functions execute. There’s no need to execute the seed function more than once per animation unless you need to generate several different repeating sequences of random numbers as your animation plays.
Beyond the Basics Reproducing randomness
Example Suppose you use the rand function to position several marbles at random translateX positions in your scene at frame 1: if (frame == 1) { marble1.tx marble2.tx marble3.tx marble4.tx }
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
The rand(-10,10) returns a random number between -10 and 10 each time it executes. When you rewind the animation to frame 1, Maya might assign these values to the translateX attributes of the marbles:
124
Attribute
Value
marble1.tx
2.922
marble2.tx
5.963
marble3.tx
-4.819
marble4.tx
7.186
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Reproducing randomness The next time you rewind the animation to frame 1, each marble’s translateX attribute receives a different random value. Maya might assign these values: Attribute
Value
marble1.tx
-3.972
marble2.tx
9.108
marble3.tx
-7.244
marble4.tx
-3.065
You can use the seed function to keep the sequence of random values returned by the rand function consistent when you rewind the animation. if (frame == 1) { seed(10); marble1.tx marble2.tx marble3.tx marble4.tx }
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
By setting the seed value to an arbitrary number, for instance, 10, the subsequent executions of the rand function return a repeating sequence of random numbers.
Using Maya: Hypergraph, Sets & Expressions
125
Expressions
You might prefer the marbles’ translateX values to stay the same when you rewind, for instance, so you can composite the marbles correctly among a foggy backdrop.
Beyond the Basics Reproducing randomness When you rewind the animation the first time, Maya might assign these values to the translateX attributes of the marbles: Attribute
Value
marble1.tx
8.020
marble2.tx
-2.973
marble3.tx
-7.709
marble4.tx
0.741
Each time you rewind the animation thereafter, Maya assigns these same values to the translateX attributes of the marbles. The marbles don’t move. Each time a statement sets the seed value to 10, the subsequent executions of the rand function return numbers from the sequence starting at the beginning number. In other words, resetting the seed value to 10 restarts the random number generation process to the first value in the sequence. Suppose you alter the expression to this: if (frame == 1) { seed(10); } marble1.tx marble2.tx marble3.tx marble4.tx
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
When you rewind the animation to frame 1, the expression sets the seed to 10. Maya assigns values to the marbles’ translateX attributes as in the previous expression.
126
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Speeding expression execution Because the expression doesn’t set the seed value in frames other than frame 1, playing the animation causes the rand function to return a new, yet repeating, sequence of random numbers each frame. If you play the animation several times, the translateX values will constantly change during animation, but the sequence of values will be identical each time you play the animation. You can assign the seed a different value to generate a different sequence of returned values. See “seed” on page 246 for details.
Speeding expression execution Maya does calculations internally in centimeters, radians, and seconds. A radian is an angular unit commonly used in mathematics. It equals 180 degrees divided by pi, or roughly 57.3 degrees. When you assign a number to an attribute whose value is a measurement unit, the expression interprets the number, by default, as the appropriate unit selected in the Units folder of the General Preferences window. By default, the Units folder selections are centimeters, degrees, and seconds. If a measurement unit you’ve chosen in the Units folder differs from the corresponding internal unit, Maya converts the number to the appropriate internal unit to do the assignment. Expressions
Example Suppose you’ve selected degrees from the Angular menu in the Units folder. You then write this expression for an object named Ball: Ball.rotateZ = 10;
Maya reads the 10 as being 10 degrees, then converts the value to the appropriate number of radians to make the assignment to Ball’s rotateZ attribute. The conversion happens automatically. From your standpoint, Maya is simply rotating Ball 10 degrees. In nonparticle expressions, these automatic conversions affect Maya performance. Because the expression executes slower, Maya slows when you play, rewind, or otherwise change the animation time. Saving, opening, and other file operations on the scene containing the expression are also slower. To boost Maya performance, you can turn off conversion to internal units. If you do so, you must convert units in expression statements.
Using Maya: Hypergraph, Sets & Expressions
127
Beyond the Basics Speeding expression execution
To speed expression execution: 1
Display the Expression Editor.
2
Choose one of these Convert Units options: None
Converts no units. You must assign values to attributes as centimeters, radians, or seconds, as appropriate. Execution is fastest with this option.
Angular Only
Converts angular units, but no others. You must assign values to attributes as centimeters, seconds, and degrees, as appropriate. (This assumes you’re using the default degree setting in the Units folder. If you’ve selected radians, you must enter radians.) If you’re confused by converting degrees to radians, select this option. Execution is fast with this option—unless the expression has many angular values.
To return to default conversions: 1
Display the Expression Editor.
2
For the Convert Units option, choose All. This lets you enter all measurement numbers in the same units specified in the Units preference settings. Execution is slowest with this selection, but expression writing is simplest. You can set a different conversion option for each expression.
Example Suppose, in the Units folder, you’ve set Linear units to millimeters and Angular units to degrees. You then write the following expression: Ball.translateX = 5; Ball.rotateZ = 10;
All causes Maya to read 5 as millimeters and 10 as degrees. None causes Maya to read 5 as centimeters and 10 as radians. Angular causes Maya to read 5 as centimeters and 10 as degrees.
To convert units in an expression statement: You must convert the units mathematically in a statement.
128
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Speeding expression execution
Examples Suppose, in the Units folder, you’ve set Linear units to millimeters and Angular units to degrees. In the Expression Editor you set the Convert Units option to None and enter this expression: Ball.translateX = 5; Ball.rotateZ = 10;
None causes Maya to read 5 as centimeters and 10 as radians, which is not the result you’re seeking. To assign 5 millimeters to Ball’s translateX attribute, you must convert 5 to the appropriate number of centimeters. To assign 10 degrees to Ball’s rotateZ attribute, you must convert 10 to the appropriate number of radians. The following statements do this: Ball.translateX = 5.0 / 10.0; Ball.rotateZ = 10.0 / 57.3;
There are 10 millimeters per centimeter. In other words, a millimeter is a centimeter divided by 10. So 5 millimeters equals 5 centimeters divided by 10. You therefore use the operation 5.0 / 10.0.
When you divide floating point attributes or variables, enter the floating point value 5.0 for an even number such as 5. This ensures that the division works as expected. For more details, see the note in “Using mixed data types with arithmetic operators” on page 145. There are 57.3 degrees per radian. In other words, a degree is a radian divided by 57.3. So 10 degrees equals 10 radians divided by 57.3. You therefore use the value 10.0 / 57.3. If you need a more precise conversion to radians, divide a degree by 57.29578 instead of 57.3. You can instead use the deg_to_rad function as follows: Ball.rotateZ = deg_to_rad(10.0);
The deg_to_rad function converts 10.0 degrees to a precise radian equivalent. See “deg_to_rad” on page 234 for details.
Using Maya: Hypergraph, Sets & Expressions
129
Expressions
Important
Beyond the Basics Reducing redundant expression execution Turning off unit conversion affects only expressions. It doesn’t affect other Maya commands, options, or displays. For instance, the preceding example expression assigns centimeters to translateX and radians to rotateZ. The Channel Box still displays values for these attributes in millimeters and degrees. It displays values in whatever units you choose in the Units folder of the General Preferences window. Note that you can’t turn off unit conversion for particle shape node expressions. Maya handles unit conversion differently for such expressions with little impact on performance.
Reducing redundant expression execution If your expression has redundant statement calculations, you can turn off Always Evaluate to speed up scrubbing and playback of your animation. To understand when this feature is useful, you must understand the subtle details of expression execution. An expression generally executes whenever the animation time changes. An expression also executes whenever an attribute that’s read by the expression changes value, and either of the following two actions occurs: •
Some other node in Maya uses the value of an attribute the expression writes to. For example, a deformer or shader uses its value.
•
Maya needs the value of an attribute to which it writes in order to redraw the workspace contents. In this context, the predefined variables time and frame are also considered attributes the expression reads. Suppose you write an expression that moves a NURBS sphere along the Yaxis at twice the current value of its X-axis translation: nurbsSphere1.translateY = 2 * nurbsSphere1.translateX;
If you use the Move tool in the workspace to drag the sphere in an X-axis direction, Maya executes the expression for each incremental change to the translateX attribute as you drag. Dragging the sphere in the X direction changes the value of the translateX attribute in the expression. As you drag the sphere and Maya updates the workspace display, the value of the translateY attribute changes in the expression. This makes the expression execute.
130
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Removing an attribute from an expression If you turn Always Evaluate off, an expression won’t execute if it contains only print function statements, variable assignments, or assignments that do not read attribute values.
Example global float $BallHeight = 5; print($BallHeight+"\n"); nurbsSphere1.tx = rand(1); print(nurbsSphere1.tx+"\n");
The first statement declares and assigns a value to the variable $BallHeight, which is not an attribute. The next statement prints the $BallHeight but assigns no value to an attribute. The next statement assigns an attribute a value, but the value is generated by the random number function rand. This function doesn’t read an attribute value. For details on the rand function, see “rand” on page 243. The last statement reads and prints the value of an attribute, but doesn’t assign a value to an attribute. None of these actions causes the expression to execute when Always Evaluate is off.
For most animations, expressions execute regardless of whether Always Evaluate is on. If in doubt, leave it on.
Removing an attribute from an expression If you do any of the following actions, an expression no longer sets or reads an attribute: •
Delete all occurrences of the attribute name in the expression.
•
Convert to comments all statements that use the attribute name in the expression.
•
Delete the expression that contains the attribute. Following these actions, the attribute keeps its value from the last time the expression executed and set its value.
Using Maya: Hypergraph, Sets & Expressions
131
Expressions
Always Evaluate affects only the expression you’re creating or editing. You can turn it on for one expression and off for another.
Beyond the Basics Disconnecting an attribute The attribute doesn’t return to the value it had before the expression set it. To return the attribute to its original value, use the Channel Box or Attribute Editor to set the attribute.
Disconnecting an attribute If you disconnect an attribute from an expression, the expression no longer reads or set its value. You might want to disconnect an attribute, for example, so you can keyframe the attribute rather than control it with an expression. These actions disconnect an attribute from an expression: •
Delete from the scene an object with an attribute that exists in the expression.
•
Use the Window→General Editors→Connection Editor to disconnect the attribute from the expression.
•
Use the MEL disconnectAttr command.
•
Use the MEL choice command.
Tip The MEL choice command lets you control an attribute alternately with two or more techniques in different frames. For example, you can keyframe an attribute for frames 1-48, control it with an expression for frames 48-96, and control it with a motion path for subsequent frames.
Displaying disconnected attributes in expressions The Expression Editor displays a disconnected attribute with a symbolic placeholder representing the attribute’s former existence in the expression.
Example Suppose your scene has two objects, Ball and Cone, and you’ve written this expression: Ball.translateX = Cone.translateX; Ball.translateY = Cone.translateY; Ball.translateZ = Cone.translateZ;
132
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Disconnecting an attribute If you delete Cone from the scene, Cone.translateX, Cone.translateY, and Cone.translateZ attributes no longer exist for the expression to read and assign to Ball’s translateX, translateY, and translateZ attributes. If you display the expression again, it appears as follows: Ball.translateX = .I[0]; Ball.translateY = .I[1]; Ball.translateZ = .I[2];
The .I[0], .I[1], and .I[2] characters indicate you’ve disconnected Cone’s translate attributes from the expression. These symbols represent placeholders for the former use of the attributes in the expression. The .I means the placeholder represents an input to the expression. An input to an expression is an attribute with a value the expression reads for assignment to another attribute or variable. The number in brackets indicates the order in the expression the attribute was read. For example, .I[0] indicates the input is the first attribute read in the expression, .I[1] indicates the input is the second attribute read, and .I[2] indicates the input is the third attribute read.
Note that if you disconnect an attribute from an expression but the attribute still exists in the scene, the attribute keeps its value from the last time the expression executed and set its value.
Example Suppose you’ve written these statements among others: Ball.translateX = Cone.translateX; Ball.translateY = Cone.translateY; Ball.translateZ = Cone.translateZ;
If you delete Ball from the scene, Ball.translateX, Ball.translateY, and Ball.translateZ attributes no longer exist. The expression can no longer assign Cone’s translateX, translateY, and translateZ values to the corresponding Ball attributes.
Using Maya: Hypergraph, Sets & Expressions
133
Expressions
A floating point or integer attribute placeholder has a value of 0. A particle shape node’s vector attribute placeholder has a value of <<0,0,0>>. In the example, the placeholders .I[0], .I[1], and I[2] have the value 0. When the expression executes, it assigns Ball.translateX, Ball.translateY, and Ball.translateZ the value 0.
Beyond the Basics Disconnecting an attribute Symbolic placeholders replace Ball attributes in the expression. If you display the expression again, the statements appear as follows: .O[0] = Cone.translateX; .O[1] = Cone.translateY; .O[2] = Cone.translateZ;
Note If an expression assigns values to the attributes of only one object, deleting the object deletes the expression also. If your expression assigns values to attributes of several object attributes, deleting all those objects deletes the expression. To avoid deleting the expression in the preceding example, you would need have some statement that sets an attribute of an object other than the deleted Ball. For example, you might include this statement: Cone.visibility = 1;
The .O[0] characters indicate you’ve disconnected the attribute Ball.translateY from the expression. The .O indicates that the placeholder represents an output from the expression. An output from an expression is an attribute assigned a value by the expression. The number in brackets, for example, [0], indicates the order in which the attribute was assigned a value in the expression. Because Ball.translateX was the first output from the expression, the expression replaces it with .O[0]. The expression replaces Ball.translateY and Ball.translateZ with .O[1] and .O[2] because they were the second and third outputs from the expression. When the expression executes, it continues to assign values to the placeholder, though the placeholder has no effect on any object or component of scene. The expression assigns the placeholders .O[0], .O[1], and .O[2] the value of Cone.translateX, Cone.translateY, and Cone.translateZ, but these placeholders don’t control anything in the scene. The statements have no effect.
134
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Disconnecting an attribute
Connecting an attribute to a symbolic placeholder After you’ve disconnected an attribute from an expression, a symbolic placeholder replaces it in the expression as described in the preceding topic. You can replace the placeholder with the attribute of your choice. The most obvious way to do this is to type the desired attribute name in every occurrence of the symbolic placeholder in the expression. If you have a lengthy expression that has lots of symbolic placeholders, you can use a single MEL connectAttr command to connect the new attribute to all occurrences of the same symbolic placeholder. You can also use Window→General Editors→Connection Editor.
Example 1 Suppose you have these statements among others in an expression named HorseController: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; BrownHorse.translateX = Car.translateX;
Deleting the Car and reloading the expression shows this:
.I[0] is the symbolic placeholder for what was the Car.translateX attribute. You can connect a different attribute to this placeholder to assign its contents to the translateX attributes of WhiteHorse, BlackHorse, and BrownHorse. Suppose you want to control these attributes with the translateX attribute of an object named Cow. You can enter the following MEL command at the Command Line: connectAttr Cow.tx HorseController.input[0]
This command connects the attribute Cow.tx to the expression’s input[0]. The expression is named HorseController. The input[0] is abbreviated as .I[0] in the expression. You can see the spelled-out input name input[0] in the Graph→Up and Downstream Connections display of the Hypergraph. Reloading the expression shows the new attribute connection: WhiteHorse.translateX = Cow.translateX; BlackHorse.translateX = Cow.translateX; BrownHorse.translateX = Cow.translateX;
Using Maya: Hypergraph, Sets & Expressions
135
Expressions
WhiteHorse.translateX = .I[0]; BlackHorse.translateX = .I[0]; BrownHorse.translateX = .I[0];
Beyond the Basics Renaming an object
Example 2 You can also reconnect an expression’s output with the connectAttr command. Suppose you have these statements among others in an expression named HorseController: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; BrownHorse.translateX = Car.translateX;
Deleting the BrownHorse object and reloading the expression displays this: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; .O[2] = Car.translateX;
.O[2] is the symbolic placeholder for what was the BrownHorse.translateX attribute. It received the placeholder .O[2] because it’s the third output from the expression. (The first and second outputs from the expression are .O[0] and .O[1] .) You can connect a different object attribute to this placeholder to control it with the value in Car.translateX, as shown in the third statement. Suppose you want to control the attribute of a new object named RedHorse.translateX with the Car.translateX value. You can enter the following MEL command in the Command Line: connectAttr HorseController.output[2] RedHorse.tx
This command connects the HorseController expression’s output[2] to the attribute RedHorse.tx. The output[2] is abbreviated .O[2] in the expression. Reloading the expression shows the new attribute connection: WhiteHorse.translateX = Cow.translateX; BlackHorse.translateX = Cow.translateX; RedHorse.translateX = Cow.translateX;
Renaming an object If you rename an object whose attributes were used in an expression, the Expression Editor continues to read or set the attributes. Maya doesn’t disconnect the attribute from the expression. The Expression Editor converts to the new name of the object the next time you click the Reload button in the Expression Editor.
136
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Executing MEL commands in an expression
Note When you reload an expression, the Expression Editor converts any short attribute names to their long attribute name equivalents. For example, if you originally type the attribute name Ball.ty, reloading the expression renames it as Ball.translateY.
Executing MEL commands in an expression You can execute MEL commands and procedures in an expression. However, if you make or break connections or add or delete nodes, your scene might malfunction. Rewinding your animation does not undo MEL command execution in an expression. For instance, if your expression executes MEL commands to create a pair of spheres, rewinding doesn’t delete the spheres. Moreover, playing the scene again creates another pair of spheres. Though you can usually undo executed MEL commands by selecting Edit→Undo repeatedly, this might not work if your scene is malfunctioning.
You can execute MEL commands in an expression with several techniques: •
MEL command alone in a statement
•
MEL command within left-hand single quote marks
•
MEL command used as an argument to an eval function
•
MEL procedure call to a procedure in a MEL script The following topics explain the techniques. See Using MEL for details on MEL.
Using a MEL command alone in a statement The simplest way to use a MEL command in an expression is to type it in a statement exactly as you would in the Script Editor or in a MEL script.
Example select -cl;
Using Maya: Hypergraph, Sets & Expressions
137
Expressions
When you execute a command from the Command Line, status information appears in the Script Editor and the Command Line’s response area. This information is not displayed when a command executes in an expression.
Beyond the Basics Executing MEL commands in an expression This example shows the use of a MEL command alone. The statement executes exactly as it would in the Script Editor, except no command output appears in the Script Editor.
Using a MEL command within single quote marks If you enclose a command within left-hand single quote marks (‘), Maya returns command output where the command is in the statement. You can assign this output to a variable to, for example, display it in the Script Editor.
Example string $a[]; $a = ‘ls -lights‘; print($a);
The first statement defines an array named $a. The second statement executes the MEL command within quotes, then assigns the command’s output to array $a. The third statement displays the contents of $a to the Script Editor as follows: ambientLightShape1 directionalLightShape1
Using a MEL command with the eval function Using a MEL command with the eval function has an advantage over the previous two techniques: you can build a command from a string.
Example string $mycommand = "sphere"; eval($mycommand+" -r 5");
The first statement assigns the string sphere to the variable $mycommand. The second statement appends -r 5 to sphere and executes the complete command sphere -r 5. This creates a sphere with a radius of 5 grid units. See “eval” on page 259 for more details.
Using a MEL procedure in an expression You can execute a MEL procedure in an expression by entering the procedure name in a statement.
138
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Executing MEL commands in an expression
To execute a MEL procedure: 1
Give the script the same filename as the procedure it contains, but with the extension .mel. For example, if your procedure name is randspot( ), name your script file randspot.mel.
2
Put the script file in your Maya scripts directory.
3
Declare the procedure as global in the script file as in this example: global proc string randspot()
4
In an expression statement, use a statement that calls the procedure. You can use the statement within left-hand single quote marks with an eval function, or alone as in this example: randspot();
A complete example of calling a MEL procedure from an expression follow:
Example Suppose, in your Maya scripts directory, you’ve created a MEL script file named randspot.mel with the following contents:
Expressions
global proc string randspot() { string $mycommand; if (rand(2) < 1) $mycommand = "particle -p "+ sphrand(10); else $mycommand = "sphere -p "+ sphrand(10); return $mycommand; }
Further suppose you’ve created this expression: string $randcommand = randspot(); eval($randcommand);
When you rewind or play a frame in the animation, the expression executes. The first expression statement executes the randspot procedure in the randspot.mel script file. In the randspot procedure, the rand(2) part of the ifelse statement generates a random floating point value between 0 and 2, then compares its value to 1. For details on the rand function, see “rand” on page 243. Using Maya: Hypergraph, Sets & Expressions
139
Beyond the Basics Understanding path names If the rand(2) function returns a value less than 1, the if statement assigns a MEL command string such as particle -p -1.356 5.983 8.458 to $mycommand. The + sphrand(10) part of the statement appends to sphere -p the three floating point components of a randomly generated vector. Though sphrand(10) returns a vector, Maya converts the vector to a string upon assigning it to the string $mycommand. For details on the sphrand function, see “sphrand” on page 244. The converted string contains no double angle brackets or commas, but does contain a space character between the floating point components. A space between the floating point components is required syntax for the MEL particle command as used above. If the rand(2) function returns a value greater than 1, $mycommand receives a MEL command string such as sphere -p 4.926 -2.589 1.274. The procedure finishes executing and passes the value of $mycommand back to the expression’s calling procedure randspot( ). This assigns the command string to the variable $randcommand. The eval function executes the command string in $randcommand. For example, if the statement executes particle -p -1.356 5.983 8.458, it creates a particle with coordinates <<1.356, 5.983, 8.458>>. The expression executes each frame and creates a new particle or sphere at a random location within a spherical radius of 10 units from the origin.
Understanding path names If two objects in a scene have different parents, they can have the same object name. If you refer to an attribute of such an object in an expression, you must use a more complete name that includes the object’s path name. An object’s path name has this format: pathname|objectname.attributename where pathname is the parent node’s name, objectname is the object’s name, and attributename is the attribute’s name of the attribute. A pipe symbol (|) symbol divides the pathname from the object name. Don’t type spaces before or after the | symbol.
140
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values For example, a scene might have a child of GroupA named Ball.tx and a different child of GroupB named Ball.tx. If you write this statement: Ball.tx = time;
Maya generates an error because it doesn’t know which Ball.tx to set. To eliminate the error, you must enter the pathname of the attribute as in this example: GroupA|Ball.tx = time;
The | symbol between GroupA and Ball.tx indicates that the object to the left of the symbol is the parent of the object to its right. Use no spaces before or after the | symbol.
Understanding unexpected attribute values As you work with expressions, you’ll sometimes see attribute values you didn’t expect. The following topics describe a few common causes of confusion.
Important
Values after rewinding When you rewind a scene, an expression executes with the last settings made for attribute values. This sometimes gives unexpected results.
Example Ball.tx = $distance; $distance = time;
Assume for this example you’ve set the starting frame of the animation to frame 0. The first statement sets Ball.tx to the variable $distance. The second statement sets $distance to the value of time.
Using Maya: Hypergraph, Sets & Expressions
141
Expressions
Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might lead you to believe your editing changes took effect.
Beyond the Basics Understanding unexpected attribute values When you play the animation, Ball moves along the X-axis with the increase in time. Ball’s X-axis position is 4 grid units, for example, when animation time equals 4 seconds. When you rewind the animation, Ball’s position along the X-axis doesn’t return to 0 as you might assume. The previous execution of the expression at time equals 4 set the $distance variable to 4. So rewinding sets Ball.tx to 4, then sets the value of $distance to 0, the value of time upon rewinding. If you rewind again, Ball’s position along the X-axis returns to 0 as desired. Because the previous execution of the expression upon rewinding set the $distance to 0, the expression now correctly sets Ball.tx to 0. To fix this problem, reverse the order of the statements and compile the expression: $distance = time; Ball.tx = $distance;
After you play and rewind the expression, the first statement executes and assigns the time to $distance. The next statement assigns Ball.tx the value of $distance, which the first statement set to the value of time. Because $distance is set to 0 as the first statement after rewinding, Ball returns to the desired translateX position.
Increment operations If you increment an attribute or variable during animation, you might be confused by its behavior.
Example Ball.ty = 0; Ball.ty = Ball.ty + 1;
Ball’s translateY position stays at 1 unit along the Y-axis. Ball’s translateY position doesn’t increase by 1 each frame as the animation plays.
Example Ball.ty = Ball.ty + 1;
Ball’s translateY position increases by 1 each frame as you play the animation. When you rewind the animation, translateY increases by 1 again.
142
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values When you play the animation again, the translateY position increases by 1 each frame. If you rewind the animation or drag the current time indicator, the translateY position continues to move up the Y-axis. The attribute never returns to its original position. To return Ball to a starting position each time you rewind, you must initialize the attribute to a starting value. For example, you could use the following expression: Ball.ty = Ball.ty + 1; if (frame == 1) Ball.translateY = 0;
This returns Ball to a Y position of 0 when you rewind to frame 1. When you drag the current time indicator, though, Ball doesn’t return to its Y position of 0. The if statement resets the value of translateY to 0 only when frame 1 plays. Frame 1 is the default frame that plays when you rewind an animation. You would need to use a different frame number in the if statement if you’ve set your animation to start at a different frame.
Data type conversions
The following topics describe the conversions that occur in such instances. Understanding these details might help you troubleshoot unexpected attribute and variable values. Unless you have programming experience, don’t intentionally convert data types. You might be confused by unexpected attribute and variable values.
Assigning to a floating point attribute or variable If you assign a vector to a floating point attribute or variable, Maya converts the vector to a floating point value according to this equation: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components in the vector. The resulting value is the magnitude of the vector.
Using Maya: Hypergraph, Sets & Expressions
143
Expressions
Maya is flexible in its handling of data types. If you do assignment or arithmetic operations between two different data types, Maya converts data type as necessary and doesn’t report a syntax error.
Beyond the Basics Understanding unexpected attribute values
Example Ball.scaleY = <<1,2,0>>;
Maya assigns the floating point scaleY attribute the converted vector: 2
2
2
1 +2 +0 =
5 = 2.236
If you assign an integer to a floating point attribute or variable, Maya makes no conversion. None is necessary.
Example Ball.scaleY = 1;
Maya assigns the value 1 to Ball.scaleY.
Assigning to an integer attribute or variable If you assign a floating point value to an integer attribute or variable, Maya deletes the decimal part of the number. If you assign a vector to an integer attribute or variable, Maya converts the vector to an integer using the square root equation in the previous topic. However, it deletes the decimal component of the result.
Example int $pi = 3.14;
Maya assigns the integer variable $pi the value 3. int $temp = <<1,2,0>>;
Maya assigns the integer variable $temp this vector value: 2
2
2
1 +2 +0 =
5 = 2.236 ≈ 2
It deletes the decimal component .2360607. The $temp variable receives the truncated value 2.
144
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values
Assigning to a vector attribute or variable If you assign an integer or floating point value to a vector attribute or variable, Maya puts the integer or floating point value into each component of the vector.
Example vector $speed = 1.34;
Because $speed is a vector, Maya assigns it <<1.34,1.34,1.34>>.
Using mixed data types with arithmetic operators The following table lists how Maya converts data types when you use arithmetic operators between different types in an expression. Operation
Resulting data type
integer operator float
float
integer operator vector
vector
vector operator float
vector
Suppose you multiply a vector variable named $velocity by a floating point number 0.5 as follows: $race = $velocity * 0.5;
If $velocity is <<2,3,0>> when the preceding expression executes, the $race variable is assigned the resulting vector value <<1,1.5,0>>.
Using Maya: Hypergraph, Sets & Expressions
145
Expressions
Example
Beyond the Basics Understanding unexpected attribute values
Important When Maya does arithmetic operations on literal constants and variables without a declared data type, it guesses the data type based on the values present. In the statement Ball.scaleY = 1/3;, for example, Maya treats 1 and 3 as integers because they have no decimal points. The expression divides integer 1 by integer 3. The integer result is 0 with a remainder of 1. Maya discards the remainder. Because Ball.scaleY is a floating point attribute, Maya converts the integer 0 result to floating point 0 (which is the same value), then assigns it to Ball.scaleY. To get the intended result of 1/3, you must type Ball.scaleY = 1.0/3.0; Maya treats 1.0 and 3.0 as floating point numbers because they have decimal points. The number 1.0 divided by 3.0 results in 0.33333333333.
146
Using Maya: Hypergraph, Sets & Expressions
8
Particle Expressions Particle expressions are more complex than other types of expressions. For example, you can write an expression to control all particles in an object the same way, or you can control each particle differently. Execution of expressions differs for particles than for other types of objects. To become proficient with particle expressions takes more study than for other expressions, but the resulting effects are worth the effort. This chapter guides you through the intricacies of working with particle expressions.
Claude Macri
This chapter has the following topics: •
“Understanding particle expressions” on page 148
•
“Understanding creation expression execution” on page 149
•
“Writing creation expressions” on page 150
•
“Understanding runtime expression execution” on page 152
•
“Writing runtime expressions” on page 153
•
“Working with particle attributes” on page 159
•
“Assigning to vectors and vector arrays” on page 193
•
“List of particle shape attributes” on page 196 Using Maya: Hypergraph, Sets & Expressions
147
Expressions
An expression moves a particle emitter in a corkscrew pattern and changes the color of trailing emitted particles as they age. The particles are displayed as Spheres render type.
Particle Expressions Understanding particle expressions
Understanding particle expressions If you select a particle shape node, the Creation and Runtime buttons in the Expression Editor are no longer dim and you can select them.
Buttons lit for particle shapes
These buttons let you write two types of expressions: creation and runtime. You can use both types for any attribute of a particle shape node. Though the details of execution are subtle, a creation expression generally executes when you rewind an animation or when a particle is emitted. A runtime expression typically executes for each frame other than the rewind frame or the frame in which a particle is emitted. By default, either type of expression executes once for each particle in the object. Creation and runtime expressions don’t execute at the same time. The age of each particle in the object determines whether a runtime expression or creation expression executes. Execution details are in “Understanding creation expression execution” on page 149 and “Understanding runtime expression execution” on page 152. The Default Object, Always Evaluate, and Convert Units options become dim when you select a particle shape node, and you can’t use them. Default Object is dim because a particle shape node’s attributes can be controlled by only one creation expression and one runtime expression. The particle shape node is always the default object when it’s the selected object. Always Evaluate is dim for particle shape node expressions because it has no effect on particle shape node expressions. See “How often an expression executes” in Chapter 7 for details on the checkbox.
148
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Understanding creation expression execution Convert Units is not selectable because you can’t alter how Maya handles unit conversions for particle shape node expressions. See “Speeding expression execution” on page 127 for details on how Maya converts units for other types of expressions.
Important You can’t write a different expression for each particle shape attribute as you can for other types of objects. Because you can write only one creation expression per particle shape, you don’t need to select an attribute from the Expression Editor’s Attributes list.
Understanding creation expression execution For a particle you create with the Particle Tool, a creation expression executes when you rewind the animation. For an emitted particle, a creation expression executes in the frame where the particle is emitted. However, there are exceptions to these rules as described in the following topics. Note that rewinding an animation two or more times in succession without playing the animation doesn’t execute a creation expression. Because no attribute value changes when you rewind several times in succession, the expression doesn’t execute.
Setting the dynamics start frame A creation expression executes once for each particle whose age is 0 when Maya evaluates dynamics. Maya evaluates dynamics whenever the animation time changes and it’s greater than or equal to the dynamics Start Frame setting—frame 1 by default. The Start Frame specifies when dynamic calculations begin for your animation. This option is available through Settings→Dynamics Controller, in the Extra Attributes section of the Attribute Editor. The animation time changes when you rewind, play, or otherwise change the current frame displayed. An emitted particle’s age is 0 in the frame where it’s emitted.
Using Maya: Hypergraph, Sets & Expressions
149
Expressions
You might also notice that all expressions in your scene are compiled and executed each time you open the scene. This occurs for architectural reasons and is unimportant to your work with expressions.
Particle Expressions Writing creation expressions Particles created with the Particle Tool have an age of 0 on and before the Start Frame. With the default animation frame range and Start Frame, rewinding an animation to frame 1 returns such particles to age 0. If you set the Time Slider’s start frame higher than the dynamics Start Frame, be aware that rewinding the animation might cause the age of particles to be greater than 0. If this occurs, the creation rule for the particles won’t execute.
Tip You can set options in the Attribute Editor to display the age of an object’s particles in the workspace. Set the particle shape’s Render Type to Numeric, click Add Attributes For Current Render Type, and enter age in the Attribute Name box. The age appears next to each particle. You can also examine the age of an object’s particles by entering print(age+“\n”) in a particle expression. See “print” on page 261.
Setting attributes for initial state usage If, at some frame, you’ve saved a particle shape’s attributes for its initial state, rewinding an animation does not return the age of the particles to 0. Suppose you’ve created a particle grid having an opacity attribute that fades gradually as the animation plays. You stop the animation at some frame where you decide the grid’s opacity looks good as a starting point for the animation. You then choose Settings→Initial State→Set For Current to cause the current value of the object’s attributes—including age—to become the initial state values. If you rewind the animation, the age of the particles in the grid is equal to age at the time you chose Set For Current. The age of the particles therefore is not equal to 0 when you rewind the scene. See “Understanding initial state attributes” on page 162 for more details on initial state attributes.
Writing creation expressions A creation expression is useful for attributes that don’t need to change during animation. For example, you might want all particles in an object to have a single velocity for the duration of an animation.
150
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing creation expressions A creation expression is also useful for initializing an attribute’s value for the first frame before a runtime expression takes control of the attribute value in subsequent frames. See “Writing runtime expressions” on page 153 for an example of the interaction between a runtime and creation expression.
Example Suppose you’ve used the Particle Tool to place a collection of particles in the workspace. You then create the following creation expression to control their velocity: particleShape1.velocity = <<0,1,0>>;
Important To use an expression to control particle attributes, make sure the selected object in the Expression Editor is a particle shape node, not the transform node of the particle object. If a particle object’s transform node is selected rather than the particle shape node, move the mouse pointer to the workspace and press your keyboard’s down arrow. This selects the particle shape node.
Using Maya: Hypergraph, Sets & Expressions
151
Expressions
All the particles move in a Y-axis direction at one grid unit per second as the animation plays.
Particle Expressions Understanding runtime expression execution
Understanding runtime expression execution For a particle you’ve created with the Particle Tool, a runtime expression typically executes in each frame after the frame that appears upon rewinding. For an emitted particle, a runtime expression typically executes in each frame after the first one where the particle was emitted. More specifically, a runtime expression executes once for each particle whose age is greater than 0, each time Maya evaluates dynamics. Maya evaluates dynamics whenever the Time Slider time changes and the time is greater than or equal to the dynamics Start Frame. To set the dynamics Start Frame, select Settings→Dynamics Controller from the Dynamics menu bar. Time changes when you rewind, play, or otherwise change the current frame displayed. A runtime expression executes once per oversample level per frame as you play or otherwise change the animation time. For example, if the oversample level is 4, Maya executes a particle shape expression four times per frame for each particle in the object. Use Settings→Dynamics Controller from the Dynamics menu to set the Oversample Level. Maya’s default setting is 1. In addition to executing when animation time changes, a runtime expression executes when the value of an attribute it reads changes, and when either of these actions occurs for an attribute the expression writes to: •
Some other node in Maya uses its value.
•
Maya needs the value to redraw the workspace contents. In this context, the predefined variables time and frame are also considered attributes the expression reads.
Important There are no creation expressions for nodes other than particle shape nodes. Such objects have only one type of expression. (It’s similar to a runtime expression.) For a particle shape node, you can write only one runtime expression for all its attributes. You don’t need to select an attribute from the Attributes list. You can create only one runtime expression per particle shape.
152
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Writing runtime expressions A runtime expression controls an attribute as an animation plays. Maya updates any attribute that’s assigned a value in a runtime expression each time the expression executes. This typically occurs once per frame. If an attribute is not set by a runtime expression, the attribute uses the creation expression value for subsequent frames of the animation.
Example Suppose you’ve created a grid of particles, then create this runtime expression for its velocity attribute: particleShape1.velocity = <<0,1,0>>;
The expression moves the grid of particles up at 1 grid unit per second as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
Expressions
Constant upward velocity
153
Particle Expressions Writing runtime expressions
Note To make the illustrations of particles easier to see in this and other chapters, we show them as small, shaded spheres rather than points.
To display particles as spheres: 1
Select the particle shape node.
2
In the Attribute Editor’s Render Attributes section, choose Spheres for the Render Type.
3
Click the Current Render Type button next to Add Attributes For. A Radius slider appears below the button.
4
Adjust the Radius to set the size of the spheres.
5
Turn on Shading→Smooth Shade All (at the upper left of the workspace).
With the default frame rate of 24 frames/second, the particles move 1/24 of a grid unit each frame. With the default oversampling level of 1, the runtime expression executes once per frame. Maya calculates the runtime expression once for each particle of an object. Because the expression sets the velocity to <<0,1,0>> each frame, the expression executes redundantly. This expression would therefore be more appropriate for a creation expression. However, either type of expression has the same effect in this example.
Example Suppose you’ve created a grid of particles, and your animation’s starting frame number is 0. You create this runtime expression for its velocity attribute: particleShape1.velocity = <<0,time,0>>;
The expression increases the Y component of velocity with the increasing value of time as the animation plays. This makes all particles in the grid rise with increasing velocity as the time increases. An increasing velocity is the same as acceleration.
154
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Increasing upward velocity
You need to use the statement in a runtime expression rather than a creation expression, because you’re increasing a value in the assignment each frame. Using the statement in a creation expression would instead set the velocity to a constant value <<0,0,0>>, because time equals 0 when the creation expression executes for the particle grid.
Example The previous examples gave all particles the same value for the velocity attribute. You can instead give each particle a different value for an attribute. Expressions
Suppose you’ve created a grid of 121 particles.
Suppose further you create this runtime expression for its acceleration attribute: particleShape1.acceleration = sphrand(2);
Using Maya: Hypergraph, Sets & Expressions
155
Particle Expressions Writing runtime expressions The expression executes once for each of the 121 particles each time the runtime expression executes. The sphrand(2) function provides a vector whose randomly selected components reside within an imaginary sphere centered at the origin and with a radius of 2. Each particle receives a different vector value. For details on the sphrand function, see “sphrand” in Chapter 9. Because each particle receives a different random vector for its acceleration each frame, the particles accelerate individually in a constantly changing direction and rate as the scene plays. This gives the acceleration abrupt changes in direction.
Important To give particles a constant acceleration, assign the acceleration attribute a constant value in a runtime expression rather than in a creation expression. Maya simulates the physics of acceleration. It initializes acceleration to <<0,0,0>> before each frame, or if the oversample level is greater than 1, before each timestep. If the oversample level is 2, there are 2 timesteps per frame. If the oversample level is 3, there are 3 timesteps per frame, and so on.
156
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Example Suppose you’ve set your animation’s starting frame to 0, and you’ve used the Particle Tool to place a single particle at the origin:
You then create a runtime expression to control its position: particleShape1.position = <<3,time,0>>;
When you play the animation, the runtime expression takes control of the attribute. In the first frame that plays, the particle jumps to <<3, time, 0>>. At the default frame rate of 24 frames/second, the position is <<3, 0.0417, 0>>, because the value of time is 0.0417. Expressions
Using Maya: Hypergraph, Sets & Expressions
157
Particle Expressions Writing runtime expressions Each subsequent frame moves the particle upward at a rate set by the incrementing value of time.
When you stop and rewind the animation, the particle moves back to the origin, the particle’s original position when you created it with the Particle Tool. When you created the particle, Maya stored its original position in an internally maintained initial state attribute named position0. For details, see “Understanding initial state attributes” on page 162. Because the attribute has no creation expression controlling its value, Maya sets the attribute to its initial state position0 value of <<0,0,0>>. To prevent the particle from jumping back to the origin after rewinding, you can write a creation expression that’s the same as the runtime expression: particleShape1.position = <<3,time,0>>;
When you rewind the animation, the particle moves to position <<3,time,0>>. Because time is 0 at frame 0, the particle starts at position <<3,0,0>> when you rewind the animation. In the second and following frames, it moves upward synchronized with the increasing value of time. Though this example showed how to initialize the position attribute with a creation expression, you could have gotten almost the same result by saving the object’s current attribute values for initial state usage:
To save the current attributes for initial state usage: 1
Select the particle shape node.
2
Advance the animation to frame 1. Here the position of the particle is <<3, 0.0417, 0>>.
3
158
Select Settings→Initial State→Set for Current.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes When you rewind the animation, Maya positions the object at the initial state setting of its position attribute. This setting is <<3, 0.0417, 0>> because you selected Set for Current while the position was equal to <<3, 0.0417, 0>>.
Working with particle attributes When you create a particle object, it has two types of static attributes: •
attributes for its transform node
•
attributes for its particle shape node These attribute are permanently part of a particle object. You typically won’t work with the static attributes that are part of its transform node, for example, scaleX, translateX, and so on. These attributes control the position and orientation of the transform node of the entire particle object, not the position and orientation of the individual particles. You’ll instead work with the static attributes of the particle shape node, for example, position, velocity, acceleration, and age. These attributes appear in the Attributes list of the Expression Editor’s when you choose Object Filter→Dynamics→Particles for the selected particle object.
Adding dynamic attributes
When you add a dynamic attribute to an object, the attribute names appear in the Expression Editor’s Attributes list.
Note See “List of particle shape attributes” on page 196 for attributes you can use with particle objects.
Using Maya: Hypergraph, Sets & Expressions
159
Expressions
You also use expressions to control dynamic and custom attributes you add to a particle shape node. See “Attributes” in Chapter 5 for details on the differences between static, dynamic, and custom attributes. See “Assigning to a custom attribute” on page 169 for details on working with custom attributes.
Particle Expressions Working with particle attributes
Understanding per particle and per object attributes You can dynamically add two types of attributes to a particle shape node: •
per particle
•
per object A per particle attribute lets you set the value of the attribute individually for each particle of the object. A per object attribute lets you set the attribute value for all particles of the object collectively with a single value. For example, a per particle opacityPP attribute lets you set a unique opacity value for each particle of an object. With a per object opacity attribute, you must give all particles of the object the same opacity. A per particle attribute holds the attribute values for each particle in the object. For example, though there is only one opacityPP attribute in a particle object, the attribute holds the value for each particle’s opacity value. The attribute holds the values in an array. In simple terms, an array is a list. Though per particle attributes are best for creating complex effects, you can’t keyframe them. You can keyframe per object attributes. You can add per particle or per object attributes for opacity, color, lifespan, and other effects. For a particle shape node attribute, you can tell whether it’s a per particle or per object attribute by examining the Attribute Editor’s particle shape folder. All per particle attributes appear in the Per Particle (Array) Attributes section of the folder. The per object attributes appear elsewhere in the folder. Most appear above the Per Particle (Array) Attributes section, for example, in the Particle Attributes and Render Attributes sections. For many dynamically added attributes, you can also tell whether they are per particle or per object by their names in the Expression Editor. If a name ends with PP, it’s per particle. Otherwise, it’s usually per object. Note that position, velocity, and acceleration are per particle attributes, though their names don’t end with PP.
160
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes The most common way to create dynamic per object or per particle attributes for a particle shape is by clicking one of the following buttons in the Add Dynamic Attributes section of the Attribute Editor:
For example, if you click the Opacity button, a window appears and lets you choose whether to add the opacity characteristic as a per object attribute or a per particle attribute. If you choose per particle, the Attributes list of the Expression Editor displays a new attribute for the selected particle shape node: opacityPP. If you choose per object, an opacity attribute is displayed instead. For attributes other than lifespan, if you add both a per particle attribute and a per object attribute for a characteristic, the per particle attribute takes precedence. For instance, if you add opacity and opacityPP, the opacityPP attribute controls the opacity of the particles of the specified object. When you click Lifespan and add both a per particle and per object attribute, Maya adds an additional attribute named useLifspanPP that lets you choose whether lifespanPP or lifespan controls the characteristic.
If you click the Goal button in the Add Dynamic Attributes section of the Attribute Editor, Maya adds a per object attribute and a per particle attribute. The attributes are named goal and goalPP. Neither attribute has precedence. Maya multiplies the value of the per object goal attribute by the per particle goalPP attribute to create the final goal effect for each particle.
Using Maya: Hypergraph, Sets & Expressions
161
Expressions
By default, the Attribute Editor setting of useLifespanPP is on, so the lifespanPP attribute control the characteristic. If you turn useLifespanPP off in the Attribute Editor, lifespan controls the characteristic.
Particle Expressions Working with particle attributes
Important You can use per particle attributes only in particle expressions. You can use per object attributes in particle or nonparticle expressions. If you use a runtime expression to read or write a per object attribute of a particle object with many particles, you can speed up expression execution by reading or writing the attribute in a nonparticle expression. Nonparticle expressions execute only once per object. Particle expressions execute once for each particle in the object. Because reading or writing a per object attribute more than once per frame is redundant, you can save processing time by working with them in nonparticle expressions.
Understanding initial state attributes For all static per particle attributes, Maya keeps a corresponding attribute with a name ending in 0. For example, the static attributes position, velocity, and acceleration have counterparts position0, velocity0, and acceleration0. An attribute name that ends in 0 holds the initial state value of the attribute. When you save a particle object’s current attribute values for initial state usage, Maya assigns those values to the initial state attributes. To save a particle object’s attribute values for initial state usage, use either of these commands: •
Settings→Initial State→Set for Current This saves all per particle attribute values for the selected particle shape node or rigid body.
•
Settings→Initial State→Set for All Dynamic This saves all per particle attribute values for all dynamic objects in the scene—in other words, all particle shape nodes and rigid bodies. When you dynamically add a per particle attribute by clicking one of the buttons in the Add Dynamic Attributes section of the Attribute Editor, Maya also adds a corresponding initial state attribute with name ending in 0. For example, when you click the Lifespan button in the Attribute Editor, Maya adds lifespanPP0. Though an initial state attribute doesn’t appear in the Expression Editor, you can read its value to retrieve the initial state.
162
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes When you use the Add Attribute window to add a custom per particle (array) attribute to a particle shape, you must choose whether you want to add it with Add Initial State Attribute on or off. If you choose on, Maya creates a corresponding initial state attribute for the added attribute. If you choose off, Maya doesn’t create a corresponding initial state attribute for the added attribute. Without this corresponding attribute, you can’t save a particle object’s current attribute values for initial state usage. You must write a creation expression if you decide to initialize the custom attribute’s value upon rewinding the animation.
Note A per particle attribute is called an array attribute in the Add Attribute window. The two terms have the same meaning. See “Assigning to a custom attribute” on page 169 for details. You can see whether a custom attribute was added with Add Initial State Attribute on or off by using the MEL listAttributes command. (See the online MEL documentation for details.)
When you add a custom attribute to a particle shape, do not end the name with a 0 character. You’ll subvert Maya’s naming scheme for the initial state attribute associated with an attribute. For any attribute, if you don’t initialize its value with a creation expression or save its value for initial state usage, Maya gives the attribute a default value at the animation’s first frame. It typically assigns the attribute the value 0 or <<0,0,0>>, as appropriate for the data type. In other cases, for instance, opacityPP and opacity, Maya assigns the attribute a default value of 1. If you know you’re going to write a creation expression for a custom attribute, you can set Add Initial State Attribute off when you add the attribute. Otherwise, set Add Initial State Attribute on whenever you add a custom attribute. When a creation expression assigns a value to an attribute, the value overrides the attribute’s initial state value for all particles whose age is 0.
Using Maya: Hypergraph, Sets & Expressions
163
Expressions
You might want to read the value of an initial state attribute in an expression, for instance, to use its original (rewind) value for some calculation. If you assign a value to an initial state attribute. Maya will overwrite the value if you save the attribute value for initial state usage.
Particle Expressions Working with particle attributes
Example of assigning to a dynamic per particle attribute Suppose you’ve used the Particle tool to create a small number of particles named Bubbles:
The following steps show how to assign a different lifespanPP value for each of the particles to make them disappear as the scene plays.
To use a per particle lifespanPP attribute: 1
Select the particle shape node for Bubbles in the Outliner or Hypergraph.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Lifespan button. A window appears that prompts you to choose whether to add the attribute per object or per particle.
3
Select Add Per Particle Attribute, then click the Add Attribute button. This adds a lifespanPP attribute to the particle shape node for Bubbles. You can set this attribute to give each particle a different value for how long it lives.
4
Select Bubble’s particle shape node in the Expression Editor.
5
Turn on Creation in the Expression Editor.
6
Create the following expression: BubblesShape1.lifespanPP = rand(5); print("Hello\n");
7
164
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Because lifespanPP is a per particle attribute and the object’s particle shape node is selected in the Expression Editor, the expression does an execution loop of both statements once for each particle in the object. Because the expression is a creation expression, it executes after the expression compiles. It also executes when you rewind the animation after playing it. For each of the particles, the first statement assigns the lifespanPP attribute a random floating point number between 0 and 5. The rand function returns a different random number each time it executes, so each particle has a different lifespanPP value between 0 and 5. For details on the rand function, see chapter 9, “Functions.” The second statement displays Hello in the Script Editor, once for each particle. The creation expression gives each particle a random lifespanPP of less than 5 seconds. The particles disappear from the scene at random times between 0 and 5 seconds of scene play. (Maya gives particles created with the Particle tool an age of 0 in the first frame of the animation.)
Expressions
Particles remaining after three seconds, with creation expression for lifespanPP.
When you rewind the animation, the particles reappear in the scene. Playing the scene again makes them disappear at random times within 5 seconds.
Using Maya: Hypergraph, Sets & Expressions
165
Particle Expressions Working with particle attributes It’s important that you use a creation expression for this effect. If you were to use a runtime expression, the particles would disappear more quickly as the animation plays, and Hello would appear 100 times each frame. The reason for this is subtle: In each frame, a runtime expression would assign a different random value between 0 and 5 seconds to the lifespanPP of each particle. The expression would likely assign one or more of the particles a lifespanPP near 0. Meanwhile, the age of each particle increases from 0 at the first frame of play. Maya checks the age of each particle every frame. If the age is greater than the lifespanPP value, Maya removes the particle. Because the expression would reassign new random lifespanPP values to each remaining particle in each frame, the new assignments would likely give a few particles a lifespanPP that’s less than their current age value. Maya deletes such particles. This causes the object’s particles to disappear quickly from the scene.
Particles remaining after one second, with runtime expression for lifespanPP.
166
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Example of assigning to a dynamic per object attribute Suppose you’ve used the Particle tool to create the same Bubbles particle object described in the previous topic.
The following steps show how to give the particles a single lifespan. All particles disappear at the same time when you play the scene.
To use a per object lifespan attribute: Select the particle shape node for Bubbles in the Outliner or Hypergraph.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Lifespan button. A window appears that prompts you to choose whether to add the attribute per object or per particle.
3
Select Add Per Object Attribute, then click the Add Attribute button. This adds the lifespan attribute to the particle shape node for Bubbles.
4
In the Expression Editor, turn on Creation.
5
Create this creation expression: BubblesShape1.lifespan = 1.33; print("Hello\n");
Because this is a creation expression, it executes after the expression compiles. It also executes when you rewind the animation after playing it.
Using Maya: Hypergraph, Sets & Expressions
167
Expressions
1
Particle Expressions Working with particle attributes For each of the 100 particles, the first statement assigns the lifespan attribute the value 1.33. The second statement displays Hello in the Script Editor once for each particle. 6
Play the animation. Because all particles have a lifespan of 1.33, they disappear from the scene after 1.33 seconds of animation play. When you rewind the animation, the particles reappear in the scene. Playing the scene again makes them disappear again after 1.33 seconds.
1.32 seconds of animation
1.33 seconds of animation
If you had put the preceding statements in a runtime expression, the particles would still disappear in 1.33 seconds. The expression would assign a lifespan of 1.33 seconds to all 100 particles redundantly each frame. The age of the particles is 0 in the first frame of their creation. (Maya gives particles created with the Particle tool an age of 0 in the first frame of the animation.) Reassigning lifespan 1.33 each frame has no effect on the age of the particles. Their age increases from the first frame regardless of the lifespan value. Note that, unlike particles created with the Particle Tool, the age of emitted particles starts in the frame where they’re emitted.
168
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Assigning to a custom attribute You can add a custom attribute to a particle shape node and control its value in an expression.
To add a custom attribute: 1
Select the object’s particle shape node rather than its transform node. Use the Hypergraph or Outliner to select the shape node.
2
Choose Modify→Add Attribute. or In the Add Dynamic Attributes section of the Attribute Editor, click the General button. The Add Attribute window appears:
Expressions
3
Enter a name for the attribute in the Attribute Name box.
Using Maya: Hypergraph, Sets & Expressions
169
Particle Expressions Working with particle attributes 4
Make sure Make attribute keyable is on.
5
Select one of the following data types:
6
•
Vector
Creates a vector attribute consisting of three floating point values.
Float
Creates a floating point attribute.
Integer
Creates an integer attribute.
Boolean
Creates an attribute consisting of an on/off toggle.
Select one of the following attribute types: Scalar
Creates a per object attribute that you can set to a single value that applies to every particle in the object. A vector scalar is considered a single value with three numbers.
Array
Creates a per particle attribute. You can set this type of attribute to different values for each particle.
If you select Scalar, you can specify Minimum, Maximum, and Default values for a Float or Integer attribute. Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value displayed for the attribute. Because you’re going to control the attribute’s value with an expression, you might want to skip entering values for these options. An expression isn’t bound by the Minimum and Maximum values. The attribute receives whatever value you assign it in the expression. The expression can read the attribute’s Default value or any other value you give it in the Attribute Editor or Channel Box. When you select Scalar, you can’t create a counterpart initial state attribute by turning on Add Initial State Attribute.
•
If you select Array, you can also create a counterpart initial state attribute by turning on Add Initial State Attribute. See “Understanding initial state attributes” on page 162 for details. You can’t set Minimum, Maximum, or Default values for an Array attribute.
7
170
Click Add if you want to add more attributes. Click OK to add the attribute and close the Add Attribute window.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes The new attribute appears under the Dynamic Attributes section of the Attribute Editor.
To assign values to a custom attribute: You can assign values to a custom attribute with the same techniques you use to assign values to static or dynamic attributes.
Example Suppose you’ve created a 100-particle object named sunspot, and you add to its particle shape node a vector per object attribute named glow. You assign the glow attribute a vector value in a creation expression as follows: sunspotShape1.glow = <<3,0,0>>; print(sunspotShape1.glow + "\n");
When you rewind the animation, the glow attribute of sunspotShape1 receives the value <<3,0,0>>. The print statement displays the values in the Script Editor.
Example
float $randomNumber = rand(1); sunspotShape1.heat = <<$randomNumber,0,0>>; print(sunspotShape1.heat + "\n");
When you rewind the animation, the expression loops through 100 executions, once for each particle. The first statement sets the $randomNumber variable to a random number between 0 and 1. The next statement assigns a vector to the heat attribute of a single particle. The left component of the vector assigned to heat is a different random number each time the statement executes. The middle and right components are always 0. One particle might have the value <<0.57, 0, 0>>, another <<0.32, 0, 0>>, another <<0.98, 0, 0>>, and so on. The print statement displays the values in the Script Editor.
Using Maya: Hypergraph, Sets & Expressions
171
Expressions
Suppose you add a vector per particle attribute named heat to the 100particle sunspot shape node. You can give each particle a different value as in this creation expression:
Particle Expressions Working with particle attributes
Note If you add a custom vector attribute to an object, Maya displays the attribute in the Attribute Editor, but you can’t enter its value there. You must enter a value for it in an expression or with the Component Editor available from the Attribute Editor.
Assigning to a particle array attribute of different length You can assign the array attribute of one particle shape node to another node having a different number of particles. The assignment is affected by which node you select in the Object Selection list in the Expression Editor. The number of particles in the selected particle shape node sets the number of statement executions, and, therefore, affects the assignment.
Example Suppose your scene contains an object named ThreePts made of three particles and an object named TwoPts made of two particles. The three particles in ThreePts are at these positions: -5 0 0 -4 0 0 -3 0 0
The two particles in TwoPts are at these positions: 5 0 0 6 0 0
172
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Suppose you write this runtime expression with TwoPtsShape2 selected in the Object Selection list: ThreePtsShape1.position = TwoPtsShape2.position; print(ThreePtsShape1.position+"\n");
In the first frame of runtime expression execution, this assigns the position attribute of TwoPts to the position attribute of ThreePts. In other words, the expression repositions the three particles to the position of the two particles. Because you selected TwoPtsShape1 in the Object Selection list, the expression will execute once for each of its two particles. When you play the scene, the runtime expression executes. The first particle of ThreePts now is at the position of the first particle of TwoPts. The second particle of ThreePts is at the position of the second particle of TwoPts. The third particle of ThreePts doesn’t change position. The expression executes only twice each frame. In summary, the particles in ThreePts are at these positions: 5 0 0 6 0 0 -3 0 0
Expressions
Suppose you write the preceding runtime expression instead with ThreePtsShape1 selected in the Object Selection list. Again, the expression repositions the three particles to the position of the two particles. Because you selected ThreePtsShape1 in the Object Selection list, the expression executes once for each of its three particles. When you play the scene, the runtime expression executes. The first particle of ThreePts moves to the position of the first particle of TwoPts. The second particle of ThreePts moves to the position of the second particle of TwoPts. Using Maya: Hypergraph, Sets & Expressions
173
Particle Expressions Working with particle attributes Because TwoPts lacks a third particle, the third particle of ThreePts is repositioned at the position of the first particle of TwoPts. You can’t see this in the workspace because the particles are in the exact same position. The three particles in ThreePts are at these positions: 5 0 0 6 0 0 5 0 0
As this example shows, the assignment statement executes three times. When it runs out of counterpart particles to assign to, it loops around and assigns to the previous particles. It starts with the first particle in the object, and continues through the other particles. For example, suppose you create a five-particle object named FivePts with the Particle Tool, and position the particles somewhere in the workspace. Suppose further you select the particle shape node of FivePts in the Expression Editor, then make this assignment in a runtime expression: FivePtsShape1.position = TwoPtsShape2.position;
The five particles move to these positions as soon as the runtime expression executes for the first time: 5 6 5 6 5
0 0 0 0 0
0 0 0 0 0
Using creation expression values in a runtime expression A runtime expression can’t read a variable you’ve defined in a creation expression unless you define the variable as global. However, you can create a custom attribute, assign it a value in a creation expression, then read or write its value in a runtime expression.
174
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes For example, suppose you assign a particle object’s position to a variable named $oldposition in a creation expression: vector $oldposition = particleShape1.position;
The runtime expression for the same particle shape node can’t read the contents of the $oldposition variable. To solve this problem, you can create an attribute for the object, assign it a value in the creation expression, then use the attribute value in a runtime expression. For example, suppose you create an attribute named oldpos, and assign it the following position in a creation expression: particleShape1.oldpos = particleShape1.position;
You can read the value of particleShape1.oldpos in a runtime expression. Note that you don’t need to create an attribute to hold the object’s initial position. The initial position already exists in its initial state attribute named position0. This attribute doesn’t appear in the Expression Editor’s Attributes List.
Working with position, velocity, and acceleration
Unless you have a solid grasp of physics, avoid setting a combination of the position, velocity, and acceleration attributes. To give a smooth, random motion to particles with a runtime expression, use a random number function such as sphrand to assign random numbers to the particle shape’s acceleration attribute. A change in acceleration always gives smooth motion no matter how abruptly its value changes. To give a jittery random motion to particles with a runtime expression, use a random number function such as sphrand to assign random numbers to the particle shape’s velocity or position attributes. See “Random number functions” on page 239 for details on how to use random number functions. If an expression and a dynamic field control an object’s position, velocity, or acceleration, Maya calculates the expression’s effect first, then adds the field’s effect.
Using Maya: Hypergraph, Sets & Expressions
175
Expressions
To create various types of particle motion, you can assign vector values to the position, velocity, or acceleration attribute. See “Writing runtime expressions” on page 153 for examples of working with these attributes.
Particle Expressions Working with particle attributes
Example Suppose a particle drops under the influence of a gravity field with default gravity options. Gravity accelerates the particle at 9.8 units per second per second down the Y-axis. In other words, the default acceleration of gravity is <<0,-9.8,0>>. Suppose further you write the following runtime expression for the particle: velocity = velocity + <<1,0,0>>;
As each frame plays, Maya first calculates the particle’s velocity from the expression statement. The velocity increases 1 unit per second in an X-axis direction. Maya then adds the gravitational acceleration to the velocity. Maya uses the combined result to compute the particle’s position. Of course, you won’t see this calculation process. The frame displays the particle in the appropriate position after all computation. Note that the expression adds the constant <<1,0,0>> to the particle’s velocity each frame as the animation plays. This makes the particle move with increasing velocity in an X direction as the time increases. An increasing velocity is the same as acceleration. The ball represents the particle’s position after several frames. The white squares represent the particle’s position as time increases.
Gravity alone
176
Using Maya: Hypergraph, Sets & Expressions
Gravity in combination with velocity = velocity + <<1,0,0>>
Particle Expressions Working with particle attributes The acceleration attribute works differently than the position or velocity attributes in an important way. Maya initializes its value to <<0,0,0>> before each frame. If the oversample level is greater than 1, this initialization occurs before each timestep.
Example Suppose you write the following runtime expression for a five-particle object unaffected by gravity: acceleration = acceleration + <<0,1,0>>;
Rather than adding <<0,1,0>> to the acceleration value each frame, acceleration remains a constant <<0,1,0>> for each of the particles. This happens because Maya initializes the value of acceleration to <<0,0,0>> before each frame. Suppose you connect the particle object to gravity with default settings. The acceleration of the particle becomes <<0,1,0>> plus <<0,-9.8,0>>, which equals <<0,-8.8,0>>. The acceleration assigned in the expression slows the downward acceleration of the gravity. Suppose you change the previous expression to this: acceleration = acceleration + sphrand(3);
acceleration = sphrand(3);
As each frame plays, Maya first calculates each particle’s acceleration from the expression statement. Each particle receives the result of the sphrand(3) function. The sphrand(3) function provides a vector whose randomly selected components reside within a spherical region centered at the origin with radius 3. Each particle receives a different vector value. Finally, Maya adds gravity’s acceleration to the expression acceleration resulting from sphrand(3). The frame displays each particle in the resulting position. Because of the random values resulting from the expression, each particle has an acceleration that differs slightly from gravity in direction and magnitude. Because the sphrand(3) function executes for each particle each frame, the acceleration of each particle varies each frame.
Using Maya: Hypergraph, Sets & Expressions
177
Expressions
Because Maya sets acceleration to <<0,0,0>> before each frame, the statement has the same result as the following statement:
Particle Expressions Working with particle attributes
Gravity in combination with acceleration = sphrand(3)
Position at rewind
Gravity alone (shown for comparison) Position after one second
This example shows that you can take advantage of the additive effect of fields and the acceleration attribute to create custom field effects.
Tip You can turn off the effect of all fields on a particle shape node attribute by setting its dynamicsWeight attribute to 0.
Working with color Coloring particles is a fundamental task for expression writers. As the techniques for coloring particles are easiest to learn by example, we provide the following lesson.
Example Suppose you’ve used the Particle tool to create a randomly positioned collection of particles named Bubbles. You can use a creation expression to give the particles a constant color during animation play.
178
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
To give the particles a constant color: 1
Select the particle shape node for Bubbles in the Hypergraph or Outliner. To write an expression to color particles, you must dynamically add the attribute that lets you color them.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Color button.
3
Select Add Per Particle Attribute, then click the Add Attribute button. This adds an rgbPP attribute to the particle shape node for Bubbles. Because you’re adding this attribute as a per particle attribute, you can give each particle a different color.
4
Choose Shading→Smooth Shade All. This step is necessary to make the correct particle color appear when you assign the rgbPP attribute a value in an expression.
5
In the Expression Editor, select Bubble’s particle shape node.
6
Turn on Creation in the Expression Editor. Because you’ll give the particles a color that doesn’t change during the animation, you use a creation expression.
7
Enter this expression: BubblesShape1.rgbPP = <<1,0,0>>;
Using Maya: Hypergraph, Sets & Expressions
179
Expressions
A window appears that prompts you to choose whether to add the attribute per object, per particle, or connected to a shader.
Particle Expressions Working with particle attributes When you click the Create button in the Expression Editor, Maya checks the syntax of the expression. Assuming you made no typing errors, the expression executes once for each of the 100 particles. The expression colors all particles in the object red. The double angle brackets << and >> enclose a vector that sets the red, green, and blue components of the rgbPP attribute to 1, 0, and 0. In the RGB color scheme, this gives the object a red color. 8
Play the animation. Because the expression is a creation expression, it executes when you rewind the animation. The particles remain red for entire animation because the red color is never changed by a runtime expression.
Tip See the online version of this documentation for colored illustrations. The following steps show how to give the particles a randomly changing color as the animation plays.
To give the particles a randomly changing color: 1
With BubblesShape1 selected in the Expression Editor, turn on Runtime.
2
Enter this runtime expression: BubblesShape1.rgbPP = sphrand(1);
180
3
Click the Create button to compile the expression.
4
Rewind the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Because the creation expression executes when you rewind, the particles are red. 5
Play the animation. The runtime expression takes control of the rgbPP attribute. Because rgbPP is a per particle attribute, the runtime expression executes for each particle in the object each frame. For each particle, the expression assigns the rgbPP attribute the output from the execution of the sphrand function with an argument of 1. The sphrand function assigns each particle’s rgbPP color a random vector. The vector represents a random point in a spherical region of radius 1. The left, middle, and right rgbPP color components have a value no less than -1 and no greater than 1. Values less than 0 are treated as 0. The sphrand function returns a different random vector each execution. So each particle has a different random rgbPP value, and therefore, a different color. The color of each particle changes each frame.
You can slow the change of colors to create a flashing Christmas light effect. The following steps make the particles change colors every second of animation.
To slow the change of color: 1
Change the runtime expression to this: if ((frame % 24) == 0) BubblesShape1.rgbPP = sphrand(1);
Using Maya: Hypergraph, Sets & Expressions
181
Expressions
If you rendered the animation and played it back at 24 frames per second, you would have trouble seeing the color of a particle in any instant because the color changes so quickly.
Particle Expressions Working with particle attributes This expression uses the modulus operator (%) to control when the rgbPP attribute of the particles receives a random color. The modulus operator returns the remainder after division. For example, 24 divided by 24 returns 0, but 25 divided by 24 returns 1. (Dividing 25 by 24 equals 1 with a remainder of 1.) If the value of frame divided by 24 is equal to any number with a remainder of 0, the assignment to BubblesShape1.rgbPP occurs. In other words, the assignment occurs when frame equals 24, 48, 72, and so on. At an animation rate of 24 frames/second, the assignment happens once each second.
Important Avoid using the modulus operator with floating point values. Because of number rounding in floating point division, you won’t likely get a return value of exactly 0 with the modulus operator. Instead use an integer value when possible. 2
Rewind and play the animation. When you rewind the animation, the particles turn red because the creation expression executes. When the animation plays, the particles receive a random color once each second.
1 second
2 seconds
3 seconds
Note that you can change the red rewind color to random colors by changing the creation expression to this: BubblesShape1.rgbPP = sphrand(1);
This is the same expression as the runtime expression.
182
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Working with emitted particles If you make an object emit particles, you can write a creation or runtime expression for attributes of the emitted particles. For example, you can assign the emitted particles a value for lifespan, opacity, and color.
To write an expression for emitted particles: 1
Create the emitter.
2
Add the desired dynamic attribute to the emitter shape node.
3
Select the shape node of the emitted particles in the Expression Editor, then write the expression to control the attribute.
Example Suppose you’ve created an emitter and added a per particle lifespanPP attribute to it. The following creation expression gives the emitted particles a lifespan of 2 seconds: particleShape1.lifespanPP = 2;
Each particle disappears two seconds after it’s emitted.
Important Expressions
Avoid assigning a per particle attribute to another object’s per particle attribute if the particles of either object die. As particles die, the order of expression evaluation changes for the object’s particles. This causes unexpected results. You can, though, assign from one attribute to another in the same object with dying particles. The array indexes of the different attributes are in synch with each other. For example, don’t write an expression like this: emittedShape1.lifespanPP = 2; emittedShape1.rgbPP = otherParticleShape2.rgbPP
Working with collisions If you make a particle object collide with an object, you can write an expression to trigger expression statements after the collision. For example, you can change the color, opacity, or lifespan of the colliding particles.
Using Maya: Hypergraph, Sets & Expressions
183
Particle Expressions Working with particle attributes
To prepare for writing the expression: 1
Select the particle shape node of the particles in the Outliner or Hypergraph.
2
Select Settings→Particle Collision Events from the Dynamics menu bar. The Particle Events window appears.
3
Click Create Event. This adds an event attribute to the selected particle shape node. The Expression Editor displays the added event attribute in the Attributes list. Close the Particle Events window.
To write the expression: 1
Select the particle shape node of the emitted particles.
2
Write the runtime or creation expression using the value of any of these attributes of the emitted particle’s shape node: Long name
Short name
event
Description
Data Type
Contains the number of times each particle in the object has hit something (on a per particle basis).
float array
eventCount
evc
Total number of events that have occurred for all particles of the object.
integer
eventTest
evt
True if an event has occurred since the last time an expression or MEL getAttr command read the eventTest value.
boolean
The eventCount and eventTest are static attributes. A particle shape node has them as soon as you create the particle object. Though they don’t appear in the Expression Editor, you can use their values in an expression. You must first create the event attribute as described previously.
184
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Example Suppose you’ve created a five-particle object named Peas that falls with gravity and collides with a plane.
You can make the particles turn red when the first particle hits the plane. Select PeasShape1 in the Outliner or Hypergraph.
2
From the Dynamics menu bar, select Settings→Particle Collision Events.
3
In the Particle Events window, click Create Event, then close the window. This adds an event attribute to PeasShape1.
4
In the Add Dynamic Attributes section of the Attribute Editor, click Color. The Particle Color window appears.
5
Select Add Per Particle Attribute, then click Add Attribute. This adds a per particle attribute named rgbPP. This attribute controls the red, green, and blue color scheme of each particle. The particles turn black after you add the rgbPP attribute. Adding the rgbPP attribute turns off the default coloring of the particles and gives them a value of <<0,0,0>>.
6
Choose Shading→Smooth Shade All. This step is necessary to make the correct particle color appear when you assign the rgbPP attribute a value in an expression.
Using Maya: Hypergraph, Sets & Expressions
185
Expressions
1
Particle Expressions Working with particle attributes 7
With PeasShape1 selected in the Expression Editor, create this runtime expression: if (event == 1) rgbPP = <<1,0,0>>; else if (event == 2) rgbPP = <<0,1,0>>; else if (event >= 3) rgbPP = <<0,0,1>>; else rgbPP = <<1,1,1>>;
8
Rewind the animation. Upon rewind, the particles are black. The particles have the default black rgbPP color because no creation expression exists for the object.
9
Play the animation. The particles fall toward the plane. The runtime expression executes as each frame plays. The event attribute is a per particle attribute. This isn’t obvious because its name doesn’t have PP as the last two characters. Because event holds a running count of collisions for each particle, event contains 0 for each particle until the first collision with the plane. Until the first collision occurs, the final else statement executes: else rgbPP = <<1,1,1>>;
This statement executes because event doesn’t equal 1, 2, 3, or a number greater than 3. The vector <<1,1,1>> in the RGB color scheme represents the color white. When the first particle of PeaShape1 hits the plane, Maya sets the event attribute for that particle to 1. This triggers execution of the first assignment, which sets the colliding particle’s rgbPP value to <<1,0,0>>. In the RGB color scheme, this vector value represents red. (When red equals 1, green equals 0, and blue equals 0, the resulting color is red.)
186
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Red particle after collision
Tip See the online version of this documentation for colored illustrations. Note that the value of the event attribute reflects the collision count in the frame after each collision. For example, if a particle collides with the plane in frame 10, event is updated in frame 11. Expressions
When the other particles hit the plane for the first time, they also turn red after they collide.
A particle stays red until it collides with the plane for the second time, when event equals 2. After a second collision, the particle turns green.
Using Maya: Hypergraph, Sets & Expressions
187
Particle Expressions Working with particle attributes After a third collision, when event is equal to or greater than 3, a particle turns blue. Each particle stays blue for all subsequent collisions as the animation plays.
10 Rewind the animation. The particles turn black again because they receive the default rgbPP value <<0,0,0>>. When you play the animation again, the particles turn white, red, green, and blue in the same sequence as before. You can refine the animation by giving the particles a color other than black for the frame that appears upon rewinding. For example, you can give the particles a white color upon rewinding with two techniques: •
Write this creation rule for PeasShape1: rgbPP = <<1,1,1>>;
This statement executes for each particle in the object, so they all receive the same white color when you rewind the scene. •
Select PeasShape1, rewind the animation, and play one frame.
11 Choose Settings→Initial State→Set for Current. This saves all PeasShape1 attribute values from the current frame for the initial state of the attributes. The current value for rgbPP will be used when you rewind the animation. Because you played the second frame of the animation, this saves the white color of the particles at that frame for use upon rewinding the animation.
188
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Note that Set for Current saves all attribute values, including position, velocity, acceleration, and so on. In cases where you have several changing attribute values during playback, Set for Current might save undesired attribute values in addition to the desired ones. In such cases, use a creation expression.
Working with specific particles A per particle attribute holds the attribute values for each of an object’s particles. For example, the rgbPP attribute holds the value for each particle’s rgbPP value. Each particle has a unique numerical particle identifier. A particle’s identifier is stored in a per particle particleId attribute for the particle object. As you create the particles of a particle object, Maya assigns each particle a particleId in sequential order starting at 0. For example, suppose you use the Particle tool to create a five-particle object by clicking positions in the workspace. The first click of the mouse creates a particle with particleId 0, the second click creates a particle with particleId 1, the third click creates a particle with particleId 2, and so on.
You can assign per particle attribute values to specific particles using the particleId attribute.
Example Suppose you’ve used the Particle tool to create a grid of eight particles named ColorGrid. In the Attribute Editor, you’ve set the Render Type of the particles to Spheres. You’ve chosen Shading→Smooth Shade All to display the particles with shading.
Using Maya: Hypergraph, Sets & Expressions
189
Expressions
When an emitter emits particles, Maya assigns particleId numbers in sequential order starting with the first particle emitted. The first emitted particle has particleId 0, the second has particleId 1, the third has particleId 2, and so on.
Particle Expressions Working with particle attributes
You can give the particles different colors based on their particleId.
To color the particles based on particleId: 1
Select the ColorGrid.
2
In the Add Dynamic Attributes section of the Attribute Editor, click Color. The Particle Color window appears.
3
Select Add Per Particle Attribute, then click Add Attribute. This adds a per particle attribute named rgbPP, which controls the red, green, and blue color scheme of each particle. The particles turn black after you add the rgbPP attribute. Adding the rgbPP attribute turns off the default coloring of the particles and gives them a value of <<0,0,0>>.
4
In the Attribute Editor, choose Numeric from the Render Type menu. The particleId of each particle is displayed instead of spheres:
190
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes 5
With ColorGridShape1 selected in the Expression Editor, enter this creation expression: if (particleId <= 2) rgbPP = <<1,0,0>>; else if ((particleId > 2) && (particleId < 6)) rgbPP = <<1,1,1>>; else rgbPP = <<0,0,1>>;
The creation expression executes whenever you rewind the animation. The particles don’t show the color assignments yet. The Numeric particle render type ignores color assignments to rgbPP. 6
In the Attribute Editor, set Render Type of the particles to Spheres again. The left, middle, and right columns of particles are red, white, and blue:
Expressions
The expression’s first statement assigns a red color to all particles whose particleId is less than or equal to 2. The value <<1,0,0>> is red in the RGB color scheme. The second statement assigns a white color to all particles whose particleId is greater than 2 and less than 6. The value <<1,1,1>> is white in the RGB color scheme. The third statement assigns a blue color to all particles that don’t meet the conditions in the prior two statements. In other words, all particles whose particleId is greater than or equal to 6 become blue. The value <<0,0,1>> is blue in the RGB color scheme. The following steps show another common way to control an attribute based on the particleId attribute.
Using Maya: Hypergraph, Sets & Expressions
191
Particle Expressions Working with particle attributes
To color half the particles red, and half the particles blue: 1
Enter the following runtime expression: if ((particleId % 2) == 0) rgbPP = <<1,0,0>>; else rgbPP = <<0,0,1>>;
2
Play the scene. The runtime expression executes each frame as the animation plays. Half the particles are blue, half are red.
The first statement uses a modulus operator (%) to calculate the remainder of dividing a particleId by 2. It then compares the remainder to 0. If the remainder equals 0, the statement assigns the particle a red color. The value <<1,0,0>> is red. The second statement assigns a particle a blue color if the remainder of the modulus operation doesn’t equal 0. The value <<0,0,1>> is blue. For example, dividing particleId 0 by 2 equals 0 with remainder 0. Because the remainder is 0, the particle having particleId 0 receives a red color. Dividing particleId 1 by 2 equals 0 with remainder 1. Because the remainder is 1, the particle having particleId 1 receives a blue color. Dividing particleId 2 by 2 equals 1 with remainder 0. With remainder 0, the particle having particleId 1 receives a blue color. The expression executes for each particle in the object. The result is that even-numbered particleIds become red, odd numbered particles become blue. 3
192
Rewind the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Assigning to vectors and vector arrays The creation expression executes. The particles become red, white, and blue as described for the previous expression. 4
Play the animation. The runtime expression executes each frame. The particles are red and blue as the animation plays.
Note to programmers You cannot assign values to individual particles with the array index notation commonly used in programming languages. For example, suppose you’ve created an opacityPP attribute for an object made of three particles. You can’t assign values as in this example: opacityPP[0] = 0.3; opacityPP[1] = 0.5; opacityPP[2] = 1;
Assigning to vectors and vector arrays
Expressions
Previous topics in this chapter show general techniques for working with vector array attributes. Vector array attributes are also called per particle attributes. Subtle details of assigning to vector and vector array attributes and variables follow.
Assigning to a vector variable You can assign a literal vector value or another vector variable to a vector variable. Enclose a literal vector value in double angle brackets.
Examples vector $top_velocity = <<2,2,5>>;
This assigns the vector $top_velocity the value <<2,2,5>>. vector $temp; vector $temp = $top_velocity;
This assigns the value of vector variable $top_velocity to the vector variable $temp.
Using Maya: Hypergraph, Sets & Expressions
193
Particle Expressions Assigning to vectors and vector arrays
Using the vector component operator with variables You can use a vector component operator (.) to read a component of a vector variable or vector array variable. Format
Meaning
$variable.x
left component
$variable.y
middle component
$variable.z
right component
Examples float $temp; vector $myvector = <<1,2,3>>; float $temp = $myvector.z;
This assigns the right component of $myvector, 3, to the floating point variable $temp. Suppose you have a vector initialized as follows: vector $myvector = <<1,2,3>>;
To replace the right component of $myvector, 3, with a new value such as 7, use this technique to preserve the other two components: $myvector = <<$myvector.x,$myvector.y,7>>;
This statement is incorrect: $myvector.z = 3;
An error occurs. A statement can read, but not directly assign, a component of a vector variable.
Assigning to a vector array attribute component An expression can neither read nor assign a component of a vector or vector array attribute. The following example shows a technique for working around this limitation. For details on working with color attributes, see “Working with color” on page 178.
194
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Assigning to vectors and vector arrays
Example Suppose you have 100-particle Cloud of randomly positioned particles. CloudShape1.position = sphrand(1); vector $pos = CloudShape1.position; CloudShape1.rgbPP = <<0,$pos.y,0>>;
The three statements execute once for each particle in Cloud. The first statement gives a particle a random position within a spherical region of radius 1. The sphrand(1) function gives the X, Y, and Z position components a value no less than -1 and no greater than 1. The second statement assigns a particle’s position to a vector variable $pos. The third statement assigns an RGB color to a particle’s rgbPP attribute. The left, middle, and right vector components of CloudShape1.rgbPP represent red, green, and blue components of the RGB color scheme. The third statement therefore assigns 0 (no color) to the red and blue components of a particle’s colorRGB. It gives a particle’s green component the value of its Y coordinate position.
This colors the particles from black to green, depending on the position.
Increasingly green
Using Maya: Hypergraph, Sets & Expressions
195
Expressions
Because a value of 0 or less results in a 0 green value, a particle is black if it’s below the XZ plane. If a particle’s Y coordinate position is above the XZ plane, it has a green component varying from nearly 0 to a fully saturated green.
Particle Expressions List of particle shape attributes
Example particleShape1.rgbPP = <<1,0,CloudShape1.position.z>>;
This causes an error. Maya interprets CloudShape1.position.z as being an attribute named z of an object named CloudShape1.position. You can get the intended result with these statements: vector $temp = CloudShape1.position; particleShape1.rgbPP = <<1,0,$temp.z>>;
The first statement reads all three components of vector attribute CloudShape1.position and assigns it to the vector variable $temp. The second statement reads the value of the right component of $temp, which contains the right component of CloudShape1.position. It then assigns this component to the right component of particleShape1.rgbPP.
Example particleShape1.rgbPP.y = 1;
This also causes an error. You can’t assign a value to a vector array attribute component.
List of particle shape attributes The following table describes the static and dynamic attributes that affect particle shape nodes on a per object or per particle basis. Note the following: •
Attributes you can read but not write are marked with an asterisk (*).
•
Empty boxes in the Render Type column indicate the render type is irrelevant to the attribute’s usage.
•
You can read and write per particle attributes only in particle expressions. See Using Maya: Dynamics for more details on the attributes.
196
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions List of particle shape attributes
Description
Per particle
Render Type
acceleration (acc)
Sets acceleration.
yes
vector array
age* (ag)
Contains number of seconds each particle has existed in scene.
yes
float array
attributeName
Specifies name of attribute whose value is displayed at particle positions.
Numeric
string
betterIllumination
Toggles increased self shadowing.
Cloud
boolean
colorAccum
Toggles additive display effect for RGB and opacity of overlapping particles for this object.
MultiPoint MultiStreak Points Streak
boolean
colorBlue
Sets blue component of RGB color.
float
colorGreen
Sets green component of RGB color.
colorRed
Sets red component of RGB color.
Blobby Surface Cloud MultiPoint MultiStreak Points Sphere Sprite Streak
conserve (con)
Sets amount of momentum conservation.
float
count* (cnt)
Contains number of particles in object.
integer
depthSort (ds)
Toggles depth sorting of particles for rendering.
MultiPoint MultiStreak Points Streak Sprite
Data Type
Expressions
Attribute long name (and short name)
float float
boolean
Using Maya: Hypergraph, Sets & Expressions
197
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
dynamicsWeight (dw)
Scales effect of dynamic fields and collisions on particle object.
event*
Contains number of times each particle in the object has hit something.
eventCount* (evc)
Contains total number of events that have occurred for all particles of the object.
integer
eventTest* (evt)
Contains 1 if an event has occurred on the object since last time an expression or MEL getAttr command read the eventTest value.
boolean
goalPP
Sets how much the particles try to follow goal on a per particle basis.
goalWeight (gw)
Sets how much the particles try to follow goal.
incandescence
Sets glow color.
incandescencePP
Sets glow color.
inheritFactor (inh)
Sets fraction of velocity inherited from the emitter of this particle object.
float
isDynamic (isd)
Toggles dynamics for object.
boolean
lifespan
Sets when all particles die.
float
198
Using Maya: Hypergraph, Sets & Expressions
Per particle
Render Type
Data Type
float
yes
float array
yes
float array
float
yes
Cloud
vector
Cloud
vector array
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
Per particle
Render Type
Data Type
lifespanPP
Sets when particles die on a per particle basis.
yes
levelOfDetail (lod)
Scales number of particles that can be emitted into the object.
lineWidth
Sets width of particle.
mass
Specifies physical mass of particles. As mass increases, the effect of dynamic forces change.
maxCount (mxc)
Sets maximum number of particles that can be emitted into this object.
multiCount
Sets number of points you want displayed for each particle. This number applies to each particle in the object.
MultiPoint Point
float
multiRadius
Sets radius of spherical region in which particles are randomly distributed.
MultiPoint MultiStreak
float
normalDir
Sets direction of normal for particles. Used with useLighting.
MultiPoint MultiStreak Points Streak
integer (1-3)
float array float
MultiStreak Streak yes
float float array
integer
Expressions
Using Maya: Hypergraph, Sets & Expressions
199
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
opacity
Sets amount of transparency.
opacityPP
Sets amount of transparency.
particleId* (id)
Contains id number of each particle.
pointSize
Sets size of particle points.
position (pos)
Sets position.
radius
Sets radius size of all particles.
Blobby Surface Cloud Sphere
float
radius0
Sets starting point radius for tube render type.
Tube
float
radius1
Sets ending point radius for tube render type.
Tube
float
radiusPP
Sets radius size on a per particle basis.
Blobby Surface Cloud Sphere
float array
200
Using Maya: Hypergraph, Sets & Expressions
Per particle
Render Type
Data Type
MultiPoint MultiStreak Points Streak Sphere Blobby Surface Cloud Sprite
float
yes
MultiPoint MultiStreak Points Streak Sphere Cloud Sprite
float array
yes
Numeric
float array
MultiPoint, Numeric Points
float
yes
yes
vector array
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
primaryVisibility (rea)
Per particle
Data Type
Toggles whether surface will be rendered by software renderer.
Cloud Blobby Surface Tube
boolean
visibleInReflections (rrl)
Toggles whether object is visible in reflections.
Cloud Blobby Surface Tube
boolean
visibleInRefractions (rrr)
Toggles whether object is visible in refractions.
Cloud Blobby Surface Tube
boolean
castsShadows (rsh)
Toggles whether object casts shadows.
Cloud Blobby Surface Tube
boolean
rgbPP
Sets color.
MultiPoint MultiStreak Points Sphere Sprite Streak
vector array
selectedOnly
Toggles display of id numbers for selected particles.
Numeric
boolean
spriteNum
Sets image number index for image sequence.
Sprite
integer
spriteNumPP
Sets image number index for image sequence.
Sprite
integer array
spriteScaleX
Sets X-axis image scale.
Sprite
float
spriteScaleXPP
Sets X-axis image scale.
Sprite
float array
spriteScaleY
Sets Y-axis image scale.
Sprite
float
spriteScaleYPP
Sets Y-axis image scale.
Sprite
float array
spriteTwist
Sets image’s rotation angle.
Sprite
float
yes
yes
yes
yes
Using Maya: Hypergraph, Sets & Expressions
Expressions
Render Type
201
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
Per particle
Render Type
Data Type
spriteTwistPP
Sets image’s rotation angle.
yes
Sprite
float array
surfaceShading
Sets level of shading.
Cloud
float
tailFade
Sets opacity of tail fade.
MultiStreak Streak
float
tailSize
Sets length of tail.
MultiStreak Streak Tube
float
threshold
Sets distance between particles at which lofting occurs.
Blobby Surface Cloud
float
useLighting
Toggles whether scene lighting lights up particles.
MultiPoint MultiStreak Points Sprite Streak
boolean
velocity (vel)
Sets velocity.
202
Using Maya: Hypergraph, Sets & Expressions
yes
vector array
9
Functions In expressions, you can use built-in operations called functions to create motion, particle positioning, and other effects. This chapter explains the most commonly used functions and a few useful MEL commands. A hermite function shaped the lightning’s soft body geometry, dnoise animated its turbulence, and sphrand enhanced its randomness.
Expressions
Matt Baer
For easy reference, this chapter groups functions by their purpose. For example, all math functions are grouped in the same section. To find out about:
See page:
Understanding functions
205
Function syntax
206
Limit functions abs ceil floor clamp min max sign trunc
209 210 210 210 211 212 212 212 213 Using Maya: Hypergraph, Sets & Expressions
203
Functions
204
To find out about:
See page:
Exponential functions exp log log10 pow sqrt
214 214 214 214 215 215
Trigonometric functions cos cosd sin sind tan tand acos acosd asin asind atan atand atan2 atan2d hypot
216 216 218 219 224 224 225 225 226 226 226 227 227 227 228 228
Vector functions angle cross dot mag rot unit
229 230 230 231 231 232 233
Conversion functions hsv_to_rgb rgb_to_hsv deg_to_rad rad_to_deg
234 235 235 234 234
Using Maya: Hypergraph, Sets & Expressions
Functions Understanding functions
See page:
Array functions clear size sort
236 236 237 237
Random number functions gauss noise dnoise rand sphrand seed
239 239 241 242 243 244 246
Curve functions linstep smoothstep hermite
249 249 252 254
General commands eval print system
259 259 261 263
Other functions and commands
264
Expressions
To find out about:
Understanding functions A function generates a value where it occurs in an expression statement. It takes action based on parameters called arguments that you enclose in parentheses next to the function name.
Example Suppose you have an object named Star whose translateX attribute is set with this expression statement: Star.translateX = rand(10);
In this statement, the rand function has the argument 10. With this argument, the function generates a randomly selected floating point number between 0 and 10 each time the statement executes. For example, translateX Using Maya: Hypergraph, Sets & Expressions
205
Functions Function syntax might be assigned 6.5409 the first time the statement executes, 3.2974 the second time, 8.7389 the third time, and so on. This causes Star to jump to random points from 0 to 10 units away from the X-axis as the scene plays. Though functions can be more or less complicated than this example, they all have at least one argument and generate one value. Note that a function is part of an expression statement. They don’t stand alone in an expression. Many functions do mathematical operations. For example, the sin function generates the sine of a specified angle. Though we often provide explanatory figures and details, we assume you’re familiar with the mathematical purpose of such functions. For details on the math behind such functions, see a more elementary reference. Note that the following functions are important to learn if you want to go beyond the basics of expression writing: •
sin or sind
•
linstep
•
smoothstep
•
hermite
•
noise
•
dnoise
•
rand
•
sphrand
•
print
Function syntax To help you quickly reference different functions, this chapter includes a syntax format statement for each function. The format follows: datatype
function(datatype argument)
function is the name of the function. datatype to the left of an argument indicates the data type of the argument. argument is a parameter you type with the function. datatype to the left of the function name indicates the data type returned when the function executes.
206
Using Maya: Hypergraph, Sets & Expressions
Functions Function syntax Note that for either datatype, you don’t type a value. The datatype tells you the type of data you must enter or the data type returned by the executed function. The data types are in small type size for easy identification in the syntax definitions.
Example 1 int
abs(int number)
float
abs(float number)
vector abs(vector number)
The function name is abs, which returns the absolute value of the number of your choice. The absolute value of a number is the number without its positive or negative sign. This example shows the abs function has three formats. Each version requires an argument with a different data type and returns a value with a different data type. The first version indicates that you can type an integer argument, and the function returns an integer result. For example, abs(-3) returns 3.
The third version indicates you can type a vector, and the function returns a vector. For example abs(<<3, -6.3, -2>>) returns <<3, 6.3, 2>>.
Example 2 Many functions have only one format, for example, the deg_to_rad function: float
deg_to_rad( float degrees )
This function returns the radian equivalent of to a degree value. It expects a floating point argument and returns a floating point number. Note that Maya ignores spaces between components of functions. For example, the functions in each of these expressions work the same: rotateY = deg_to_rad (45); rotateY = deg_to_rad(45); rotateY = deg_to_rad( 45 );
Using Maya: Hypergraph, Sets & Expressions
207
Expressions
The second version indicates that you can type a floating point argument, and the function returns a floating point result. For instance, abs(-7.54) returns 7.54.
Functions Function syntax
Data types In many cases, entering a data type other than the type expected by a function causes an error and prevents the expression from executing. For example, if you enter a vector argument where a floating point number is expected, an error occurs. For a function argument that expects a floating point number, however, you can instead type an integer—a number without a decimal point. Maya converts an integer to a floating point number in arithmetic operations. If an error occurs when you create an expression, check that you’re using the appropriate data types for all arguments.
Notes In this book, examples of floating point return values show no more than three digits to the right of the decimal point. If you display the contents of an attribute or variable in the Script Editor, you’ll see as many as 10 digits to the right of the decimal point. For instance, an example might show a return value as 3.539 rather than the precise value 3.538654390. The examples round up such numbers for ease of reading. Note also that converting radians to degrees and vice versa results in rounding errors. For example, converting a radian value might result in 89.99999996 degrees rather than 90.0 degrees.
Understanding function examples in this chapter Most function examples in this chapter show the use of the function outside of an expression statement. This makes the examples less cluttered and easier to read. For instance, the first example for the abs function on page 209 is: abs(-1)
This returns the value 1 where it occurs in an expression statement. For a function to have effect, you must use it within an expression that assigns a value to an attribute or variable.
208
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions
Examples Ball.scaleY = abs(-1);
This statement assigns Ball.scaleY the value returned by the abs(-1) function. If you use a function in an expression statement and do not assign the returned value to an attribute, the statement has no effect. abs(-1);
Returns 1, but doesn’t assign it to an attribute. This has the same result as the following meaningless statement: 1;
In some function examples in this chapter, the function’s purpose is easier to understand in the context of an expression. In such cases, we show examples of the function in an expression.
Limit functions The limit functions are math functions that impose limits on numbers.
abs
int
Expressions
Returns the absolute value of number. The absolute value of an integer or floating point number is the number without its positive or negative sign. The absolute value of a vector is a vector with components stripped of negative signs. abs(int number)
float
abs(float number)
vector
abs(vector number)
number is the number for which you want the absolute value.
Examples abs(-1)
Returns the value 1. abs(1)
Returns the value 1.
Using Maya: Hypergraph, Sets & Expressions
209
Functions Limit functions abs(<<-1,-2.43,555>>)
Returns <<1, 2.43, 555>>. abs(Ball.translateY)
If Ball.translateY contains -20, this returns 20.
ceil Returns a number rounded to the smallest integer value greater than or equal to a floating point number. float
ceil(float number)
number is the number you want to round.
Examples ceil(2.344)
Returns 3. ceil(3.0)
Returns 3. ceil(Rock.scaleY)
If Rock.scaleY contains -2.82, this returns -2.
floor Returns a number rounded to the largest integer less than or equal to a floating point number. float
floor(float number)
number is the number you want to round.
Examples floor(2.344)
Returns 2. floor(3.0)
Returns 3.
210
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions floor(Head.height)
If Head.height is -2.8, this returns -3.
clamp Returns a number within a range. You can use the clamp function to confine an increasing, decreasing, or randomly changing number to a range of values. float
clamp(float minnumber, float maxnumber, float parameter)
minnumber and maxnumber specify the range of the returned value. parameter is an attribute or variable whose value you want to clamp within the range. If parameter is within the numerical range of minnumber and maxnumber, the function returns the value of parameter. If parameter is greater than the range, the function returns the maxnumber. If parameter is less than the range, the function returns the minnumber.
Examples clamp(4,6,22)
clamp(4,6,2)
Returns 4, because 2 is less than 4, the minimum number of the range. clamp(4,6,5)
Returns 5, because it’s within the range. Ball.scaleY = clamp(0,3,time);
Returns a value between 0 and 3 each time the expression executes. When you rewind the animation to frame 1, the above expression executes and Ball’s scaleY attribute receives the value of time—a number slightly above 0. The clamp function returns the value of time because time is within the range 0 to 3. When you play the animation, time increments slightly with each frame. The expression executes with each frame and Ball’s scaleY attribute receives the value of time until time exceeds 3. When time exceeds 3, the clamp function returns the value 3. Using Maya: Hypergraph, Sets & Expressions
211
Expressions
Returns 6, because 22 is greater than 6, the maximum number of the range.
Functions Limit functions
min Returns the lesser of two floating point numbers. float
min( float number, float number)
number is a number you want to compare.
Examples min(7.2,-3.2)
Returns -3.2. Desk.height = -2; Lamp.height = 9; $Mylight = min(Desk.height,Lamp.height);
Sets $Mylight to -2.
max Returns the larger of two floating point numbers. float
max(float number, float number)
number is a number you want to compare.
Examples max(7.2,-3.2)
Returns 7.2. Desk.height = -2; Lamp.height = 9; $Mylight = max(Desk.height,Lamp.height);
Sets $Mylight to 9.
sign Returns one of three values representing the sign of a number. Returns -1 if the number is negative, 1 if positive, 0 if 0. float
sign( float number )
number is the number whose sign you want to determine.
212
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions
Examples sign(-9.63)
Returns -1. sign(0)
Returns 0. sign(10)
Returns 1. sign(Ball.translateX)
If Ball.translateX is 5, this returns 1.
trunc Returns the whole number part of a floating point number. float
trunc(float number)
number is the number you want to truncate.
Examples trunc(2.344)
Expressions
Returns 2. trunc(0.3)
Returns 0. trunc(-2.82)
Returns -2. trunc(time)
If time equals 3.1234, this returns 3.
Using Maya: Hypergraph, Sets & Expressions
213
Functions Exponential functions
Exponential functions The following functions work with exponential values.
exp Returns e raised to the power of a number, enumber. The predefined variable e is the base of the natural logarithm, which is 2.718. float
exp(float number)
number is the exponent to which you want to raise e.
Examples exp(1)
Returns 2.718, the value of e. exp(2)
Returns 7.389, the value of e2.
log Returns the natural logarithm of a number, logenumber. The natural logarithm uses the constant e, which is 2.718. float
log(float number)
number is the positive number for which you want the natural logarithm.
Examples log(10)
Returns 2.303. log(2.718282845904)
Returns 1.000.
log10 Returns the log base 10 of a number. float
log10(float number)
number is the positive number for which you want the log base 10.
214
Using Maya: Hypergraph, Sets & Expressions
Functions Exponential functions
Examples log10(100)
Returns 2. log10(10)
Returns 1.
pow Returns a base number raised to an exponent. float
pow(float base, float exponent )
base is the base number you want to raise to the exponent. A negative base number with a decimal component causes an error message. exponent is the exponent.
Examples pow(2,3)
Returns 8. pow(-2,3)
Expressions
Returns -8. pow(2,-3)
Returns 0.125.
sqrt Returns the square root of a positive number. float
sqrt(float number)
number is the positive number of which you want the square root. A negative number displays an error message.
Examples sqrt(16)
Returns 4.
Using Maya: Hypergraph, Sets & Expressions
215
Functions Trigonometric functions sqrt($side)
If $side is 25, this returns 5.
Trigonometric functions The following functions return trigonometric values. Each function has two formats that let you choose the type of angular unit you work with: degrees or radians. For example, the cos function expects an argument in radians, while cosd expects an argument in degrees. A radian equals 180 degrees divided by pi, or roughly 57.3 degrees. Note that pi equals 3.1415927, which is also 180 degrees.
cos Returns the cosine of an angle specified in radians. float
cos(float number)
number is the angle, in radians, whose cosine you want. For any right triangle, the cosine of an angle is the following ratio:
adjacent B cos θ = ------------------------------ = ---hypotenuse C Y
Y
C
θ
A
θ
B B
X
X
A C
If θ is less than 1/2 pi radians and more than 3/2 pi radians (from 270 to 90 degrees), cos θ is a value between 0 and 1.
216
Using Maya: Hypergraph, Sets & Expressions
If θ is between 1/2 pi radians and 3/2 pi radians (90 to 270 degrees), cos θ is a value between 0 and -1.
Functions Trigonometric functions The cosine ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the cosine of the measure of the angle. The cosine ratio is a value between -1 and 1. With a steadily increasing or decreasing argument, the cos function returns steadily increasing or decreasing values between 1 and -1. This is useful for creating rhythmic, oscillating changes in attribute values. The cos function works like the sin function except its return values are 90 degrees, or pi/2, out of phase. See page 219 for ideas on how to use the cyclical characteristics of the sin and cos functions.
Example 1 cos(1)
Returns 0.5403, the cosine of 1 radian.
Example 2 To animate the motion of Ball in a cosine wave pattern, use this expression:
Ball starts at the origin and moves in the X direction at a rate set by the incrementing animation time. Its Y translation moves cyclically up and down according to the return values of the cos function. The cos function uses translateX, and therefore indirectly, time, as its argument. As time increases from 0 to 6.283 seconds, the cos function returns values that change in fine increments from 1 to -1 and back to 1. The value 6.283 is 2 times the value of pi. As time increases beyond 6.283 seconds, the same cycle repeats for each span of 6.283 seconds.
Using Maya: Hypergraph, Sets & Expressions
217
Expressions
Ball.translateX = time; Ball.translateY = cos(Ball.translateX);
Functions Trigonometric functions
Ball.translateY = cos(Ball.translateX);
time = 6.283 (2 * pi seconds)
Compare the same expression using the sin function: Ball.translateY = sin(Ball.translateX);
time = 6.283 (2 * pi seconds)
The cosine curve is 1.571 (pi/2) seconds ahead of (or behind) the sine curve, and vice versa.
cosd Returns the cosine of an angle specified in degrees. float
cosd(float number)
number is the angle, in degrees, whose cosine you want. For more details on the cosd function, see the cos function in the preceding topic. The cosd and cos functions do the same operation, but cosd requires its argument in degree measurement units.
218
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Example cosd(45)
Returns 0.707, the cosine of 45 degrees.
sin Returns the sine of an angle specified in radians. float
sin(float number)
number is the angle, in radians, whose sine you want. For any right triangle, the sine of an angle is the following ratio:
opposite A sin θ = ------------------------------ = ---hypotenuse C Y
Y
C A
θ
θ
B
X
A C
If θ is from 0 to pi radians (0 to 180 degrees), sin θ is a value between 0 and 1.
If θ is from pi to 2 pi radians (180 to 360 degrees), sin θ is a value between 0 and -1.
The sine ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the sine of the measure of the angle. The sine ratio is a value between -1 and 1. With a steadily increasing or decreasing argument, the sin function returns steadily increasing or decreasing values between -1 and 1. This is useful for creating rhythmic, oscillating changes in attribute values. Using Maya: Hypergraph, Sets & Expressions
219
Expressions
X
B
Functions Trigonometric functions For example, you can use the sin function to manipulate: •
an object’s translate attributes to create snake-like motion
•
a body’s scale attributes to create a breathing cycle
•
a particle object’s opacity or color attributes to cycle a color or opacity pattern
Example 1 float $pi = 3.1415927; sin($pi/2)
Returns 1, the sine of pi/2 radians.
Example 2 Ball.translateY = sin(Ball.translateX);
This statement sets Ball’s translateY attribute equal to the sine of its translateX attribute. If you drag Ball along the X-axis, Ball’s translateY position moves up and down in a cyclical pattern:
Example 3 To animate Ball to the path of the preceding example, use this expression: Ball.translateX = time; Ball.translateY = sin(Ball.translateX);
220
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions Ball starts at the origin and moves in the X direction at a rate set by the incrementing animation time. Its Y translation moves cyclically up and down according to the return values of the sin function. The sin function uses translateX, and therefore indirectly, time, as its argument. As time increases from 0 to 6.283 seconds, the sin function returns values that change in fine increments from 0 to 1 to -1 to 0. The value 6.283 is 2 times the value of pi. The resulting motion resembles a horizontal S-shape:
time = 6.283 (2 * pi seconds)
As time increases beyond 6.283 seconds, the same S-shaped cycle repeats for each span of 6.283 seconds.
This expression animates Ball with larger up and down swings: Ball.translateX = time; Ball.translateY = sin(Ball.translateX) * 2;
By multiplying sin(Ball.translateX) by a number greater than 1, you increase the amplitude of the sine wave pattern. The amplitude is half the distance between the minium and maximum values of the wave.
Amplitude
Using Maya: Hypergraph, Sets & Expressions
221
Expressions
Example 4
Functions Trigonometric functions You can decrease the amplitude of the sine wave by multiplying by a number less than 1, for example, 0.5.
Example 5 This expression increases how often the sine wave completes a cycle: Ball.translateX = time; Ball.translateY = sin(Ball.translateX * 2);
By multiplying Ball.translateX by a number greater than 1, you increase the frequency of the sine wave pattern. The frequency is how long it takes the wave to make a complete cycle.
Frequency
You can decrease the frequency of the sine wave by multiplying by a number less than 1, for example, 0.5. This number is known as a frequency multiplier because it multiplies (or divides) the frequency of the sine pattern.
Example 6 This expression offsets the wave pattern higher up the Y-axis: Ball.translateX = time; Ball.translateY = sin(Ball.translateX) + 2;
By adding 2 to sin(Ball.translateX), the wave pattern starts further up the Yaxis. You can, of course, also subtract a number to offset the wave pattern lower on the Y-axis.
222
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Offset of 2
Example 7 The following expression sets a frequency multiplier, amplitude, and offset of a sine pattern in a single statement: Ball.translateX = time; Ball.translateY = (sin(Ball.translateX * 2) * 2) + 2;
Expressions
The following diagram shows which values set the frequency multiplier, amplitude, and offset. Frequency multiplier Amplitude Offset Ball.translateY = (sin(Ball.translateX * 2) * 2) + 2;
A general equation showing the factors you can use to create a sine wave pattern follows: attribute = (sin(frequency * frequency multiplier) * amplitude) + offset;
Using Maya: Hypergraph, Sets & Expressions
223
Functions Trigonometric functions
sind Returns the sine of an angle specified in degrees. float
sind(float number)
number is the angle, in degrees, whose sine you want. For more details on how to use the sind function, see the sin function in the preceding topic. The sind and sin functions do the same operation, but sind requires its argument in degree measurement units.
Example sind(90)
Returns 1, the sine of 90 degrees.
tan Returns the tangent of an angle specified in radians. float
tan(float number)
number is the angle, in radians, whose tangent you want. For any right triangle, the tangent of an acute angle is the following ratio:
opposite A tan θ = ----------------------- = --adjacent B Y
Y
C
θ
A
θ
B B
X
X
A C
224
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions The ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the tangent of the measure of the angle.
Example tan(1)
Returns 1.557.
tand Returns the tangent of an angle specified in degrees. float
tand(float number)
number is the angle, in degrees, whose tangent you want. For more details on the tand function, see the tan function in the preceding topic. The tand and tan functions do the same operation, but tand requires its argument in degree measurement units.
Example tand(45)
Returns roughly 1, the tangent of 45 degrees.
Returns the radian value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to pi. float
acos(float number)
number is the cosine of the angle, and must be from -1 to 1.
Example acos(1)
Returns 0. acos(-0.5)
Returns 2.0944 radians.
Using Maya: Hypergraph, Sets & Expressions
225
Expressions
acos
Functions Trigonometric functions
acosd Returns the degree value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to 180. float
acosd(float number)
number is the cosine of the angle, and must be from -1 to 1.
Example acosd(1)
Returns 0 degrees. acosd(-0.5)
Returns 120 degrees.
asin Returns the radian value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -pi/2 to pi/2. float
asin(float number)
number is the sine of the angle, and must be from -1 to 1.
Example asin(0.5)
Returns 0.525 radians.
asind Returns the degree value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -90 to 90. float
asind(float number)
number is the sine of the angle, and must be from -1 to 1.
226
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Example asind(0.5))
Returns 30 degrees.
atan Returns the radian value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -pi/2 to pi/2. float
atan(float number)
number is the tangent of the angle and can be any value.
Example atan(1)
Returns 0.785.
atand
float
atand(float number)
number is the tangent of the angle and can be any value.
Example atand(1)
Returns 45 degrees.
atan2 Returns the radian value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in radians, from -pi to pi, excluding -pi. float
atan2(float Y, float X )
X is the X coordinate of the point. Using Maya: Hypergraph, Sets & Expressions
227
Expressions
Returns the degree value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -90 to 90.
Functions Trigonometric functions Y is the Y coordinate of the point.
Example atan2(1,1)
Returns 0.785 radians.
atan2d Returns the degree value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in degrees, from -180 to 180, excluding -180. float
atan2d(float Y, float X )
X is the X coordinate of the point. Y is the Y coordinate of the point.
Example atan2d(1,1)
Returns 45 degrees.
hypot Returns the magnitude of two-dimensional vector from the origin to a point with coordinates X, Y. Y
hypot
(X,Y) X
228
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions As shown in the preceding figure, the hypot function returns the radius of a circle whose center is at one end of a right triangle’s hypotenuse and perimeter is at the other end of the hypotenuse. The following equation gives the magnitude of the vector: 2
x +y float
2
hypot(float x, float y)
X is the X coordinate of the point. Y is the Y coordinate of the point.
Example hypot(3,4)
Returns 5.
Vector functions Expressions
The following functions do operations with vectors. The functions take vector arguments and return floating point numbers or vectors.
angle Returns the radian angle between two vectors. Vector1
Angle
Vector2
float
angle( vector vector1, vector vector2)
vector1 is one of the vectors.
Using Maya: Hypergraph, Sets & Expressions
229
Functions Vector functions vector2 is the other vector. The returned angle is the shortest angle between the two vectors. The measurement is always less than 180 degrees.
Example angle(<<2,-1,1>>,<<1,1,2>>)
Returns 1.0472 radians, which equals 60 degrees.
cross Returns the cross product of two vectors. For two vectors, the cross product returns the vector that’s normal to the plane defined by the two vectors. Vector1
Vector2
Cross product
vector
cross(vector vector1, vector vector2)
If the cross product is 0, the two vectors are parallel or colinear. If one or both vectors are <<0,0,0>>, the cross product returns <<0,0,0>>. vector1 is one of the vectors. vector2 is the other vector.
Example cross(<<1,2,-2>>,<<3,0,1>>)
Returns <<2, -7, -6>>.
230
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions
dot Returns the floating point dot product of two vectors. The dot product takes two vectors as arguments and returns a scalar value. float
dot(vector vector1, vector vector2)
If the dot product returns 0, the two vectors are perpendicular. vector1 is one of the vectors. vector2 is the other vector.
Example dot(<<1,2,-2>>,<<3,0,1>>)
Returns 1. The dot product of this example is (1 * 3) + (2*0) + (-2*1), which equals 1.
mag Returns the magnitude of a vector. This is the length of the vector. Y-axis
X
Expressions
Z
<> Y X-axis
Z-axis Magnitude float
mag(vector vector)
vector is the vector whose magnitude you want.
Using Maya: Hypergraph, Sets & Expressions
231
Functions Vector functions The mag function converts a vector into a floating point number using the following formula. 2
2
x +y +z
2
Example mag(<<7,8,9>>)
Returns 13.928. 2
2
2
7 + 8 + 9 = 13.928
rot Returns a vector that represents the position of a point after it’s rotated a specified number of radians about a specified axis. Rotation is counterclockwise as viewed downward from the axis end position. Position of point before rotation Angle Position of point after rotation
Axis
vector
rot(vector point, vector axis, float angle )
point is the position of a point in the world coordinate system. axis is the axis around which the point rotates. The axis is a line that passes through the origin and the specified axis position. angle is the number of radians the point rotates.
232
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions
Example 1 rot(<<3,3,0>>,<<1,0,0>>,0.5)
Returns <<3, 2.633, 1.438>>. This is a vector representing the position of point <<3,3,0>> after rotating it 0.5 radians around the axis represented by <<1,0,0>>.
Example 2 particleShape1.position = rot(position,<<0,1,0>>,0.1);
Suppose your scene has a single-particle object at position <<4,6,0>>, and you wrote the above runtime expression for its particle shape node. When you play the scene, the particle rotates in a circular pattern around the Y-axis (the axis represented by <<0,1,0>>). In each frame, the particle’s position rotates 0.1 radian, roughly 5.7 degrees. Motion Particle
Expressions
unit Returns the unit vector corresponding to a vector. The unit vector has the same direction as the specified vector, but with a magnitude of 1. vector
unit( vector vector)
vector is the vector whose unit vector you want.
Example unit(<<1,1,1>>)
Returns <<0.577, 0.577, 0.577>>. Using Maya: Hypergraph, Sets & Expressions
233
Functions Conversion functions
Y <<1, 1, 1>> <<0.577, 0.577, 0.577>>
X Z Unit vector (magnitude = 1)
Conversion functions The following functions convert color scheme values or angle measurements.
deg_to_rad Returns the radian equivalent of a degree value. One radian equals roughly 57.29578 degrees. float
deg_to_rad( float degrees )
degrees is the degree angle you want to convert to radians.
Example deg_to_rad(90)
Returns 1.571, which is the same as pi/2.
rad_to_deg Returns the degree equivalent of a radian value. One radian equals roughly 57.29578 degrees. float
rad_to_deg(float radians)
radians is the radian angle you want to convert to degrees.
234
Using Maya: Hypergraph, Sets & Expressions
Functions Conversion functions
Examples rad_to_deg(1)
Returns 57.296. float $pi = 3.1415927; rad_to_deg($pi)
Returns 180.
hsv_to_rgb Converts an HSV vector to an RGB vector. vector
hsv_to_rgb(vector hsv)
hsv is a vector representing the hue, saturation, and value components.
Example hsv_to_rgb(<<1,0.5,0.6>>)
Returns <<0.6, 0.3, 0.3>>.
Tip
In the window’s hexagonal color wheel, drag the pointer to a color of interest. The edit boxes in the window list the color’s values for hue, saturation, and value—and their counterpart red, green, and blue values. Note, however, that the Hue value in the Color Chooser has a range of 0 to 360, while the H component of an HSV vector has a corresponding proportional range of 0 to 1. When you launch the Color Chooser by entering colorEditor, it’s useful only for learning about color. You can’t use it to change the color of objects in your scene.
rgb_to_hsv Converts an RGB vector to an HSV vector.
Using Maya: Hypergraph, Sets & Expressions
235
Expressions
To see the relationship between HSV and RGB color components, enter the MEL command colorEditor at the Command Line. This displays the Color Chooser window.
Functions Array functions vector
rgb_to_hsv(vector rgb)
rgb is a vector representing the red, green, and blue components.
Example rgb_to_hsv(<<0.6,0.6, 0.6>>)
Returns <<0, 0, 0.6>>.
Array functions The following functions work with integer, floating point, and vector arrays. If you need more information, see a reference book on the C programming language.
clear Empties the array’s contents, freeing all memory reserved for the array. After you clear an array, its size is 0. When you no longer need to use an array, use the clear function to free memory. int
clear(array array)
array is the name of the array you want to clear. The clear function returns 1 if the function succeeds, 0 if it fails. The return value is not typically used in expressions.
Example int $myInts[] = {1,2,3,4,5,6}; print("size of $myInts is: "+size($myInts)+"\n"); clear($myInts); print("size of $myInts is: "+size($myInts)+"\n");
The third statement above clears the array $myInts. The second and fourth statements display the following text in the Script Editor: size of $myInts is: 6 size of $myInts is: 0
236
Using Maya: Hypergraph, Sets & Expressions
Functions Array functions
size Returns the number of elements in an array or the number of characters in a string. int
size(array array)
int
size(string string)
array is the name of the array whose size you want. string is the string whose number of characters you want.
Example 1 string $s = "Hello"; $stringlen = size($s);
The size($s) function returns 5, then the statement assigns 5 to $stringlen.
Example 2 int $myInts[] = {1,2,3,4,5,6}; $numInts = size($myInts);
The size($myInts) function returns 6, then the statement assigns 6 to $numInts.
Returns an array sorted in alphabetical or ascending numerical order. The returned array has the same number and type of elements as the original array. array sort(array array)
array is the name of the array to be sorted.
Example 1 int $myInts[] = {3,6,1,4,2,5}; int $afterSorting[] = sort($myInts); print("After sorting, the array contains:\n"); for ($i = 0; $i < 6; $i = $i + 1) { print($afterSorting[$i]+"\n"); }
Using Maya: Hypergraph, Sets & Expressions
237
Expressions
sort
Functions Array functions The sort function sorts the elements of $myInts in ascending order. The following appears in the Script Editor: After sorting, the array contains: 1 2 3 4 5 6
Example 2 string $myName[] = {"Peewee","Michael","Kennedy"}; string $afterSorting[] = sort($myName); print("After sorting, the array contains:\n"); for ($i = 0; $i < 3; $i = $i + 1) { print($afterSorting[$i]+"\n"); }
The sort function sorts the elements of $myName in alphabetical order. The following appears in the Script Editor: After sorting, the array contains: Kennedy Michael Peewee
238
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
Random number functions The following functions generate random numbers. Random numbers are useful when you want the position, motion, or color of an object’s particles or vertices to have a random appearance.
gauss Returns a random floating point number or vector. The number returned falls within a Gaussian (bell curve) distribution with mean value 0. float
gauss(float stdDev)
vector
gauss(float XstdDev, float YstdDev)
vector
gauss(vector stdDevVector)
stdDev specifies the value at which one standard deviation occurs along the distribution. This gives a one-dimensional Gaussian distribution. XstdDev and YstdDev specify the values for one standard deviation. This gives a two-dimensional Gaussian distribution in the XY plane. The right component of the vector returned is 0. stdDevVector specifies the vector component values for one standard deviation. This gives a three-dimensional distribution.
Example gauss(5)
Returns a random floating point value such as 0.239.
Using Maya: Hypergraph, Sets & Expressions
239
Expressions
To control the random values returned by this function, see “seed” on page 246.
Functions Random number functions If you were to execute gauss(5) repeatedly and chart the values returned, they would occur roughly with this frequency: Mean One standard deviation
About 2/3 of returned values will be within one standard deviation.
Number of occurrences
0
-5
5
Value returned
If you were to execute gauss(2) repeatedly, return values would occur with this frequency: Mean One standard deviation
About 2/3 of returned values will be within one standard deviation.
Number of occurrences
-2
0
Value returned
240
Using Maya: Hypergraph, Sets & Expressions
2
Functions Random number functions
noise Returns a random number from -1 to 1 according to a Perlin noise field generator. float
noise(float number)
float
noise(float xnum, float ynum)
float
noise(vector vector)
number specifies a number that generates a random number. This gives a one-dimensional distribution of return values. xnum and ynum specify numbers for generating a random number. This gives a two-dimensional distribution of return values. vector specifies a vector for generating a random number. This gives a threedimensional distribution of return values. If you execute this function with the same argument value repeatedly, the function returns the same random value each time it executes. If you execute this function with an argument value that steadily increases or decreases in fine increments over time, the function returns random values that increase and decrease over time.
noise(time)
Returns a value between -1 and 1 each time the expression executes as an animation plays. Because time increases in fine increments, the values returned increase and decrease in smooth, yet random, patterns. If you were to chart the values returned over a period of time, they might occur as in this figure:
1 Return value 0 -1 noise(time) as animation plays
Using Maya: Hypergraph, Sets & Expressions
241
Expressions
Example 1
Functions Random number functions
Example 2 noise(frame)
Returns a value between -1 and 1 each time the expression executes as an animation plays. Because frame increases in larger increments, the values returned increase and decrease in rougher patterns. If you were to chart the values returned over a period of time, they might occur as in this figure:
1 Return value 0 -1 noise(frame) as animation plays
The value returned by noise(frame) and noise(time) is the same when frame contains the same number as time. For example, when frame equals 10, noise(frame) returns the same value that noise(time) returns when time is 10.
dnoise Returns a vector with each component containing a random number from -1 to 1. It works like the noise function except it expects and returns a vector argument. The returned vector represents the gradient of the noise field in three dimensions. vector
dnoise(vector argument)
argument specifies a vector for generating a random number. This gives a three-dimensional distribution of return values. See the noise function for more details on dnoise operation.
Example dnoise(<<10,20,-30>>)
Returns <<-0.185, 0.441, 0.686>>.
242
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
rand Returns a random floating point number or vector within a range of your choice. float
rand(float maxnumber)
float
rand(float minnumber, float maxnumber)
vector
rand(vector maxvector)
vector
rand(vector minvector, vector maxvector)
maxnumber specifies the maximum number returned (in the first syntax format listed above). The minimum number returned is 0. In other words, the returned value will be a random number between 0 and maxnumber. minnumber and maxnumber specify the minimum and maximum numbers returned. maxvector specifies the maximum value for each component of the vector returned. The minimum value is 0. Each component returned is a different random number. minvector and maxvector specify the minimum and maximum value for each component of the vector returned.
Example 1 rand(5)
Returns a random floating point number between 0 and 5, for example, 3.539.
Example 2 rand(-1,1)
Returns a random floating point number between -1 and 1, for example, 0.452.
Using Maya: Hypergraph, Sets & Expressions
243
Expressions
To control the random values returned by this function, see “seed” on page 246.
Functions Random number functions If you were to execute rand(-1,1) repeatedly as an animation plays, its return values might occur as in this figure:
1 Return value 0 -1 rand(1,-1) as animation plays
Example 3 rand(<<1,1,1>>)
Returns a random vector in which each component is between 0 and 1, for example, <<0.532, 0.984, 0.399>>.
Example 4 rand(<<1,1,1>>,<<100,200,300>>)
Returns a random vector in which the left component is between 1 and 100, the middle component is between 1 and 200, and the right component is between 1 and 300. An example is <<81.234, 49.095, 166.048>>.
sphrand Returns a random vector value that exists within a spherical or ellipsoidal region of your choice. An ellipsoid is a sphere scaled along its X-, Y- or Zaxes. vector
sphrand(float radius)
vector
sphrand(vector vector)
radius is the radius of a sphere in which the returned vector exists. vector is the radius of an ellipsoid along the X-, Y-, and Z-axis. To control the random values returned by this function, see “seed” on page 246.
244
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
Example 1 sphrand(1)
Returns a vector whose randomly selected coordinates reside within an imaginary sphere centered at the origin and with a radius of 1. An example returned vector is <<0.444, -0.427, 0.764>>.
Outer boundary of returned value Origin
1
radius
Example 2 sphrand(<<2,1,1>>)
Radius in Z 1
2
Radius in X
1
Outer bound of returned value Radius in Y
To create a particle ellipsoid: You can use the sphrand function, for example, to create a cluster of 500 particles randomly positioned within an ellipsoid having a radius of 2 in the X-axis, 1 in the Y-axis, and 1 in the Z-axis. Using Maya: Hypergraph, Sets & Expressions
245
Expressions
Returns a vector whose coordinates reside within an ellipsoid centered at the origin and with a radius of 2 along the X-axis, 1 along the Y-axis, and 1 along the Z-axis.
Functions Random number functions 1
Select Particles→Particle Tool-❒.
2
Enter 500 for Number of Particles, and 1 for Maximum Radius.
3
Click the mouse somewhere in the workspace to position the particles.
4
Select the particle shape node of the particle object in the Expression Editor.
5
Turn on Creation.
6
Enter this expression: position = sphrand(<<2,1,1>>);
Maya executes the expression once for each particle. It gives each particle a different random position around the origin within the ellipsoid specified by <<2,1,1>>.
seed Sets a seed value the gauss, rand, and sphrand functions use to generate random numbers. If you assign a value to the seed then execute the gauss, rand, or sphrand function repeatedly, an identical sequence of random numbers is generated. For clarification, see the example below and “Reproducing randomness” on page 123. int
seed(int number)
number sets an arbitrary number to be used as the seed value.
Example Suppose you create a NURBS sphere named Ball then enter this expression: Ball.translateX = rand(5);
246
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions When you rewind the animation, Ball’s translateX attribute receives a random value between 0 and 5, for example, 1.392. When you play the animation, the translateX attribute receives a different random value between 0 and 5 each frame. When you rewind the animation again, the translateX attribute receives a value that’s different from the value it received the first time you rewound, for example, 3.223. When you play the animation again, the translateX attribute receives a value each frame that’s different from the values it received the first time you played the animation. In short, every time the rand(5) executes, it gives a different random value. Suppose you change the expression to this: if (frame == 1) seed(1); Ball.translateX = rand(5);
Rewinding the scene to frame 1 executes the seed(1) function. It then assigns translateX a random value between 0 and 5, for example, 4.501. When you play the animation, the rand(5) function executes each frame and returns a different value. Example returned values follow: Value
1
4.501
2
3.863
3
3.202
4
3.735
5
2.726
6
0.101
Expressions
Frame
Each time you rewind and play the animation, translateX receives the same sequence of random values. For different seed values, the sequence of numbers returned will differ. You can’t predict the values in the number sequence based on the value of the seed.
Using Maya: Hypergraph, Sets & Expressions
247
Functions Random number functions Suppose you change the expression to this: if (frame == 1) seed(500); Ball.translateX = rand(5);
The rand(5) function returns these values as you rewind and play the animation: Frame
Value
1
4.725
2
2.628
3
0.189
4
0.004
5
4.834
6
0.775
By changing the seed function’s value, you change the sequence of random numbers generated. A common mistake while using the seed function follows: seed(1); Ball.translateX = rand(5);
When you rewind the animation, Ball’s translateX attribute receives the value 4.501. When you play the animation, the translateX attribute receives 4.501 each time the expression executes. Because you assign a value (1) to the seed before each execution of rand(5), you initialize the random number sequence. The rand(5) function therefore returns the first value of the number sequence each time it executes.
Important When you set a seed value in an expression or MEL script, the seed value affects the rand, sphrand, and gauss functions in other expressions and MEL scripts. Such functions are affected by this seed value in all scenes you open subsequently in the current work session.
248
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Curve functions The step functions let you make smooth, incrementing transitions between values.
linstep Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. This function lets you increase an attribute such as opacity from 0 to 1 linearly over a time range. float
linstep(float start, float end, float parameter)
start and end specifies the minimum and maximum values. parameter is the value you want to use to generate the proportional number. If parameter is less than start, linstep returns 0. If parameter is greater than end, linstep returns 1.
Example Suppose you’ve used the Particle Tool to create a collection of particles named Cloud: Expressions
Suppose further you’ve added a dyamic per object opacity attribute to Cloud (see “Working with particle attributes” in Chapter 8). You then write this runtime expression for Cloud’s particle shape node: CloudShape1.opacity = linstep(0,5,age);
Using Maya: Hypergraph, Sets & Expressions
249
Functions Curve functions This expression increases the per object opacity attribute of CloudShape1 in equal steps from 0 to 1 for the first 5 seconds of the object’s existence. Because you created the object with the Particle Tool, the particles existence begins in the first frame of the animation. All particles in the object fade in from transparent to opaque for the first 5 seconds of animation. At the first frame that plays, the age of the particles is 0, so the linstep function returns 0 for the opacity. An opacity of 0 is transparent. In each subsequent frame, the linstep function returns a proportionally larger opacity value. When the age of the object reaches 5, the linstep function returns 1 for the opacity. An opacity of 1 is 100% opaque. When the age exceeds 5, the linstep function returns 1. The opacity stays 100% opaque. Here are some values returned for the object’s opacity:
250
Age
Opacity
0.0417
0.0083
0.0833
0.0166
0.125
0.025
0.1667
0.0333
0.2083
0.0417
2.5
0.5
1.0
0.2
3.75
0.75
5
1
5.041
1
5.083
1
10
1
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions As the table shows, the opacity increases in linear increments for the first 5 seconds of the object’s age. At the midpoint of the specified 0 to 5 second age range, the opacity is 0.5. At 3/4 of the way between 0 and 5 seconds, the opacity is 0.75. At 5 seconds of the object’s age, opacity is 1. After 5 seconds, the opacity stays at 1. 1
opacity
0
5 age (in seconds)
Suppose you edit the runtime expression as follows: CloudShape1.opacity = linstep(5,10,age);
This increases the opacity attribute linearly from 0 to 1 as the object’s age increases from 5 to 10 seconds. Expressions
1
opacity
0
5 age (in seconds)
10
Suppose you edit the runtime expression as follows: particleShape1.opacity = 1-linstep(0,5,age);
This decreases the opacity attribute linearly from 1 to 0 for the first 5 seconds of the object’s age. Subtracting linstep(0,5,age) from 1 causes the opacity to fade out rather than fade in.
Using Maya: Hypergraph, Sets & Expressions
251
Functions Curve functions
1
opacity
0
5 age (in seconds)
smoothstep Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. The smoothstep function lets you increase an attribute such as opacity from 0 to 1 gradually, but nonlinearly, over a time range. The smoothstep function works like the linstep function, except it increases values more quickly near the middle values between the minimum and maximum value. The function uses hermite interpolation between minimum and maximum values. float
smoothstep(float start, float end, float parameter)
start and end specifies the minimum and maximum values. parameter is the value you want to use to generate the smoothstep number. If parameter is less than start, linstep returns 0. If parameter is greater than end, linstep returns 1.
252
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions The following figure compares values returned by smoothstep and linstep over time: parameter
smoothstep
start
linstep
end
Example Suppose you’ve used the Particle Tool to create a collection of particles named Cloud: Expressions
Suppose also you’ve added a dynamic per object opacity attribute to Cloud (see “Working with particle attributes” in Chapter 8). You then write this runtime expression for Cloud’s particle shape node: CloudShape1.opacity = smoothstep(0,5,age);
Using Maya: Hypergraph, Sets & Expressions
253
Functions Curve functions This increases the opacity attribute of CloudShape1 in steps from 0 to 1 for the first 5 seconds of the object’s age. This makes the object fade in from transparent to opaque. The fade in and fade out of the opacity occurs more quickly around 2.5, the midpoint between 0 and 5. 1
opacity
0
5 age (in seconds)
See the linstep function for details on similar examples.
hermite Returns values along a hermite curve. You can use the hermite function, for instance, to move a particle object’s position smoothly along a curve. As the examples in the following pages show, you can create various curve shapes by altering the arguments to the hermite function. vector float
hermite(vector start, vector end, vector tan1, vector tan2, float parameter)
hermite(float start, float end, float tan1, float tan2, float parameter)
start is the start point of the curve. end is the end point of the curve. tan1 is the tangent vector that guides the direction and shape of the curve as it leaves the start point of the curve. The vector’s position starts at the start point of the curve. tan2 is the tangent vector that guides the direction and shape of the curve as it approaches the end point of the curve. The vector’s position starts at the end point of the curve. parameter is an floating point value between 0 and 1, for example, the value returned by a linstep function. In the second format, the arguments and return values work in a single dimension.
254
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Example 1 Suppose you create an object named dust made of one particle at the origin. To guide its motion along a short upward-bound curve for the first four seconds of animation, you can write the following runtime expression: dust.position = hermite(<<0,0,0>>,<<2,2,0>>, <<3,0,0>>, <<0,3,0>>, linstep(0,4,time));
When you play the animation, the particle moves from the start point <0,0,0> along a curve to the end point <2,2,0>. The tangent vector <3,0,0> sets the curve’s direction and shape as it leaves the start point. The tangent vector <0,3,0> sets the curve’s direction and shape as it approaches the end point. From zero to four seconds of animation play, the particle moves along the curve as defined by the linstep function. (See page 249 for details on linstep.) The function arguments and resulting path of the object follow: Y
tan2 = <<0,3,0>>
Expressions
end = <<2,2,0>>
Object’s path
start = <<0,0,0>>
tan1 = <<3,0,0>>
X
Example 2 Suppose you change the third argument of the previous example expression to <<6,0,0>>: dust.position = hermite(<<0,0,0>>,<<2,2,0>>, <<6,0,0>>, <<0,3,0>>, linstep(0,4,time));
Using Maya: Hypergraph, Sets & Expressions
255
Functions Curve functions The slope of the path curve steepens because of the longer tan1 vector: Y
tan2 = <<0,3,0>>
end = <<2,2,0>>
Object’s path X start = <<0,0,0>>
tan1 = <<6,0,0>>
Example 3 The following expression moves dust in an S pattern: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,3,0>>, <<0,3,0>>, linstep(0,4,time)); Y
tan1 = <<0,3,0>>
tan2 = <<0,3,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
The tan1 vector <<0,3,0>> sets the direction of the curve from the start point to a positive Y direction. The tan2 vector <<0,3,0>> sets the direction of the curve to a positive Y direction as it approaches the end point. Values between the start and end point curves are interpolated to form an S pattern.
256
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Example 4 Suppose you change the fourth argument of the previous example expression to <<0,-3,0>>: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,3,0>>, <<0,-3,0>>, linstep(0,4,time));
The dust particle moves in a pattern resembling a half-circle: Y
tan1 = <<0,3,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
Expressions
tan2 = <<0,-3,0>>
The tan1 vector <<0,3,0>> sets the direction of the curve from the start point to a positive Y direction. The tan2 vector <<0,-3,0>> sets the direction of the curve to a negative Y direction as it approaches the end point.
Example 5 Suppose you change the third argument of the preceding example to <<0,10,0>>: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,10,0>>, <<0,-3,0>>, linstep(0,4,time));
Using Maya: Hypergraph, Sets & Expressions
257
Functions Curve functions
Y tan1 = <<0,10,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
tan2 = <<0,-3,0>>
Because of the longer tan1 vector, the slope of the path curve steepens as it rises from the start point. Because the tan2 vector has a smaller Y magnitude than the Y magnitude of the tan1 vector, the slope of the path curve is flatter as it approaches the end point. The curve’s rise in the Y direction is greater than the previous example because the magnitude of tan1’s Y component is larger (10 instead of 3).
258
Using Maya: Hypergraph, Sets & Expressions
Functions General commands
General commands The following functions do various actions in Maya.
eval Executes a MEL command. string
eval(string command)
command is either a command string enclosed in quote marks or a string variable containing a command. The returned value contains command output returned by the command’s execution.
Example 1 eval("select -cl")
Executes the command select -cl, which deselects all objects in the scene. Though the return value is not used in this example, it contains the command output.
Example 2
The first statement assigns the command string select -cl to the string variable $cmd. The second statement executes the contents of $cmd, which is the command select -cl.
Example 3 string $mycommand = "sphere"; eval($mycommand+"-r 5");
The first statement assigns the string sphere to the variable $mycommand. The second statement appends -r 5 to the string sphere and executes the complete command sphere -r 5. This creates a sphere with a radius of 5 grid units.
Using Maya: Hypergraph, Sets & Expressions
259
Expressions
string $cmd = "select -cl"; eval($cmd);
Functions General commands
Example 4 string $a[]; $a = eval("ls -lights"); print($a);
The first statement defines an array of strings named $a. The second statement executes the MEL command ls -lights, then assigns the command’s output to array $a. The third statement displays the contents of $a to the Script Editor as follows: ambientLightShape1 directionalLightShape1
Note that each line of command output appears on a new line. Each command output line is an array element. Maya formats array output with each array element on a new line.
Example 5 Suppose you’ve created a MEL script file named bunk.mel in your Maya scripts directory and it contains this procedure: global proc string bunk() { string $fog; if (rand(2) < 1) $fog = "particle"; else $fog = "sphere"; return $fog; }
Further suppose you create this expression: string $name = bunk(); eval($name); print($name);
The first expression statement executes the bunk() procedure in the bunk.mel script file. In the bunk procedure, the if-else statement generates a random floating point value between 0 and 2, then compares its value to 1. If the value is less than 1, the statement assigns the MEL command string particle to $fog. If the value is greater than 1, $fog receives the command string sphere.
260
Using Maya: Hypergraph, Sets & Expressions
Functions General commands The procedure finishes executing and passes the value of $fog back to the calling procedure, bunk() in the expression. This assigns the command string to the variable $name. The eval function executes the command string stored in the $name. For example, the statement might execute particle, which creates a particle at the origin of the workspace. The fourth statement displays the contents of $name, for example, particle. The expression executes each frame and creates a new particle or sphere.
print Displays text in the Script Editor. You can use this function to display the contents of attributes and variables. This is helpful for debugging an expression. print(string text) print(vector number) print(float number) print(int number) print(array number)
number is a number without the quote marks. Numerical arguments display as strings. There is no returned value for this function. Note the following display considerations. •
You can format displayed text with standard C language escape characters. For example, you can create a new line with “\n” or a tab character with “\t” in the argument.
•
Displaying a floating point value shows the number with up to 10 digits to the right of the decimal point, for example 0.3333333333.
•
Insignificant 0 digits are truncated from floating point numbers. For example, floating point number 2.0 is displayed as 2.
Using Maya: Hypergraph, Sets & Expressions
261
Expressions
text is either a string enclosed in quote marks or an attribute name or string variable containing text.
Functions General commands •
A vector appears with a space separating components and no double angle brackets. Each vector component has a floating point value with up to 10 digits to the right of the decimal point. For example, a vector <<1.518876356, 0, -1.290387446>> appears in the Script Editor as this: 1.518876356 0 -1.290387446
•
Arrays are formatted with each array element on a new line.
•
You can use the + operator to join two strings in an argument: "text1" + "text2"
This is displayed as: text1text2
•
You can also append a number to a string: "text" + 1
This is displayed as: text1
•
You cannot use the + operator with a string array.
•
If you assign a string to a variable that’s not a string data type, the following text appears if you display the variable: Variable data type
String assignment
Data displayed
float
"3.14"
3.14
int
"3.14"
3
vector
"3.14"
3.14 0 0
float
"pi is 3.14"
0, error message
As shown in the last row of the table, if a variable is assigned a string that starts with a nonnumerical character, Maya converts the string to 0. •
262
For a nonparticle expression consisting of only print statements, Always Evaluate must be on in the Expression Editor for the expression to execute.
Using Maya: Hypergraph, Sets & Expressions
Functions General commands
Examples print(time); print("\n");
The first statement displays the value of time. The second statement displays a new-line character after the value of time, so the time appears on a separate line in the Script Editor. float $f = 3.14159; print($f);
Displays the floating point number 3.14159. string $s = "Hello There"; print($s);
Displays the string Hello There. vector $v; $v = <<1.2,2.3,3.4>>; print($v);
Displays the vector as 1.2 2.3 3.4. string $a[]; $a = eval("ls -lights"); print($a+" are the lights in my scene.\n");
Expressions
The print function causes an error message because you cannot use the + operator with a string array.
system Passes a UNIX command to the shell where you launched Maya. int
system( string command)
command is either a command string enclosed in quote marks or a string variable containing a command. The returned value is the output resulting from the command’s execution.
Example string $cmdout; $cmdout = system("date"); print($cmdout+"\n");
Using Maya: Hypergraph, Sets & Expressions
263
Functions Other functions and commands Executes the UNIX date command, which outputs your workstation’s date and time to the $cmdout variable. The final statement displays the date in the Script Editor.
Other functions and commands In addition to the functions described in this chapter, you might find the following less commonly used functions and administration commands helpful. For details on usage, see the MEL online documentation. General
Math
Curve
String
File
alias
acosh
besselj0
gmatch
fopen
catch
asinh
besselj1
match
fclose
chdir
atanh
besseljn
size
fflush
env
constrainValue
besselyn
strcmp
popen
error
erf
substitute
pclose
exists
erfc
substring
fprint
getenv
expm1
tokenize
frewind
getpid
fmod
tolower
feof
gmatch
gamma
toupper
fgetline
putenv
log1p
pwd
fwrite
source
fread
trace
filetest
warning whatIs
264
fgetword
Using Maya: Hypergraph, Sets & Expressions
Index Symbols
abbreviating attribute names 112, 116 abs function 209 absolute value 209 acceleration 197 acceleration attribute assigning constant value to 156 assigning with runtime expression 155 changing value randomly 156 field’s effect on 175 initialization to zero 177 working with 175 acos function 225, 226 Add Attribute window 50, 120, 169 Add Dynamic Attributes 49, 161 Add Initial State Attribute checkbox 163, 170 adding custom attributes 119, 169 age 197 age of particles at rewind 150 how to examine 150 runtime expression execution and 152 when created with Particle tool 168 alias UNIX command avoiding use with text editor 109 Always Evaluate 130 Always Evaluate checkbox 118 amplitude of sin function 221 angle function 229
angular units conversion of 128 degrees 29, 127 radians 29, 127 arc cosine 225, 226 arc sine 226 arc tangent 227, 228 arguments in functions 205 arithmetic operators 63 array (per particle) attributes 163 assigning to array of different length 172 array functions 236 array indexes invalid assigment to 193 Array option for per particle attributes 170 arrays 93 clearing contents of 236 display format 262 element assignment 95 example initialization and usage 93 exceeding memory capacity of 93 expansion of 93 invalid assignment to indexes 193 obtaining size of 237 sorting 237 asin function 226 assigning to attributes 55 to int or float variables 60 to specific particles 189 to vector attributes 56 to vector components 193, 194 to vector variables 61 vector to three scalar attributes 56 assignment operator 47
Using Maya: Hypergraph, Sets & Expressions
265
Index
! 87 - 63 -- 92 != 65, 66 $ 59, 73 % 63, 182 %= 92 && 67 * 63 *= 92 + 63 ++ 92 += 92 / 63 // 75 /= 92 < 65 << >> 53, 73, 180, 193 <= 65 -= 92 = 47, 55 == 65, 66, 74 > 65 >= 65 ?: 86 \n 261 { } 39, 70, 72, 73 | 140 || 67
A
Index
atan function 227 atan2 function 227 atan2d function 228 atand function 227 attribute names renaming as short names 137 attributeName 197
266
attributes abbreviating names 112, 116 assigning conditionally 32 assigning to 55 assigning to multiple 13, 23 assigning to multiple objects 13, 28 connecting to symbolic placeholders 135 custom 50 data types 51 deleting from expressions 131 disconnecting from expressions 132 displayed in Attributes list 18 displaying contents of 123 displaying disconnected 132 dynamic 49 eliminating expression control of 122 full name 51 initial state 158, 162 linking 11, 15, 26 long names 114 name syntax 47 not selecting for particle shape node 112 particle shape node 159 per object 12, 160 per particle 12, 160 reading in expressions 133 removing from expressions 131 seeing abbreviations of 113, 115 static 49 unexpected values 141 Attributes list 103
Using Maya: Hypergraph, Sets & Expressions
B base number raised to exponent 215 bell curve function 239 betterIllumination 197 blank lines in expressions 74 Booleans 52 handling as floating point 65 symbolic constants 95 braces 72 in statements 39, 40 matching pairs of 73 brackets double angle 53, 73, 180, 193 break instruction 79
C C language escape characters 261 syntax in expressions 75 case sensitivity in variable names 59 castsShadows 201 ceil function 210 centimeters 127 Channel Box displaying attribute values in 30 choice command 132 circular motion of NURBS sphere 119 clamp function 211 clear function 236 clearing an expression 106 array contents 236
Index
conversion of angular units only 128 of data types 143, 144 of user selected units 127 conversion functions 234 converting degrees to radians 129 measurement units 128 statements to comments 131 copying text in expressions 105 cos function 216 comparison with sin function 218 cosd function 218 cosine 216, 217, 218 cosine wave pattern animating a ball 217 count 197 Create button 22 Create Event 184 creating new expressions 111 creation expressions 148 assigning to rgbPP 179 dynamics start frame 149 example assignment to lifespan 165, 167 example assignment to lifespanPP 164 execution for emitted particles 149 how often execution occurs 148 using values in runtime expressions 174 when to use 150 cross function 230 cross product of two vectors 230 curve functions 249
custom attributes 50 adding to an object 119 adding to particle shape node 169 assigning to 169 examples of assignment 171 when to use 118 custom variables 59 declaring 59 using globally 61 cyclical pattern with sin function 220
D data types attribute 53 Boolean 52 conversion during assignment 143, 144 conversion of displayed strings 262 conversion with arithmetic operators 145 data entry limitations 54 float array 52 floating point 52 functions 208 integers 52 matrix 55 vector array 52 debugging expressions with print function 261 decimal deletion in data type conversion 144 decimal precision in display 261 declaring variables 59 default object in Expression Editor 104 making an object the 115 defining variables 26 deg_to_rad function 234
Using Maya: Hypergraph, Sets & Expressions
267
Index
collision example of controlling color resulting from 185 working with particles 183 color Christmas light effect with particles 181 giving object constant color 179 giving particles randomly changing color 180 understanding RGB and HSV 235 working with 178 colorAccum 197 colorBlue 197 colorEditor 235 colorGreen 197 colorRed 197 comments converting statements to 131 in expressions 75 compiling an expression 19, 62, 118 conditional assignment to attributes 32 conditional statements 69 else-if 71 if 34, 69 if-else 70 confining numerical range 211 connectAttr command 135 connecting an attribute 135 Connection Editor 132, 135 conserve 197 constants 62 Boolean 95 continue instruction 80 controlling flow in statements 77
Index
degrees 29 converting to radians 129, 234 deleting attribute names 131 expressions 112, 134 text from expressions 105 depthSort 197 discarded remainders in data type conversions 146 disconnectAttr command 132 disconnecting an attribute 132 displaying attribute contents 123 disconnected attributes 132 text 261 variable contents 123 dnoise function 242 do loop 78 dollar sign ($) in variable names 59, 73 dot function 231 dot product 231 dot product operator 64 double angle brackets 53, 73, 180, 193 dynamic attributes 49 adding to object 49, 50, 161 dynamic per object attribute example assignment to lifespan 167 dynamic per particle attribute example assignment to lifespanPP 164 dynamics changing start frame 149 how often Maya evaluates 149, 152 Dynamics Controller 149, 152 dynamicsWeight 198 dynamicsWeight attribute 178
268
E e raised to power 214 Edit button 22 editing expressions in text field 99, 105 else keyword 38 else-if statements 71 emitted particles age of 149 assigning lifespanPP for 183 creation expression execution and 149 working with 183 English common names for attributes 114 equal to (==) operator 36 errors common expression 95 comparing floats with the == operator 89 from wrong data types in functions 208 in flow control statements 88 logic 95 message format of 95 syntax 36, 73, 95 where they appear 96 eval function 259 event 198 event attribute 184 when collision count increases 187 eventCount 198 eventCount attribute 184 eventTest 198 eventTest attribute 184 examining two or more expressions 106
Using Maya: Hypergraph, Sets & Expressions
executing MEL commands in expressions 137 MEL commands with eval function 259 MEL procedures in expressions 139 nonparticle expressions 118 UNIX commands in expressions 263 execution slow expression 127 exp function 214 exponential functions 214 Expression Editor starting 13
Index
slow execution of 127 speeding execution of 127 text field 14 tutorials 15 type case sensitivity 18 when unusable 12 Expressions list 100, 104
F fading opacity 249, 253 fields influence on expression 175 turning off effect in an expression 178 filtering attributes by connected attribute 104 from Expression Editor 104 filtering expressions 99 finding expressions by connected attribute 101 by expression name 100 by item type 102 by selected object 101 float 52, 57 float arrays data type 52 floating point 52 floor function 210 flow control errors 88 flow control statements 77 for loop 79 for-in loop 81 forward slashes (//) for comments 75 frame 0 reason for using in examples 43 frame playback rate 16, 58 frame variable 57 frequency multiplier of sin function 222
frequency of sin function 222 full attribute name 51 functions 47 arguments in 47, 205, 206 array 236 as expression elements 47 complete list of 203 conversion 234 curve 249 data type of arguments 206 data type of returned values 206 essential for advanced expression writing 206 format of 206 introduction to 203 limit 209 others in online documentation 264 random number 123, 239 spaces in 207 trigonometric 216 understanding book examples 208 vector 229
G gauss function 239 Gaussian distribution 239 General button 49 general commands 259 global procedures declaring 139 global variables 61 declaring 62 initializing 62 goal attribute 161 Goal button 161 goalPP 198 goalPP attribute 161
Using Maya: Hypergraph, Sets & Expressions
Index
expressions advantage of separate 31 advantage of single 31 comments in 75 common errors 95 comparison with MEL scripts 46 compiling 19 copying text 105 creating 13 creating new 111 creation 148 default object 104 deleting 112, 131 deleting text in 105 displaying connected attributes only 104 editing in text field 99 editing with text editor 106 elements of 46, 47 eliminating control of attributes 122 erasing 106 examining two or more 106 execution for nonparticle shapes 118 field’s influence on 175 filtering 99 finding 100, 101, 102 for particles 147 input to 133, 135 keywords 76 names for particle shape node 100 naming conventions 18 output from 134, 136 programming features 75 redundant execution 130, 154 reloading 106 required elements of 48 runtime 148 runtime execution 152 saving to file 107
269
Index
goalWeight 198 gravity field acceleration’s effect on 177
H half-circle creating motion with hermite function 257 hermite function 254 HSV conversion to RGB 235 hsv_to_rgb function 235 hypot function 229
I if statements 32, 34, 69 if-else abbreviation 86 if-else statements 38, 39, 70 incandescence 198 incandescencePP 198 increment operations and unexpected values 142 inheritFactor 198 initial state attributes 158, 162, 163 creation expression execution 150 naming convention 163 saving values for 158 input to expressions 135 integers 52, 57 handling as floating point 65 internal conversion of units 127 isDynamic 198
jot text editor 107
K keyframes eliminating expression to use 122 keywords in expressions 76
L levelOfDetail 199 lifespan 198 lifespan attribute 161 example assignment in creation expression 167 Lifespan button 161 lifespanPP 199 lifespanPP attribute 161, 164 assigning for emitted particles 183 limit functions 209 lineWidth 199 linking attributes 11, 15, 26 linstep function 249 comparison with smoothstep 253 listAttributes MEL command 163 log base 10 214 log function 214 logic errors 95 logical operators 67 && 67 || 67 long attribute names 114 looping errors 88
J joining text in strings 262
270
Using Maya: Hypergraph, Sets & Expressions
M mag function 231 magnitude of a vector 67, 231 mass 199 matrix data type 55 max function 212 maxCount 199 measurement units 127 MEL commands 45, 46 executing with eval function 259 using alone in statements 137 using with eval function 138 using within single quotes 138 MEL procedures using in expressions 138 MEL scripts 46 millimeters 128 min function 212 mixed data types using with arithmetic operators 145 modulus operator (%) 63, 182, 192 risk of using with floats 182 motion creating jittery 175 creating smooth, random 175 multiCount 199 multiRadius 199
N natural logarithm 214 new line characters in print statement 261
Index
noise function 241 returned values with frame argument 242 returned values with time argument 241 normalDir 199 not (!) operator 87 number sequences generating consistently random 125 numeric render type 190
O object names omitting in expressions 115 path of 140 Objects list 103 offset with sin function 222 omitting object names in expressions 115 online function documentation 264 opacity 200 opacity attribute 161 fading over time 249, 253 Opacity button 161 opacityPP 200 opacityPP attribute 161
operators arithmetic 48, 63 assigning values to 36 dot product 64 equal to 36, 65 greater than 65 greater than or equal to 65 less than 35, 65 less than or equal to 65 logical 48, 67 not equal to 65 precedence 68 relational 48, 65 shortcut assignment 91 shortcut increment and decrement 92 order of statements 37 output from expression 134, 136 oversample level 152, 156
P parentheses matching pairs of 73 use in conditionals 68, 73 particle array attributes assigning to different lengths 172 particle attributes list of 196 Particle Collision Events 184 particleId 200 particleId attribute 189
Using Maya: Hypergraph, Sets & Expressions
271
Index
particles age of 150 assigning to specific 189 attribute data types 52 expressions for 147 moving position with hermite function 254 selecting shape node 148 shape node attributes 159 transform node attributes 159 using sphrand to create ellipsoid of 245 working with collisions 183 path names of objects 140 per object attributes 12, 160 keyframing 160 naming conventions 160 scalar option 170 per particle attributes 12, 53, 160 Array option 170 assigning to individual particles 189 how to distinguish 160 naming conventions 160 Perlin noise field 241 playback rate 58 pointSize 200 position 200 position attribute assigning with creation expression 158 assigning with runtime expression 157 field’s effect on 175 working with 175 pow function 215 precedence of operators 68 precision of float display 261 predefined variables 57 frame 57 time 57 primaryVisibility 201
Index
print function 261 programming features 75
R radians 29, 127 angle between two vectors 229 converting to degrees 234 radius 200 radius0 200 radius1 200 radiusPP 200 rand function 140, 243 rand functions 123 random lifespan of particles 165 random number functions 123, 239 random numbers making return values consistent 124 redundant expressions 130 relational operators 65 reloading expressions 106 removing an attribute 131 renaming an object 136 render type numeric 190 rewinding effect on creation expressions 149 unexpected values 141 RGB conversion to HSV 235 rgb_to_hsv function 235 rgbPP 201 rgbPP attribute example use of 179 rotate function 232
272
rotating object around its axis 28 point’s position 232 rounding errors from converting radians to degrees 208 rounding numbers 210 rules of syntax 73 runtime expressions 148, 153 assigning rgbPP in 181 how often execution occurs 148, 152
S saving an expression 107 saving attribute values for initial state 158, 188 Scalar option for per object attributes 170 scale multiplying by percentage 41 slowing increase of 21, 26 Script Editor error display 96 scripting with MEL 45 scripts directory 139 seed function 246 making consistent random values 125 selectedOnly 201 Selection list 103, 104 semicolon terminator 18, 48, 73 Set for All Dynamic 162 Set For Current 150 Set for Current 158, 162, 188 shaded spheres how rendered in examples 154
Using Maya: Hypergraph, Sets & Expressions
short attribute names renaming as long names 137 shortcut operators assignment 91 increment and decrement 92 sign function 212 sin function 219 equation for various uses of 223 sind function 224 sine 219, 224 size function 237 Smooth Shade All 154 smooth shading setting all objects to 16 smoothly increasing opacity 250 smoothstep function 252 comparison with linstep 253 soft body attributes in common with particles 50 spaces in expressions 74 in functions 207 specific particles assigning to 189 speeding expression execution 127, 128 spheres how shaded in examples 154 sphrand function 123, 140, 156, 177, 244 use with random color 181 spriteNum 201 spriteNumPP 201 spriteScaleX 201 spriteScaleXPP 201 spriteScaleY 201 spriteScaleYPP 201 spriteTwist 201 spriteTwistPP 202
Index
sqrt function 215 square root 215 S-shaped cycle sin function and 221 S-shaped motion creating with hermite function 256 standard deviation with Gaussian values 239 starting the Expression Editor 13 statements between { } 70 order of 37 static attributes 49 strings 57, 90 assigning to a vector 91 concatenating with + 90 data type conversion 91, 262 joining 262 syntax rules 90 surfaceShading 202 switch instruction 83 symbolic placeholders 132, 134 syntax errors 36, 73, 95 rules 73 system function 263
T
U unexpected values after incrementing 142 after rewinding 141 in mixed data type division 146 of attributes 141, 143
unit function 233 unit vector 233 units internal conversion of 127, 128 UNIX commands executing from expressions 263 useLifspanPP attribute 161 useLighting 202
V variables 56 as expression element 48 assigning to vector 61 data type of 57 declaring 59 defining 26 displaying contents 123 predefined 57 unexpected values 143 vector functions 229 vectors 57 assigning to component of array attribute 194 assigning to variable 193 component operator 194 data type 52 definition 52 dot product 231 format in print function output 262 formula for magnitude 67, 231 magnitude of 2D 228 random vectors with sphrand 244 velocity 202
Using Maya: Hypergraph, Sets & Expressions
273
Index
tab characters in expressions 74 tailFade 202 tailSize 202 tan function 224 tand function 225 tangent 224, 225 terminator statement 73
text editor changing operation settings 110 quitting 107 selecting 107 selecting default startup 110 using on expression 106 using unlisted 109 valid options 109 threshold 202 time changing 152 default use of seconds 33 definition 57 dividing by 27 multiplying by 27 negative value of 59 predefined variable 19 relationship to frame 59 value at different frames 19 Time Slider setting start and end range 16 timesteps 156 transform nodes not used for particle expressions 151 trigonometric functions 216 trunc function 213 truncating insignificant numbers 213, 261 tutorials for expressions 15
Index
velocity attribute assigning with creation expression 150 assigning with runtime expression 153, 154 field’s effect on 175 working with 175 vi text editor 107 vim text editor 107 visibleInReflections 201 visibleInRefractions 201
W while loop 77 white space in expressions 74 WINEDITOR setting 109, 110
X xemacs text editor 107
274
Using Maya: Hypergraph, Sets & Expressions
Chapter 1 Story Concept
MAYA Character Animation
1
RU.MAYA 99
software package is to come up with an idea and create it using the same type of production process most animation studios employ. It only takes a little extra time to develop a good idea for a 3D project then it does to just sit down and start clicking away doing what the computer wants to do instead of what you may want to see as an end result of all those hours. The best design tool is a pencil which is where we will begin generating ideas. We have all seen animations that were technically perfect or had great 3D characters but left us feeling like the story was not really there and that a great deal of time had been wasted. These next three chapters of conceptual development will help prevent that from happening with your 3D projects.
Development This book is about animating characters in Maya. One of the most amazing things about Maya is that it allows you to create complicated organic looking characters and animate them rather quickly. The challenge now seems to be coming up with fresh original characters and story ideas. As computers get faster and 3D programs become easier to use, visual storytelling skills become more valuable. The first three chapters of this book will take you though a conceptual development process that will help you become a better visual storyteller, character designer and 3D animator. The first step is learning how to generate story ideas for fresh 3D characters and animations in Maya. The next chapter deals with 3D character design and how to create original characters that will leap off the screen visually and grab your audience emotionally. The third chapter will introduce some basic visual storytelling concepts including story boarding, camera shots, color maps, timing and creating an animatic. The goal of these first three chapters is to help you think up solid short stories that can be created by one person in Maya for use on demo reels, animation festivals or to develop your own TV show or feature film. You may also just want to improve your ability to design and compose animated stories, characters and shots.
1) To get the job you want. Most people will hire animators who understand how to compose a shot and design a good character over people who are more technically oriented and consider their artistic and conceptual skills limited.
George Lucas thinks the next «Star Wars» is going to made on a desktop computer. Maya is the type of the software that gives 3D artists the power to create their own TV shows and films. What kinds of stories do you have to tell that might be considered the next «Star Wars»?
2) To win an animation festival. And get the job you want because someone saw your piece in the festival or maybe to pitch a TV series based on your characters to the head of Comedy Central who happened to be in the audience and loved your animation.
Importance Of Story Concept
3) To have more fun animating. It feels better to be working on a really good idea for months on end deep into the night then it does on an idea you suspect may have very limited viewing potential.
This book is arrange in a tutorial process. We invite you to follow along to create your own award winning Maya animations based on the ideas presented in this book.
Top 10 Reasons To Become A Visual Storytelling Expert
The most effective way to learn a new 2
RU.MAYA 99
MAYA Character Animation
which will further your career options. Once you learn how to tell a good visual story you will be able to spot problems and come up with solutions to make difficult shots work. This will also make you a more valuable animator and help you to do the kind of projects you want to do.
4) More flexibility in job market. The animation industry can be unpredictable for employment. The more skills you have the better off you will be if your game company suddenly runs out of money and you need to get another job fast.
10) You could become really rich, famous and make the next «Star Wars» on your $500 PC using Maya. But first you need to know how to tell a good visual story.
5) You may not want to animate other people’s ideas for rest of your life. Some 3D people are fine with modeling monsters for 3D game companies year in and year out. Others find they need a change of pace or maybe have some ideas of their own they would like to try. The more visual storytelling skills you cultivate the better position you are in to pull together your own dream projects.
Other Fields To Study To Become A Better 3D Animator
6) Visual storytelling skills will become mandatory in the very near future. Computers are getting faster and easier to use everyday. Artistic skills are becoming more in demand in the animation field. Already traditional 2D animators are sought out to animate and keyframe 3D characters. Technical skills and knowing which button to push will become less important in the future as interfaces improve. You can teach an artist to use a computer but not always teach a computer person to be an artist as quickly.
In order to become a better visual storyteller and 3D animator you need to spend some time studying some other areas between your renderings. If you want to be a really good 3D person you should be taking classes, reading books and learning as much as you can about the following subjects:
Figure Drawing If you do not know how to draw really well you will have a rough time as a professional animator these days. You use to be able to get by not knowing how to draw but that is changing fast. Draw as much as possible. Try to fit in at least 9 hours a week of figure drawing off a nude model. Concentrate on getting the energy of the pose quickly with short gesture drawings. Check local art schools for life drawing classes and open studios. You have to be able to draw to communicate your ideas, storyboard and understand light, composition, color and values. Life drawing also keeps your eye finely tuned to the nuances of how to really see things like shadows and light. Most places you apply for animation jobs
7) Huge content markets are opening up for original animations. When video streaming hits the internet with TV type speed and quality there will be a big market for original animated shorts and series. There are also lots of other new options such as the digital TV market, animations festivals and commercial work. 8) It takes a long time to get good at visual storytelling so you should start now. Being a good visual artist and animator is a life long process that can never start too soon. 9) You will have more intelligent and useful things to say at production meetings 3
1
MAYA Character Animation
RU.MAYA 99
movie so much. Borrow some of these ideas in your next animation.
1
2D Animation Most really good 3D character animators have spent time doing 2D animations drawing moving characters at 24 frames per second. Read the Illusion of Life and The Animator’s Workbook. Study the Principles of Animation in the Illusion of Life. See how much squash and stretch, anticipation, staging, follow through, overlapping action, ease in/out, arcs, secondary action, timing, exaggeration and appeal you can add to your next 3D project.
will ask to see some drawings. Most large animation studios consider life drawing important enough to offer open drawing studios for their animators during lunch time. Being good at figure drawing will help you design anatomically correct exaggerated characters such as this or anyplace your imagination may take you.
Set up a pencil tester with a cheap video camera and start trying to hand draw animated bouncing balls, walking sacks of flour and simple characters doing things. Develop a sense of timing for movement. Learn how to put some personality into a character’s walk cycle. Get a VCR or DVD with a clean freeze frame and go through step by step each frame of cartoons. Try to copy what works and learn what does not. 3D animators usually continue to do some 2D animation to keep their traditional skills fresh. If you are just getting into 3D animation and are serious about becoming a character animator as a career, you may want to go to Cal Arts or Sheridan College to study 2D animation first.
Film Making/Traditional Cinematography Study the great directors behind the cameras of the best films ever made. Its all been done before in one visual form or another. You don’t have to reinvent the wheel every storyboard panel. Visually creative people have been setting up shots, constructing interesting characters and designing sets ever since the first story was told. Storyboard shot by shot films or scenes from films that you think worked really well or are similar to current projects you are developing. Try to figure out what the director was thinking when he composed each shot.
Graphic Design, Typography, Sacred Geometry
Storyboard the first five minutes of the movie classic «Citizen Kane». Pay attention to the composition, contrast of lights and darks, lighting, camera movement, transitions from scene to scene, timing of shots, cuts and overall look and feel creation. What are your top ten favorite movies of all time? Storyboard the best parts and try to figure out why you liked each
Good animation requires good design sense. Understanding how colors work together, type, layout and visual communication will improve the way you design your characters and shots. Take a graphic design course or practice copying designs that appeal to your sense of style. You will gain a greater understanding of 4
RU.MAYA 99
MAYA Character Animation
the process involved if you try to recreate a nice layout with pictures and professional type. This will also makes the credit sequences of your animated projects look more professional.
about how important dramatic lighting can be to a 3D scene. Take a figure sculpture class with clay to help make little models of 3D characters you may want to animate one day. «The Artist’s Way» is great artistic survival book for people embarking on creative careers and will also help you think of yourself more as an artist if you feel weak in this area.
Sacred geometry will also help you design sets and characters. «A Beginner’s Guide To Constructing The Universe» by Michael Schneider is a great books to get you started in this fascinating and useful subject.
Photography
Acting
Carry a good camera with you at all times to take pictures of rusted walls, strange pets, graffiti, interesting looking people, architecture and sunsets. Start your own clip media library of 3D texture maps and reference shots for brainstorming. Commercial clip media textures are often overused and easy to spot. Photography helps develop your eye to compose better moving camera shots once you master the still frame.
Take an acting class. This activity will help you understand how important it is to give characters clear motivations. You will learn about dramatic tension and three act structure. Animators need to be able to act out their characters in front of mirrors to get the motion right. You may feel more comfortable doing this with some dramatic training. You will also get a sense of how to make a character come alive in a 3D scene.
You may be wondering how you are going to have time to do any 3D animation at all if you have to know all of these other things. This is why you need to start now. The best animators usually have some training in several of the fields mentioned above if not all. Being a 3D animator is one of the most challenging careers around but at least you will never have to worry about being bored!
Screen Writing Write your dream screenplay then take a screen writing class. You will learn all about formatting, beats, scene structure, visual storytelling and lots of other information you can use later. 3D animation houses borrow lots of ideas from movie making so you should get familiar with the lingo. Read «Writing Screenplays That Sell» by Michael Hauge.
Story Concept Process You are about to embark on a story telling journey. The ideas presented in these first three Chapters were developed to help even people who have never told a story before formulate a good solid idea for a short (2-10 minutes) 3D animated film. This is a step by step process that continues on through out the book. A sample story called «Media Man In the Net»
Fine Arts/Performing Arts Studying any area of the arts will help you become a better animator. Obviously you cannot master painting, sculpture, music and theater but if you already have an interest in one you may want to develop it further. Volunteer at a community theater to light their next play. You will learn a great deal 5
1
MAYA Character Animation
1
RU.MAYA 99
The first step to showing off a really great 3D animated character is coming up with a good story that you can then mold into a deeply satisfying emotional ride.
will be developed in these first three chapters to give you an idea of the conceptual design process for 3D animated projects.
Steps To Formulating A Basic 3D Story
The Most Important Thing The first question to consider is this: What is the primary goal of any film, TV Show, play or animation? Now think about this for a moment before you read on since it is a very important point. Most people say it is to entertain or make money. All of these things are important but will not happen unless you do the following:
1) Research story ideas 2) Brainstorm specific ideas good for 3D & Maya 3) Create a story concept sentence 4) Fill in three act structure points 5) Flush out story to one page draft 6) Create some rough thumbnail drawings 7) Evaluate using 3D Story Concept Criteria Checklist
The first and primary goal is to evoke a strong emotional response from the audience.
Researching Ideas For 3D Animated Stories
Ideally you want your audience to be laughing out loud, crying out in surprise, biting off their finger nails while worrying about the characters, jumping out of their seats with joy, recoiling in fear, screaming out in bursts terror, smoldering in emotional pain, feeling at one with the universe or exhausted from all the action. These reactions are harder to get then you would think.
There are lots of places to look for 3D story ideas, characters and settings. 1) Personal Experiences - Write about what you know. This is the oldest rule in the book. If you choose stories you have some prior knowledge about you will be able to communicate more effectively the slight nuances and details that will bring the characters and situations to life. Try to pick experiences that have a high emotional charge in your life. Make a list of your top 10 emotional experiences and see if you can turn any of them into some form of a 3D animation.
Review the emotional impacts of your favorite films. When you go out to movies keep an eye on the audience. See if you can get an emotional read off of how much they are involved in the story. Films that don’t do well usually fail to evoke any emotion at all. «The Avengers» (1998) is a painful example of a technically good film full of hot stars and special FX that failed to evoke any emotion at all and did miserably at the box office.
2) Novels, magazines, comic books, newspapers, internet sites, short story books - all contain great ideas to animate. Once you get more comfortable writing stories specifically geared for 3D animations you will be able to re purpose practically any story for your needs. Keep a scrap book with clippings from different places full of stories that somehow fascinate 6
RU.MAYA 99
MAYA Character Animation
you. After reading a good novel summarize the story on a sheet of paper and add it to your story files. You may want to start grouping stories according to subjects such as SCI-FI, adventure, game ideas, fantasy or whatever areas interest you.
1
3) Movies, plays, TV shows, operas, 2D animations - What kinds of ideas can you borrow from existing visual stories? Disney has a pretty standard formula for most of their films where they just change characters and settings. Most myths and stories have already been told in one form or another. Start to find patterns in storytelling. Practice combining ideas from different stories to create new ones. Each time you see a visual story write a summary of the plot and note any exceptional characters or sets. Be a critic and write down what worked in the story and what did not. Storyboard your favorite shots or any clever cuts for future reference.
such a successful film. You could feel his wonder and excitement for the subject in almost every frame of the movie.
4) Historical Events - History is full of epic stories packed with emotional intensity, unexpected plot twists and larger than life characters. What events in the history of the world fascinate you the most? Why? How could you turn them into original 3D animations? Jim Cameron said he was always interested in the sinking of the Titanic. His passion about this subject helped him make
These two characters would be good for a historical story with lots of cultural and background. Write your own history of a made up culture based on a real one with an added 3D dimension.
5) Dreams - The subconscious mind deals with visual symbols that can work great for animations. The trick to re purposing dreams is not to be so abstract that your audience has no idea about the structure of the story. It is virtually impossible to get an emotional response from the audience with abstract story lines in 3D. There is a great danger that the audience may simply write your whole animation off as an experimental trip video. Be careful with dream information. Try to use the symbolic references or parts that have the most emotional impact and work them into a solid story line as a visual twist. Keep a dream journal beside your bed and write down any interesting ones when you wake up. 7
MAYA Character Animation
1
RU.MAYA 99
story you may want to use the classic hero myth structure. Star Wars is classic hero adventure and can be broken down into the steps listed below.
makes the reluctant hero doubt whether or not he wants to go on this new adventure. Reluctance to change. May meet a mentor to help him make the decision. 4.1) A crossing of the first threshold where the hero leaves the place that is familiar and goes into unknown realms either physically, emotionally or spiritually. Commits to making a change. 5.1) A series of tests that increase with risk occurs where the hero encounters allies, mentors and enemies. Experimenting with first change. 6.1) A journey into the innermost cave or belly of the whale where the hero usually goes into the stronghold of the opposition. New perceptions and skills put to test. Conflict needs to be building and obstacles getting much more difficult. Preparing for big change. 7.1) The main crisis or ordeal takes place where the hero comes face to face with death or greatest fear. Attempting big change while seizing the sword. Hero somehow magically escapes becomes transformed or reborn after final attempt at big change. 8.1) Reward/Road back home has the hero returning a new person from going through this set events. Great celebrations from final mastery of the problem.
This character would be good for mythic story full of legends and magic.
What other movies can you think of that follow this hero journey formula?
Read Joseph Campbell’s book «Hero Of A 1000 Faces» to get a better understanding of how to create really solid hero journeys. Another great book for hero stories is «The Writer’s Journey» by Christopher Vogler. The basic story happens in these steps:
7) Software Capabilities - What does Maya do that you’ve heard about or seen that you are dying to try? Perhaps you just got the new cloth plug-in and suddenly want to do a futuristic fashion show. Every time you get a new software capability brainstorm at least 50 different uses for it in your story lines. This will force you to come up with ideas beyond the first few everyone thinks about. Try to do what your software does best. Maya is know for character animation so you might not want to try to do a huge city getting washed away by a tidal wave in Maya for your first project. Most animation houses use several different software packages to get what each one does best for the job. Create a table like the one
6) Myths - If want to do a guaranteed good
The Hero’s Journey 1.1) Normal person in ordinary world with limited awareness of bigger problem. 2.1) Call to adventure. Event occurs that thrusts main character into uncommon situation requiring great amounts of courage. awareness of problem increases. 3.1) A refusal of the call may occur that
8
RU.MAYA 99
MAYA Character Animation
Story Ideas Based On Maya Software Capab Dynamics
Particles
car crashes picture type fireworks visible electrical fields stylized science experiments ball through maze jello people mousetraps Rube Goldberg contraptions Newtonian black holes
drool bee swarms hail water splashes, falls dimensional vortex tiny water creatures
Cloth/Hair Viking Sailboat futuristic fashion show alien fashion show ape w/ mowhawk flaming hair English sheep dog types furry tunnel fly through furry sea creatures
Maya Live 3D character in 2D environment shaking camera FX 3D wings on a blue screened angel 3D tail or horns on a blue screened actor placing 3D dinosaurs in video forest 3D UFO's flying over a video of NYC
Brainstorming Technique For Original 3D Ideas
below with basic functionality categories on top and then brainstorm ideas for each one. Here is an example chart with a few of the software capabilities from Maya: Keep an on-going list of any ideas you think of to utilize new software in an original way. Try to come up with at least sixty ideas for each of the groups below. Add to these lists as new capabilities are introduced in the form of plug-ins and upgrades.»
After you have done some research and gathered a wide array of ideas you may want to animate, it’s time to make them original. The following brainstorming exercise was developed to help people combine ideas they would not normally consider. Most of the ideas you think of sitting around watching Star Trek or walking down the street have also been thought of by some other dedicated 3D maven who is probably working on it right now. You need to go beyond the first idea and go deeper. The majority of screenplays in Hollywood are rewritten from scratch at least 10 times before they are considered ready to shoot. You should spend as
Not all of the above ideas are going to go on to become Academy Award winning Maya animation shorts. That’s OK. Whenever you are in the brainstorming phase try not to judge the quality of the ideas - just get a bunch down on paper for future reference.
9
1
MAYA Character Animation
1
RU.MAYA 99
much time as possible making sure your idea is the best and most original one you can generate before committing it to production. Never touch a computer unless you have final storyboards that have undergone a process such as the one described in these first three chapters. If the story does not work on paper you cannot fix it by adding a bunch of whiz bang special effects or even great animation. Be honest with yourself, get lots of feedback and be prepared to make your final concept as successful as possible at the storyboard stage. A great deal of «rough» storyboard ideas end up in final animations because the animator was just so enthusiastic he could not wait to touch that computer. Sometimes you do get a great idea out of the blue but it will still need considerable work to make it a tight animated story. Take out a big drawing book or sheet of paper and make four columns such as the ones that follow with these main subject headings:
grammar. Sometimes just a few words is fine. Underline main words such as «robot dog» to help you glance quickly at the list later if this seems helps you.
1) 3D Characters: Think of some 3D characters you have always wanted to animate. You must think of a good reason to do them in 3D or you can’t put them on the list. Be specific and describe them using visual adjectives whenever possible. The goal is to be able to see the character and understand its essence from the description. «Robot dog» will not get you as far as «robot dog made of found junkyard objects, rusted, pit bull, sassy male punk teenager white trash mutt with one eye». Now you can see the robot dog better and get a good visual sense of his personality. Do not worry about sentence structure or good
«This is a 500 year old woman with lots of wrinkles. It would be very difficult to find an actress to play this role which makes it a great idea for a 3D.» 2) 3D Settings: Think your ultimate list of 3D sets. Once again it must make sense to do it in 3D. Audiences want to see things they have never seen before. Base all settings on actual exiting places to give them a style. Feel free to combine ideas. Add dates for reference to help us understand look and feel. «A city» gets you nowhere. «Ice crystal city Paris type metropolis 2300, future primitive cave buildings, powder blue with a silver mercury river». Once again underline the main idea if it is hard for you to pick out from the rest of the words. As you do
10
RU.MAYA 99
MAYA Character Animation
3D worthy. The visible motivation on the part of your main character is what will drive the story so be sure to choose motivations you can show well. 4) Obstacles: You need to look at the motivations column to complete the obstacles since they are tied together. Think of at least two obstacles for each motivation. «To get rich by inventing new happy drug» could have obstacles such as «bad side effects/drug companies trying to kill you for the formula». Try to have the first obstacle be smaller than the second. Think of at least twenty to sixty ideas for each column. Add to this list as you go through your life. This brainstorming tool can also be tailored for specific ideas such as an alien game world, You could then concentrate on just alien 3D characters, alien sets and corresponding
the settings do not look at the first character column list. You should not be trying to think of where the robot dog lives at this point.
«This prehistoric setting would make sense to do in 3D. You could not take a camera crew out to shoot this and it is something people have not much of before which will make it more interesting. The 3D characters also fit nicely into the environment.»
3) Motivations: Once again do not look at the previous two columns. Think of good motivations for characters in movies or stories you have heard. Motivations can be a bit more general or really specific if you want. «To get rich» works as well sometimes as «to get rich by inventing new happy drug». If you get stuck on thinking about good motivations go down to your local video store and read the back of movie boxes. Video stores are great resources for thinking up 3D characters and sets too. Just add slight design twists to make them 11
1
MAYA Character Animation
1
RU.MAYA 99
motivations and obstacles. It is OK to even refer to the other
3D Story Concept Brainstorming Generator Chart 3D Characters robot dog made of found junkyard objects, pit bull, sassy teenage punkrock boy 16 yrs obese kung-fu warrior, into disco 500 year old Chinese woman, covered w/ huge wrinkles, wooden leg, 3ft tall Mayan King stone statue, 10 feet tall, playboy, ancient 3D avatar techno DJ, lives in internet, 007 fix it man alien octopus that eats airplanes, 3 miles wide, lives in Bermuda Triangle Atlantis crystal princess, telepathic, tones, nordic
3D Settings
Motivations
ice crystal city 2300,
to get rich by inventing
furture primitive Paris
new happy drug from rare animal
inside the human heart
to get the girl by getting
magical redwood forest
rid of huspand
with talking trees haunted castle 1800
to win the race
500 pounds, teenager red blood cell who wants to be white, into swing music, rockabilly biker bumblebee, hates the hive life , rebel, James Dean Type shape shifting liquid alien, assumes different human forms blackwidow spider race w/ human heads, 60’s Valley Of The Dolls toy wookie doll, violent temper, purple fur, glowing red eyes, 9 inches sunflower opera singer in a field with other singing plants race of 12 foot tall humans w/out mouths, ears or hair lizard headed humoniods, corn worshippers from Taos animated talking star constellations in the night sky biped alligator race, drunk ozark outlaws, voodoo swamp cowboys, warriors, ancient
2. drug companies trying to kill you for formula 1. evil people took her 2. she thinks you are silly 1. vehicle always breaks down 2. people trying to kill you
Translyvania, demon staues that come to life alien planet made of
to stop bomb from exploding
fluffy clouds thick enough
that could blow up planet
1. you do not know where it is 2. only 3 minutes left
to live on, low gravity deep ocean jellyfish city,
to have everyone worship
in crevice, dome fish skin
you as a god
1. planet is about to explode 2. you’ve lost your voice yelling
dwellings alien planet made of to keep evil virus from killing
fluffy clouds thick enough
everything
to live on, low gravity
1. virus is smarter than you 2. it kills through visuals
3D internet city, metaverse, to learn how to be psychic
San Francisco 2050 Ultimatte frisbee pig,
Obstacles (2) 1. bad side effects
at militant institution
subterrainian rat world
1. you keep seeing all the demons 2. CIA & Mafia are trying recruit
made of garbage, NYC type futuristic robot factory
to win the dance contest
run by cyborgs w/ human slaves
at a galactic competition
1. competition has more legs 2. the penalty is death for losers
ancient tomb city from lost civilization with high tech stuff space station vacation land 3000
to hunt down an evil poacher
above earth, Balinese theme
to get rid of half the world’s
Hopi village at height of culture 1350? space station on edge of universe seaport ancient Turkish theme
population to save it from
1. poacher is diabolical madman 2. poacher is hunting you 1. breeding outpaces extermination 2. doctors keep coming up with cures
destrution to rule the world
huge futuristic aquarium
1. lots of competition 2. your partner is trying to kill you
where fish communicate
to get enlightend at
glass world made of colorful
kung fu yoga camp
blown liquid shapes, Prague like village inside the belly of a huge whale like creature, French seaport
to kill bad aliens invading planet to kidnap all the earth
futuristic organic pirate ship
woman and sell them to mars
that talks and has own agenda swamp world full of quciksand,
to find another planet live on
1. head guru is wise but insane 2. they want you to go to war for the cause 1. aliens have better technology 2. aliens can look like humans 1. earth men trying to stop you 2. woman fight back 1. stolen spaceships hard to fix 2. other aliens are hunting you for sport
huge snakes, Venus fly traps to make the galaxy peaceful
life inside a beehive that’s 500
1. huge 300 year war in progress 2. you end up in prison
miles wide, metropolis Bangcock
to find your way back
Medusa headed femme fatal,
home to planet
1000 gold cobras on head, sand for skin, gemstone eyes, Coutney Love type
to go to the edges of the
3 legged humaniod with snake head
known world exploring
covered in rainbow scales, 14 feet tall,
1. lost no idea where you are 2. your eyes get burned out by staring at a sun momentarily 1.you can’t even get out of your tiny town 2. travel is forbidden
African tribal witchdoctor theme
columns sometimes if it helps you generate better ideas. See what works best for you and your story needs.
Now that you have filled in your chart you are ready to create some original stories. First you need to understand the story concept sentence. Here is the basic structure:
Brainstorming Chart
It is a story about a character who wants
The Story Concept Sentence 12
RU.MAYA 99
MAYA Character Animation
something.
descriptive.
You should be able to define any story ideas for animation projects film or TV show using this format. They also call it the 30 second elevator pitch. The idea being if you are stuck in the elevator with Steven Spielberg you can pitch your idea before he reaches his floor and has a chance to get away from you. It also helps to orient people to your idea before presenting the storyboards or just to explain the concept of what you are doing to other animators or people in the industry.
It is a story about a young man coming of age during a galactic civil war in outer of space, and his struggle to save the princess and become a hero by using a universal «force» power. Now try generating the story concept sentence for your top ten favorite films. If you get stuck, start with figuring out who the main character is first and then what their main goal was throughout the film. Try generating story concept sentences for TV episodes, comic books, stories you read or personal experiences. Keep a running list to have ideas for future Maya projects.
Once again the idea is to be as specific as possible to make the sentence as good a synopsis of your particular story. Avoid references to popular movies or characters. Pretend the person hearing your story is from another planet and knows nothing about our culture but understands the language. Stating that a character is a Buckaroo Bonzai type in a 2001 spaceship setting may lose people who are not as familiar with these references as you may be. It will also help you to redefine popular characters and settings in concise adjectives and understand their essence more fully.
STORY CONCEPT SENTENCES FOR THE BRAIN STORMING LIBRARY Now that you understand the story concept sentence you can use your brainstorming chart to come up with some new ideas to animate. The characters are almost sure to be original, good to do in 3D and live in 3D environments with some unexpected motivations. By using this brain storming technique you will be able to generate a large number of original ideas quickly. Save your lists in a notebook to refer to later for ideas on other projects or for elements in your story.
What do you think the story concept sentence is for the movie, Titanic? Most people say Titanic is about a boat that sinks. Everyone knows that the boat is going to sink before seeing the movie. Cameron had to instead come up with a way to get the audience to care about the people on the boat and the reality ship life.
You will be using a slightly altered story concept sentence to ensure you get a good original 3D setting in the mix:
It is a story about a poor young artist who falls in love with wealthy young recently engaged woman aboard a luxury ocean liner on its maiden voyage. As the ship sinks we get to see how this event effects their relationship and lives.
It is a story about a 3D character who lives in a 3D setting who wants a motivation.
What is the story concept sentence of the movie, Star Wars? You may say it is a story about Luke. Unfortunately some people do not know Luke, so you have to be more
Start with your character column placing the first one in the «3D character» space using an abbreviated version. Now go through the 13
1
MAYA Character Animation
1
RU.MAYA 99
settings until you find one that makes the most sense or sounds interesting. Add a motivation that would fit with the character and setting you have already combined. Cross each one off as you use them so that you will not use them again.
who lives in a space station who wants to win the futuristic Frisbee trick competition.
Here is an example list of twenty taken from the previous brainstorming chart to give you an idea of the combination techniques. Do not worry about grammar or sentence structure just get the necessary information in the sentence. You can also add or delete little twists or details that will make the ideas hold together better but try to stick as close to your original list as possible. Do not worry about the obstacles yet.
10. It is a story about a biker bumblebee who lives in a sub terrain world run by rats who wants to rob the ultimate honey bank.
9. It is a story about a red blood cell who lives inside a human heart and wants to go to beyond the edges of his known world.
11. It is a story about a shape shifting humanoid alien who lives in an organic pirate ship who wants to kidnap all earth woman and sell them to other planets. 12. It is a story about spider with a human head who lives in a swamp world who wants to rule the world.
1. It is a story about a robot dog who lives futuristic factory run by robots with human slaves who wants to hunt down an evil poacher.
13. It is a story about evil toy wookie doll who lives on a space station and wants to kill bad aliens invading the ships through the children.
2. It is a story about an obese kung-fu warrior who lives in a Hopi type village who wants to get enlightened by going through intense training.
14. It is a story about a sunflower opera singer who lives inside a magical forest with talking Redwood trees who wants to make the whole galaxy a peaceful place by singing her beautiful songs.
3. It is a story about 500 year old Chinese woman who lives in a haunted castle who wants to get rich by inventing new happy drug. 4. It is a story about Mayan statue king who lives on an alien planet made of fluffy clouds who wants to get the girl of his dreams.
15. It is a story about a race of people without ears or mouths who live in a sand world who want to find another planet to live on to survive.
5. It is a story about of a 3D avatar techno DJ who lives in a metaverse internet world who wants to keep an evil virus from killing everything.
16. It is a story about lizard headed humanoids who live inside a huge beehive and want to fly the beehive back to their own planet far away.
6. It is a story about alien octopus who eats airplanes who lives in a city deep below the ocean floor and wants to win a dance contest at a galactic competition.
17. It is a story about animated talking constellations who live above a glass world who want to make everyone worship them as gods.
7. It is a story about an Atlantis crystal princess who lives in an ancient tomb who wants to get rid of half the world’s population.
18. It is a story about an alligator biped race of drunks who live in an futuristic aquarium who want to win the annual speed around the big tank species race.
8. It is a story about an ultimate Frisbee pig 14
RU.MAYA 99
MAYA Character Animation
1. It is a story about a geometric style dog who lives in a dog town and wants to break into the butcher shop.
19. It is a story about medusa headed woman made of dirt sin who lives in a ice crystal city who wants to learn to be psychic at a militant institute.
2. It is a story about a ghost Great Dane who lives in a vast bone yard wonderland who wants to win the ghost pet dog show.
20. It is a story about a snake headed 2 legged humanoid who lives inside the belly of a great beast who wants to stop the bomb it just swallowed from exploding.
3. It is a story about an Irish Setter movie starlet dog that walks like a woman who lives in a doggie amusement park and wants to be queen.
Brainstorming Chart For Particular Themes
THREE ACT STRUCTURE
Not all of the ideas you come up with will work well enough to develop into 3D animations. If you did a good list of 60 rows for each of the columns, you may only have two or three good ideas at the end. If you feel you have only a very few good ideas try limiting your brainstorming lists to themes that interest you. Some example themes include: alien worlds, gothic fantasies, medieval samurai or dog stories.
Once you get the hang of creating story concept sentences you can then use them to generate three act structure animations. Start by choosing your favorite story concept sentence from the brain storming list you created. Keep adding to your brain storming lists and making up new ones. Experiment with the theme lists to help tailor the stories for specific genres. The strange thing about ideas is that you always seem to have a lots of them until you really need one. Dedicate one drawing book to brain storming story concept lists, sentences and three act structure points.
The following chart is a brief example of the dog stories theme: (format in script font same as other chart)
3D Characters 3D Settings Motivations Obstacles (2)
WHAT IS THREE ACT STRUCTURE?
geometric stylized dog made out of primitives vast bone yard wonderland to be king/queen of the local dog park • current top dog is trying to kill you • your owner has abandoned you ghost pet Great Dane dog doggie amusement park to win the dog show • you just broke out in a hot spot rash • the announcer’s voice hurts your ears Irish Setter movie starlet that walks like a woman in heels big dog town with little dog houses to break into the butcher shop • you are trapped inside your own house • Bulldog guard dog twice your size & mean
Once you have a basic idea you can put into the story concept sentence it is easier to flesh out the meat of an animated story. The idea of three act structure has been around since ancient oral story telling traditions. Greek playwrights founded the term and it is still used today in most of our modern stories. Three act structure permeates almost every aspects of commercial entertainment. TV shows, feature films, animated shows, books, operas and plays all follow the three act formula. There are lots of debates about the use of three act structure among conceptual artists and experimental abstract film makers. The danger 15
1
MAYA Character Animation
1
RU.MAYA 99
of not using three act structure is that people are use to it, expect it and get a little frustrated and confused with your animation if you do not give them a satisfactory story experience. It is a big risk to embark on a story without three act structure, especially when utilizing something as expensive and time consuming as 3D animation. You should master three act structure before diving into any sort of abstract free form story lines or experimental ideas.
problems. Without this event there would be no a story. FIRST TURNING POINT: 55-65 seconds - Fresh turn of action for a story. Plot twists. Surprise changes in story direction and motivation for the main character. Escalation of obstacles with new and bigger obstacles introduced. CLIMAX: 90 - 95 seconds - Point of the greatest intensity. Your goal here is to get the audience sitting at the edge of their seats fully engaged in this moment of your story. This will be the hardest plot point to successfully execute. If your audience is not emotionally entrenched in your story they will not experience a point of greatest intensity that feels satisfying. This build up of incredible tension also needs to be timed perfectly with the other plot points. If you climax the story too early it will leave the audience feeling flat at the end. Most people fail to make their story climaxes strong enough in general. This sequence is often the most important and expensive series of shots in a 3D animation or film with special FX.
Stories are broken into three parts called acts. The first act is where the set up for the story occurs, main characters are introduced and the look and feel is established. In act two there is build up of story tension with a lots of action, conflict, obstacles and difficult situation that the main character must confront and overcome. Act three ties the story up and resolves the situations presented.
Shown above is a graphical representation of three act structure. The upward curve represents the dramatic tension build up of the story resulting in the climax at the top of the curve. The points of the curve represents timing of particular events or turning points in the story line. Notice that act one and act three are the same length, each being about one quarter of the story. Act two is twice as long and comprises half of the story in the middle section. You can use these plot points to figure out the timing for when certain events should occur in your story. Most Hollywood screen plays are 120 pages or minutes. We will be doing a two minute story for this example which breaks down to 120 seconds to use the same formula. If you were doing a four minute animation just double the seconds for each part. Estimate for other lengths accordingly.
FINAL CONFRONTATION: 100 - 110 seconds - Confrontation between two main characters that has been building up throughout the story finally happens. Hero and villain battle to the death, love interests have a point of reckoning or groups of opposing characters meet head on and battle it out over a brewing issue. RESOLUTION: 105 - 120 seconds - Ties up loose ends of the story. Does the boy finally get the girl after saving the world? Do the characters live happily ever? How does going through this experience change the characters or situations?
SET UP: 0 - 30 seconds - define a status quo (What is normal?) Introduce a main character, foreshadow subplots, introduce mood and setting.
Let us now break up some popular films with these plot points. The movies Titanic and Star Wars will be used as examples since most people have seen these movies. Three act structure for the movie Titanic is as follows:
CATALYST: 25 - 30 seconds - This is a event that changes a status quo. Forces a character to act and introduces conflict or 16
RU.MAYA 99
MAYA Character Animation
SET UP: We meet Rose, a young wealthy woman, and Jack, a poor young artist as they board the famous ship for its maiden voyage. Subplot starts comparing rich vs. poor passengers and how life aboard ship reflects this idea through accommodations, dining experiences and entertainment. There is also a main motivation on the part of the salvage captain to find the lost diamond Rose was wearing when the ship sank. This allows Cameron to go backwards and forwards in time to let you discover the story and piece it together at the same pace as the captain of the salvage ship. Would you have cared as much about Rose and Jack if it would have been a linear story where it started with Rose and Jack just getting on the boat? Ask yourself why they do things like this in films. We will talk more about this in Chapter two.
reveals that she has had the diamond all long and throws it over board. We also see how the sinking of this ship and the subsequent search for the neckless has affected all the character’s lives.
Three act structure for the movie, Star Wars, is as follows: SET UP: We meet the princess who gets captured by Darth Vader and get a taste of the light and dark sides of this galactic war. We then meet Luke on his an planet as a restless young man ripe for an adventure. CATALYST: Luke decides to leave his home and help Obi Wan get the plans to the rebel planet after his family is killed. If Luke had decided not to go there would not have been much of a story.
CATALYST: Jack and Rose meet when Rose tries to kill herself by jumping off the edge of the ship. They start to fall in love. If Jack and Rose had never met there would not of been much of a story. You would not have cared who survived unless you were emotionally involved with one or two main characters on a deeper level.
FIRST TURNING POINT: They find out the rebel planet has been destroyed and discover that the princess is being held captive on the death star which is also a big new threat. FINAL CONFRONTATION: Obi won fights Darth Vader to the death to settle a long dispute.
FIRST TURNING POINT: The ship hits the iceberg. Jack and Rose then quickly discover that they have two hours to figure out how to survive and stay together. Fresh direction for the story line.
CLIMAX: «Use the force Luke» as Luke flies in for the final chance to destroy the death star and save the rebel planet.
CLIMAX: Jack yells to Rose «This is it!» as the ship’s bow is erect in the water ready to finally sink into the icy sea. Most expensive shot in the film as the ship plunges into water with people falling all over the place. The audience has been waiting for this event the whole film.
RESOLUTION: Luke returns to the princess as a hero. Notice how in Star Wars the final confrontation occurs before the climax. This happens occasionally so keep an eye on where it may work to your advantage to make the story stronger and the climax more powerful.
FINAL CONFRONTATION: Life boat full of rich passengers argue about whether or not to try to save people screaming in water. Wraps up the subplot of class differences presented throughout the movie.
GOOD REASONS TO USE THREE ACT STRUCTURE 1. Guarantees good solid story structure in a proven formula that works.
RESOLUTION: Rose as a old woman 17
1
MAYA Character Animation
1
RU.MAYA 99
2. Hollywood usually will not touch stories that do not use three act structure because they tend to loose money, are viewed as experimental projects and audiences do not respond in consistently positive ways. 3. Knowledge of three act structure will help you to fix stories that do not work or have problems. 4. Three act structure helps you to pace the events in your story more effectively.
CATALYST: Anti-virus software appears to be contaminated as a Media Man installs it to system prior to product launch. FIRST TURNING POINT: Evil virus penetrates internal security systems. CLIMAX: Central core and Media Man defeats virus and saves live internet product launch party.
APPLYING THREE ACT STRUCTURE TO IDEAS
FINAL CONFRONTATION: Media Man and Core finally say they love each other.
Now choose your favorite story concept sentence from the list you have generated. Fill in three act structure plot points for your idea as demonstrated below in our example story «Media Man In The Net».
RESOLUTION: Everyone on the internet tuned into the broadcast feels good about new software and experiences the peak moment induced frequency.
WRITE ONE PAGE SUMMARY OF STORY
It is a story about a 3D avatar techno DJ who lives in a metaverse internet world in 2020 who wants to keep an evil virus from killing everything during the launch of a new software that induces emotional states via graphics.
Using your three act structure points as a skeleton fill in events that happened inbetween. If you know how to write in traditional screen writing format you may want to rough it out on paper in the official format to get a sense of the timing (one page equals about a minute).
Notice how some of the information has changed to fit together better as a story such as switching out the bad guy to for an evil virus, including a software launch and adding the date 2020. This story concept will be particularly hard since it has lots of cliche elements in it that will have to be worked out such as the overdone virus in the net theme. We will choose this one to learn how to fix problem stories along the way. You should chose one from your list that makes you feel excited enough to want to animate it over the course of several months.
You may also just want to use a brief sentence or two to describe each scene in your animation. For the «Media Man In The Net» example, the rough scenes were listed in this manner to flesh out the spaces between the plot points. The goal at this point is to get a idea of the events that need to occur to bridge the three act structure points. This is not intended to be a final script, but more of a working tool to help you develop a set of rough thumbnails to see how much potential the idea my have for
Three act structure for the 3D animation Media Man In The Net is as follows: SET UP: Meet Media Man driving through a 3D internet node on his way to pick up new anti-virus software. Introduce subplot of love interest and big software internet launch event coming up that night. 18
RU.MAYA 99
MAYA Character Animation
animation. If you find it hard to think of visual events that go between these plot points you may want to choose a better story idea. The visible motivation on the part of your main character must be the driving force behind your animation.
6. We see the evil scientist again in his lab working away as the virus behind the glass starts to come alive. The side door opens and the Mole man comes in and says he has done what he was told and wants his family back. Evil doctor points to the door inside the glass room and tells him his family is in there where the moles goes and is torn apart by the shadow lit virus.
Media Man In The Net One Page Rough Scene Summary 1. Media Man (MM) streaks through the metaverse (3D internet city) in his pod car with his robot copilot Spookbot beside him. MM is holding a sacred geometry sculpture spinning hologram and talking about giving it to his current love interest the Core. He also mentions how lucky he was to find the new anti-virus software needed to protect his project from a new strain of AI viruses rumored to be currently close completion.
7. We see Vax as a real person at a real warehouse party type new age rave scene testing the real time graphics live internet feed and setting up for the big event that night. Lots of crew type people are running around in the background as we see the conversation continue with MM on VAX’s laptop. 8. MM is now inside the main nerve center of Cyberdome and greets the Core who is a shinning white avatar woman hooked into a bunch of Geiger like cables as a neural net link
2. We see a diabolical lab room inside the metaverse with a crazy scientist avatar pushing buttons that make an ominous shadow behind thick glass twist and writhe. The scientist says you are almost done and talks about how evil this virus lord is and how it will destroy Cyberdome which he believes was stolen from him when he was fired from the place a long time ago and lost his valuable stock options now worth millions in smart cash. 3. MM pulls up into a side alley in Chinatown and drives through a secret door after being scanned. 4. MM gets out of pod inside virtual scary underground pet store. Mole type bald headed avatar enters and gives him new virus software after brief cryptic conversation. 5. MM heads back out through the Metaverse towards the entrance to the Cyberdome which is a Megaplex type internet private community with lots of security gates he needs to go through as he talks more about the launch of the new emotional inducer software launch they are planning with his human link Vax who we see on his com screen asking if everything is ready.
up for the emotional induced states they generate. MM and her talk about this as he 19
1
MAYA Character Animation
1
RU.MAYA 99
prepares to upload the anti virus software. Vax breaks in and says two minutes to launch as MM loads in software.
wrong with security as Evil Virus comes up behind him and starts to spin radiating these slimy tentacles that splash a rain swarm of virus worms over across MM who immediately becomes infected. The Core sees this from the corner of her eye and starts to scream out in fear as the virus heads towards her.
This is rough design for The Core character who is hooked into a machine that generates emotions via 3D computer graphic visuals.
16. We watch as crowd’s faces go from happy to screaming scary as the core is attacked by evil virus lord. Vax is now trance locked on the screen too and screaming.
9. We see the evil virus lord break out of the glass cage and kill the scientist who made him then flee down the Metaverse streets heading towards Cyberdome.
17. MM pulls himself up and inserts a backup experimental AI anti virus dose into security system which starts to bring it back on line. Virus sees him and they fight it out with core helping and the audience going through all the emotions at the same time from watching the screen patterns generate.
10. The core during a routine test with the new anti virus software starts to jerk spastic ally telling MM something is wrong. MM checks and says it is corrupted and that he does not understand since the Mole has always given him the best and most honorable code before. MM also announces all security systems are off line.
18. MM defeats virus in some ingenious way. Core and him profess love for each and all of crowd goes into love mode watching screen as MM and Core stare into each other “s eyes then turn off live emotion feed.
11. We see Evil virus waiting outside Cyberdome gate as it suddenly flies open and he passes through the security points easily cloaked.
19. Crowd looks all loving as screen at party goes to black and Vax snaps out of phase lock into his announcer role as everyone starts to cheer enthusiastically.
12. Vax back at the party is trying to raise MM on his laptop while on stage in front of thousands of people for the big live internet launch. MM says something is wrong. Vax tells him to fix it fast and continue with launch since nothing can stop it from happening at this point.
CREATING ROUGH THUMBNAILS It is now time to test the visual potential of your story. If the story seems hard to draw into individual scenes it may not be visual enough and need some reworking. You are on the right track if you can immediately think up lots of «Wow» camera shots for the thumbnails.
13. Core comes back on-line after MM goes to back up system. Core starts to broadcast new emotion frequency of sacred geometry patterns onto party screen behind Vax at the event. Vax is explaining how this new software will be like a drug to induce emotional states.
At this point, it is very useful to know how to draw. This first pass at thumbnails is just to get a feel for the story and possible obvious camera
14. Cut to audience who is staring at screen and change from mildly interesting to radiantly happy as we cut back and forth from core to crowd and screen. 15. MM is working hard to figure out what is 20
RU.MAYA 99
MAYA Character Animation
If your story depends on heavily on dialogue or other devices it may not be best suite for animation or as a visual story. 3. Is it a clever and original idea?
shots. Thumbnails are small rough storyboard panels used to visually block out scenes or illustrate ideas in progress. You may want to use some Post-It notes (2" x 3") for this exercise or just roughly block out where you see the characters and sets in small boxes.
Do you feel excited about the idea? Does it sound like you have heard it somewhere before? Coming up with a great idea that is both clever and really original is the hardest thing to do for a 3D animated project. This is where the conceptual genius part enters into the formula. This is the aspect of your 3D animation that will win awards at festivals and get you a dream jobs and projects if everything else is working too. The goal here is to have everyone hear your concept or see your animation and think «Wow! What a great idea! I wish I would have thought of that!»
Some rough initial thumbnails for the Media Man In The Net story.
4. Do you have a solid three act structure with pacing your plot points in the right place? Your biggest challenge will be making your climax strong enough.
STORY CONCEPT CHECK LIST
5. Do the main characters leap off the page visually? How strong is their appeal and originality? How can you increase character identification?
Now you are ready to test your story idea against a set of questions that will help you evaluate whether or not if you should proceed with this idea. If your rough story and thumbnails do not meet all these requirements change them until they do or develop another idea that will work better.
We will look at all these questions in depth in Chapter Two. 6. Does the story evoke a good range of strong emotions in both the characters and audience?
1. Does the story work?
Try to visualize how your audience will respond to each scene in your animation. Are they laughing, worried, frightened or bored?
Was it easy to do the thumbnails? Do you sense plot problems or areas that may confuse people? Some stories feel more problematic than others at the initial stage and you need to get sense whether or not your story is going to be «problem child».
7. Are all the characters’ motivation clear? Do we visually know what they want from scene to scene?
2. Is it a good visual story? Could you watch it with sound off and still understand the basic story line?
8. Is there good reason to do your story in 3d?
21
1
MAYA Character Animation
RU.MAYA 99
their feedback is appreciated so you can train them to give you useful feedback and utilize them as a valuable resource. Be very nice to these people and honor their time. Give them good feedback on their projects too if possible to keep the relationship balanced. Be careful of just asking animators for feedback. Ask your parents, friends or anyone who will listen. Post your completed storyboards on a secret page of your web site and direct people you know to go over them and email back their questions and suggestions when they have the time.
1
Make a short list of general questions for feedback people to answer: Did you understand the story? If not where did you get confused? How did you feel about the main characters? What was your favorite parts? What parts seemed uninteresting or boring? Any ideas on making the story better? Did you feel any emotions when going through the story, if so which ones and where?
Are you showing the audiences something that they have never seen before? Would the story work better shot with traditional actors and sets or as 2D animation? Be honest here or you could waste a great deal of time on something people may not appreciate.
MEDIA MAN IN THE NET STORY CONCEPT CHECK LIST
This is an interesting character but may work better in 2D since it looks similar to Japanamation style characters. Sometimes you make these look interesting in 3D but you need to be careful when introducing established 2D styles into 3D. There are visual expectations associated with some styles which may be difficult to overcome in the 3D realm. You may also get into trouble with regards to originality.
Let us run our example story through this checklist to how well it is working at this stage. 1. Does the story work? The story seems to be working but there are still some cliche elements to work out and whether or not the sacred geometry images can visually convince the audience that they are transmitting an emotional state of some kind will be a challenge.
9. Get feedback from several people or groups of people and incorporate the changes into your story lines.
2. Is it a good visual story? Could you watch with sound off and still understand the basic story line?
It generally takes about 20 minutes to pitch and receive feedback for every four minutes of final storyboards. Offer to take people out for coffee or lunch to really listen to your idea. Cultivate a good group of people who know
The main motivations on the part of the characters are pretty clear. More visual motivation for Vax maybe a series of screen graphics behind him a pre-party test phase that tells about the emotional enhancer launch 22
RU.MAYA 99
MAYA Character Animation
product with a countdown to add timing tension in back ground. Subtitles for Metaverse intro so people immediately know where the story takes place «Metaverse 3D Internet Node 2020».
wants a good software product launch. Virus wants to kill Cyberdome systems. 8. Is there a good reason to do your story in 3d?
3. Is it a clever and original idea?
It’s a 3D internet world so yes this makes sense since all of the technology is headed this way and people would probably like to see what the internet may look like in 20 years. Adding the live footage of the techno party people helps break up the visual styles and adds a sense of realism too.
This is the weakest point in this story. Sounds derivative of Reboot, Tron, Lawn Mower Man and other take offs. Hopefully the sacred geometry and 3D internet mixed with live action will save the idea. Needs more feed back from neutral third parties.
9. Get feedback and incorporate changes into your story lines.
4. Do you have solid three act structure with the pacing your plot points in the right place?
Feedback from the «guys» was to make it less cheesy and more edgy.
Three act structure seems to be working fine since we did plot points ahead of time and stuck to pacing between events. Climax is very tension filled with lots of high stake emotions from different places riding on the outcome. Live feed, product launch, security down, virus attack, love interest threatened, death to main characters threatened and audience fed into emotions of violent struggle gone bad builds tension visually with sacred geometry visuals on screen too.
COMMON 3D ANIMATED PLOT PITFALLS TO AVOID 1) Avoid A Linear Progression Of Events Your story will sound flat and boring if events just happen too casually or easily for the characters. You need some unexpected twists and turns in your story that keeps the audience guessing as to what will happen next. Do not make things too obvious or convenient for your characters or the story will seem contrived and fake. This is the most common problem in 3D animations conceived by people unfamiliar with telling visual stories.
5. Do the main characters leap off the page visually, how strong appeal and originality? See Chapter 2 where the main characters get a good work over.
6. Does the story evoke a good range of strong emotions in both characters and audiences?
2) Animals/Inanimate Objects In Human World/Situations If you are doing a biker rat story do not put your rats in a human biker bar. Put them in a sewer rat hole with settings that feel authentic to what rats would use to decorate a biker bar like bottle cap stools and used tin can tables. Have them talk about what rats are concerned about like some new sticky foot trap or poison pellets that look like cheese.
Audience should key into every aspect of emotion since the main story line is based on a product that generates emotions visually. Nice range of emotions too. 7. Are all the characters’ motivation clear? Yes, MM wants to win Core’s heart. Vax 23
1
MAYA Character Animation
1
RU.MAYA 99
animation perfect in every way if the 3D conceptual base is absent. Why make it hard on yourself? Start with a good 3D idea and your feedback will be more encouraging through out the process and subsequent screenings.
Study movies like Antz and Bugs Life. These were excellent examples of showing how the animals use things people felt were familiar to those animals as props and sets. They use leaves to build a fake bird monster and harvested seeds to eat or built ant colonies for work.
This character feels more 2D than 3D but still might work depending on the story and sets.
Remain true to the essence and desires of the types of characters you design or it will ring false and contrived. Same thing for any inanimate object that you bring to life through the wonders of 3D animation. If you are doing a dancing blender make sure the audience believes that that character is really a blender and has blender wants and needs not those of a typical housewife or baseball coach.
2D animation can do anything. All 3D stories could just well be done in 2D except when photo realism is essential. You will get a feel the more you write animated stories for which ones just would feel better in 2D rather then 3D. 3D tends to be more serious and less touchy feely. Try to get a sense of 2D vs. 3D as you watch TV, go to films and animation festivals. Ask yourself how the piece would feel in 2D rather than 3D or visa versa. Why did the director choose that particular medium? Its a blurry line so try to get a sense of it.
3) Avoid Stories that would work better in 2D or with live actors and real sets. You can argue stylistic choice for a long time. 3D is expensive and time consuming. People expect you to show them something they could not see otherwise or they may feel somehow cheated. Animations that use 3D in clever ways get much more respect and attention then those that are not as well thought out. You will just have to work much harder to make the
4) Be careful with using dream sequences or flashbacks. Dream sequences and flashbacks are usually used to get in and out of problem plot areas or to justify 3D animation in some fantastic way. Audiences are getting pretty weary of the character falls asleep at the table and all this crazy stuff happens then he wakes up and it was all a dream story. If you use these types of story telling devices in really fresh and original ways you may be able to get away with it but it is always a gamble and one I would not recommend unless you are a very good visual story teller. 5) The Four Minute Movie Trailer/TV Show Pitch Problem Its great to have an idea you would like to one day develop into feature film or TV series. Unfortunately trying to shove that whole idea into a few minutes will most likely come off as a movie trailer type of animation where the 24
RU.MAYA 99
MAYA Character Animation
events are happening too fast to digest emotionally and huge gaps in the story seem to be appear every few seconds.
stiff sentences that some actors and characters speak. Use a tape recorder and try to mimic the characters in your story with a friend talking out the ideas that need to be communicated and sample dialogue tracks. Listening to it later you will most likely be able to tell which lines or phrases work and which ones are not spoken naturally. It is a good idea to tape record your entire story much like a book on tape once you have the general idea to hear how it sounds and to hear if it is working. You will also be able to get a sense of the timing from doing a tape version of your story which we will discuss more in Chapter 3.
Try to take a small interesting piece of the script and make it strong enough to stand alone as a festival piece. This approach will give you more of an opportunity to fully develop the characters in more subtle ways and make the story deeper with a good look and feel potential that will reflect more of what you had in mind for the original piece as a whole. Festivals are littered with animation type trailers that show lots of hard work on the screen but leave audiences feeling dazed and confused as to what the story is about which means no emotion and no points for professional storytelling discretion. Better to tell a short slow simple story full of emotions then a fast choppy confusing action packed trailer whirlwind no one will understand or remember much about later.
If you have followed all the steps in this chapter and incorporated all the feedback you should have a good sense of an idea for your Maya 3D animation. You are now ready to concentrate on the character design and development aspects of your rough story idea. Remember that coming up with a good 3D idea to animate takes practice and lots of creative thinking. It is challenging to create really good short form 3D animations and you need to patient with yourself as you learn how to tell visual stories. The more 3D conceptual design skills you begin master the more fun you will have creating amazing 3D animations using a powerful tool such as Maya.
6) Fear of Dialogue The phrase «lip sink» can send some 3D animators into a panic attack. This book will cover several techniques for making your 3D characters talk easily and quickly. Use dialogue in your stories when appropriate. People glean a great deal of information about characters from their voices and how they talk. Back in the old days (a few years ago) it was much harder to do character animation of any kind and you did not see many talking 3D characters. With programs like Maya you can now realistically do dialogue and enrich your story lines in the process. Audiences in general respond better and identify more with characters that talk. You do want to have your characters talk all the time since you are doing an animation , but a little dialogue goes a long way in making your story stronger. Some animators admit to having a limited ear when it comes to writing good dialogue. This is an honest concern. Try to pay attention to how people talk in conversations to get an idea of the differences between written dialogue and 25
1
Chapter 2 Character Design
MAYA Character Animation
2
RU.MAYA 99
A good main character is essential to any successful 3D animated story. Maya excels at animating simple 3D characters or complex organic looking creatures. As the computers get faster the complexity of 3D characters and the audience’s viewing expectations rise. Maya gives you the power to build and animate almost any character you could imagine. The big challenge now is coming up with original characters who are alive with personality and have amazing 3D visual appeal. This chapter will take you through a step by step character design process. You will learn how to create a main character for the story you developed in chapter one or for any other projects you may encounter. Conceptual 3D character designers work in many different ways to come up with their ideas. The process presented in this chapter is designed to help you think of your 3D character as an actor you create who is perfect for the lead role in your animation. The more you know your character the better you can animate it for the most believability and emotional impact. You can then use these same steps to create a whole cast of characters that visually relate to both each other and their environments.
better for a more interesting animation. This character looks fun to animate. He has an interesting trunk and an alien zoo
Character Types There are lots of different types of characters that are well suited for 3D. Listed below is list to get you started. Add to this list as you see more and more 3D characters to give you a broad selection of brainstorming types to think of fresh approaches. Try designing the same characters in different types such as a biped, quadruped and wing creature. You may have first thought that the character would be a biped but see something coming out in the winged creature with possibly four legs that may work
2
RU.MAYA 99
MAYA Character Animation
2
creature type of feel.
really well you should try to get the basic concept or energy of the character down on paper. These types of fast sketches are commonly referred to as thumbnail drawings.
Start With A Rough Sketch You should have a good idea of your story by now which will help you create some rough sketches for your character designs. This is where being able to draw fast and accurately comes in handy. Even if you cannot draw 3
MAYA Character Animation
RU.MAYA 99
2
part types. Use pictures of real animals, insects, fish. plants or people for a variety of ideas. Decide who is the main character in your story. Draw at least ten different gesture type versions of your character with a pencil. Spend about a minute or two on each sketch. Experiment with proportions of body parts, head shapes, clothing and postures. This will help get your imagination away from being stuck on one idea at this point. Try not to fall in love with any of your ideas during the conceptual development stages of any project because it will limit your ability to try new things that may work better than the initial concept. Shown below are some drawings of «Media Man» the main character for our example story. The initial idea was that the character have a TV. set as a head and be a super hero techno DJ 3D avatar type character. Draw multiple versions of each body part to examine all the possibilities. Keep a library in a sketch book of different body
Notice the variety of versions and what changes between each one. The shape of the 4
RU.MAYA 99
MAYA Character Animation
TV. set was of particular concern. Nathan who created the character over six years ago, wanted it to have a 16:9 aspect ratio for film or HDTV projections. I felt a horizontal rectangular head would make the character seem less intelligent and harder to get audience identification with because it was so anti-human. There was also some concern that the character needed to be updated from the old designs to add more visual appeal. This is an example of where the story line was generated from an existing character design who did not have a solid script yet. Some animators come up with a strong 3D character they want to animate first and then develop a story to showcase that character. We experimented with more oval shapes for the head and tried not to get stuck with any one idea at this point. Quantity not quality is the
design must read clearly as a solid black shape to ensure that the audience can pick the character out of backgrounds and easily read whatever motion the character is attempting. Strong silhouettes makes for good character design.
This character has a strong silhouette from some directions but gets a little confusing from the sides due to the low chin.
The Importance Of Using Strong Visual Themes You do not want to create 3D characters who look disconnected from their environments or other characters in the story. Often you are creating your own visual reality in a 3D animation and it will look more professional if you pick a visual theme or familiar touchstone to design all of the elements around for each particular set of characters or locations. This will also help the audience relate to your
idea at this stage. These sketches show the progression between versions incorporating changes in design direction.
You should do at least one big drawing book size page of these initial sketches first to get a feel for all of the possibilities your character design may veer towards. Pay particular attention to strong silhouettes at this stage. The 5
2
MAYA Character Animation
RU.MAYA 99
level.. Think of how you feel you know a person better after seeing where they live, what kind of pictures are on their walls and their
2
characters. Maia Sanders came up with the idea of using the alphabet to design character head shapes. Try numbers, symbols, foreign alphabets or an other shapes to help you design beyond the basic ideas.
A visual theme is a design thread that has some familiar attributes running through everything you create in your animation. If you were to pick the visual theme of a giant beehive for a futuristic NYC design then you would incorporate aspects of traditional bee hives with your buildings, city layout, characters, clothing and spaceships. If you were to choose a new age hippie utopian visual theme for a futuristic NYC design it would look quite different than the beehive one. In general you would design half with the common NYC elements we all know (dense buildings, taxis, subways, endless layers of life) then dress it up with the particular theme to say something about how that city has changed or maybe its just like NYC but in another place or time. Visual themes when used consciously tell the audience what is important to the characters in this world you create, and how they look at life on a deeper
furniture choices. This character uses the visual them of a pirate to give it a well traveled look. Star Trek is a good example of characters and sets with strong specific visual themes. The main Star Trek crew are much like the stereotypic good Americans who are out to explore the universe and follow their «prime directive». The Romeleons seem to be based on French people who have stylish blue outfits and classy haircuts with a rather cool demeanor. The Klingons come off with a heavy metal 6
RU.MAYA 99
MAYA Character Animation
biker gang appeal with hot tempers, brown colors, lots of barbaric weapons and big hair. Vulcans may remind you of Czechoslovakian intellectuals who are reserved and wise from a long rich history of civilization. The animators we know spend long hours debating these types of theme issues. If the creators of Star Trek went off and designed a bunch really cool looking characters with no themes, the audience would not be able to get a handle on each character and think the show was silly.
about when they say things like «an organic Vorlon type ship» or just to know what has been done before so you do not duplicate common ideas. You can also «borrow» ideas for shots that work really well. You may even start to recognize particular Maya based dynamics or features!
You may not agree with my generalizations of Star Trek species. That is OK. Please feel free to come up with classifications of your own. The point is their ships, uniforms and character designs all match in general look and feel. You know when you are on a Starfleet ship, even if you have never seen that particular ship before, by the design and colors as opposed to a Klingon battle cruiser. Visual themes are particularly important for creating believable alien races that the audience can
A visual theme consists of any group of people or things that have specific styles associated with them in regards to body shape, architecture, clothing, skin type, jewelry, music, transportation, weapons, demeanor/attitude, colors, time periods or cultural history. You can tell whether or not a visual theme is a strong one in your own mind by seeing how many of these categories you can come up with specify ideas for each one.
Developing Strong Visual Themes
identity with on some common reality ground. Another pirate theme creature that easily relates to other one since the visual theme is executed so strongly. Keep lists and visual notes of how other conceptual designers have classified their characters or sets in any science fiction material you encounter. This will help you grow accustomed to designing your own visual themes. Babylon 5 is another TV show with good design themes to study. If you are a 3D animator you should be immersing yourself in any and all science fiction and special FX TV shows or movies. This will help you understand what other animators are talking 7
2
MAYA Character Animation
RU.MAYA 99
Places To Look For Visual Themes One of the best resources for thinking up visual themes are old National Geographic Magazines. The pictures and stories they generally do in each issue are literal gold mines for conceptual designers. You can now purchase the last 100 years of National Geographic on CD or DVD for around $140 which includes a search engine to help you find particular themes..
2
You can type in «Mayan» and all of the issues with stories on the Mayan people come up which you can then make a collages of with all of the best pictures in Photoshop and print out color versions to have beside you while you design your characters. A good color printer is essential even if it only costs a couple hundred dollars. Due to copyright restrictions I cannot show you the hundreds of collages we have done for our personal favorites in the visual theme arena.
Notice the progression of the visual them «scary virus» throughout these drawings. This is the badguy for the Media Man story. The tentacles were voted down for being too time consuming to animate.
Even better you can go to old thrift stores and buy big bags of old National Geographic magazines for about twenty five cents each. You can then choose which themes appeal to you. It is nice to have the actual paper versions to go through but can also be rather time consuming. Create a clip media library for yourself with the sections mentioned above to help you think of unusual visual themes.
Examine the visual theme list below to get a feel for what constitutes strong visual themes. Try to make a list of around sixty visual themes you like to work on some level complete with a few descriptive words to help you define the theme. You may want to keep a separate drawing book just for visual themes to refer to when designing characters. You can tell a lot about people by the types of themes they enjoy using. Pick ones you are familiar with if possible to be able to really understand it on a deeper level of details and for animation ideas.
Subscribe to magazines with good pictures, put them in a big pile at the end of the year and clip out the best images that inspire good designs. European fashion magazines are a great resource for costume designs. Architectural Digest has some wonderful palettes for sets and furniture designs. What magazines do you like that have visual themes just waiting for you to explore? Start your own visual theme library today and organize them into binders according to civilizations or groups that make sense to you. Its a great way to spend time while rendering. 8
RU.MAYA 99
MAYA Character Animation
2
9
MAYA Character Animation
RU.MAYA 99
Visual Theme Elements After you have made preliminary list of sixty or so themes that interest you aesthetically with a few key descriptive words you are now ready to develop a one that appeals to you. Make several collages for the different visual areas (people, architecture, art...). Now look at these pictures and ask what are key visual elements? Lets use the Mayan example and make another list of each section regarding patterns you can see that constitute strong visual elements. Try to come up with at least 20 for each section. Include a separate column for colors and create a 5 color palette.
2
This a wonderful character that uses the theme of Yemen woman. A visual theme collage was first made from a National Geographic article and then the character went through several version to arrive at this soulful interpretation of an ancient alien Yemen. Group the themes into to categories such as clothing, bodies/faces, architecture, art, jewelry, transportation, religion, landscape and other categories that seem relevant. Group your collages into these sections. Place all the faces on one page so you can refer to it while designing your characters face without having to go through page after page of collages with only one two faces on a page. You can also notice patterns and themes easier when grouping the visual areas.
This character was designed with a Mayan visual theme.
Perhaps all the people have a strange crook on their noses or strangely shaped ears you exaggerate in some way on your 3D character. Maybe you notice on the clothing pages that they wear a very specific shade of cobalt blue made from the dye of some local plant or something. All of these details that you spot as a cultural detective will weave a history for your 3D character even if its an alien from another plant that walks on four feet and has a nose like an elephant.
Developing Moods For Visual Themes Every visual them has a particular mood associated with it that you can discover by examining your collages and visual elements lists. The mood is important to help you make sure your character or group of characters are going to fit this particular themes essence. You can also use the opposite of the essence if you do this consciously. 10
RU.MAYA 99
MAYA Character Animation
scars, guns Visual Mood: tough, hard, criminal, rebel, free, dangerous, on the move, fun loving, Colors: Black, red, brown, chrome, midnight blue
For example, lets say you were going to use a Hell Angles Acid Rock Biker visual theme for a gang of chickens you are animating. You already have the juxtaposition of chickens being perceived as lacking courage so this could be interesting if you are going to make your chickens a very tough biker poultry gang. Or you could go the other way and make your chickens really rough and tough perhaps a gang of renegade ex cock fighters. You could also approach the mood or essence of your chicken gang as being spineless wimpy chickens dressed up as bikers getting all flustered every time anything even slightly scary happened. The point is each of these examples have very specific moods attached to them which you need to establish to decide which design path and attitude you want your chicken gang to be. You may also want to have two chicken biker gangs with similar themes but completely different moods to show contrast and build conflict.Play with these ideas and see how many versions you can come up with for each character design.
2
Macho Chicken
Visual Theme: Hell Angles Acid Rock Biker Visual Elements: Harleys, tattoos, leather vest, beards, bandannas, dirty faces, sunglasses, flat biker butts, knives, rock t-shirts, beer cans,
Notice the different moods of these two chickens. Even though they have the same biker chicken visual theme one is very macho while the other one is rather silly
11
MAYA Character Animation
RU.MAYA 99
You should also being thinking what types of existing visual elements can a I exaggerate using 3D? Maybe your Biker chicken has an animated tattoo that talks to him on his arm or something else that would up the cool animation angle.
looking and softer.
2
Creating Rough Sketches With Visual Themes
Creating Character Identification
Once you have a clear idea of your characters basic shape and siloette you can combine it with your new visual theme ideas into something original. You may change your character dramatically at this stage but try to use as many of the rough sketches you did earlier as guidelines if possible.
What do you think people mean when they say «I do not identify with your characters?» Now this is important question so think about for a moment. Character identification is how well the audience relates emotionally to the characters in any story. I the audience does not relate or care about your characters they will not become involved in your story and not enjoy it very much.
Do another full page of rough thumbnail sketches incorporating your new visual theme elements and mood. The elements will come out in the clothing, jewelry, facial features and body builds. It is better to layer on as many of your elements from your list as possible and scale back later then it is to keep it too bland or simple at this point. The mood you have developed will come into play with the posture of the character, facial expressions and pose. Remember to keep the idea of strong siloette in mind while you design at this stage.
Character identification is the one of the hardest thing to achieve when creating a 3D character. 2D animated characters get away with a lot more since people are use to seeing them for last 80 or so years and they are so stylized sometimes that the audience does not care if they look real or not. 3D characters generally have higher expectations. Studios such as Industrial Light and Magic have trained audiences to expect very high levels of design and animation from the 3D world. I think this will change in the coming years as audiences learn to enjoy and forgive the more stylized versions of 3D characters coming out more and more each day. Most stylized 3D characters fall flat against the traditional 2D characters unless the design and animation are absolutely superb. There are nine different points to keep in mind when trying to get the audience to identify with your characters. Try to incorporate as many of these as possible in your designs, story and visual shots as possible. 1: Likability - Make your characters likable. This does not mean that they would win the high school popularity contest by any means. Likability refers to the idea that your characters should have some personality attribute that 12
RU.MAYA 99
MAYA Character Animation
makes the audience see someone or a part of them selves in the character that is redeeming in some way. Never make a character black or white or all good or all evil, Make gray characters with a mixture of good and bad traits that reflect most people you know. Even really good characters need to have some flaws and even the most diabolical madman should have a some reason alluded to as to what event in his life mad him so mean. Add a love of something sensitive like cats or a funny sense of humor to really evil character to give the audience a chance to care about them on some level.
come off as contrived and flat to audiences since they have nothing familiar to latch onto and understand the characters orintation from visually or emotionally.
2
This character uses the idea of Robert DeNiro as a ballerina with shotgun barrels for legs. All familiar ideas put together in a fresh way to create an original 3D character.
3. Visual Appeal - Make the character interesting to look at. This does not mean they have to be cute or pretty just designed well. Sometimes the simplest character makes the best one but 3D characters tend to have more detail than 2D animated characters and you need to add details that make them interesting and develop the character’s personality and cultural orientation in the process. A strong silhouette on once again is very important to help make characters visually appealing.
This character is extremely likable. The visual theme is forest Bachae rave and the design is based around the actress Gwenyth Paltrow. Looks fun to animate. Try to draw your characters so you can see them move with energy and tension in the pose like this one.
2. Familiar Visual Themes/settings - Design your 3D character with a strong visual theme to give them some history and personality. The audience will also subconsciously relate to the character better if their is something they are already familiar with in the design. Most abstract 3D characters without visual themes
13
MAYA Character Animation
RU.MAYA 99
flaws are more personality, mental or emotional weaknesses to bring out in the story. Audiences like to see flaws that they themselves have or notice in the people around them for main characters. Make a list of your flaws and the then of a few people in your life that you know really well. notice how flaws go together with certain personality types. Create lists of flaws from interesting characters you see in TV shows, animations or films.
2
5. Superhero Qualities - 3D characters have an added advantage for conceptual designers since they can do anything. Try to really understand the essence of your character and the apply some superhero qualities. These may be as simple as detachable wings that can make the character fly like a UFO or weapons that spring out of body parts in a jam. Remember to always balance any superhero qualities with equally as strong flaws. Superman would be very boring if it were not for the kryptonite. Audiences like to see characters that can do things they wish they could in their everyday lives. What types of original superhero qualities do wish you had and could bestow upon a 3D character? Try to fit superhero traits with visual themes as much as possible. An animated Mayan stone statue may have the ability to lift huge blocks of rock or talk to star constellations.
An elderly alien female that has strong visual appeal even though she is not beautiful or cute but is interesting to look at and could hold a screen. Lots of personality coming across in this design 4. Flaws - All characters you design must have flaws of some kind. Do you know any perfect people? Then do not design perfect characters - they are annoying and unrealistic. Add as many flaws as possible. Character
14
RU.MAYA 99
MAYA Character Animation
through the story. You should have only one main character and make it very clear which character that is in the very beginning. Just remember how you feel when watching a movie and getting all attached to what you thin is the main character and then seeing him get shot 10 minutes into the story and finding out another character is actually the main character. You feel may feel cheated, tricked and ripped off. You may have a hard time getting into that next character and harbor resentment emotionally for the whole story after that point which will make it hard to identify with any of the characters.
«This character has all sorts of superhero possibilites. He looks very strong and fierce.
8. Jeopardy - The main story line of most movies is that you meet a character you like with some flaws in a sympathetic situation and get attached emotionally and then a whole stream difficult things start to happen to that character. An escalating array of obstacles start to pile up placing the main character in extreme emotional or physical jeopardy. Audiences love to worry about characters. The more the better. Try to get them attached to the character before placing them in too jeopardy or they make not even care. The Titanic is classic example. Cameron had us care about and identify with the main characters before placing them in great jeopardy buy sinking the ship. If he would have started sinking the ship right away it would have been hard to get all the subtle personality quirks and sympathic situations into the chaos of survival.
The last five in the character identification points are ideas that you need to work into the story line. Try to see some design elements coming through for each point if possible even though these last 5 are not as visual as the first ones.
6. Sympathy - Place the character in difficult situations that are beyond there control or create sympathy for them from the audience. You don’t want them to have too much of a victim complex but to be in situations that the audience can identify with as being hard to deal with emotionally. Pay attention to how good films elicit sympathy from the audience by a variety of plot devices and character design to some extent. A common visual sympathy device is to have the character limp, an arm in a cast, one eye missing, scars, sad eyes or by something unexpected happening like an accident that creates challenges for the character to overcome.
9. Possession of Power - Give your characters the ability to save themselves or get out of really difficult situations in clever ways. People like to see stories about characters who change their lives by making decisions and having power to effect their situations. Don’t just have linear event happen to the character. Play with cause and effect ideas to weave a more involving story.
7. Introduce Your Main Character ASAP This is especially important if you are doing a short animation. Audiences think of a main character as a guide to lead them emotional 15
2
MAYA Character Animation
RU.MAYA 99
The more you know about your character the easier it will be to design, animate and have them say the right things if they talk. Think of how flat movie characters are that wake up with complete amnesia. Many 3D characters have this same problem since animators do not always take the time to think deeply about who their characters really are from a life experience and genetic level.Cast your 3D characters like they are the perfect thespian for the role. Give them backgrounds that will make the audience fall in love them because they are so full personality and depth. You need to write character driven stories as much as possible meaning that your concept does not rely on funny situations or superficial gags. A good character starts with a deep reflection on who they are by writing a history. Many screenwriters do this trick for the actors in their films before writing any of the script. Try to base your characters on people you know or pieces of people you know.
2
This a power looking 3D character that can fly and walk around in cool boots. Audiences like to see characters do things they cannot like fly.
Try writing your own version of a character history question list. Sometimes you need to tailor these lists to reflect the types of 3D characters you are focusing on. If you are doing a cast of sea creatures you may add questions such as Do they breath air or through gills? How fast can they swim? Can creatures live inside their bellies if swallowed whole?
10. Eyes Of The Audience - This means that the audience finds out and experiences things at the same time the character does. You may not always want to do this but try to fit it in as much as possible. It builds more tension to cut back and forth between two situations coming together without the other one’s knowledge sometimes. But there is also a great deal of emotional charge to walk through a dark hallway like in the movie «Aliens» and discover where the monster is along with characters as they get eaten by surprise. You will start to get a feel for this the more you create visual stories. Keep a list of how film makers use this plot device effectively and try to copy it in your 3D animations in some way.
The Barbara Walters 3D Character Interview Test Pretend your character has become so successful that Barbara Walters has requested a 20 minute interview with the 3D character as if it were a real creature. Use questions that will help you define the essence of your character. Listen to the types of questions journalists like Barbara Walters ask people they interview to try and get the highest emotional response. You may want to write a brief script of Barbara Walters interviewing your character to see what would make the best questions and answers for a TV interview.
Character History All 3D characters need to have a history behind them to come off as real and believable. 16
RU.MAYA 99
MAYA Character Animation
2
17
MAYA Character Animation
2
RU.MAYA 99
This is Sloxan. She would have no problem holding her own during a Barbara Walters interview. Full of personality and energy.
How would you animate your character during this interview to show what it is about visually? Pretend your character is famous in some way that is connected with your animation idea and see what happens. You may come up with unusual questions and interview behaviors that you had not thought of when writing a straight character history answering questions on paper. All great 3D characters should be able to hold their own in Barbara Walters interview for 20 minutes on prime time. If you feel your character is not that interesting enough then change it until it is. Study good TV interviews to see what makes a character or person fascinating enough to watch for this long in an interview format. Pay particular attention to the setting that the interview takes place in since it should be one familiar to character’s everyday life.
Adding An Actor To Your 3D Character All 3D characters should have a movie star type persona attached to them in some way to help understand their essence more clearly. Even if you are suffering from fear of lip synch and have opted not to have your character speak you still need to attach an actors voice to play your character. Pick well known voices from famous films. Try to stay away from the more obscure TV and foreign film actors unless it is just for your own information. When you go into a Hollywood studio and pitch and idea for an animation they will ask you «Who would play the voice of this character?» before you pitch your story. It doesn’t mean that Robin Williams is going to be available to play your biker chicken character. It means a biker chicken played by a Robin Williams type actor is completely different than a biker chicken played by a voice like Arnold Schwartzanger, Mel Gibson or Nicholas Cage. It merely helps orient people and yourself to how this character sounds and what type of essence and personality he has beyond the basic storyboard drawing. Jermony Irons could be the voice for this creature. How would your perception of this character change if the voice was played by Robin Williams? You would probably have to do some redesign to make a voice 18
RU.MAYA 99
MAYA Character Animation
cannot take your eyes off of her. This is hard to define to some people who have not thought about it much.
like Robin’s work.
Design Around An Actor
Start to study actors in films and see what makes some more interesting to watch then others. A great deal of screen presence has to do with the energy of the actor. How do you translate this magical energy to your 3D character? Great animation and design are a good start but you also need to be studying the little nuances that an actor like Jack Nickolson does on screen with his eyes, eyebrows, mouth and swaggering walk that makes him so electric. Pick one actor a month and rent their top four films. Write down as you watch each film what little ticks they give to their characters to make them so appealing and original.
You may also want to design your characters facial features or body types to somehow resemble the actor you have chosen for the voice essence. This will make them easier for the audience to identify with and seem to fit their personalities more. Choose actors that of course would fit the history, visual theme and mood of your animation. When you hire voice actors to play the characters they will also appreciate being told that his futuristic valley girl ape is played by a Courtney Love type voice rather then being told she sounds «cute but rebellious» which is hard to latch onto from an attitude perspective quickly.
This pirate themed character was designed around Samuel Jackson as evident in the facial features.
Anatomy Considerations For Animating This character was designed around Sigorney Weaver. It is made of flesh and bone but moves like an organic motorcyle.
One dangerous design pitfall for 3D is creating on paper characters that look great but may be anatomically difficult or impossible to animate well. Obvious problems such as short legs with really big feet are going to make that walk cycle a very challenging set of keyframes. Study anatomy books on animals and humans to see how they are built to move. Take an anatomy class for artists to get a good solid understanding of muscle and bone structure to apply to your 3D characters.
Study Actors For Animation Acting Tips Actors spend a long time developing their screen presence. One of the more challenging aspects of animating 3D characters is getting them to the point where they hold a screen as well as Elizabeth Taylor. When people say that an actor has a great screen presence they mean that when Liz walks into the picture frame you
19
2
MAYA Character Animation
RU.MAYA 99
2
20
RU.MAYA 99
MAYA Character Animation
Design using pictures of real creatures for reference. All of these bug ideas were taken from actual photographs of real bugs zoomed way up.
Acting For Animators You should be able to act out a walk cycle for your character and may want to try acting out the motion for each design. You want to try and get something original that looks good and is going to move really nice. Most animators work with a long floor length mirror near their station, a close up mirror for facial animations next to their computer and a stop watch to time out the movements of each sequence. This character was designed around Pee Wee Herman and looks great on paper but may be challenging to animate due to the knees joined at the spoke.
Take an acting class to learn how to act «big» so that you can make your characters leap off the screen. Give your 3D characters some activity to do during dialog that says something about what is important to that character and gives you a chance to show off your great animation abilities. You could have your biker chicken fixing a delicate music box, building a bomb or pulling the wings off of butterflies during a conversation which will help the audience get a better read for what this character is about visually.
A great example of questionable 3D character design for animation is in the SCI-fi movie The Arrival. The 3D alien in this film has these really funky inverted knees and the center of gravity seems completely off as it runs around. The audience laughed during the screening I saw when this character started to move in what was suppose to a very scary chase scene. After that scene the alien seemed pretty unbelievable and the whole movie started to unravel quickly. Once you show people something that looks a little off in a 3D element they will get more picky with everything else you try to make them believe.
How would act out a walk cycle for this particular character? Get up and try to simulate the motion across the room you are sitting in. Its great to have big floor to ceiling mirrors in your animation studio to test out motion ideas.
21
2
MAYA Character Animation
RU.MAYA 99
Adding Clothing And Accessories
2
much great importance in the coming years. The fashion industry is really into Maya right now. Go make friends with an up and coming clothing designer to dress your cast of 3D actors. We will see more of this synergy very soon in the 3D industry much the same way designers compete to dress the stars for the Academy Awards each year. Already clothing companies like Diesel are sponsoring 3D action games with the characters wearing their signature line of clothes. What types of deals can you swing in this area to fund your next animation project?
Clothing and accessories are treasure troves of information about what your character is like inside. Go through the movies «Antz» and «Bug’s Life» and write down the name of each main character with a rough sketch and a list of what visual elements make that character different from all the other ants or bugs. How do these different accessories make the character more interesting? Ask yourself why the designers made each decision and what they wanted you to feel about that particular element.
Draw Several More Versions Incorporating the Essence After completing your visual theme, character history, identification checklist, actor’s voice and costume design you should once again do more small quick sketches incorporating all of these ideas. Don’t rush through this step. If you go straight towards a clean sheet of paper for the final design you may come up with a stiff character full of eraser marks. Try at least 10 different versions for body types, feet, hands, head shapes, clothing, facial features, 3D elements, You don’t have to draw the whole character each time just focus on parts first the put together the pieces that work the best.
This pirate theme lady was based on Angela Landsbury. Great clothes make the woman.
Visual themes are full of ideas for accessories and clothing options. Collect costume picture books to get more ideas on different outfits for your 3D characters. Just remember you are the wardrobe department and costume designer for your 3D animation so spend some time thinking about this aspect and you will get lots of points for originality. I predict with the advent of Maya cloth and hair that we are going to start seeing some really fashionable dressed 3D characters in the near future. If you do not feel your own wardrobe is anything to get excited about you may want to ask an obsessive fashion fanatic for tips on dressing your creations. This aspect of character design will be taking on a role of
Drawing Semi Final Versions & Picking a Palette Draw 3-5 final contenders that are at least 610 inches tall on good paper. Use one big sheet 22
RU.MAYA 99
MAYA Character Animation
of paper for each character. Pick a color palette based on your visual theme of no more five colors. Make copies of the final pencil designs to test for color combinations. When you have some characters with good palettes you think look good go get some feedback. You should have 3-5 final drawings for each character. I would start just with the main character since it is the most important before doing any of the secondary characters. You may find there is a direction you want to go with the main character which will somehow effect the design of the secondary ones. Ask anyone who will look at the drawing what they think about the designs.
2
Love Interest
Main Character Sidekick
23
MAYA Character Animation
RU.MAYA 99
into the night? 3. Does this character have a good silhouette? 4. Will this character be fun, easy and interesting to animate? 5. Is the mood, visual theme and actor’s essence clear in design?
2
Good Questions To Ask Other People For feedback Try to have several versions of the characters drawn for people to choose from when giving you feedback. A rough design you came up with earlier may have more appeal than the one you settled on. 1. Which one do you like best and why? 2. What kind of emotion do feel when you look at this character? 3. What would you change about this character(s) if you could to make it more interesting? 4. Does this character look like Jack Nickolson or Robin Williams to you? (Don’t trick them have it be designed around one or the other) 5. What would you say is the personality of this character?
Enemy This is complete set of characters are all based on the visual theme of a furturistic traveling pirate acrobatic troupe. Try to design sets based around these four types; main character, love interest, sidekick for main character and enemy. You can add or subtract characters later as the story requires. Notice how well these creatures all go together and how the limited color palette works. The Enemy one in long coat was designed around a family member where lots of personality seems to just be oozing through visually. Family members make great 3D essences for strong characters since you know them so well.
The Character Design Process Mindset As you may be starting to suspect by now, this conceptual design process can be deep and time consuming but the rewards are worth all the effort. This is not a linear process and you may have to go back and change your story several times to fit new character histories, visual themes or design decisions. Once you get more of a handle of all of the things you need to be aware of you will do them automatically and it will go a lot faster.
Good Questions To Ask Yourself Before Getting Character Design Feedback 1. Do I like this character? 2. Am I excited about this character and want to spend months of my life working on it deep 24
Chapter 3 Production Design & Storyboarding
MAYA Character Animation
3
RU.MAYA 99
It is now time to design the visual road maps for your 3D animated story. You should have a solid understanding of your story structure and main characters before proceeding to this stage. You may have to go back to rewriting scenes at the story level or redesigning parts of your characters based on problems you encounter from feedback after the pitching the storyboards. Understand that this is part of the process and know this is the time to make those kinds of changes. If every story you thought of was perfect from start to finish the first time you would need not need to plan very much at all. Most visual stories require at least one third to one half of the total production time to get to final animatic stage before any 3D has been created at all on the computer.
Set Design
Here is where the evil virus lives before attacking Media Man. It has a retro futuristic Frankenstein visual theme.
Great 3D characters can be enhanced by well thought out set designs which reflect their essence and personality. Think about how when you meet someone you feel you gain a greater knowledge about who that person is after seeing where they live. The types of pictures people hang on their walls, whether or not they live in a dusty gray warehouse or a spacious Mediterranean villa overlooking a sculpture garden they created expands your perception of who they are as people and what is important to them.
Where Does Your 3D Character Sleep? Try designing a rough bedroom or living environment for each 3D character you develop even if the audience will never see this particular location. By doing this you may gain many visual clues about who the character is and possibly even how to animate it. If your 5000 year old Chinese woman lives in a cave she may always be picking spider webs out of her hair or perhaps bright light forces her to shield her eyes during environmental changes throughout the script. Remember the screen power around all the subtle little actions and nuances of a brilliant real life character actor. How can you make your 3D creatures come alive by having the set design interact as much as possible with their personality and animated movements?.
2
RU.MAYA 99
MAYA Character Animation
and books to expand your possibilities of what you can do with your 3D sets. Even if you create a matte painting it still needs to convey some visual connection to the characters and story. Use the same visual themes you developed for your characters when designing the sets they live in .
3
This is where the Core sleeps in the Media Man story. She is weird into the 3D net and has a techno retro future visual theme.
This character has a Mayan visual theme and fits nicely into the set using the same theme. SideBar: The new Star Wars film Phantom Menace has some incredible conceptual design with regards to characters, sets and visual themes. See if you can figure out the theme basis for each location and character theme. Example: Ja Ja has some Jamaican qualities while the queen when dressed up looks similar to a Mongolian princess.
Study The Masters Study existing films for set design tips. «The Usual Suspects» did some incredible character development through set design. Ask yourself questions about every background detail like why is their a stuffed white ferret posed to strike behind this actor? How does this make me feel about him or change my feelings? What would I think about this character if it were a beat up old stuffed Raggedy Anne Doll? Why are the walls brown wood paneling? Old Film Noir movies do lots with background set design and should be viewed for more ideas.
Try to avoid stereotypical bedrooms, offices or houses. This is 3D! Embrace it! For the first time in history you now have the power to create anything you can imagine on a desktop computer! Defy physics, create new planets. make an 800 foot tall solid golden temple or a miniature world inside a dirty shag carpet. Most stories have been told before in some form - only the sets and characters change.
Audiences need things to look at in the background that tell them more about what the reality is like in these often strange and unfamiliar 3D worlds. Professional set designers spend a great deal of time on each and every detail for a big film.
Study good architectural design magazines 3
MAYA Character Animation
RU.MAYA 99
designs we have all seen a thousand times.
Add Background Lopping Animation’s
3
• Amazing visual appeal that makes you just want to stare at it endlessly in complete awe.
Try to think of lopping animation’s for each background to add movement and make the place feel alive. Add old clocks ticking, clouds moving through windows, weird birds flying off in the distance, spaceships or vehicles dashing by, fans whirling, candles burning, fountains, aquariums, flashing signs, TV monitors, strange creatures walking around or pets breathing hard curled up on rug. Make a list of possible looping animation’s that would fit each environment you plan to have in your animation and use the ones that work best. Try and keep it simple with modeling and texture mapping especially if they are far away.
• Has a clever and original angle such as making a rat world biker bar out rat type found objects rather than making it look like Al’s Bar down the street. Be true to your character’s essence in some way. Study Bug’s Life, Antz and Toy Story to get a feel for what is clever. A good rule of thumb for doing animal or inanimate object animation’s is to use 50% their world and 50% human characteristics to help the audience identify with the story and characters. To do a 100% realistic ant hole would be a bit dry for an entertainment show and hard to tell which ant was which. • Develops your character and story in deeper way by adding background visual details that give us information about the world they live in and what is important to them. An alien living in a frilly lacy cocoon would be perceived completely different from one dwelling inside one made of sharp metal knives.
Make sure your 3D sets have the following: This character looks well suited to his environment.
• A good reason to be done in 3D and shows the audience something they have not seen before. A bedroom made of organic breathing furniture is more interesting to look at then one made from a clip art set of the basic wooden
• Make sure your visual themes match both characters and environments. Do not create them separately and thorough them together 4
RU.MAYA 99
MAYA Character Animation
hoping it will all work out. We have all seen 3D animation’s where the characters look completely different from each other and the worlds they live in resulting in confusion and lack of belief in the reality the animator was trying to create. Think of this like going on vacation to India. If all the surroundings look the way they do today but the people were all wearing day glo shiny silver glam rock outfits you would feel something was very off.
Production Design Collect Wow shots from existing films that may work in some way in your animation. You can grab frames off of a video tape or storyboard the shots. Keep a separate drawing book just for igneous camera work. Each time you see a film make note of at least three great shots that effected you emotionally or made you visually appreciative.
• Be careful not to overwhelm your foreground character with backgrounds that are too busy. You need to create strong silhouettes for your 3D characters. Make sure backgrounds are different colors or lit differently and do not have too much detail that your character gets lost in front of it. Lopping animation’s are great to make your set come alive just use them economically and wisely.
Collect photographs that have the look and feel for what you think may work with your animation. Pay attention to the composition and lighting and see what ideas you can borrow, Paintings are another great source for good conceptual design ideas. See if you can capture the essence of a painting inside a shot, character or set in your animation.
Research For 3D Set Ideas
Once you have researched your visual theme, created strong 3D characters and sets you a ready to pull the visual look and feel for the entire animation together. Gather all of your thumbnails, character designs, illustrations, pictures and photographs and lay them out next to each other on a big floor or table. See if any pieces do not look like they fit with the rest of the mood and theme you are developing.
Keep a clip art file of set design ideas for reference. A great place to get new ideas is the 100 year National Geographic CD-ROM set mentioned in Chapter One. You may be able to pull off a fresh 3D rock city design by looking at a microscopic picture of granite or a hillside in Bangladesh. Try picking 5 pictures you think fit the mood and feel for your animation and design five different rock cities based each picture’s form and shape. Make sure to include your visual theme as strong as possible in each of the five designs. Pick the one that works best and try to exaggerate even more the visual parts that are working such as the curves in the rock wall or the number of crevices, People like to see things they have never seen before in 3D and set design is great way to get more «Wow» shots.
If you have multiple sets of characters or environments lay them out in separate areas and see if they still hold together in some way. Begin weaving together ideas for your own camera shots. Start to see the animation taking shape in your mind. Make changes to any images or characters that do not fit or feel weak visually. Experiment with mixing together different set designs and photographs for fresh lighting or composition ideas. This is great time to try different combinations before you start locking down the storyboards.
Another fun exercise to get to know your 3D characters is to try and design their work environments, neighborhoods, backyards, familiar landscapes, grocery store, gardens, favorite restaurant or bar and vehicle. Hours and hours of fun.
5
3
MAYA Character Animation
RU.MAYA 99
Timing (3 Act Breakdown, Rules)
3
3. Act Out Those Shots - Get a stopwatch (which you should already have if you are a 3D animator) and act out each scene of your animation. Try each one about three times and average them according to the seconds you find it takes to get through each movement and dialogue piece.
You are almost ready to start storyboarding. One problem animators run into is trying to decide how many shots to give to each section of a story. Or you may be trying to decide which events occur in each scene. Even if you have a rough shot list as we did in Chapter One you may still run into some confusion about the individual scenes and how many panels to allow for each part. Timing can help you out in several ways. People can mean a great deal of things when they make comments such as «The timing in your animation feels off».
Better yet video tape yourself with a few friends acting out the entire animation much like an experimental short play without sets and see how the timing and story is working in general. This is especially important if the story is suppose to be funny. If your idea does not get many laughs being acted out by your friends on video tape as a rough cut you may want to change it until it does. No amount of good animation or design can save a bad script. Better to find out now rather than later after all those hours spent staring into a computer screen.
Good Things To Keep In Mind To Help Your Sense Of Timing 1. One Thing At A Time - When storyboarding your animation try to have only one thing at time happening or moving (not including background loops). Some 3D animators are tempted to move everything all at once and it usually comes off as a general lack of cinematic elegance. Take your finger and follow the movement within the frame of movies like Citizen Kane or any movie that you like. Notice the timing of how each movement occurs and the directional rhythm. Try to keep your 3D cameras locked down as much as possible since this seems to be another overused aspect of 3D which make animated shots feel very busy.
4. Comedic Timing - Funny stories are some are the most difficult to execute successfully particularly in 3D. A great sense of comedic timing is essential to pace gags and character animation’s effectively. Study shows like Roadrunner. It would not be very funny if the coyote chased the roadrunner off a cliff and fell to the bottom. But the shot is funny when the coyote stops to pause in mid air before falling and looks down then at the audience with changing expressions as he realizes his impending situation. Comedic timing is something that may be more of a natural ability than something that can be completely learned.
2. Time your shots according to your 3 Act Structure Formula - The average length of a shot for most films or TV shows is about 4 seconds. Generally you never see shots over 10 seconds unless they are establishing shots or doing something special. If I know my set up is suppose to take 30 seconds then I will plan on having around 6 - 8 panels or shots. Use the formula in Chapter One for three act Structure to figure out how long each part of your animation will be.
Be careful with funny animation ideas and test them thoroughly on friends and neutral third parties first. There is a gag story type of animation which requires lots of little funny things that happen throughout the story building to a more and more absurd climax. Never make an animated story that rests solely on one funny gag at the end as it will usually not be enough to hold your audience throughout the piece and has a high probability of bombing at the end. Popular shows like The Simpsons have a great pace and feel for comedic timing 6
RU.MAYA 99
MAYA Character Animation
which should be studied thoroughly before attempting these types of stories. 5. Pace That Animation - The pace of your story should generally accelerate as it nears the climax but this is not always the case. Pay attention to when your story starts to get slow in the wrong places and up the pace, change it or cut parts out. You need to think of your animation as a carefully choreograph acrobatic ballet juggling literally thousands of components that need to all fall into one groove and rise out to the end of your story. Try slowing down or speeding up your pacing to get different feels for your story. Use pace to elicit more emotion. Study suspense thrillers films to see how pace is used to up the tension and emotional release.
3
6. Character Animation - Once again use a stop watch or video camera and play with acting out each movement of your characters to get a sense for how long things take to occur. Timing is by far one of the most difficult parts of good character animation. Take a stopwatch everywhere you go and practice timing how long it takes for a big woman to walk across the street Vs a skinny one, or trucks to drive by Vs a sports car. You will start to develop a feel for seconds Vs movement if you study the world around you.
How would go about acting out this type of character for timing purposes? A good trick is to act out your scene using two video cameras going at the same time from different angels as a cheap motion capture system. Map the video frames on image planes around your 3D character to the correct scale and use the video as keyframe guides. to help you get the hang of character animation to more learn about timing for keyframing.
Cinematography There are many different types of illustrators. Some illustrators are great at drawing photo realistically but hit a brick wall when it comes to designing amazing camera shots. Any illustrators doing storyboards for 3D animation’s need to have a solid background in cinematography and editing. Cinematography is the art of filmaking particularly in regards to framing camera shots and telling a powerful visual story. 7
MAYA Character Animation
RU.MAYA 99
The best way to learn about cinematography is to do the following:
6) Life drawing will help keep your eyes in shape and aware of the subtitles of value, shading, shadows, light, composition and color.
1) Take classes in film making, editing, lighting and production design.
3
7) You may want to play with index cards and Post-It (letterbox type size) notes to experiment with different shot ideas and combinations of shots to change meaning. Add photographs and illustration into the mix and try for a rough visual timeline from a look and feel perspective to see how all the elements are pulling together. Sketch any obvious great camera shots you may see right off the bat. This initial design process will make storyboarding easier later.
2) Study great films and storyboard shot by shot sequences you find particularly appealing or the entire film to get a feel for how it was put together. 2) Make little movies with an inexpensive DV video camera and edit on your computer using programs like Adobe Premiere and After FX. This takes less time than building everything in 3D and trying to develop your skills around the constraints of a 3D computer world.
8) Refer to films in similar genres for shots and blocking ideas. Suppose you are doing an alien battle animation between two clans and it seems a little flat. You may want to go rent «Braveheart» and borrow some ideas in that film which created tension on the battlefield. Change your weapons out for future primitive, different battlefield landscape and any other designs themes that can give the battle the flavor of your particular animation. Time the camera shots in Braveheart and see where you can chop off seconds or scenes and still preserve the excitement. Try to figure out what Braveheart did to make the scene so successful and take it one step further. Rent several epic battle movies and you may even see where the film makers borrowed from each other.
Write little stories that might be re purposed for a set of 3D characters later or based on an existing animation idea. Focus on creating tension and emotion. Pay attention to making the dialogue sound natural and interesting while you and your friends act out the characters in exaggerated articulated gestures. Do not worry about props, sets or costumes. Use your imagination and experiment with the essence of the story’s emotional curve. Play with real lighting if you have time. Great way to spend time while rendering. Good research too. 3) Read books and magazines on film making and special FX to see how to handle tricky shots, gather valuable tips and gain awareness about specific 3D animation issues with regards to 2D elements and special FX.
9) Go to independent international film festivals and see 40 or so films in two weeks. After each film write down the story line, 3 act structure, storyboard best camera shots, cultural slant on story, what worked and what did not. Try to see how you could take their plot and ideas and make it into a 3D film or even a piece of it for a short 3D film. You should do this in the back of your mind as a fun 3D conceptual exercise for every film or TV show you watch.
4) Study photography and take lots of photographs. Shooting large amounts of black and white is particularly useful to develop a good eye for composition and light and darks. Try to gain a greater understanding what ingredients make an interesting visual picture or better yet a «Wow» shot.
Independent films have not been through the Hollywood machine and have problems and successes that are easy to spot. The story lines are often more experimental which is good to
5) Storyboard animated 3D films and compare camera shots and techniques to traditional cinematography. 8
RU.MAYA 99
MAYA Character Animation
study for ideas. For example the lighting in independent films is sometimes off or the director finds a way to make things work on a small budget that would also save you time in 3D. Maybe its more scary to see the monster in shadow throughout most of the film and keep the lights low. Cable stations are currently featuring more international independent films for you to study if there are not festivals near where you live.
attention to how the continuity between the shots is working. Are there any visual gaps for how you get from shot to shot or confusion when you pitch the story?
Short films are of particular interest to a 3D animator attempting to make 3D shorts so keep an eye out for these too and use the same evaluation process. Never «borrow» an idea outright always change it enough to make it yours or combine it with another idea to make it fresh and original for 3D animation.
4) Getting feedback on a 3D animated story idea is very difficult without having storyboards for people to look at as you take them through your story. Without storyboards most people’s eyes will merely glaze over after your first few descriptive sentences and have very little to say after you are finished explaining everything. With the physical boards in front of everyone they can point to particular shots and make comments or suggestions much easier. You yourself will also have a hard time trying to describe each shot without a visual guide to help keep you on track as you go through each shot.
3) Visual road map for the team. Usually you will work with other people to get a 3D animation done. Storyboards are about the only really effective way to describe an animation so everyone can understand it clearly.
Storyboarding Storyboards are the visual blueprints of your 3D animation. Once you start to build pieces of your story on the computer you will be focused on just making the scene happen and should not be worrying about whether or not the shot is going to work. Storyboards are the most useful tool for any moving visual art form. Never touch a computer until you have a final set of storyboards to keep you on track. In the real world this is not always the case but it is a goal you should shoot for if at all possible especially when something as time consuming as 3D is involved.
5) Production bibles are created from the storyboards which list each shot and what parts need to be shot, built, painted or created to make the scene work. Without a good set of storyboards you may have a hard time planning your production schedule. 6) Client milestones usually include a set of storyboards. You draw up the idea, they sign off on each panel agreeing that this is the animation. Any changes are extra. Never do an animation for anyone without signing off on a detailed set of storyboards. They are visual contracts that protect both yourself and client from misunderstandings and the need for big revisions later.
Top 10 Reasons Storyboards Are Essential To Any 3D Animation 1) Cheaper and less time consuming to make changes at the storyboard level than it is in the middle of a whirlwind 3D production.
7) The 3D world set up is easier to accomplish if you know your shots first. First you know where the camera is going to be which effects your lighting, texture mapping, blocking and range of animation. Second, if you know one of the characters is only going to be shown in the distance you can do a more of
2) To see if your story works. Never depend on whiz bang special FX or the coolness of the 3D world to save your story. If it does not work on paper it will not work after lots of hard work in 3D. Pay particular 9
3
MAYA Character Animation
RU.MAYA 99
animatics later on in this chapter.
a general texture mapping job as opposed to an extreme close up where you would probably have to make new texture maps for the model just to hold up to that level of detail. IT is very important to think smart and economically in 3D so you spend your valuable time making other more important things look better.
3
Drawing Your Own Storyboards It is now time to do some rough storyboards for your 3D animation. Include all of the production design and research you have gathered as much as possible including strong visual themes. There is no established standard iconography for the correct way to execute a set of storyboards. The most important thing is that the boards convey the idea you are thinking about animating in a clear and easy to understand way.
8) Allows you to pre visualize multiple ideas and choose the best ones. You could do several sets of storyboards for one animation and play with the parts that work best. do not always go with the first idea or shot that pops into your head. Ask yourself how else you could handle the shot. How would Hitch cock have framed it or what would Fellini have tried to make it more interesting?
Tips On Storyboarding:
9) Visual appeal is often determined at the storyboard level in regards to look and feel and color. Does the story look good as a whole? Will the colors work of do you have a group of lizard men that clash with the bumble people? Is the mood strong enough? Is each shot a Wow shot? What can you change in each shot to make it hold up as its own visual masterpiece?
1) Draw boxes that are same aspect ratio for your output size. If you are doing video it is 4:3, HDTV and film are around 16:9. Do not plan shots out in perfect squares. 2) Use arrows to indicate camera movement or motion in the frame.
3) Use arrows with shot names inside to convey specific camera movements that may not be understood by arrows alone.
Good visual appeal on this character. What do you think his world would look like? 10) Animatics are created from storyboards which are scanned into the computer and made into a sideshow with timing and audio to get a feel for the story as a whole piece. Some animatics have 3D elements. More on
4) Use a frame within a frame to indicate zoom areas.
10
RU.MAYA 99
MAYA Character Animation
around to explain anything. 10) Place major transitions between panels.
5) Use different shaped, extra long or extra wide boxes to show pans.
3 11) Vary your camera angles to get more interesting shots. Try to use as much perspective as possible to feel more 3D and give a clear indication what the camera is pointing. 12) Draw with pencil or charcoal for these first drafts to get a sense for light and darks. Use dry markers, acrylic paint, colored pencils for final versions. You may also want to color them on the computer using programs such as Photoshop and Painter.
6) Draw multiple pictures for moving objects or characters within a frame if it seems important to the story.
Lighting Lighting can make or break a 3D animation. Good lighting looks expensive and dramatic. Bad lighting looks cheap and amateurish. Light is a great storyteller in itself and can really help establish mood and emotion. Study the masters of cinematic lighting. Read «Painting With Light» by John Alton (UC Press). Practice lighting real objects at home with a variety of light sources or a even a couple desks lamps.
7) Write dialogue beneath storyboard panels to understand how the audio track will help tell the story. Keep dialogue to a minimum to avoid talking heads throughout animation’s. Try to give the character some activity to do while speaking to make it seem more full. AS talking head ostrich is not as entertaining a talking ostrich carving pictures in a tree with his beak.
Watch movies like Citizen Kane and just pay attention to where the lights are and why each scene is lit that particular way. Old black and white classic films did some amazing things with light that are worth checking out. There is a whole section on lighting in Maya at the end of the texture mapping chapter which has more good information to help you light scenes more realistically and dramatically. Keep dramatic lightening in mind while planning your camera shots and storyboards.
8) Include shot numbers beside each panel to indicate order. Go from right to left not up and down. 9) You should not need to explain under each panel what is occurring unless it is confusing which may mean you need to fix the shot. This is an optional addition that some people use and can be a good idea if you are leaving your storyboards some place where you will not be 11
MAYA Character Animation
3
RU.MAYA 99
You need to balance out your light and darks so your animation will have good composition. Render out all final animations with a greyscale pass in a video editing program to see if the contrast is working. It should look fine in black and white if you have been paying attention to your lighting and scene compositions. Using too many midtones in the background and foreground may make your silhouettes and animation hard to read visually.
4. Over the shoulder - Looking over the shoulder of a character. Used to show where things are in relation to the character.
Camera Shots Use a variety of camera shots to add a rhythm to your 3D animation. People who do not realize how many types of great camera shots there are to chose from usually use lots of monotonous medium shots. Learn the names of these shots and what they mean since animators often refer to them during production and they are refereed to in scripts. You can combine shots to make more complicated ones just make sure you always have a good reason before moving your camera.
5. Reaction shot - Shot of characters reacting emotionally to something that just occurred. Look of utter disbelief on people’s faces when spaceships land on their street.
Below is a list of 47 camera shots for to consider: 1: Aerial shot - A shot from above. Usually high up. Often used at the beginning and end of films to zoom in or out on location.
6. Zoom - Moving shot where the focal length and field of view change over time. Used to bridge shots.
2. Point-of-view (POV) - What the character is seeing. Usually this character is not in the shot its just from their point of view.
7. Tracking shot - Shot that follows a character or an object moving through a scene. Can also be used to move away or towards a stationary subject. 3. Reverse POV- Reverse of POV usually used to show character’s reaction to POV.
12
RU.MAYA 99
MAYA Character Animation
8. Follow Shot - Like a tracking shot but keeps focus on subject only as it moves.
13. Split screen - A frame with two shots occurring simultaneously often divided by a line. Two people talking on the telephone is common for a split screen. Screen can be split diagonally, horizontally, vertically or with an Alpha channel shape mask for interesting FX.
9. Into view - The camera moves and reveals a new subject.
10. Into frame - A new subject moves into the frame from off screen without changing the shot. 14. Pause or Beat - Script term to control timing. You may have a reflective shot of a babbling brook with a long pause to let the audience think about things.
11. Insert - A close up shot of an object that implies great importance like a lost key under a table.
15. Freeze frame - Single frame repeated or held to imply freezing of the action. Good for funny take offs and freeze-frame endings.
12. Montage - A series of shots used to build moods or provide information. Typical ones include passage of time shots with seasons changing around one tree fast or calendar pages flipping. Try to use different angles of similar shapes to create more dramatic montages.
14. Slow motion (slo-mo) - Camera speed increased above normal frame rate to give the impression of the action being slowed down.
13
3
MAYA Character Animation
RU.MAYA 99
15. Super (or extreme) slow motion Exaggerated slow motion that is even slower. Good for draw out dramatic moments such as death scenes.
20. Another angle - Shot from another angle different from the previous angle.
3 16. Super - Text or images superimposed over the shot. Often used for credits, subtitles or animated graphics.
21. Bank shot - Camera moving on a crane type motion in a circular orbit.
17. Stock shot - Footage you buy from stock shops of shots you need but do not want to create or are unable to shoot yourself.. Newsreel footage, aerial city scenes, establishing shots of far away locations, microscopic scientific footage or any other previously shot footage.
22. Close Up (CU) - neck up of a person or character.
23. Extreme close up (XCU) - Just the lips or eyes or any really tight close shot. These are hard to do in 3D since you will probably have to re texture map your model with lots of extra detail to hold up to this type of close up.
18. Two Shot - Two people or characters in a shot.
19. angle on - Object shot at an angle rather than straight on. You may want to specify degrees or direction of angle for 3D shots.
14
RU.MAYA 99
MAYA Character Animation
24. Group shot - A group of people or characters in one shot.
29. Reverse angle - The reverse of the previous shot angle.
3 25. Interior/Exterior - Script term used to specify whether the location is inside or outside.
30. Take - Exaggerated animated look where the character does and extreme reaction shot.
Interior Shot 26 Long Shot - A man on a horse in a city street.
31. Three Shot - Three people or characters in shot. 27. Extreme Long Shot - A man on horse in a city street with mountains behind town.
Camera Movement Type Shots 28. Medium Shot - Waist up on person or character.
32. Pan left/right - Camera rotates horizontally around its base without any dolly movement.
15
MAYA Character Animation
RU.MAYA 99
36. Pedestal up/down - Camera going up and down along the vertical axis.
3 Transitions From One Scene To Another
33 Truck left/right Horizontal movement of the entire camera with a dolly type device.
1. Cut - Abrupt change from one scene to another in the course of one frame.
2. Fade in - Scene appears slowly from a black or colored screen. Most movies begin with a fade in and end with a fade out in the script.
34. Dolly in/out Horizontal movement along the lens axis of the entire camera with a dolly type device. Also refereed to as Camera up/back, Dolly up/back.
3. Crossfade - Slow fade from one scene to another that takes place over a range of frames but always involves at least one black frame between the fades. 35. Tilt up/down - Vertical rotation of the camera about the lens axis parallel to the scene.
4. Dissolve - Slow fade from one scene to the next without any black frames in between.
16
RU.MAYA 99
MAYA Character Animation
5. Wipe - One scenes pushes another scene of the screen either horizontally, vertically, spiral or in any other manner.
lets you hand build any transition that you can imagine. Even simple circles with feathered edges may work better than a horizontal wipe depending on the composition of the shot before and after. Try to match the basic shapes for transitions like these but be careful not to overuse them since they may draw too much attention to the idea itself.
Creating An Interesting Visual Rhythm
6. Intercut - Two scenes occur simultaneously to form one sequence cut together which shows lines of actions where parallels or contrasts are apparent. A good example of this is in The Godfather at the end where the family is in a church at the christening of new baby while the rest of the family is gunning down a rival Mafia clan at a toll booth. This shows contrast in how extreme family life can be for this group.
Go through your rough storyboards and try to use at least one of each of the shots, camera moves and transitions listed above to see if the camera work becomes more visually interesting. There is a fine line between great cinematography and going overboard with too many interesting elements that become distracting to the audience. Get a feel for this balance by studying your favorite cinematic films. The point is to mix up your shots so they do not feel stale and boring. Try to make four different camera shots for each shot and see how the meaning changes simply by using different shots. Pick the most emotionsl shot from the four. In the following example the one circled has the best composition to explain the staging of the shot.
7. Match cut - Cut between two scenes which have the same object, setting, or person in same position. General Wow type shot if you can work it in. May be used to show passage of time or point out identity. An example would be cutting from the shot of a ring on a girls finger to the same ring worn around the neck of an old woman to show they are the same person in a different time.
Rule Of Thirds Using the rule of thirds is a great help for composing basic shots. The idea behind this is to break up the screen into thirds both horizontally and vertically. You then place your elements along the lines and center of interest at one of the four points where the lines cross.
8. Alpha Mask - Using digital video editing programs often gives you the option of building your own transition shapes using Alpha Channel masks. Adobe Premiere has lots of shapes prebuilt in their transition library. Many these work like your basic wipe but may have a star shape associated with it. Adobe After FX 17
3
MAYA Character Animation
RU.MAYA 99
3) When the camera angle is lower than the subject it makes the subject seem more important, larger and superior.
3 Balance Each shot needs to be thought of a scale and balanced appropriately. If you have a heavy big object on one end add a smaller object on the other side to balance out the shot. Objects that are closer appear larger and it is fine to use ones that are farther away and thus smaller in the background to balance out a shot.
Angles 3D animation can look very 2D if you do not shot your scenes from good angles. Try to avoid flat straight ahead shots. Most 3D animators do this automatically when in 3D but sometimes forget to draw their storyboards with angles. The advantage of drawing with the illusion of depth is that you will then know where to put your camera in your 3D world before you build it and also whether or not the combination of angles you chose to use are working together visually. Pay attention to films, TV and advertising to see how they use camera angles to make you feel a certain way about the subject in the shot. The basic ideas behind camera angles and the impression given to the viewer are as follows:
Leading looks is another aspect of balance meaning that you have allowed for the compositional weight of the look. If you have a side view of a person looking to the left put this person on the right end of the frame to allow room for the look to occur. Objects such as TV sets, vehicles in motion and subjects with slanted compositions also need to have room ahead of them for good balance.
1) When camera angle is equal to subject at the same height it gives the felling of equality with the subject. 2) When camera angle is higher than subject it gives the feeling of dominance or that the subject is inferior, smaller and less important.
18
RU.MAYA 99
MAYA Character Animation
3) Scan a painting using a palette you think fits the mood of your animation and has a limited color scheme. Use the eyedropper from Photoshop and pull colors off the painting for your 3D animation palette range. Artists with some good palettes to start with are Geiger, Dali, Bosche and any old master.
Color effects balance since our eyes naturally go towards bright or white colors in the frame. Keep this in mind as you compose your color maps and shots. Try to arrange your frame so that the viewer’s eye goes to the brightest area first. Brightness gives an object extra weight in a composition. An object with greater mass may be used to balance out one with brighter colors.
3 Creating A Color Palette For Your 3D Animation Color is another area that can make or break your animation. Study color theory if you have not before to get an idea of how deep this area can go. You need to develop a limited palette of color for your animation and stick to it throughout the animation. This will also make it much easier for you when you are texture mapping late into the night and have to once again choose a color for something.
This palette would not be our first choice for the Media Man story but it is good for the sake of this example. Notice how the colors from the painting make a palette of brights and dulls. 1) Stay away from really bright highly saturated colors. These will not look good on NTSC and generally will give your animation a less expensive look and feel.
4) Grab a frame from a favorite movie that uses color powerfully and pick a palette off of this as a guide. You may want to grab two or three different frames with slightly different palettes to cover multiple sets in your animation. Pick films with similar moods or look and feels.
2) Use lots of neutral tones such as browns, grays, golds, blacks and whites with small touches of brighter colors. Study movies such a Dune, Dark City, Alien, Matrix and Blade Runner to get a better sense of mono chromatic type color schemes that have high emotional impacts.
Most of our favorite palettes are pulled from famous paintings and films which due to 19
MAYA Character Animation
RU.MAYA 99
copyright reasons we cannot show you here. Some movies we are currently using for pulling palettes are: Phantom Menace, Dune, Bladerunner, 5th Element, Matrix, Dark City, City Of Lost Children and Baraka (great outdoor and visual theme palettes from exotic places),
3
Color Maps Color maps have been used by 2D animators for a long time. Disney started the trend and there are many versions of color map formats floating around today. A color map is a grid of colored bars for the length of your animation’s that tells you exactly how the colors are going to change from scene to scene and throughout the length of the piece. These helpful visual road maps give you a great understanding of how well the color scheme will hold together as a whole.
Do not grab palettes off of movie like «Blade» for a happy children’s animation. You would grab palettes off of movies like Lion King or the TV show The Simpson’s to appeal to that lighter emotional level. 5) Collect film design books and scan palettes off of the color pictures of actual shots if you are unable to do high quality video grabs. The new Star Wars series has all sorts of production picture books out with wonderful color schemes to choose from for your 3D animation’s. These are tried and tested colors guaranteed to look good on film, TV and computer monitors. Keep a note book full of colored shot copies accompanied by five to ten color RGB coded palettes to choose from for different 3D projects. 6) Pick a four or five color palette with colors that all go together in the same hue range and use only these as much as possible. Collect color palette books with RGB values and 4-5 color swatch combinations used by graphic designers to make sure your colors go together.
You should be able to glance at a color map and see where the major plots points occur or where big emotional changes occur.
7) All monitors have slight color variations. Get your system vectrascoped to make sure they are calibrated correctly to avoid any unpleasant surprises when you go to a professional post house to out put to tape and find out your purples are actually more of a pink! Use the RGB color value numbers with your palettes to make sure everything will be the same color in the end if you are working on different computers or with a team.
20
RU.MAYA 99
MAYA Character Animation
3
21
MAYA Character Animation
RU.MAYA 99
3
Emotion Maps
game plan will help determine everything from lighting choices to music to character animation.
Add a line in your color maps for the emotion of the scene. This can get a great deal more complicated if you want to go a step further and map emotions of each character, the scene and what you want the audience to feel since these can all be slightly different. Evoking emotion is the main goal in 3D animation and having even a simple emotional
Including The Principles Of Animation The «Disney 12» Principles of animation are good things to keep in mind when 22
RU.MAYA 99
MAYA Character Animation
storyboarding and planning your shots. Try to use as many of the these as possible to keep your animation more of an animation art form rather than a technical execution without personality or soul. Read «The Illusion Of Life» mentioned in Chapter One for a deeper explanation of these ideas.
staging. Study Charlie Chaplin films. He also believed that if an actor really knew his emotion he could show it in silhouette. 4. Slow In Slow Out - Same as ease in ease out. Timing of the motion of the shots to change in-between keyframes to give more of a realistic movement and spirited result.
1. Squash & Stretch - Fill a sack flour with flour and drop it on the floor. The bottom stretches out while the top squashes. Take this same sack of flour and hurl it through the air in slow motion watching as the flour inside changes shape depending on velocity and impacts. A bouncing rubber ball changes shape in much the same way when it hits the floor hard it flattens out. The most important thing is to maintain the same mass. If on part gets bigger by being stretched another part gets smaller by being squashed.
5. Arcs - Avoid mechanical precision in your character’s movement. Movements of most creatures follow circle paths. More arches between positions rather than straight lines. Keep these in mind when setting keyframes for characters. Straight in-betweens run the risk of killing the essence of the action. 6. Secondary Action - An action that accompanies the main action for added impact. If your 3D dragon is going to cry have it form a tear in its eye them have his hand come up and wipe away the tear while he face gets sad and his lips start to quiver. If the dragon were to just sit their with tears streaming down its face it would not be as emotional..
2. Anticipation - Planned sequence of actions from one event to the next. Proceed each major action with one that introduces it to the audience so that they do not become confused or wonder «what is it doing?» Before your alien reaches for a small critter to eat have him first reach out his arm and look at the critter for a moment.
7. Timing - This term in regards to the Principles refer to the number of in-betweens to time action with character animation draw frame by frame. The fewer in-betweens the faster and more abrupt the action.
3. Staging - Every visual detail in the frame needs to help convey the story line and emotion. If you are doing a futuristic haunted house you would use dark colors, shadowy creatures, howling sounds and other scary things. A bright flower bed would be out of place.
8. Exaggeration - Taking a normal set of actions and making them extreme without distortion but more of a hyper realistic exaggeration.
The same goes with staging actions since you need to direct the audience’s attention by showing them precise shots using close ups and clear actions whenever possible. Your character animation should always look good in silhouette to help the viewer see clearly what the character is doing. Render out an alpha channel movie of each scene where there is heavy character animation with just the character. If you can not tell what the character is doing and what the attitude is of the shot you need to change it until you can to improve your 23
3
MAYA Character Animation
RU.MAYA 99
such a Ja Ja in the Phantom Menace comes to a stop, his long flapping ears continue to sway into place. Try to design your characters with some overlapping action if possible even though it will be more complicate to animate but will make it look more interesting on the screen. If Ja Ja would have had short stiff ears his lack of overlapping action would have made him less fun to watch. You can add overlapping action by using folded rolls of flesh, tails, sagging body parts or hair.
3
9. Solid Drawing - Does every frame in your animation have weight, depth and balance? Avoid «twins» where both hands or legs are parallel and in the same position Beware of plastic perfect looking creatures in your 3D animation’s. Make sure each pose has the feeling of potential activity. Try to make each shape of your character slightly off balance with an animated mass like a flour sack of some kind. This way all of the parts will move and bend with the main frame of the character. Avoid symmetrical shapes. Add contrast in form and shape to achieve an active type of balance. 3D makes this harder to avoid than in 2D where each frame is re drawn. 10. Appeal - Live actors have a screen presence full of charisma. Animated characters need to have the same thing which is often referred to as «appeal». This does not mean cuddly and cute. This refers to anything that a person likes to see, quality of charm, exceptional design elements, simplicity, communication and magnetism. All villains should have their own type of appeal or you will not want to watch what they are doing.
12 Straight Ahead Action & Pose To Pose These are terms for drawing 2D animation’s that refer to keyframing which is taken care of by the computer.
11. Follow Through & Overlapping Action The main idea here is that things do not all stop moving at the same time. When a character 24
RU.MAYA 99
MAYA Character Animation
Pitching Storyboards For Feedback
Tips On Pitching Storyboards 1) Pretend whoever is listening is a five year old child with a short attention span.
Pitching storyboards to an audience is an art form in itself. You will need to pitch your semifinal storyboards to a variety of people to get valuable feedback. Keep in mind that is much easier to make changes at the storyboard level than in the middle or end of production on a 3D animation. If the story does not work on paper it will most likely not work when done as a 3D animation.
2) Do not talk about why you chose to do the animation, technical aspects, camera shot decisions or any other extraneous information during the story pitch. People have a hard enough time getting around a new story and it will not be helpful to load them down with extraneous information before they even
25
3
MAYA Character Animation
RU.MAYA 99
3
understand the basic premise. After your pitch you can answer questions.
of your audience will have some confusion over the point later. Remember your goal is to get feedback.
3) Encourage them to ask questions during your pitch if it is a small group of less than three people. Otherwise they may forget there questions or suggestions if they have to wait until the end. They may also not understand a key point and be lost the rest of the story pitch. Odds are if they are stuck on something the other people are too or at least some percentage
4) Act out the character’s voices and movements if you feel comfortable doing this to involve the people hearing the pitch. 5) Point at each panel as you tell the story to make sure everyone knows where you are visually. Draw one panel for each important 26
RU.MAYA 99
MAYA Character Animation
3
shot even if you have to copy one. Never point back and forth through your storyboards to explain some aspect of the story. Go in a linear easy to understand order.
be three minutes in total length. 7) Make sure your storyboards are easy enough for everyone to see from at least ten feet away. Use clear lines and good contrasts between lights and darks.
6) Try to tell your story in the same amount of time it would take to see it as an animation. This will check timing and pace of story. You also know your story is too long if it takes you ten minutes to pitch briskly and its suppose to
8) Pay attention to when the people hearing your story laugh, look concerned, or show any emotion and mentally make a note of it to see if 27
MAYA Character Animation
RU.MAYA 99
3
what you are trying to evoke is working. If the people hearing you pitch your story seem really bored or confused you need to find out why and make major changes.
favorite parts? Did you like the main character?» or any question from the Story Concept Criteria List in Chapter One which should also ask your self before pitching the story to anyone. Be honest with yourself and be prepared to spend some time making the story better. Most screenplays are rewritten from scratch a bunch or times before making it into production. This is your visual script
9) Ask them questions after the pitch such as; «Did you like the story? What would you do to make it better? Anything you did not understand? What were your favorite and least 28
RU.MAYA 99
MAYA Character Animation
which requires the same dedication to revisions.
dialogue, and put them together in a program like Adobe Premiere with the correct timing. This will result in a sideshow type movie which will tell you how well the story is working on a different visual level. It is surprisingly easy to tell how well a 3D animation is going to work from even a simple animatic. Plot problems and timing issues should be readily apparent. Make the necessary changes after showing this version to several groups of people again.
Sound Sound is at least fifty percent of the emotional impact of your 3D animation. Try watching Star Wars with the sound off and see what you think. Good sound can sometimes save bad animation. Bad sound can kill good animation. Great sound and great animation are magical. Make friends with professional sound people or amateur audiophiles who work for cheap. You will need some help doing a good soundtrack for your animation if you have not done much sound editing before. Sound is one job that animator’s should not feel they should have to cover alone. It is too important and takes people who live and breath kilohertz and decibels to do it justice. Many professional sound people enjoy doing soundtracks for animation’s to get exposure and do something different for a change. They will be more inclined to help you out if they like the story and feel it has potential to be successful. .
Moving 2D Animatic Some animatics have layers of 2D elements that move around to show motion and test timing for movement. Usually a character will slide around the screen or a background will pan across. This type of motion requires storyboards drawn in the shape of the pan to work correctly. If you have a shot where there is long horizontal pan across city street, you would draw a long horizontal city street panel and animate it across the screen. You may also want to draw characters or moving objects on different layers to animate around the screen to test timing. You should make one of these to test your 3D Story before deciding that the idea and timing are solid.
You may want to do a rough sound track to animate to using programs such as Sound Edit, Deck or Pro Tools but try to find experienced sound people to do the final cut. Proper sound FX and background music will greatly enhance the viewing pleasure of your 3D animation’s.
Moving 3D Animatic Some final looking shots are still considered animatics these days. 3D animatics use to involve simple 3D primitives as place holders for spaceship fleets traveling across the screen with a rough motion path to check timing and camera shots. They have become more realistic, modeled in detailed, texture mapped and lit in larger production houses since 3D is getting faster and easier to do. It is still easier to plan out rough camera shots and make changes than it is to experiment with heavy final type renders and make changes.
Animatics After you have pitched the storyboards to at least five different people, made changes based on their feedback and pitched it again until it’s as good as you can possible get it, then you are ready to create an animatic. The word animatic can mean many things these days. Disney starting doing them to test story ideas and character animation before final drawings were created.
Getting To The Final Animatic Stage
Basic 2D Animatic The first step for a basic animatic is to scan your storyboards, do a rough audio track with
Once you have a successful final animatic 29
3
MAYA Character Animation
RU.MAYA 99
even if it is only a sliding 2D one you will feel more confident during the computer production stage that your story works and will have a good chance at being a success. It is not a short or easy process to get to this stage but is less painful then spending months on a sketchy idea for a 3D animation that does not get a good audience response when shown but was a good learning experience.
3
The steps presented in these first three chapters are not a linear progression and need to be traveled through in a variety of progressions depending on the animator and the idea. Feel free to experiment with your own order of story concept design for 3D projects and find what works best for your creativity.
30
Chapter 5. Modeling an Organic Biped using primitive shapes
MAYA Character Animation
RU.MAYA 99
horizontal isoparms. After adding the horizontal details mirror the shape and sculpt the sides with artisan’s multi-surface brush reflection option.
Introduction
5
Creating a realistic articulated 3D character is very much possible using Maya’s state of the art tool set. The character that you will model is designed so as to be ready to add character animation controls and then bring to life. There are many ways to create articulate organic characters in Maya and all of them are valid to some degree for each need that they serve. The following series of tutorials are a good introduction to many of the most important aspects of bipedal character creation. The “Lanker” tutorial series authored by Alex Alvarez was seen in part in 3D Design magazine as well as on the Lumis web site and of course at his Gnomon 3D Film FX and Design school’s web site at gnomon3D.com. The tutorial is included in full on the companion CD-ROM and the first part will be referenced heavily during the following section. The following steps are an outline and update on the steps included for the modeling stages of making an organic 3D biped character using similar techniques. The original tutorial was written for the limited space available in a magazine article and though highly detailed and informative, it still had a few more details to be included for completeness sake. A hybrid procedure is thus presented that will clarify certain points and elaborate others.
Step 1. “The first and most important step involved in building a character is design and the preparation of orthographic drawings. The main thing to point out is that I am working off of only front and side drawings, due to the fact that the arms are at the character”s side. I decided to model him with his arms down, just to make sure that his shoulder region looked exactly as I desired a more common, neutral position.” - A. Alvarez Place the image planes so that they intersect and are both aligned perfectly. Good placement helps to insure accurate cross sectional placement of the hulls. If you are not an illustrator you can find many other orthographic images in classical anatomical art reference books. Included on the CD are several orthographic character templates containing front and side view pairs. Look for them in the directory BOOKPROJ: CHAPT4: PROJECTS: BIPED: SOURCEIMAGES: CUTSIDE.jpg and CUTFRONT.jpg or BIPED_SD.jpg and BIPED_FT.jpg. If you have biped character images of your own to use then be sure and prepare them accordingly. The illustrated version with the big hair is based on a role playing game character named “Cuthrau”. The anatomical drawings are an equally useful choice having extra contour lines that can be useful as reference.
“
Section A. Create the torso and head from a sphere Overview
Stage 1.1Create an image plane on the side camera by going into the Cameras tab in the Multilister window and double clicking the side camera. The attributes editor for the top camera should appear and by scrolling down the list of entries the environment pop down menu should be opened revealing the «create image plane» button. Pressing this creates a new image plane and the attributes editor should show the options for this. In the image name option hit browse and then load up your side view of the biped. Double click the new image plane and
To ensure that the model is to look like the reference imagery we will begin by loading the drawings into two image planes. Then create a primitive sphere and hull edit to match the side profile image. Add vertical isoparms to match the contour of the source drawings. When the time comes to add horizontal details that exceed the resolution of the sphere detach it in half to assist in symmetrical placement of new 2
RU.MAYA 99
MAYA Character Animation
down, maybe not while modeling, but definitely down the road when setting up deformations or sculpting morph targets for facial animation. When this geometry is complete, we will then attach arms and legs with the Fillet Blend tool.” - A. Alvarez
hit the select button found at the bottom of the Attribute Editor’s window. In the channel box adjust the Center X, Y, and Z channels to align this image plane with the next one you create for the front view. Stage 1.2Create the front image plane like the side and go ahead and align them. One way to make a sort of reference chamber around your character is to align the imagery so the side view is still centered on the ZY axis but is pulled back down the negative X axis enough to meet the far side of the front image plane. Then move the front down the negative Z away from the camera just enough to meet the character’s far right edge of the side view. This forms a sort of box around the character that gives you an interactive reference to your progress towards the final goal of completing the biped model.
Create a primitive NURBS sphere, note: use a full sphere shape! Set its parameters to 16 x 4 sections and spans to allow for enough geometry to begin with. Set the radius to match the waist’s profile in the side view. Stage 2.1 To allow the use of symmetrical hull scaling from the front view a few steps from now we must first create a full spherical object as opposed to the suggested half sphere. Go to the side view then from the menus or hotbox choose Modeling: Create Surface: Create Primitive: NURBS SPHERE. Don’t edit the settings in the create primitives settings palette, but instead edit the model interactively from the inputs for MakeNurbsSphere in the Channel Box or from the attribute editor window. Stage 2.2In Maya when a hull object component is selected the defaulted central point of manipulation is at the calculated average center of all the CV’s in the hull (or any other group of selected components). Thus if you were using the previous recommended half sphere technique you might be frustrated when attempting to scale the hull symmetrically or towards the zero point on the X axis. To display or select components for a single object, hold the RMB over the sphere and choose an edit mode. Hulls and CV’s options allow direct editing where as isoparms and surface points allow one to mark the surface for other tools to know where to perform the desired tasks. Try the Hulls mode and click on a pink horizontal hull floating above the surface’s isoparms (the direction one often wears a belt). After selecting it choose the scale tool with the “R“ key. Notice that the scale tool’s manipulator is in the center of the hull’s ring of points. If it were a half sphere’s hull it would be in the center of the hulls points, and thus it would not scale towards the grid unless you create a custom
Aligning the front and side image planes assists accurate cross section modeling.
Step 2. “With the orthos, or imageplanes, loaded into my front and side views, it is time to begin modeling. The first step is to place half a sphere into the side view with the poles at the top of the head and bottom of the pelvis. What we are going to do is model the entire head (including eyelids, nose, ears, and mouth), neck, torso and pelvis out of a single half sphere. When modeling any humanoid form, this is the way to go, especially for the head. Any other technique can seriously slow things
3
5
MAYA Character Animation
RU.MAYA 99
MEL script that reset the center point of the hull each time you selected one.
view. A feature of Maya that makes this and many other common tasks more intuitive are the new manipulators for modifying objects. When an object is selected, with a transformation tool, either translate, rotate or scale, a manipulator appears which allows for intuitive freeform or axis constrained editing. For objects or surfaces, this manipulator appears at their Pivot Points, but for Components, the manipulator appears at the center of the selecting vertices or hulls. This allows for editing in the Perspective window which was before only possible in orthographic views.” - A. Alvarez
Stage 2.3Later after certain basic shaping steps have been completed the shape will be bisected down the center between the eyes to allow for an artisan modeling tool function called multi-surface reflection editing to happen. First to lighten the geometry and to prevent construction history build up delete the history of the object. This is found in Edit: Delete by type: Delete History.
The next step is to move the top third of the hulls to the skull area to form the dome of the head. The bottom third of the hulls should be translated to the base of the groin, as they will form the foundation for the hips, pelvis and crotch region as well as the upper buttocks.
5
Stage 3.1There are usually several ways in Maya to do any one thing. To edit the sphere either go to component edit mode by hitting F8 or use the object components marking menu by holding down the RMB over the torso geometry to prepare the object for editing. Use either CV or Hull mode to select the portions you wish to edit. If you chose to edit in component mode set the pick masks to all off. Then individually activate either the CV or Hulls masks. If you used the marking menu with the RMB then select CV or Hulls to enable the editing process to transpire.
The primitive sphere is a useful and straightforward modeling foundation.
a hull is displayed of a half sphere and a full sphere with the scale tool active. Note the center point for scaling.
Stage 3.2In the side view, using the translation tool activated with the “W” key, move each complete vertical ring of eight CV’s to the designated region to match the image plane. If you wish to move groups of CV’s or Hulls then if in CV mode simply drag the mouse over a larger region, making sure all points are highlighted, or if in Hulls mode shift click each corresponding hull to move them all simultaneously.
Step 3. “With the sphere in place, we now want to shape it to match the general forms of the Image Planes, starting first with the side
Stage 3.3Remember that the very most northern and southern tips of the sphere actually contain a ring of sixteen CV’s just like the rest 4
RU.MAYA 99
MAYA Character Animation
of the isoparm’s hulls. This means that to be precise one must be very careful to remember to pick it when moving the rest of the vertices in the region or else there will be some sort of spike of tearing that can occur.
inch apart for the head and three inches for the torso. Using the Insert Isoparm tool and the Move tool, in the side view, place the hulls (rows of vertices) so that the Move manipulator is centered horizontally with the corresponding area of the drawing. Then switching to the Scale Manipulator, scaling the hull to match the design. An important note with the Scale Manip is to constrain the scaling to the Z direction. Not doing this will cause the selected vertices to also scale across the YZ plane, which will cause problems in mirror copying. Once the side view has been filled out, the same process is done in the front view. It is important for future ease of manipulation to try and keep the hulls as “vertical” and “horizontal” as possible; waviness will make the wireframe very difficult to read and edit later. Figure 3 shows the various stages the model will go through while executing these techniques.” - A. Alvarez
Selecting and placing the hulls by translating or Z axis scaling them to fit from the side view matching image plane for precision.
Continue to add horizontal isoparms from the side view until the geometry approaches the details needed to form the torso and basic head shapes silhouettes. Attempt to only add the most essential isoparms at this time making sure to edit them into place as you go along.
Be sure not to forget the top most hull.
You must insert more horizontal isoparms to achieve the profile of the biped.
Step 4. “The default primitive sphere we placed over the image plane was created with (16) vertical and four horizontal spans. Step four involves inserting enough horizontal isoparms to match the drawing, without including any areas of tight sudden changes in curvature. If the entire figure were, for example, six feet tall, you wouldn’t want to get any horizontal isoparms that are closer than one 5
5
MAYA Character Animation
RU.MAYA 99
mode to wireframe by hitting the “1 and 4” keys. Also to help facilitate making a special MEL script shortcut for part of this often executed procedure, open the script editor window and turn on echo all commands. If you have screen real-estate to spare, keep this window open off to the side to observe how Maya keeps close track of everything that is going on in the background. Stage 5.2 From a perspective view RMB over the torso geometry and choose “isoparameter” from the object components marking menu that appears. Select the front polar isoparameter by clicking on it with the LMB. Shift click the back polar isoparameter so that both are highlighted yellow. Choose Modeling: Edit Surfaces: Detach Surfaces: Settings and make sure keep original is off. Then detach the sphere in two.
Be careful not to bunch up too many isoparms in one place quite yet or it might cause creases or lumps.
5
Step 5. “With the basic forms filled in, it is now important to decide exactly how we want the curvature of the surface to flow. Trying to follow anatomical muscle flow can be difficult, but remember than many details can be added via bump and displacement maps later. The main problem is trying to get surfaces to deform diagonal to their parameterization. Thus at this point it is good to try to sculpt the still simple surface so that its isoparms, or surface curves, follow the flow of form in the design. For example, in the neck/shoulder area, muscles move from the back of the skull to end of the collarbone, and from behind the ear to the beginning of the collarbone. The Artisan module of Maya can make this process substantially quicker, especially later on when the geometry becomes more dense.” - A. Alvarez
Stage 5.3 Delete the right side. There is a strange anomaly when using both sides of a detached sphere for reflection sculpting in artisan. To get a predictable result it is important to mirror one of the sides. Select the remaining left side and choose Edit: Duplicate: Settings In the window set the scale parameter for the X axis to “1”. Click on the Duplicate button. A mirror object should appear, rename it R_side. Select both right and left torso objects to prepare for artisan’s Sculpt Surfaces Tool. “The Sculpt Surfaces aspect to Artisan allows you to push, pull or smooth surfaces via tablet driven input. As with pressure sensitive application in 2d paint packages, a Stamp Shape is selected which determines the shape of the area of the surface that will be selected and edited in a single stroke. The Radius and Magnitude of effect is controlled by pressure, while the artist can move vertices in the directions of their normals, the global axes, or along the U and V directions of the surface as shown in Figure 5e (Step5e.jpg). This interface for editing vertices is powerful, maintaining near real-time interactivity while working on complex models.”
Detach surfaces and delete the right side. Duplicate the left side with -1 X axis scale. This essentially mirrors the remaining half, recompleting the torso shape. Make a MEL script to automate part of this procedure. Later as you need more isoparm detail you will again need to delete the right side, add isoparms, then once more mirror the left side to facilitate easy artisan sculpting. Stage 5.1 Select the torso geometry and set the display smoothness to low and the shading
Stage 5.4 Now you are ready to use the 6
RU.MAYA 99
MAYA Character Animation
reflection option in artisan. Go to Modeling: Edit Surfaces: Sculpt Surfaces Tool: Settings. In the Stroke tab there is a reflection editing check box. Make sure it is activated and then choose the Multiple Surfaces option. Be wary of the north and south poles of the sphere when using this tool because it can have strange and unpredictable results in these regions of the model due to the dense proximity of isoparameters and strange “pinch” parameterization that occurs in the spherical primitive. Stage 5.5 To save time when repeating this step regularly during the up-res process write a MEL script using the script editor window’s record of the last time you did the procedure to help you.
Deleting the right half.
5
(Detail of MEL script 5.5) Sidebar from chapter 11. Stage 5.6 Create a custom shelf to hold your new tools. (Detail of custom shelf creation 5.6) Sidebar from chapter 11. Mirroring the left side.
Detaching the surfaces. Set up for reflection modeling in artisan.
7
MAYA Character Animation
RU.MAYA 99
Section B. Detail and up-res the head
the left side of the torso model and set the display smoothness to low and the shading mode to wire frame by hitting the “1 and 4” keys. Next hold down the RMB over the left side and choose isoparm. Click on an existing vertical isoparm and drag the mouse up or down stopping where you wish to insert a new one. A ghost like isoparm should follow your mouse until you release the RMB. This new “yellow” curve is only a marker of where an isoparm will appear when you are going to insert one, and is not permanent until you do so. By holding the shift key you can click on a curve you highlighted to un-select it or shift drag an isoparm to have multiple markers for new isoparms.
Overview The eyes and mouth will require some practice to perfect. Adding more mesh resolution horizontally should be done with caution as the details span the length of the character. Vertical isoparms are safer to add as their influence is more localized and does not tend to get in the way of the rest of the model as much.
5
Step 6. “With the basic shape finished, we can begin adding details trying to first concentrate on horizontal curvature. If a vertical isoparm is inserted while working on the head, the new isoparm flows all the way down to the bottom of the pelvis. Thus by beginning work horizontally, we can work our way gradually down the body. When we finally need to insert vertical isoparms, say to tuck the edges of the nostrils, it is a good idea to look around the surface to see if the new isoparm could help shape another region as well. This method keeps balance and fluidity of form while working on the model. Figure 7 shows the head geometry at the end of this phase, having a mirror copy displayed as well. The final model of the eye was put in place prior to doing any work in the eye region to act as a reference for the lids.” - A. Alvarez
Stage 6.2 The next thing to do is to go to Modeling: Edit Surfaces: Insert Isoparameter thus converting all of the yellow higlighted potentials into usable, editable isoparameters. Now it is possible to add more details to the face and torso with artisan. Re mirror every time to keep the seams together. Stage 6.3 Keep in mind that too many isoparms near each other will often times result in kinks or unwanted ripples. Try to space the horizontal isoparms as evenly as possible and still be where you need them. Adding a blinn shader to the model helps to expose surface shape irregularities.
After editing as much of the face as possible with the existing local isoparameters, it is time to add some essential yet well thought out vertical isoparameters. When inserting these vertical isoparms be frugal, placing less at first and more when the time is necessary. Whenever you insert isoparms and you intend to model symmetrically you must follow certain basic guidelines. Remember to insert isoparms only on one of the halves and then mirror it after inserting the new details.
Setting the torso to low res wireframe.
Stage 6.1 In a perspective viewport click on 8
RU.MAYA 99
MAYA Character Animation
completely separate geometry using Revolve for the teeth and Loft for the Gums and Tongue.” - A. Alvarez Creating the perfect mouth and eye sockets requires skill and patience. This is a real good time to save your file and do some modeling R&D to get a feel for how all of the delicate pinching and folding will work. It won’t always look perfect the first time so give yourself room to create some strange mutants along the road to perfection. Stage 7.1 To insert the optimal isoparms that will enable you to create the radical change in shape so as to pull a large crater out and still retain a smooth surface right next to it will require a few “control” isoparms. These isoparms will be needed very near the vicinity of the outer edge of the eye and mouth craters. Hold down the RMB over the surface and then select isoparm. Then click on an existing horizontal isoparm and drag away towards where you desire to leave a new one, releasing your mouse button.
Inserting isoparms allows details to be added.
Stage 7.2 To add the other isoparms at one time hold the shift key and click drag another new iso-marker. Place at least two on each horizontal side and probably two on the top and two on the bottom vertically to start out your eyebrows. Then when your selection is complete use Modeling: Edit Surfaces: Insert Isoparm to finalize the details.
Avoid kinks by spacing the isoparms evenly.
Step 7. “Regions that pinch such as the corners of the eyes and mouth can be tricky due to the close proximity of isoparms that need to be inserted. Wrinkles can easily pop up, so always check your hulls to make sure they don’t cross each other. Hulls are the lines that do not lie on the surface, drawn between the surface’s vertices. They can be displayed using Display/ NurbsComponents/Hulls. However, the wrinkle problem is easily fixed with Artisan, using Sculpt Surfaces/Smooth. This mode spreads apart isoparms, literally smoothing out the selected area. The mouth was handled by pushing a “cave” in through the lips, creating relatively accurate lip and cheek thickness. The gums, teeth and tongue (are) then sculpted as
Stage 7.3 It is time to punch in the geometry that will be forming the base of the crater. Carefully select only the vertices you wish to edit, checking in wireframe to make sure that you only highlighted what you want then translate the selected vertices in the negative Z axis. At first it will look a little stretched but afterward you must do some massaging, redistributing the CV’s just right. Use the pick walking method of navigating through the mesh one CV at a time using the arrow keys for the most precise detail. Artisan can be a little unpredictable when working in pinched areas and cavity regions. In these conditions manual editing is the safest for these micro detail 9
5
MAYA Character Animation
RU.MAYA 99
regions. Remember also that the region behind the eye does not have to look perfect as it will be obscured by the eye in the socket anyway.
5
Stage 7.4 Create an eye ball model using a sphere that has been turned on its side with the input manipulator so that its poles point down the Z axis. Add a little eye texture by making a new blinn shading group in the Multilister window and map its color channel with a ramp. Set the ramp type to U Ramp and set the colors to black, purple and white. Localize the ramp’s gradient bars near the top and bring the black down a little from the top. Now apply this to the sphere then delete the sphere’s construction history. Translate and Scale the eye sphere to match the reference art and then add a group node to the sphere with its center set to the origin. Duplicate the eye group and then scale it -1 across the X axis to give the torso two reference eye balls. These can be templated if you just need their wire frames as reference. Now as you create the eyelid regions you have a proper reference in place.
Sculpting the lips.
Placing a sphere for the eye.
Forming the mouth cavity.
For pupil reference add a ramp to the sphere. Step 8. The nose can be a little tricky requiring you to spend some time evaluating how you wish to use the exisiting parameterization of the middle of the face 10
RU.MAYA 99
MAYA Character Animation
without having to add very many custom isoparameters. Stage 8.1The main section of the nose is the protruding slightly conical portion. Working close up to the head region in the side view pull out the main portion of the nose region by shiftselecting individual CV’s. If you pull out too many and the nose/nostril region looks too wide use artisan’s Sculpt Surface with low displacement and opacity values to mould it back into place. Stage 8.2The nostrils require creative use of the surrounding isoparm details. After flaring the lower edges of the nostril area outward be sure that there is enough isoparm CV details to pull a small nasal cavity upward. When doing any of these close up facial details try bouncing between working on half of the model then using the techniques described earlier add the mirror duplicate and gently smooth and refine the details you added with the intricate CV editing.
Sculpting the lips.
5
Stage 8.3Alternate between the single and multiple object editing while adding the finishing touches so that you get a good idea of how the progress with the nose is coming. Though very useful, especially when sculpting the contours and bumps, artisans Sculpt Surfaces Tool can be a little frustrating when trying to add details directly at the seams. The seam correction that is so helpful is doing a lot of processing and so the interactivity can be less repsonsive.
Placing a sphere for the eye.
Step 9. Facial bone and muscle structure must be modeled in. Try to use as much of the exsisting eye and nose isoparm details as possible when sculpting the cheek bones, eye brows, forehead and jowls. Add details in the following order. Stage 9.1 Cheek bones and jowls. Stage 9.2 Eye brows and forehead. Stage 9.3 Skin creases around the nose.
Forming the mouth cavity. 11
MAYA Character Animation
RU.MAYA 99
Stage 10.1 Insert isoparms around the lips and double up on the vertical edge of the mouth detail as control points to allow the tight change of direction as the cavity is burrowed out. It is often easier in the long run to place vertical and horizontal isoparms fairly tightly together and then spread the individual areas apart as opposed to pulling the details together after inserting them apart. This helps reduce wrinkles from popping up. Stage 10.2 Select the CV’s that are going to be used to form the back of the mouth and to simulate the beginning of the esophagus and throat. Translate them backwards to an area sufficient to leave room for the teeth, gums and tongue as well as a roof of the mouth.
Cheek bones and jowls.
5
Stage 10.3 Smooth out the transition area by spreading out the isoparms CV’s both towards the top and bottom of the mouth area inserting horizontal isoparms as need arises. Stage 10.4 Now add isoparms to finish off the upper and lower lips region. Stage 10.5 Next it is time to smooth any wrinkles that may have been cause during the sculpting and detail adding stage. Use the Sculpt Surfaces smoothing option to lightly brush over the wrinkles and gently spread them apart.
Eye brows and forehead.
“Now, you can attach a mirror copy to our head/torso surface, remembering to attach at both the front and back of the geometry. First, make sure to check the surface for any areas that may have accidentally been moved across the YZ plane. Simply selecting the interior edge hull and “Grid snapping” it to the YZ plane will work. After mirroring the surface, we could add asymmetrical details to the torso such as musculature, for example. However, with this (type of) model I chose to do this primarily via bump maps. Next, I detached the surface at an isoparm located near the collar bone to give the model a shirt and manipulated the top hull of the detached torso geometry to give it some thickness over the skin.” - A. Alvarez
Skin creases around the nose. Sometimes a little under lighting exposes details. Step 10. The mouth region is fairly complex but with a step by step procedure it is an achievable goal.
12
RU.MAYA 99
MAYA Character Animation
Step 10.6 Attaching two mirrored objects involves first duplicating the half torso with the X axis scaled to –1 then selecting the edge isoparms of each object by holding down the RMB and choosing isoparm and clicking on the edge. It should highlight a yellow line along the edge. Shift select the other side and then repeat the process. Once selected go to Modeling: Edit Surfaces: Attach Surfaces. Next choose Modeling: Edit Surfaces: Open/Close Surface: Settings. Be sure that your are closing the V surface direction and shape preserve is toggled. Be aware that the preserve option automatically inserts a couple of extra isoparms to help preserve the shape which can be bothersome if not planned for accordingly as in the case of building morph targets, attach and close after sculpting them all.
Expand the mouth to make room for the teeth.
5
Insert details to finish off the lips.
Insert isoparms around the lips.
Use artisans smoothing brush to relax kinks. Insert details then move the CV’s back.
13
MAYA Character Animation
RU.MAYA 99
Create the leg from a primitive cylinder. Use translations and scale to approximate the location to where the leg would be. Stage 11.1 Use a primitive cylinder set to at least 12x12 sections and spans. Stage 11.2 Match the radius and height to generally appear like the reference art, don’t worry about it too much. Stage 11.3 Delete history and freeze transformations as well to reset the leg geometry before you begin.
Stages to attach the head (this does not have to happen until you bind your skeleton to the geometry).
5 Section C. Model legs from primitive cylinders Step 11. “With the head/torso geometry complete, it is time to sculpt an arm and a leg, each out of a primitive cylinder. The hand will be done separately. The same sculpting techniques as mentioned above apply, but now we need to consider the areas where the arms and legs attach to the torso, (just like) where the fingers attach(ed) to the palm. Since we are going to use the Fillet Blend tool to attach them, we can ensure good results by modeling the surfaces almost on top of each other, so that they have a visually implied continuity. When this is accomplished, we can Trim, or cut away, regions of the torso within which we will create new surfaces using Fillet Blend. This type of geometry is solely based on the two surfaces it is blending between, thus the reason for modeling the hip areas of both the torso and leg surfaces so that they flow into each other. When creating our curves on surface in preparation for Trimming, a nice new feature is the ability to make a surface “Live” using Modify/ MakeLive which allows us to intuitively draw curves directly on the surface in the perspective window.” - A. Alvarez
Perspective of the leg progression.
Front view of the leg progression.
14
RU.MAYA 99
MAYA Character Animation
Create a cylinder and align it to the image.
Adding extra isoparm details near the ankle.
Step 12. Time to make a one piece leg and foot out of the primitive. Use the hull editing and insert isoparm techniques as well as the Sculpt Surfaces Tool that were covered extensively earlier to go ahead and sculpt then add resolution to look like the drawing. Begin by spreading the hulls to fit the side view.
Step 13. Add resolution to the geometry to match the image plane. Keep in mind not to go overboard on mesh detail as much of it can be added in the texture mapping stage. Stage 13.1 Add vertical details when placing each new isoparm take time to edit it before adding the next curve. By doing so the next curve that you insert will probably already be shaped somewhat like you need.
Stage 12.1 Cover the leg from the hip/pelvis region all the way to the toe of the foot.
Stage 13.2 Add horizontal details more sparsely as they influence more of the geometry.
Stage 12.2 Use translate and scale and rotate to massage the hulls into place. Stage 12.3 Add extra detail near the ankle and heel region by bunching up several hulls. This prepares this region to be stretched into the foot as well.
Stage 13.3 Massage the added resolution into place using your favorite detailing methods. Be sure and place enough isoparms to allow for the foot to be pulled out of the ankle area.
Continue hull editing to match the image.
15
5
MAYA Character Animation
RU.MAYA 99
Insert horizontal isoparms.
Use artisan to mold the new geometry.
Step 15. Prep the leg to be connected to the torso. Do any extra detail work on the torso to help facilitate the transition region.
5
Stage 15.1 Align the geometry to appear to be a smooth, flowing transition between models. The more similar they are the more seamless the fillet blend will be. Stage 15.2 Work on matching the front and back groin region Stage 15.3 Make sure the buttocks have good match up by grouping the left leg. In the group settings be sure its group pivot is defaulted to the origin. Then duplicate the left leg group and scale –1 X. Obeserve the symmetry of the two legs and how they apprroach the torso.
Rotate, scale and translate the hulls to form an ankle and a heel.
Step 14. Use artisan’s Sculpt Surfaces Tool to add muscular details. Remember to keep the opacity and the max displacement set low so as to gradually build up details. When adding geometry to the back of the knee use a pair of horizontal isoparms to help detail the skin clefts between the rear thigh and calf regions.
Stage 15.4 Model the genital mound making sure there is a smooth flow between the leg areas. Stage 15.5 Add any extra isoparms necessary to the leg to enable the front and back areas of the torso and leg musculature to be properly contoured. If you add any isoparms always reduplicate any other mirrored parts to keep everything consistent.
16
RU.MAYA 99
MAYA Character Animation
Section D. Create arms and then add the hands Step 16. Create the arms from primitive cylinders in much the same process that were used to create the leg. The heel and elbow have certain common traits such as the bone protrusions having similar visual qualities.
Edit the leg so the geometry flows together.
5
The arms progression from primitive to anatomy. Step 17. Add musculature detailing to your hearts content. Keep in mind that over exaggerated muscles are a bit of a fad in the games markets but a more tasteful and realistic well defined and muscled humanoid can still be appealing. For more reference on the subject observe your own physiology and you are urged to consult anatomy for the artist books.
Use artisan on the rump to smooth and mold the transition.
Be sure and smooth the genital mound for a smooth flow between the leg area. Hull editing is your mantra. 17
MAYA Character Animation
RU.MAYA 99
Step 18. Make a cuff at the wrist to simulate a skin-tight leotard style outfit and to give you an easier way to integrate the hand. If need be add a couple of isoparms. The Global Stitch tool if tweaked enough can also be used to integrate the hand.
Step 20. The imported hand model will have to be adjusted to fit the humanoid upon being imported and there is a specific methodology that allows you to do so. Import the hand file by going to File: Import. Locate and open the hand model that you have completed or the ready to go file provided on the CD-ROM called hand_done.mb in found in your chapter4/ project/hand directory. Another strategy exists to save time setting up body parts. It involves completely setting up the hand a head of time. Once a skinned and driven hand is ready (texture-mapped even) import it and generally follow the same sort of grouping and scaling procedures to retain the construction history.
5
Stage 20.1 Import the hand model then continue to examine the hypergraph and access the changes and additions. Most of the grouping has been performed ahead of time while organizing the hand file in Part I. They were prepared according to a procedure designed to simplify the duplication process while still retaining the construction history. Using insert and the translate tool reset the oversized hand’s Hand_MOVEME group pivot to the base of the hand.
Tucking the cuff is one way to add the hand. Step 19. It is time to prepare the file for integration with another file. Go into the hyper graph and organize the geometry into a simple and easy to understand hierarchy that would allow anyone not familiar to the file to understand your database. This way you give yourself good habits for workflow that will guarantee to help organize your production pipeline.
Stage 20.2 When translating and duplicating highly complex models with dense interwoven construction history like the hand model you must understand the nature of construction history and how processes that retain active history such as fillet blend work. If you do not plan it out with a defined strategy your model will often simply explode apart, suffering from predictable anomalies such as double transforms and history feedback loops. Stage 20.3 Grouping and duplicating (with upstream graph) blend objects is okay but do not attempt to scale these groups or the blends as they derive their scale from the source geometry used to create them. Grouping and duplicating skinned objects is alright as long as you duplicate the skeleton and control objects at the same time, activating the Duplicate Upstream Graph option. Because of
Preparing the scene’s database is easy if yoi start before things get too complex. 18
RU.MAYA 99
MAYA Character Animation
the fact that the skeleton they are skinned to determines their scale it wouldn’t work to perform any scaling on the geometry group. Stage 20.4 Pick the group Hand_MOVEME that contains the hand geometry with no blends. Rotate and scale the Hand_MOVEME to match the biped’s arm and the background image. The hand that is provided is a right hand and the arm geometry is on the left. So align then flip the hand. Stage 20.5 Proceed to group Hand_MOVEME with the pivot around the origin. This prepares the geometry for mirror scaling to create the other hand. Call this group Mirror_Scale.
Only move the designated translations group to maintain proper construction history.
5
Stage 20.6 When you duplicate (with the up stream graph preference) the main hand group, scale the hands Mirror_Scale group –1 on the X axis but leave the fillet blend group alone. The this live construction history geometry derives its scale attributes from the source geometry its created from, thus fillet blends location is generated based on the location of the palm and fingers.
Mirror the hand by duplicating then scaling the appropriate groups.
Section E. Fillet Blending and Freeform Fillet to join the limbs Step 21. The arms will need a trim curve to attach a blend to. Create a curve on surface at the shoulder using one of the techniques introduced during chapter 4. Several choices for curve on surface include direct drawing on the surface utilizing the Modify: Make Live feature.
Use the hypergraph to prepare the the file after importing the hand.
19
MAYA Character Animation
RU.MAYA 99
Make live is a convenient way to create curves on surface.
5
Project the curve onto the torso.
Step 23. Trim the torso making the holes for the arms and the legs then if need be trim the upper arm as well then fillet blend.
Step 22. To blend the legs, create a curve on surface at the leg nubby. Hold down the RMB over the leg and choose isoparm. Click on the top edge isoparm then go to Modeling: Edit Curves: Duplicate Surface Curves. Adjust the curve so that it is slightly larger than the leg. Then select the torso and shift select the curve. Go to Edit Surfaces: Project Curve onto the torso.
Trim the torso object.
Duplicate the edge isoparm.
Step 24. Trim or detach surfaces to prepare 20
RU.MAYA 99
MAYA Character Animation
the upper leg near the rump. Then to seamlessly close the space between the parts use either fillet blend or freeform fillet.
Use the manipulator tool after highlighting the appropriate input to adjust and fine tune the fillets. Fillet the space between the body parts.
5
Step 25. Maintenance Stage 25.1 Manipulator tool to fine tune. Click and drag the little blue dots located one at each edge of the fillet blend. Stage 25.2 Correct grouping, refer to step 20. Stage 25.3 Torso and limb geometry editing is sometimes necessary to perfect the blend’s shape and remove any unwanted seams and holes at the blend’s edges. Stage 25.4 There are several issues concerning duplication of a half biped. Issues such as when and at what stage in the models creation to do it. Stage 25.5 Retaining the skinning work during mirror duplication is a way to save time on symmetrical bipeds.
21
Chapter 6. Modeling an Organic Dragon with NURBS
MAYA Character Animation
6
RU.MAYA 99
There are many methodologies available when deciding how to begin constructing any form in 3D. Rigid forms suggest certain styles of building where organic geometry requires its own tools and techniques. After forming the hand, body and head you have become familiar with many techniques required to build seamless characters. For the next modeling project you must use what you have learned and integrate these methods with a few new ones. Ultimately your result will be an organic dragon complete with articulated wings ready for adding to a skeleton, legs, tail and neck with a nasty fanged mouth. Keeping in the tradition of modeling from NURBS primitives this Dragon character extends the biped concept by adding extra details to articulate. Some of these details include an articulated dinosaur-like tail with a fan of blades ready to be flexed, large finely detailed bat style wings and even a sinewy flexible long neck. This is a hybrid creature design with quadruped influences like a cat as well as features of a reptile and even humanoid like front fore limbs. Characters with many interesting moveable features often are more fun to animate. If the design of the creature alone can express movement just in its form than you are just that much closer to evoking an emotional response after it is created.
Section B. Constructing the wings Section C. Modeling the front legs and digits Section D. Forming the Head Section E. Sculpting the tail spikes Section F. Shaping the rear legs, toes and spikes Section G. Making the model seamless and detailed As always there are a multitude of modeling and 3D sculpting techniques available in Maya and you are urged to explore other methods to model the dragon after trying this technique. After modeling this character you should feel fairly comfortable modeling characters based on drawings or pictures.
Section A. Fleshing out the body Using a primitive cylinder, form the entire outline for the main body with this one object. Stretch the hulls of the primitive cylinder from the neck to the tip of the tail to begin with. Later stages will introduce techniques on how to form the head. Similar to the biped project the body will be split in half to facilitate symmetrical modeling. After inserting sufficient isoparms to allow the surface to be dense enough to sculpt artisan will be used to add muscular and bone bulges.
This dragon was designed by illustrator/ character designer Donnie Bruce for this book, but based on several other original paintings of similar styled terrestrial creatures. Several orthographic drawings have been provided as reference on the CD-ROM. These can be found under (path to be determined). It is highly recommended that whenever you set out to model a character that you obtain or create as much background on the character as possible. Before modeling the dragon examine the reference material as extensively as possible keeping an eye for any details that intrigue you or forms that suggest certain modeling methods.
Step 1. Placing the image plane is a straightforward process accessible through the Multilister under the camera tab. Double click the side view to open the attribute editor and open the sub-listing called environment. Click on the image plane button and when prompted browse for the Dragon’s side view image labeled dragSide.jpg to load in the image.
The Dragon model’s creation is broken out into seven sections as follows: Section A. Fleshing out the body
(Sidebar: Create an image plane on/off button by linking a new attribute in the connection 2
RU.MAYA 99
MAYA Character Animation
editor on a locator called imagePlane_visible to the visibility toggle on the camera in question. By hiding the camera with this switch the image planes associated with the camera all are hidden. Another method is to actually make a layer for the camera itself and hide or show the camera as needed.)
The manipulator tool allows you to edit cetain inputs that are not available in the channels box. Step 3. The geometry must be distributed across the image plane to approximate the shape of the dragons body. Using basic component level hull editing is a straight forward task to match the image plane reference.
Placing the source images for the dragon templates.
Stage 3.1 Edit the hulls from the side view by holding the RMB over the model and choosing the hulls option.
Step 2. Creating a primitive cylinder is the foundation of the dragon’s body. Stage 2.1 Use the manipulator tool and click on the NURBS cylinder inputs then translate the top manipulator and snap it to the grid on the Z axis. This lines up the cylinder’s hulls and the isoparameterization to prepare it for shaping to the imageplane.
Stage 3.2 Click on the end hull and use the translation tool to drag it to the edge of the Dragon’s tail. Stage 3.3 Click on the other end and drag it to the edge of the Dragon’s neck.
Stage 2.2 Edit the makeNurbsCylinder inputs to add some isoparm details to 8 x 12 sections and spans.
Stage 3.4 The edge hulls have a sort of companion hull that sits right next to it and needs to be brought along and kept relatively close and similarly oriented with regards to tangency.
Stage 2.3 After setting up the cylinder’s parameters delete the construction history to keep the model light. Go to Edit: Delete by Type: Delete History.
Stage 3.5 The rest of the hulls need to be evenly distributed across the rest of the Dragon’s body. Stage 3.6 Match the tail region paying close attention to keeping the width of the tail constant to avoid any strange and unwanted bulges resulting from a mis-shaped hull. 3
6
MAYA Character Animation
6
RU.MAYA 99
Step 4. The neck needs special detail work so that the skin and muscle at the base of the neck will have adequate geometry to use when doing articulated movements for later when you apply deformation skeletons to it. The original primitive cylinder was not created with enough isoparms to flesh out the outline, for a reason. When molding geometry it is often better to use as few details as possible to get the general shape down. Then when the form has partially been constructed and you add more isoparm details to edit with they will be added generally where they are needed, usually not requiring major tweaking and movement, unlike step 2 where we had to massively stretch some very rough details.
short, hmpph these analog constraints!) and work with the reference that you are given. It’s okay because the author strayed slightly from the original wing design anyway.
Stage 4.1 Set the display smoothness to “1” and the shading mode to wireframe with the “4 ”key. This reduced detail view helps isolate the existing parameterization and aids in the selection of the correct isoparms to start from.
Stage 5.4Also keep in mind the musculature required for a strong tail like this. The underlying bones in the tail are short and flexible and are more near the surface at the base of the tail centering as it approaches the tip. This kind of bone structure would produce a crest or ridge on the top side of the tail especially near the base where it attaches to the rear legs.
Stage 5.1Insert more isoparms to add details to the tail region. Stage 5.2Pinch the last isoparm’s hull to a close by scaling it to zero after inserting enough detail around the tip to allow the it to close without creasing or deforming the rest of the tail area. Stage 5.3Sculpt a nubby tip that could be used as the base for the tail fan blades.
Stage 4.2 Insert isoparms vertically to add resolution to the dragon’s body geometry first in the neck region. These are the ones that are like a necklace or collar. Hold down the RMB over the beast and choose Isoparm from the marking menu. Then choose Modeling: Edit Surfaces: Insert Isoparms.
Stage 5.5At this time we won’t yet add the horizontal isoparms that run the length of the body, waiting until after we bisect the model in half at step 7. This keeps the sides from having uneven parameterization and helps preserve the initial symmetricness that has been designed in from the beginning.
Stage 4.3 Repeat this process to match the image plane until you are sufficiently satisfied with the details. Try not to go off to much adding resolution, just enough for what is needed.
Step 6. The Torso needs its hulls to be both scaled in the X as well as the Y axis. Some extra isorparms will be needed to allow for the attachment of the wing joints and the creation of the nubby wing extensions that help facilitate this.
Step 5. Keep in mind adding and distributing enough isoparms to allow the tail to bend back to its original form. In general, 3D geometry prefers to bend into place more than it prefers to bend out of place. Note that the author acknowledges that the optimal way to model from an orthographic drawing is to have the shape prepared so it is stretched out to its extents, unlike the dragon’s orthographic side view that is provided. However, for the sake of staying true to the artists’ intentions one must put up with the illustrators’ creative quirks (the paper was too
Stage 6.1Fill out the central torso area and begin adding detail by inserting more isoparms. The chest area has a lot of details that need to added a bit at a time. The bird like ridge on the chest that many reptiles and avaians both share can be seen embedded in the design. Stage 6.2The wing nubbies need 4
RU.MAYA 99
MAYA Character Animation
“drumsticks” as in turkey dinner, musculature that is required to flap wings such as these. As no real creature known to the author exists that is a quadruped and has two additional wings we are forced to make up the anatomy and structure from scratch and/or use zoological and mythical reference and blend them with some imagination.
model. Instead it causes huge problems when doing blend-shape targets if you want to repeatedly attach and re-attach the two sides, each time adding more isoparms as the process goes on. Of course there are workarounds such as always leaving your pairs of symmetrical models un-attached until the very last file and then having one step in the past always saved and left untouched in case of edits that will inevitably be needed for something. Instead of trying to add the details needed for the wing socket twice, once on each side of the beast, it is far more practical to use one of the mirror methods. Keep in mind the reflection paint mode in artisan or just doing local area tweaks that don’t cause any of the CV’s to cross the zero point on the X axis. You can always fix any X axis “rebel” CV’s later by enabling grid snapping by holding down the “X “ key and dragging the point towards zero on the X axis working grid. Doing these kinds of fixes tends to waste too much time and is avoidable with proper planning and forethought.
Stage 6.3Either way the geometry must reflect some physics and anatomy thought so when the viewer is watching the beast come to life they are not distracted by improbable imagery. Be sure and keep these ideas in mind when sculpting the specific details of the wing muscles. Step 7. When adding isoparms horizontally and you wish your end result to be generally symmetrical like most humanoids and many beasts it is important to think of a few principles. If you are adding an isoparm on each side there is a very big chance that without using some sort of script for precision the two sides will be a little off. This small aberation can ripple through to create all sorts of strange anomalies and often annoying quirks preventing you from doing a trim correctly etc. In Alias Power Animator and Maya 2.0 one can successfully split a symmetrical object in half, delete the other half, edit the one either with an instanced mirror duplicate or with a normal mirrored duplicate and artisan’s multiple surface reflection paint mode. This form of modeling half of something is nothing original and has been done this way for centuries of conventional sculpture. Symmetrical modeling saves the artist time and to avoid the creation looking too uniform it is easy to add unique variations after the two halves have been re-fused. It’s at this stage that the 1.0 and 1.5 versions of Maya have their major weakness. Maya 1.x does not allow adequate re-seaming of both the front and the back sides of the bisected shape. Instead when attaching surfaces you are forced to use the open/close surface command which then adds an extra isoparm on either side of the edge of the surfaces to be closed. It does so apparently to preserve the original form of the
The next stages will cover how to split the body in two pieces and use artisan to mirror paint the muscle details on the remaining half and its new mirrored duplicate. Stage 7.1 Set the selected body geometry to rough smoothness display with the “1” key and the shading mode to wireframe with the “4” key. Select the top and bottom polar isoparms by holding down the RMB over the body then selecting the first one and shift selecting the other. With the yellow iso-markers still highlighted to Modeling: Edit Surfaces: Detach Surfaces Stage 7.2 Delete the right half because of an artisan bug anomaly that does not allow two halves of the same object to be reflection painted predictably. Remember to be sure to delete history and freeze transformations to reset the model. Stage 7.3 Duplicate the left half and then scale it to –1 on the X axis to mirror it over the origin. 5
6
MAYA Character Animation
RU.MAYA 99
Stage 7.4 Select both sides of the body geometry. Go to Modeling: Edit Surfaces: Sculpt Surfaces Tool: Settings. Go to the stroke tab and be sure that the settings for Reflection painting and Multiple Surfaces are both on.
Stage 8.3 Remove the construction history by deleting the history. Afterwards choose Modify: Freeze Transformations to reset the cylinders attributes to zero in it’s new origin. Step 9. The next step is to distribute the hulls according to the reference image plane and then to add resolution. The end goal will to have a mostly one piece wing arm model that includes the base all the way to the quasi-wing thumb and the three nub like foundations for the wing fingers.
Stage 7.6 Edit and tweak artisan’s opacity, brush size/shape, and max diplacement prefs while sculpting the geometry. Stage 7.7 To add more isoparm details delete R_side, return to Stage 7.3.
Stage 9.1 Hold down the RMB over the new leg model and then highlight the Hulls option from the marking menu.
Section B. Constructing the wings
6
Stage 9.2 Select the ring like vertical hull at the bottom edge of the new cylinder by clicking on the pink ring hovering around the top isoparm.
The construction of the wings membrane will require a new technique that has not yet been introduced. We will create an armature of several sets of NURBS curves and then perform a loft across them all to create the membrane that stretches between the bony finger like wing tips. The wing arm and wing fingers are made of standard primitive cylinders edited into place.
Stage 9.3 Translate it to the ankle region. Scale, rotate and transform the hull and all that follow to your best depiction of a wing arm, keeping in mind musculature and bone structure. Stage 9.4 Repeat with each hull until the object generally resembles the wing arm. Use the arrow keys to “pick-walk” through the hulls one at a time for easy editing. Make sure that the top isoparm smoothly approaches the main body’s wing nubby attaching region.
Sub-Section B.1 Creating the meat and bones Step 8. Create a primitive cylinder as the starting place for the new wing arm. Placement of a new primitive cylinder in the perspective view will help facilitate correct alignment in XYZ space.
Stage 9.5 When you have spread out all of the hulls it is time to insert more isoparms to up the resolution. Set the shading style to wireframe and the selected leg model to rough smoothness with the “4 and 1” keys RMB on the wing and choose isoparm.
Stage 8.1 Be sure to place the cylinder directly above the front the wing lump to insure that the isoparms will easily integrate with the main body.
Stage 9.6 Hold down the RMB and activate isoparm mode. Click drag then shift click drag more ring like isoparms across the length of the wing arm. When satisfied choose Modeling: Edit Surfaces: Insert Isoparms.
Stage 8.2 Set the “makeNurbsCylinder” inputs to 8x8 and adjust the radius to generally match the reference picture of the wing’s arm area loaded in the image plane.
Stage 9.7 Repeat hull editing technique until 6
RU.MAYA 99
MAYA Character Animation
the wrist extends to become a wing paw with a thumb like extension already attached. Make sure the tip of the thumb/claw is pinched closed smoothly. Pull out the geometry to form a sort of knuckle nub for each of the wing fingers to use as a foundation. Stage 9.8 Finish off the editing of the muscles and contours by using Artisan to tweak the geometry of the arm. Step 10. Create the wing fingers from hull edited primitive cylinders set to 8x12 spans and sections, replicating them to finish off placing the wings’ other digits. Parent the digits of the base wing finger together for easy replication.
Duplicate the fingers after reseting the pivot point.
Sub-Section B.2 creating the leathery wing membrane Step 12. Create a primitive Nurbs circle across the XZ axis and then scale it’s X axis down quite a way to become a very thin ellipse. Edit the points to become a crescent shape like a cross section of wing might look like.
Starting with a cylinder primitive and editing the existing hulls to match the drawing. Step 11. Replicating and scaling the rest of the fingers to match the image plane is a process of straight forward object duplication and manipulation. Set the pivot point to the base of the finger to aid in positioning using the translate tool and the insert key. Duplicate, Scale, Rotate and Translate the finished finger two more times and distribute them to match the reference art.
Starting the wings by creating a circle and deforming it to become the foundation for the lofted wing membrane.
Step 13. Before duplicating and distributing the edited circles display and offset the built in selection handles. Later when there is geometry covering the circles it will make them easier to select and edit. 7
6
MAYA Character Animation
RU.MAYA 99
Stage 13.1 Select the new crescent shaped Nurbs Curve and go to Display: Object Components: Selection Handles. Then enter component mode by hitting the function key F8. Then from the pick masks All On/Off pop up menu next to the component mode button choose all off. Then select the plus shaped selection handle pick mask. Stage 13.2 Draw a selection marquee around the curve’s new selection handle and with the translation tool offset the handle in the positive X direction a few units. Hit the F8 key to exit component mode.
6
Distribute duplicates of the curve after displaying and offsetting a selection handle for easy selection later.
Stage 13.3 Duplicate, CV edit, Translate, Scale and Rotate the loft target curves so there is a total of 10 of them the represent the wing shape. Place three in exact proximity to the bottom finger, one above, one below, and one in the middle. Place three below it towards the body. Place another curve half way between the base finger and the middle one. Also put one directly by the middle wing finger. Two more will go to the top (shorter) finger to form the upper mini wing area.
Step 14. The next step is creating a curve on surface for the base of the wing to seamlessly blend to. Select the bottom wing curve and then maneuver a camera to look directly at it with the Dragon body/torso directly behind it. Stage 14.1 Duplicate the curve before projecting it because the actual curve that we will project needs to be deleted after the projection and basic editing to preserve the construction history list. If you don’t then every time you edit the curve that did the projection the curve on surface would also change in the same way, causing unwanted changes in the wings’ surface. Stage 14.2 Select the projection curve (duplicated curve) name it for easy identification. Then shift select the torso and choose Modeling: Edit Surfaces: Project Curve on Surface. Remember the angle that your camera relative to the selected objects for projection is how the angle of curve projection will be calculated.
Edit the pairs of CV’s simultaneously.
Stage 14.3 If the projected curve does not look pleasing or useful then perhaps it either needs to be re-projected from a slightly different angle or edit the projection curve source curve floating above the torso itself for point level editing. When you are satisfied that the curve will work as the base attachment for the wing to 8
RU.MAYA 99
MAYA Character Animation
the torso move on and delete the duplicated projecting curve. Stage 14.4 Simplifying the shape will make a smoother loft. Rebuild the curve on surface making sure the settings have keep original on and then experiment and undo until you have about 16 knots and then display a selection handle for it as well.
Display and offset a selection handle for the rebuilt curve.
Step 15. It is time to try some initial test lofts. The order that you select the curves is important so keep that in mind. In general if you stay consistent such as front to back, top to bottom, left to right etc. then the result should look the same.
Projecting a curve on surface for the base of the wing membrane.
Stage 15.1 One by one from top to bottom select then shift select all of the wing curves except the top two for the upper mini wing but including the new curve on surface. Stage 15.2 Selection can be done alternately from the hyper-graph (assuming you named the curves logically) or if you set the Show preferences in an alternate viewports’ menus to not display surfaces, you could view your progress but still make easy selections. Stage 15.3 If the order was wrong or your curves are non-aligned when viewed from an angle then the membrane geometry could be messed up and thus not visually appealing. If this is the case hit the “Z” key and try again after perceiving your error. If it basically looks right but just needs a little tweaking then go on to the next step.
Rebuild the curve on surface to allow for a smoother loft. Locate and name the curves in the multilister for easy identification.
9
6
MAYA Character Animation
RU.MAYA 99
visible and editable. Try moving the CV’s one at a time. After selecting a single CV you can “pick-walk” to the next one by hitting the arrow keys. This saves time when doing minute detail editing.
Shift select each curve in order from bottom to top starting with the rebuilt curve on surface at the base ending with the top most isoparm. Carefully edit the membrane source curves.
6
Perform a series of test lofts, undoing the loft, doing minor edits to the foundation curves then re-loft. In two views mode set surface display off to allow easy editing of the wing curves.
Step 16. Correction can be accomplished in several ways. You can edit the the position of the component curves or their CV’s. You can also edit the surfaces of the new membrane geometry itself but that’s the next step.
Step 17. Smoothing the wing membrane geometry itself, if it needs anything, is the last step for modeling the wing. Use you favorite method of editing tools. Keep in mind that the wing is made of two sheets of geometry that are very close to each other, making certain, less delicate tools difficult.
Stage 16.1 Minor rotations, translations and scaling of the curves can result in significant change overall. Be very careful when doing so, and your finger near the “Z” key for undos. Stage 16.2 Try editing the curves components CV’s by highlighting the curve then holding down the RMB and choosing CV’s. This makes the curves components
Stage 17.1 Artisan does have a preference for detecting multiple surfaces that are nearly intersecting and editing them both similarly for a consistent appearance. This would help the 10
RU.MAYA 99
MAYA Character Animation
two wing membrane pieces to not pull away from each other. It is important to be cautious when using artisan to not let one side of the wing get too thick.
Try using a lattice deformer to retain volume and to keep the geometry’s seams together.
Section C. Modeling the front legs and digits
Stage 17.2 Various lattice types could be used to retain the general volume of the wing membrane.
Both of the front and back limbs are constructed very similarly in the initial stages. Keep in mind when modeling that the fore limbs are more like arms and rear legs are more like a horse or big cat. For stylistic reasons a three finger front paw and two toed rear foot has been decided upon.
Stage 17.3 Of course there is always the old faithful point by point method which often works quite well for minor detail work. Stage 17.4 After the stage where you are through smoothing you are urged to “save as” and experiment a little by embellishing the geometry with skin wrinkles and other close up details. Otherwise you can save that kind of work for the texture mapping pass where adding a bump and/or displacement maps will let you get much the same result with lighter geometry that is easier to set up.
Step 18. Create a primitive cylinder as the starting place for the new arm like front leg. Placement of a new primitive cylinder in the perspective view will help facilitate correct alignment in XYZ space. Stage 18.1 Be sure to place the cylinder directly beneath the front leg lump to insure that the isoparms will easily integrate with the main body. Stage 18.2 Set the “makeNurbsCylinder” inputs to 8x8 and adjust the radius to generally match the reference picture loaded in the image plane. Stage 18.3 Remove the construction history by deleting the history. Afterwards choose Modify: Freeze Transformations to reset the cylinders attributes to zero in it’s new origin.
Smoothing the wing membrane with artisan’s smoothing brush.
Step 19. The next step is to distribute the hulls according to the reference image plane and then to add resolution. The end goal will to have a mostly one piece leg model that includes the upper thigh on down to the tip of the inner toe. Stage 19.1 Hold down the RMB over the new leg model and then highlight the Hulls option from the marking menu. Stage 19.2 Select the ring like vertical hull at 11
6
MAYA Character Animation
RU.MAYA 99
the bottom edge of the new cylinder by clicking on the pink ring hovering around the top isoparm. Stage 19.3 Translate it to the ankle region. Scale, rotate and transform the hull and all that follow to your best depiction of a leg, keeping in mind musculature and bone structure. Stage 19.4 Repeat with each hull until the object generally resembles the leg. Use the arrow keys to “pick-walk” through the hulls one at a time for easy editing. Make sure that the top isoparm smoothly approaches the main body’s leg attach region.
6
Pinch the tip closed.
Stage 19.5 When you have spread out all of the hulls it is time too insert more isoparms to up the resolution. Set the shading style to wireframe and the selected leg model to rough smoothness with the “4 and 1” keys RMB on the leg and choose isoparm. Stage 19.6 Click drag then shift click drag more ring like isoparms across the length of the leg. When satisfied choose Modeling: Edit Surfaces: Insert Isoparms. Stage 19.7 Repeat hull editing technique until the wrist extends to become a palm/front paw with an inside finger/claw already attached. Make sure the finger/claw is pinched closed smoothly.
Insert more isoparms to up-res the model.
Step 20. Make sure a solid palm/paw is formed as you sculpt the arm, making sure that there is enough of a flair near the knuckles for the future thumb and pinky to be attached. Use CV and hull editing for precise geometry manipulation.
Match the hulls to the muscles.
12
RU.MAYA 99
MAYA Character Animation
A perspective and side view of the arm progression.
Adjust the shoulder and arm to have a smooth flowing appearance as it transitions to the torso.
Step 22. The next step is to create a pinky and thumb for the arm. The finger objects will be created by duplicating the front leg and then detaching the middle finger to be used as the source for new digits. Stage 22.1 To create the outside fingers duplicate the leg model and then scale it to –1 on the X axis. Move it over to an area that is easy to get at and then select an isoparm at the base of the knuckle. Choose Modeling: Edit Surfaces: Detach Surfaces: Settings. Make sure keep original is off. Detach then delete the extra arm geometry. Move the finger back to the palm region of the original arm. Repeat with out the X scaling or duplicate and alter the pinky to create the thumb. Either way try using the work that you have already completed as source for work that you still need to do.
Forming the finger and palm from the base of the arm.
Step 21. The arm as it is needs to have some details added to it. Sculpting muscles and adding detail to the torso to aid in musculature integration will be necessary. The torso needs to be adjusted so that the arm and shoulder appear to function together naturally. Add Use the Sculpt Surfaces Tool and if you have to go ahead and insert additional isoparms for added details then do so, just remember that light geometry is preferable.
Stage 22.2 Using hull editing techniques merge the finger near the arm. Later we will decide whether or not to use fillet blends to create geometric integration or to use the transparency masking blend method. The decision will be based on how you are planning to view the creature in the camera shots. Super close ups will require fillet blends and normal distance shots can allow a lighter modeling method with out any trims or blends needed.
13
6
MAYA Character Animation
RU.MAYA 99
Extend the neck to become the head, hull editing the new isoparms that have been inserted.
Select a knuckle isoparm on a duplicate arm, detach surface then delete the arm fragment to generate fingers and thumbs.
Section D. Forming the Head
6 Step 23. Create the bottom of the skull from the end of the neck-torso model. First you must delete the R_side. Next add the new isoparms, then hull edit to match the image plane, and then mirror the result to prepare your model to be sculpted into shape. Flattening out the nose prepares the foundation for the head.
Stage 23.1 Insert isoparms by holding down the RMB over the model and choosing isoparpm from the object component marking menu that appears. Mark several new isoparms that will provide enough resolution that you can easily pull out the details required. Stage 23.2 Edit the hulls to match the drawing. Use the translate tool and scale only in the Y axis to preserve the half shape’s X axis CV’s. The fine detail sculpting will happen when the mirror side is in place. Stage 23.3 Mirror the L_side by either using the MEL script or use Duplicate –1 scale on the X axis. Make sure that the new object is properly named. Now you are ready for some more artisan sculpting with reflection brush.
Mirror the torso to check your progress. Step 24. To edit the bottom of the head area use a combination of Artisans Sculpt Surfaces Tool and try adding a lattice just to the region 14
RU.MAYA 99
MAYA Character Animation
that needs edit. Stage 24.1 Make sure both halves are selected. Activate Artisan’s Sculpt Surfaces Tool. Proceed to edit the contours of the lower jaw region. Stage 24.2 Another method is to add a deformation lattice to selected CV’s for both halves and this allows easy simultaneous editing of both sides. In the side view go to component editing mode by hitting F8. Make sure the component pick masks are set to CV’s only. Then select the head regions CV’s. Go to a perspective view to verify that both sides have selected CV’s. If they do then go to Animation: Deformation: Lattice: Settings. Make sure that group with base is activated and auto-Center on selection is activated as well. Now when you add the lattice it should be centered on the selected CV’s. If the lattice needs to be moved around be sure and select the lattice’s group node by hitting the up arrow with the lattice selected, then use the translate, rotation or scale tools to maneuver it to the desired location. When editing the inputs of the number of lattice points you will need keep in mind the level of detail that you require for the edits and add them before doing any lattice point tweaks. Then scale, rotate and transform the lattice points until you are satisfied. When you are sure that you don’t need the lattice anymore select both sides and choose Edit: Delete by type: Delete History.
Use artisan to sculpt the lower head area making a cavity for teeth and gums.
6
Try direct CV editing to move chunks of geometry around. Be precise and symmetrical about which CV’s you pick at this time.
Stage 24.3 After using these techniques there is also the more manual method of selecting a hull on one side then shift selecting a hull on the other side. It takes longer but it is the most precise method. When both hulls are selected the scale tool works correctly allowing uniform scaling around the proper center of the object.
Place a lattice around the highlighted CV’s in the head region. Translate, rotate, and scale symmetrical groups of lattice points to achieve useful results. 15
MAYA Character Animation
RU.MAYA 99
Close up on the lower head’s inner jaw region.
Step 25. Make sure that the tip of the chin of the lower jaw is pinched seamlessly by zooming in and verifying it. Scale the hull or chin CV’s until it pinches seamlessly. Be sure and zoom out to check for any surface errors caused by overlapping geometry.
6
Step 27. Create a primitive sphere for the top of the skull. Using the translation, rotation and scale tools form the primitive sphere into the general shape of the head. Do not use component level editing until after the sphere is been intitially shaped and until after the mesh resolution has been decided. If you component edit before you change the level of detail of the primitive sphere there will be strange results upon altering the sphere’s input mesh resolution. This is because the sphere’s components have a list of parameters that have labels. When new components are added to sphere because of an increase of decrease in the number of spans and sections or start/end sweep degrees the topology is altered but the remaining geometry still is numbered as it was. New geometry is added or removed from the base of the object when the parameters are altered. If it is too late and you wish to add resolution that is a simple task done using a tool found under Modeling: Edit Surface: Rebuild Surfaces: Settings. With Rebuild Surfaces you can add or subtract resolution. The tool is a bit dangerous though because it will often give you results that don’t look exactly the way you want. The tool can be used fairly interactively by leaving the tool settings window and alternately trying different settings and hitting “Z” to undo the result before closing the dialogue box. This way you can experiment until you reach a setting that you can feel will achieve your goals. Assuming that you follow this example the Rebuild Surfaces Tool will not be necessary at this time. Always keep in mind that the insert isoparm tool is a much more precise way to add resolution to a model.
Pinch the chin seamlessly by zooming in very close. Make sure that you do not scale in the negative units.
Step 26. Collapse the whole lower jaw region up to the base of the neck. Imagine a circle. Now imagine taking the CV’s from the top half and aligning them with the bottom half but slightly above so that there are no intersecting vertices. That way the lower jaw is significantly concave to allow the placement of the teeth, gums and tongue. Return to “Step 24” until the lower head region is sufficiently carved away then proceed to “Step 27”.
Stage 27.1 After shaping the sphere to approximate the top of the skull go to Edit: Delete by type: Delete History to clear the model’s construction history. Then choose Edit: Reset Transformation. 16
RU.MAYA 99
MAYA Character Animation
tab and be sure that the settings for Reflection painting and Multiple Surfaces are both on.
Stage 27.2 Insert several isoparms horizontally to prepare the sphere to be edited. Hold the RMB down over the skull object choosing isoparm and then mark several isoparms between the nose and the neck left to right by shift clicking on an existing isoparm and dragging out additional yellow isoparm markers. Then choose Modeling: Edit Surfaces: Insert Isoparms.
Stage 28.2 Proceed to push and pull details until the top of the head looks acceptable. Remember to add nostrils, eye sockets (a reference eye ball sphere is good to put in place), face and head spikes. Stage 28.3 For some extra details try applying a lattice to the upper skull models and the CV’s in the lower jaw region of the main body geometry. Then with a combination of lattice point and CV point pulling edit the form of the entire head more fluidly. After completing the work with lattice select all the geometry that the lattice was placed on and choose Edit: Delete by type: Delete History to remove the lattice yet retain the deformation effect desired.
Stage 27.3 Use the Hull editing technique to adjust the skull’s isoparms with the standard transformation tools until they closely approximate the image plane. Return to Stage 12.2 if the skull needs more resolution. Before adding any vertical isoparms (the ones that go the length of the skull) to remain symmetrical you must first separate the sphere in half much like you did with the body earlier. Select the top and bottom isoparms as if inserting new ones then choose Edit Surfaces: Detach Surfaces. Delete the right half and then select the other half and Duplicate and -1 X scale the new object to mirror it’s original half.
Stage 28.4 Finally to add special details to the head such as nubbies that will be used to attach the horns straight up CV editing is best. Remember to delete half of the head and do the point editing on one side then mirror the result to save you time and to look consistent.
The top of the head begins as a primitive sphere. Bisect then mirror duplicate the head to allow reflective editing in artisan.
Step 28. Shaping the top of the skull with artisan’s reflection tool and other detail adding techniques. Stage 28.1 Select both sides of the skull geometry. Go to Modeling: Edit Surfaces: Sculpt Surfaces Tool: Settings. Go to the stroke 17
6
MAYA Character Animation
RU.MAYA 99
Use a lattice on the head for intresting effects. Try a lattice around both the CV’s of the bottom of the head with the top of the head in one lattice.
Create a new primitive cone. After creating the object edit its inputs to start it off with enough geometry.
Step 30. Scale the X axis down so that the tail spike is much thinner and then delete the history and freeze the transformations.
6
Step 31. Pull points in the component mode to match image plane. Think about rotating isoparms on their side to stretch out some of the vertical spikes. Step 32. Offset the center point then Duplicate and edit the spikes to distribute and personalize the other tail spikes. Still needs a lot of work!
Section E. Sculpting the tail spikes
Stage 32.1 Make sure the translation tool is on then hit select the cone. Hit the insert key to place the pivot at the base of the cone spike. Make sure that you only move the pivot in the Y and Z axis by using the green and blue colored arrow icons on the translation manipulator.
Step 29. Beginning with a Nurbs primitive cone. Set the sections and spans to 8x4. Translate on the Z and Y axis to place the cone over the image plane reference art. Adjust the radius to the approximate width of the widest spike.
Stage 32.2 Duplicate, rotate and then CV edit to distribute and personalize the next spike to match the reference art or to your own preference. Stage 32.3 Repeat step 32.2 three more times to complete the tail fan.
18
RU.MAYA 99
MAYA Character Animation
Section E. Shaping the rear legs, toes and spikes
one at a time for easy editing. Make sure that the top isoparm smoothly approaches the main body’s leg attach region.
Step 33. Create a primitive cylinder as the starting place for the new leg. Placement of a new primitive cylinder in the perspective view will help facilitate correct alignment in XYZ space.
Stage 34.5 When you have spread out all of the hulls it is time too insert more isoparms to up the resolution. Set the shading style to wireframe and the selected leg model to rough smoothness with the “4 and 1” keys RMB on the leg and choose isoparm.
Stage 33.1 Be sure to place the cylinder directly beneath the rear leg lump to insure that the isoparms will easily integrate with the main body.
Stage 34.6 Click drag then shift click drag more ring like isoparms across the length of the leg. When satisfied choose Modeling: Edit Surfaces: Insert Isoparms.
Stage 33.2 Set the “makeNurbsCylinder” inputs to 8x8 and adjust the radius to generally match the reference picture loaded in the image plane.
Stage 34.7 Repeat hull editing technique until the ankle extends to become a foot with an inside toe already attached. Make sure the toe is pinched closed smoothly.
Stage 33.3 Remove the construction history by deleting the history. Afterwards choose Modify: Freeze Transformations to reset the cylinders attributes to zero in it’s new origin.
Step 35. Next we will create the embilishments that will add some detail to the leg such. Create the heel and ankle spike from primitives. The outside toe object will be created by duplicating the leg and then extracting the toe component.
Step 34. The next step is to distribute the hulls according to the reference image plane and then to add resolution. The end goal will be to have a mostly one-piece leg model that includes the upper thigh on down to the tip of the inner toe.
Stage 35.1 Use a primitive cone for the heel and ankle spikes. Use scale, rotate and transform to approximate the general shape of the horny protrusions. Use component editing of the hulls to give each spike some unique character.
Stage 34.1 Hold down the RMB over the new leg model and then highlight the Hulls option from the marking menu.
Stage 35.2 To create the outside toe duplicate the leg model and then scale it to –1 on the X axis. Move it over to an area that is easy to get at and then select an isoparm at the base of the toe. Choose Modeling: Edit Surfaces: Detach Surfaces: Settings. Make sure keep original is off. Detach then delete the extra leg geometry. Move the toe back to the foot region of the original leg.
Stage 34.2 Select the ring like vertical hull at the bottom edge of the new cylinder by clicking on the pink ring hovering around the top isoparm. Stage 34.3 Translate it to the ankle region. Scale, rotate and transform the hull and all that follow to your best depiction of a leg, keeping in mind musculature and bone structure.
Stage 35.3 Using hull editing techniques merge the toe near the leg. Later we will decide whether or not to use fillet blends to create geometric integration or to use the transparency masking blend method. The decision will be
Stage 34.4 Repeat with each hull until the object generally resembles the leg. Use the arrow keys to “pick-walk” through the hulls 19
6
MAYA Character Animation
RU.MAYA 99
introduced in the Part I steps 21 – 23 covering the construction of the hand you can create a curve on surface on the paw or foot to be used as the foundation of the fillet blend.
based on how you are planning to view the creature in the camera shots. Super close ups will require fillet blends and normal distance shots can allow a lighter modeling method with out any trims or blends needed.
Stage 37.2 After creating the curve on surface trim the curve on surface and create a fillet blend spanning the gap to blend the geometries together.
Step 36. Sculpting muscles and adding detail to the main body torso to aid in musculature integration is necessary to actualize a smooth and flowing body design.
Stage 37.3 Instead of fillet blends you can also build a gradient ramp or gray scale image to make a transparency map that causes the geometry to artful go transparent where the blend is to occur. However this technique is tricky and needs to have the model be finessed for this effect, making sure that the surfaces have just enough overlap to achieve the effect.
Stage 36.1 Use artisans Sculpt Surfaces Tool to fluidly add muscle details to the leg. Remember to keep opacity and Max displacement set low to avoid any extreme changes, resulting in unwanted lumps.
6
Stage 36.2 If necessary for the detail level that you wish to achieve go ahead and add some extra horizontal isoparms (the ones extending from toe to thigh). Return to sculpting with artisan’s brush set.
Step 38. Integrating the leg to the body with Fillet blend or transparency mask. Stage 38.1 Much like the recommended step for Step 37 make a curve on surface to act as the blend foundation.
Stage 36.3 Select the main body torso models and begin to add some extra detail to the rear leg/rump region using artisan’s Sculpt Surfaces Tool. Remember to activate the reflection and multi-surface stroke options so you can paint on both halves at the same time.
Stage 38.2 Continue to trim and blend the pieces together. Stage 38.3 Transparency maps can save processing time and do offer lighter geometry but are a tricky way to work and should be given adequate time for experimentation.
Stage 36.4 Verify that the geometry flows together visually going back and forth between editing the main body and the leg with artisan’s brushes.
Step 39. You can add horns and spikes. The animated sweep tool allows for interesting spiral and twisted horn variations.
Special Appendix.1
Stage 39.1 First key frame animate a closed curve on a path that appears much like the way the horns you wish to fabricate would look.
Section G. Making the model seamless and detailed
Stage 39.2 Animate the curve shrinking to zero, this will make the horn be closed at one end.
Step 37. Integrating the toes and fingers to the leg and arms with Fillet blend or transparency mask.
Stage 39.3 Choose Modify: Animated Sweep: Settings and experiment with the step count by changing the By time feature. This is
Stage 37.1 By using techniques like those 20
RU.MAYA 99
MAYA Character Animation
the parameter that says how many times a cross section is sampled down the animation path. The Start and End time must be set to the point on the time line where you made the start and end keyframe for the curve. Now for a call to action, here is what to do
6
21
CHAPTER 7 - Character Animation
MAYA Character Animation
RU.MAYA 99
frustrating experience if you start animating a very complex scene if you haven’t experimented with and discovered some of the basic rules of animation. Over time you will develop your own instincts and methods for animating 3D characters. You will quickly be able to see when motion appears correctly or incorrectly. This chapter will cover different methods for animating your 3D character in Maya. Along the way we will look at some basic animation «rules» to keep in mind as you animate. We will also look at methods for improving your animation workflow in Maya as well. Then we will finish by looking at some special animation scenarios and how we would solve them in Maya.
I. INTRODUCTION We will now look at the process of animating our 3D characters. The basic idea is to «pose» your character at different frames in time. You record each pose in time as a «keyframe». Maya then interpolates how your character gets from each keyframe, with help from you, the animator. The most challenging aspects of the character animation process is first achieving strong poses with your character and second, achieving the correct timing between these poses. Being able to pose your character properly is highly dependent on how you modeled and setup your character with its IK skeleton. The way you time your character between poses is dependant upon your understanding of motion and the way things move.
7
II. ANIMATION - THE BASICS FRAME RATE - establish fps at beginning of project
One of the best ways to start «understanding» motion is by observing the world around you. Watching people, animals and objects is a great way to understand how things move. Observe people walking down the street. Watch a dog walking/running in the park. Observe yourself moving and doing different things. Use a stopwatch to get a feel for how much time it takes for something to move. Video tape is another great method for studying how things move. Video tape allows you to record the motion of things, then play it back as many times as you want at any speed. You can even play the video back frame-byframe, this essential for breaking down complex or subtle motions. For stylized or exaggerated motion, like what you may see in cartoon animation, cartoons and comics from the traditional masters is another way of examining timing and animation techniques. Let’s not forget though, that just starting to animate is important as well. It is best to start with simple and straight-forward animation situations. You will see many beginning animators starting with a «bouncing ball». This may sound too easy, but it is a great exercise in timing. Later on, you can work up to more complex animations. It can be a very
GRAPH EDITOR (EDITING VALUES AND TIME, ACCELERATION/ DECELERATION) - show something like an arm rotating and tie it into the curves in the Graph Editor.
II. METHODS OF ANIMATING 3D CHARACTERS
It is always a good idea to start with some sort of road map of what you want to animate. This should be in the form of a storyboard or series of sketches of what you want to do with 2
RU.MAYA 99
MAYA Character Animation
your character. It is good to try and previsualize your animation as much as possible before executing anything on the computer. Even if it is in your head, play it over and over in your mind and get a good sense of what the character needs to do. Try to «be» your character, challenge yourself to get out of your seat and act out the animation of your character. Use a stopwatch and time yourself as you act out the actions for your character. This is really important for the animator, physically getting into the character and getting a feeling for the timing and how your character will need to move from point A to point B. Don’t be shy, you will find see some of the best animators jumping around like crazy people trying to flush out the timing and movements for their characters. In addition After you have your animation idea down on paper, you then need to determine how you will go about animating your 3D character. There are numerous methods that an animator can use. Some methods lend themselves to specific animation situations. In other situations you may use a combination of methods to animate your character. There may be methods that you may prefer over others. Over time you may develop your own personal methods to approaching the animation of 3D characters. Let’s take a look at several different methods for animating 3D characters, we’ll note the strengths and weaknesses of each method. Again, in some situations, you may use a combination of methods.
approach the engine, raise his wrench, start pounding the engine with the wrench, then step away from the engine somewhat ashamed for breaking the engine. The animation just evolved section by section. The character walking toward the engine was finished before going onto animating the character raising the wrench. The strength of this method is that the animation doesn’t look too «pre-planned», the actions of the character are somewhat improvised along the way. Keep in mind, during the animation process, particular rules of animation were followed such as «followthrough» and «timing». One of the weaknesses of this method is also that it is not pre-planned. In some cases, you can start animating, get half-way through the animation and discover that the animation is not working. It is essential that you have a clear vision of what you are going to do. This method is probably best when you have a bit of animating experience.
B. Pose to Pose
A. Straight Ahead Animating your character in a «straight ahead» manner involves some improvisation and spontaneity by the animator. There may be a general idea of what your character may need to do in the scene, but, in general you just start animating. You build up your animation section by section, starting at the beginning. In this example, we have a character animated straight ahead. It was known at the onset that the character is supposed to «fix the engine». The animation started by having the character just
The «Pose to Pose» method is great for characters who must be animated through a series of very distinct poses. Each pose of the character conveys an idea or action. Each pose can be thought of as the traditional 2D «keypose». Once the poses are established, the animator must determine the speed/timing between the poses and how the character moves from pose to pose. In this example, we have a lion jumping through a flaming hoop, from one platform to 3
7
MAYA Character Animation
RU.MAYA 99
another. The keyposes for the lion are: standing, crouching down, begin jump, jump in the air, landing and standing on the platform. Using photographs and video for reference, the lion was posed. The lion jumping in midair is one of the most distinct poses that needed to be achieved. The lion is posed in each position and then keyframed every 10 frames. For the lion then we have at frame 1 standing, frame 10 crouch down, frame 20 begin jump, frame 30 jump in air, frame 40 landing, frame 50 standing on platform. Spacing the poses 10
3. Open the Script Editor. Under the File menu, open the lionPose1 script from the AnimationScripts directory on the CDROM. 4. You will see the input area of the Script Editor with the lionPose1 script. This MEL script basically just sets attributes for various parts of the lion. For instance, it contains settings for placing each foot in position, the back, the head and neck. Select the text for the lionPose1 script and middle mouse button drag to the Lion tab on your shelf. You now have a button which poses the lion in the first pose, standing. 5. Repeat steps 3 and 4 for the lionPose2 - 6 scripts. You should end up with 6 MEL icons in your Lion shelf. Click on each MEL icon and you will see the lion take on different poses. These MEL scripts were created using the recordPose.mel script which is available in the AnimationScripts directory on the CDROM. This scripts «records» the settings of attributes for the selected objects. In the case of the lion, the feet, back cluster (for the spine) and the lionControl locator were selected first, then the recordPose.mel script was executed. The attribute settings are recorded to the «history» section of the Script Editor, highlight the list of «setAtttr» commands and middle mouse drag it to the shelf. Each time you click that MEL icon it will set the attributes of those objects.
7 frames is arbitrary, spacing the poses makes it easier to start seeing how the lion is going between each pose. Once the poses are keyframed, you must then start working with the timing between the poses. We have to determine how fast or slow the lion goes through its poses. For instance, the timing of the lion going into its crouch pose would be slower than when the lion goes into its leaping pose because it is a quicker movement. 1. Open the lion.mb scene file. 2. Create a «lion» tab on your shelf, we will use this for MEL scripts to help us with animating the lion. Go to Options->Customize UI->Shelves... . Go to the Shelf tab and click the button New Shelf. Name the shelf Lion.
4
RU.MAYA 99
MAYA Character Animation
entire animation. One of the weaknesses of the pose to pose method can be managing all of the keyframed objects of your character. For instance, all four feet, the back, the neck and head need to be keyframed to hold the lion in each of its keyposes. You will have to keep track of all of these objects when adjusting poses and timing between poses.
C. Rotoscoping Rotoscoping is the process of matching the movement of your 3D character to a sequence of 2D images. For instance, shoot some video of somebody throwing a ball, digitize the video into your computer (with any video capture card), and save the digitized video as a sequence of image files or as a movie file. These files can then be loaded into the background 3D views, where you can then pose your character using the background images as a reference. The following steps demonstrate how to load a movie file into the perspective window to use for rotoscoping. (ROTOSCOPING EXAMPLE THROWING BASEBALL?) 1. Open the file pinRoto.mb.
6. Load the keyframeLion.mel script from the AnimationScripts directory on the included CDROM. Drag the script from the Script Editor to the Lion tab on your shelf. When executed (clicked), this script will keyframe all of the necessary objects of the lion. Later on in this chapter we will discuss how to automate the keyframing process with the MEL language. 7. Set the time slider to frame 1. Click on the lionPose1 icon, then click on the keyframeLion icon. You have just set the pose for the lion and keyframed the position of the lion at frame 1. 8. Set the time slider to frame 10. Click on the lionPose2 icon, then click on the keyframeLion icon. 9. Repeat these steps until you have all six poses of the lion keyframed 10 frames apart. You will end up with lionPose6 at frame 60. 10. Slide the time slider from 1 to 60. You will see the lion going through its series of poses. From here you would start working on the timing of the lion between the six poses. Open the Lion.QT movie to view the lion animation going through several passes of refinement. The strong points of this method is that it is a very intuitive and methodical approach. It follows the traditional workflow of 2D animation. You start with strong, easily identified character poses, then time between those poses. The quality of your animation relies heavily on how well the character poses relay a message or idea to the audience. If one of the poses is incorrect, it could throw off the
2. View->Select Camera. Open the Attribute Editor. 3. In the Attribute Editor under Environment go to Image Plane and click on the Create button. This creates a default «Image Plane» node for the selected camera.
5
7
MAYA Character Animation
7
RU.MAYA 99
4. In the File section of the Attribute Editor, browse for the images bballRoto in the animation directory on the CDROM. You can select any frame in the sequence to load it into the image plane. 5. Set the time slider to frame one. 6. In the Attribute Editor for the Image Plane, click on the box next to Use Frame Extension, this tells Maya that you are loading an image sequence into the Image Plane. When you click on Use Frame Extension you will see the Frame Extension area underneath become editable. Make sure that Frame Extension is set to 1, then over the word Frame Extension, right mouse button click for a pop-up menu then go to Set Key.
You have now keyed the Frame Extension of the Image Plane from frame 1 to 100. As you now update the time on the Time Slider, you will also see the image sequence in the Image Plane Update. You now need to match the view of the character with the images of the Image Plane. The Image Plane stays locked to the character, so wherever you move the camera, the Image Plane will always stay locked right in front of the view of the camera. You can tumble, pan, zoom, translate or rotate the camera to line up the Image Plane and character. 8. Go to frame one in the Time Slider, move the camera to line up the Image Plane with the camera. It won’t be a perfect match because of the proportion differences between the actor on the Image Plane and our cartoony character. Just try to get the angle correct and line up the feet of the actor on the image plane with the feet of the 3D character. You may also want to zoom the camera in or out to get the size of the actor on the Image Plane close to the size of the 3D character. After lining up the 3D character you may want to either set a keyframe for the camera or lock the camera attributes (Select the camera, highlight the transform attributes (translate and rotate) in the Channel Box, then right mouse click in the Channel Box for the pop menu to Lock Attributes.
7. Set the Time Slider to the end of the animation, frame 100. Go back to the Attribute Editor and set the Frame Extension to 100, then set a keyframe for the Frame Extension at frame 100.
6
RU.MAYA 99
MAYA Character Animation
arms, back, neck etc.) to detailed body parts (fingers, ears, eyes, facial parts etc). This method is great for animating subtle and complex motion for your 3D character. By using the footage as a guide for your animation, you will be able to pick up on the subtle nuances of motion and timing. This method is also great method for learning about how things move. It is very similar to pose to pose with the additional image references. In addition, rotoscoping is essential for matching «live action» footage. If you are animating a character that will later be composited into video or film, it is essential that you have footage you can use to match timing and camera angles to. Some of the weaknesses of this method include the difficulty of obtaining the proper footage for you animation situation. Especially when animating imaginary characters, imagine finding video for an 18 legged beast! However, you could always grab a video camera and record yourself hopping around like a 18 legged beast. Another problem can be «lining up» your 2D rotoscoping imagery with your 3D character. Often times it is difficult to rotoscope to footage in perspective. Using video shot from the side or front can be more straightforward. Reference footage shot in multiple angles, such as side and front can be helpful too.
9. Now you can start animating. Select both feet and the pelvis (you can select the three Selection Handles behind the character), then set keyframes for the translate attributes in the Channel Box. You can deal with the arms later. 10. Go to frame 10. Position the feet and pelvis to match the actor in the Image Plane. Once you have positioned the feet and pelvis, set a keyframe at frame 10. Animate the feet and the pelvis every 5 or 10 frames one time through to frame 100.
D. Layering The process of animation can also be approached in a «layered» approach. Layering the different aspects of your animation can be compared to painting or drawing. The general idea/design is sketched in, then the fine detail is gradually added. The detail is added only after the basic framework has been established. The same method can be used when animating a 3D character. You want to first start with general, overall movements, then add detail later on. For example, if you wanted to animate a character walking from one end of the room to the other to pick up an object on a table, you would start by first animating the feet and pelvis of the character getting to the table before animating the arms and hands picking up
This is your «blocking pass». You will rotoscope your character in many passes. You will start with roughly blocking in the poses of the character to match the Image Plane. Then rewind back to frame 1, and fine tune the motion until it matches the Image Plane images more exactly. It is a good idea to also start with the main body parts first, like the feet and pelvis, then once you have blocked those to the image plane, then go on to the arms, then back then neck and so on. Work with your animation from general body parts (feet, pelvis, 7
7
MAYA Character Animation
RU.MAYA 99
the object on the table.
2. Change the default keyframe interpolation and the frame rate for our animated walk cycle. Go to Options->General Preferences. Click on the «Animation» tab. In the «Keys» section of the Animation Preferences, set the Default In Tangent and the Default Out Tangent to «Flat». This interpolation type will give us a nice «ease in» and «ease out» of keyframes that we set. Click on the multiple tabs at the top of the General Preferences window and go to the «Units» tab. Set the time to «NTSC (30 fps)».
1. Open the file bipedWalkStart.mb. This file is the finished biped you worked on in the previous chapter (chapter 6). You can use the hiResLowRes.mel script to switch between the high and low resolution models on the biped skeleton. You probably would want to use the low resolution model for this exercise so your interaction with the character is much faster.
7
We will be using the bipedRoot, leftFoot and rightFoot nodes to animate the pelvis and each of the feet to start. You can access theses objects by selecting the selection handles that have been placed behind the character. For the arms and other parts of the body we will use custom attributes that have been added to the locator in front of the character (as covered in the previous chapter).
We will animate the walk of our character at 30 frames per second of animation. This frame rate works well for animation that will be put to video tape. 3. Position the character in the starting position for the walk. Select the rightFoot selection handle and move the right foot back slightly . Select the leftFoot selection handle
8
RU.MAYA 99
MAYA Character Animation
1 to 100 on the range slider . Hit the rewind
and move the left foot slightly forward . Select the bipedRoot selection handle and move the
button on the playback controls to set the current frame to one. Select the leftFoot selection handle and shift-select the rightFoot and bipedRoot selection handles. In the channel box, highlight Translate X, Y and Z. Right mouse button click and hold to get the channel box pop-up menu and go to «Key Selected». You have just set a keyframe at frame one for the translate channels of the pelvis and feet. Later on in this chapter we will discuss how to create «macros» using the MEL scripting language to automate the keyframing process. 5. Set keyframes at frame 20. Select the rightFoot and move it forward along the Z axis, ahead of the left foot . You will notice that the
pelvis down slightly to add a slight bend in the legs, we want our character to have a natural bend in the legs at the start of the walk .
pelvis is left behind. Select the bipedRoot node and move it forward along the Z axis so it lies between the two feet . Select the selection handles for the two feet and the pelvis and set a keyframe for translate x,y,z in the Channel Box.
4. Set the initial keyframes for the pelvis and feet. Set the frame range of the animation from 9
7
MAYA Character Animation
RU.MAYA 99
60, 80 and 100. At frames 60 and 100, the right foot should be ahead of the left foot. At frame 80, the left foot will be ahead of the right foot. Continue to keyframe the translation of the pelvis at frames 60, 80 and 100 to keep it centered between the feet. 8. Rewind the animation and hit the «Play» button. The biped character should be «sliding» its feet forward for about 5 steps. At this point the animation looks pretty stiff and unconvincing. However, this is just our first pass at animating the character. With each pass through the 100 frames of animation, we will refine and add new motion to the character
7
You can «scrub» through the animation you have just keyframed between frames 1 and 20 by dragging the time slider bar back and forth along the time line. You will see how Maya is «interpolating» the motion of the pelvis and two feet between frames 1 and 20. Although the left foot has not moved from frame 1 to 20, we still set a keyframe for it to ensure that it remains in place until the right foot has stopped moving. 6. Set keyframes at frame 40. Select the leftFoot selection handle and translate it along the Z axis so it is ahead of the right foot. Again, the pelvis lags behind, select the bipedRoot and move it so it is centered between the left and right feet . Set a keyframe for both feet and the pelvis translation in the Channel
.
Box. 7. Repeat the alternating movement of the right and left feet while keeping the pelvis centered for the rest of the time range. Set keyframes for both feet and the pelvis at frames 10
RU.MAYA 99
MAYA Character Animation
Scrub through the animation again with the Time Slider from framed 1 to 20, watch how the right foot lifts off the ground at frame 10 then lands back on the ground at frame 20. Repeat the keyframing of the right foot lifting off the ground at frames 50 and 90. 10. Keyframe the Y translation of the leftFoot using «copy and paste» in the Time Slider. Select the leftFoot and set the current time to frame 30, this is the first «in-between» step of the leftFoot. Translate the leftFoot up along the Y axis and set a keyframe for translate Y in the Channel Box . Take a close look at
9. Lift the feet off the ground at the middle of each step. Select the rightFoot and set the Time Slider to frame 10, this is the «inbetween» step for the right foot. Translate the rightFoot on the Y axis so it is raised above the ground. Highlight only the Translate Y channel of the rightFoot in the Channel Box and Key Selected in the Channel Box pop-up menu .
the Time Slider, you will notice thin, red, «tick» marks. These represent keyframes for the
11
7
MAYA Character Animation
RU.MAYA 99
«Paste» to paste the copied keyframe at frame 70. When you «shift-click» at a frame in the Time Slider then paste the keyframe(s), you are «inserting» keyframes with out moving other keyframes back. You can also «Paste» keyframes without «shift-clicking» on the frame you wish to paste, this will paste the keyframes and «push» over keyframes to the right. Pushing the keyframes over would be good if you had to insert a range of keyframes in the middle of an animation and push the existing animation later in time. 11. Animate the pelvis moving up and down on the Y axis. When the feet of the character are at their widest stride, the pelvis should be somewhat lower . As the feet go through mid-
selected objects, in this case the leftFoot. While at frame 30, position your mouse in the Time Slider and right mouse click to get the Time Slider pop-up menu and go to «Copy». You have just copied the Y translate keyframe for the leftFoot . Go to frame 90, which is the next
7
stride, the pelvis will lift up slightly higher
frame at which the left foot should be off the ground. In the Time Slider, shift-click on the time slider at frame 70, it will turn red . In the Time Slider, right mouse button click and go to
along the Y axis. We will use «Auto Key» to help automate the keyframing of the bipedRoot node. Activate «Auto Key» by clicking on the «Key» icon in the lower right hand corner of the interface . We have existing keyframes on 12
RU.MAYA 99
MAYA Character Animation
30 where the left foot lifts off of the ground and shift the bipedRoot over the right leg .
the Y translate of the bipedRoot already. With Auto Key activated, anytime you change the value of the Y translate at a particular frame in time, Maya will automatically insert a keyframe at the current frame. Go to frame 10 and translate the bipedRoot node up on the Y axis until the knees are almost straightened. You will see that Maya automatically added a keyframe for the Y translate at frame 10. 12. Animate the side to side movement of the pelvis (X Translate). Follow the same steps above to animate the pelvis moving side to side on the X axis. The pelvis area will move over the leg that is planted on the ground. When that leg begins to lift off the ground, the pelvis will shift over the opposite leg as it is planting on the ground. We have some keyframes already on the X translate channel, let’s delete them and reanimate the X translate of the bipedRoot. Select the bipedRoot selection handle, highlight Translate X in the Channel Box. Hold down the right mouse button in the Channel Box and go to «Delete Selected». Make sure «Auto Key» is still on and set a keyframe at frame 1 for the Translate X of the bipedRoot. This sets an initial keyframe for Translate X, now each time you change the Translate X of the bipedRoot from its initial keyframe, Maya will add a keyframe for you. Go to frame 10, where the right foot lifts off of the ground and shift the bipedRoot over the left leg , a keyframe is added automatically at frame 10. Go to frame
7
There is no need to add a key for the pelvis in between the two feet. As the bipedRoot is animated on the X axis side to side it will pass through the middle. Repeat the side to side motion of the bipedRoot at frames 50, 70 and 90. When you are finished be sure to click the «Key» icon in the lower right corner of the interface to turn «Auto Key» off. 13. Animate the «Roll» of the feet. Let’s take a look at animating the «roll» attribute we created for the feet from the previous chapter. There will be three main positions of the foot we will need to concern ourselves with when animating the roll attribute. As the foot begins to lift off the ground, the heel will lift off of the ground . As the foot begin s to land, the heel
13
MAYA Character Animation
RU.MAYA 99
will come in contact with the ground first .
c. Go to frame 20 and set the roll attribute to -5 then set a keyframe.
Then as the foot comes to rest on the
d. Go to frame 25 and set roll to 0 then set a keyframe.
7
ground, it will lie flat on the ground . a. Select the rightFoot selection handle a set the Time Slider to frame 1. b. In the Channel Box, set the «Roll» attribute to 10 then keyframe the roll attribute.
Repeat the animation of the foot roll for both feet through the rest of the animation. Use «Auto Key» to automate the keyframing process. We will further modify the the 14
RU.MAYA 99
MAYA Character Animation
animation curves for the foot roll later. 14. Lengthening the stride of the Character in the Graph Editor. After animating the foot roll, you may notice that the stride of our biped character may appear short along the Z axis. We need to lengthen the Z translate distance between the two feet.
staying in place. An «incline» in the curve represents the feet moving forward. We can scale these Translate Z curves to increase the value of the keyframes, thus increasing the distance between the feet. d. In the Graph Editor menu go to Edit>Scale - option. Hit the «Reset» button in the Scale menu box. In the «Value Scale/Pivot» change the Value Scale (the box on the left), to 1.5, then hit the «Scale Keys» button. You should see the distance of the feet in the 3D views increase . Playback the animation, note
a. Select the selection handles for both of the feet. b. Open the Graph Editor (Window>Animation Editors->Graph Editors).
c. On th eleft side of the Graph Editor you will see a listing of the selected objects and their animated channels. Click on the blue «Translate Z» for the leftFoot and Ctrl-select the blue Translate Z for the rightFoot. The Translate Z reperesents the axis that the feet step forward along. By just looking at the curves, you can identify the stepping motion in the «stepped» shape of the Translate Z curves. The flat sections of the curves represent the feet
that now the stride distance is wider, but the pelvis still lags behind. 15. Modify the animation of the pelvis (bipedRoot). a. Select the bipedRoot, open the Graph Editor. b. Select the Translate Z channel under bipedRoot and Edit->Scale the curve with the same 1.5 Value Scale .
15
7
MAYA Character Animation
RU.MAYA 99
Scrub through the animation, you may still notice sections where the pelvis may be slightly behind the right and left feet. You can also «translate» keys in the Graph Editor to reposition or edit the timing of animated objects. (57)
Scrub through the animation again. If there are sections of the animation where the pelvis position may still be behind the feet, then you can also «tranlate» keyframes in the Graph Editor to modify the position of the pelvis (59).
c. Select the bipedRoot selection handle and open the Graph Editor. d. Select the Translate Z channel for the bipedRoot in the Graph Editor. e. Select the blue Translate Z curve in the Graph. f. Hit the «W» key on the keyboard to go into «Translate» mode. Hold down the shift key and in the Graph Editor drag vertically and watch the position of the pelvis update as you drag. Holding down the shift key as you drag «constrains» the movement of the curve vertically or horizontally depending upon the direction you drag the mouse. (58)
16. Animate the arms of the Character. All of the arm controls for our biped character are centrally located on a locator named «armControls» directly positioned in front of the character. a. Select the locator directly in front of the biped character. b. In the Channel Box, select «LftShldrUpDown» and Ctrl-select «RtShldrUpDown». Set the values of these two attributes to -6. c. Set «LftShldrFwd» to -8 and «RtShldrFwd» to 5. Go to the Channel Box and set keyframes for LftShldrFwd and RtShldrFwd. The arms will swing opposite from one
7
16
RU.MAYA 99
MAYA Character Animation
another forward and backward. Each arm will also swing opposite the leg on the same side. For instance, the left arm will swing backwards when the left leg is forward. The left arm will swing forward as the left leg goes backward. The same holds true of course for the right arm swinging motion as well (60).
Select the locators at the wrists of the character. Located here are controls we set up in the previous chapter for the wrists and fingers. Use the «fist» control to close the hand (63) into a fist. You could also animate the «wristSide» attributes much the same way you animated the elbow and shoulders. The wrists will swing forward as the arm swings forward and swing back as the arm swings back .
d. Go to frame 20 and switch the position of the arms so the left arm is forward and the right arm swings backward (61).
7
17. Offset the animation of the elbows and wrists to obtain some «offset motion» in the arms. a. Select the «armControls» locator in front of the character and open the Graph Editor .
Continue to alternate the swinging of the arms at frames 40, 60, 80 and 100. After animating the arm swing, go through and animate the elbow rotations with the «LftElbowRot» and «RtElbowRot» attributes on the «armControls» locator. When the arm swings back, the elbow will «straighten out» to the point where there is very little bend in the elbow. When the arm swings forward, there should be a distinct bend at the elbow (62).
17
MAYA Character Animation
RU.MAYA 99
an offset in the motion of the arms. d. Repeat the offset steps of the elbow rotations for the «wristSide» attributes (on the locators at the wrists of the character). Offset the wrist rotations 6 frames .
b. Highlight the «lftElbowRot» and the «rtElbowRot» channels in the list on the left side of the Graph Editor
18. Edit the animation of the «Roll» attribute for the feet. At this moment, the roll of the foot is not quite correct. The foot needs to remain «flat» on the ground for a longer period of time. Right now, the foot rolls too quickly and appears unnatural. Also, we need to make the motion of the foot hitting the ground much faster and «snappier». We will be able to adjust the animation curves for this motion in the Graph Editor. To get the foot to lie flat on the ground longer, we will need to have a flat area in the curve for the roll attribute. To make the motion of the foot hitting the ground faster, we will need to make portions of the animation curve steeper. Let’s first take a look at the curve representing the motion of the «Roll» attribute in the Graph Editor. We will look at the shape of the curve and interpret what is happening to the foot. Select the selection handle for the «rightFoot» of our biped character and open the Graph Editor. Highlight the «roll» attribute of rightFoot on the left side of the Graph Editor. Keyframes with a value of «0» equate to the foot laying flat on the ground . Keyframes with
7
c. Be sure that «Time Snap» is on (66a), hit the «W» key on the keyboard to translate and translate the curves to the right 3 frames .
The elbow will now start rotating 3 frames behind the rotation of the shoulders producing 18
RU.MAYA 99
MAYA Character Animation
2. Hit the «Break Tangents» button in the Graph Editor. 3. Shift-select the «red» handles on the left of each of the three keyframes you have selected .
a value of «10» equate to the foot rolling off the ball and toe of the foot . Keyframes with a
7
value of «-5» equate to the foot rolling around the «heel» of the foot .
4. Hit the «W» key on the keyboard to translate the tangent handles in the Graph Editor. 5. Drag the handles up and to the left so you end up with a steeper region with the curve from -5 to 0 .
1. Select all of the keyframes for the «rightFoot.roll» with a value of -5 in the Graph Editor .
19
MAYA Character Animation
RU.MAYA 99
6. Select all of the keys with a value of 10 which represent the foot rolling forward from the ball to the toe .
By creating these «flatter» areas for the foot roll attribute, the foot remains flat on the ground for a longer period of time. The areas where the curve is steep, the foot roll will occur much faster and more lifelike.
7. Hit the «Break Tangents» button in the Graph Editor . This should help you get the idea of how to animate the walk of a character. You can continue animating other parts of the character as well, including the back and neck. You can also take the basic idea of animating a «twolegged» character and apply the same methods to «multi-legged» characters.
7
Try and develop a methodology or an approach to animating your 3D character. Animate the legs and feet first, then the pelvis, then the back, then the shoulders, then the elbows and so on. Treat each animated aspect of your character as a «layer». Only go on to the next layer when the current is close to complete. The sum of all your layers is the entire character animated. Using a methodology like this also makes it straightforward to edit and fix animation in your character.
8. Shift-select the «blue» tangent handles on the left side of each of the selected keyframes. 9. Drag the handle down and to the right, so you end up with steeper regions in the curve where the value of roll goes from 0 to 10 .
Motion Capture Motion capture is another method for animating your CG characters. This involves recording three dimensional movement from an object outside the computer and inputting that data into your computer, then interacting with it in 3D software like Maya. Motion capture is most often used to capture human bodies, facial expressions, objects, camera and light positions. 20
RU.MAYA 99
MAYA Character Animation
The process of capturing motion may involve physically placing «sensors» on an actor, having the actor perform movements while the computer records the three dimensional positions of the sensors. This three dimensional data can then be transferred into 3D software programs like Maya onto skeleton joints or the transformation nodes of other objects.
difficult and time consuming to replicate through traditional keyframing techniques. Motion capture is very useful when there is a need for a lot of complex animation in a short amount of time, the turnaround time from captured motion to the CG character can be very short. Some of the drawbacks to using motion capture are the expenses of the equipment and software needed to actually obtain the captured motion. The cost of the motion capture equipment, most of the time, can run into the thousands of dollars. There are also many technical considerations for getting the motion capture onto your CG character correctly. This includes calibrating the 3D space of the realworld environment with the 3D environment in the computer as well as calibrating the proportions of the real-world actor to the CG character. Motion capture can also be difficult to use when there is a need for highly stylized animation (i.e., cartoony). For instance, how would you capture the motion of a squashing and stretching, 20 foot tall, 12 legged dragon?
Open the file dancer.mb on the CD. This file contains captured motion from a woman dancing. Go to the Perspective window and in the window panel go to Show->Surfaces to hide the surfaces of the character (this will speed up the playback of the animation on the skeleton). Make sure Show->Joints is on in the Perspective panel. Hit the play button on the time slider to playback the animation. You will see the skeleton joints rotating as the figure dances through numerous complex movements. This is a very good example of captured human movement. There are many subtle movements in the motion of the dancer that would be very difficult and time-consuming for an animator to accomplish by hand. Motion capture can be a very quick method for getting motion into your CG characters. Some motion capture devices and software allow you to get real-time interaction between your real-world actor and CG character. Motion capture also picks up the most subtle nuances of movement that would be very
IV. ANIMATION RULES TO IMPROVE YOUR CHARACTER ANIMATION At the onset of any character animation project, the animator must answer a few questions about the animation they are undertaking. Remember, always, that you are animating to an audience. They may only see your animation once, so you have to be sure that what you are animating is clear for the audience to understand. The following rules come from «the principles of animation» from the book «The Illusion of Life» by Frank Thomas and Ollie Johnston. Using these principles will help you to think about the way you are animating your character and undoubtedly help you improve your character animation skills.
A. Posing, Line of Action and Staging This might be the most important rule for ensuring that your character is communicating 21
7
MAYA Character Animation
7
RU.MAYA 99
the proper message to the audience. The pose of the character, a distinct «line of action» of the character’s movement and how the character is appears in the frame of the camera must all work together for an effective animation. When «posing» the character, you need to make sure that the pose clearly communicates an idea. By just looking at how the character is posed, the audience should be able to understand what the character is doing. If your character is angry, a fist in the air, if your character is impatient, arms folded and tapping its foot. A good method for making sure your pose is working is to examine the form of your character in «outline» or «silhouette». This allows you to focus on how the overall form of the character’s pose is communicating while excluding distracting details. By looking at the silhouette of the character, the idea, mood or attitude of the character should be obviously clear. If the form is obscured or confusing, there is a good chance that the audience may be unclear about what the character is doing. A simple way to view your character in silhouette is to render your character with a black non-reflective surface against a white background. Render a still image or a sequence and ask yourself (or even somebody else!) if you could clearly understand what the character is doing in silhouette.
band, and the jump is releasing the rubber band. Anticipation also helps the animator «prepare» or «set up» the audience for what the character is about to do. It would be somewhat confusing if your character just instantaneously jumped in the air without crouching down first. First, it would be an unnatural movement. Second, the action would happen so fast, that the audience might get confused about what the character just did. The anticipation gives the audience enough time to «digest» all of the actions of the character. You want to use anticipation with your character so the audience has an idea of what the character is about to do. Also, use anticipation to help communicate to the audience what the character might be thinking. This will help to convey to the audience ideas and actions that are about to happen.
C. Offset/Breaking Joints/ Flexibility When a force is applied to a link in a chain, it takes time for that force to go down the chain to the subsequent links. The reaction to the force is «delayed» down the chain. Think of a dog’s tail, the same rules apply. The muscles at the base of the tail pull the tail back and forth. That force applied to the base of the tail is delayed from the base up to the tip of the tail. With your CG character you can express this delayed reaction on skeleton joints by offsetting the timing of the rotation of joints down the chain. Keep in mind that the rotation of your joints should not all occur exactly at the same time. Even slight delays in timing can make the movement of your character look smoother and more natural. Your character tends to look stiff if there is no offset motion, especially in the limbs.
When posing your character, it is also important to visualize a «line of action» in your character. An effective pose of a character in action will have a very strong and clear line through its form. If the line of action is broken up in several directions, it may be a clue to a weak pose for your character. Contrast lines of action in your animation and characters to add variety and rhythm to your scene.
B. Anticipation
D. Follow Through/ Overshoot
Sir Isaac Newton said, «For every action, there is an equal and opposite reaction.» When a character jumps, it first crouches down, then jumps. The crouching down motion is the anticipation for the jumping motion. Anticipation happens naturally in nature, the crouching down is like pulling back a rubber
Where you think of anticipation as helping you to communicate an action before it happens, follow-through helps the animator to emphasize the motion as it finishes. This involves taking the last positions of the 22
RU.MAYA 99
MAYA Character Animation
character at the end of a particular movement and extending them a bit further to «overshoot» the final position slightly. After the overshoot, the character comes back to rest in the final pose. Think of a baseball pitcher throwing a baseball. The pitcher winds up, unwinds, throws the ball, yet as the pitcher releases the ball his motion does not immediately stop. The pitcher’s entire body continues to move through the throwing motion.
in an animation to achieve a reaction out of the audience.
H. Squash and Stretch Living, breathing characters are not rigid objects. Their bodies are made of flesh and change shape based on how forces are applied to them. As their shape changes however, their volume of mass stays the same. Ask yourself, «What is the character made of?» Is the character rigid or stiff? Is your character changing direction, accelerating, decelerating? These factors will all have an effect on how the shape of the character may change throughout the animation. The classic example of understanding squash and stretch is a bouncing rubber ball. By itself, the ball is a round spherical shape. When the ball slams against the hard floor, the force of the collision causes the shape of the ball to become oblong or «squashed». When it rebounds off the floor it «stretches» from the force going in the other direction. Squash and stretch is not the same as simply «scaling» your character bigger or smaller. You have to make sure the volume of the character is the same, it is the displacement of the volume which is the key to «squash and stretch». Notice the shoe of this character when it hits the ground. As the shoe lands, the bottom of the shoe «spreads out» from the impact with the ground. The top of the shoe squishes down and the volume is taken up out to the sides of the shoe.
E. Arcs The motion of a jointed character appears in «arcing» motions. Much like a pendulum on a clock, swinging back and forth from its pivot point. The same thing happens on your character. Look at your own arm as it swings at the shoulder joint forward and backward. Only a robot would move along rigid, straight lines. Keep this in mind when animating your characters. Movement in straight lines will look unnatural and stiff.
F. Acceleration/ Deceleration In reality, nothing has instantaneous motion. Objects accelerate into motion and decelerate into no motion. When your character starts a particular movement, make sure there is some sort of acceleration/deceleration in and out of that movement. Ask yourself what the mass and weight of your character is. Heavier objects will have a tendency to take a longer amount of time to get into motion and longer to stop their motion. Lighter objects will accelerate faster and stop quicker.
I. Symmetry/Asymmetry A common mistake when first animating a character is that the character’s movements are symmetrical. You will hear animators refer to this as «twinning». Avoid having limbs on each side of the character moving in the exact same direction at the exact same time, this tends to look very unnatural. Again, a robot may move this way, but not a living breathing CG character! Try to vary the position of appendages on both sides of your character when posing. When posing your character, consider torque, twist, «contrapposto», line of action and the shifting of the character’s weight
G. Pacing/Contrasting Motion «A series of actions all with the same intensity, speed and amount of movement will quickly become tedious and predictable.» Look for ways to show contrast in your characters movement and attitudes. Your character should not always be moving a million miles per hour all the time. Some of the best animators use motion inerspersed with «static» or still motion at just the right moment 23
7
MAYA Character Animation
RU.MAYA 99
from one side of the body to the other. When the character is standing for instance, the weight of the character should be shifted to one side of the character or the other. On the side where the weight has been shifted, the pelvis will tilt up towards the shoulder, while the shoulder will tilt down toward the pelvis on the same side. This will form a nice bend or arc in the spine as well. This makes the character look more believable and less like it was animated with a computer. (pin standing arms folded, symmetrical and asymmetrical)
V. IMPROVING INTERACTION WITH YOUR 3D CHARACTERS
J. Weight/Balance
7
Be aware of the weight and balance of your character, this can truly make your character appear as a living creature to the audience. Be aware of what material your character is made of. Is the character a 5 ton dinosaur or a 5 ounce lizard? Notice how you stand for instance. You will notice that you tend to shift your center of gravity, your pelvis area, from one leg to another or to both legs. Your center of gravity shifts back and forth, maintaining balance. Consider also when your character is carrying something heavy. The body of your character will need to alter its body posture and center of gravity to «balance» the heavy load. (pin carrying a bowling ball)
K. Storytelling When animating your characters, keep in mind that you are telling a story to your audience. The actions and attitudes of your characters need to aid the audience in following the storyline. Also, even in the shortest animations, think of the actions and motions of your character as telling a small story or conveying an idea. A character riding a bike for instance, can tell a short story. How is the character riding the bike? Slowly? Quickly? Where is the character going? To work? To the beach? Think of each animated shot as a short story unto itself. Make sure the point of your story is understandable, clear and entertaining to watch for the viewer.
Before we actually start animating our 3D character, let’s look at a few ways we can make our interaction with our character faster. As an 24
RU.MAYA 99
MAYA Character Animation
A. Fast Interaction
animator, it is very important that you are able to visualize the motion you are creating as interactively as possible. As your characters and environments become more complex, your computer and Maya will take more time to update the visual feedback to your screen. If you have ever seen a traditional 2D animator working, you will see them penciling in their drawings while «flipping» through sheets (frames) of their animation. The animator is quickly viewing the progression of their animation, examining, refining and improving the animation with each pass. Flipping the sheets of drawn animation is done in «real time», the sequence of frames being displayed at the speed the audience will be viewing them at. One drawback with 3D animation, especially with complex scenes and characters, is that it takes time for the computer and software to calculate and display the 3D information. A fully modeled character, bound to a skeleton, with a few deformers can slow down the playback rate of your character. In some instances, the animator may have to wait seconds or minutes just to view the next frame in an animation sequence. This is the kiss of death for achieving good animation. It is very difficult for a 3D animator to visualize the motion if they cannot interact with the motion close to «real time» speed. Even very fast computers will not be able to calculate complex scenes and characters in real time (at least not yet!). The faster you interact with your character, the more iterations you will be able to go through and edit your animation. We will take a look at a few methods that can help improve the way you interact with even your most complex 3D characters. We will first note some «built-in» functionality Maya has to improve interaction. Then we will look at a method for creating «low-resolution» or «standin» characters and environments to animate with. Using a MEL script we will be able to switch between a high resolution and low resolution character with the push of a button.
This mode is found under Display->Fast Interaction. Fast Interaction dynamically simplifies your geometry when you update any of your 3D modeling view panels. When toggled on, you will see your NURBS surfaces appear «faceted» or «polygonalized» when you navigate in a 3D window or hit play. Once you release the mouse button or hit the stop button, your geometry returns to its original shape. Maya is reducing the amount of geometry data it needs to display to the screen. 1. Open the bipedFinished.ma scene file. 2. Go to Display->Fast Interaction to turn on Fast Interaction in Maya. 3. Navigate the camera (tumble/pan/zoom) with the LMB and the Alt key. You will see the geometry become simplified as you update the 3D views. With simple characters, you may not see a significant speed increase in the interaction of your character/scene. But as they get more complex, Fast Interaction can speed up screen updates of your scene.
25
7
MAYA Character Animation
RU.MAYA 99
1. Select the NURBS surfaces of the biped character in the bipedFinished.ma file. 2. Go to Display->NURBS Smoothness>Fine (or 3 key on the keyboard), this may take a few seconds. This displays the selected NURBS surfaces at their highest screen resolution. The surfaces appear very smooth at the cost of interactive speed. Try navigating the camera in the perspective view, you will see that the update of the view is quite slow. 3. With the surfaces still selected, go to Display->NURBS Smoothness->Hull-option, and set both the U and V to 2. This tells Maya to display every other hull of the selected NURBS surfaces (a setting of 3 U and V would display every third hull on the selected surfaces). This drastically reduces the complexity of the displayed NURBS surfaces in the 3D views. At the cost of smoothly displayed surfaces, your character will update very quickly in the 3D views. When using Display Smoothness->Hull, you try to balance the surface resolution to be able to recognize important features, with the speed at which you interact with the character. To set the surfaces back to the default resolution, select the surfaces and Display->NURBS Smoothness->Rough. Keep in mind that the settings of Display Smoothness has no effect on how your surfaces actually render using the software renderer. However, when hardware rendering, Display Smoothness may need to be adjusted for adequately smoothed NURBS surfaces.
B. Display Smoothness
7
C. Visibility
Maya also has built-in functionality that allows you to specify the viewing resolution of NURBS surfaces. This is essential when working with complex characters and environments. 26
RU.MAYA 99
MAYA Character Animation
3. Open the Layer Editor and hit the new button. Name the layer hiResCharacter. Hit the Transfer button in the Layer Editor to add the selected surfaces to this layer.
Another method of improving the speed of interaction which should not be overlooked is the visibility of objects. Maya will not calculate objects that are invisible. You can speed up interaction with your character if you simply hide items that you may not need to use at the time. For instance, if your character has hundreds of teeth, and you are animating a walk cycle, hide the teeth so Maya will not have to calculate them in the 3D views.
D. Low Resolution «Stand Ins»
7
An animator can easily create a lowresolution «stand-in» character to speed up the interaction with even the most complex 3D characters and scenes. The basic idea is to create a copy of your character that is reduced in complexity. You use this «simplified» character only when animating, for quicker interaction. The simplified character represents the bare minimum amount of geometry you need to represent the character. Once you have finished animating, you switch back to the original character model (high resolution) for rendering. All of the animation occurs on one skeleton, and you simply hide the high resolution model and show the low resolution model and vice versa. 1. Open the scene file bipedFinished.ma 2. Select only the NURBS surfaces which represent the biped character.
4. With the NURBS surfaces still selected, go to Edit->Duplicate-option, hit the Reset button then hit the duplicate button. 5. Open the Layer Editor again, create a new layer called lowRes, then hit the Transfer button.
27
MAYA Character Animation
RU.MAYA 99
6. With the duplicate lowRes geometry still selected, go to Modify->Prefix Hierarchy Names ... . In the text field type lowRes_ . This adds the prefix «lowRes_» to the names of all of the selected surfaces. This will enable us to utilize a helpful MEL script later.
7. Select the left arm surface of the character. 8. Click on the left arm surface with the right mouse button and select Isoparm from the popup menu. This quickly enables you to select isoparms on the left arm surface.
7
7. In the Layer Editor, click on the hiRes layer and hit the Hide button to hide the high resolution geometry. The high resolution geometry is the geometry that is already bound to the skeleton. The low resolution geometry is a duplicate and has no connections to the skeleton or deformers. The next step is to slice up or «detach» our low resolution character into pieces that we can simply parent to the skeleton. We will detach surfaces at locations on the character where deformations will occur. For instance, on the arm, we will cut the surface of the arm at the elbow. The forearm section will be parented under the elbow and the upper arm will be parented under the shoulder. Surfaces parented to skeleton joints are much faster to calculate then surfaces bound to the skeleton. Maya must calculate all of the points on the surface when bound to a skeleton.
9. Click on one of the vertical isoparms near the elbow.
10. Edit Surfaces->Detach Surfaces. The Detach Surfaces tool uses the selected isoparm 28
RU.MAYA 99
MAYA Character Animation
to «cut» the single arm surface into two surfaces. We now have the arm surface detached into a lower and upper arm. We detached the arm at the elbow because this is where the deformation will occur.
Repeat this process for the rest of the character. Detach surfaces where deformations will take place, like the elbows, knees, ankles, torso etc. Be sure to parent the detached surfaces under the joints you need to control them with. You can also use other stand-in objects to represent your character geometry as well. For instance, you could use a polygon sphere as a stand-in object for all of the head surfaces. You can also delete items from the duplicated low resolution geometry. For example, we don’t really need the teeth or hair of the character for our low resolution character. Just pick those unnecessary objects and delete them. Remember, your goal here is to have a stand-in character that represents just enough information for you when animating.
11. Select the detached upper arm geometry and shift-select the shoulder joint. Select Edit>Parent. When the shoulder joint moves, the upper arm geometry will follow because it is the child of the shoulder joint.
E. Hi-Res Low-Res MEL script We can use the power of the MEL scripting language to create a single button that will allow us to toggle between the high resolution and low resolution geometry. 1. Copy the lowResHiRes.mel script from the CD to your scripts directory. Your scripts directory can be found at the same directory level as your projects directory. Refer to the MEL chapter for further information on using MEL scripts. 2. In the Layer Editor, select the hiResCharacter layer and hit the Select button.
12. Select the detached lower arm geometry and shift-select the elbow joint. Select Edit>Parent.
29
7
MAYA Character Animation
RU.MAYA 99
5. Highlight the text for the lowResHiRes.mel script and middle mouse button up to your shelf. You now have a shelf icon which represents the lowResHiRes.mel script. By clicking on the icon you execute the script.
3. Edit->Sets->Create Quick Select Set... . Name the Quick Select Set hiRes. A Quick Select Set is a good way of saving a selection of objects or components in your Maya scene. Now when you want to select the high resolution surfaces you can go to Edit->Quick Select Sets.
7
6. Click the icon in the shelf that represents the lowResHiRes.mel script. This is a toggle switch, click once and the lowRes geometry appears while the hiRes geometry is hidden. Click again and the lowRes is hidden while the hiRes is made visible. This script contains an «if then» statement which hides the hiRes Quick Select Set when objects with the text string «lowRes_» in their name are visible.
4. Open the Script Editor window, Window>General Editors->Script Editor. In the Script Editor go to File->Open Script, find the lowResHiRes.mel in your scripts directory. You will see the script loaded into the input area of the Script Editor.
VI. CHARACTERS INTERACTING WITH ENVIRONMENT Often times you may want your characters to appear that they are «interacting» with the 30
RU.MAYA 99
MAYA Character Animation
«Duplicate» button.
environment around them. Potentially, there are many different ways the character could interact. For instance, your character may push an object off a table, leave footprints on the ground, pick up an object.
A. Characters picking up objects - Animating the «visibility» on and off. In some situations, your character may need to «pick up» and interact with objects in the scene. We will achieve this by having «two» objects that we will animate the visibility of. One of the objects will remain on the table while the other will be «parented» to the wrist joint of the charcter’s hand. At a particular frame, the one object will become invisible while the other becomes visible. 1. Open file pinPickUpObject.mb. This file contains a 150 frame animation of a character picking a can off of a table. The character is not actually picking up the object, but the motion has been animated already for you. It is best to approach your animation this way. Animate the motion of the character first, then animate the object being picked up, which is what we will do here.
4. With the duplicate can still active, shiftselect the wrist joint of the right arm. Go to Edit-> Parent to make the duplicate can a child of the wrist joint on the right arm.
7
Playing back the animation you will now see the one can remain on the table while the duplicate follows the motion of the right arm and hand. 5. Select the can on the table and set the frame to 55 in the Time Slider. Highlight the «Visibility» attribute in the Channel Box and go to «Key Selected». 2. Scrub through the animation and determine at which frame will the character will need to «pick up» the object, frame 56 will work great. 3. Go to frame 56 in the Time Slider. Select the can object on the table. Go to Edit-> Duplicate-Option. Hit the «Reset» button in the Duplicate Option Box then hit the 31
MAYA Character Animation
7
RU.MAYA 99
6. Go to frame 56 and with the can still selected, change the Visibility attribute to «off» by typing «0» in the input field and hitting the «enter» key. You will see the can on the table disappear. 7. Select the can object parented to the wrist joint on the right arm. Keyframe the Visibility «on» in the Channel Box for this can at frame 56. 8. With the can parented to the wrist still selected, go back one frame to frame 55. Keyframe the Visibility attribute off in the Channel Box.
Play back the animation. It appears that our character actually «picks up» the can sitting on the table. But in reality, we are simply animating the visibility of the two cans which gives the impression that the can is being lifted off of the table.
32
RU.MAYA 99
MAYA Character Animation
B. Character interacting with objects using Rigid Body Dynamics - Pin Character hitting cans off of table.
1. Open the file pinHitCans.mb. This file contains a «bowling pin» character which has been animated over 45 frames hitting several cans off of the table in front of him. . Use the lowRes geom to be Rigid bodies. You
7 will notice when playing back the animation that the character’s hands pass right through the cans. We will use «dynamics» to allow us to have the character’s hand «collide» with the cans on the table. It is important to first have the charcter animated then go ahead witht the rigid body animation. 2. Create->Polygon Primitives->CubeOption, hit the «Reset» button then the «Create» button. This creates a default primitive polygon cube . Name the polygon
33
MAYA Character Animation
RU.MAYA 99
cube «cubeHand». 3. With the cube still selected go to Edit>Delete by Type->History. This gets rid of the extra «Construction History» data for the cube which we no longer need to use. 4. With the cube still selected, go to Bodies>Create Passive Rigid Body with the default settings .
6. Parent cubeHand to the leftWrist joint. Select the cube object «cubeHand» and shiftselect the leftWrist joint of the character. Go to Edit->Parent .
7
5. Move «cubeHand» over to the charcter’s left hand. Scale and rotate it so the cubeHand cube covers the entire hand. The following transforms work well for this: Tranalte X=6.5, Translate Y=9, Translate Z=.5, Rotate X=-10, Rotate Y=-12, Rotate Z=35, Scale X=3, Scale Y=5 and Scale Z=3.5.
7. After parenting the cubeHand object to the leftWrist joint, select cubeHand and go to Solvers->Initial State-> Set for Current. This tells the dynamics system of Maya that this is the «starting» position for the cube. Scrub through the animation of the Pin hitting the cans on the table. You should see the cubeHand object following the left hand of the character . You can think of the polygon cube
34
RU.MAYA 99
MAYA Character Animation
as a «stand-in» object for the rigid body dynamics animation we are about to do. The cube will calculate much faster than if we actually used the actual geometry of the character’s hand. It is important, especially with complex scenes, that you try to use standins wherever possible to simplify the amount of data Maya must calculate. Polygon stand-ins are optimal for dynamics, they will calculate much faster than NURBS geometry. Next, we need to make the cans on the table rigid bodies so they will collide with the cubeHand object when we run the dynamcis. 8. Go to frame 1. Select the 6 polygon «cans» sitting on the table in front of our character. Go to Bodies-> Create Passive Rigid Body . With the 6 cans still selected go to the
rigid body input (under Shapes in the Channel Box). Highlight the «Active» attribute and «Key Selected». Make sure «Active» is «off» when you do this. We will be animating the active/passive status of the can rigid bodies. At the beginning, we need the cans to stay in place, stacked on the table, so they will begin the animation as passive rigid bodies. As the hand arrives to hit the cans off of the table, we will animate the status to «active» because we need the cans to «collide» with the hand and be affected by a «gravity» field we will add to the scene later. Also, take note, the cans are not quite touching each other. This slight spacing will alleviate any «interpenetration» errors that might occur when geometry used in dynamics intersects .
35
7
MAYA Character Animation
RU.MAYA 99
9. Scrub through the animation once again and determine at which frame will the character’s left hand arrive right before hitting the cans on the table. This should be at about frame 20. Go to the Channel Box and where it says «off» on the «Active» attribute of the rigid body Shape node, type «1» or «on», then «Key Selected». This makes the cans switch form passive to active at frame 20 .
7
11. In dynamics, go to Solvers->Rigid Body Solver... . In the attribute Editor for the «rigidSolver», change the «Step Size» to «.001». Playback the animation and this time you should see the hand colliding with the cans on the table .
10. Go back to frame one and then playback the animation. Surprisingly, you will notice that the left hand of the character still «passes through» the cans on the table .
12. Adjust the dynamics attributes of the cans. To further optimize the speed of the calculation of the dynamics, select the 6 cans. In the Channel Box under rigid body input node, switch the «Stand In» attribute from «None» to «Cube». This simplifies how Maya calculates the can surfaces during the collisions. Maya uses a simple «Cube» to calculate the rigid body dynamics as opposed to the cylindrical polygon shape of the cans which is a bit more complex. You may want to increase
The animation of the character’s hand hitting the cans occurs so quickly, just one or two frames, that the «collisions» are not registered by the dynamics system in Maya. We need to adjust the «Step Size» of the rigid body solver. Right now the increments that the rigid body solver calculates are too large. We need Maya to calculate finer increments so the collision of the hand and cans is correct. 36
RU.MAYA 99
MAYA Character Animation
19 and 44 then hit the «Bake» button. You will see the animation play back frame by frame, as Maya writes out keyframe animation for the cans. 15. When Maya is finished «Baking» the simulation, make sure the six cans are selected, rewind the animation to frame 1 and go to Edit> Delete By Type-> Rigid Bodies. This deletes all of the Rigid Body nodes for the cans, which are no longer needed.
the «Mass» of the cans to 100 so they don’t fly so far away. Decrease the «Bounciness» to .1 so they don’t bounce so much. 13. With the six cans selected, go to Field-> Create Gravity. In the Channel Box, change the magnitude of the Gravity field to 30. The gravity field by default, will pull the cans down along the Y axis. Adjust the rigid body dynamics attributes for
16. Now that the rigid body animation is baked into the cans, you can delete the cube on the hand. Select the cubeHand polygonal cube and Edit->Delete.
the 6 cans until you are happy with the animation. You can then «Bake» the dynamics animation into keyframes for the six cans. Right now the rigid body dynamics are being calculated one frame at a time, from begiining to end. If you «scrub» through the animation at this point you may see some errors in the way that the hand and cans collide. This occurs when the animation is not played back frame by frame. Baking the rigid body dynamics will transfer the motion of the rigid bodies into keyframe animation. 14. Select the 6 cans and go to Edit-> Keys> Bake Simulation-Option. Set the Start/End to 37
7
MAYA Character Animation
RU.MAYA 99
3. In the Channel Box for the selected items, select the channels you want to animate by highlighting the name of the channel in the Channel Box. Shift click if there are more than one channels you want to key.
You have now gone through one way of having your character interact with objects in the scene through the use of animating the passive/active status of Rigid Body objects. This method could be used in endless different scenarios where your character needs to collide and interact with objects in your scene.
VI. IMPROVING YOUR ANIMATION WORKFLOW
7
A. Keyframe Macro with MEL 1. Open the file pin.mb.
4. Open the Script Editor (Window>General Editors->Script Editor). In the Script Editor, go to Edit in the menu bar and Clear History. This clears the information displayed in the History window of the Script Editor. 5. Right mouse click in the Channel Box for the pop-up menu, then go to Key Selected. You will notice that several «setKeyframe» MEL commands were reported to the History section of the Script Editor.
2. Select the nodes of the character to animate. For instance, select the Selection Handles for the two feet and the pelvis behind the character.
38
RU.MAYA 99
MAYA Character Animation
the far right of the screen.
VII. Editing Animation Time and Values A. Scaling Animation Timing with the Dope Sheet In some instances you may have your character animated in the right poses but you may need to «speed up» or «slow down» the animation. A real direct and easy way of doing this is through the Dope Sheet. The Dope Sheet can be found under Window->Animation Editors->Dope Sheet. The Dope Sheet represents time in frames and keyframes for selected objects. Frames are represented with boxes and keyframes are represented with brown boxes. The Dope Sheet is great for «sliding» keyframes around in time or for scaling time to make your animation quicker or slower. Let’s take a look at how we might edit the timing of a character’s walk cycle with the Dope Sheet. 1. Open the file pinWalk.mb. This file contains a character that already has keyframed walk cycle animation applied to it over 24
6. Highlight the setKeyframe command reported in the History window of the Script Editor, and drag it to one of your shelves. A button is created with the label «MEL» on it. This is a button which contains the MEL
commands you dragged to the shelf. You now have a «macro» made of several MEL commands, every time you click on this MEL button, Maya will execute the «setKeyframe» MEL commands for the selected objects. You don’t even have to select the objects again to setKeyframes. Simply, move the objects into position then click on the button. The setKeyframe commands already contain the names of the objects you keyframed originally, so there is no need to select them when you want to keyframe. You can also have as many of these macros as you want. Each one of your macros can keyframe different objects, or you can have one macro that keyframes everything, it is totally up to you. You can delete MEL scripts you drag to your shelves by middle mouse dragging them to the small trash can on
frames. 2. To edit the animation we need to first select the objects which have keyframed animation. In the Outliner, select the rightFoot, leftFoot, pelvis, upperBodyControl and armControl nodes (the upperBodyControl and 39
7
MAYA Character Animation
7
RU.MAYA 99
upperBodyControl and armControl nodes. You can also select keyframes for individual objects by selecting them horizontally across from the name of the object. Shift select to select keyframes from more than one object. 5. We will now use the scale tool to scale the whole walk cycle animation for our character. Click on the Scale transform tool or hit the «R» key on the keyboard to scale the animation. You will see a white border around all the keys
armControl nodes are Locators with attributes driving skeleton joints on the character. 3. Open the Dope Sheet (Window>Animation Editors->Dope Sheet). You will see the nodes you have selected appear in a list on the left side of the Dope Sheet. In the rest of Dope Sheet you will see the grid of boxes which represent frames in the scene, and you will see yellow or brown boxes filling some of the frames. The yellow boxes are selected keyframes while the brown boxes are unselected keyframes. Look at one of the nodes on the object list on the left side and read
selected in the Dope Sheet. 6. Click the white vertical bar on the right side of the Dope Sheet. Drag it to the right from the current frame 24, to about frame 50. You have now just double the length of the animation from 24 frames to 50 frames. The walk cycle will now take twice as many frames
horizontally across the Dope Sheet, these are the keyframes for that object. 4. Running horizontally along the top line of the Dope Sheet, you will see the «Summary» line. The summary line displays all of the keyframes for all of the objects displayed in the Dope Sheet. Using the left mouse button, select all of the keyframes on the summary line. You now have all of the keyframes selected for the rightFoot, leftFoot, pelvis, 40
RU.MAYA 99
MAYA Character Animation
to complete. In addition to scaling your animation you can also translate your keys in the Dope Sheet by using the Translate tool or by hitting the «W» key on the keyboard. This allows you to translate keys left or right to have the animation happen sooner or later.
7
41
Character Setup This tutorial goes through the steps to add animation controls to a previously modeled character. The character in the scene below is wearing clothes made with Cloth and the scenery has been created with Paint Effects.
A Taste of Maya
The following topics are discussed: n
Creating skeletons,
n
Using Smooth Skin to bind a model to a skeleton,
n
Adding IK chains for efficient character control, and
n
Combining custom attributes and Set Driven Key to automate character controls.
An animated character
Character Setup
Note:
Questions? visit www.aliaswavefront.com/tasteofmaya
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install. Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
BUILD A SKELETON 1 Open the file characterModel1.ma 2 Press F2 to change the menu set to animation 3 In the side view build leg joints with Skeleton → Joint Tool as shown below n start at the hip and place a joint at the knee, ankle, heel, ball and toe of the leg. There should be five joints in total. n
Tip:
When you have placed all five joints press enter to complete the leg. Hold the x key when placing joints to snap to the grid.
Start joint
knee joint
ball joint end joint
ankle joint heel joint
Joints placed for the right leg
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
To see your Maya display as pictured, press 6 to transfer to textured mode and Shading → Shade Options → XRay.
Note:
4 In the front view move the leg over so that it matches the geometry of the right leg n Press w to use the move tool. n
Click on the right arrow of the manipulator to constrain the movement to the x-axis.
n
Use the MMB to move the leg to fit in the geometry
n
If you want to change the joint display size select Display → Joint Size and choose a different size
5 In the side view build the back with Skeleton → Joint Tool as shown below n Place the first joint slightly above the hip joint. There should be eight joints in total. n
Press enter to complete the back skeleton
End joint
Start joint
Joints placed for the back 6 In the top view build the right arm joints with Skeleton → Joint Tool as shown below n The arm is made up of five joints starting at the clavicle. n
Press enter to complete the skeleton.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
Start joint (clavicle) End joint
shoulder joint
Joints placed for the right arm 7 Move the skeleton chain up to fit in the arm n Use the move tool and constrain the movement to the y-axis using the manipulators. 8 Select the shoulder joint and rotate and scale it so that the bones are oriented correctly with the arm
Adjusting the arm bones to match the arm geometry 9 Select the right clavicle joint and shift select the joint at the base of the neck and Edit → Parent n The clavicle is the joint above the shoulder, closest to the spine.
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
n
To select a joint you can click LMB directly on the joint or you can click LMB drag across the bone below it. For example to select the elbow joint you would click LMB drag across the forearm bone
10 Create the left arm n Select the right clavicle. n
Choose Skeleton → Mirror Joint p to open up the options dialogue box.
n
Set the following options: Mirror Across: YZ
n
Press Mirror to create the left arm.
Mirroring the arm 11 Parent the right leg to the back skeleton by selecting the right hip joint followed by the joint at the base of the back and Edit → Parent 12 Create the left leg by selecting the right hip and Skeleton → Mirror Joint
SKIN THE CHARACTER 1 Open the file characterModel2.ma or continue from the last step 2 Skin the body of the character first n Select the body of the character Do not select the feet surfaces at this step. They will be bound to the skeleton in a later step. n
Shift-select the root joint of the skeleton The root joint is the joint at the base of the back that all of the other joints branch off from. When it is selected and you move it all the other joints in the hierarchy will move as well.
n
Select Skin → Bind Skin → Smooth Bind.
3 Test the bind by rotating joints in the skeleton Tip:
Use the z key to undo any joint rotations so the character is in the previous pose or use Skin → Go to BInd Pose.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
4 Skin the feet next n Select the joints of the right leg from the knee to the toe. Start by selecting the toe joint and then shift selecting the ball joint, heel joint, ankle joint and then knee joint. Tip:
This selection may be done easily in the Hypergraph or the Outliner. n
Shift-select the right foot geometry
5 Skin → Bind Skin → Smooth Bind p, and set the following options: Bind to: Selected Joints Note:
Because the feet are so big, this will keep them from getting skinned to joints that they shouldn’t be associated with.
Binding the shoe to the skeleton 6 Repeat steps 4 and 5 for the left foot
ADD IK TO THE ARMS AND LEGS 1 Open the file characterModel3.ma or continue from the last step 2 Activate the IK Handle tool with Skeleton → IK Handle Tool p, and set the following options: n Current Solver: ikRPsolver IK Handles give you control over the motion of several joints at once. IK Handles allow you to move one object (the IK Handle) and have several other objects (joints) change position by rotating. This allows you to animate a skeleton quickly as you only need to control one or two IK handles to get create lots of motion. 3 Click on the right hip joint followed by the right ankle joint to add an IK chain to the right leg. Press the y key to repeat for the left leg. Pressing the y key puts Maya back into the tool that was used last. In this case pressing y is the same as selecting Skeleton → IK Handle Tool
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Character Setup
4 Repeat for the arms by pressing the y key and clicking on a shoulder followed by the corresponding wrist.
IK chain added to the arms and legs Tip:
It is a good idea to rename the IK handles to keep the scene organized. Select an IK handle and rename it by clicking on the name at the top of the channel box.
5 You may test the IK chains by selecting an IK handle and moving it Note:
Undo any transformations with the z key after you are finished testing.
ADD IK SPLINE TO THE BACK 1 Open the file characterModel4.ma or continue from the last step
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
2 Select the right eye followed by the joint at the top of the head and Edit → Parent
Parenting the eye to the skeleton 3 Select the left eye followed by the joint at the top of the head and Edit → Parent 4 Activate the IK Spline Handle tool with Skeleton → IK Spline Handle Tool, and click on the stomach joint followed by the joint at the base of the neck
Adding IK Spline to the back Note:
You may test the IK Spline by selecting the IK handle and changing the value of the Twist attribute.
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Character Setup
Testing the IK Spline Note:
The IK Spline is controlled by a curve. When you create the IK Spline, the curve will be parented to the skeleton. If you select the curve and press F8 to change to component mode, you can move the CVs of the curve to control the back further. Remember to press F8 when finished testing to return to object mode.
ADD CONTROL FOR THE HEAD 1 Open the file characterModel5.ma or continue from the last step 2 Select the root joint and Display → Object Components → Selection Handles
Selection handle added to the root joint
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
Character Setup
Note:
Questions? visit www.aliaswavefront.com/tasteofmaya
Selection Handles have the highest priority for selecting geometry. This means it will always be easy to select the root joint.
3 With the root joint selected, Modify → Add Attribute... 4 Enter an attribute name of headTurn and press OK Note:
An extra attribute has now been added to the root joint. You should see it in the channel box.
5 Open the Set Driven Key window with Animate → Set Driven Key → Set p Set Driven Key is a type of key available in Maya that allows you to connect an attribute from one object to an attribute of another object. For example you could have a sphere and a cone. The sphere’s translate Y could drive the scale Y of the cone. When you move the sphere in a defined range of values in the Y axis the scale Y of the cone would change accordingly. To use the Set Driven Key window you need to have a driver and a driven object to load. Once they are loaded you modify attributes on both the driver and driven and key them with the key button in the Set Driven Key window. 6 With the root joint still selected, press Load Driver 7 Select the joint at the base of the neck followed by the joint at the base of the head and press Load Driven 8 Set initial key for Set Driven Key n In the Set Driven Key window, highlight headTurn for the driver. n
Click drag on the two driven joints and then on rotateX and press Key
base of head
base of neck
The Set Driven Key window
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Character Setup
9 In the Set Driven Key window click on the Driver joint to activate it in the Channel Box and set Head Turn to 10 If you click on the name of an object listed in the Set Driven Key window (either the driver or driven), it will become the selected object and it’s attributes will show up in the Channel Box 10 In the Set Driven Key window click drag on the two driven joints to activate them and rotate them about 30 degrees in X You can use the rotate tool and constrain the rotation to the x-axis using the rotate manipulator or you can type the value into the Channel Box. 11 Press the Key button in the Set Driven Key Window 12 In the Set Driven Key window click on the Driver joint to activate it in the Channel Box and set the Head Turn attribute to -10 13 In the Set Driven Key window click drag on the two Driven joints to activate them and rotate them about -30 degrees in X 14 Press the Key button in the Set Driven Key Window Now that this setup is complete when you change the value of the headTurn attribute on the root joint it will cause the rotateX to change on the other two joints. If you select the root joint of the character and go to the Channel Box you can click on the Head Turn attribute. Once the Head Turn attribute is highlighted (not the number but the actual words), you can use your MMB in the perspective view and click drag left or right to change the values interactively.
Twisting the neck with Set Driven Key and a custom attribute Note:
You may test the setup by adjusting the Head Turn value between -10 and 10. To stop the arms from moving you may keyframe the IK handles with s or turn Stickiness ON in the Attribute Editor under IK Handle Attributes.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
ANIMATING THE CHARACTER The final version of this file is called characterModel6.ma. If you want to try animating the character open this file. The main difference in this file is that the foot has been setup more completely for walking. Selection handles have been added to each of the IK handles for easier selecting.
The character ready for animating The feet nodes have an added attribute called roll. If you adjust this attribute the foot will roll from heel to toe making for a nice walking motion. This foot setup comes from the Character Animation in Maya class.
The foot set to roll when walking
12 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
Roll attribute added to left_foot node displayed in channel box n
Select one of the foot selection handles In the Channel box you will see the selected object. Notice that there is an extra attribute on the foot called Roll.
n
Click on the word Roll to highlight it. It should appear black as in the above image.
n
Move your mouse over to the perspective view or one of the othographic views.
n
Press the MMB and drag your mouse left or right. When you press the MMB a new mouse icon should appear that looks like arrows pointing left and right.
The following points should help you to animate the character:
back
left_wrist
right_wrist
root
left_foot
right_foot Selection handles n
Only the following six nodes need to be animated: root, back, right_wrist, left_wrist, right_foot and left_foot.
n
Keyframes can be set with s or with Animate → Set Key
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 13
Character Setup
Questions? visit www.aliaswavefront.com/tasteofmaya
n
Animation curves can be adjusted with Window → Animation Editors → Graph Editor...
n
When setting keys, start with the root and feet nodes to block out the animation
n
The finer animation of the arms, back and feet rolling should be secondary
n
You can get a real-time playback with Window → Playblast
Note:
There are other animation workflows covered in the Comic Book and Jellyfish tutorials.
CONCLUSION You have now experienced how easy it is to prepare a character for animation in Maya. This includes the following topics: n
Creating joints and building skeletons,
n
Adding an IK chain to control arms and legs,
n
Using the IK Spline to the back for smooth and organic control,
n
Making custom attributes for finer control,
n
Set Driven Key to create relationships between nodes to simplify character control, and
n
Some basic animation concepts in Maya.
Character setup and animation can be very complex topics to cover. Alias|Wavefront offers a Character Animation course that explores these topics in depth. For more information go to www.aliaswavefront.com (Express Link to Training).
14 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Modeling a dragon using NurBs in Maya
Modeling a dragon with NURBS in Maya Modeling A Dragon Creating Image Modeling Head Creating Eyes Modeling Torso Modeling Gum Modeling Leg(I) Modeling Leg(II) [Back]
presented by keongputer digital art kindly mail your comments to: [email protected]
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/ [2000-06-10 23.53.38]
Main frame
presented by keongputer digital art kindly mail your comments to: [email protected]
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/contain.html [2000-06-10 23.53.40]
Modeling a dragon with NURBS in Maya
Modeling a dragon with NURBS in Maya:
This piece of article will show you step by step of how the dragon is created using Maya. There are three type of modeling method in Maya, NURBS modeling, Subdivision modeling and Polygon modeling, each of them have their advantages and disadvantages. However we will build the dragon using patch NURBS surface techniques. The tools that I use to model this dragon are Birail tools, NURBS primitive, Fillet Blend Tools and etc. In the first section, I will show you how the dragon is created by using Maya. Next section, texturing the dragon will be shown. We need to paint the texture and create bump map in PhotoShop, but before that, I will need Deep Paint 3D to create reference line on how the texture will be distorted by NURBS. The detail will be covered in the texturing section. Before I start launching Maya, I will do some concept sketching on paper. This is important, as it will be easier for me to visualise the object I have in mind later on. I wanted to create a dragon between realistic and imaginative. I want it to look like a T-Rex but with horn and larger forelimbs. Only the side orthographic is needed to create the model. When I have done, I will scan in the sketch and save it as JPEG. (Figure 1)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_dragon.html (1 of 4) [2000-06-10 23.53.44]
Modeling a dragon with NURBS in Maya
(Figure 1)
Creating Image Planes 1.Select Multilister from Window menu, from camera tab double click side camera or Ctrl-a to open Attributes Editor. Scroll down the list of entries until you see Environment pop-up menu. Click on the Create Image Plane button. 2.In Image Name option, click Browse and load the JPEG file as reference for modeling. (Figure 2)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_dragon.html (2 of 4) [2000-06-10 23.53.45]
Modeling a dragon with NURBS in Maya
(Figure 2) 3.Now, I will translate the image plane further away from axis X origin, so as to avoid any intersection with my model. From image Plane, Attribute, scroll down to Placement Extras. Key in -5 in the first input field. (Figure 3)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_dragon.html (3 of 4) [2000-06-10 23.53.45]
Modeling a dragon with NURBS in Maya
(Figure 3)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_dragon.html (4 of 4) [2000-06-10 23.53.45]
Modeling the Head
Modeling the Head 1.Go to Create, EP Curve Tool. Note that curve created by EP Curve Tool will pass through every point you draw. Press Enter to confirm when done. 2.In side view window, draw 2 separate curve as shown. Select second curve, press F8 to switch to Components selection mode if it is in Objects selection mode. Hold down RMB to invoke hotbox and select Edit point. After select curve's Edit Point, press w to activate move tool then pulls points along X-axis. Remember not to edit the first point near the nose. (Figure 4)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (1 of 7) [2000-06-10 23.54.23]
Modeling the Head
(Figure 4) 3.Now, I will rebuild the curve that I'd drawn to uniform number of spans. First is to ensure that uniform count of spans will form better surface. Secondly is to reduce spans count of surface, since I don't want to have so many points to push and pull around. Do not worry about the detail part, it can always been done by inserting isoparm to the surface. Press F3 to toggle to Modeling menu. Select curves that have been created. Go to Edit Curve, Rebuild Curve, options. Key in 10 for Number of Spans. Click Rebuild. Rebuild next curve too. 4.From Status Line select Snap to Curve. (Figure 5)
(Figure 5) 5. With the snap to curve activated, then select EP Curve Tool. Hold down LMB along first curve, you will notice that the first EP point is snapping on the curve. Snap the end point to second curve then press enter. Create another curve at both curve ends. I edit the last curve but leave third curve in the origin x-axis. Then I rebuild these 2 curves to 4 spans curve. (Figure 6)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (2 of 7) [2000-06-10 23.54.23]
Modeling the Head
(Figure 6) 6.Turn off grid from Display, Grid. Now go to Surfaces, Birail-2 select 2 profile curves and then select 2 rail curves. 7.After surface is formed, press 5 to turn on smooth shade, then press 3 to display highest smoothness. Make sure you are in Components selection mode (Press F8 to switch), hold down RMB to select Hull, and again select Control Vertex from hot box. Keep pulling CV, using direction arrow to toggle point to point until you get something similar to the picture shown. (Figure 7) When I feel I need more CV to control certain part, just click on RMB, from the hotbox select isoparm. Click on any isoparm and drag it to the area that you would like to add in more detail, then go to Edit Surface, Insert Isoparm. After you have satisfy of what you have done, then select the surface, go to Edit, Delete by Type, History to delete construction history.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (3 of 7) [2000-06-10 23.54.23]
Modeling the Head
(Figure 7) 8. Now I will model the jaw using the same method as above to create 4 curves, but only curve marked in red will be edited (pull the CV along X-axis). (Figure 8)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (4 of 7) [2000-06-10 23.54.23]
Modeling the Head
(Figure 8) Rebuild curves, Birail-2 to form surface and then delete the history of the surface. Let¡¦s see what we have now. (Figure 9)
(Figure 9) 9. Select both head and jaw, go to Edit, Duplicate, options set the first Scale input field to -1, Number of Copies to 1, Geometry Type to Copy. Then press Duplicate button. 10. Now we will start stitching the surface to create seamless model. Select both head surfaces, go to Edit Surfaces, Stitch, Global Stitch, options. Set the following setting and press Global Stitch. (Figure 10) http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (5 of 7) [2000-06-10 23.54.23]
Modeling the Head
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (6 of 7) [2000-06-10 23.54.23]
Modeling the Head
(Figure 10) If there are gab between surfaces, just play around with difference Max Separation value. The jaw surface was stitched with same method. With Global Stitch, there is no need to select both surfaces isoparm and stitch edges. It help to save time when you have a lot of surfaces to stitch!
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_head.html (7 of 7) [2000-06-10 23.54.23]
Creating an Eye
Creating an Eye 11.We shall now create an eye for the dragon. Before we start, select all the surfaces, then go to Display, Hide, Hide Selection. First, I created a NURBS sphere, then translate and scale it to the position of an eyeball. When it¡¦s done, select the sphere and hold down RMB to invoke hotbox then go to Actions, Template the eyeball. 12.Next use EP Curve Tool to draw a curve. Snap the start point to end point to create a circle. After that, go to Edit Curves, Open/Close Curves to close the curve. From there duplicate another 4 curves and scale them to 4 difference sizes. Before you scale, go to Modify, Center Pivot. This will put pivot point of the circle to the centre. After this is done, select the curves in order, then perform Loft from Surfaces menu. Press 3 for hi-res display, then delete construction history of the Lofted surface. And also don¡¦t forget to delete the 4 curves that we use to create surface. (Figure 11)
(Figure 11) 13.Hold down RMB to select Hull, then select again Control Vertex from hotbox. Keep on pulling CV, using key pad¡¦s direction arrow to toggle from point to point until you get something similar like picture shown (Figure 12). Make sure the eyelid fit properly to the eyeball.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (1 of 8) [2000-06-10 23.55.06]
Creating an Eye
(Figure 12) 14.Then group them together and translate it above the head model. We are going make a hole out of its head! (Figure 13)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (2 of 8) [2000-06-10 23.55.06]
Creating an Eye
(Figure 13) 15.Select the eyelid, RMB to select the edge isoparm. Go to Edit Curves, Duplicate Surface Curves. This will create a curve circle base on the isoparm that you selected. Then go to Modify, Center Pivot. Finally scale it slightly bigger then the eyelid's surface. (Figure 14)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (3 of 8) [2000-06-10 23.55.06]
Creating an Eye
(Figure 14) 16.We will project this curve on to the head. Select both head surfaces and curve, switch to side orthographic view. Go to Edit Surfaces, Project Curve On Surface, Options. Project Along Active View should be selected. Then click on Project button. This will project the curve on to the surfaces base on the active view; in this case I want it to project from side orthographic so that it will project a similar circle on both head surface. If it¡¦s project from perspective view, you will get a strange and awkward result of curve on surface. Now, let¡¦s take a look at figure 15, the one that I have circle in red was to show the curve that projected on the head surfaces. (Figure 15)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (4 of 8) [2000-06-10 23.55.06]
Creating an Eye
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (5 of 8) [2000-06-10 23.55.06]
Creating an Eye
(Figure 15) 17.Select the surface then go to Edit Surfaces, Trim tool. The surface should have transform into white wireframe (not show in Figure 16). (Figure 16)
(Figure 16) Click on the surface that we want to retain, a yellow dot will appear when clicked then press Enter to confirm the trim. Press 3 for hi-res display. Repeat the same procedure for the other side of the head surface. (Figure 17) Delete curves that use for projection when done.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (6 of 8) [2000-06-10 23.55.06]
Creating an Eye
(Figure 17) 18.I will create a fillet blend between the gab. Select isoparm of eyelid edge, and then shift select Trim Edge of head surface with RMB. While both edges were selected, go to Edit Surfaces, Surface Fillet, Freeform Fillet. Press 3 for hi-res display. With construction history you can adjust the eyelid¡¦s edge and the fillet surface will follow. Once you are satisfy with the result, select the surface blend and delete the construction history. (Figure 18)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (7 of 8) [2000-06-10 23.55.06]
Creating an Eye
(Figure 18)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_eyes.html (8 of 8) [2000-06-10 23.55.06]
Modeling Torso
Modeling Torso 19.Model the torso is easy, use the same method as I use to model the head. First I use EP Curve Tool to create 4 curves on side orthographic. Each curve must intersect with one another. Then I rebuild curves to the amount of span I want. Always remember to keep less number of spans. You can always insert isoparm when more detail is needed. I inserted some isoparm in the area where the neck meet head, so as to create wrinkle below the neck. (Figure 19)
(Figure 19) 20.We can see there are an obvious seam where head joins the neck. (Figure 20) Don¡¦t worry about the clear-cut of the seam, we will fix this with texture transparency later when texture maps the dragon.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_torso.html (1 of 4) [2000-06-10 23.55.36]
Modeling Torso
(Figure 20) 21.To use Texture transparency to blend in 2 surfaces, we need to create another surface. We will using Loft to create 3 spans surfaces. Firstly select head model, then click on Make Live icon, notice that the surface turn into green wireframe. Select EP Curve Tool and draw a curve on the surface. Next Make Live the neck surface and draw curve on it. (Figure 21)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_torso.html (2 of 4) [2000-06-10 23.55.36]
Modeling Torso
(Figure 21) Duplicate one of the curves by using Duplicate Surface Curves then place it in between curves. Select curves in order, then perform Loft to create surface. (Figure 22)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_torso.html (3 of 4) [2000-06-10 23.55.36]
Modeling Torso
(Figure 22)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_torso.html (4 of 4) [2000-06-10 23.55.36]
Modeling Gum and Teeth
Modeling Gum and Teeth 22.The gum is model from a NURBS plane. Before we start, template the head and jaw. Select torso and go to Display, Hide, Hide Selection. Go to Create, NURBS Primitives, Plane, Options. Set the patches U and V to 3 then translate to head position and start to manipulate the CV to form a gum shape. (Figure 23) After that mirror it and stitch it together.
(Figure 23) 23.Tooth is model with revolve technique. Turn on grid; Switch to side orthographic view. Draw a curve on axis origin. Then go to Surfaces, Revolve. (Figure 24) For future texturing, we will detach the model. The top part will be tooth and bottom part will be gum. Select isoparm and go Edit Surfaces, Detach Surface. Then group them together.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_gum.html (1 of 4) [2000-06-10 23.55.55]
Modeling Gum and Teeth
(Figure 24) 24.Use the tooth we just model, duplicate, rotate and scale it to difference sizes. Place them to upper and lower gums. (Figure 25) When you have done, group the gum and teeth together.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_gum.html (2 of 4) [2000-06-10 23.55.55]
Modeling Gum and Teeth
(Figure 25) 25.Now duplicate the tooth again and scale them to a larger size, pull the CVs to make them into horn like shape and place them on the head as horns. Copy a few more and mirror it to something similar as Figure 26. (Figure 26)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_gum.html (3 of 4) [2000-06-10 23.55.55]
Modeling Gum and Teeth
(Figure 26) At last the head of the dragon was completed. Next we will build the dragon's leg. we will build the dragon's leg. l>
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_gum.html (4 of 4) [2000-06-10 23.55.55]
Modeling Legs
Modeling Legs(part I) 26.The leg is created from a cylinder. First, we create a NURBS cylinder, from Channels box, click on Sections, hold down MMB and drag. Note that the number in input field is changing. We will change the number of Sections and Spans to 30. When it is done, translate it to the position we want. (Figure 27)
(Figure 27) 27. We will deform the cylinder into the shape of leg. Before that, select the
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg.html (1 of 5) [2000-06-10 23.56.14]
Modeling Legs
cylinder, press F2 to switch to Animation, go to Deform, Create Lattice. An outline box which surrounds the cylinder will appear. From Channels box change the S Divisions to 2, T Divisions to 10, U Divisions to 4. (Figure 28)
(Figure 28) 28.Select the box that surrounds the cylinder, hold down RMB and select Lattice Point from hotbox. Press w to activate move tool, select the first row of lattice points and tilt it into a position as figure 29 shown. (Figure 29)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg.html (2 of 5) [2000-06-10 23.56.14]
Modeling Legs
(Figure 29) 29. This part will be fillet blend with torso in the future. Switch to side view, from Shading, Shade Option, x-ray. This will make the cylinder become translucent so we can pull points by referring to Image Plane. (Figure 30)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg.html (3 of 5) [2000-06-10 23.56.14]
Modeling Legs
(Figure 30) 30.Continue to pull, push, scale and rotate lattice points until it form into a leg shape. When you are satisfied with it, select the cylinder and delete the construction history to confirm the shape. (Figure 31)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg.html (4 of 5) [2000-06-10 23.56.14]
Modeling Legs
(Figure 31)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg.html (5 of 5) [2000-06-10 23.56.14]
Modeling Legs (partII)
Modeling Legs(part II) 31.Next, we will use Maya Artisan to sculpt the detail of the leg. Make sure the leg is selected, go to Edit Surfaces, Sculpt Surface Tool. Hold down b key and MMB to adjust the brush radius, m key and MMB to adjust the max displacement and start sculpting the surface. Keep your finger near to z key to get ready for undo. (Figure 32)
(Figure 32) 32.When it is done use the same method of creating fillet blend for the eyes to create fillet blend for the leg and torso. (Figure 33)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg2.html (1 of 6) [2000-06-10 23.56.42]
Modeling Legs (partII)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg2.html (2 of 6) [2000-06-10 23.56.42]
Modeling Legs (partII)
(Figure 33) 33.We will use the same method to create fore limb for the dragon. (Figure 34)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg2.html (3 of 6) [2000-06-10 23.56.42]
Modeling Legs (partII)
(Figure 34) 34.Well, we still need toes and fingers to complete the dragon. The toe can be done by using the same technique as horn and teeth, which is revolving from curve. You can use CV pulling or Artisan to sculpt it into the shape you wants. (Figure 35)
(Figure 35) 35.Basically, the fingers are just the same model as toe. From the first toe I had made, I duplicate it, scale it, rotate it and pull the CVs into the shape of finger and place them on to their positions. Instead of fillet blend so many fingers and toes, I decided to use texture transparency to blend the surface. This will help to save up a lot of time. So what I do is to make sure the fingers is intersect properly on to the palm. (Figure 36)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg2.html (4 of 6) [2000-06-10 23.56.42]
Modeling Legs (partII)
(Figure 36) 36.Finally, we have completed the entire model. We can now mirror it to form a complete dragon. Do you still remember in the early part, we had mirrored the head and jaw of dragon and stitched them together. We will now apply the same technique to the body. Group all the part you want to mirror and name it as body. Go to Window, Hypergraph to call up hypergraph window. Select the body group from hypergraph and mirror it to form a complete model. The modeling of the dragon is thus completed. (Figure 37)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg2.html (5 of 6) [2000-06-10 23.56.42]
Modeling Legs (partII)
(Figure 37)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/modeling/dragon/Modeling_leg2.html (6 of 6) [2000-06-10 23.56.42]
Main frame
presented by keongputer digital art kindly mail your comments to: [email protected]
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/contain.html [2000-06-11 00.02.51]
Texture Map NURBS Dragon
Texture Map NURBS Dragon In this section, I would like to use Deep Paint 3D to help me to indicate the location of UV on the NURBS surfaces. But 3D Paint package only recognizes polygons with UV. So, we need to convert NURBS to polygon, then export the polygons to 3D paint program. First, I will create bump map in 3D-paint program, and then I will use PhotoShop to define the bump map. Let start now, 1.Rename all the surfaces you had created, you can do this in the modeling stage. Select a surface, in the Channels window, key in a proper name for your surface. 2.After renamed all the surfaces; I will apply a material for the surfaces.In this case, I would like to use Blinn for the skin as Blinn has the Softest specular highlight among the rest. Open up the Hypershade window, from the visor window's material folder, MMB drag the Blinn to the working space. (Figure 38).
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-1.html (1 of 4) [2000-06-11 00.03.00]
Texture Map NURBS Dragon
(Figure 38) Shift select the surfaces that u wish to assign to Blinn material, then point your mouse to Blinn in working space, Left click on Blinn (don't let go, a menu will pop- up, select Assign Material to Selected. (Figure 39)
(Figure 39) 3. Toggle to Rendering mode; create a Direction Light from light panel. Place it to light up your model. Save your work. 4.1 Now, we going to convert NURBS to polygons for Deep Paint 3D.I will going to do it part by part. First, I will do for left side head. Select the left side head, toggle to Modeling mode, go to Display->NURBS components->Normal (shaded mode) to check the Surface Normal is pointing out. Go to your perspective window, in the Shading panel->smooth Shade Selected Item to view the result. If the "hair" pointing in, go to Edit Surface panel->Reverse Surface Direction. This is to make sure that the polygon¡¦s surface normal point to the correct direction (Figure 40)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-1.html (2 of 4) [2000-06-11 00.03.00]
Texture Map NURBS Dragon
(Figure 40) 4.2 While the surface still selected, go to Polygons panel->NURBS to Polygon options. Set number U & V to 24. Click Tessellate. Move up the polygons, Now you will have the polygons Left Head and NURBS Left Head still remain. (Figure 41)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-1.html (3 of 4) [2000-06-11 00.03.00]
Texture Map NURBS Dragon
(Figure 41) 4.3 Go to your Window panel -> General editor ->Plug-in Manager, select obj. Export.mll to loaded and auto load. Now, have your Lt_Head selected polygon, go to File->Export Selection's options, pick the file type as OBJexport, then save it to obj directory under your project directory or any directory that you like.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-1.html (4 of 4) [2000-06-11 00.03.00]
5
5.1 Ok, we are going to leave Maya for a while. Launch any paint package that you like to import the Lt_Head. I will use Deep Paint 3D in this work. File -> open to the directory contain Lt_Head. obj and you will see this Material import window. In the Object column, your will find UV word, that's mean your polygons are prepared with UV, It's ready to paint! (Figure 42)
(Figure 42) 5.2Click on the Material column's gray area to call up Set Material Size window, enter your texture size. It's good to keep your master copy texture in higher resolution that u can scale it down later according to your needs. 5.3 I prefer to work on bump map as a colour map in grey rather then paint the real bump on the model. So I click on C (colour) in Material Channel, then click on colour in Add New Channel. Select white as my colour and will get this. (Figure43)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (1 of 8) [2000-06-11 00.03.50]
5
(Figure43) 5.4 After painted (figure 44)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (2 of 8) [2000-06-11 00.03.50]
5
(figure 44) click on export material to photoshop icon to further define the texture in photoshop. (Figure 45)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (3 of 8) [2000-06-11 00.03.50]
5
(Figure 45) or save your image in 2D file format for Photoshop. 5.5 This is my final bump map for Lt_Head. (Figure 46) Save your work to popular file type such as Targa in your texture directory.
(Figure 46) 5.6 From the bump texture, I used Photoshop's layering capability to create my colour map (Figure 47)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (4 of 8) [2000-06-11 00.03.50]
5
(Figure 47) as well as specular map. (Figure 48)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (5 of 8) [2000-06-11 00.03.50]
5
(Figure 48) This texture can be reused to it mirrored or duplicated object without redraw your textures. It perfectly matches to them. So you only need to do for left side head 's colour, bump and specular and these are reusable for right side head. As well as one side of limb for map 2 side. 5.7 I repeat these steps from 4.1 to 5.6 for the rest of the surfaces that I wish to do 2D mapping. (Figure 49)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (6 of 8) [2000-06-11 00.03.50]
5
(Figure 49) 5.8 As I proceed to the body, I found out that the creature's body in a piece is pretty hard to control my mapping, so I decided to detach it and rename them into 3 different surfaces: neck, torso and tail. Then stitched them back accordingly. (Figure 50)
(Figure 50)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (7 of 8) [2000-06-11 00.03.50]
5
5.9 I deleted all of the polygon geometry in Maya after I completed my 2D textures paint because I going to use this textures map as UV map for my NURBS geometry. To delete all polygons geometry, go to Edit panel ->Select All by Type -> Polygon Geometry then press Backspace key to delete them. Now we remain all the NURBS as beginning stage. press Backspace key to delete them. Now we remain all the NURBS as beginning stage.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-2.html (8 of 8) [2000-06-11 00.03.50]
Using Triple Shading Switch to Shade the Creature
Using Triple Shading Switch to Shade the Creature This is the time to see how our textures go with the surfaces. As u can see, I will assign colour, bump and specular map to Blinn material. I'm going to use Switch node to enable me to specify a shading group for many objects to have different characteristic within the shaded members. 1.Open Hypershade window and locate the early created Blinn. Rename it to Skin. Double click on it to bring up it's Attribute Editor. 2.Click on the colour's map button (Figure52)
(Figure52) and you will bring up Create Render Node window. 3.As for colour maps; the Triple Shading Switch will allow the switching of three-channel values (RGB). With this switch you can have a single shader control the general surface attribute of many objects but different texture of each object. Click on Utilities tab ->Switch Utilities->Triple Shading Switch. (Figure 53)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (1 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
(Figure 53) 4. Open Outliner window, put it beside Triple Shading Switch1 Attribute Editor window, select the renamed surface, MMB drag to inshape's column. (Figure 54)
(Figure 54) 5.Click on Lt_head's inTriple column, then click on Map Item on the above will bring up Create Render Node window. Click on File under Texture's tab (figure 55)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (2 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
(figure 55) and will bring you to this window. (Figure 56) ¡@ load the texture from your textures directory and change the "File #" to" Lt_Head colour".
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (3 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
(Figure 56) 6.Go to your perspective window's press 6 to turn on Hardware Texturing. (Figure 57)
(Figure 57)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (4 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
7.Repeat step 5 for the rest of inTriple's column. (Figure 58)
(Figure 58) 8.I will use the same way to map specular maps to the surfaces. Now, double click on the Skin (Blinn) from the Hypershade window's working space to bring up its attribute window. 9.This time, I will click on Specular Colour's map button to add in Triple Shading Switch to allow the Skin (Blinn)'s shader to control the general surface attribute of many objects but different specular map of each object. (Figure 59)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (5 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
(Figure 59) You may want to take a look at Hypershader's workspace to view the connection between them. Right click and hold on the Skin (Blinn) to bring up a pop-up menu, select Graph Shader Network to view their render connection. (Figure 60)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (6 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
(Figure 60) To see how's the specular maps placed on the model, go to the Skin's Attribute Editor, expend Hardware Texturing, select specular color. (Figure 61)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (7 of 8) [2000-06-11 00.04.38]
Using Triple Shading Switch to Shade the Creature
(Figure 61)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-3.htm (8 of 8) [2000-06-11 00.04.38]
Using Single Shading Switch to Map Bump Maps
Using Single Shading Switch to Map Bump Maps The Single Shading Switch allows the switching of single float attributes, for example, bump depth. 1, Bring up the Skin (Blinn) attribute, click on Bump mapping's map button, click on Utilities tab and select Bump 2d. (Figure 62)
(Figure 62) 2. From the Bump 2d window, click on Bump Value's map button, Utilities Tab and Single Shading Switch. (Figure 63)
(Figure 63) 3. Doing the same way as before to load In Shape and In Single. (Figure 64).
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-4.html (1 of 2) [2000-06-11 00.05.21]
Using Single Shading Switch to Map Bump Maps
(Figure 64) You may want to do a test render to view the result.
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-4.html (2 of 2) [2000-06-11 00.05.21]
Texture Map Organic NURBS
Map with procedural map. I will use Maya's build in procedural map to map the horns, nails and teeth. 1. Create a Phong rename it to "horns" and assign it to horn's models. 2.To create bump map for the horns .In the Hypershade window, MMB drag and drop bump 2d on the Phong's node. Then MMB drag and drop Fractral on Bump 2d node to create render network (figure 65)
(figure 65) Perform a test render using IPR render view. Select an area in IPR window, tune the bump 2d and fractral node to have interactive update of your rendering image. Colour and noise were added using the drag and drop way. (figure 66)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-5.html (1 of 5) [2000-06-11 00.05.41]
Texture Map Organic NURBS
(figure 66) After I've done, I use the same way to create textures for nails and teeth. Check all the geometry with texture map in Hardware Texturing mode. (Figure 66a)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-5.html (2 of 5) [2000-06-11 00.05.41]
Texture Map Organic NURBS
(Figure 66a) Fine Tuning with IPR We are completed mapping the creature. The last thing to do is fine-tune the materials' attribute that we assigned in early. IPR will do a great job in this aspect. But before that, you need to setup some lights to light-up your character. (Figure 67)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-5.html (3 of 5) [2000-06-11 00.05.41]
Texture Map Organic NURBS
(Figure 67) I open up the attribute and adjust some value to see how they influent the model. After I satisfy with the setting, I create a fill light, a back light and a bounce light to make the character more interesting. Perform a final render (figure 69)
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-5.html (4 of 5) [2000-06-11 00.05.41]
Texture Map Organic NURBS
(figure 69) E-mail : [email protected]
http://micro.ee.nthu.edu.tw/~u850961/tutor/html/texturing/Nurb_dragon/Texture1-5.html (5 of 5) [2000-06-11 00.05.41]
Maya Tutorials - Creating the logo effect from Matrix
HIGHEND3D > Maya > Tips & Tutorials
Creating the logo effect from Matrix Maya expressions and dynamics is great. We can produce some cool special effects using maya. Now we are going to reproduce some of the logo effect of the film "Matrix" using maya particles and expressions.Now let us begin. First we need to create all the 26 letters ,from "a" to "z". Creat----text, open the option ,set the text type to poly. Type "abcd.......xyz" in the text box. Press "Create". [Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Tools - Tips & Tutorials - Users Links
Now you have all the letters you want.Open the outline window, you can find that maya has create two groups. One contains all the curve of the letters and another contains the 26 mesh objects. Delete the group contains all the curve. Here we need only the group contains all the polygon letters. Now we need to write a script to rename all the polygen letters to names that are easy for later use.use the script below to rename all the letters. Of course you can rename them by hand. ( I am not sure the script is optimised, maybe you can write one better, but this one really dose the work). int $i; string $t="abcdefghijklmnopqrstuvwxyz"; string $cmd="rename Trim_Char_"; for($i=1;$i<=26;$i++) {string $temp; $temp=eval("substring "+$t+" "+$i+" "+$i); print($temp); eval($cmd+$temp+"_1_1 "+"text"+$i); };
file:///D|/TEMP/Maya Tutorials - Creating the logo effect from Matrix.htm (1 of 5) [24.6.2000 ?. 13:41:43]
Maya Tutorials - Creating the logo effect from Matrix
type the script in your script editor and execute it.Now your outline window should show this.
now select all the polygon letters and Center pivot, translate to abs(0,0,0), then freezetransform. Then hide all of them. Create a 10*20 nurbs plane. Select the plane and add a particle emitter to it.The emitter type is set to surface. Rotate the plane 180 degrees along z axis. Set the speed of the emission to about 15. emitter rate to 0.2 . Now we will add one attribute to the particleshape node . Select particleshape1, open the attribute editor. click the "general" under "add dynamic attributes"section. Add a new attribute named "index" and set the attribute type to "Array".
file:///D|/TEMP/Maya Tutorials - Creating the logo effect from Matrix.htm (2 of 5) [24.6.2000 ?. 13:41:43]
Maya Tutorials - Creating the logo effect from Matrix
Next to make an particleinstancer.Select all the polygen letters in the outline window( note: dont select the group), creat particle instancer.In the option window, turn on "Allow All data types".select the "objectindex" to the new attribute "index".
file:///D|/TEMP/Maya Tutorials - Creating the logo effect from Matrix.htm (3 of 5) [24.6.2000 ?. 13:41:43]
Maya Tutorials - Creating the logo effect from Matrix
Now you will see all the particles in the scene turned int letter "a". we are going to add an expressions to make each of the particles to instance one random letter. Select particleshape1 and open the expression editor.Add the runtime expression index=rand(1,26); Play the animtion and you will find that each particles are now instancing a random letter and changes every frame. It is now near the effect we want. But we still need to write some expressions to control the motion of each particle. Select particleshape1 and add one another array attribute "gate". It has not much meaning , just for used in the expression. Add the runtime expressions below to the particleshape1. particleShape1.index=rand(1,26); vector $temp=particleShape1.worldVelocity; if ($temp.y<=rand(-10,-5)) { particleShape1.gate=1;}; if ($temp.y>=(-1)) {particleShape1.gate=0;}; if (particleShape1.gate==1){ particleShape1.acceleration=<<0,rand(20,25),0>>; //print("aaaa"); }; if (particleShape1.gate==0) { particleShape1.acceleration=<<0,rand(-25,-20),0>>; //print("bbbb"); }; These expressions is to control the acceleration of each particles along the y axis. Play the animation and you can now get a cool random acceleratoin effect for the particles; Finally you need to position your camera and do render. I rendered the front camera. I think it looks good. When done, you can use Maya fusion or some other software to add some motion blur or tail effects. Here is a picture of my last effect.
file:///D|/TEMP/Maya Tutorials - Creating the logo effect from Matrix.htm (4 of 5) [24.6.2000 ?. 13:41:43]
Maya Tutorials - Creating the logo effect from Matrix
At last, you can change the expressions to get some other special effects. All is you imagine. Have Fun ¡¡ Harley Zhao Original Force Animation Studio ¡¡
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board
Contact Us Advertise
Produced by Will McCullough. Copyright © 1999-2000 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
file:///D|/TEMP/Maya Tutorials - Creating the logo effect from Matrix.htm (5 of 5) [24.6.2000 ?. 13:41:43]
Hypergraph
Hypergraph Contents
Hypergraph 1 Hypergraph
5
Understanding the Hypergraph panel
6
Understanding scene hierarchy terminology Using the scene hierarchy
8
10
Expanding scene hierarchy nodes
10
Displaying special nodes and connections
12
Shape, invisible, and underworld nodes
12
Expression, constraint, and deformer connections Parenting objects
15
Rearranging scene hierarchy nodes
17
Changing a node’s relative position Creating a free-form hierarchy
18
19
Displaying a background image with a scene hierarchy Understanding the dependency graph Using a dependency graph
20
22
23
Displaying render node connections
24
Displaying upstream and downstream connections Dragging nodes into a dependency graph Connecting nodes in a dependency graph
30 32
Updating the layout of a dependency graph Clearing the contents of a dependency graph Returning to the scene hierarchy
26
29
Disconnecting nodes in a dependency graph
Editing objects
14
40 40
40
41
Selecting objects
41
Adding and selecting an IK handle Renaming an object
42
43
Using Maya: Hypergraph, Sets & Expressions
3
Hypergraph Contents Hiding an object in the workspace Editing an object’s attributes Creating a render node Altering the view of a graph Tracking the view
46
Dollying the view
46
Dollying a region
46
44
45
45 45
Fitting an entire graph in the window
48
Centering selected nodes in the window Centering a hierarchy in the window
48
49
Centering a hierarchy branch in the window Adjusting view transition speed Setting graph update options
50 50
Undoing a view of a scene hierarchy Using bookmarks for graph views
51 51
Displaying a graph vertically or horizontally Rebuilding the graphs
4
49
54
Using Maya: Hypergraph, Sets & Expressions
53
H ypergraph
1
Hypergraph The Hypergraph shows a graphical relationship between components of a scene. You can display two kinds of graphs in the Hypergraph: the scene hierarchy or dependency graph. The scene hierarchy shows the ordered arrangement of objects, lights, cameras, and other items that make up a scene. It’s similar to the Outliner but has more features and visual aids for working with the hierarchy of scene components. Here’s an example scene hierarchy:
A dependency graph shows the architectural connections between Maya entities that input and output data. For example, it shows connections between shading group elements that create an object’s material appearance. This chapter describes the following topics: •
“Understanding the Hypergraph panel” on page 6
•
“Understanding scene hierarchy terminology” on page 8
•
“Using the scene hierarchy” on page 10 Using Maya: Hypergraph, Sets & Expressions
5
Hypergraph Understanding the Hypergraph panel •
“Understanding the dependency graph” on page 22
•
“Using a dependency graph” on page 23
•
“Editing objects” on page 41
•
“Altering the view of a graph” on page 45
Understanding the Hypergraph panel You can launch the Hypergraph in its own window or in a workspace panel. Displaying it in a workspace panel has the advantage of letting you see the Maya user interface and the Hypergraph without having to reposition the windows.
To start the Hypergraph in its own window: From the menu bar or Hotbox, select Window→Hypergraph. The Hypergraph appears:
Menu bar Tool bar
Scale and move the window as needed.
To start the Hypergraph in a workspace panel: From a workspace panel, select Panels→Panel→Hypergraph.
6
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Understanding the Hypergraph panel
Hypergraph panel items
The tool bar has icons for commonly used Hypergraph menu bar selections. To see the selection that an icon represents, drag the mouse pointer over the icon and look in the blue help box at the bottom of the Maya window. The name of the selection appears there. When you display the Hypergraph the first time, the scene hierarchy is displayed. In subsequent displays of the Hypergraph, the scene hierarchy or dependency graph appears, depending on which was displayed the previous time you closed the window. Note that a scene hierarchy is also referred to as a DAG, an abbreviation for directed acyclic graph. If you display the scene hierarchy, invisible objects such as the perspective, top, front, and side cameras do not appear in the graph by default. If you display the scene hierarchy for a new, empty scene, you’ll see no graph. In contrast, the Outliner shows the default cameras unless you choose not to display them. .
By default, the scene hierarchy doesn’t show these default cameras displayed in the Outliner.
Note Unless instructions in this chapter state otherwise, make all menu choices from the Hypergraph’s menu bar.
Using Maya: Hypergraph, Sets & Expressions
7
H ypergraph
The Hypergraph’s menu bar has entries for working with the scene hierarchy or dependency graph.
Hypergraph Understanding scene hierarchy terminology
Understanding scene hierarchy terminology A common technique in modeling, rendering, and animation is to work with objects in a hierarchical relationship. To work with a hierarchy you must understand the terminology for describing the relationship of objects. We use the following figure to define common hierarchy terminology:
Parent
An object or other item that controls attributes of one or more children. A parent can also be the child of another parent. In the figure, InnerSolarSystem is a parent of Sun. Sun is a parent of Mercury, Venus, Earth, and Mars. Earth is a parent of Moon.
Child
An object having attributes controlled by its parent. A child can be the parent of other children. A child in the graph is connected to its parent by an indented right angle line. Sun is a child of InnerSolarSystem. Mercury, Venus, Earth, and Mars are children of Sun. Moon is a child of Earth.
Node
8
A parent, child, or independent item. This refers generally to any box in the graph.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Understanding scene hierarchy terminology
Subnode
Any node below another node in the hierarchy. The subnodes of InnerSolarSystem are Sun, Mercury, Venus, Earth, Moon, and Mars. The subnodes of Sun are Mercury, Venus, Earth, Moon, and Mars. The subnode of Earth is Moon. Moon and Mars have no subnode.
Branch
All nodes along a path from a parent to child. A branch from Sun to Moon includes Sun, Earth, and Moon.
Hierarchy
The arrangement of all connected nodes that make up a scene or object. The scene hierarchy is made of all nodes in the figure. The Earth hierarchy consists of Earth and Moon.
Transform node A node that contains an object’s transformation attributes—
values for its translate, rotation, scale, and so on. It also holds information on parent-child relationships it has with other nodes. InnerSolarSystem, Sun, Moon, and all other boxes shown in the example are transform nodes. Shape node
A shape node holds an object’s geometry attributes or attributes other than the object’s transform node attributes. Shape nodes do not appear in the scene hierarchy by default. To display shape nodes, see “Displaying special nodes and connections” on page 12.
The scene hierarchy and the dependency graph display animated nodes as slanted boxes. If you animate a node with an expression, it displays a regular rectangle rather than a slanted box. All other animation techniques display a slanted box. Specifically, a slanted box indicates that the node has a param curve connected to it.
Not animated
Expression animation
Other animation
Using Maya: Hypergraph, Sets & Expressions
9
H ypergraph
InnerSolarSystem, Sun, Moon, and all other boxes in the graph are nodes.
Hypergraph Using the scene hierarchy
Using the scene hierarchy You can use the scene hierarchy to: •
display special nodes and connections You can display shape, invisible, and underworld nodes. You can also show expression, constraint, and deformer connections that link nodes. See “Displaying special nodes and connections” on page 12.
•
make an object the child of a parent object (known as parenting) A child adopts attribute changes made to the parent. See “Parenting objects” on page 15.
•
reorder the position of nodes See “Rearranging scene hierarchy nodes” on page 17.
•
create a free-form graph of the hierarchy that suits your visual preference See “Creating a free-form hierarchy” on page 19.
•
select, rename, and hide objects, and edit attributes of an object See “Editing objects” on page 41.
•
examine the structure of the scene The Outliner lists the components of a scene as an indented list. The Hypergraph shows the relationship of the objects of the scene graphically. See “Altering the view of a graph” on page 45 for details on navigating the view of the graph.
Expanding scene hierarchy nodes As you examine a scene hierarchy, you can expand or collapse the display of nodes. Collapsing nodes is helpful for lessening clutter in a hierarchy. You expand a node to see nodes below it. For a selected node, you can display: •
subnodes one level below the node
•
all subnodes below a node When you know where a node is in the workspace but you’re not sure of its graph position, you can select the node in the workspace and expand all nodes necessary to display and highlight it.
10
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy A selected node is yellow in the scene hierarchy.
1
Select the node. If the node is not visible in the scene hierarchy, select it in the workspace or Outliner.
2
Choose: Edit→Expand to expand a node to one level below. Edit→Expand All to expand all subnodes below a node. Edit→Show Selected to display and expand a node not visible in the graph.
A red arrow appears below a node if it’s collapsed.
Expanded node
To collapse a node: 1
Select the node.
2
Choose Edit→Collapse.
Using Maya: Hypergraph, Sets & Expressions
11
H ypergraph
To expand a node:
Hypergraph Using the scene hierarchy
Tips •
To expand or collapse a node, double-click it.
•
To quickly select Hypergraph menus, click the right mouse button in an empty part of the Hypergraph window.
•
To display context-sensitive Hypergraph menus, drag the mouse over a node and click the right mouse button. These menus are also available from the main Hypergraph menus, but they apply only to the selected node.
•
For details on navigating the view of the graph, see “Altering the view of a graph” on page 45.
Displaying special nodes and connections You can display shape, invisible, and underworld nodes in the scene hierarchy. You can also display expression, constraint, and deformer connections that link different nodes.
Shape, invisible, and underworld nodes By default, the scene hierarchy does not display shape nodes, invisible nodes, or underworld nodes. It displays only transform nodes—nodes that hold attributes and other information on an object’s transformation and parent-child relationships. A shape node holds an object’s geometry attributes or attributes other than the object’s transform node attributes. A shape node is a child of a transform node. A transform node has only one shape node. An invisible node is any object you’ve hidden with Display→Hide from Maya’s menu bar. The default cameras top, front, side, and persp are also invisible nodes. An underworld node is a pair of nodes below a shape node. When you create a curve on a NURBS surface, Maya generates an underworld transform node and shape node below the shape node of the surface. The CV positions of underworld nodes have UV coordinates on the surface rather than coordinates in world or local space.
12
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
To display invisible nodes, object shape nodes, or underworld nodes: H ypergraph
Turn on these options: Options→Show→Shape Nodes Options→Show→Invisible Nodes Options→Show→Underworld Nodes The graph displays invisible nodes with darker coloring. Underworld nodes appear only if you also display shape nodes in the graph. A dotted line in the scene hierarchy indicates a connection to an underworld node. Connections to instanced objects are also indicated by dotted lines.
Note Hypergraph option settings are saved with a scene file. The options are not saved for Maya globally.
Example Suppose you use Primitives→Create NURBS→Sphere from the Modeling menu to create a sphere. Maya creates a transform node and a shape node. The sphere’s shape node holds the mathematical description of the sphere’s shape. The sphere’s transform node holds the sphere’s position, scaling, rotation, and so on. The shape node is the child of the transform node. If you select Options→Show→Shape Nodes, the scene hierarchy shows these nodes for the sphere:
Maya gives the nodes the default names shown in the preceding figure. The nurbsSphere1 is the transform node, nurbsSphereShape1 is the shape node. If you rename the transform node, for example, as Bubble, Maya renames the shape node BubbleShape. If you rename the shape node, Maya does not rename the transform node. Maya doesn’t transmit a child’s attribute changes up to its parent. Using Maya: Hypergraph, Sets & Expressions
13
Hypergraph Using the scene hierarchy
Example Suppose you use Primitives→Create NURBS→Sphere to create a sphere. Maya creates a transform node and a sphere node. Suppose further you select Modify→Make Live, then use the Curves→CV Curve Tool to draw a curve on the surface of the sphere. If you turn on the display of shape nodes and underworld nodes, the scene hierarchy appears as follows:
Maya gives the nodes the default names shown. The nurbsSphere1 is the transform node of the sphere, nurbsSphereShape1 is the shape node. The curve1 and curveShape1 nodes are underworld nodes for the curve created on the sphere’s surface. When a curve-on-surface is hard to select in the workspace because of crowding or complex geometry, you can select it easily in the scene hierarchy with underworld nodes displayed.
Expression, constraint, and deformer connections You can display color-coded lines in the scene hierarchy that illustrate nodes connected by an expression, constraint, or deformer.
To display nodes connected by an expression, constraint, or deformer: Turn on any or all of these options: Options→Show→Expression Connections Options→Show→Constraint Connections Options→Show→Deformer Connections To turn off display of these connections, turn off the appropriate options.
14
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
Example
The expression links the two values. When you move Ball up or down in the workspace (in a Y-axis direction), Cone moves up or down the same amount. If you select Options→Show→Expression Connections, the scene hierarchy displays this:
This line means attributes in the two nodes are connected, for instance, by an expression.
Tip You can change the color-coding of the connection lines and other important entities by selecting Options→Customize→UI Colors from Maya’s main menu bar.
Parenting objects You can make an object the child of a parent object. The child adopts some or all attribute changes made to the parent. For example, suppose you animate a planet to orbit the center of the workspace. If you make a moon the child of the planet, it follows the motion of the planet. Though the moon is the child of the planet, you can also give the moon motion that’s independent of the planet. For example, you can make it orbit the planet. If you later change the orbiting motion of the planet, the moon continues to follow the planet’s motion, but stills retains its original orbiting motion.
Using Maya: Hypergraph, Sets & Expressions
15
H ypergraph
Suppose you create a NURBS sphere named Ball and a NURBS cone named Cone. You write an expression to assign the value of Ball’s translateY attribute to Cone’s translateY attribute.
Hypergraph Using the scene hierarchy To control multiple objects with one node, you can also create an empty group and make several objects its children. By grouping objects under one node, you can move, shade, apply texture, and do many other actions to all the objects by working with the group node.
Example
BackTire
FrontTire
1. Create original objects.
BikeTires
2. Create empty node and name it BikeTires.
BikeTires
3. Group objects under BikeTires.
BackTire
4. Move, rotate, shade BikeTires.
FrontTire
To parent an object: In the scene hierarchy, use the middle mouse button to drag the child node on the parent node. Use the middle mouse button to drag Moon onto Planet.
Moon is now a child of Planet.
If the parent node is not visible in the window, drag the child toward in the direction of the parent. The graph view scrolls as you drag into the Hypergraph’s window border.
16
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
To parent several objects to a new node: From the Maya main menu bar, choose Edit→Create Empty Group.
H ypergraph
1
A new node appears in the scene hierarchy named null1. This node is an invisible, empty object. 2
Use the middle mouse button to drag an object node onto the null1 node. The object becomes a child of the null1 node.
3
Repeat this step for other objects to be children of the group.
4
Rename the null1 node to something more meaningful. For example, you might rename a group containing four flower petals as flower. See “Renaming an object” on page 43. The scene hierarchy displays the objects parented to the group node:
If you modify the group node attributes, its corresponding member’s attributes also are modified. For example, if you scale down a flower group node, the four petals scale down also.
To break the relationship between parent and child: With the middle mouse button, drag the child node to an empty spot in the workspace.
Rearranging scene hierarchy nodes You can rearrange the position of nodes in a scene hierarchy to suit your preferences as follows: •
Move a node’s relative position.
Using Maya: Hypergraph, Sets & Expressions
17
Hypergraph Using the scene hierarchy •
Create a free-form scene hierarchy.
•
Display the graph vertically or horizontally. See “Displaying a graph vertically or horizontally” on page 53. Note that Maya updates the scene hierarchy as you modify a scene.
Changing a node’s relative position You can move a node’s relative position vertically or horizontally in a scene hierarchy. You might want to do this, for example, to make the node’s graph position correspond to its spatial position in the workspace. Be aware that rearranging an object’s position in the Hypergraph might alter its behavior or appearance in your scene. Reordering a node’s position in the graph affects Maya’s evaluation order for the object. The evaluation order occurs from left to right and top to bottom for a scene hierarchy displayed in automatic layout. For example, Maya typically renders nodes in the order they appear in the scene hierarchy. Changing this order changes their rendering order. If a node has transparency, however, Maya puts the node in a delayed render queue. Maya renders this queue after all opaque objects. To see the evaluation order for a graph in free-form layout, select Layout→Automatic Layout. To return to the free-form layout, select Layout→Freeform Layout.
To move a node in the graph: Use Ctrl-middle mouse button to drag the node on top of another node. In a horizontal graph, the dragged node replaces the other node’s position. The other node’s position gets pushed to the right. In a vertical graph, the dragged node replaces the other node’s position. The other node’s position gets pushed downward.
Example Suppose you’ve created a scene containing several of the solar system’s planets, including earth. As you add each planet, the scene hierarchy puts a node representing the planet in the graph.
18
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
H ypergraph
Maya puts each new node in the graph to the right of existing nodes. The location of the planet nodes in the graph might not represent the spatial relationship of the planets in the workspace, as in this example:
Here, earth sits further from mercury than mars. In the actual solar system and in your workspace, this is not true. To make the graph reflect the positioning of the earth in the workspace, use Ctrl-middle mouse button to drag the earth on top of mars. Maya positions the node to the right of venus and to the left of mars. Thereafter, you’ll know where to look for earth in the scene hierarchy.
Creating a free-form hierarchy Maya lets you choose a free-form layout for the scene hierarchy to suit your node position preferences. By doing so, you can make the graph’s appearance resemble the appearance of characters or other complex objects in your scene. This helps you find and select components from the hierarchy more quickly. For example, suppose you’ve modeled a human hand. You can customize the graph so the location of its nodes resembles the arrangement of the joints that represent the fingers and palm:
Using Maya: Hypergraph, Sets & Expressions
19
Hypergraph Using the scene hierarchy
Important Move as few nodes as necessary. When you drag a node to a new position in the graph, you increase the scene’s file size and the Maya processing time needed to work with the scene. When you move a parent node, Maya automatically moves its children with it. Automatically moved children do not increase the file size and processing time.
To make a free-form graph: 1
Select Options→Layout→Freeform Layout.
2
Drag nodes to the desired positions in the graph. If the spot where you want to put a node is not visible in the window, drag the node past the edge of the window. The window scrolls in the direction you drag. To drag two or more nodes to another position, click the first node, Shiftclick the second node and any other nodes, then drag to the desired position. To drag a parent but not its children, Ctrl-Shift-click the node and drag to the desired position.
To return to the automatically generated layout: Select Options→Layout→Automatic Layout. You can return to your previous free-form graph arrangement by turning off Options→Layout→Freeform Layout.
To reset the free-form graph: If you create a free-form graph and you decide you no longer like its appearance, you can reset the graph to the automatic layout. 1
Select Edit→Reset Freeform Layout.
2
Click Yes when asked to confirm your selection.
Displaying a background image with a scene hierarchy You can display a single image of your choice as the background for a scene hierarchy. This is helpful if you want to create a free-form hierarchy that lets you identify and select a character’s joints and nodes more easily.
20
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
You can display the image in the background of a free-form hierarchy, then position nodes and joints to match the character skeleton. This helps you identify scene hierarchy components more quickly. An example follows:
Using Maya: Hypergraph, Sets & Expressions
21
H ypergraph
For example, suppose you’ve modeled a human character. Suppose further you’ve rendered an image of the character or used a snapshot utility to capture an image of the character’s skeleton in the workspace.
Hypergraph Understanding the dependency graph The character skeleton exists behind the scene hierarchy. With this arrangement, you can quickly find nodes, for example, that represents the character’s feet and ankles.
To import the background image: 1
Choose View→Load Background Image. The Load Image window appears.
2
Use the window to select the image. Make sure the image name is in the text box at the bottom of the Load Image window, then click the Load Image button. The image appears in the scene hierarchy. Note that the image appears for the automatic layout as well as for the free-form layout. Having a background image for the automatic layout has no practical purpose. The node positions for the automatic layout are fixed.
3
Dolly or track to bring the image into view.
4
In Freeform Layout mode, move nodes to positions on top of the image. Whenever you display the scene hierarchy in the Hypergraph, the image appears behind the nodes.
To turn the display of the background image off or on: Turn Options→Show→Background Image (in free-form) on or off. You can display the image in the background of a free-form hierarchy.
Understanding the dependency graph The dependency graph displays connections between nodes in Maya that input and output data. A dependency graph node can represent an object’s geometry, for example, a NURBS sphere. A node can also represent a Maya operation such as a deformer. Inputs and outputs are the connections between nodes, including direction of influence. A dependency graph has no parent-child relationships, only data flow. You can display a dependency graph, for example, to see the data flow between nodes that make up an object’s construction history or shading. All nodes in a scene hierarchy also can be displayed in a dependency graph. However, not all nodes in a dependency can be displayed in a scene graph.
22
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
H ypergraph
For example, a NURBS sphere’s transform and shape nodes appear in a scene graph and therefore can be displayed in a dependency graph. A shading group node or deformer operation node that appears in a dependency graph never appears in a scene hierarchy. A dependency graph node takes input data from one or more other nodes and uses the input to create output data. When you create models, deform objects, animate, process audio, and so on, dependency graph nodes work with the data involved. Though we refer to a dependency graph as a singular graph, be aware you can display two or more independent graphs of connected nodes in the same window. We refer to each independent graph also as a dependency graph. Maya updates the dependency graph as you modify a scene.
Using a dependency graph The dependency graph is a tool for programmers who extend Maya capabilities. If you’re an advanced Maya user, you’ll also find it useful to: •
examine render node connections See “Displaying render node connections” on page 24.
•
examine other node connections See “Displaying upstream and downstream connections” on page 26.
•
disconnect rendering nodes and other nodes See “Disconnecting nodes in a dependency graph” on page 30.
•
connect rendering nodes and other nodes See “Connecting nodes in a dependency graph” on page 32. Avoid disconnecting and connecting nodes unless you have an understanding of Maya’s architecture. You’ll spare yourself frustration tracking down resulting problems. See “Editing objects” on page 41 and “Altering the view of a graph” on page 45 for additional details on working with a dependency graph.
Using Maya: Hypergraph, Sets & Expressions
23
Hypergraph Using a dependency graph
Tip As a new user of the Hypergraph, you might be unsure whether you’re looking at the scene hierarchy or a dependency graph. If you see arrows between nodes, you’re looking at a dependency graph. If Scene Hierarchy under the Graph menu is dim, you’re looking at the scene hierarchy.
Displaying render node connections You can show connections to shading groups, materials, textures, and lights. See Using Maya: Rendering for details.
To display render node connections: Choose one of these options: Rendering→Show Shading Groups Rendering→Show Materials Rendering→Show Textures Rendering→Show Lights
Example Suppose you create a NURBS sphere, then use the Multilister to create and assign a Phong shading group to it. Next you use the Multilister to create a 2D checker texture and assign it to the Phong node.
24
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph The Multilister displays the following contents: H ypergraph
The following dependency graph appears when you choose Rendering→Show Shading Groups:
Connection lines
Using Maya: Hypergraph, Sets & Expressions
25
Hypergraph Using a dependency graph The connection lines between nodes show connection direction. The connection line originates at a node that outputs data, and the line points to a node receiving the data as input. The preceding figure shows that the flow of output goes from place2dTexture1 to checker1, to phong1, and finally to the phong1SG shading group. Though you can see most of the same nodes in the Multilister, the dependency graph shows the nodes in a flow diagram. This makes it easy to see the connections between the nodes that make up a shading group. The figure also shows that nurbsSphereShape1 outputs its data to the phong1SG shading group. The phong1SG shading group therefore controls the color of the NURBS sphere. If you move your mouse pointer over a connection line, small white boxes appear next to the input node and output node. The white box next to an input node shows the node’s name and attribute that receives the input.
phong1.color
checker1.outColor
Mouse pointer
The white box next to an output node shows the node’s name and attribute that provides the output. Each node name and attribute is separated by a period, for example, checker1.outColor and phong1.color. In the preceding figure, the outColor attribute of checker1 is output to the color attribute of phong1. In many cases, you must be familiar with Maya internal operation details to understand the node and attribute names you see in the white boxes.
Displaying upstream and downstream connections You can show upstream and downstream connections to a selected node. An upstream connection is a node that provides input to the selected node. A downstream connection is a node that receives input from the selected node. To see connections to most objects, you must select the shape node of the object rather than the transform node.
26
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
To select a node and display its connections: Select the node.
H ypergraph
1
To choose a shape node from the scene hierarchy, make sure Options→Show→Shape Nodes is on.
Tip You can select an object’s shape node in the scene hierarchy without showing shape nodes. Select the object’s transform node, put the mouse pointer in the Maya or Hypergraph window, then press your keyboard’s down arrow key. Selecting a shape node with this technique is useful for scenes having many nodes, where displaying all shape nodes in the scene hierarchy takes up much panel space. Press the up arrow key to return to the transform node. 2
Choose one of these options: Graph→Up and Downstream Connections Graph→Upstream Connections Graph→Downstream Connections When you display upstream connections for a node, you see the chain of nodes that provide input to each other all the way to the selected node. When you display downstream connections for a node, you see the chain of nodes that output to each other, all the way through to the end receiving node.
Using Maya: Hypergraph, Sets & Expressions
27
Hypergraph Using a dependency graph
Example Suppose you create a wine glass surface by revolving a NURBS curve. The following dependency graph appears when you select the revolved surface’s shape node and choose Graph→Up and Downstream Connections:
Note that the graph is shown with a vertical orientation to make the illustration fit on this page. By default, a dependency graph has a horizontal orientation. See “Displaying a graph vertically or horizontally” on page 53. The connection lines between nodes show connection direction. The connection line originates at a node that outputs data, and the line points to a node receiving the data as input. The example graph shows that a curve provides input to the revolve operation node. The revolve operation generates a revolved shape—the wine glass. The revolved shape is connected to initialShadingGroup, which sets the default color of all geometric shapes created in Maya. If you move your mouse pointer over a connection line, small white boxes appear next to the input node and output node. The white box next to an input node shows the node’s name and attribute that receives the input. The white box next to an output node shows the node’s name and attribute that provides the output. Each node name and attribute is separated by a period.
28
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
Note that the dependency graph and scene hierarchy display animated nodes as slanted boxes. If you animate a node with an expression, it displays a regular rectangle rather than a slanted box. All other animation techniques display a slanted box. Specifically, a slanted box indicates Ball has a param curve connected to it.
Example Suppose you keyframe the translateX attribute of a NURBS sphere named Ball. If you select Ball’s transform node and display all upstream and downstream connections, this graph appears:
The slanted box indicates Ball’s transform node has been animated. The graph doesn’t indicate which type of animation technique controls the attribute.
Dragging nodes into a dependency graph You can drag one or more nodes from the Outliner or Multilister into the dependency graph to display the dependency graph of the node or nodes. This is ideal for keeping irrelevant nodes out of view when you’re creating and assigning rendering nodes. Any dependency graphs previously in the display remain there. 1
To clear out all graphs from the display, select Edit→Clear View.
2
Click Yes to confirm. Note that you can also drag a node into the dependency graph from any part of Maya that lets you drag icons.
To drag the node into the dependency graph: Use the middle mouse button to drag the node or nodes into the Hypergraph panel.
Using Maya: Hypergraph, Sets & Expressions
29
H ypergraph
In many cases, you must be familiar with Maya internal operation details to understand the node and attribute names you see in the white boxes.
Hypergraph Using a dependency graph The upstream and downstream connections appear in the graph. If the Hypergraph previously displayed the scene hierarchy, it now displays a dependency graph.
Disconnecting nodes in a dependency graph You can use the dependency graph to disconnect nodes.
To disconnect nodes: 1
Click the connection line representing the connection in the dependency graph. The connection line turns yellow to indicate it’s selected.
2
Press your keyboard’s Backspace key. The connection line disappears, indicating you’ve disconnected the connection. To update the graph’s layout to display the disconnected nodes more appropriately, choose Graph→Layout.
Example Suppose you create a NURBS sphere named Ball. You then use the Multilister to create a Phong E material with red color and assign the resulting phongE1SG shading group node to Ball.
30
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph The Multilister displays the following contents: H ypergraph
The following dependency graph appears when you select Rendering→Show Shading Groups.
The graph shows that an attribute of the BallShape node (that represents Ball’s geometry) is input to the phongE1SG shading group node. Ball gets its color from the phongE1SG node.
Using Maya: Hypergraph, Sets & Expressions
31
Hypergraph Using a dependency graph To stop the phongE1SG node from setting Ball’s color, do these steps: 1
Click the connection line leading from BallShape to phongE1SG. The connection line turns yellow to indicate it’s selected.
2
Press your keyboard’s Backspace key. The connection line disappears, indicating you’ve disconnected the nodes. The phongE1SG no longer controls Ball’s color. Ball keeps its previous shading group attribute values. In other words, it stays red and doesn’t become the default gray. If you alter attributes of phongE1SG, though, the changes are not passed to Ball. You can reconnect BallShape to another shading group node to make it control Ball’s shading. For example, you can use the middle mouse button to drag BallShape onto initialShadingGroup. Ball’s color becomes the default gray color set in the initialShadingGroup node. Note that each geometric object you create is connected to the initialShadingGroup node, by default, until you connect it to another shading group.
Connecting nodes in a dependency graph The dependency graph offers convenient ways to connect nodes while you examine the graph. In the dependency graph, you can: •
launch the Connection Editor
•
launch a window that displays input or output attributes you can connect to
•
connect a node’s default output attribute to a node’s default input attribute
To launch the Connection Editor: Use Shift-middle mouse button to drag from an output node to an input node. The Connection Editor appears. The Outputs side of the Connection Editor displays the dragged node and its attributes. The Inputs side displays the attributes of the destination node. See Using Maya: Rendering for details on the Connection Editor.
To create a default connection: Use the middle mouse button to drag the output node onto the input node.
32
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
If the attributes aren’t compatible, no connection occurs and the Connection Editor appears instead.
Example Suppose you create a NURBS sphere and cone named Ball and Cone. You use the Multilister to create a Phong E material with red color, and a Blinn material with blue color. You assign the resulting phongE1SG shading group node to Ball, and the blinn1SG shading group to the Cone. The Multilister displays the following contents:
Using Maya: Hypergraph, Sets & Expressions
33
H ypergraph
Maya connects the default output attribute from the output node to the default input attribute of the input node. Usually, the default input and output attributes are the attributes you would most likely want to connect.
Hypergraph Using a dependency graph The following dependency graph appears when you select Rendering→Show Shading Groups:
The graph shows ConeShape connected to the blinn1SG shading group, and BallShape connected to the phongE1SG shading group. You can swap the colors of Ball and Cone by reversing their connections to the shading groups.
To reverse connections: 1
Drag ConeShape onto phongE1SG. This reconnects the default output attribute of the ConeShape node to the default input attribute of the phongE1SG node. Cone becomes red.
2
Drag BallShape onto blinn1SG. This reconnects the default output attribute of the ConeShape node to the default input attribute of the phongE1SG node. Ball becomes blue.
34
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
Tip
Example Suppose you create a NURBS sphere named Ball. You then use the Multilister to create a Phong E material with blue color and assign the corresponding phongE1SG shading group node to Ball to color it blue.
Suppose further you create a black and white 2D checker texture, but you haven’t assigned it to an object.
Using Maya: Hypergraph, Sets & Expressions
35
H ypergraph
Choose Rendering→Create Render Node to create a new material, texture, or light. You can then connect to the new node using the dependency graph.
Hypergraph Using a dependency graph The Multilister displays the following contents:
To replace Ball’s blue color with the checker texture, you must use the middle mouse button to drag the texture node onto the shading group. If you choose Rendering→Show Shading Groups, you’ll see the shading groups in the scene, but not the textures:
36
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
To drag the checker1 texture onto the phongE1SG shading group, you need to display them in the graph at the same time. Do the following steps: 1
While the checker1 node is displayed in the dependency graph, use the middle mouse button to drag the phongE1SG shading group node from the Multilister into the window. The dependency graph for the phongE1SG node appears above the checker1 graph:
2
Use the middle mouse button to drag the checker1 node onto the phongE1SG or PhongE1 node.
Using Maya: Hypergraph, Sets & Expressions
37
H ypergraph
If you choose Rendering→Show Textures, you’ll see the textures created in the scene, but not the shading groups:
Hypergraph Using a dependency graph Maya makes a connection from checker1 to phongE1 and draws a connection line representing the connection:
Ball shows a black and white checkerboard texture, rather than blue color. Turn on Shading→Smooth Shade All and Shading→Hardware Texturing to display shading and textures of objects in your workspace.
3
38
To redraw the graph with better organization of connection lines, choose Graph→Layout.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph Dolly and track to bring the reorganized graph into view:
5
Move the mouse pointer over the connection line between checker1 and phongE1.
H ypergraph
4
White boxes appear next to the nodes. They show that the default output outColor attribute of checker1 connects to the default input color attribute of phongE1. Because of this connection, the black and white checker1 texture provides the material color for the phongE1 node and therefore the phongE1SG shading group. An object connected to the phongE1SG shading group receives the black and white checker1 texture.
To launch the display of input or output attributes: 1
Drag a connection line to a node. If you drag the side of the line closer to the original output node, you display output attributes of the destination node. If you drag the side of the line closer to the original input node, you display input attributes of the destination node. After you drag a connection line to a node, a window appears and displays either the appropriate attributes you can connect to, either input or output. The part of the connection line you drag determines whether you display the node’s input or output attributes.
2
Click the attribute you want to connect to.
Using Maya: Hypergraph, Sets & Expressions
39
Hypergraph Using a dependency graph
Updating the layout of a dependency graph When you add or connect nodes in a scene, the dependency graph might place the nodes in a position that isn’t easy to read. If you don’t like the positioning of the added node, you can update the graph’s layout to a default reorganized layout.
To update the dependency graph’s layout: 1
Choose Graph→Layout. A window appears and asks you to confirm your choice.
2
Click Yes.
To return to the scene hierarchy from the dependency graph: Choose Graph→Scene Hierarchy.
Clearing the contents of a dependency graph You can clear the display of the dependency graph from the Hypergraph window. This is helpful when you’re looking at connections for one or more nodes, but want to look at unrelated nodes without the clutter of the existing nodes.
To clear the contents of the dependency graph: 1
Choose Edit→Clear View. A window requesting confirmation appears.
2
Click Yes.
Returning to the scene hierarchy While examining a dependency graph, you can return to the view of the scene hierarchy.
To return to the view of the scene hierarchy: Select Graph→Scene Hierarchy.
40
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Editing objects
Editing objects H ypergraph
There are several ways to edit objects as you’re examining the scene hierarchy or dependency graph. You can: •
select objects
•
add and select an IK handle
•
rename objects
•
hide objects
•
edit a selected node’s attributes
•
add a render node
Selecting objects The scene hierarchy and dependency graph offer a convenient way to select objects or other items in a scene. This is useful when items in the workspace are crowded and overlapping.
To select an object: 1
Track and dolly the view to find the node that represents the object or component. For example, if your scene has an object named Ball, bring the node representing Ball into view in the scene hierarchy.
2
Click the node to select it. The node changes to yellow.
Click a node to select the object it represents.
To deselect an object: Click an empty spot in the window.
Using Maya: Hypergraph, Sets & Expressions
41
Hypergraph Editing objects When you deselect a node, it becomes gray again.
Adding and selecting an IK handle In a scene having an IK character with a complex, crowded skeleton, you can use the scene hierarchy to easily add an IK handle to a joint chain. This lets you select the handle easily.
To add an IK handle: 1
From Maya’s Animation menu, choose Skeletons→IK Handle Tool.
2
In the scene hierarchy, select the top node of the joint chain.
3
Shift-select the bottom node of the joint chain. Maya creates an end effector and IK handle for the joint chain.
IK handle icon
To select an IK handle: Click the IK handle icon to the right of the end effector node. The IK handle node (and icon) turn yellow to indicate you’ve selected it. If you make the IK handle node the child of another node, its location might be hard to find in the graph. The IK handle icon to the right of the end effector at the bottom of the joint chain makes it easy to find.
42
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Editing objects
Renaming an object
MountainBike
RoadBike
FrontTire
FrontTire
BackTire
BackTire
This is allowed.
Bike
Tire
Tire
This is not allowed.
To rename an object: 1
Drag the mouse over the node representing the object.
2
Click the right mouse button and select Rename from the pop-up menu.
Using Maya: Hypergraph, Sets & Expressions
43
H ypergraph
You can rename an object or other item in the scene hierarchy or dependency graph. You can give two nodes the same name, but only if each has a different parent. An example follows:
Hypergraph Editing objects A small text box appears in the node:
Text box
3
Enter the new name.
Hiding an object in the workspace You can use the scene hierarchy or dependency graph to make an object or other item invisible in the workspace.
To hide an object: 1
Drag the mouse over the node representing the object.
2
Click the right mouse button and select Hide from the pop-up menu. The object disappears from the workspace and from the scene hierarchy.
To display a hidden object: 1
Select Options→Show→Invisible Nodes. The node representing a hidden object has a light gray color to indicate it’s invisible in the workspace.
Invisible node
2
Drag the mouse over the node representing the object.
3
Click the right mouse button and select Show from the pop-up menu. The object reappears in the workspace.
44
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
Editing an object’s attributes
To edit an node’s attributes: 1
Select the node in the graph.
2
Select Edit→Attributes. The Attribute Editor appears for the selected object or item.
Tip When the dependency graph is displayed, you can launch the Attribute Editor for a node by double-clicking it.
Creating a render node You can launch the Create Render Node window to create a new material, texture, and light. This is convenient when you’re examining the dependency graph for a rendering node. The Create Render Node window is the same window that appears when you choose Edit→Create from the Multilister.
To create a render node: Choose Rendering→Create Render Node. The Create Render Node window appears. See Using Maya: Rendering for details.
Altering the view of a graph A scene hierarchy or dependency graph covers lots of screen space for complex scenes. For example, you might create a detailed kinematic character that results in thousands of nodes. The following pages describe general navigation techniques for examining a graph. You can use the techniques with a scene hierarchy or dependency graph, unless otherwise noted.
Using Maya: Hypergraph, Sets & Expressions
45
H ypergraph
After you select a node in the scene hierarchy or dependency graph, you can edit its attributes:
Hypergraph Altering the view of a graph
Tracking the view You can move the view of the graph up, down, or sideways.
To track the view: In the graph view, use Alt-middle mouse button to drag in the desired direction.
Dollying the view You can enlarge or shrink the view of the graph.
To dolly the view: In the graph view, hold down the Alt key and drag the left and middle mouse buttons left to shrink the view; drag to the right to enlarge the view.
Note If you dolly away from a graph, the text in node boxes becomes abbreviated. An ellipses (...) appears to the right of the abbreviation. To read the text, drag the mouse pointer over the box. The node’s name appears in a pop-up box. The type of node appears in parenthesis next to the node name. For example, if you see Ball (transform) in a box, it means the box represents the node named Ball, which is a transform node.
Dollying a region You can dolly the view of a selected region by dragging a selection box.
To dolly a region: 1
46
Ctrl-Alt-drag a selection box from left to right around the region.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
H ypergraph
Drag from left to right.
The region in the selection box expands to the center of the Hypergraph window:
To dolly away from a selection: Ctrl-Alt-drag a selection box from right to left around the region.
Using Maya: Hypergraph, Sets & Expressions
47
Hypergraph Altering the view of a graph
Fitting an entire graph in the window You can fit an entire graph in the Hypergraph window. This is helpful if you want to see the general organization of nodes.
To fit the entire scene graph in the window: Select View→Frame All.
In a large graph, the node names will be too small to read. You’ll need to dolly and track this view to read the names.
Centering selected nodes in the window You can center and expand the view of selected nodes in the Hypergraph window. You might want to do this, for example, when you’re looking at distant, unreadable view of the graph, and you want to read the name of the currently selected object.
To center selected nodes in the window: 1
Click the node or nodes in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
48
Select View→Frame Selection.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph Here’s an example display: H ypergraph
Selected node
Centering a hierarchy in the window You can center a selected node’s hierarchy in the Hypergraph window. This is useful when you want to focus on a group of related nodes above and below the selected node. This option works only in the scene hierarchy, not in the dependency graph.
To center a hierarchy in the window: 1
Click the node in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
Select View→Frame Hierarchy.
Centering a hierarchy branch in the window You can center the branch descending from a node in the Hypergraph window. This is useful when you want to focus on the related nodes below a selected node. This option works only in the scene hierarchy, not in the dependency graph.
To center a branch in the window: 1
Click the node in the graph. Using Maya: Hypergraph, Sets & Expressions
49
Hypergraph Altering the view of a graph You can also select a node in the Maya workspace or from the Outliner. 2
Select View→Frame Branch.
Adjusting view transition speed When you alter the view of a graph by selecting View→Previous View or View→Next View, Maya dollies from one view to another instantaneously, by default. You can slow Maya’s transition speed between views to make the view change action easier to see.
To adjust the transition speed between views: 1
Turn on Options→Transitions→Animate Transitions.
2
Choose Options→Transitions→ and select one of these speeds: 5 Frames 10 Frames 15 Frames 20 Frames 20 Frames dollies slowest, 5 Frames dollies fastest.
To return to the default transition speed between views: Turn off Options→Transitions→Animate Transitions.
Setting graph update options Whenever you add or delete an object, rendering node, or other item in the scene, the Hypergraph updates the scene hierarchy and dependency graph, by default. When you select an object in the scene hierarchy or dependency graph, the object is also selected in the workspace, Outliner, and elsewhere in Maya. Also, when you select an object in the workspace, Outliner, and elsewhere in Maya, the object becomes selected in the scene hierarchy or dependency graph. These updates slow Maya operation when you work with a complex scene or when you’re examining nodes or dragging nodes to new positions in a free-form hierarchy. You can turn off updating to improve operation speed.
50
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
To turn off graph updates for created nodes:
If you turn this option on later, the graph displays all previously added and deleted nodes.
To turn off Hypergraph selection updates: Turn off Options→Update→On Selection.
Undoing a view of a scene hierarchy As you’re tracking, dollying, and making other changes to the view of a scene hierarchy, you’ll sometimes want to return to a previous view. Maya keeps the history of your view changes and lets you return to one or more previous views. After you display a previous view, you can move forward again to other view.
To change to a previous view: Select View→Previous View. To see the view before this one, select View→Previous View again.
To see the view ahead: Select View→Next View. This works only after you’ve used View→Previous View. To see another view ahead, select View→Next View again.
Using bookmarks for graph views You can bookmark the view of a graph to return to it later. For instance, suppose you dolly the view to see a group of nodes, then bookmark the view. If you dolly to a different view of the scene, you can select the bookmarked view to return to it. Note that the layout of the nodes in a previously bookmarked view changes when you modify a scene as follows: •
add or delete objects.
•
reposition nodes in a free-form hierarchy
Using Maya: Hypergraph, Sets & Expressions
51
H ypergraph
Turn off Options→Update→On Nodes Creation.
Hypergraph Altering the view of a graph •
expand or collapse nodes
•
display invisible, shape, or underworld nodes If a node was selected and entirely visible in the view at the time of bookmarking, when you return to the bookmarked view, the node appears in the same position regardless of how you’ve altered the graph. If no node was selected or if a selected node was only partly visible in the view, returning to the bookmarked view shows the previously displayed region in the graph. Depending on how you’ve altered the graph, the previously displayed nodes might not appear in the bookmarked region anymore. You’ll likely need to create a new bookmark. As you add or delete nodes in a scene, Maya updates the layout of the scene hierarchy and dependency graph. Don’t be alarmed if you notice a node disappears from a previously bookmarked view of the dependency graph. This is usually the result of Maya conforming with its default graph layout.
Tip You can ensure that a bookmarked view displays a node even after you reposition, add, or delete nodes in the scene. To do so, select the node and make sure its entire outline is visible in the view before creating the bookmark. If you select two or more nodes, the bookmarked view displays the first node selected.
To bookmark a view: 1
Track and dolly the view as desired.
2
Select Bookmarks→Create Bookmark. The bookmarked view gets a default name, for example, hyperView1. The name appears at the bottom of the Bookmarks menu.
To name a view before bookmarking it: 1
Track and dolly the view as desired.
2
Select Bookmarks→Create Bookmark-❒. A window appears and prompts for the bookmark name.
3
52
Enter a bookmark name.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
Select Bookmarks and the name of the bookmark at the bottom of the menu. For example, select Bookmarks→MonsterHead.
To delete a bookmarked view: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Delete Bookmark. The name of the bookmark is deleted.
To rename a bookmarked view: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Rename Bookmark. A window appears and prompts for the bookmark name.
4
Enter the new name. You can also rename a bookmark by selecting Bookmarks→name-❒, where name is the name of the bookmark. A prompt window appears and lets you enter the new name.
Displaying a graph vertically or horizontally The scene hierarchy and dependency graph have a horizontal layout by default. Here’s an example:
Using Maya: Hypergraph, Sets & Expressions
53
H ypergraph
To return to a bookmarked view:
Hypergraph Altering the view of a graph If you prefer to look at a graph upright, you can change to a vertical layout.
To display the graph vertically: Select Options→Orientation→Vertical.
To display the graph horizontally: Select Options→Orientation→Horizontal.
Rebuilding the graphs If your scene hierarchy or dependency graph doesn’t seem up to date, you can rebuild the graphs. For example, if you add an object to a scene and it doesn’t appear in the scene hierarchy, rebuild the graphs to make the scene hierarchy aware of the object’s presence.
To rebuild the graph: Select Graph→Rebuild.
54
Using Maya: Hypergraph, Sets & Expressions
Index A adding IK handle 42 animated nodes 9, 29 animating transitions (of view) 50 Attribute Editor launching 45 attributes default input and output 39 editing 45 automatic graph layout 20
B background image importing to scene hierarchy 20 bookmarks automatic view change 52 creating 52 deleting 53 renaming 53 returning to 53 branches 9 centering in view 49 breaking parent-child relationship 17
C
D default input and output attributes 39 deformer connections displaying 14
dependency graph 5 displaying lights 24 displaying textures 24 how to use 23 materials 24 rebuilding 38 shading groups 24 types of nodes 22 understanding the 22 displaying entire graph in view 48 hidden objects 44 horizontal graph 53 up and downstream connections 26 vertical graph 53 dollying graph view 46 selected region 46 downstream connections 26 dragging node from Outliner or Multilister 29 to reconnect nodes 37
E editing objects 41 ellipses (...) in graph 46 empty group nodes 17 expanding nodes 10 expression connections displaying 14
F
Index
cameras default display of 7 centering nodes in view 48 children 8, 15
clearing graph display 40 collapsing nodes 10 color swapping object 34 connecting default output to input 32 nodes 32 Connection Editor launching from dependency graph 32 connection lines in dependency graph 26 in scene hierarchy 14 connections creating default 33 direction of 26 displaying constraint 14 displaying deformer 14 displaying expression 14 constraint connections displaying 14 Create Render Node window launching 45 creating bookmarks 52 new materials, textures, or lights 45
free-form hierarchy 21, 22 creating 19
Using Maya: Hypergraph, Sets & Expressions
55
Index
G
lights dependency graph 24
graphs clearing display 40 dollying view 46 navigation techniques 45 rebuilding 54 tracking 46 turning off updates 51 viewing 46 group nodes 16
H hidden objects 44 hierarchy centering node in view 49 horizontal layout of graph 28, 53 Hypergraph 5, 6 menu bar 7 tool bar 7
M materials dependency graph 24 menu bar 7 menus displaying context sensitive 12 Multilister nodes visible in dependency graph 26
N next view 51
I IK handle adding 42 selecting 42 image displaying as background 20 improving speed Hypergraph 50 input nodes 26 invisible nodes 12 objects 44
L layout updating graph 40
56
Using Maya: Hypergraph, Sets & Expressions
nodes 8 animated 9, 29 attribute names in dependency graph 26, 28 child 8, 15 collapsing 10 connecting 32 containing param curves 9, 29 displaying invisible 12 displaying shape 12 displaying underworld 12 dragging from Outliiner or Multilister 29 dragging to reconnect 37 effect on graph of deleting and adding 52 empty group 17 expanding 10 group 16 input 26 moving relative position of 18 output 26 parent 8, 15 renaming 43 selecting 41 shape 9 showing invisible 11 slanted boxes 9, 29 subnodes 9, 10 transform 9
O objects displaying hidden 44 editing 41 editing attributes of 45 hiding 44 making invisible 44 selecting 41 output nodes 26
Index
P param curves 9, 29 parents 8, 15 breaking relationship 17 creating 16 previous view returning to 51
R rebuilding graph 38, 54 region dollying 46 renaming node 43
S
view centering branch 49 centering node hierarchy 49 centering nodes 48 changing transistion speed 50 dollying graph 46 history 51 next 51 returning to prior 51 tracking graph 46
W
T textures displaying in dependency graph 24 graph display example 37 tool bar 7 tracking graph view 46 transform nodes 9 transition speed changing 50
white boxes in dependency graph 26, 28
Y yellow nodes 41
U underworld nodes displaying 12 update options setting graph 50 updating graph layout 40 upstream and downstream connections 26
Index
scene hierarchy 10 automatic layout 20 creating free-form 19 defined 5 displaying background image 20 displaying special nodes and connections 12 parenting 15 rearranging nodes 17 terminology 8 selected nodes framing in view 48 selected region dollying 46 selecting IK handle 42 objects 41
shading groups 26 changing selected 36 display example 24 displaying in dependency graph 24 shape nodes 9 displaying 12 slanted boxes 9, 29 speed of Hypergraph improving 50 subnodes 9, 10
V vertical layout of graph 28, 53
Using Maya: Hypergraph, Sets & Expressions
57
Sets
Sets Contents
Sets 2 Sets
5
How you can use sets Understanding sets
6 7
Sets you create
8
Shading group sets created by Maya
9
Deformer and skin point sets created by Maya Understanding edit modes
13
Creating, selecting, and removing sets Creating a set
11
13
13
Selecting a set Removing a set
15 16
Creating sets for easy object selection Choosing set display formats Editing set membership
16
17
22
Adding set members
22
Removing set members
24
Adding or removing deformer and skin point set members Pruning deformer set membership Moving skin points to a different set Editing point weights
25
28 28
33
Painting point weights
37
Options for modifying point weight numbers
38
Selecting and keying point weight attributes
39
Altering the display of sets
40
Expanding and collapsing sets Filtering sets from display
40
40
Displaying sets associated with selected objects
41
Using Maya: Hypergraph, Sets & Expressions
3
Sets Contents Using bookmarks to display sets Understanding partitions Partitions you create
44
47 47
Partitions created by Maya
48
Creating, displaying, and removing partitions Adding and moving sets to partitions
4
Using Maya: Hypergraph, Sets & Expressions
51
49
2
Sets A set is a collection of objects or components. For example, a set might include geometric objects, NURBS CVs, polygonal vertices, lattice points, polygonal facets, or other items. Any item you can select can be in a set. In some instances, Maya creates sets for you as you work with objects. For example, when you add a cluster to several CVs of a NURBS cone, Maya makes a set of the CVs. You can edit and tune such sets to control the area affected by deformation. Sets
You can also create a custom set so you can work on its items with a single action. For instance, you can create a set of NURBS objects, then hide or display them as a single entity.
You can edit and tune sets to control deformation of one or more objects.
This chapter has the following topics: •
“How you can use sets” on page 6
•
“Understanding sets” on page 7
•
“Understanding edit modes” on page 13
•
“Creating, selecting, and removing sets” on page 13
•
“Choosing set display formats” on page 17 Using Maya: Hypergraph, Sets & Expressions
5
Sets How you can use sets •
“Editing set membership” on page 22
•
“Editing point weights” on page 33
•
“Altering the display of sets” on page 40
•
“Understanding partitions” on page 47
•
“Creating, displaying, and removing partitions” on page 49
•
“Adding and moving sets to partitions” on page 51
How you can use sets Here are the ways you can use sets: •
adjusting deformer, skin, and flexor deformation
•
adjusting the weight of cluster, cluster flexor, and skin points
•
simplifying selection of objects or components that you regularly select or have difficulty selecting in the workspace.
•
assigning objects to shading groups for rendering
•
moving objects from one layer to another If you apply a deformer or skin to a geometric object, Maya creates a set for the geometry’s CVs, vertices, or points. You can add or remove set members to alter the effect of the deformer or skin. See Using Maya: Animation for details on deformers and skins. For clusters and cluster flexors, you can apply different weights to the set members to increase or decrease deformations at specified points. For skin, you can apply different weights to the set members to increase or decrease skin deformation around the joints. You can create your own set of objects or components for easier selection and transformation. For instance, suppose you need to repeatedly select the same few CVs around the eye of a cyclops to animate the eye. Rather than struggle to select the CVs with a selection box, you might create a set named cyclops_eye for the CVs, then select the set by clicking the set name in a convenient set editing tool named the Set Editor. When you create a shading group with the Multilister, Maya creates a set that represents the shading group. You can work with such sets rather than the Multilister to conveniently assign shading groups to objects. See Using Maya: Rendering for details on shading groups.
6
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding sets When you create a layer, Maya creates a set that represents it. You can work with sets rather than layer menu entries to quickly move members from one layer to another. See Using Maya: Basics for details on layers. When you add a field to vertices, CVs, or edit points, Maya creates a set named after the field, for instance, uniformFieldShape1Set. The set members are the vertices, CVs, or edit points to which you added the field. You can add or remove the set members to alter the effect of the field. See Using Maya: Dynamics for details on fields.
Understanding sets
To start the Set Editor: From the main Maya menu, choose Window→General Editors→Set Editor. The Set Editor appears:
Menu bar Tool bar Sets
Items for editing point weights
Scale and move the window as needed. You can also display the Set Editor in a workspace panel by choosing Panels→Panel→Set Editor. This lets you see the Maya user interface and the Set Editor without having to reposition the windows.
Using Maya: Hypergraph, Sets & Expressions
7
Sets
It’s easiest to learn about sets by examining the display of the Set Editor, the main tool for working with sets. You can launch the Set Editor by selecting it from the main menu or with other common techniques such as the Hotbox.
Sets Understanding sets The menu bar has entries for working with sets, while the tool bar has icons for commonly used menu bar selections. To see the menu selection an icon represents, drag the pointer over the icon and look in the blue help box at the bottom of the Maya window. The name of the menu selection appears there. The bottom part of the Set Editor has items for editing point weights. See “Editing point weights” on page 33 for details.
Note Unless instructions in this chapter state otherwise, make all menu choices from the Set Editor’s menu bar.
Sets you create When you create a set, the Set Editor displays the set’s name and contents. You can apply an operation to a set to affect all its members.
Example Suppose you create three NURBS spheres. You can put the spheres in a set as follows: 1
Select the spheres in the workspace, Outliner, or elsewhere.
2
From the Set Editor, choose Edit→ Create Set. The Set Editor displays the newly created set: ‘
By default, Maya gives the set the name set1 or something similar. To use your own name rather than the default, choose Edit→ Create Set-❒. The Set Editor lists all sets in the scene. The initialShadingGroup and initialParticleSE are default sets that exist in every scene. The following topic gives more details on these sets. 3
Click the triangle next to the set to expand its contents. If you don’t see triangles in the Set Editor, turn on Mode→Editing first.
8
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding sets
Click here to expand or collapse the set.
4
To select the objects in the set, but not the set itself, turn on Mode→Select Contents.
5
Click the set name.
Sets
The set contains nurbsSphere1, nurbsSphere2, and nurbsSphere3. Items indented below a set name are its members. You can select the set to do operations on each of its members.
This selects the three spheres that are members of the set. With the sphere members selected, you can do operations such as: •
hide them from the workspace view
•
translate, rotate, and scale
•
start the Attribute Editor, so all three spheres are available for editing there Subsequent topics provide more details on working with sets.
Shading group sets created by Maya A new, empty scene has two sets by default: initialShadingGroup and initialParticleSE. These sets control the default shading of objects added to the scene. When you add a geometric object to the scene, the object becomes a member of the initialShadingGroup set by default. The shading group colors its members a dull gray. (You can see the default gray color of such objects in the workspace by choosing Shading→Smooth Shade All.) If you create a sphere, for instance, Maya adds the sphere to the initialShadingGroup set.
Using Maya: Hypergraph, Sets & Expressions
9
Sets Understanding sets
Member of the set initialShadingGroup
Maya keeps a newly added geometric object in the initialShadingGroup set until you create and assign a different shader to the object. Maya then relocates the object to a set it creates for the shading group you created. You typically won’t do anything directly with the initialShadingGroup set. It’s for Maya’s internal use as you make shading choices.
Example Suppose you use the Multilister to create a Phong material. When you create the node, Maya creates a set named phong1SG. This set represents the Phong shading group. Suppose further you use the Multilister to assign phong1SG to a geometric object named nurbsSphere1. Maya moves the object from the initialShadingGroup to the phong1SG set.
Member of phong1SG
The object receives its surface shading from the options you set in the Attribute Editor for the phong1SG node.
10
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding sets If you were to add a particle object to a scene, it would become part of the initialParticleSE shading group set. This set has the same purpose as initialShadingGroup, only it controls the default shading characteristics of particles rather than geometry. An object can be part of only one shading group set—whether initialShadingGroup, the initialParticleSE, or one you create. By looking at the members of the shading group sets, you can see which objects are shaded by the shading groups you’ve added to your scene. To try out various shaders on different objects, use the middle-mouse button to drag objects from one shading group set to another.
Sets
For more details on working with shading group sets, see the Shading Groups Editor documentation in Using Maya: Rendering. The Shading Groups Editor is a set editor tailored to shading objects.
Deformer and skin point sets created by Maya When you attach a deformer to an object, Maya creates a set from the object’s points. When you bind skin to a skeleton, Maya creates two or more sets for the skin points attached to the joints. See Using Maya: Animation for details on deformers and skin points.
Example Suppose you create a NURBS cone, select several CVs, then choose Deformations→Cluster from the Animation menu to apply a cluster:
Apply cluster to these points
Maya creates a set named cluster1Set or something similar by default. Using Maya: Hypergraph, Sets & Expressions
11
Sets Understanding sets
Applying a cluster creates a set
The set contains the points in the cone controlled by the cluster. In such sets, you can alter deformations by adding and removing points or by editing point weights of existing members. For example, you can add corresponding points from a newly added cone in the scene. The added points deform with the existing points as you translate, rotate, or scale the cluster handle.
Subsequent topics provide details on how to alter object deformations by editing sets.
12
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding edit modes
Understanding edit modes The Set Editor has several editing modes. The modes are important as you create, edit, and remove sets and their members. Usage
Editing
Select, add, move, and remove set members.
Select
Select a set, not its members—to remove or rename the set. You cannot add or remove members in this mode.
Select Contents
Select a set’s members without selecting the set itself. You cannot add or remove members in this mode.
Paint Percentages
Change the weight of cluster, cluster flexor, and skin points. This mode works only when you display NURBS component sets with List by Object in table format. See “Painting point weights” on page 37.
Sets
Mode
If you list partitions rather than sets, Select Contents and Paint Percentages are invalid modes. See the note in “Creating, displaying, and removing partitions” on page 49.
Creating, selecting, and removing sets The following topics describe how to create, select, and remove a set. Note that binding skin or adding a deformer or flexor to an object automatically creates one or more sets. You need not create a set for such objects. See “Understanding sets” on page 7 for details.
Creating a set You can create a set of geometric objects, CVs, vertices, polygonal facets, or other items.
To create a set with a default name: 1
Select the objects or items in the workspace, Outliner, or elsewhere. Using Maya: Hypergraph, Sets & Expressions
13
Sets Creating, selecting, and removing sets For example, after displaying the CVs of an object, use a selection box to select the CVs. If you don’t select any objects, an empty set will be created in the next step. You can add to an empty set later. 2
From Maya’s main menu, choose Edit→Sets→Create Set. or From the Set Editor, choose Edit→Create Set. The set appears with a default name in the Set Editor.
To create a set and name it: 1
Select the objects or items in the workspace, Outliner, or elsewhere.
2
From Maya’s main menu, choose Edit→Sets→Create Set-❒. or From the Set Editor, choose Edit→Create Set-❒. The Create Set Options menu appears.
3
Enter the name of the set in the Name text box. For example, enter nurbsObjects.
14
Using Maya: Hypergraph, Sets & Expressions
Sets Creating, selecting, and removing sets Other options in the window let you add the set to a partition. See “Adding and moving sets to partitions” on page 51 for details. 4
Click Apply. The set appears with the chosen name in the Set Editor.
To rename a set: 1
In the Set Editor, turn on Mode→Select.
2
Click the name of the set.
3
Change the set’s name in the Channel Box, Attribute Editor, or elsewhere.
Selecting a set You can select a set or the contents of a set. You must select a set to remove or rename the set. You must select the contents of the set to apply an action to each member of the set.
To select a set: 1
In the Set Editor, turn on Mode→Select.
2
Click the name of the set. You can also select the set in the Outliner or Hypergraph’s dependency graph view. To display sets in the Outliner so you can select them, turn off Show→DAG Objects Only. To display sets in the Hypergraph’s dependency graph view, select the object shape node associated with the set and choose Graph→Up and Downstream Connections. Using Maya: Hypergraph, Sets & Expressions
15
Sets
If a set or other item in the scene already has the specified name, the new set name will be appended with a number. For example, entering top results in top1, because top is the name of a camera that exists in every scene by default.
Sets Creating, selecting, and removing sets
To select a set’s contents only: 1
In the Set Editor, turn on Mode→Select Contents.
2
Click the name of the set. This selects the contents of the set, but not the set.
Removing a set You can remove a set or the contents of a set. Removing a set is useful for removing set names you’re no longer using.
To remove a set: 1
In the Set Editor, turn on Mode→Select.
2
Click the name of the set.
3
Check that only the set name is the selected object, for example, by examining the Channel Box or Outliner. Make sure no objects are selected in the workspace.
4
Press your keyboard’s Backspace key. This removes the set, but not its contents.
To remove a set’s contents only: 1
In the Set Editor, turn on Mode→Select Contents.
2
Click the name of the set.
3
Press your keyboard’s Backspace key. This removes the items from the set.
Creating sets for easy object selection You can create a set of joints, geometry, CVs, materials, or other items for quick selection in the main menu. You might want to do this, for instance, so you can select different animation characters quickly without having to start the Set Editor. This is also useful for selecting items not visible in the workspace, for instance, invisible objects.
To create the set: 1
16
Select the objects or items.
Using Maya: Hypergraph, Sets & Expressions
Sets Choosing set display formats 2
From Maya’s main menu, choose Edit→Sets→Create Quick Select Set. A window prompts for a set name.
3
Enter the set name for the items. This creates the set and puts its name in the cascading menu to the right of Edit→Quick Select Set.
To select the items in the set: From Maya’s main menu, choose Edit→Quick Select Set and the name of the set. This selects the items in the set, not the set itself. Sets
Choosing set display formats For sets of object components such as CVs and polygonal vertices, you can display set contents in the Set Editor in these convenient formats: •
Default list—components listed without additional headings for the objects they’re part of
•
List by object—components listed under the object they’re part of For sets made of NURBS CVs, you can also list by object in a concise table. The following example shows the differences between the display formats.
Example Suppose you create a curve named TopCurve with four CVs, and a similar curve named BottomCurve with four CVs.
2 0 TopCurve 1
3 1
3 BottomCurve
0 2
Using Maya: Hypergraph, Sets & Expressions
17
Sets Choosing set display formats To display the CVs, select the curves, and from the main menu, choose Display→NURBS Components→CVs. Internally, Maya numbers the CVs of each curve as 0, 1, 2, and 3 (but doesn’t display the numbers in the workspace). Suppose you select CVs 2 and 3 of both curves, then create a set named rightCVs. (See “Creating, selecting, and removing sets” on page 13 for instructions on creating sets.) You might do this, for example, because you want to adjust the shape of both lines identically with the corresponding CVs.
2 0
1
3 1
3
0 2
Select these CVs, then create a set named rightCVs.
To display set contents as the default list: 1
In the Set Editor, turn on Mode→Editing. This mode lets you examine, select, add, move, and remove set members.
2
Expand the contents of rightCVs.
TopCurveShape.cv[2] and [3] represents CVs 2 and 3 of TopCurve. BottomCurveShape.cv[2] and [3] represents CVs 2 and 3 of BottomCurve.
18
Using Maya: Hypergraph, Sets & Expressions
Sets Choosing set display formats This is the default listing of sets. Each set member has its name listed under the set name. This is the most concise way to show sets and their members. You don’t need to understand Maya’s identification scheme for set members. For example, it’s not essential to know why Maya names certain members of TopCurveShape as TopCurveShape.cv[2] and TopCurveShape.cv[3]. You’ll typically work with set members by selecting the desired object or point in the workspace, not by selecting its name in the Set Editor.
To list by object: 1
In the Set Editor, select Options→List by Object. The following set contents appear: Sets
The set now shows two object headings, one for TopCurveShape and one for BottomCurveShape. Note that the icons to the left of the object headings appear only for sets made of CVs. 2
Expand each object heading by clicking the triangles.
The Set Editor displays the same information as for the default list, but with a different format. The CV set members are grouped under a heading for the object they’re part of. There are four CVs in the set. Two CVs in the set are part of the object TopCurveShape and two are part of the object BottomCurveShape.
Using Maya: Hypergraph, Sets & Expressions
19
Sets Choosing set display formats Because the rightCVs set is made of NURBS CVs, you can also display set members in a table format. The CV location in the table corresponds to their physical location in the object.
To list by object in table format: 1
Make sure Options→List by Object is selected.
2
Click the List/Table icon next to each set name to display it in table format. This icon appears only for NURBS curves and surfaces. Click the List/Table icon
The set appears in table mode:
3
Expand the sets and scroll the window as necessary. The table format shows all CVs of each curve. The CVs that are set members are represented by the gray boxes. The CVs that aren’t set members are the empty black boxes. The 0, 1, 2, 3 in the row are the U parameters of the curves. There are no V parameters for the curves because they have only a single dimension (U) in parameter space. You can select any CV by clicking the box that represents it. For example, if you click the box under 3 for TopCurveShape, you also select TopCurveShape’s CV number 3 in the workspace. You can drag through adjacent boxes to select several members or nonmembers of a set.
20
Using Maya: Hypergraph, Sets & Expressions
Sets Choosing set display formats The ability to select nonmembers of a set in table format is helpful if you have an object with CVs that are hard to select in the workspace. 4
To change from table format back to the previous list, click the List/Table icon again. This toggles between the table and list. For details on choosing which sets are displayed in the Set Editor, see “Altering the display of sets” on page 40.
Note If you display a set of CVs of a NURBS surface such as a plane, you’ll see the U and V parameters that identify each CV. An example follows: Sets
V parameters
U parameters
3 2 1 0 0
2 1 U parameters
3
V parameters
It’s not essential to understand Maya’s U and V identification scheme for CV set members. You’ll typically work with set members by selecting the desired CV in the workspace, not by selecting its U and V parameter in the Set Editor. See Using Maya: Modeling to learn more about U and V parameters.
Using Maya: Hypergraph, Sets & Expressions
21
Sets Editing set membership
Editing set membership You can add or remove members of a set with the Set Editor or the Edit Membership Tool. The advantage of the Set Editor is that it: •
includes a formatted list of set members and associated objects
•
displays U and V parameters of NURBS curve and surface CVs
•
lets you edit the weight of cluster, cluster flexor, and skin points The advantage of the Edit Membership Tool is that you can add and remove set members in the workspace without using another window or panel. This is ideal for quickly altering membership of sets Maya creates for deformers and skin. See “Adding or removing deformer and skin point set members” on page 25 for details.
Adding set members The following steps show how to add set members with the Set Editor.
To add set members: 1
In the workspace, select the items you want to add.
2
Maker sure Mode→Editing is on.
3
Click the name of the set.
4
Choose Edit→Add Items.
Tips You can use standard Motif selection techniques in the Set Editor:
22
•
Use the middle mouse button to drag a member from one set to another.
•
Use Ctrl-middle mouse button to copy a member from one set to another.
•
Drag through several items to select them.
•
Shift-click to extend the selection through the item clicked.
•
Ctrl-click a member to add or remove it from existing selection. Note that Ctrl-clicking to add a member to the selection deselects any item in the workspace that isn’t in the set.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Example Suppose you put several CVs of a cone into a set name TopCVs.
CVs in set TopCVs
Sets
You can add several more of the Cone’s CVs to TopCVs as follows: 1
Select the CVs you want to add to the set.
Selected CVs to be added to the set.
2
In the Set Editor, turn on Mode→Editing.
3
Click the name of the set.
4
Choose Edit→Add Items. Using Maya: Hypergraph, Sets & Expressions
23
Sets Editing set membership Maya adds the items to the set.
Tip To edit related CVs of a NURBS object, turn on Component/Hull selection, then select a hull. To turn on Component/Hull selection, turn on these icons in the Status Line: (Select by component type) and
(Hulls)
Removing set members The following steps show how to remove set members with the Set Editor.
To remove set members: 1
In the Set Editor, turn on Mode→Editing.
2
In the Set Editor or workspace, select the items you want to remove from the set. If you select an item in the workspace that’s in two or more sets, doing the following step removes the item from all the sets.
3
24
Select Edit→Remove Items.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Adding or removing deformer and skin point set members The Edit Membership Tool provides the simplest way to add and remove members of deformer and skin point sets. See “Deformer and skin point sets created by Maya” on page 11 for information on such sets. In the following steps, we use the term points to refer generally to NURBS CVs, polygonal vertices, and lattice points.
To add or remove with the Edit Set Membership tool From the Animation menu, select Deformations→Edit Membership Tool.
2
Select the set as follows:
•
For a skin point set, select the associated joint (in the workspace or Outliner).
•
For a deformer set, select the associated influence object. For a cluster, for instance, select the cluster handle. See the Basic Deformers part of Using Maya: Animation for information on influence objects.
•
For a blend shape set, select the associated target or blendShape node.
•
For other types of sets, select the set in the Set Editor. See “Selecting a set” on page 15 for details.
Sets
1
Maya highlights the set members in the workspace. For a deformer set, the influence object is also highlighted, but is not the selected object.
Using Maya: Hypergraph, Sets & Expressions
25
Sets Editing set membership Maya also lists the set name in the Help line as in the following example.
Highlighted members
Name of selected set
3
To add to the set, Shift-click the points (or objects) you want to add. To add points from a different object, you must select the points without the Shift key first, then Shift-click the points again to add them to the set.You can also Shift-drag a selection box around the points. To remove from the set, Ctrl-click to select the points (or objects). You can also Ctrl-drag a selection box around the points.
4
26
Click a different menu entry to quit the Edit Membership tool.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Note If you bind skin to a skeleton and add a flexor, the Set Editor displays a set name for the flexor. This type of set has sets embedded under it, as in this example: You must expand these sets and edit their points here.
Sets
You can’t edit the points here.
The embedded sets joint2Set1 and joint1Set1 appear twice in the Set Editor. You must edit the members where they aren’t embedded. To quickly find the appropriate sets, select the embedded set names and choose List→Update Now. To edit the weights of the members, display the unembedded sets in table format with Options→List by Object on. Bookmark the embedded sets before doing Update Now if you want to display them again later.
Using Maya: Hypergraph, Sets & Expressions
27
Sets Editing set membership
Pruning deformer set membership The set used by a deformer often has members that aren’t deformed when you manipulate the deformer. You can remove the unaffected members to speed transformation and animation of the deformer.
To prune the deformer set: 1
Select the influence object of the deformer. For a cluster, for instance, select the cluster handle. See the Basic Deformers part of Using Maya: Animation for information on influence objects.
2
From the Animation menu, select Deformations→Prune Membership and the type of deformer.
Note Prune Membership removes deformer members whose position in the current frame is the same as their undeformed position. Pruning might ruin the deformer animation of the members that had not yet moved at the time of pruning. Because a typical blend shape operation has weights of 0 (unmoving points) for some target shapes at any instant, pruning membership would likely ruin the blend shape deformations. For this reason, there is no menu entry for pruning the membership of blend shape deformers. You can do this only with a MEL blendShape command. See the MEL documentation for details. If you unintentionally prune members, you can choose Edit→Undo to undo pruning, or you can add the members to the set again.
Moving skin points to a different set When you bind skin to a skeleton, Maya puts the skin points in sets named for each joint that has a bone originating from it. The skin point sets are also called joint cluster sets because Maya adds a cluster for each joint that controls skin deformation. You can move skin points from one set to another to tune deformation in the region where you bend or rotate the joint.
28
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership Working with skin points in sets differs slightly from other deformer sets. To prevent undesirable skin deformations as you bend joints, Maya prevents skin points from being in two sets at the same time. When you put a member of one set into another, Maya removes the member from its old set. See “Understanding partitions” on page 47 for details.
Example Suppose you create a skeleton made of three joints. Maya names the joints of the skeleton joint1, joint2, and joint3 by default. You then use the IK Handle Tool to add an IK handle to the skeleton’s joint chain. Finally, you create a cylinder with 12 sections and 12 spans to be used as the skeleton’s skin, then bind the cylinder to the skeleton. Sets
joint1
joint1’s bone Skin
joint2 joint2’s bone joint3
When you bind the skin to the skeleton, Maya creates two sets named joint1Set1 and joint2Set1 (or something similar). The joint1Set1 set includes the points for the skin attached to the bone originating from joint1. The joint2Set1 set includes the points for the skin attached to the bone originating from joint2. The Set Editor lists these set names and their contents. Because joint3 has no bone, it has no set of skin points.
Using Maya: Hypergraph, Sets & Expressions
29
Sets Editing set membership If you turn on Shading→Smooth Shade All and translate the IK handle to bend joint2, the skin might deform like this:
The following steps show how to move skin points from one set to another to alter skin deformation as a joint bends.
To move skin points to a different set: 1
Turn on Shading→Wireframe. This display mode is best for examining skin points.
2
Select joint1 in the Outliner, workspace, or elsewhere.
3
Choose Deformations→Edit Membership Tool. When this tool is selected, the members of the set associated with the selected object are highlighted in the workspace and Set Editor. In this example, the members of joint1Set1 are displayed in yellow in the workspace and white in the Set Editor.
30
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Members of joint1Set1
To see the members of joint2Set1, select joint2.
Sets
4
Members of joint2Set1
Because the Edit Membership Tool is selected, the members of joint2Set1 become highlighted in the workspace and Set Editor. The Edit Membership Tool lets you move points from the joint1Set1 to the joint2Set1.
Using Maya: Hypergraph, Sets & Expressions
31
Sets Editing set membership 5
Use Shift-left mouse button to drag a selection box around joint1Set1’s two lowest (not selected) circles of points.
Select these two circles of points
This moves the selected points from joint1Set1 to joint2Set1. The new set members become highlighted in yellow in the workspace. With the points attached to a different set, the skin deforms differently when you transform the IK handle to bend the joint.
Original deformation
Deformation after regrouping points
Because you moved skin points from joint1Set1 to joint2Set1, bending joint2 causes the skin to crease higher above the joint.
32
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights You can also remove points from a set with the Edit Membership Tool. With the joint selected, Ctrl-click to remove the points. If you remove points from a set, the skin points have no attachment to any bone. The points won’t deform when you transform the joints in the skeleton. You’ll need to add them to a skin point set to make the associated skin deform appropriately. The altered deformation in this example is, of course, excessive—not something you would likely strive for in a character animation. The example simply shows how to alter skin deformation by adjusting set membership.
Editing point weights When you apply a cluster to some or all of an object’s points, transforming the cluster handle deforms the shape controlled by the points. When you bind skin or add a cluster flexor to a skeleton, transforming a joint deforms the shape controlled by the points. The Set Editor lets you tune the weight of such points. For example, suppose you add a cluster to a cone. You can fine tune the weights of the cluster points so that when you translate the cluster handle, the points at the base of the cone move less than the points at the tip of the cone. A point with a weight of 1 moves 100% when you translate the cluster. A point with weight 0 doesn’t move at all. A point value between these weights moves proportionally to its percentage of 1. For example, a point with a weight of 0.40 moves 40% as much as a point having a weight of 1. You can also give points a negative weight. When you move the cluster handle, negative points move in the opposite direction of the other points in the cluster. You might do this, for instance, to make a belly dancer’s hips swing one way as the rest of her body moves another way.
Using Maya: Hypergraph, Sets & Expressions
33
Sets
As you work on your own characters, experiment by adding and removing different points near the crease of the skin. You’ll be able to create subtle improvements in deformation. For details on using the Edit Membership Tool, see “Adding or removing deformer and skin point set members” on page 25.
Sets Editing point weights
Weight 0.5
Weight 1
Translating the cone moves points with weight 0.5 half as much as points with weight 1.
Skin points also have weights. When you bind skin to a skeleton, Maya puts the skin points in sets. The skin points have a default weight of 1. You can edit the weight of skin points to control the extent to which skin deforms when you bend a joint. Skin point weights affect the movement of attached skin as follows: Point weight
Resulting skin movement
1
Same as joint
0
None
Between 0 and 1
Percentage of joint movement
Less than 0
Opposite direction of joint movement (percentage)
More than 1
Exaggerates skin movement
To set the weight of cluster or skin points: 1
Select Window→General Editors→Set Editor.
2
From the Set Editor, turn off Options→List by Object. This step is optional, as described in the tip at the end of this topic.
3
Expand the set representing the cluster or skin points. By default, a cluster point set has the name cluster1Set or something similar.
34
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights Note that you can filter sets from the Set Editor to display only cluster and skin point sets. See “Filtering sets from display” on page 40. By default, skin point sets have the names joint2Set1, joint2Set1, and so on. 4
Turn on
(Select by component type) in the main menu area.
5
Turn on (Points), then right mouse-click to make sure CVs, Poly Vertices, or Lattice Points are enabled for selection (as appropriate).
6
In the workspace, select the desired points. For example, you might select these points of a clustered cone: Sets
Selected points
The corresponding points in the Set Editor turn white to indicate they’re selected. 7
Scroll the window as needed to see the point members. The selected set members are highlighted in white in the Set Editor. Boxes to the right of the members show the points having a weight of 1. The points have a default weight of 1.
Using Maya: Hypergraph, Sets & Expressions
35
Sets Editing point weights
Note that you can select points by clicking members in the Set Editor rather than in the workspace. If you click a member, the affected point and surface geometry is highlighted in the workspace. For NURBS objects, there isn’t necessarily a one-to-one correlation between set members and points visible in the workspace. For example, if you drag a selection box around the top point of a cone, several members in the set light up. This is because you’ve actually selected several points superimposed at the top of the cone. Because of the internal structure of NURBS geometry, points are often superimposed around edges or end positions. 8
Enter the weight in the Edit box, or drag the thumbwheel.
Thumbwheel
Reset
Edit box
The weight you enter applies to all selected points. The Set Editor shows the new point weights in the boxes next to the points. 9
In the workspace, transform the cluster’s handle or skeleton’s IK handle to see if your weight choices have the desired results.
10 Adjust the weights as needed.
36
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights See “Options for modifying point weight numbers” on page 38 for details on options that help you enter weights for groups of points.
Tip You can also assign weights to the points when you display sets with List by Object turned on (in list or table format). The technique is the same as the preceding steps. Selected set members in the Set Editor are highlighted with a white background in each display format. For complex clusters having many set members, it’s easiest to see all set members with List by Object and table format selected. Table format is available only for NURBS CV members.
You can set the weight for adjacent points in the Set Editor with a technique that’s similar to painting. The method is ideal for testing the affect of various weights on different points. You can paint point weights only when you display NURBS CV component sets with List by Object in table format.
To paint point weight values in boxes: 1
Turn on Options→List by Object.
2
Click
(List/Table icon) to display the set contents in table format.
Using Maya: Hypergraph, Sets & Expressions
37
Sets
Painting point weights
Sets Editing point weights An example set in table format follows:
Note that the black table entries are unusable members of the set. 3
Choose Mode→Paint Percentages.
4
Enter a value in the Edit box of the Set Editor.
5
Drag through the desired boxes. Each box you drag through receives the weight you entered in the Edit box.
6
Repeat the last two steps to paint other boxes with a different value. See the following topic for options that help you enter weights for points.
Options for modifying point weight numbers There are several options next to the Set Editor’s thumbwheel that might help you enter weights for groups of points:
38
Absolute
When on, the Set Editor gives the point the exact weight shown in the Edit box. This is the default setting.
Scale
When on, the Set Editor multiplies the weight of the selected point by the number shown in the Edit box. When you paint weights, Ctrl-dragging divides the weight of the selected point by the number shown in the Edit box.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights When on, the Set Editor adds the number in the Edit box to the existing weight of the selected point. When you paint weights, Ctrl-dragging subtracts the number in the Edit box from the existing weight of the selected point.
Shift
(Reset)
Resets the thumbwheel value. When Absolute is on, clicking the Reset icon resets the thumbwheel to the home value of the selected weight. The home value is the value a weight has when you click the weight or enter a new value in the Edit Box.
Sets
Suppose you click a weight that has a value of 0.25, then drag the thumbwheel to change its value to 0.5. When you click the Reset icon, the weight becomes its original value 0.25. When Scale is on, clicking the Reset icon resets the thumbwheel value to 1. When Shift is on, clicking the Reset icon resets the thumbwheel value to 0.
Selecting and keying point weight attributes You can select weight attributes and key their values for clusters, cluster flexors, and skin points. Note that you key attributes on a cluster; Maya stores weights with a cluster, not the associated geometry.
To select the weight attribute of points: 1
Choose Mode→Editing.
2
In the workspace or Set Editor, choose the points whose weight attribute you want to keyframe.
3
Select Edit→Select Weight Attribute(s).
To key the weight attribute of points: 1
Move the Time Slider’s current time indicator to the desired frame.
2
Select the weight attribute of the points.
3
Enter the weight value in the Set Editor’s edit box. See “Editing point weights” on page 33 for details.
4
Select Edit→Key Selected Weight(s). Using Maya: Hypergraph, Sets & Expressions
39
Sets Altering the display of sets 5
Choose Edit→Select Weight Attribute(s) if you want to:
•
see the red key marker in the Time Slider resulting from the keyed weights
•
load the keyed weight into the Graph Editor
Altering the display of sets The Set Editor, by default, displays all sets in your scene. The following topics describe options for narrowing or broadening the number of sets displayed, so you spend less time scrolling and expanding sets.
Expanding and collapsing sets You can expand or collapse all sets in the Set Editor. You can also expand all sets automatically as they appear in the Set Editor.
To expand all sets: Choose List→Expand All Frames.
To collapse all sets: Choose List→Collapse All Frames.
To expand all sets automatically: Choose Options→Auto Expand Frames.
Note If you display a lengthy set with List by Object in the list format, a scroll bar appears to the left of set members. The scrolling area displays eight members by default. To display more members, choose Options→Object List Length. Enter the number in the Mini Scroll Bar Length window, then close the window.
Filtering sets from display The Set Editor displays all sets in the scene by default. If the display seems crowded with entries, you can omit types of sets from the display, for instance, rendering sets.
40
Using Maya: Hypergraph, Sets & Expressions
Sets Altering the display of sets
To filter categories of set types from the Set Editor display: In the Set Editor, choose List→Filters and the type of set. Clarification of several Filters menu entries follows: Meaning
All Regular Sets
All sets other than those Maya creates automatically.
All Render Sets
Default and added shading groups.
All Deformer Sets
Default and added sets for each type of deformer. Turning this option off lets you filter specific types of deformer sets listed below the option in the Filters menu.
Joint Cluster Sets
Skin point sets. (If you add a cluster flexor to bound skin, Maya creates a set that contains one or two embedded sets. The embedded sets are existing skin point sets. See the note on page 27.)
Joint Lattice Sets
Joint lattice flexor sets.
Lattice Sets
Lattice sets and bone lattice flexor sets.
Sculpt Sets
Sculpt sets and sculpt flexor sets.
Other menu entries are self-explanatory.
To filter individual set types from the Set Editor display: In the Set Editor, choose List→Filters→Item Filters→ and the type of item. The set types in the list are mainly types of rendering sets. See the documentation for the MEL itemFilter command for details on how you can add items to this list.
Displaying sets associated with selected objects The Set Editor has several options for displaying sets associated with selected objects or items.
Using Maya: Hypergraph, Sets & Expressions
41
Sets
Menu entry
Sets Altering the display of sets
To display sets associated with selected objects: 1
Select the objects or items.
2
Choose List→Update Now. The Set Editor displays sets whose members are in the selected objects. If you selected a deformer influence object such as a joint or lattice, the Set Editor also displays the associated deformer set. No other sets appear, including the default initialShadingGroup and initialParticleSE sets. If no objects are selected before using Update Now, the Set Editor displays no sets.
Example Suppose you’ve applied clusters to several NURBS objects in your scene. You want to edit the points of a cluster you’ve attached to a cylinder, but you don’t know which of the cluster sets is appropriate.
The set might be any of these sets.
Do the following steps to find and display the appropriate set:
42
1
Turn on
(Select by component type) in the main menu area.
2
Turn on (Points), then right mouse-click enabled for selection.
3
Select some or all CVs that are part of the cylinder’s cluster set.
Using Maya: Hypergraph, Sets & Expressions
to make sure CVs are
Sets Altering the display of sets 4
Choose List→Update Now. The set appears by itself in the Set Editor. If no objects are selected before using Update Now, the Set Editor displays no sets.
Sets
5
Expand the set to work on its members.
To display sets associated with selected objects repeatedly: Turn on Options→Auto Update. Each time you select an object or item, the Set Editor displays the sets associated with the selected object. If no objects are selected, the Set Editor displays no sets. Note that the Set Editor cannot be in Editing mode and Auto Update mode at the same time.
Tip If the Set Editor displays a set you want to keep in view, turn off Auto Update while the set is in view.
To add sets to the existing display: 1
Select the objects or items.
2
Choose List→Add Selected to List. The Set Editor displays sets associated with the selected objects in addition to any sets already in the Set Editor.
To return to the display of all sets in the scene: Choose List→All Sets.
Using Maya: Hypergraph, Sets & Expressions
43
Sets Altering the display of sets This displays all sets in the scene, including those in partitions. See “Understanding partitions” on page 47.
To scroll directly to set members associated with selected objects: 1
Choose Options→List by Object. This lists sets by object. Scrolling directly to set members associated with selected objects is possible only with List by Object selected.
2
Expand the set containing the members you want to see.
3
Select the set members in the workspace.
4
Choose List→Scroll Frames to Selection. The Set Editor displays the members at the top of the list of set members. With this option off, set members are displayed in an ordered list. You might need to scroll through a lengthy list to find the selected members.
To scroll directly to set members each time you select: 1
Choose Options→List by Object. This lists sets by object. Scrolling directly to selected set members works only with List by Object selected.
2
Choose Options→Auto Scroll to Selection. When you select set members in the workspace, the Set Editor displays the members at the top of the list of set members.
Using bookmarks to display sets You can bookmark sets in the Set Editor to display them conveniently later. This is useful when it’s hard to navigate the Set Editor because it contains many sets. Bookmarking is also useful for grouping sets together to examine them at the same time.
To bookmark sets: 1
Display only the desired set or sets in the Set Editor. For example, select a member of the set in the workspace, then choose List→Update Now to display only the selected set.
2
44
Select Bookmarks→Add Bookmark.
Using Maya: Hypergraph, Sets & Expressions
Sets Altering the display of sets A bookmark gets a default name, for example, bookmark, bookmark1, and so on. The name appears at the bottom of the Bookmarks menu.
To name a bookmark before creating it: 1
Display only the desired set or sets in the Set Editor. For example, select a member of the set in the workspace, then choose List→Update Now to display only the selected set.
2
Select Bookmarks→Add Bookmark-❒. A window appears and prompts for the bookmark name.
3
Enter a bookmark name. Sets
To return to a bookmark: Select Bookmarks→ and the name of the bookmark from the menu.
Example Suppose you create a bookmark named Eyeballs when the Set Editor displays only two sets, LeftEye and RightEye. Selecting Bookmarks→Eyeballs displays the LeftEye and RightEye sets:
To delete a bookmark: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Delete Bookmark. Using Maya: Hypergraph, Sets & Expressions
45
Sets Altering the display of sets
To rename a bookmark: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Rename Bookmark. A window appears and prompts for the bookmark name.
4
Enter the new name. You can also rename a bookmark by selecting Bookmarks→name-❒, where name is the name of the bookmark. A prompt appears and lets you enter the new name.
Note If you create a bookmark in the Set Editor or Graph Editor, a bookmark name appears among the set names when you display all sets in the Set Editor. This is because a bookmark is actually a set. If you expand a bookmark name, you’ll see the names of the bookmarked sets embedded under it. The same sets appear in the Set Editor display elsewhere, not embedded under the bookmark name. You must work directly with the members of a set where they aren’t embedded. To quickly display the appropriate unembedded set, select the set name, and choose List→Update Now. To edit the weights of the members, display the unembedded sets in table format with Options→List by Object on.
Edit the members of the balls set here. You can’t edit the members below BallsBookmark.
46
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding partitions
Understanding partitions A partition is a collection of related sets. The sets in a partition can have no overlapping members. As you create shading groups, bind skin, and do a few other tasks, Maya creates partitions. It does this to keep the sets separate where an operation would be hindered by overlapping members. You can also create custom partitions to keep your own sets separate.
Partitions you create
Example Suppose you’re animating a cartoon character’s nose as he smiles and laughs. You’ve added a cluster to several CVs for adjusting the nose as he smiles and another cluster to different CVs for adjusting the nose as he laughs. Creating the two clusters creates a set for each group of CVs. Occasionally you want to move CVs from one set to the other, to alter the deformations that occur as you transform the clusters. When you move the CVs from one set to the other set, they remain in the first set. You might not want the CV’s presence in the first set because they add undesirable deformations as you transform the cluster. To avoid this problem, you can create a partition and put both sets in it. The partition prevents one set from having members of another set. When you move the CVs from the first set to the second set, they’re automatically removed from the first set. You can also add a partition to prevent clusters from having overlapping members when you add the cluster with Deformations→Cluster-❒. See the Basic Deformers part of Using Maya: Animation for details.
Using Maya: Hypergraph, Sets & Expressions
47
Sets
When you use the Create Set menu entry to create a set, its members can, by default, exist in any other set you’ve created. In some instances, you might want to prevent two sets from having overlapping members. You can do this by creating a partition and putting the sets in it.
Sets Understanding partitions
The LaughCVs and SmileCVs sets in the NoseParts partition cannot have overlapping members.
Partitions created by Maya Maya creates partitions in cases where objects or items must be kept separate for correct operation. A new scene has two partitions by default: •
layerPartition
•
renderPartition The layerPartition includes sets named for layers you create. See Using Maya: Basics for details on creating layers. The renderPartition contains the shading group sets explained in “Shading group sets created by Maya” on page 9.
48
Using Maya: Hypergraph, Sets & Expressions
Sets Creating, displaying, and removing partitions Because you can apply only one shading group per object or per polygonal facet, the rendering partition ensures you can’t accidentally render a single object or polygonal facet with two shading groups. If you bind skin to a skeleton, Maya also creates a partition. The partition has the name joint1skinPartition or something similar. It contains all the skin point sets in your scene. The partition prevents you from assigning skin points to two different joints, which would result in undesirable skin deformations when you manipulate a skeleton If create a deformer with the Exclusive option, Maya creates a partition named deformPartition by default. The partition contains all deformer point sets in your scene. It prevents you from assigning points to two different sets, which might result in undesirable deformations when you manipulate the deformers.
Creating, displaying, and removing partitions The following procedures describe how to create, display, and remove partitions. Note that there are only two valid operation modes when you display partitions in the Set Editor. •
Editing mode lets you move a set from one partition to another.
•
Select mode lets you select the partition to rename or remove it, or add sets to it.
To create a partition: 1
Make sure no objects or other items are selected.
2
Select any sets you want to put in the partition. See “Selecting a set” on page 15 for details.
Using Maya: Hypergraph, Sets & Expressions
49
Sets
Because Maya creates partitions for you when it makes sense to do so, you’ll rarely need to create your own partitions. Still, if you find a situation where you need create one, you can do so as described in the next topic.
Sets Creating, displaying, and removing partitions 3
To create a partition with a default name, choose Edit→Sets→Create Partition. (This completes the procedure.) or To name the partition when you create it, choose Edit→Sets→Create Partition-❒ and continue with these steps:
4
Enter the name of the partition in the Name text box of the Partition Options menu.
5
Click Apply. See the following procedure to display the partition in the Set Editor. Note that you can also create a partition from the Set Editor with Edit→Create Partition-❒.
To display partitions: 1
From the Set Editor, choose List→Partitions. The partitions appear in the Set Editor.
2
To see the sets a partition contains, turn on Mode→Editing and expand the partition. You can move a set from one partition to another in this display mode, but you can’t move or edit set members. To return to the display of sets only, choose List→Sets. This displays all sets in the scene, including those in partitions.
To remove a partition, but not its contents: 1
From the Set Editor, choose List→Partitions. The partitions appear in the Set Editor.
2
In the Set Editor, turn on Mode→Select.
3
Click the name of the partition.
4
Press your keyboard’s Backspace key. This removes the partition, but not the sets that are in the partition.
50
Using Maya: Hypergraph, Sets & Expressions
Sets Adding and moving sets to partitions
Adding and moving sets to partitions The following procedures describe how to add and move sets to partitions:
To add a set to an existing partition when you create the set: 1
Select the objects or items to be put in the set.
2
From Maya’s main menu, choose Edit→Sets→Create Set-❒. or From the Set Editor, choose Edit→Create Set-❒. The Create Set Options menu appears. Enter the name of the set in the Name text box.
4
To add the set to a partition turn on Try to Add or Force to Add.
Sets
3
If the partition already has a set containing elements of the selected object, when you select Try to Add, Maya doesn’t add the member and instead displays a warning message to the Script Editor. If you select Force to Add, Maya adds the member to the set after removing the member from the set it’s already part of. 5
After you turn on either option in the prior step, choose the name of the partition from the Partition menu.
6
Click the Apply button. Maya puts the set in the selected partition.
To move a set from one partition to another: 1
Choose List→Partitions.
2
Expand the partitions as necessary to see the set.
3
With the middle-mouse button, drag the set to the desired partition. Use Ctrl-middle mouse button to copy a set from one partition to another.
To move a set to an empty partition: 1
Select List→Sets.
2
Select Mode→Select.
3
Click the set to be moved into a partition.
Using Maya: Hypergraph, Sets & Expressions
51
Sets Adding and moving sets to partitions 4
Select List→Partitions.
5
Select Mode→Editing.
6
Click the destination partition to select it.
7
Select Edit→Add Items. Maya puts the set in the selected partition.
52
Using Maya: Hypergraph, Sets & Expressions
Index A Absolute option 38 adding members to deformer sets 25 set members 22 sets to a partition 51 Auto Scroll to Selection 44 Auto Update 43 automatically created sets 5
B blend shapes sets associated with 25 bookmarks creating 45 deleting 45 embedded names 46 naming 45 renaming 46 returning to 45
C
D default list of sets 17, 19 naming of sets 8 shading of objects 9 deformation skin 6, 28 deformers adding set members to 25 adjusting operation of 6 pruning membership 28 removing members 25 sets 6, 11, 25 deformPartition 49 deleting bookmarks 45 displaying additional sets in Set Editor 43 all sets in a scene 43 partitions 50 dragging members to a new set 22
editing point weights 33 set membership 22 editing modes in Set Editor 13, 18 embedded bookmark names 46 set editing not allowed 27 set names 46 entering weights in Edit box 36 expanding all sets 40 set contents 8
F filtering types of sets 40 Force to Add 51
I icons in Set Editor 8 indentation of sets 9 initialParticleSE 9, 11 initialShadingGroup 9, 10
J joint1Set1 29 joint1skinPartition 49
E Edit box 36 Edit Membership Tool 22, 25, 31
Index
character sets creating and selecting 16 cluster default set names 34 sets 6, 12 weights of points 33 cluster1Set set 11 collapsing all sets 40 sets 9
creating and naming a partition 49 and naming a set 14 bookmarks 45 character sets 16 set with default name 13 CVs selecting in table format 20 set member IDs 18
K keying weight attribute values 39
Using Maya: Hypergraph, Sets & Expressions
53
Index
L layerPartition 48 layers moving sets to 7 List/Table icon 20 listing by object 17, 19 table format 20
M menu bar Set Editor 8 Motif selection techniques 22 moving sets to another partition 51 skin point members 28, 30
N NURBS CVs superimposed in workspace 36
O object list changing scroll bar length 40 overlapping set members preventing 47
R removing deformer set members 25 partitions 50 set contents 16 set members 24 removing points with Edit Membership Tool 33 renaming bookmarks 46 renderPartition 48 resetting weights 39
S
P Paint Percentages mode 13 painting point weights 37
54
partitions adding sets 51 creating and naming 49 default 48 definition of 47 displaying 50 moving sets 51 removing 50 points cluster 12 definition 25 highlighting in Set Editor 35 selecting in Set Editor 36 pruning membership of deformer sets 28
Scale option 38 scroll bar length changing 40 Scroll Frames to Selection 44 scrolling directly to selected members 44
Using Maya: Hypergraph, Sets & Expressions
Select Contents mode 13 Select mode 13 selected objects displaying set members of 41 selecting character sets 16 CVs in table format 20 nonmembers in table format 21 points in Set Editor 36 set contents 9, 16 set without contents 14, 15 weight attributes 39 selecting objects simplifying with sets 6 selection techniques Motif 22 Set Editor menu bar 8 starting 7 tool bar icons 8 set members correlation with NURBS CVs 36
Index
simplifying selection with 6 skin point 6, 11, 29 U and V parameter IDs 21 user-created 5, 6 shading groups sets Maya creates for 10 Shift option 39 skin altering location of creasing 32 tuning deformation 28, 30 using sets with 6 skin points default names of 35 moving membership 28, 30 set comparison with deformer sets 29 sets 11, 25 weights 34 starting Set Editor 7
W weights cluster point 33 editing 33 entering in Edit box 36 keying 39 negative values 33 painting values 37 selecting attributes 39 set member 6 setting cluster or skin point 34 skin point 34
T table format selecting nonmembers 21 set display in 17, 20 thumbwheel 39 triangle for expanding sets 8 Try to Add 51
U U and V parameters in set member IDs 21 Update Now 42 user-created sets 5, 6
Using Maya: Hypergraph, Sets & Expressions
Index
sets 9, 10 adding members 22 adding to Set Editor display 43 altering display 40 associated with skin points 25 automatically created 5 blend shape 25 cluster 6 cluster1Set 11 collapsing 9 collapsing all 40 creating and naming 14 creating with default name 13 CV member IDs 18 default listing 17, 19 default naming of 8 definition 5 deformer 6, 11, 25 displaying all 43 displaying selected object members 41 Editing mode 13, 18 embedded names 27, 46 expanding a set’s contents 8 expanding all 40 filtering types of 40 indentation 9 initialParticleSE 9, 11 listing by object 19 listing by object in table format 17, 20 member weights 6 Paint Percentages mode 13 preventing overlapping members 47 removing contents only 16 removing members 24 Select Contents mode 13 Select mode 13 selecting contents only 9, 16 selecting without contents 14, 15 shading group 10
55
Expressions
Expressions 3 Introducing Expressions About expressions
12
Where you create expressions
4 Quick Start
11
13
15
Preparing for the examples
15
Creating a simple expression
17
Controlling multiple attributes of an object Controlling attributes in two objects Controlling attributes conditionally Notes on the predefined time variable
5 Expression Syntax Expressions and MEL
32 43
46 47
49
Static attributes
49
Dynamic attributes
49
Custom attributes Attribute names
50 51
Data types of attributes
51
Assigning a value to an attribute Variables
28
45
Elements of an expression Attributes
23
55
56
Data types of variables Predefined variables Custom variables
57 57
59
Using Maya: Hypergraph, Sets & Expressions
3
Expressions Contents Constants
62
Arithmetic, logic, and relational operators Arithmetic operators
63
Relational operators
65
Logical operators Operator precedence
67 68
Conditional statements if statements
69
69
if-else statements
70
else if statements
71
General syntax rules
73
Comments in expressions Programming features
75
75
Notes for C programmers
75
Expression language keywords Flow control statements Flow control errors String usage
63
76
77
88
90
Shortcut assignment operators
91
Shortcut increment and decrement operators Arrays
93
Boolean symbolic constants Common expression errors
95
Error message format
95
Common error messages
6 Editing Expressions Finding expressions
97
99
99
Finding by expression name Finding by selected object
4
95
100 101
Using Maya: Hypergraph, Sets & Expressions
92
Expressions Contents Finding by item type
102
Using the Selection list
103
Filtering attributes from the Selection list Editing an expression in the text field Deleting and copying text
104
105
105
Clearing the expression text field
106
Reloading an expression’s previous contents Editing an expression with a text editor
106
Using an editor listed in the Editor menu
107
Using an editor not listed in the Editor menu Changing an editor’s operation settings Selecting an editor for default startup Creating a new expression Deleting an expression
106
109
110 110
111
112
Using attribute names in expressions
112
Using attribute name abbreviations
113
Omitting an object name in expressions
115
Combining the abbreviation techniques
116
7 Beyond the Basics
117
How often an expression executes
118
Using custom attributes in expressions
118
Displaying attribute and variable contents Reproducing randomness
123
123
Speeding expression execution
127
Reducing redundant expression execution
130
Removing an attribute from an expression
131
Disconnecting an attribute
132
Displaying disconnected attributes in expressions
132
Connecting an attribute to a symbolic placeholder
135
Using Maya: Hypergraph, Sets & Expressions
5
Expressions Contents Renaming an object
136
Executing MEL commands in an expression Understanding path names
137
140
Understanding unexpected attribute values Values after rewinding Increment operations
141
141 142
Data type conversions
143
8 Particle Expressions
147
Understanding particle expressions
148
Understanding creation expression execution Setting the dynamics start frame
149
Setting attributes for initial state usage Writing creation expressions
149 150
150
Understanding runtime expression execution Writing runtime expressions
152
153
Working with particle attributes
159
Adding dynamic attributes
159
Understanding per particle and per object attributes Understanding initial state attributes
160
162
Example of assigning to a dynamic per particle attribute Example of assigning to a dynamic per object attribute Assigning to a custom attribute
Using creation expression values in a runtime expression Working with position, velocity, and acceleration 178
Working with emitted particles Working with collisions
6
183
183
Working with specific particles
167
169
Assigning to a particle array attribute of different length
Working with color
164
189
Using Maya: Hypergraph, Sets & Expressions
175
172 174
Expressions Contents Assigning to vectors and vector arrays List of particle shape attributes
9 Functions
193
196
203
Understanding functions Function syntax
205
206
Data types
208
Understanding function examples in this chapter Limit functions
209
abs
209
ceil
210
floor clamp
210 211
min
212
max
212
sign
212
trunc
213
Exponential functions exp
214
log
214
log10
215
sqrt
215
Trigonometric functions cosd sin sind tan tand
214
214
pow
cos
208
216
216 218 219 224 224 225
Using Maya: Hypergraph, Sets & Expressions
7
Expressions Contents acos
225
acosd
226
asin
226
asind
226
atan
227
atand
227
atan2
227
atan2d
228
hypot
228
Vector functions
229
angle
229
cross
230
dot
231
mag rot
231 232
unit
233
Conversion functions
234
deg_to_rad
234
rad_to_deg
234
hsv_to_rgb
235
rgb_to_hsv
235
Array functions clear
236
236
size
237
sort
237
Random number functions gauss
239
noise
241
dnoise rand
242 243
sphrand
8
239
244
Using Maya: Hypergraph, Sets & Expressions
Expressions Contents seed
246
Curve functions linstep
249 249
smoothstep hermite
254
General commands eval
259
print
261
system
252 259
263
Other functions and commands
264
Using Maya: Hypergraph, Sets & Expressions
9
Expressions Contents
10
Using Maya: Hypergraph, Sets & Expressions
3
Introducing Expressions Expressions are instructions you type to control an object attribute over time. An attribute is a characteristic of an object, for instance, X scale, Y translate, visibility, and so on. Though you can create an expression to animate attributes for any purpose, they’re ideal for attributes that change incrementally, randomly, or rhythmically over time.
An expression gives the manta ray’s wings a fluid, rhythmic motion.
Expressions
Eric Saindon
Expressions are also useful for linking attributes between different objects— where a change in one attribute alters the behavior of the other. For instance, you can make the rotation of a tire dependent on the forward or backward movement of a car. This chapter has the following topics: •
“About expressions” on page 12
•
“Where you create expressions” on page 13
Using Maya: Hypergraph, Sets & Expressions
11
Introducing Expressions About expressions
About expressions Expressions offer an alternative to difficult keyframing tasks. In keyframing, you set the values of attributes at selected keyframes in the animation, and Maya interpolates the action between the keyframes. With expressions, you write a formula, then Maya performs the action as the animation plays. Expressions are often as simple as a few words or lines. In the following example expressions, note the variation in length and detail (rather than their purpose).
Example Ball.translateX = Cube.translateX + 4;
Example if (frame == 1) Cone.scaleY = 1; else { Cone.scaleY = (0.25 + sin(time)) * 3; print(Cone.scaleY + "\n"); }
Though many expressions look like math or a programming language, you don’t need to be a mathematician or programmer to learn how to use them. If you’re fond of programming, expressions offer unlimited animation techniques that would challenge the skill of keyframing experts. You can use an expression to animate any keyable, unlocked object attribute for any frame range. You can also use an expression to control per particle or per object attributes. Per particle attributes control each particle of an object individually. Per object attributes control all particles of an object collectively. You cannot apply an expression to an attribute already animated with any of these techniques:
12
•
keys
•
set driven key
•
constraint
•
motion path
Using Maya: Hypergraph, Sets & Expressions
Introducing Expressions Where you create expressions •
another expression
•
any other direct connection If you do so, you’ll see an error message in the Script Editor and the Command Line’s response area. Though you can’t control a single attribute with two of the preceding techniques, you can control one attribute with keyframes, another with an expression, another with a constraint, and so on. Also, you can use a single expression to assign values to several attributes of one or more objects.
Where you create expressions You create and edit an expression in the Expression Editor. There are several ways to start the Expression Editor: From the main menu bar or Hotbox, choose Window→Expression Editor.
•
From the Channel Box, click the right mouse button in an attribute text field and select Expressions.
•
From the Attribute Editor, click the right mouse button in an attribute text field and select Create New Expression, Edit Expression, or Expression Editor. You cannot start the Expression Editor from every attribute text field in the Channel Box and Attribute Editor. Use Window→Expression Editor if necessary.
Using Maya: Hypergraph, Sets & Expressions
13
Expressions
•
Introducing Expressions Where you create expressions The Expression Editor follows:
Expression text field
The expression text field expands as you type text, so you can write expressions of unlimited length. You can also edit expressions with a text editor such as jot by selecting it from the Editor pull-down menu above the text field.
14
Using Maya: Hypergraph, Sets & Expressions
4
Quick Start The easiest way to learn about expressions is to work through examples. For this reason, we provide the following introductory lessons. Expressions that control particle attributes are more complex than for other objects. For examples, see Chapter 8, “Particle Expressions.”
You can use an expression to link attributes in different objects—so a change in one attribute alters the behavior of the other.
Expressions
In this chapter, you’ll learn about the following topics: •
“Creating a simple expression” on page 17
•
“Controlling multiple attributes of an object” on page 23
•
“Controlling attributes in two objects” on page 28
•
“Controlling attributes conditionally” on page 32
•
“Notes on the predefined time variable” on page 43
Preparing for the examples A few preparatory steps will simplify your understanding of the examples in this chapter. Before starting the examples, do these steps:
To prepare for the examples: 1
Select Options→General Preferences. Using Maya: Hypergraph, Sets & Expressions
15
Quick Start Preparing for the examples The General Preferences window appears. Drag either side of the General Preferences window to expand its width. You must do this to display the Units tab in the window. 2
Click the Units tab.
3
In the Units tab, make sure Time is set to Film (24 fps). This makes your animation play at the default rate of 24 frames per second.
4
In the General Preferences window, choose the Animation tab.
5
Enter 0 for the starting frame of the Time Slider and the Range Slider, and enter 300 for the ending frame of the Time Slider and Range Slider.
Important For the lessons to work correctly, you must enter 0 for the starting frame of the Time Slider and Range Slider. Press your keyboard’s Enter key after each entry. Rewind the animation to frame 0. After doing the lessons, read “Notes on the predefined time variable” on page 43 for details on why the lessons require the starting frame to be 0. Specifying a range of 300 frames gives ample time to see the effects you’ll create in the examples. 6
In the General Preferences window, click Save and Close.
7
At the top edge of the workspace, select Shading→Smooth Shade All to display all objects you create in the scene with smooth shading. This will enhance the look of the objects you create in the examples.
8
16
From the menu bar, choose Window→Expression Editor to display the Expression Editor.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 9
Make sure these default Expression Editor menu options are selected: Select Filter→By Object/Attribute Name Object Filter→Selected Objects Attribute Filter→All “Finding expressions” in Chapter 6 gives details on these options.
Creating a simple expression The following steps show how to control an attribute of a single object. An attribute is a characteristic of an object, for example, X scale, Y scale, X rotation, and so on. In this example, you’ll learn how to stretch a sphere along its Y-axis by controlling its scaleY attribute as the animation plays.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. This creates a NURBS sphere with an X scale, Y scale, and Z scale of 1. In the Channel Box or elsewhere, name the sphere Ball.
3
Select Display→NURBS Smoothness→Fine to set Ball’s display smoothness to fine resolution. Maya displays the object with extra polygons to make it look smoother in the workspace. This doesn’t affect the underlying model’s geometry. It alters only its display.
4
Rewind the animation to frame 0.
Using Maya: Hypergraph, Sets & Expressions
17
Expressions
2
Quick Start Creating a simple expression
To create the expression: 1
Make sure Ball is selected.
2
Choose Window→Expression Editor to display the Expression Editor. The selected object’s name, Ball, is highlighted in the Objects list of the Expression Editor.
3
Enter ScaleBallHeight in the Expression Name box. Entering an expression name lets you find the expression easily in a later work session if you decide to alter it. Use alphabetical and numerical characters for expression names. If you use space characters or special characters such as a hyphen (-), Maya deletes them or replaces them with an underscore character (_) after you finish creating the expression.
4
Notice the Attributes list. It displays Ball’s keyable, unlocked attributes—the attributes you’ll most likely want to animate with an expression. Use the scroll bar to see the entire list.
5
Enter this expression in the expression text field:
Ball.scaleY = time + 1;
Enter the expression with the same upper and lowercase spelling shown. Entries in the expression field are type case sensitive. The semicolon (;) signifies the end of the expression statement. Each statement in an expression must end with a semicolon. The only exception is when the expression has a single statement. An error message appears in the Script Editor and Command Line’s response area if the expression has incorrect syntax or typing mistakes. Edit text the same way you edit other text fields in Maya.
18
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 6
Click Create to compile the expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. Clicking this button also executes the expression for the current frame. The expression sets Ball’s scaleY attribute to the value of time + 1. Ball.scaleY is the full name of the attribute. A period separates the name of the object and attribute. You must spell them with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. See “Using attribute names in expressions” in Chapter 6 for more details. The word time is a predefined variable in Maya that updates as an animation plays. It contains the elapsed number of seconds from the first frame to the current frame. The value increases with the increasing frame number. At the default animation playback rate of 24 frames per second, time has these values, rounded to four decimal places: Time (seconds)
0
0
1
0.0417
2
0.0833
3
0.125
24
1.0
240
10.0
Expressions
Frame
If you ever need to change the playback rate, you can do so by choosing Options→General Preferences. Expand the General Preferences window, display the Units folder, and choose the desired rate from the Time menu. Regardless of what animation playback rate you choose, you can find the time elapsed in the animation at any frame with this formula:
frame time = --------------rate For example, if the frame rate is 24 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.25. Using Maya: Hypergraph, Sets & Expressions
19
Quick Start Creating a simple expression If the frame rate is 30 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 30, which equals 0.0333. At frame 6, elapsed time is 6 divided by 30, which equals 0.2.
To see the result of the expression: 1
Rewind and play the animation. Ball’s scaleY attribute increases as the time increases: Frame
Time (seconds)
Ball.scaleY (time + 1)
0
0
1
1
0.0417
1.0417
2
0.0833
1.0833
3
0.125
1.125
24
1.0
2.0
240
10.0
11.0
Maya executes the expression each frame. This causes the object size to scale along its Y-axis, stretching its height during playback.
The scaling is smooth because the geometry stretches in synch with the small time increments of the animation playback.
20
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 2
Stop and rewind the animation. Rewinding the animation returns Ball to its original shape. This occurs because the expression executes with time equal to 0. The value of time + 1 is 1, the original scaleY value of Ball.
3
Play the animation. This repeats the increasing scale.
4
Stop and rewind the animation.
5
Close the Expression Editor window. This complete the steps to creating an expression. To further your understanding of expressions, we’ve included the following steps to show how to edit the expression you just completed.
To edit the expression: Suppose you decide that Ball scales too quickly as the animation plays. You can change the expression to see how the animation looks when you scale Ball half as fast. 1
Choose Window→Expression Editor to display the Expression Editor again. You can find the expression you created earlier by: remembering the name of the expression
•
remembering the name of the object and attribute you controlled with the expression
•
examining each expression in the scene that’s controlled by an expression In this example, you’ll find the expression ScaleBallHeight by its name. See Chapter 6, “Editing Expressions” for details on the other methods.
2
Choose Select Filter→By Expression Name.
3
Click ScaleBallHeight in the Expressions list. The expression appears in the expression text field.
Using Maya: Hypergraph, Sets & Expressions
21
Expressions
•
Quick Start Creating a simple expression
Ball.scaleY = time + 1;
4
Change the previous expression to this: Ball.scaleY = time/2 + 1;
Use the same editing techniques you use with other text fields in Maya. By dividing time by 2, you’ll make the Y scaling increase half as fast as with the previous version of the expression. 5
Click Edit to compile the modified expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. After being compiled, the expression executes for the current frame. Clicking the Edit button does the same action as clicking the Create button. The Create button exists only for new expressions. The Edit button replaces the Create button when you display an existing expression.
To see the result of the edited expression: 1
Play the animation. Ball scales its Y dimension half as fast as with the previous expression contents.
2
Stop and rewind the animation. Feel free to experiment with other values in the expression. This concludes the first example. Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
22
name an expression and type it in the expression text field
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object •
compile an expression to a form Maya can execute
•
work with the predefined variable time
•
find an expression you previously created
•
modify an expression
Controlling multiple attributes of an object You can use a single expression to control two or more attributes of an object. In the following steps, you’ll use an expression to increase the X, Y, and Z scale attributes of a sphere as the animation plays.
Expressions
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. This creates a NURBS sphere with an X scale, Y scale, and Z scale of 1.
2
In the Channel Box or elsewhere, name the sphere Planet.
3
Select Display→NURBS Smoothness→Fine to set the Planet’s display smoothness to fine resolution.
4
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
5
Rewind the animation to frame 0.
To create the expression: 1
Select the Planet object. Planet becomes the selected object in the Expression Editor.
2
In the Expression Editor, enter ScalePlanet in the Expression Name box. Using Maya: Hypergraph, Sets & Expressions
23
Quick Start Controlling multiple attributes of an object This names the expression so you can find it more easily later. 3
Enter these statements in the expression text field:
The expression has three statements. Each statement sets an attribute to the value of the predefined variable time. 4
Click Create to compile the expression. An error message appears in the Script Editor and Command Line’s response area if the expression has incorrect syntax. Planet disappears because clicking Create also executes the expression at the current frame after compiling. At frame 0, time is 0, so the value of the scaleX, scaleY, and scaleZ attributes becomes 0. Planet has no size, so it disappears.
To see the result of the expression: 1
Play the animation. The expression executes each frame, so Planet grows quickly as the animation plays.
24
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object
Because animation playback increases time, the value of Planet’s scaleX, scaleY, and scaleZ attributes increase at the rate of the increasing time. The object increases its scale until the last frame of the Time Slider plays. 2
Stop and rewind the animation. The following two series of steps show how to see the same result with other methods.
To see the result by linking attribute values: 1
Change the expression to this: Expressions
Planet.scaleX = time; Planet.scaleY = Planet.scaleX; Planet.scaleZ = Planet.scaleX;
2
Click Edit to compile the expression.
3
Play the animation. The expression works the same as the previous one. The first statement sets Planet.scaleX to the value of time. The second statement sets Planet.scaleY to the value of Planet.scaleX. Because you’ve set Planet.scaleX to the value of time, Planet.scaleY also has the value of time. You’re simply transferring one attribute’s value to another. The third statement also sets Planet.scaleZ to the value of the attribute Planet.scaleX.
Using Maya: Hypergraph, Sets & Expressions
25
Quick Start Controlling multiple attributes of an object The advantage of this expression is that if you assign a different value to Planet.scaleX in the first statement, the second and third statements automatically receive the new value. In other words, you’ve linked Planet.scaleY and Planet.scaleZ to the value of Planet.scaleX—whatever its value is. 4
Stop and rewind the animation.
5
In the first statement of the expression, divide time by 5 as follows: Planet.scaleX = time/5; Planet.scaleY = Planet.scaleX; Planet.scaleZ = Planet.scaleX;
6
Click Edit to compile the expression.
7
Play the animation. Planet increases its scale attributes one-fifth as fast of the previous expression. By assigning the value of Planet.scaleX to Planet.scaleY and Planet.scaleZ, Planet.scaleY and Planet.scaleZ were automatically assigned the value time/ 5 in the second and third statements.
8
Stop and rewind the animation. You can get the same result using a variable in an expression.
To see the results using a variable: 1
Change the expression to this: float $increment; $increment = time/5; Planet.scaleX = $increment; Planet.scaleY = $increment; Planet.scaleZ = $increment;
The expression has the same result as the previous one. The first statement defines a variable named $increment to be used as storage for the value of a time increment. You define it as a floating point number—a number that can have a decimal point. The second statement assigns $increment the value of time divided by 5. As the animation plays and the time increases each frame, the value of $increment increases by the value of time divided by 5. The $increment therefore increases in smaller units than time increases.
26
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object The next three statements assign the contents of $increment to the three scale attributes of Planet. The scale attributes therefore receive the value of time divided by 5 each frame. This makes the object increase uniformly in scale slowly as the animation plays. 2
Click Edit.
3
Play the animation. The result is the same as with the previous expression
4
Stop and rewind the animation. You can make a change to the variable assignment in the second statement without altering the other statements.
To modify the variable: 1
Change the expression to this: float $increment; $increment = time * 2; Planet.scaleX = $increment; Planet.scaleY = $increment; Planet.scaleZ = $increment;
Click Edit.
3
Play the animation. Because you assigned time * 2 to the variable $increment, the expression sets all three attributes to the value of time * 2 as the animation plays. This makes the three scale attributes increase at a rate twice as fast as would occur if you assigned them the value of time alone.
4
Stop and rewind the animation. This concludes the example. Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
link multiple attributes of the same object with a single expression
•
use a variable you defined in an expression
•
modify a single assignment to an attribute without changing other statements
Using Maya: Hypergraph, Sets & Expressions
27
Expressions
2
Quick Start Controlling attributes in two objects
Controlling attributes in two objects You can write an expression to control attributes in two or more objects. In the following steps, you’ll create a cylinder and cone, then rotate each around its local X-axis as the animation plays. In other words, each object will spin around in place.
To see an object’s local rotation axes, select the object, then choose Display→Object Components→Local Rotation Axes.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Cone.
2
In the Channel Box or elsewhere, name it Cone.
3
Choose Primitives→Create NURBS→Cylinder from the Modeling menu.
4
In the Channel Box or elsewhere, name the cylinder Can. The exact translation and scale of Cone and Can is unimportant in this example. Give them roughly the same translation and scale as in the above figure.
5
Select both objects, then choose Display→NURBS Smoothness→Fine. This sets the display smoothness of both objects to fine resolution.
28
6
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
7
Rewind the animation to frame 0.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes in two objects
To create the expression: 1
Select Can. To control attributes in both objects, you can select either object to write the expression. In fact, any object or node in a scene can be selected when you write an expression to control an object other than a particle object. For details on creating expressions to control particles, see Chapter 8, “Particle Expressions.”
2
In the Expression Editor, enter RotCanAndCone in the Expression Name box. This names the expression so you can find it more easily later.
3
Enter this expression: Can.rotateX = time * 10; Cone.rotateX = time * 10;
This assigns Can’s rotateX attribute and Cone’s rotateX attribute to the value of time multiplied by 10. 4
Click Create to compile the expression.
To see the results: 1
Play the animation. Expressions
Each object rotates around its local X-axis by the degree value resulting from time * 10. After 1 second, for example, the rotateX attribute of each object is one degree times 10, or 10 degrees. After 2 seconds, it’s 2 degrees times 10, or 20 degrees. Maya works in degree angle units, by default. You can change the angular units to radians by choosing Options→General Preferences and displaying the Units folder.
Using Maya: Hypergraph, Sets & Expressions
29
Quick Start Controlling attributes in two objects With the animation playing at 24 frames per second, each object’s rotateX attribute has these values: Frame
Time
Can.rotateX (degrees)
0
0
0
1
0.0417
0.417
2
0.0833
0.833
3
0.125
1.25
24
1.0
10
240
10.0
100
The values in this chapter are rounded to four significant digits. The actual values might have many more digits. To see the degree value of Can.rotateX at different frames, select Can, display the Channel Box, and stop the animation at selected frames. The Channel Box updates its values after you stop the animation. To see the degree value of Cone.rotateX at different frames, select Cone instead of Can. The Channel Box displays values for the selected object. 2
Stop and rewind the animation. You can edit the expression to make Can rotate slower than Cone.
To get different results: 1
Change to the expression to this: Can.rotateX = time * 5; Cone.rotateX = time * 10;
2
Click Edit to compile the expression.
3
Play the animation. Can rotates half as fast as Cone as the animation plays.
30
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes in two objects
4
Stop and rewind the animation.
5
Close the Expression Editor window. This concludes the example. This example showed how to write a single expression to control attributes of two different objects. However, you could have written two expressions, one that rotates Can and one that rotates Cone. The advantage of creating separate expressions is that you’ll have two expression names, each presumably named after the object and attribute you’re controlling. Having two expression names makes it easier to find the expression that controls the desired attribute.
Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
control rotateX attributes in two objects using the same expression
•
increase the rotation of each object in synch with animation time
•
rotate one object at half the speed of the other object
Using Maya: Hypergraph, Sets & Expressions
31
Expressions
The advantage of using a single expression to control the attributes is that all statements are in a single expression. You don’t need to edit two expressions.
Quick Start Controlling attributes conditionally
Controlling attributes conditionally You can write an expression that takes different actions depending on the value of attributes or variables it examines as an animation plays. In the following steps, you’ll increase the scale of a sphere for the first two seconds of animation, then stop scaling and move it in a global Y-axis direction for the remainder of the animation.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. By default, this creates a NURBS sphere at the origin with an X scale, Y scale, and Z scale of 1.
2
From the Channel Box or elsewhere, name the sphere Balloon.
3
Select Display→NURBS Smoothness→Fine to set Balloon’s display smoothness to fine resolution.
4
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
5
Rewind the animation to frame 0.
To create the expression: 1
Select Balloon.
2
In the Expression Editor, enter RisingBalloon in the Expression Name box.
3
Enter this expression: if (time < 2) Balloon.scaleY = time;
This expression is an if statement. The if keyword causes the expression to make a decision based on a comparison of two or more items. In this case, the expression compares the value of time to the value 2.
32
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally
Important When you compare the value of time to a number in an expression, Maya interprets time as seconds rather than milliseconds, minutes, or any other unit of time. In the example, Maya interprets 2 as 2 seconds. The expression checks whether the value of time is less than two seconds. If so, it does the assignment Balloon.scaleY = time. If time is not less than two seconds, the assignment doesn’t occur. Notice the indentation of Balloon.scaleY = time under if (time < 2). Maya ignores all indentation, extra spaces, and blank lines between statements. We used the indentation to make the expression easier to read. You could have also written the expression as follows: if (time < 2) Balloon.scaleY = time;
This isn’t as easy to read. Consistent, organized spacing is a good habit to develop. This book shows examples of good spacing style. 4
Click Create to compile the expression. Balloon flattens. Expressions
The expression executes when you click the Create button. Because the animation is at frame 0, animation time is 0. Because time is less than 2, Maya sets Balloon.scaleY equal to the value of time, which equals 0. A scaleY value of 0 flattens the object in the Y dimension. 5
Play the animation. The flattened Balloon’s scale increases along its Y-axis. It inflates as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
33
Quick Start Controlling attributes conditionally
At 2 seconds, Balloon stops inflating. An expression executes each frame as an animation plays. The if statement sets the scaleY attribute of Balloon to the value of time each frame when the time is less than 2. When time equals 2 or more, the if condition is no longer true. The statement that follows it, Balloon.scaleY = time, no longer executes. The value of the scaleY attribute stays at the last value it had before time became 2, specifically, 1.9583. At 2 seconds of animation time and every moment thereafter, scaleY continues to be 1.9583. Recall that this example uses a frame rate of 24 frames/second. The time and Balloon.scaleY have these values at various frames: Frame
Time (seconds)
Balloon.scaleY (time)
0
0
0
1
0.0417
0.0417
2
0.0833
0.0833
3
0.125
0.125
24
1.0
1.0
47
1.96
1.9583
48
2.0
1.9583
49
2.04
1.9583
The if statement’s condition, (time < 2), is a comparison. The condition must be surrounded by parentheses to isolate it from assignment that follows it.
34
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally The < in the condition is a relational operator. A relational operator tests how one value relates to another. In the example, the < tested whether time is less than 2. Besides the < operator shown in this example, there are several other relational operators such as >, >=, ==, and so on. See “Arithmetic, logic, and relational operators” in Chapter 5. 6
Stop and rewind the animation. Balloon flattens again because the scaleY attribute becomes 0 when you rewind the animation. Time is 0, so scaleY is 0. You can make Balloon rise after it inflates by adding a second if statement to the expression.
To add another if statement to the expression: 1
Change the expression to this: if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time;
Click Edit to compile the expression.
3
Play the animation. Balloon inflates for 2 seconds. After 2 seconds, Balloon stops inflating and its position skips from a Y-axis position of 0 to 2. You’ll eliminate the motion skip in a later step. The second if statement increases the translateY position of Balloon after the animation time rises above two seconds. The >= symbols mean greater than or equal to. Whenever time is greater than or equal to 2, the expression assigns Balloon’s translateY the value of time. The translateY value therefore increases for the rest of your animation’s playback range. Notice that a semicolon ends each statement. Forgetting a semicolon after each statement causes a syntax error, and the changes you’ve made to the expression won’t take effect.
Using Maya: Hypergraph, Sets & Expressions
35
Expressions
2
Quick Start Controlling attributes conditionally
Important Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might make you believe your editing changes took effect. 4
Stop and rewind the animation. Balloon flattens but doesn’t return to the origin. (If Balloon has risen out of view, adjust your camera to see it.)
Balloon doesn’t return to the origin because the expression doesn’t assign Balloon a starting point for the beginning of the animation. 5
To make Balloon return to the origin, change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time;
The new first statement sets Balloon.translateY to 0 whenever time equals 0. The == symbols mean is equal to. In conditional statements, be careful to type == rather than =. The = symbol means assign the value to.
36
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally Note that you can put the three statements in any order in this example. When Maya plays each frame, it executes each statement in the expression in the order listed. In this example, the statements work independently, so their order doesn’t matter. We put the statements in the order of time execution because it’s easier to see the logic of the expression. If you ever need to change the expression, you’ll be able to grasp the expression’s actions more quickly. 6
Click Edit.
7
Stop and rewind the animation again. The flattened Balloon returns to its correct position at the origin.
8
Play the animation. Balloon inflates for two seconds, then rises. Expressions
As mentioned before, Balloon skips from Y-axis position 0 to 2 after two seconds of animation play. You can eliminate the skipping and make Balloon rise smoothly from the origin.
To eliminate the motion skip: 1
Stop and rewind the animation.
2
Change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time - 2;
3
Click Edit.
4
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
37
Quick Start Controlling attributes conditionally Balloon inflates for 2 seconds, then rises slowly with time from its position at the origin. When time is greater than or equal to 2, the translateY position of Balloon becomes 2 minus 2, which is 0. As time increases beyond 2 seconds, the translateY position increases in the same increments that time increases.
5
Stop and rewind the animation. The expression achieved the desired result, but it’s more complicated than necessary. You can use an if-else statement to make the statement more compact and easier to read.
To use an else statement instead of multiple if statements: 1
Change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; else Balloon.translateY = time - 2;
2
Click Edit.
3
Play the animation. The else keyword sets Balloon.translateY to time - 2 when (time < 2) is false. In English terms, the combination of the if and else statements says, “If time is less than two seconds, set Balloon.scaleY to the value of time. Otherwise (when time is greater than or equal to two seconds), set Balloon.translateY to time minus two.”
38
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally At any instant in the animation’s playback, either Balloon.scaleY = time executes or Balloon.translateY = time - 2 executes. Under no circumstances can they both execute. The else statement executes only when the if condition that precedes it is false. Note that we added a blank line between the first if statement and the if-else statement combination. This has no effect on the execution of the statements. We put it there to emphasize that the two if statements are unrelated. The first if statement executes whenever time equals 0. It is unrelated to the if-else statements. Using else statements instead of multiple if statements makes an expression simpler to read. If you use an if-else construction instead of a lengthy list of if statements, you’ll also improve the execution speed of the expression. This improves your animation’s playback and rendering speed. Either expression is valid. If using the if-else construction seems confusing, stick with multiple if statements. You can accomplish most expression animation tasks with several if statements strung after one another. 4
Stop and rewind the animation. You can refine the expression to make it even easier to read. Expressions
To make the expression easier to read: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time; } else Balloon.translateY = time - 2;
We removed this statement from the previous version of the expression: if (time == 0) Balloon.translateY = 0;
In its place, we put the statement Balloon.scaleY = time in a segment enclosed by the braces { and }. Maya evaluates both the statements between the braces if the condition (time < 2) is true. 2
Click Edit. Using Maya: Hypergraph, Sets & Expressions
39
Quick Start Controlling attributes conditionally 3
Play the animation. The animation plays exactly as before with the new expression. When the animation time is less than two seconds, not only does Maya set Balloon.scaleY to time, it sets Balloon.translateY to 0. Balloon has a position at the origin until the animation time is greater than or equal to 2 seconds. Setting Ball.translateY to 0 here instead of in a separate if statement makes the expression easier to read and comprehend. As in the previous version of the expression, if time is greater than or equal to 2, Maya executes the else statement. Note that you can put multiple statements between braces for an else statement, just as you do for an if statement.
4
Stop and rewind the animation. You can further refine the animation’s appearance by expanding Balloon more slowly.
To slow Balloon’s expansion: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2;
Only one statement is different, Balloon.scaleY = time * 0.6. The asterisk (*) multiplies time by 0.6.
40
2
Click Edit.
3
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally
The scaleY attribute increases at 60% of the value of time, so Balloon expands slower during playback. (The number 0.6 equals 60%.) By the time Balloon starts to rise, it has expanded to the size of a typical balloon. How do you know whether to multiply time by 0.6 or some other number? You don’t. In cases like this, you need to experiment. For example, you might multiply by various percentages such as 0.2, 0.5, 0.75, and finally 0.6. The 0.6 creates a life-like balloon shape at two seconds. 4
Stop and rewind the animation. You can further refine Balloon’s appearance by eliminating the flattened Balloon that appears at the origin when you rewind the animation. You can also scale Balloon at different rates along each of its three axes. Expressions
To further refine Balloon’s appearance: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; Balloon.scaleX = time * 0.5; Balloon.scaleZ = time * 0.5; } else Balloon.translateY = time - 2;
2
Click Edit. Balloon disappears from view because its scale attributes are 0. The scaleX, scaleY, and scaleZ attributes are 0 at frame 0 because time is 0. Any number multiplied by 0 is 0.
3
Play the animation. Using Maya: Hypergraph, Sets & Expressions
41
Quick Start Controlling attributes conditionally As time increases, the value of Balloon’s scale attributes increase. Because the expression sets scaleX and scaleZ to 50% of the value of time, these dimensions scale slower than scaleY, which is set to 60% of the value of time. Balloon scales faster in height than in width or depth. This is true for many real balloons.
4
Stop and rewind the animation. This concludes the example.
Summary Using an expression is a combination of logic and experimentation. Problem solving starts with breaking a task into smaller problems you can solve and later refine. In this lesson, you learned how to:
42
•
control an attribute conditionally with an if statement
•
use good spacing and indentation for expressions
•
use relational operators such as <, <=, and ==
•
use multiple if statements to control different conditions
•
use an if-else statement in place of multiple if statements to make an expression easier to read and comprehend
•
refine an expression with a combination of analysis and experimentation
Using Maya: Hypergraph, Sets & Expressions
Quick Start Notes on the predefined time variable In the preceding examples we didn’t include comments in expressions because we explained them line by line. When you write your own expressions, include comments with statements to help document how the expression works. This will help you or someone else understand how your expression works later if the need to enhance it arises. See “Comments in expressions” in Chapter 5.
Notes on the predefined time variable The lessons in this chapter use a starting frame number of 0. In your work, you’ll typically create an animation with a starting frame number of 1. Because the examples use Maya’s default frame rate of 24 frames per second, time is 0.0417 at frame 1. Because of this small offset from 0, the examples would have required more steps and instructions to work with frame 1 as the starting frame. For instance, in the first example of the chapter, suppose you set the starting frame of the animation to 1. The expression in the example follows: Ball.scaleY = time + 1;
This discrepancy means the Ball scaleY is larger than its scaleX and scaleZ attributes in the first frame of the animation. Though the difference is not substantial in this example, other cases might be more significant. To start your animation at frame 1 and get the same result as the example, you can subtract 0.0417 from the attribute: Ball.scaleY = (time - 0.0417) + 1;
When you rewind the animation, the expression sets Ball’s scaleY value to (0.0417 - 0.0417) + 1. This equals 1, its original scaleY value. When you use the predefined time variable, be aware of the starting frame number and the associated time value.
Using Maya: Hypergraph, Sets & Expressions
43
Expressions
If you rewind the animation, the expression executes and sets the initial value of Ball’s scaleY attribute to time + 1, which equals 0.0417 + 1, or 1.0417. Because Ball’s scaleY attribute was 1 when you created it, rewinding the animation sets scaleY to a value 0.0417 larger than its initial value.
Quick Start Notes on the predefined time variable After doing the lessons in this chapter, remember to change your Time Slider’s starting frame, ending frame, and frame rate to the desired values when you start other projects. To do this, select Options→General Preferences and display the appropriate tabs in the General Preferences window.
44
Using Maya: Hypergraph, Sets & Expressions
5
Expression Syntax Expressions use the syntax of the Maya Embedded Language (MEL). Though MEL is a scripting language, you’ll find the syntax easy to learn even if you’ve never programmed. Mastering the rules of syntax is essential to writing expressions without errors.
Tristan Ikuta
This chapter describes the following topics: •
“Expressions and MEL” on page 46
•
“Elements of an expression” on page 47
•
“Attributes” on page 49
•
“Variables” on page 56
•
“Constants” on page 62
•
“Arithmetic, logic, and relational operators” on page 63
•
“Operator precedence” on page 68
•
“Conditional statements” on page 69
•
“General syntax rules” on page 73
•
“Comments in expressions” on page 75 Using Maya: Hypergraph, Sets & Expressions
45
Expressions
You can use an expression to rotate each child joint based on the root joint’s keyframed rotation.
Expression Syntax Expressions and MEL •
“Programming features” on page 75
•
“Common expression errors” on page 95
Expressions and MEL Expressions have a different purpose from MEL commands and MEL scripts. You enter a MEL command to do a single action, for example, to create a sphere. A MEL script is a list of commands you create to do a sequence of actions, for instance, create a wall-shaped object and apply a brick texture to it. Because you store a MEL script in a file on disk, you can run a script in different scenes and different work sessions, whether today or next year. An expression animates one or more attributes over time in a single scene. By default, an expression executes each frame as an animation plays. After you create an expression, it executes whenever you play the animation— including when you play the animation after saving, closing, and reopening the scene. A MEL command or script is not part of a scene after you execute it. You must execute it again to repeat the action. Sometimes it’s useful to exectute MEL commands and scripts in expressions. See “Executing MEL commands in an expression” on page 137 for details. Action
Typical use
MEL command
Does one action
MEL script
Does several actions
Expression
Animates attribute values as an animation plays
The following pages describe expression syntax elements such as arithmetic operators you can use to set and compare attributes. If you have trouble understanding the syntax descriptions, refer to a C programming guide for beginners. Except for attribute names, the syntax elements have the same definitions as their counterparts in C. Attribute names do not exist in C. If you’re familiar with a programming language such as C, Pascal, or Basic, be sure to see “Programming features” on page 75.
46
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Elements of an expression
Elements of an expression An expression is made of one or more statements. Statements follow the rules of algebra, so they’ll seem familiar if you’ve studied math. Each statement has several elements as in the following example: Assignment operator Arithmetic operator Attribute name
Function Constant
Ball.rotateZ = sin(time) + 6;
Terminator
Statement Variable
Detailed explanations follow the summary definitions: Attribute name The name of the attribute set by the statement. In the
example, Ball.rotateZ is the attribute name of the rotateZ attribute of an object named Ball. Assignment operator
A special word that you provide with an entry called an argument. In this example, the argument is time. Based on the value of the argument, Maya does a calculation for the function and returns a new value or takes some other action. In the example, the function sin(time) returns the sine of the value of time, which evaluates to a number between -1 and 1. Maya has many convenient built-in functions and commands that do math calculations, conversions, and so on. See Chapter 9 for details.
Using Maya: Hypergraph, Sets & Expressions
47
Expressions
Function
The = to the right of an attribute name. This symbol assigns the attribute the result of the statement on the right side of =. In the example, Ball.rotateZ receives the value of the statement sin(time) + 6. (Ignore what this assignment does; it’s for illustration only.) You can also use = to assign a value to a variable.
Expression Syntax Elements of an expression A variable is a symbolic name that stands for a changing value. You can assign a value to a variable or read a variable’s value. The variable time is a predefined Maya variable that contains the animation time at the current frame. You can read but not set the value of time.
Variable
Arithmetic, logic, or relational operator An operation such as + or < (less than). Constant
An unchanging number, for example, 6.1 or 90.
Terminator
A semicolon (;) that marks the end of a statement. An expression can have an unlimited number of statements. You must end each statement with a semicolon.
Each expression usually has an attribute name, assignment operator (=), expression value assigned to the attribute, and a statement terminator (;). Other elements are optional.
Example Here’s an expression with the fewest elements possible: Value assigned
Ball.scaleY = 5;
The expression has an attribute, assignment operator (=), value assigned to the attribute, and a statement terminator (;). The expression sets Ball’s Y scale to 5 grid units. When you play the animation, Ball’s Y scale stays fixed at 5 regardless of the Y scale value you gave it when you created it.
48
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes
Attributes An attribute is a characteristic of an object or other item in a scene. There are many ways to set attributes in Maya—with the Attribute Editor, Channel Box, menu selections, and of course, expressions. You can set attributes to control virtually anything in your animation. There are three types of attributes you work with in Maya: •
static
•
dynamic
•
custom Static and dynamic attributes have a predefined purpose. They are standard attributes Maya provides for objects and items that make up a scene. Custom attributes are attributes you define for an object.
Static attributes Static attributes are attributes an object has by default. They exist the moment you create the object and throughout its lifetime.
Expressions
For example, the transform node of a NURBS sphere has static attributes scaleX, scaleY, scaleZ, rotateX, and so on. You can set the values of these attributes with the Attribute Editor, Channel Box, expressions, and other techniques after you create the object.
Dynamic attributes Dynamic attributes have predefined names and purposes, but Maya adds them to an object in response to your user interface selections. For example, suppose you create a particle object and display its particle shape folder in the Attribute Editor. If you click one of the following buttons in the Add Dynamic Attributes section of the Attribute Editor, Maya adds a dynamic attribute to the node:
Clicking the General button lets you add a custom attribute (see the next topic). Clicking any of the other buttons lets you add one or more dynamic attributes with names that are the same or similar to the button name. Using Maya: Hypergraph, Sets & Expressions
49
Expression Syntax Attributes An object has no dynamic attributes unless your actions cause Maya to add them to the object. By adding only required attributes, Maya runs faster. When you add a dynamic attribute to an object, the attribute appears in the Attribute editor for the selected object or node.
Note Because soft body geometry is a particle shape node coupled with geometry, a soft body has the same static and dynamic attributes as a particle object.
Custom attributes Custom attributes are attributes you optionally add from the New folder of the Add Attribute window.
50
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes Such attributes have no direct effect on any characteristic of an object. They’re often used to control a combination of other attributes. You might also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes. When you add a custom attribute to an object, it appears in the Attribute Editor and Channel Box for the object or node. Though custom attributes are dynamically added to an object, we refer to them as custom to distinguish them from the built-in dynamic attributes. See “Assigning to a custom attribute” in Chapter 8 for details on how to add and use a custom attribute.
Attribute names Static, dynamic, and custom attributes follow the same naming conventions and represent the same types of data. A full attribute name has this format: object.attribute where object is the name of the object node, and attribute is the name of the attribute. A period (.) separates the name of the object and attribute.
See “Using attribute names in expressions” in Chapter 6 for more details.
Example Ball.scaleY
Data types of attributes Each attribute has a data type that specifies the type of values you can use to control it in an expression. This is true for static, dynamic, and custom attributes.
Using Maya: Hypergraph, Sets & Expressions
51
Expressions
You must spell the object and attribute name with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. You cannot spell attribute names with the common English spellings shown in the Attribute Editor or by default in the Channel Box.
Expression Syntax Attributes Attributes you’ll work with in expressions have these data types: Data type
Meaning
Example attribute
Example data
float
floating point numbers
Balloon.scaleY
-2.3333333333
integer
signed whole numbers
Ball.sections
16
Boolean
on or off selection
Ball.visibility
on
The most common attribute data type is floating point. In mathematics, floating point numbers are also called real numbers. Often, such numbers have a decimal point. Booleans are also common data types in attributes. Integer data types are rarely used. Particle shape nodes have these additional attribute data types: Data type
Meaning
Example attribute
Example data
vector array
array of vectors
FireShape.position
<<3.2, 7.7, 9.1>> <<4.5, 9.2, 3.1>> <<3.8, 4.4, 2.1>>
float array
array of floating point numbers
FireShape.lifespan
1.333 1.666 2.333 1.333
Note Scientists often refer to a vector as a quantity that specifies both a magnitude and direction. In Maya, a vector is simply a related group of three floating point numbers that set an attribute or variable.
52
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes Vector array data types are useful for animating position, velocity, acceleration, color, and other particle attributes made of three components. Float array attributes are useful for setting lifespan, opacity, and other particle attributes that have a single number value. Attributes having a vector array or float array data type are also called per particle attributes. See Chapter 8 for details on working with particle attributes. If you have programming experience, note that for vector array data types, Maya represents the specified attribute for each particle of the object with a single element of an array. Each element is made of three floating point numbers. In a float array, Maya represents the specified attribute for each particle with a vector array element that’s a floating point number.
Note In expressions, you must type a vector in double angle brackets (<< >>). For example, type <<3,0,5>> for a vector having 3, 0, and 5 as its left, middle, and right component.
Data types of static and dynamic attributes
Using Maya: Hypergraph, Sets & Expressions
Expressions
Static and dynamic attributes have predefined data types. To learn the attribute’s data type, select the node containing it. In the Attribute Editor, find the attribute name and examine its data format.
53
Expression Syntax Attributes Here’s an example display of attributes with floating point, Boolean, and integer data types:
Floating point
Boolean Integer
A floating point attribute shows a value that includes a decimal point. Most numerical attributes in Maya are floating point. A Boolean attribute has a checkbox or other user interface item for turning it on or off. An integer attribute has no decimal point. Integer attributes are rare in Maya. The data type of an attribute limits what type of value you can enter for the attribute in the Attribute Editor and in expressions. For example, because a directional light’s Depth Map Filter Size attribute is an integer, you cannot enter a decimal point in its text entry box or assign it a decimal quantity in an expression. For a floating point attribute, you can omit the decimal point. The Attribute Editor automatically inserts a decimal point in the attribute’s text field after you press the Enter key. For example, if you type 3 for a floating point entry, the Attribute Editor replaces 3 with 3.0000.
54
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes An expression also automatically converts an integer to a floating point value when appropriate. See “Data type conversions” in Chapter 7 for details. Only particle objects, not geometric objects, have vector array and float array attributes. The static vector array attributes for particle objects are position, velocity, and acceleration. These are also called per particle attributes because you can set the attribute for each particle to different values. Maya has other attribute data types that are irrelevant to the use of expressions. For example, Maya has a matrix data type that is useful only in MEL scripting and API programming.
Data types of custom attributes When you add a custom attribute to an object with Modify→Add Attribute, you choose whether its data type is floating point, integer, Boolean, or vector. Vector attributes are commonly used with particle shape nodes.
Assigning a value to an attribute You assign a value to an attribute using the = assignment operator. Static and dynamic attributes have data types established by Maya. You do not define their data type.
You can assign a value to any attribute. If the attribute is dynamic or custom, though, you must add the attribute to the object before you can assign it a value in an expression. Become familiar with the purpose of an attribute by working with it in the Attribute Editor, Channel Box, or other parts of Maya before assigning it a value in an expression. It’s best to know the behavior you can expect from the attribute in case you write your expression incorrectly.
Note For rigid bodies, you can read but not write the velocity, angularVelocity, and force attributes.
Using Maya: Hypergraph, Sets & Expressions
55
Expressions
Because you choose the data type of custom attributes when you add them with Modify→Add Attribute, you do not define their data type either.
Expression Syntax Variables
Assigning to a float or integer attribute An assignment operation is a statement, so you must terminate it with a semicolon (;).
Examples Cone.scaleY = 5.3;
This assigns 5.3 to the floating point scaleY attribute of Cone. Ball.translateY = time;
This assigns the value of time to the floating point translateY attribute of Ball. Ball.scaleX = Ball.scaleY = Ball.scaleZ = 2;
This assigns 2 to the floating point scaleX, scaleY, and scaleZ attributes of Ball. As the example shows, you can use an assignment operator several times in a statement to set multiple attributes to the same value.
Assigning to a vector attribute You can assign values to all three components of a vector attribute, or just to a single component. See “Assigning to vectors and vector arrays” in Chapter 8 for details on assigning values to vector attributes. Only particle shape nodes have vector attributes. Note that you cannot assign a vector to three related scalar attributes such as scaleX, scaleY, and scaleZ. For example, you can’t do this: Ball.scale = <<1,2,0>>;
You must assign to each attribute separately: Ball.scaleX = 1; Ball.scaleY = 2; Ball.scaleZ = 0;
Variables A variable is a symbolic name that stands for a constant or changing value. There are two types of variables, predefined and custom. Maya creates and maintains predefined variables. Custom variables are variables you can create to store data in an expression.
56
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables Keep in mind that attributes, not variables, set object and component behavior in Maya. You can use variables to as temporary storage for working with the attributes.
Data types of variables Variables can be one of these types of data: Data type
Meaning
Examples
Defining keyword
float
floating point numbers
392.6, -0.667
float
integer
signed whole numbers
10, -5, 0
int
vector
vector made of three floating point numbers
<<3.2, 7.7, 9.1>>
vector
string
one or more characters
“What’s up, chief?”
string
The most common data type of variables is floating point. Integer data types are rarely used. Booleans are commonly used in attributes, but not allowed in variables. Vector variables are useful in expressions for particle shape attributes.
For a custom variable you create in an expression, you must declare the data type as described in “Custom variables” on page 59.
Predefined variables Maya maintains values in two predefined variables as an animation plays: Variable
Contents
Data type
frame
number of frames the animation has played
float
time
time in seconds the animation has played
float
Using Maya: Hypergraph, Sets & Expressions
57
Expressions
Animators with programming experience sometimes use string variables. Quote marks (" ") are required with strings. See “String usage” on page 90 for details.
Expression Syntax Variables Your expressions can read, but not set, the value of time and frame. These variables are floating point values that are useful for animating an attribute as an animation plays. The time updates as an animation plays. It contains the elapsed number of seconds from the first frame to the current frame. The value increases with the increasing frame number. At the default animation playback rate of 24 frames per second, time has these values, rounded to four decimal places: Frame
Time (seconds)
0
0
1
0.0417
2
0.0833
3
0.125
24
1.0
240
10.0
If you need to change the playback rate, choose Options→General Preferences. Expand the General Preferences window, display the Units folder, and choose the desired rate from the Time menu. Regardless of what animation playback rate you choose, you can find the time elapsed in the animation at any frame with this formula:
frame time = --------------rate For example, if the frame rate is 24 frames/second, and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.25. If the frame rate is 30 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 30, which equals 0.0333. At frame 6, elapsed time is 6 divided by 30, which equals 0.2.
58
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables There’s an advantage to writing an expression using the value of time rather than frame: You won’t need to modify your expression if you change your animation’s frame rate. Note that time is always 0 at frame 0. As each frame plays, the time increases in increments resulting from the frame rate. It’s impossible to set time to a value other than 0 at frame 0. If you set Maya’s frame range to begin at a negative number, time has a negative value.
Examples Ball.translateY = time/2;
This sets the Ball’s Y translation equal to the value of time divided by 2 as the animation plays. This make the Ball move in a Y direction as the animation time increases. Ball.scaleY = frame/2;
This sets the Ball’s Y scale equal to the value of frame divided by 2 as the animation plays. The Ball scales along its Y axis as the animation frame number increases.
Custom variables
Though programming languages use such variables abundantly, you might not need to use them at all in many expressions.
Declaring variables Each custom variable name must begin with a dollar sign character ($). After the $, you can use alphabetical, numerical, and underscore characters. You cannot include spaces in the names. Variable names are type case sensitive. In other words, $temp is a different variable name than $Temp.
Using Maya: Hypergraph, Sets & Expressions
59
Expressions
You can declare and use variables to store a constant or changing value. These work like their counterparts in programming languages and spreadsheet programs.
Expression Syntax Variables
Examples float $object_height;
This declares $object_height as a floating point variable. int $counter;
This declares $counter as an integer. vector $top_velocity;
This declares $top_position as a vector variable.
Assigning a value to an integer or float variable To assign a value to a variable, you use = as an assignment operator. An assignment operation is a statement, so you must end it with a semicolon (;).
Examples float $counter = 5.3;
This declares a floating point variable named $counter and gives it an initial value of 5.3. $height = 6;
This declares a floating point variable named $height and gives it an initial value of 6. This example shows you can skip declaring the variable’s data type. When you assign a variable a value, Maya assumes the variable is floating point unless you specify a different data type. $pi = 3.1415927; $twist = $pi;
These statements show you can assign the value of one variable to another variable. The first statement assigns 3.1415927 to $pi. The second statement assigns the contents of $pi, 3.1415927, to $twist.
60
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables
Important If you misspell an existing declared variable name and assign it a value, a syntax error won’t be generated for the undeclared variable. Because Maya automatically provides a data type for an undeclared variable if it’s on the left side of the assignment operator, the misspelled variable will be interpreted as a newly added variable. Undeclared variables on the right side of the assignment operator do generate error messages. Check spellings of variables if your expression isn’t working as expected. In the following example, the misspelling in the final statement generates an error but not the misspelling in the statement before it: int $start; int $end; int $interrupt; $starrrt = 1; $end = $interrupppt;
Assigning a value to a vector variable You can assign values to all three components of a vector variable, or just to a single component. Expressions
See “Assigning to vectors and vector arrays” in Chapter 8 for details on assigning values to vector variables. Such variables are useful for working with particle shape node attributes.
Using custom variables globally Typically, you’ll use variables within a single expression. If you want to create and maintain a custom variable in one expression, but use it in another expression, you must declare it as a global variable.
Example global float $counter;
You can thereafter set or read the value of this variable in any other expression in the scene. If you create a variable with the same name in two expressions, the two variables are separate and unrelated. For example, suppose you create a variable named $timer in two expressions. Assigning a value to one of the $timer variables has no effect on the other’s value. Using Maya: Hypergraph, Sets & Expressions
61
Expression Syntax Constants If you declare and initialize a global variable in a single statement, you can initialize it to a numerical constant or string only.
Examples global float $counter = 3;
This initializes $counter to 3. global float $counter = time;
This causes an error because time is a variable. If you declare and initialize a global variable in a single statement, the statement executes only when Maya compiles the expression. Maya compiles an expression when you click the Create or Edit button in the Expression Editor, or when you open a scene containing a previously created expression.
Example global float $counter = 3; print($counter+"\n"); $counter = 1000; print($counter+"\n");
When Maya compiles the expression, it sets $counter to 3, prints 3, sets $counter to 1000, then prints 1000. During playback, each execution of the expression skips the first statement, so $counter never receives the value 3. The expression prints 1000, sets $counter to 1000 again, and prints 1000 again.
Constants A constant is an unchanging number or variable.
Examples Ball.translateY = 6.1.
This statement sets Ball’s translateY attribute to the constant number 6.1. float $pi = 3.1415927; Ball.rotateY = $pi;
These statements set the value of Ball’s rotateY attribute to the value of the variable $pi. The variable $pi represents the constant 3.1415927.
62
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators
Arithmetic, logic, and relational operators You can use the following operator symbols to add, subtract, multiply, compare, and do other actions to variables and attributes.
Arithmetic operators Symbol
Meaning
Used with these data types
+
plus
integer, float, vector, string
-
minus or negation
integer, float, vector
*
for integers and floats: multiply for vectors: dot product
integer, float, vector
/
divided by
integer, float
%
remainder of division
integer, float
Integers and floats
Examples Car.translateX = time / 2.0;
This moves the Car in an X direction as the time increases in the animation. By dividing time by 2.0, you move the object half as fast as if you used time alone. Car.translateX = 7 % 3;
This assigns Car.translateX the value 1, the remainder of 7 divided by 3. The number 7 divided by 3 equals 2 with a remainder of 1. Car.translateX = 8.8 % 4.2;
This assigns Car.translateX the value 0.4, the remainder of 8.8 divided by 4.2. The number 8.8 divided by 4.2 equals 2 with a remainder of 0.4. Car.translateX = 0.5 % 3;
Using Maya: Hypergraph, Sets & Expressions
63
Expressions
For integer and floating point attributes and variables, the above arithmetic operators work according to the rules of basic math. Note that the modulus operator (%) calculates the remainder of division.
Expression Syntax Arithmetic, logic, and relational operators This assigns Car.translateX the value 0.5, the remainder of 0.5 divided by 3. The number 0.5 divided by 3 equals 0, with a remainder of 0.5.
Vectors For operations between vector attributes and variables, the * operator performs the dot product. The dot product multiplies corresponding components of each vector, then adds the components to create a single floating point number result. For + and - operators, each component of one vector is operated on by its counterpart component in the other vector. For operations between a vector and an integer or floating point number, each component of the vector is operated on by the integer or floating point number.
Examples Suppose you’ve initialized these vectors: vector $A = <<1,2,3>>; vector $B = <<2,3,4>>; vector $C; float $myfloat;
You then use the following statements (in different expressions, not in sequential order): $C = $A + $B;
This assigns $C the value << 3, 5, 7>>. $C = $B - $A;
This assigns $C the value <<1, 1, 1>>. $myfloat = $A * $B;
This assigns $myfloat the value (1*2) + (2*3) + (3*4), which equals 20. Multiplying two vectors gives the dot product of the vectors. $C = 3 * $A;
This assigns $C the value <<3, 6, 9>>. Each component of the vector is multiplied by 3 to create a vector result.
64
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators
Strings For details on how to use the + operator with strings, see “String usage” on page 90.
Note Maya handles integer and Boolean attributes in an expression mathematically as floating point numbers. After the expression executes, Maya converts the floating point number to the proper data type. If your expression does arithmetic on an integer or Boolean attribute and you display the attribute’s contents in the Script Editor, you’ll see floating point values. After the expression executes, Maya assigns an appropriate integer or Boolean value to the attributes you set in the expression text field. Maya handles integer and Boolean variables within an expression mathematically as integer and Boolean data types.
Relational operators You’ll often use relational operators to compare the value of variables and attributes in conditional statements. See “Conditional statements” on page 69. Meaning
Used with these data types
<
less than
integer, float, vector
>
greater than
integer, float, vector
==
equal to
integer, float, vector
!=
not equal to
integer, float, vector
>=
greater than or equal to
integer, float, vector
<=
less than or equal to
integer, float, vector
Expressions
Symbol
Integers and floats For integer and floating point attributes and variables, the above relational operators work according to the rules of algebra.
Using Maya: Hypergraph, Sets & Expressions
65
Expression Syntax Arithmetic, logic, and relational operators
Examples if (time > 10) Sphere.translateX = 3;
When the animation time is greater than 10 seconds of play, the expression sets the Sphere’s translateX attribute to 3. It stays fixed in this position thereafter. See “Conditional statements” on page 69 for details on the if condition in this and following examples. if (Ball.scaleY == 3) Cone.scaleY = 6;
If Ball’s scaleY attribute is equal to 3, Maya sets Cone’s scaleY attribute to 6.
Important Be careful to type == rather than = for the equal to operator. For example, suppose you type if (Ball.scaleY = 3) in the previous example. Rather than test whether Ball.scaleY is equal to 3, the statement assigns 3 to Ball.scaleY. Maya evaluates the assignment statement Ball.scaleY = 3 as a true condition, so it executes Cone.scaleY = 6. This statement doesn’t cause an error message, but it gives unintended results.
Vectors If you use the == or != operators between two vector attributes or variables, Maya compares the corresponding components of each vector. In contrast, the >, >=, <, and <= operators compare the magnitude of two vectors. Use this formula to calculate a vector’s magnitude: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components of the vector.
Examples vector $A = <<1,2,3>>; vector $B = <<1,2,3>>; if ($A == $B) Sphere.translateX = 3;
66
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators This expression sets Sphere’s translateX attribute to 3, because vector $A is equal to $B. $A’s left component, 1, is compared to $B’s left component, also 1. $A’s 2 is compared to $B’s 2, and $A’s 3 is compared $B’s 3. vector $A = <<0,4,0>>; vector $B = <<1,0,0>>; if ($A > $B) Sphere.translateX = 3;
This expression sets Sphere’s translateX attribute to 3, because the magnitude of vector $A is greater than vector $B. The magnitude of $A is: 2
2
2
0 +4 +0 =
2
4 = 4
The magnitude of $B is: 2
2
2
1 +0 +0 =
2
1 = 1
Logical operators
Symbol
Meaning
||
or
&&
and
Expressions
You use logical operators with the relational operators described in the previous topic. Logical operators are often part of conditional statements. See “Conditional statements” on page 69.
Example 1 if ((time > 5) && (time < 10)) Ball.scaleZ = time;
This sets Ball’s scaleZ attribute to the value of time only when the animation time is greater than 5 and less than 10 seconds.
Using Maya: Hypergraph, Sets & Expressions
67
Expression Syntax Operator precedence Notice that each condition is grouped in parentheses, and the pair of conditions are enclosed again in parentheses. If you use multiple conditions with logical operators, you must enclose all the conditions in parentheses for the if statement. If you omit the outer pair of parentheses as in the following example, an error message occurs: if (time > 5) && (time < 10) Ball.scaleZ = time;
Example 2 if ((Ball.translateX < 5) || (Ball.translateY > 10)) Ball.scaleZ = time;
This sets Ball’s scaleZ attribute to the value of time in either of two conditions: when Ball’s translateX attribute is less than 5 or greater than 10.
Operator precedence The precedence of operators in expressions follows: Highest
() [] ! ++ - * / % ^
+
Lowest
-
< <= > >= == != && || = += -= *= /=
This figure includes operators used mainly by individuals experienced in programming. See “Programming features” on page 75 for details. In the figure, operators on the same row have equal precedence. If a statement has two or more operators from the same row, the operator furthest to the left is evaluated first. The parentheses at the top of the figure are for grouping a condition or elements of a statement. As shown in a following example, parentheses are useful for altering the order of operator evaluation.
68
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Conditional statements
Examples Ball.scaleY = 8 + 2 * 4;
This assigns Ball.scaleY the value 16. Ball.scaleY = (8 + 2) * 4;
This assigns Ball.scaleY the value 40. Ball.scaleY = 8 + 6 - 4;
This assigns Ball.scaleY the value 10. The + executes first because it’s further to the left in the statement than the -.
Conditional statements Conditional statements set one attribute or variable based on the condition of another attribute or variable. For example, you might increase the scale of a balloon after frame 48 plays. The if and if-else statements are the most commonly used conditional statements in expressions. You’ll often use relational and logical operators in conditional statements. See page 65 and page 67 for details. Expressions
If you have programming experience, be aware you can use loop and flow control statements such as while and for. See “Programming features” on page 75.
if statements The if conditional statement has this format: if ( condition ) statement;
If condition is true, statement executes.
Example if (time > 3) Ball.scaleY = 2;
This sets the scale of Ball’s scaleY attribute to 2 after the animation plays three seconds.
Using Maya: Hypergraph, Sets & Expressions
69
Expression Syntax Conditional statements
if-else statements The if-else conditional statement has the following format: if ( condition ) statement1; else statement2;
If condition is true, statement1 executes. Otherwise statement2 executes.
Example 1: Simple if-else statement if (time > 3) Ball.scaleY = 2; else Ball.scaleY = 1;
This sets Ball’s scaleY attribute to 2 if animation time is greater than 3 seconds. If animation time is less than 3, scaleY is set to 1. You can use more than one statement after a condition with this format: if ( condition ) { statement; statement; } else { statement; statement; }
Notice you must enclose the multiple statements between braces ({ }).
Example 2: Braces in if-else statement if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else { Balloon.translateY = time - 2; Balloon.scaleY = 1; }
70
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Conditional statements If the animation time is less than 2 seconds, the expression sets Balloon’s translateY attribute to 0, and sets its scaleY attribute to the value of time multiplied by 0.6. If animation time is greater than or equal to 2 seconds, the expression sets Balloon’s translateY attribute to time minus 2, and sets its scaleY attribute to 1.
Important You cannot set the same attribute in two different expressions. If you try to do so, an error message results and your second expression has no effect.
else if statements The else if statement works with the if-else conditional statement and has this format: if (condition1 ) statement1; else if ( condition2 ) statement2;
If condition1 is true, statement1 executes and the else if statement after it is skipped.
You can add an else condition to the previous format as follows: if (condition1 ) statement1; else if ( condition2 ) statement2; else statement3;
If neither condition is true, statement3 executes.
Using Maya: Hypergraph, Sets & Expressions
71
Expressions
If condition1 is false, the else if statement executes. If condition2 is true, statement2 executes. If neither condition is true, neither statement executes.
Expression Syntax Conditional statements
Example if (time < 3) Ball.scaleY = else if ((time >= 3) Ball.scaleY = else Ball.scaleY =
1; && (time =< 6)) 2; 3;
This sets Ball’s scaleY attribute to 1 if animation time is less than 3 seconds. If animation time is between 3 and 6 seconds, scaleY is 2. Otherwise, when time is greater than 6 seconds, scaleY is 3. Note that you can add multiple else if statements and multiple statements within braces ({ }) using this format: if (condition1 ) { statement; statement; } else if ( condition2 ) { statement; statement; } else if ( condition3 ) { statement; statement; } else if ( condition4 ) { statement; statement; } else { statement; statement; }
72
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax General syntax rules
General syntax rules Use these guidelines to avoid syntax errors while writing expressions: •
Terminate each statement in an expression with a semicolon (;). Here’s an example expression with two statements: if (time < 3) nurbsSphere1.translateX = time/2; else nurbsSphere1.translateX = time*3;
A semicolon marks the end of each statement. •
Enclose each conditional item in an expression within parentheses. In the preceding example, (time < 3) is a conditional item enclosed in parentheses.
•
Match each opening parenthesis with a closing parenthesis. For example, this statement causes an error: Ball.rotateZ = deg_to_rad(-6 * (floor(time));
If you look closely, you’ll see that there are three opening parentheses, but only two closing parentheses. The next statement causes no error: Ball.rotateZ = deg_to_rad(-6 * (floor(time)));
•
Expressions
There are three matching closing parentheses for the three opening parentheses. When you use { and } as opening and closing braces, make sure you use them in matching pairs: if (time > 3) { Ball.rotateZ = deg_to_rad(-6 * (floor(time)); Ball.rotateY = Ball.rotateZ * 3; }
•
Enclose a vector in double angle brackets as in this example: <<3,4,8>>
Spaces before and after the numbers and commas are optional. •
Begin any variable you use with a dollar sign ($), and do not to use spaces or special characters other than underscores in the name. Here’s an acceptable example: float $my_Rotate; $my_Rotate = 3.14;
Using Maya: Hypergraph, Sets & Expressions
73
Expression Syntax General syntax rules •
In conditional statements, be careful to type == rather than = for the equal to operator. The = symbol means assign the value. For example, make sure you type: if (Ball.scaleY == 3) Cone.scaleY = 6;
instead of this: if (Ball.scaleY = 3) Cone.scaleY = 6;
•
You can use as many spaces, tab characters, and blank lines as you like when separating words, operators, or statements. Maya ignores white space in an expression. For example, suppose you’ve written this expression: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2;
Though the following expression has different spacing and is unpleasant to read, Maya interprets the expression the same as the previous one. if(time<2){Balloon.translateY=0; Balloon.scaleY=time*0.6;} else Balloon.translateY=time-2;
You must include at least one space between any two keywords, variables, or attribute names (or combination of these). So a space is required after the else keyword but in no other place in this expression. To simplify spacing considerations, remember to put at least one space before and after a keyword, variable, operator, attribute, assignment operator, and so on. Consistent use of white space makes expressions easier to read. Examples throughout this chapter show examples of good spacing style.
74
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Comments in expressions
Comments in expressions Add comments to your expressions to explain the purpose of each statement within. You’ll appreciate this later if you need to modify the expression. Maya ignores comments.
To add a comment to the right of a one-line statement: Enter two forward slashes (//) at the end of the statement, then enter the comment: Ball.translateX = time; // Moves ball in X dir. with time
To write a multi-line comment: Enter two forward slashes (//) before the comment: // This is an example of a // comment spanning two lines.
Programming features Expressions
The following topics describe programming features available in expressions. Discussion is brief and assumes you’re familiar with programming. Most of the syntax features described work like their C counterparts.
Notes for C programmers Some important differences between expression and C syntax follow: •
A C program consists of one or more functions, each containing multiple statements. An expression is simply a single block of statements. You don’t declare main( ) or your own functions in an expression. You also don’t include the C standard library of functions. You will, though, sometimes include a built-in Maya function such as sin( ) to accomplish time-saving tasks. See Chapter 9, “Functions,” for details.
•
After you type an expression in the Expression Editor, clicking the Create or Edit button compiles the expression.
•
The first character of variables must be a dollar sign ($).
•
ANSI C has 32 keywords. The expression language has less, as listed in the following topic. Using Maya: Hypergraph, Sets & Expressions
75
Expression Syntax Programming features •
Maya’s integer data type has the same numerical range as ANSI C’s integer data type, -2,147,483,648 to 2,147,483,648.
•
Maya’s float data type has the same numerical range as ANSI C’s double data type.
Expression language keywords The expression language keywords follow:
Data type keywords int
float
vector
string
matrix
on
off
true
false
in
Boolean constant keywords yes
no
Flow control keywords if
else
for
while
do
break
continue
default
switch
case
source
catch
alias
Other keywords global
return
proc
The return, proc, and matrix keywords are useful for writing MEL scripts, not for expressions. Other keywords above are described throughout this chapter. Type keywords in lowercase letters exactly as shown. Do not name a custom attribute with any of these keywords.
76
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Flow control statements Besides the if and if-else statements described previously, you can control the flow of statement execution with while, do, for, break, continue, and ?: instructions. These work like their C language counterparts. You’ll often use logical and relational operators in conditional statements. See page 65 and page 67 for details.
Important Using a while, do, or for loop incorrectly might halt Maya. See “Flow control errors” on page 88 for details.
while A while loop has this format: while ( condition ) { statement; statement; ... }
Example float $test = 0; while ($test < 5) { print("$test equals: " +$test+"\n"); $test = $test + 1; }
Using Maya: Hypergraph, Sets & Expressions
77
Expressions
Use condition to compare variable, attribute, or constant values. If condition is true, Maya executes each statement between braces. Maya then evaluates condition again. If true, it executes each statement again. This cycle continues until condition is false, whereupon execution resumes with the statement after the loop.
Expression Syntax Programming features This expression displays the following lines in the Script Editor: $test $test $test $test $test
equals: equals: equals: equals: equals:
0 1 2 3 4
These lines are followed by a status message similar to this: expression -e -s "" -o Ball -an 1 Expr
This message indicates that a MEL command executed when you clicked the Create or Edit button in the Expression Editor. Specifically, an expression command executed. This is unrelated to the exact statements in the expression.
do A do loop has this format: do
{ statement; statement; ... }
while (condition);
Here Maya executes each statement between braces, then evaluates condition. The condition compares variable, attribute, or constant values. If condition is true, each statement executes again. The loop terminates when condition is false. In contrast to a while loop, a do loop executes the statements in the loop at least once. It tests the termination condition after the loop. A while loop tests the termination condition before executing the statements in the loop.
Example float $test = 0; do
{ print("$test equals: " +$test+"\n"); $test = $test + 1; } while ($test < 5);
78
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features This expression displays the following lines in the Script Editor: $test $test $test $test $test
equals: equals: equals: equals: equals:
0 1 2 3 4
for A for loop has this format: for (initialization; condition; change of condition) { statement; statement; ... }
A for loop evaluates the termination condition before executing each statement. The condition compares variable, attribute, or constant values.
Example float $i;
Expressions
for ($i = 0; $i < 5; $i = $i + 1) { print("$i equals: " +$i+"\n"); }
This expression displays the following lines in the Script Editor: $i $i $i $i $i
equals: equals: equals: equals: equals:
0 1 2 3 4
break The break instruction exits a loop from any point within its body, bypassing the normal termination at the loop’s beginning or end. Expression execution resumes at the next statement after the loop. You can use a break instruction with a while, do, or for loop.
Using Maya: Hypergraph, Sets & Expressions
79
Expression Syntax Programming features
Example float $f = 0; while( $f < 10 ) { print("$f equals: "+$f+"\n"); if ( $f > 5 ) break; $f = $f + 1; }
This expression displays the following lines in the Script Editor: $f $f $f $f $f $f $f
equals: equals: equals: equals: equals: equals: equals:
0 1 2 3 4 5 6
Suppose the example didn’t have this statement: if ($f > 5) break;
The loop would execute ten times and display the numbers 0 through 9. The break statement terminates the loop after $f is greater than 5. So the expression displays only numbers 0 through 6.
continue The continue instruction works inside loops. It forces the next iteration of the loop to occur, skipping any statements between itself and the loop’s test condition. The condition compares variable, attribute, or constant values.
80
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example float $f = 0; for( $f = 0; $f < 10; $f = $f + 1) { print("$f equals: "+$f+"\n"); if( $f > 5 ) continue; print(" got here.\n"); }
This expression displays the following lines in the Script Editor: 0 here. 1 here. 2 here. 3 here. 4 here. 5 here. 6 7 8 9
Expressions
$f equals: got $f equals: got $f equals: got $f equals: got $f equals: got $f equals: got $f equals: $f equals: $f equals: $f equals:
Suppose the example didn’t have this statement: if( $f > 5 ) continue;
The loop would display got here after each line of $f equals: n. Maya ignores the continue instruction until $f increases to a value greater than 5. When $f becomes 6 or greater, the continue instruction executes and skips the remaining statement in the loop, so got here isn’t printed.
for-in The for-in loop is a specialized for loop that simplifies manipulation of all elements of an array. A for-in loop with an array element variable lets you omit the initialization, condition, and change of condition components of a for loop. Using Maya: Hypergraph, Sets & Expressions
81
Expression Syntax Programming features The for-in loop has this format: for (array-element in array) { statement; statement; ... }
Example string $carType[3] = {"Porsche", "Ferrari", "Fiesta"}; string $car; for ($car in $carType) { print("I want a new "); print($car + ".\n"); }
The expression displays this in the Script Editor: I want a new Porsche. I want a new Ferrari. I want a new Fiesta.
The loop executes three times, once for each array element in $carType. The first loop execution copies array element $carType[0] into $car, then prints, “I want a new Porsche.” Array element $carType[0] is Porsche. The second loop execution copies $carType[1] into $car, then prints the second line shown. The third execution copies $carType[2] into $car, then prints the third line shown. When the for-in statement finishes reading all array elements, the loop terminates.
82
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
switch A switch instruction executes one of several groups of statements based on a control value. The control value can be a variable value or an attribute other than an array (per particle) attribute. The format follows:
The switch executes with a variable control-value. If the variable contents match value1, value2, or another value in the switch, the statements under the associated case statement execute. The control-value can be an int, float, string, or vector. Be careful if you use a float control-value. Because of the way floating point arithmetic rounds numerals, a case value might fail to match a control-value as you expect. A break statement within a switch causes execution to skip subsequent case statement groups within the switch instruction.
Using Maya: Hypergraph, Sets & Expressions
83
Expressions
switch (control-value) { case value1: statement; statement; ... break; case value2: statement; statement; ... break; case value3: statement; statement; ... break; ... default: statement; statement; ... break; }
Expression Syntax Programming features
Example 1: Break statement within a switch int $sway = rand(3); switch ($sway) { case 0: print("Case 0\n"); // Executes if $sway = 0 break; case 1: print("Case 1\n"); // Executes if $sway = 1 break; case 2: while (rand(10) < 7)// These statements print("I say!\n");// execute only print("Case 2\n");// if $sway = 2 break; }
When the expression executes a few times, it might display this random selection of entries in the Script Editor: Case 0 Case 1 I say! I say! I say! Case 2 Case 0 Case 1
The last case instruction in a switch doesn’t need a break statement because the switch is finished. Still, it’s best to add the break statement to avoid future problems that might result from adding other cases to the switch. For details on the purpose of rand(3), see “rand” on page 243.
84
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example 2: Omitted break statement within a switch The following expression omits a break statement to make the switch continue execution after the first case: int $argo = rand(2); switch ($argo) { case 0: print("Food\n"); // Runs if $argo is 0. case 1: print("Fight\n");// Runs if $argo is 0 or 1. break; }
When the expression executes a few times, it might display this random selection of entries in the Script Editor: Fight Fight Fight Food Fight Food
Whenever Food appears, Fight also appears after it. Fight can appear without Food being displayed.
int $argo = rand(4); switch ($argo) { case 0: case 1: print("Food\n"); // Runs if $argo is 0 or 1 case 2: case 3: print("Fight\n");// Runs if $argo is 2 or 3 break; }
This works like the preceding expression, except that a match of 0 or 1 displays Food and Fight, and a match of 2 or 3 displays Fight.
Using Maya: Hypergraph, Sets & Expressions
85
Expressions
Note that you can make more than one case statement execute the same statements:
Expression Syntax Programming features
Example You can use the default keyword to make a block of statements execute when none of the case values match the control value label. Generally, you put this label after all the case statements, though you can put it anywhere in the switch statement. If the switch has no default label and none of the case values match the control value, the switch does nothing. vector $mgb = <<1,1,0>>; switch ($mgb) { case <<0,1,1>>: print("Who?\n");// Runs if $mgb is <<0,1,1>> break; case <<1,0,1>>: print("What?\n");//Runs if $mgb is <<1,0,1>> break; default: print("Why?\n"); // Executes if $mgb is not break; // <<0,1,1>> or <<1,0,1>> }
The expression executes the default case, which displays the following line in the Script Editor: Why?
?: operator The ?: operator lets you write a shorthand if-else statement to set an attribute or variable in one statement. Because of its cryptic appearance, many programming style experts suggest not using it. Here’s its format: attribute = condition? statement1: statement2;
The condition compares variable, attribute, or constant values. If condition is true, Maya evaluates statement1 and assigns its value to attribute. (You can also assign the statement’s value to a variable.) Maya evaluates either statement1 or statement2, never both. You can optionally enclose statement1 and statement2 in parentheses to make the expression easier to read.
86
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example Balloon.scaleY = (time < 2) ? time / 2: time * 2;
This statement sets Balloon’s scaleY attribute to time divided by 2 if time is less than 2, and time multiplied by 2 if time is greater than or equal to 2. This causes the scaleY attribute to increase slower for the first two seconds than after two seconds. This is the same as the following if-else statement: if (time < 2) Balloon.scaleY = time / 2; else Balloon.scaleY = time * 2;
Use this format because it’s easier to read.
Important If you use an integer value as statement1 and a floating point value as statement2, the ?: operator truncates the floating point value of statement2 to an integer. In the expression Balloon.scaleY = (time < 2) ? 0: time;, for example, 0 is an integer, and time is a floating point value. When time is 2 seconds or more, Maya sets Balloon’s scaleY attribute to the integer value of time.
If you have problems using the ?: operator, use an if-else statement instead.
! operator You can use the not logical operator (!) with integer, float, and vector data types. For vector values, ! is true only when the vector magnitude is 0. A vector’s magnitude is the value resulting from this equation: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components of the vector.
Using Maya: Hypergraph, Sets & Expressions
87
Expressions
Because Maya sets scaleY to the integer value of time (without the decimal part), scaleY jumps in one-second increments at time 2, 3, 4, and so on.
Expression Syntax Programming features
Examples if (!$count) Ball.scaleY = 2;
The !$count condition is true only if $count is 0. If true, Ball.scaleY is set to 2. vector $myvector = <<0,0,0>>; if (!$myvector) Ball.scaleY = 2;
Because the magnitude of $myvector is 0, the !$myvector condition is true and Ball.scaleY is set to 2.
Flow control errors The following topics describe solutions to common mistakes in expression flow control statements.
Modifying variable values in test conditions If you use a while, do, or for loop in an expression, remember to change the variable or attribute being tested in the test condition of the loop. Failing to do so can halt Maya operation.
Example 1 Suppose you create an object named Balloon and decide to use a while loop to increase its Y scaling after three seconds of animation play. while (time > 3) Balloon.scaleY = time;
Though you might think this expression sets Balloon’s scaleY attribute to the increasing value of time after the animation time exceeds 3 seconds, it actually halts Maya operation as soon as time exceeds 3. At that moment, the while condition is true, so the while loop statement Balloon.scaleY = time executes repeatedly and endlessly. Even though a statement sets an attribute within an expression, Maya updates the attribute only after the expression finishes executing. Because the expression never finishes executing, Maya halts. Unless you change Balloon.scaleY within the while loop to a value less than or equal to 3, the statement executes infinitely.
88
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features To get the desired result without halting Maya, use this expression: if (time > 3) Balloon.scaleY = time;
Example 2 Suppose you create objects named Cone and Ball, then use a while statement to link the Ball’s translateY attribute to the Cone’s translateY attribute: while (Cone.translateY > 0) Ball.translateY = Cone.translateY;
At first glance, the expression seems to set Ball’s translateY position to the value of the Cone’s translateY position whenever Cone’s translateY is greater than 0. In fact, the expression halts Maya as soon as you translate the Cone to a Y position greater than 0. At that moment, the while condition is true, so the while loop statement Ball.translateY = Cone.translateY executes endlessly. Nothing you do in the user interface can change the Cone’s translateY position. It stays at translateY value of 0. Unless you change Cone.translateY within the while loop to a value less than or equal to 0, the statement executes infinitely.
if (Cone.translateY > 0) Ball.translateY = Cone.translateY;
Comparing floating point values to 0 with == If you use the == operator to compare a floating point variable or attribute to 0, your expression might not work correctly. This typically occurs when you assume the value returned by a built-in function such as cosd will be exactly 0.
Example float $x = cosd(90); if ($x == 0) print("This equals 0.\n"); else print("This doesn’t equal 0.\n");
Using Maya: Hypergraph, Sets & Expressions
89
Expressions
To get the desired result without halting Maya, use this expression:
Expression Syntax Programming features The expression displays the following text: This doesn’t equal 0.
Though the cosine of 90 degrees is mathematically 0, the cosd(90) function returns the value 6.123e-17, which is extremely close to 0 but not exactly equal. Though the number for practical purposes is the same as 0, it’s stored in the computer as a fractional quantity above 0 because of the way computers handle floating point numbers. To fix the problem, compare the values as in this expression: float $x = cosd(90); if (($x > -0.0001) && ($x < 0.0001)) print("This equals 0.\n"); else print("This doesn’t equal 0.\n");
The expression displays the following text: This equals 0.
By checking that $x is between -0.0001 and 0.0001, the appropriate print statement executes. The value returned by cosd(90) is so close to 0 that it’s within the small range specified in the if statement’s numerical comparison.
String usage A string is a sequence of alphabetical, numerical, and special characters. You can display strings in the Script Editor, for example, to check the contents of attributes or variables. You can also create strings in the Expression Editor to execute MEL commands in an expression. See Chapter 7 for details. Guidelines for using strings follow: •
Enclose a literal string with double quotes as in this example: print("asteroid2");
This displays the following text: asteroid2
•
You can use the + operator to concatenate strings as in this example: print("Ball’s scaleY attribute equals: " + Ball.scaleY);
90
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features This displays the following text: Ball’s scaleY attribute equals: 0.3333333333
•
The following table lists how Maya converts data types if you use arithmetic operators with strings in an expression. Arithmetic operation
Resulting data type
string operator integer
string
string operator float
string
string operator vector
string
For example, suppose you type the following statement: print("Hi there, "+007);
This displays the following text: Hi there, 007
•
If you’re familiar with C programming, be aware you can assign a string to a vector as in these examples: vector $i = (vector) "<<1,2,3>>";
Expressions
vector $i = vector ("<<1,2,3>>");
•
You can execute a MEL command in an expression statement. See “Executing MEL commands in an expression” in Chapter 7.
Shortcut assignment operators You can use shorthand assignment operators to save typing time compared to their longhand counterparts. In place of a statement like this: $height = $height + 3;
You can use this statement: $height += 3;
Using Maya: Hypergraph, Sets & Expressions
91
Expression Syntax Programming features The following table shows the shorthand operators and the valid data types for each. The shorthand operators work like their counterparts in C. Symbol
Data type
+=
integer, float, vector, string
-=
integer, float, vector
/=
integer, float, vector
*=
integer, float, vector
%=
integer, float
Do not insert a space between the operator and =.
Example $counter += 1;
This adds 1 to $counter each time the statement executes.
Shortcut increment and decrement operators You can use the ++ and -- shortcut increment and decrement operators to increase or decrease floating point and integer variables by 1. The following table shows the shortcut syntax and its equivalent expanded syntax: Shortcut syntax
Expanded syntax
++variable;
variable = variable + 1;
--variable;
variable = variable - 1;
variable++;
variable = variable + 1;
variable--;
variable = variable - 1;
When the increment or decrement operator precedes the variable, the increment or decrement occurs before the statement executes. When the operator follows the variable, the increment or decrement occurs after the statement executes.
92
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Examples float float $crab $crab $crab
$eel = 32.3; $crab = $eel++; = $eel--; = --$eel; = ++$eel;
// // // //
$crab $crab $crab $crab
= = = =
32.3; 33.3; 31.3; 32.3;
$eel $eel $eel $eel
= = = =
33.3; 32.3; 31.3; 32.3;
Important To avoid unexpected results, do not use more than one shortcut increment or decrement operator on the same variable in the same statement. The evaluation order of the operators is unpredictable.
Arrays You can create arrays of float, vector, integer, or string values. You can clear an array using a clear function. You can find the size of an array with the size function. See “Array functions” in Chapter 9 for details.
Expressions
When you assign a value in an array, Maya reserves memory for all elements less than that number. This means you can exceed the capacity of your computer with a single array declaration. For example, do not use a statement like this: $newarray[12312323123] = 1;
Examples: Defining an array float $myarray[]; vector $myposition[]; int $p[];
Note that an array expands its size automatically as you assign values to its elements. You don’t need to declare its size. If your array assignment exceeds the size of the array, the array expands to that size. If you reference an element of the array beyond the array size, a 0 is returned. Suppose you include these statements in an expression: int $p []; $p[1500] = 3; $p[2000] = 5;
Using Maya: Hypergraph, Sets & Expressions
93
Expression Syntax Programming features The second statement makes the array contain 1501 elements and assigns element 1500 the value 3. The third statement expands the array to 2001 elements and assigns element 2000 the value 5.
Example: Initializing and printing an array’s contents float $fa[]; print("$fa size: "+size($fa)+"\n"); for( $i = 0; $i < 10; $i = $i + 1) { $fa[$i] = $i; print($fa[$i]+"\n"); } print("fa size: "+size($fa)+"\n");
This expression displays the following: $fa size: 0 0 1 2 3 4 5 6 7 8 9 $fa size: 10
The first statement creates an array of floating point variables named $fa[ ]. The next statement displays the size of the array, which has 0 elements after its definition. The for loop executes the statements between the braces 10 times, once for each increment of $i from 0 to 9. The first statement between the braces ({ }) initializes and sets the value of one element of the array. Array element $fa[0] is set to floating point value 0, element $fa[1] is set to 1, element $fa[2] is set to 2, and so on. The print statement between the braces displays the value of each element of the array after you initialize it. In other words, the Script Editor displays 0 through 9.
94
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Common expression errors The for loop stops executing after $i becomes equal to 10. Then the final print statement displays the number of elements of the initialized array, 10. The array increased in size as you assigned values to its elements.
Boolean symbolic constants You can use the symbolic constants on, true, or yes for the Boolean numeric value 1. You can use off, false, or no to represent 0. Be aware that on, true, and yes are equal only to 1. They aren’t equal to nonzero values.
Example if (Monster.visibility == on) Lance.scaleY = time / 3;
This causes Lance’s scaleY attribute to increase only if Monster’s visibility attribute is on. The on represents 1. print(3 + on);
This displays 4 in the Script Editor. Again, on represents the value 1.
Common expression errors
Logic errors are mistakes in your reasoning that cause unexpected animation results. The syntax of your expression is valid, but errors in your logic prevent Maya from doing what you intended. In the worst cases, Maya might halt operation because your statements lock it into a permanent loop. Because Maya can’t detect logic errors, it can’t display error messages. As such, these errors are harder to find and require more analysis to solve. To resolve logic errors, it’s often helpful to display the contents of relevant attributes and variables. See “Displaying attribute and variable contents” in Chapter 7.
Error message format A syntax error displays one or more messages in the Script Editor.
Using Maya: Hypergraph, Sets & Expressions
95
Expressions
There are two types of errors you can make when writing expressions: syntax errors and logic errors. Syntax errors include mistakes in spelling, incomplete attribute names, omitted semicolons, and other oversights that prevent the expression from compiling and executing. For syntax errors, Maya explains the error in a message to the Script Editor.
Expression Syntax Common expression errors
You’ll often need to scroll or increase the size of the Script Editor to see an entire message. When the Script Editor displays a syntax error, the response area of the Command Line displays the same error with a red background.
Command line’s response area turns red if error occurs
If an expression executes a valid statement after the erring statement, the error message with the red background flashes briefly. You won’t notice it unless you’re looking directly at it and have quick eyes. The best way to know when an error has occurred is to look for a new message prefixed by // Error: in the Script Editor.
96
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Common expression errors Before clicking the Create or Edit button to create an expression, you might want to select Edit→Clear History in the Script Editor to remove previous messages in the window. This makes it easier to see when a new error message appears.
Common error messages Here are some common syntax errors and their explanations: Attribute not found or variable missing '$': Ball.goof.
You misspelled an attribute name, the attribute doesn’t exist in the scene, or you forgot to prefix a variable name with $. Attribute of a particle object can only be used with dynExpression command: particleShape1.position
You used a particle array attribute in the expression, but a particle shape node is not the Selected Object in the Expression Editor. A particle shape node must be selected to use particle array attributes. A particle array attribute is also called a per particle attribute. Attribute already controlled by an expression, keyframe, or other connection: Balloon.tx.
•
set driven key
•
constraint
•
motion path
•
another expression
•
any other direct connection More than one attribute name matches. Must use unique path name: Ball.tx.
You used an object.attribute name that exists in two or more parent objects. Two objects in a scene can have the same object name if they have different parent objects. For example, a scene might have a child of GroupA named Ball.tx and a different child of GroupB named Ball.tx. If you write a statement such as “Ball.tx = time;”, Maya won’t know which Ball.tx to set.
Using Maya: Hypergraph, Sets & Expressions
97
Expressions
You tried to set the value of an attribute that has already been set by one of these techniques:
Expression Syntax Common expression errors To eliminate the error in this example, you must enter the full pathname of the attribute as GroupA|Ball.tx. The pipe symbol (|) specifies that the object to its left is the parent of the object on the right. Cannot set 'time' or 'frame'
You can read the value of the predefined time and frame variables, but you cannot set them. Attributes must be of float, integer, or boolean types: Ball.worldMatrix
You tried to set or read the value of an attribute that was a string or matrix type. For instance, you might have tried to use an attribute named translate rather than translateX, translateY, or translateZ attribute. In the error message above, worldMatrix is an attribute that exists for transforms, but you can’t use it. It’s for Maya’s internal use. Cannot divide by zero
You tried to divide by an attribute or variable that equals 0. This typically happens in an expression statement that divides by an object’s translateX, translateY, or translateZ attribute when the Snap to grids button is on and you drag the object to past the X-, Y- or Z-axis. When Snap to grids is on, the translateX, translateY, or translateZ attribute becomes exactly equal to 0 at the point where you drag the object across the axis. To prevent this error, turn Snap to grids off. With snapping off, the attribute is unlikely to become exactly 0 as you drag across the axis.
Note If you compile an expression for a particle shape node and see the same error message once for each particle in the object, it’s likely that some attribute name, variable, or function is undefined or misspelled.
98
Using Maya: Hypergraph, Sets & Expressions
6
Editing Expressions The Expression Editor offers convenient techniques for editing the text of expressions. There are filters that help you search for expressions you previously created, as well as techniques for entering and modifying the text of an expression.
You can edit an expression directly in the text box or with a text editor such as vi.
This chapter describes the following topics: “Finding expressions” on page 99
•
“Editing an expression in the text field” on page 105
•
“Editing an expression with a text editor” on page 106
•
“Creating a new expression” on page 111
•
“Deleting an expression” on page 112
•
“Using attribute names in expressions” on page 112
Expressions
•
Finding expressions After you’ve created an expression, you might decide later to alter it to create a different animation result. To edit an expression, you display it in the Expression Editor. The following sections describe how to find and display an expression for editing.
Using Maya: Hypergraph, Sets & Expressions
99
Editing Expressions Finding expressions
Finding by expression name To find an expression, you can choose from a list of all expressions in the scene.
To search for an expression by name: 1
From the Expression Editor, choose Select Filter→By Expression Name. An Expressions list appears in the Expression Editor. This list shows all expressions created for the scene.
List of expressions
2
Click the expression in the list. The expression contents appear in the expression text field. If you don’t remember the name of the expression, click each name on the list until the desired expression appears in the expression text field.
Note For a particle shape node, you can create a creation expression, a runtime expression, or both. Both expressions are listed under a single name—the name of the particle shape node. You can’t name or rename such expressions. To find such expressions, look for the particle shape node’s name in the Expressions list. Click the appropriate Runtime or Creation checkbox to display the desired expression.
100
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Finding expressions
Finding by selected object If you can’t remember the name you gave an expression, you can find it by selecting the affected object. For a nonparticle shape node, you can also select an affected attribute from the Attributes list to narrow the search for the expression.
To search for an expression by object and attribute name: 1
Select the object or other node in the Outliner, Hypergraph, or workspace.
2
Choose Select Filter→By Object/Attribute Name in the Expression Editor. This is the default search setting for the Expression Editor.
3
Choose Object Filter→Selected Objects. The selected object’s name and appropriate attributes appear in the window.
Object name Object’s attributes
For an object other than a particle shape node, click the name of the attribute controlled by the expression. If you’ve forgotten the name of the attribute controlled by the expression, choose Attribute Filter→Connected to Expressions. The Attributes list displays only the attributes controlled by expressions for the selected object. Click each attribute in the Attributes list until you see the desired expression in the expression text field. You can’t write a different expression for each attribute of a particle shape as you can for other types of objects. Because you can write only one creation expression and one runtime expression per particle shape, you don’t need to select an attribute from the Expression Editor’s Attributes list. See “Understanding particle expressions” on page 148 for details on particle expressions.
Using Maya: Hypergraph, Sets & Expressions
101
Expressions
4
Editing Expressions Finding expressions
Note The Attributes list shows only unlocked, keyable attributes. You can choose whether an attribute is keyable or locked with View→Object→ Editors→Channel Control. To write an expression for any nonkeyable attribute not shown in the list, enter object.attribute name in the Selected Obj & Attr text box.
Finding by item type You can find an expression based on the type of object or item the expression affects. For example, if you can’t remember an expression’s name but remember you applied it to a shader node, you can narrow your search to expressions that control shader nodes in the scene.
To search for an expression by item type: 1
In the Expression Editor, choose Select Filter→By Object/Attribute Name.
2
From the Object Filter menu, select the type of object or item the expression affects.
3
Choose Attribute Filter→Connected to Expressions.
4
Select the affected object or item from the Objects list.
5
Select the affected attribute from the Attributes list. The expression that controls the attribute appears in the expression text field.
Example Suppose you’ve written an expression that controls the rotateZ attribute of a spotlight transform node named Searchlight. Do this to find the expression: 1
Choose Select Filter→By Object/Attribute name.
2
Select Object Filter→Transforms. Note that you don’t select Object Filter→Lights in this example. The rotateZ attribute is an attribute of a light’s transform node, not of the light object itself.
102
3
Choose Attribute Filter→Connected to Expressions.
4
Select the object Searchlight from the Objects list.
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Finding expressions 5
Click rotateZ from the Attributes list. The expression appears in the expression text field.
Using the Selection list The Expression Editor displays a Selection list by default. This list displays either a list of objects and attributes, or a list of expressions you’ve created. To display the list of objects and attributes, choose Select Filter→By Object/ Attribute Name. This is the default display. To display the list of expressions you’ve created in the scene, choose Select Filter→By Expression Name.
Selection list triangle
Expressions list
Expressions
Using the Objects and Attributes list The objects listed in the Objects list depend on which entry you’ve selected from the Object Filter menu. If you select Object Filter→Lights, for instance, all lights in the scene appear in the list. The appropriate attributes of the object selected in the Objects list appear in the Attributes list. For example, if spotLightShape1 is selected in the Objects list, the attributes of spotLightShape1 appear in the list. When searching for an expression to edit, you can click an object and attribute from this list to find and display an expression that affects the chosen attribute. You can edit the displayed expression in the expression text field.
Using Maya: Hypergraph, Sets & Expressions
103
Editing Expressions Finding expressions For a particle shape node, you don’t need to select an attribute from the Attributes list. You can create only one creation expression and one runtime expression per particle shape node. The same expression appears for each attribute. When you create a new expression, you can click an object from this list to choose the default object to which the expression applies. When you select the default object in the Expression Editor, you can skip omit the object name and period that’s part of a full attribute name (see “Omitting an object name in expressions” on page 115.)
Using the Expressions list The Expressions list shows all expressions you’ve created in the scene. When searching for an expression to edit, click an expression from this list to display and edit its contents.
Hiding the Selection list You can hide the Selection list to lessen clutter in the window. To do so, click the triangle next to Selection (see previous figure). This triangle collapses and expands the list.
Filtering attributes from the Selection list If a selected object has several attributes controlled by expressions but you’re not sure which attributes, you can select a filter to list only attributes controlled by an expression.
To filter attributes from the Attributes list: 1
Select the object containing the attributes.
2
Choose Select Filter→By Object/Attribute Name.
3
Choose Object Filter→Selected Objects.
4
Choose Attribute Filter→Connected to Expressions. Only the object’s attributes controlled by expressions appear in the Attributes list. To see all attributes you can control with an expression again, choose Attribute Filter→All.
104
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression in the text field
Editing an expression in the text field The Expression Editor provides techniques for deleting and copying text in the expression text field. There are also techniques for clearing and restoring the text of an expression.
Expression text field
Important
Deleting and copying text To delete text: 1
Drag the mouse to select the text.
2
Press your keyboard’s Backspace key to delete it.
To copy and paste text: 1
Drag the mouse to select the text to be copied.
2
At the point in the text where you want to copy the text, click with the middle mouse button. This technique takes a little practice. If you find this frustrating, you might prefer using a text editor native to your operating system, for example, vi or jot. See “Editing an expression with a text editor” on page 106.
Using Maya: Hypergraph, Sets & Expressions
105
Expressions
If you close the Expression Editor window without successfully compiling an expression with the Create or Edit button, Maya discards any editing changes you’ve made to the expression.
Editing Expressions Editing an expression with a text editor
Clearing the expression text field You can erase the entire expression text field by clicking a button rather than dragging and deleting text.
To clear the expression text field: Click the Clear button.
Important To erase an expression and make sure its previous contents no longer control an attribute, click the Edit button after clicking the Clear button.
Reloading an expression’s previous contents Clicking the Create or Edit button compiles an expression. If you’ve made an editing change and haven’t yet clicked the Edit button, you can reload the previous expression if you don’t like the results.
To reload the expression: Click the Reload button. This restores the expression to the contents last present when you clicked the Create or Edit button.
Editing an expression with a text editor From the Expression Editor, you can start a text editor such as vi to create and edit an expression. Text editors have features useful for editing big expressions. When you start the text editor for an expression, you can edit only that expression with that instance of the text editor. However, you can start the text editor once for each of several expressions if you want to examine or edit several expressions at the same time. Once you start a text editor for an expression, the Expression Editor’s text field dims to indicate you can’t work there while the text editor runs. You can, though, work in the expression text field for another expression.
106
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression with a text editor There is no file on disk you can edit independently of the Expression Editor. When you use the text editor through the Expression Editor, you’re working with a temporary file that’s linked to the expression stored in the scene. You can, however, read an independent text file containing expression text into the temporary file. If you save an expression without specifying a filename, Maya reads the saved expression and stores it with the scene. You’ll see it dimmed in the expression text field while you’re working with the text editor. When you close the text editor, the expression text field entry no longer is dim. The text expression field becomes active after you close the text editor. If you quit the text editor without saving the expression, Maya does nothing. Because the expression hasn’t changed, Maya’s copy of the expression doesn’t need to change either.
Tip You can use a text editor to save an expression to a filename in the directory of your choice. This gives you a way to archive an expression you want to use in a different scene.
Using an editor listed in the Editor menu Expressions
By default, you can start one of these editors from the Editor menu in the Expressions Editor: •
jot
•
vi
•
vim
•
xemacs To run a different editor, see “Using an editor not listed in the Editor menu” on page 109.
To start an editor listed in the menu: 1
From the Editor pull-down menu in the Expression Editor, select an editor.
2
Double-click an object name, expression name, or attribute name from the Selection list.
Using Maya: Hypergraph, Sets & Expressions
107
Editing Expressions Editing an expression with a text editor The editor appears. An example display of vi follows:
The editor’s title bar shows a filename that’s temporarily created while you work on the expression. When you write or save the file, its contents are copied to the Maya scene containing the expression. The expression text field is inactive while the text editor is open. You can optionally close the Expression Editor window. If you single-click the name of an object, attribute, or expression, the text editor doesn’t appear. You can single-click to browse the contents in the expression text field without opening a text editor. If you double-click an attribute that’s already been assigned a value in an expression, the expression that controls that attribute appears in the text editor. For nonparticle expressions, you can assign to any attribute in the scene, not just to the double-clicked attribute. In fact, you don’t even need to work with the double-clicked attribute at all. If you double-click an attribute that has not yet been assigned a value, the text editor appears with no contents. If you double-click that attribute again, a new instance of the editor appears. After you assign a value to an attribute in an expression, you can start the editor only once for the attribute.
108
3
Create or edit the expression with the editor.
4
Save the file.
5
Confirm that the Expression Editor detected no syntax errors.
6
Quit the editor.
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression with a text editor
Note If you’ve created a UNIX command alias for jot, vi, vim, or xemacs, the Expression Editor tries to launch this command. If the arguments provided in the command alias are unusable by the Expression Editor, the editor might operate unexpectedly or fail to launch. Avoid using an alias to customize your editor’s operation settings. Do the steps in “Changing an editor’s operation settings” on page 110.
Using an editor not listed in the Editor menu If your workstation has a text editor that’s not listed in the Editor menu, you can use it after doing a few preliminary UNIX system administration tasks.
To start an unlisted editor: 1
In your UNIX .cshrc file, set the WINEDITOR environment variable to specify the desired editor and options. See “Changing an editor’s operation settings” on page 110 for examples. You can choose any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor).
2
Log out and log into your user account.
3
Restart Maya.
4
Choose Other from the Editor pull-down menu.
5
Double-click an object name, expression name, or attribute name from the Selection list. The editor appears.
6
Create or edit the expression with the editor.
7
Save the file.
8
Confirm that the Expression Editor detected no syntax errors.
9
Quit the editor.
Using Maya: Hypergraph, Sets & Expressions
109
Expressions
If the editor normally appears in the shell where you launched it, you must make the WINEDITOR setting display the editor in a shell.
Editing Expressions Editing an expression with a text editor
Changing an editor’s operation settings Maya launches the editors listed in the Editor menu with default operation settings. You can change the operation settings with a few preliminary system administration tasks.
To change an editor’s operation settings: 1
Set the WINEDITOR environment variable to specify the desired editor options. You can choose any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor). For example, jot requires the option -f, vim requires -g -f, and xemacs requires the option -nw. An example of setting WINEDITOR for vi follows: setenv WINEDITOR “xwsh -name mayaEditor -e vi”
An example for vim follows: setenv WINEDITOR “xwsh -geometry 80x57+350+130 -bg 97 -e vim”
2
Log out and log into your user account.
3
Restart Maya.
4
Choose Other from the Editor pull-down menu.
5
Double-click an object name, expression name, or attribute name from the Selection list. The editor appears.
6
Create or edit the expression with the editor.
7
Save the file.
8
Confirm that the Expression Editor detected no syntax errors.
9
Quit the editor.
Selecting an editor for default startup You can make an external text editor start by default each time you start a text editor.
110
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Creating a new expression
To start an editor by default: 1
Choose Options→UI Preferences.
2
In the UI Preferences window, click the Misc folder.
3
Choose the editor in the Expression Editor menu. To choose an editor specified with the WINEDITOR environment variable, select Other.
4
Click Save Changes to close the window.
5
In the Expression Editor, double-click an object name, expression name, or attribute name from the Selection list. The editor appears. The next time you start the Expression Editor, the editor’s name appears in the Editor pull-down menu by default. If you’ve chosen different text editors in UI Preferences and the Editor menu, the one chosen in UI Preferences appears.
Important If you’ve specified a text editor through Options→UI Preferences or with the Expression Editor’s Editor menu, starting the Expression Editor from the Channel Box or Attribute Editor displays the text editor instead of the Expression Editor.
Creating a new expression You can create a new expression after you’ve been editing an existing one.
To create a new expression: 1
Make sure you click the Create or Edit button to compile the existing expression.
2
Choose Select Filter→By Expression Name.
3
Click the New Expression button. This clears the Expression Name box and expression text field so you can create a new expression.
Using Maya: Hypergraph, Sets & Expressions
111
Expressions
Note the text editor appears when you click the New Expression button.
Editing Expressions Deleting an expression When you create the expression, the Expression Editor associates the object name with the expression. This means you can narrow your search for the expression using the object’s name in addition to the expression name. You do not need to select an attribute in the Attributes list. You can associate the expression with an object only. For a particle shape node, you don’t need to select an attribute, as you can create only one creation expression and one runtime expression per particle shape. For nonparticle shape objects, you can create one expression per attribute.
Deleting an expression If you want to stop an expression from controlling attributes, you can delete the expression.
To delete an expression: 1
Display it in the Expression Editor.
2
Click the Delete button.
Using attribute names in expressions A full attribute name has this format: object.attribute where object is the name of the object node and attribute is the name of the attribute. A period separates the name of the object and attribute. Object and attribute names are case-sensitive. You must spell them with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. You cannot spell attribute names with the common English spellings shown in the Attribute Editor or by default in the Channel Box. The following topics show how you can abbreviate attribute names to save typing time.
112
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Using attribute names in expressions
Using attribute name abbreviations You can use an abbreviation in place of any full attribute name in the expression text field.
Example In place of this: Ball.translateY = time;
you can type this: Ball.ty = time;
Each attribute has at least one acceptable abbreviation. Here are some commonly used attribute name abbreviations for several types of object transform nodes: Abbreviation
translateX
tx
translateY
ty
translateZ
tz
rotateX
rx
rotateY
ry
rotateZ
rz
scaleX
sx
scaleY
sy
scaleZ
sz
visibility
v
Expressions
Long name
To see the abbreviations for attributes that can be keyframed: 1
Select the object or item containing the desired attributes.
2
Turn on Options→Channel Box to display the Channel Box.
Using Maya: Hypergraph, Sets & Expressions
113
Editing Expressions Using attribute names in expressions Common English equivalents for the long attribute names appear in the Channel Box by default. These names are different than the names you must use in the expression text field. If you use the long attribute name, use the name that appears in the Attributes list of the Expression Editor. Do not use the common English language equivalents displayed in the Channel Box.
Use either attribute long names or abbreviated names in expressions
Do not use these common English names
3
From the Channels menu at the top of the Channel Box, select Channel Names→Short. The abbreviated attribute names replace the common English attribute names in the Channel Box.
114
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Using attribute names in expressions
To see abbreviations for other attributes: Execute this MEL command in the Script Editor: listAttr -sn objectname
where objectname is the name of the object or other node.
Note After you click Create or Edit to compile an expression, Maya converts all attribute abbreviations in the expression to the full attribute name.
Omitting an object name in expressions If you select an object as the Default Object in the Expression Editor, you can omit the object name and period that’s part of a full attribute name.
Example Suppose you’ve selected Ball as the Default Object. In place of this: Ball.translateY = time;
you can type this: Expressions
translateY = time;
Maya interprets translateY as belonging to Ball, the object listed in the Default Object text box of the Expression Editor.
To make an object the Default Object: Enter the object’s name in the Default Object text box. By default, the selected object is also the default object. You can omit the object name only for attributes of the object in the Default Object text box. The Default Object text box is dim when a particle shape node is the selected object in the Expression Editor. Because a particle shape node’s attributes can be controlled by only one creation expression and one runtime expression, the particle shape node is always the default object when it is the selected object.
Using Maya: Hypergraph, Sets & Expressions
115
Editing Expressions Using attribute names in expressions
Combining the abbreviation techniques You can combine the abbreviation techniques mentioned in the two previous topics to minimize typing.
Example Suppose you’ve selected Ball as the Default Object. In place of this: Ball.translateY = time;
you can type this: ty = time;
Maya interprets ty as being the translateY attribute of Ball, the object listed in the Default Object text box of the Expression Editor. Attributes of other objects must be spelled out with the full object and attribute name.
116
Using Maya: Hypergraph, Sets & Expressions
7
Beyond the Basics This chapter describes advanced concepts for writing expressions. Unless otherwise noted, the topics within apply to expressions for attributes of all objects, including particles. For additional details on working with particles, see Chapter 8, “Particle Expressions.”
Rob Tesdahl
This chapter describes the following topics: •
“How often an expression executes” on page 118
•
“Using custom attributes in expressions” on page 118
•
“Displaying attribute and variable contents” on page 123
•
“Reproducing randomness” on page 123
•
“Speeding expression execution” on page 127
•
“Reducing redundant expression execution” on page 130
•
“Removing an attribute from an expression” on page 131
•
“Disconnecting an attribute” on page 132 Using Maya: Hypergraph, Sets & Expressions
117
Expressions
The falling cube is a soft body with goal and springs. As its points move below the floor, an expression assigns them a goal weight of 0. The cube appears to melt as it passes through the floor.
Beyond the Basics How often an expression executes •
“Renaming an object” on page 136
•
“Executing MEL commands in an expression” on page 137
•
“Understanding path names” on page 140
•
“Understanding unexpected attribute values” on page 141
How often an expression executes After you’ve typed an expression in the Expression Editor, you click the Create or Edit button to compile the expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. After being compiled, the expression executes for the current frame. When you select an object other than a particle shape node, the Expression Editor displays an Always Evaluate checkbox that affects when an expression executes. If you select a particle shape node, the Expression Editor dims this checkbox. For details on particle shape node expressions, see Chapter 8, “Particle Expressions”). Generally an expression executes whenever the current animation time or frame changes. For example, an expression executes when you rewind or play the animation. The expression executes once for each time the animation frame or time changes. An expression also generally executes when your interaction with Maya makes use of an attribute in the expression. For example, if your expression assigns a sphere’s translateX attribute to another attribute and you move the sphere in an X-axis direction, the expression executes upon each increment of the sphere’s movement. Occasionally, it’s useful to turn off Always Evaluate to diminish redundant expression execution and speed Maya operation. Before doing this, it’s best to understand the subtle details of expression execution. See “Reducing redundant expression execution” on page 130 for details.
Using custom attributes in expressions It’s often helpful to add a custom attribute to an object and use it in an expression. You can use a custom attribute to control a combination of other attributes. You can also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes.
118
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Using custom attributes in expressions Custom attributes have no direct effect on any characteristic of an object. See “Assigning to a custom attribute” in Chapter 8 for details on how to add and use a custom attribute with particles.
Example Suppose you’ve given a NURBS sphere named Planet a circular, orbiting motion in the XY plane with this expression: Planet.tx = sin(time); Planet.ty = cos(time);
Expressions
Planet orbits the origin at a radius of 1 unit. In the following steps, you’ll create a custom attribute named distance to increase the radius of Planet’s orbit over time.
Note The small balls in the preceding figure show the circular path of Planet. They’re in the figure only to help you visualize the motion. They aren’t part of the animation or expression.
To add a custom attribute to alter the orbit: 1
Select Planet.
2
Choose Modify→Add Attribute.
Using Maya: Hypergraph, Sets & Expressions
119
Beyond the Basics Using custom attributes in expressions
3
In the Add Attribute window, enter distance in the Attribute Name text box.
4
Make sure Make attribute keyable is on.
5
Set Data Type to Float, and Attribute Type to Scalar.
6
Set Minimum to 1, Maximum to 10, and Default to 4. Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value displayed for the attribute. An expression isn’t bound by the Minimum and Maximum values. The attribute receives whatever value you assign it in the expression. The expression can read the Default value or any other value you set in the Attribute Editor or Channel Box.
7
120
Click Add to add the attribute, then close the Add Attribute window.
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Using custom attributes in expressions The distance attribute appears in the Attributes list of the Expression Editor for Planet. You can now set or read the value of the attribute in any expression. 8
Edit the expression to this: Planet.tx = distance * sin(time); Planet.ty = distance * cos(time);
Multiplying the sin(time) and the cos(time) by the distance attribute makes Planet circle the origin at a distance specified by the value of the distance attribute. See Chapter 9 for details on the sin and cos functions.
You can make the expression control the distance attribute over time. 9
Edit the expression to this: distance = time; Planet.tx = distance * sin(time); Planet.ty = distance * cos(time);
By setting distance to the value of time, Planet’s orbiting distance increases as playback time increases. Planet moves in a steady outward spiral as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
121
Expressions
Because you gave the distance attribute a default value of 4 when you added it to Planet, playing the animation makes Planet circle the origin at a distance of 4 grid units from the origin.
Beyond the Basics Using custom attributes in expressions
Instead of using an expression to control distance, you can keyframe its value over time. For example, by keyframing a distance value of 1 at frame 1 and a value of 10 at frame 200, Planet moves in a steady outbound spiral as you play the 200 frames. Planet’s distance increases in a linear interpolation from 1 to 10 as the animation plays. You can animate the distance attribute with keyframes or with an expression, not with both.
Tip If an expression controls an attribute and you want to control it with keyframes instead, delete all statements that assign values to the attribute, then click the Edit button. Use the Channel Box to reset the attribute’s value to an initial value, then set keyframes as desired. If keyframes control an attribute and you want to control it with an expression instead, click the attribute’s text box in the Channel Box, then choose Channels→Delete Selected. Assign values to the attribute name in an expression as desired.
122
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Displaying attribute and variable contents
Displaying attribute and variable contents The predefined print( ) function displays attribute contents, variable contents, and other strings in the Script Editor. This is often helpful for debugging an expression. See “print” on page 261 for more details. Note that for a nonparticle expression consisting of only print statements, Always Evaluate must be on in the Expression Editor for the expression to execute.
Reproducing randomness If you execute the rand, sphrand, and gauss functions repeatedly in an expression, Maya returns a sequence of random numbers. (See “Random number functions” on page 239 for details on these functions.) Each time you rewind and play your animation, the sequence of random numbers is different. Often, you’ll want to generate a sequence of random numbers that repeats each time your animation plays. For instance, suppose you use the rand function to assign a random radius to each particle in a stream of emitted particles rendered as Spheres. By default, Maya gives the particles a different sequence of random radius values each time your animation plays.
Important When you set a seed value in an expression or MEL script, the seed value affects the rand, sphrand, and gauss functions in other expressions and MEL scripts. Such functions are affected by this seed value in all scenes you open subsequently in the current work session. This seed value is unrelated to the Seed option available through Settings→Dynamics Controller in the Dynamics menus. The seed function therefore doesn’t affect randomness created with dynamics.
Using Maya: Hypergraph, Sets & Expressions
123
Expressions
To create the same radius values each time the animation plays, you can use the seed function in an expression before the rand, sphrand, or gauss functions execute. There’s no need to execute the seed function more than once per animation unless you need to generate several different repeating sequences of random numbers as your animation plays.
Beyond the Basics Reproducing randomness
Example Suppose you use the rand function to position several marbles at random translateX positions in your scene at frame 1: if (frame == 1) { marble1.tx marble2.tx marble3.tx marble4.tx }
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
The rand(-10,10) returns a random number between -10 and 10 each time it executes. When you rewind the animation to frame 1, Maya might assign these values to the translateX attributes of the marbles:
124
Attribute
Value
marble1.tx
2.922
marble2.tx
5.963
marble3.tx
-4.819
marble4.tx
7.186
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Reproducing randomness The next time you rewind the animation to frame 1, each marble’s translateX attribute receives a different random value. Maya might assign these values: Attribute
Value
marble1.tx
-3.972
marble2.tx
9.108
marble3.tx
-7.244
marble4.tx
-3.065
You can use the seed function to keep the sequence of random values returned by the rand function consistent when you rewind the animation. if (frame == 1) { seed(10); marble1.tx marble2.tx marble3.tx marble4.tx }
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
By setting the seed value to an arbitrary number, for instance, 10, the subsequent executions of the rand function return a repeating sequence of random numbers.
Using Maya: Hypergraph, Sets & Expressions
125
Expressions
You might prefer the marbles’ translateX values to stay the same when you rewind, for instance, so you can composite the marbles correctly among a foggy backdrop.
Beyond the Basics Reproducing randomness When you rewind the animation the first time, Maya might assign these values to the translateX attributes of the marbles: Attribute
Value
marble1.tx
8.020
marble2.tx
-2.973
marble3.tx
-7.709
marble4.tx
0.741
Each time you rewind the animation thereafter, Maya assigns these same values to the translateX attributes of the marbles. The marbles don’t move. Each time a statement sets the seed value to 10, the subsequent executions of the rand function return numbers from the sequence starting at the beginning number. In other words, resetting the seed value to 10 restarts the random number generation process to the first value in the sequence. Suppose you alter the expression to this: if (frame == 1) { seed(10); } marble1.tx marble2.tx marble3.tx marble4.tx
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
When you rewind the animation to frame 1, the expression sets the seed to 10. Maya assigns values to the marbles’ translateX attributes as in the previous expression.
126
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Speeding expression execution Because the expression doesn’t set the seed value in frames other than frame 1, playing the animation causes the rand function to return a new, yet repeating, sequence of random numbers each frame. If you play the animation several times, the translateX values will constantly change during animation, but the sequence of values will be identical each time you play the animation. You can assign the seed a different value to generate a different sequence of returned values. See “seed” on page 246 for details.
Speeding expression execution Maya does calculations internally in centimeters, radians, and seconds. A radian is an angular unit commonly used in mathematics. It equals 180 degrees divided by pi, or roughly 57.3 degrees. When you assign a number to an attribute whose value is a measurement unit, the expression interprets the number, by default, as the appropriate unit selected in the Units folder of the General Preferences window. By default, the Units folder selections are centimeters, degrees, and seconds. If a measurement unit you’ve chosen in the Units folder differs from the corresponding internal unit, Maya converts the number to the appropriate internal unit to do the assignment. Expressions
Example Suppose you’ve selected degrees from the Angular menu in the Units folder. You then write this expression for an object named Ball: Ball.rotateZ = 10;
Maya reads the 10 as being 10 degrees, then converts the value to the appropriate number of radians to make the assignment to Ball’s rotateZ attribute. The conversion happens automatically. From your standpoint, Maya is simply rotating Ball 10 degrees. In nonparticle expressions, these automatic conversions affect Maya performance. Because the expression executes slower, Maya slows when you play, rewind, or otherwise change the animation time. Saving, opening, and other file operations on the scene containing the expression are also slower. To boost Maya performance, you can turn off conversion to internal units. If you do so, you must convert units in expression statements.
Using Maya: Hypergraph, Sets & Expressions
127
Beyond the Basics Speeding expression execution
To speed expression execution: 1
Display the Expression Editor.
2
Choose one of these Convert Units options: None
Converts no units. You must assign values to attributes as centimeters, radians, or seconds, as appropriate. Execution is fastest with this option.
Angular Only
Converts angular units, but no others. You must assign values to attributes as centimeters, seconds, and degrees, as appropriate. (This assumes you’re using the default degree setting in the Units folder. If you’ve selected radians, you must enter radians.) If you’re confused by converting degrees to radians, select this option. Execution is fast with this option—unless the expression has many angular values.
To return to default conversions: 1
Display the Expression Editor.
2
For the Convert Units option, choose All. This lets you enter all measurement numbers in the same units specified in the Units preference settings. Execution is slowest with this selection, but expression writing is simplest. You can set a different conversion option for each expression.
Example Suppose, in the Units folder, you’ve set Linear units to millimeters and Angular units to degrees. You then write the following expression: Ball.translateX = 5; Ball.rotateZ = 10;
All causes Maya to read 5 as millimeters and 10 as degrees. None causes Maya to read 5 as centimeters and 10 as radians. Angular causes Maya to read 5 as centimeters and 10 as degrees.
To convert units in an expression statement: You must convert the units mathematically in a statement.
128
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Speeding expression execution
Examples Suppose, in the Units folder, you’ve set Linear units to millimeters and Angular units to degrees. In the Expression Editor you set the Convert Units option to None and enter this expression: Ball.translateX = 5; Ball.rotateZ = 10;
None causes Maya to read 5 as centimeters and 10 as radians, which is not the result you’re seeking. To assign 5 millimeters to Ball’s translateX attribute, you must convert 5 to the appropriate number of centimeters. To assign 10 degrees to Ball’s rotateZ attribute, you must convert 10 to the appropriate number of radians. The following statements do this: Ball.translateX = 5.0 / 10.0; Ball.rotateZ = 10.0 / 57.3;
There are 10 millimeters per centimeter. In other words, a millimeter is a centimeter divided by 10. So 5 millimeters equals 5 centimeters divided by 10. You therefore use the operation 5.0 / 10.0.
When you divide floating point attributes or variables, enter the floating point value 5.0 for an even number such as 5. This ensures that the division works as expected. For more details, see the note in “Using mixed data types with arithmetic operators” on page 145. There are 57.3 degrees per radian. In other words, a degree is a radian divided by 57.3. So 10 degrees equals 10 radians divided by 57.3. You therefore use the value 10.0 / 57.3. If you need a more precise conversion to radians, divide a degree by 57.29578 instead of 57.3. You can instead use the deg_to_rad function as follows: Ball.rotateZ = deg_to_rad(10.0);
The deg_to_rad function converts 10.0 degrees to a precise radian equivalent. See “deg_to_rad” on page 234 for details.
Using Maya: Hypergraph, Sets & Expressions
129
Expressions
Important
Beyond the Basics Reducing redundant expression execution Turning off unit conversion affects only expressions. It doesn’t affect other Maya commands, options, or displays. For instance, the preceding example expression assigns centimeters to translateX and radians to rotateZ. The Channel Box still displays values for these attributes in millimeters and degrees. It displays values in whatever units you choose in the Units folder of the General Preferences window. Note that you can’t turn off unit conversion for particle shape node expressions. Maya handles unit conversion differently for such expressions with little impact on performance.
Reducing redundant expression execution If your expression has redundant statement calculations, you can turn off Always Evaluate to speed up scrubbing and playback of your animation. To understand when this feature is useful, you must understand the subtle details of expression execution. An expression generally executes whenever the animation time changes. An expression also executes whenever an attribute that’s read by the expression changes value, and either of the following two actions occurs: •
Some other node in Maya uses the value of an attribute the expression writes to. For example, a deformer or shader uses its value.
•
Maya needs the value of an attribute to which it writes in order to redraw the workspace contents. In this context, the predefined variables time and frame are also considered attributes the expression reads. Suppose you write an expression that moves a NURBS sphere along the Yaxis at twice the current value of its X-axis translation: nurbsSphere1.translateY = 2 * nurbsSphere1.translateX;
If you use the Move tool in the workspace to drag the sphere in an X-axis direction, Maya executes the expression for each incremental change to the translateX attribute as you drag. Dragging the sphere in the X direction changes the value of the translateX attribute in the expression. As you drag the sphere and Maya updates the workspace display, the value of the translateY attribute changes in the expression. This makes the expression execute.
130
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Removing an attribute from an expression If you turn Always Evaluate off, an expression won’t execute if it contains only print function statements, variable assignments, or assignments that do not read attribute values.
Example global float $BallHeight = 5; print($BallHeight+"\n"); nurbsSphere1.tx = rand(1); print(nurbsSphere1.tx+"\n");
The first statement declares and assigns a value to the variable $BallHeight, which is not an attribute. The next statement prints the $BallHeight but assigns no value to an attribute. The next statement assigns an attribute a value, but the value is generated by the random number function rand. This function doesn’t read an attribute value. For details on the rand function, see “rand” on page 243. The last statement reads and prints the value of an attribute, but doesn’t assign a value to an attribute. None of these actions causes the expression to execute when Always Evaluate is off.
For most animations, expressions execute regardless of whether Always Evaluate is on. If in doubt, leave it on.
Removing an attribute from an expression If you do any of the following actions, an expression no longer sets or reads an attribute: •
Delete all occurrences of the attribute name in the expression.
•
Convert to comments all statements that use the attribute name in the expression.
•
Delete the expression that contains the attribute. Following these actions, the attribute keeps its value from the last time the expression executed and set its value.
Using Maya: Hypergraph, Sets & Expressions
131
Expressions
Always Evaluate affects only the expression you’re creating or editing. You can turn it on for one expression and off for another.
Beyond the Basics Disconnecting an attribute The attribute doesn’t return to the value it had before the expression set it. To return the attribute to its original value, use the Channel Box or Attribute Editor to set the attribute.
Disconnecting an attribute If you disconnect an attribute from an expression, the expression no longer reads or set its value. You might want to disconnect an attribute, for example, so you can keyframe the attribute rather than control it with an expression. These actions disconnect an attribute from an expression: •
Delete from the scene an object with an attribute that exists in the expression.
•
Use the Window→General Editors→Connection Editor to disconnect the attribute from the expression.
•
Use the MEL disconnectAttr command.
•
Use the MEL choice command.
Tip The MEL choice command lets you control an attribute alternately with two or more techniques in different frames. For example, you can keyframe an attribute for frames 1-48, control it with an expression for frames 48-96, and control it with a motion path for subsequent frames.
Displaying disconnected attributes in expressions The Expression Editor displays a disconnected attribute with a symbolic placeholder representing the attribute’s former existence in the expression.
Example Suppose your scene has two objects, Ball and Cone, and you’ve written this expression: Ball.translateX = Cone.translateX; Ball.translateY = Cone.translateY; Ball.translateZ = Cone.translateZ;
132
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Disconnecting an attribute If you delete Cone from the scene, Cone.translateX, Cone.translateY, and Cone.translateZ attributes no longer exist for the expression to read and assign to Ball’s translateX, translateY, and translateZ attributes. If you display the expression again, it appears as follows: Ball.translateX = .I[0]; Ball.translateY = .I[1]; Ball.translateZ = .I[2];
The .I[0], .I[1], and .I[2] characters indicate you’ve disconnected Cone’s translate attributes from the expression. These symbols represent placeholders for the former use of the attributes in the expression. The .I means the placeholder represents an input to the expression. An input to an expression is an attribute with a value the expression reads for assignment to another attribute or variable. The number in brackets indicates the order in the expression the attribute was read. For example, .I[0] indicates the input is the first attribute read in the expression, .I[1] indicates the input is the second attribute read, and .I[2] indicates the input is the third attribute read.
Note that if you disconnect an attribute from an expression but the attribute still exists in the scene, the attribute keeps its value from the last time the expression executed and set its value.
Example Suppose you’ve written these statements among others: Ball.translateX = Cone.translateX; Ball.translateY = Cone.translateY; Ball.translateZ = Cone.translateZ;
If you delete Ball from the scene, Ball.translateX, Ball.translateY, and Ball.translateZ attributes no longer exist. The expression can no longer assign Cone’s translateX, translateY, and translateZ values to the corresponding Ball attributes.
Using Maya: Hypergraph, Sets & Expressions
133
Expressions
A floating point or integer attribute placeholder has a value of 0. A particle shape node’s vector attribute placeholder has a value of <<0,0,0>>. In the example, the placeholders .I[0], .I[1], and I[2] have the value 0. When the expression executes, it assigns Ball.translateX, Ball.translateY, and Ball.translateZ the value 0.
Beyond the Basics Disconnecting an attribute Symbolic placeholders replace Ball attributes in the expression. If you display the expression again, the statements appear as follows: .O[0] = Cone.translateX; .O[1] = Cone.translateY; .O[2] = Cone.translateZ;
Note If an expression assigns values to the attributes of only one object, deleting the object deletes the expression also. If your expression assigns values to attributes of several object attributes, deleting all those objects deletes the expression. To avoid deleting the expression in the preceding example, you would need have some statement that sets an attribute of an object other than the deleted Ball. For example, you might include this statement: Cone.visibility = 1;
The .O[0] characters indicate you’ve disconnected the attribute Ball.translateY from the expression. The .O indicates that the placeholder represents an output from the expression. An output from an expression is an attribute assigned a value by the expression. The number in brackets, for example, [0], indicates the order in which the attribute was assigned a value in the expression. Because Ball.translateX was the first output from the expression, the expression replaces it with .O[0]. The expression replaces Ball.translateY and Ball.translateZ with .O[1] and .O[2] because they were the second and third outputs from the expression. When the expression executes, it continues to assign values to the placeholder, though the placeholder has no effect on any object or component of scene. The expression assigns the placeholders .O[0], .O[1], and .O[2] the value of Cone.translateX, Cone.translateY, and Cone.translateZ, but these placeholders don’t control anything in the scene. The statements have no effect.
134
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Disconnecting an attribute
Connecting an attribute to a symbolic placeholder After you’ve disconnected an attribute from an expression, a symbolic placeholder replaces it in the expression as described in the preceding topic. You can replace the placeholder with the attribute of your choice. The most obvious way to do this is to type the desired attribute name in every occurrence of the symbolic placeholder in the expression. If you have a lengthy expression that has lots of symbolic placeholders, you can use a single MEL connectAttr command to connect the new attribute to all occurrences of the same symbolic placeholder. You can also use Window→General Editors→Connection Editor.
Example 1 Suppose you have these statements among others in an expression named HorseController: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; BrownHorse.translateX = Car.translateX;
Deleting the Car and reloading the expression shows this:
.I[0] is the symbolic placeholder for what was the Car.translateX attribute. You can connect a different attribute to this placeholder to assign its contents to the translateX attributes of WhiteHorse, BlackHorse, and BrownHorse. Suppose you want to control these attributes with the translateX attribute of an object named Cow. You can enter the following MEL command at the Command Line: connectAttr Cow.tx HorseController.input[0]
This command connects the attribute Cow.tx to the expression’s input[0]. The expression is named HorseController. The input[0] is abbreviated as .I[0] in the expression. You can see the spelled-out input name input[0] in the Graph→Up and Downstream Connections display of the Hypergraph. Reloading the expression shows the new attribute connection: WhiteHorse.translateX = Cow.translateX; BlackHorse.translateX = Cow.translateX; BrownHorse.translateX = Cow.translateX;
Using Maya: Hypergraph, Sets & Expressions
135
Expressions
WhiteHorse.translateX = .I[0]; BlackHorse.translateX = .I[0]; BrownHorse.translateX = .I[0];
Beyond the Basics Renaming an object
Example 2 You can also reconnect an expression’s output with the connectAttr command. Suppose you have these statements among others in an expression named HorseController: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; BrownHorse.translateX = Car.translateX;
Deleting the BrownHorse object and reloading the expression displays this: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; .O[2] = Car.translateX;
.O[2] is the symbolic placeholder for what was the BrownHorse.translateX attribute. It received the placeholder .O[2] because it’s the third output from the expression. (The first and second outputs from the expression are .O[0] and .O[1] .) You can connect a different object attribute to this placeholder to control it with the value in Car.translateX, as shown in the third statement. Suppose you want to control the attribute of a new object named RedHorse.translateX with the Car.translateX value. You can enter the following MEL command in the Command Line: connectAttr HorseController.output[2] RedHorse.tx
This command connects the HorseController expression’s output[2] to the attribute RedHorse.tx. The output[2] is abbreviated .O[2] in the expression. Reloading the expression shows the new attribute connection: WhiteHorse.translateX = Cow.translateX; BlackHorse.translateX = Cow.translateX; RedHorse.translateX = Cow.translateX;
Renaming an object If you rename an object whose attributes were used in an expression, the Expression Editor continues to read or set the attributes. Maya doesn’t disconnect the attribute from the expression. The Expression Editor converts to the new name of the object the next time you click the Reload button in the Expression Editor.
136
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Executing MEL commands in an expression
Note When you reload an expression, the Expression Editor converts any short attribute names to their long attribute name equivalents. For example, if you originally type the attribute name Ball.ty, reloading the expression renames it as Ball.translateY.
Executing MEL commands in an expression You can execute MEL commands and procedures in an expression. However, if you make or break connections or add or delete nodes, your scene might malfunction. Rewinding your animation does not undo MEL command execution in an expression. For instance, if your expression executes MEL commands to create a pair of spheres, rewinding doesn’t delete the spheres. Moreover, playing the scene again creates another pair of spheres. Though you can usually undo executed MEL commands by selecting Edit→Undo repeatedly, this might not work if your scene is malfunctioning.
You can execute MEL commands in an expression with several techniques: •
MEL command alone in a statement
•
MEL command within left-hand single quote marks
•
MEL command used as an argument to an eval function
•
MEL procedure call to a procedure in a MEL script The following topics explain the techniques. See Using MEL for details on MEL.
Using a MEL command alone in a statement The simplest way to use a MEL command in an expression is to type it in a statement exactly as you would in the Script Editor or in a MEL script.
Example select -cl;
Using Maya: Hypergraph, Sets & Expressions
137
Expressions
When you execute a command from the Command Line, status information appears in the Script Editor and the Command Line’s response area. This information is not displayed when a command executes in an expression.
Beyond the Basics Executing MEL commands in an expression This example shows the use of a MEL command alone. The statement executes exactly as it would in the Script Editor, except no command output appears in the Script Editor.
Using a MEL command within single quote marks If you enclose a command within left-hand single quote marks (‘), Maya returns command output where the command is in the statement. You can assign this output to a variable to, for example, display it in the Script Editor.
Example string $a[]; $a = ‘ls -lights‘; print($a);
The first statement defines an array named $a. The second statement executes the MEL command within quotes, then assigns the command’s output to array $a. The third statement displays the contents of $a to the Script Editor as follows: ambientLightShape1 directionalLightShape1
Using a MEL command with the eval function Using a MEL command with the eval function has an advantage over the previous two techniques: you can build a command from a string.
Example string $mycommand = "sphere"; eval($mycommand+" -r 5");
The first statement assigns the string sphere to the variable $mycommand. The second statement appends -r 5 to sphere and executes the complete command sphere -r 5. This creates a sphere with a radius of 5 grid units. See “eval” on page 259 for more details.
Using a MEL procedure in an expression You can execute a MEL procedure in an expression by entering the procedure name in a statement.
138
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Executing MEL commands in an expression
To execute a MEL procedure: 1
Give the script the same filename as the procedure it contains, but with the extension .mel. For example, if your procedure name is randspot( ), name your script file randspot.mel.
2
Put the script file in your Maya scripts directory.
3
Declare the procedure as global in the script file as in this example: global proc string randspot()
4
In an expression statement, use a statement that calls the procedure. You can use the statement within left-hand single quote marks with an eval function, or alone as in this example: randspot();
A complete example of calling a MEL procedure from an expression follow:
Example Suppose, in your Maya scripts directory, you’ve created a MEL script file named randspot.mel with the following contents:
Expressions
global proc string randspot() { string $mycommand; if (rand(2) < 1) $mycommand = "particle -p "+ sphrand(10); else $mycommand = "sphere -p "+ sphrand(10); return $mycommand; }
Further suppose you’ve created this expression: string $randcommand = randspot(); eval($randcommand);
When you rewind or play a frame in the animation, the expression executes. The first expression statement executes the randspot procedure in the randspot.mel script file. In the randspot procedure, the rand(2) part of the ifelse statement generates a random floating point value between 0 and 2, then compares its value to 1. For details on the rand function, see “rand” on page 243. Using Maya: Hypergraph, Sets & Expressions
139
Beyond the Basics Understanding path names If the rand(2) function returns a value less than 1, the if statement assigns a MEL command string such as particle -p -1.356 5.983 8.458 to $mycommand. The + sphrand(10) part of the statement appends to sphere -p the three floating point components of a randomly generated vector. Though sphrand(10) returns a vector, Maya converts the vector to a string upon assigning it to the string $mycommand. For details on the sphrand function, see “sphrand” on page 244. The converted string contains no double angle brackets or commas, but does contain a space character between the floating point components. A space between the floating point components is required syntax for the MEL particle command as used above. If the rand(2) function returns a value greater than 1, $mycommand receives a MEL command string such as sphere -p 4.926 -2.589 1.274. The procedure finishes executing and passes the value of $mycommand back to the expression’s calling procedure randspot( ). This assigns the command string to the variable $randcommand. The eval function executes the command string in $randcommand. For example, if the statement executes particle -p -1.356 5.983 8.458, it creates a particle with coordinates <<1.356, 5.983, 8.458>>. The expression executes each frame and creates a new particle or sphere at a random location within a spherical radius of 10 units from the origin.
Understanding path names If two objects in a scene have different parents, they can have the same object name. If you refer to an attribute of such an object in an expression, you must use a more complete name that includes the object’s path name. An object’s path name has this format: pathname|objectname.attributename where pathname is the parent node’s name, objectname is the object’s name, and attributename is the attribute’s name of the attribute. A pipe symbol (|) symbol divides the pathname from the object name. Don’t type spaces before or after the | symbol.
140
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values For example, a scene might have a child of GroupA named Ball.tx and a different child of GroupB named Ball.tx. If you write this statement: Ball.tx = time;
Maya generates an error because it doesn’t know which Ball.tx to set. To eliminate the error, you must enter the pathname of the attribute as in this example: GroupA|Ball.tx = time;
The | symbol between GroupA and Ball.tx indicates that the object to the left of the symbol is the parent of the object to its right. Use no spaces before or after the | symbol.
Understanding unexpected attribute values As you work with expressions, you’ll sometimes see attribute values you didn’t expect. The following topics describe a few common causes of confusion.
Important
Values after rewinding When you rewind a scene, an expression executes with the last settings made for attribute values. This sometimes gives unexpected results.
Example Ball.tx = $distance; $distance = time;
Assume for this example you’ve set the starting frame of the animation to frame 0. The first statement sets Ball.tx to the variable $distance. The second statement sets $distance to the value of time.
Using Maya: Hypergraph, Sets & Expressions
141
Expressions
Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might lead you to believe your editing changes took effect.
Beyond the Basics Understanding unexpected attribute values When you play the animation, Ball moves along the X-axis with the increase in time. Ball’s X-axis position is 4 grid units, for example, when animation time equals 4 seconds. When you rewind the animation, Ball’s position along the X-axis doesn’t return to 0 as you might assume. The previous execution of the expression at time equals 4 set the $distance variable to 4. So rewinding sets Ball.tx to 4, then sets the value of $distance to 0, the value of time upon rewinding. If you rewind again, Ball’s position along the X-axis returns to 0 as desired. Because the previous execution of the expression upon rewinding set the $distance to 0, the expression now correctly sets Ball.tx to 0. To fix this problem, reverse the order of the statements and compile the expression: $distance = time; Ball.tx = $distance;
After you play and rewind the expression, the first statement executes and assigns the time to $distance. The next statement assigns Ball.tx the value of $distance, which the first statement set to the value of time. Because $distance is set to 0 as the first statement after rewinding, Ball returns to the desired translateX position.
Increment operations If you increment an attribute or variable during animation, you might be confused by its behavior.
Example Ball.ty = 0; Ball.ty = Ball.ty + 1;
Ball’s translateY position stays at 1 unit along the Y-axis. Ball’s translateY position doesn’t increase by 1 each frame as the animation plays.
Example Ball.ty = Ball.ty + 1;
Ball’s translateY position increases by 1 each frame as you play the animation. When you rewind the animation, translateY increases by 1 again.
142
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values When you play the animation again, the translateY position increases by 1 each frame. If you rewind the animation or drag the current time indicator, the translateY position continues to move up the Y-axis. The attribute never returns to its original position. To return Ball to a starting position each time you rewind, you must initialize the attribute to a starting value. For example, you could use the following expression: Ball.ty = Ball.ty + 1; if (frame == 1) Ball.translateY = 0;
This returns Ball to a Y position of 0 when you rewind to frame 1. When you drag the current time indicator, though, Ball doesn’t return to its Y position of 0. The if statement resets the value of translateY to 0 only when frame 1 plays. Frame 1 is the default frame that plays when you rewind an animation. You would need to use a different frame number in the if statement if you’ve set your animation to start at a different frame.
Data type conversions
The following topics describe the conversions that occur in such instances. Understanding these details might help you troubleshoot unexpected attribute and variable values. Unless you have programming experience, don’t intentionally convert data types. You might be confused by unexpected attribute and variable values.
Assigning to a floating point attribute or variable If you assign a vector to a floating point attribute or variable, Maya converts the vector to a floating point value according to this equation: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components in the vector. The resulting value is the magnitude of the vector.
Using Maya: Hypergraph, Sets & Expressions
143
Expressions
Maya is flexible in its handling of data types. If you do assignment or arithmetic operations between two different data types, Maya converts data type as necessary and doesn’t report a syntax error.
Beyond the Basics Understanding unexpected attribute values
Example Ball.scaleY = <<1,2,0>>;
Maya assigns the floating point scaleY attribute the converted vector: 2
2
2
1 +2 +0 =
5 = 2.236
If you assign an integer to a floating point attribute or variable, Maya makes no conversion. None is necessary.
Example Ball.scaleY = 1;
Maya assigns the value 1 to Ball.scaleY.
Assigning to an integer attribute or variable If you assign a floating point value to an integer attribute or variable, Maya deletes the decimal part of the number. If you assign a vector to an integer attribute or variable, Maya converts the vector to an integer using the square root equation in the previous topic. However, it deletes the decimal component of the result.
Example int $pi = 3.14;
Maya assigns the integer variable $pi the value 3. int $temp = <<1,2,0>>;
Maya assigns the integer variable $temp this vector value: 2
2
2
1 +2 +0 =
5 = 2.236 ≈ 2
It deletes the decimal component .2360607. The $temp variable receives the truncated value 2.
144
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values
Assigning to a vector attribute or variable If you assign an integer or floating point value to a vector attribute or variable, Maya puts the integer or floating point value into each component of the vector.
Example vector $speed = 1.34;
Because $speed is a vector, Maya assigns it <<1.34,1.34,1.34>>.
Using mixed data types with arithmetic operators The following table lists how Maya converts data types when you use arithmetic operators between different types in an expression. Operation
Resulting data type
integer operator float
float
integer operator vector
vector
vector operator float
vector
Suppose you multiply a vector variable named $velocity by a floating point number 0.5 as follows: $race = $velocity * 0.5;
If $velocity is <<2,3,0>> when the preceding expression executes, the $race variable is assigned the resulting vector value <<1,1.5,0>>.
Using Maya: Hypergraph, Sets & Expressions
145
Expressions
Example
Beyond the Basics Understanding unexpected attribute values
Important When Maya does arithmetic operations on literal constants and variables without a declared data type, it guesses the data type based on the values present. In the statement Ball.scaleY = 1/3;, for example, Maya treats 1 and 3 as integers because they have no decimal points. The expression divides integer 1 by integer 3. The integer result is 0 with a remainder of 1. Maya discards the remainder. Because Ball.scaleY is a floating point attribute, Maya converts the integer 0 result to floating point 0 (which is the same value), then assigns it to Ball.scaleY. To get the intended result of 1/3, you must type Ball.scaleY = 1.0/3.0; Maya treats 1.0 and 3.0 as floating point numbers because they have decimal points. The number 1.0 divided by 3.0 results in 0.33333333333.
146
Using Maya: Hypergraph, Sets & Expressions
8
Particle Expressions Particle expressions are more complex than other types of expressions. For example, you can write an expression to control all particles in an object the same way, or you can control each particle differently. Execution of expressions differs for particles than for other types of objects. To become proficient with particle expressions takes more study than for other expressions, but the resulting effects are worth the effort. This chapter guides you through the intricacies of working with particle expressions.
Claude Macri
This chapter has the following topics: •
“Understanding particle expressions” on page 148
•
“Understanding creation expression execution” on page 149
•
“Writing creation expressions” on page 150
•
“Understanding runtime expression execution” on page 152
•
“Writing runtime expressions” on page 153
•
“Working with particle attributes” on page 159
•
“Assigning to vectors and vector arrays” on page 193
•
“List of particle shape attributes” on page 196 Using Maya: Hypergraph, Sets & Expressions
147
Expressions
An expression moves a particle emitter in a corkscrew pattern and changes the color of trailing emitted particles as they age. The particles are displayed as Spheres render type.
Particle Expressions Understanding particle expressions
Understanding particle expressions If you select a particle shape node, the Creation and Runtime buttons in the Expression Editor are no longer dim and you can select them.
Buttons lit for particle shapes
These buttons let you write two types of expressions: creation and runtime. You can use both types for any attribute of a particle shape node. Though the details of execution are subtle, a creation expression generally executes when you rewind an animation or when a particle is emitted. A runtime expression typically executes for each frame other than the rewind frame or the frame in which a particle is emitted. By default, either type of expression executes once for each particle in the object. Creation and runtime expressions don’t execute at the same time. The age of each particle in the object determines whether a runtime expression or creation expression executes. Execution details are in “Understanding creation expression execution” on page 149 and “Understanding runtime expression execution” on page 152. The Default Object, Always Evaluate, and Convert Units options become dim when you select a particle shape node, and you can’t use them. Default Object is dim because a particle shape node’s attributes can be controlled by only one creation expression and one runtime expression. The particle shape node is always the default object when it’s the selected object. Always Evaluate is dim for particle shape node expressions because it has no effect on particle shape node expressions. See “How often an expression executes” in Chapter 7 for details on the checkbox.
148
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Understanding creation expression execution Convert Units is not selectable because you can’t alter how Maya handles unit conversions for particle shape node expressions. See “Speeding expression execution” on page 127 for details on how Maya converts units for other types of expressions.
Important You can’t write a different expression for each particle shape attribute as you can for other types of objects. Because you can write only one creation expression per particle shape, you don’t need to select an attribute from the Expression Editor’s Attributes list.
Understanding creation expression execution For a particle you create with the Particle Tool, a creation expression executes when you rewind the animation. For an emitted particle, a creation expression executes in the frame where the particle is emitted. However, there are exceptions to these rules as described in the following topics. Note that rewinding an animation two or more times in succession without playing the animation doesn’t execute a creation expression. Because no attribute value changes when you rewind several times in succession, the expression doesn’t execute.
Setting the dynamics start frame A creation expression executes once for each particle whose age is 0 when Maya evaluates dynamics. Maya evaluates dynamics whenever the animation time changes and it’s greater than or equal to the dynamics Start Frame setting—frame 1 by default. The Start Frame specifies when dynamic calculations begin for your animation. This option is available through Settings→Dynamics Controller, in the Extra Attributes section of the Attribute Editor. The animation time changes when you rewind, play, or otherwise change the current frame displayed. An emitted particle’s age is 0 in the frame where it’s emitted.
Using Maya: Hypergraph, Sets & Expressions
149
Expressions
You might also notice that all expressions in your scene are compiled and executed each time you open the scene. This occurs for architectural reasons and is unimportant to your work with expressions.
Particle Expressions Writing creation expressions Particles created with the Particle Tool have an age of 0 on and before the Start Frame. With the default animation frame range and Start Frame, rewinding an animation to frame 1 returns such particles to age 0. If you set the Time Slider’s start frame higher than the dynamics Start Frame, be aware that rewinding the animation might cause the age of particles to be greater than 0. If this occurs, the creation rule for the particles won’t execute.
Tip You can set options in the Attribute Editor to display the age of an object’s particles in the workspace. Set the particle shape’s Render Type to Numeric, click Add Attributes For Current Render Type, and enter age in the Attribute Name box. The age appears next to each particle. You can also examine the age of an object’s particles by entering print(age+“\n”) in a particle expression. See “print” on page 261.
Setting attributes for initial state usage If, at some frame, you’ve saved a particle shape’s attributes for its initial state, rewinding an animation does not return the age of the particles to 0. Suppose you’ve created a particle grid having an opacity attribute that fades gradually as the animation plays. You stop the animation at some frame where you decide the grid’s opacity looks good as a starting point for the animation. You then choose Settings→Initial State→Set For Current to cause the current value of the object’s attributes—including age—to become the initial state values. If you rewind the animation, the age of the particles in the grid is equal to age at the time you chose Set For Current. The age of the particles therefore is not equal to 0 when you rewind the scene. See “Understanding initial state attributes” on page 162 for more details on initial state attributes.
Writing creation expressions A creation expression is useful for attributes that don’t need to change during animation. For example, you might want all particles in an object to have a single velocity for the duration of an animation.
150
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing creation expressions A creation expression is also useful for initializing an attribute’s value for the first frame before a runtime expression takes control of the attribute value in subsequent frames. See “Writing runtime expressions” on page 153 for an example of the interaction between a runtime and creation expression.
Example Suppose you’ve used the Particle Tool to place a collection of particles in the workspace. You then create the following creation expression to control their velocity: particleShape1.velocity = <<0,1,0>>;
Important To use an expression to control particle attributes, make sure the selected object in the Expression Editor is a particle shape node, not the transform node of the particle object. If a particle object’s transform node is selected rather than the particle shape node, move the mouse pointer to the workspace and press your keyboard’s down arrow. This selects the particle shape node.
Using Maya: Hypergraph, Sets & Expressions
151
Expressions
All the particles move in a Y-axis direction at one grid unit per second as the animation plays.
Particle Expressions Understanding runtime expression execution
Understanding runtime expression execution For a particle you’ve created with the Particle Tool, a runtime expression typically executes in each frame after the frame that appears upon rewinding. For an emitted particle, a runtime expression typically executes in each frame after the first one where the particle was emitted. More specifically, a runtime expression executes once for each particle whose age is greater than 0, each time Maya evaluates dynamics. Maya evaluates dynamics whenever the Time Slider time changes and the time is greater than or equal to the dynamics Start Frame. To set the dynamics Start Frame, select Settings→Dynamics Controller from the Dynamics menu bar. Time changes when you rewind, play, or otherwise change the current frame displayed. A runtime expression executes once per oversample level per frame as you play or otherwise change the animation time. For example, if the oversample level is 4, Maya executes a particle shape expression four times per frame for each particle in the object. Use Settings→Dynamics Controller from the Dynamics menu to set the Oversample Level. Maya’s default setting is 1. In addition to executing when animation time changes, a runtime expression executes when the value of an attribute it reads changes, and when either of these actions occurs for an attribute the expression writes to: •
Some other node in Maya uses its value.
•
Maya needs the value to redraw the workspace contents. In this context, the predefined variables time and frame are also considered attributes the expression reads.
Important There are no creation expressions for nodes other than particle shape nodes. Such objects have only one type of expression. (It’s similar to a runtime expression.) For a particle shape node, you can write only one runtime expression for all its attributes. You don’t need to select an attribute from the Attributes list. You can create only one runtime expression per particle shape.
152
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Writing runtime expressions A runtime expression controls an attribute as an animation plays. Maya updates any attribute that’s assigned a value in a runtime expression each time the expression executes. This typically occurs once per frame. If an attribute is not set by a runtime expression, the attribute uses the creation expression value for subsequent frames of the animation.
Example Suppose you’ve created a grid of particles, then create this runtime expression for its velocity attribute: particleShape1.velocity = <<0,1,0>>;
The expression moves the grid of particles up at 1 grid unit per second as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
Expressions
Constant upward velocity
153
Particle Expressions Writing runtime expressions
Note To make the illustrations of particles easier to see in this and other chapters, we show them as small, shaded spheres rather than points.
To display particles as spheres: 1
Select the particle shape node.
2
In the Attribute Editor’s Render Attributes section, choose Spheres for the Render Type.
3
Click the Current Render Type button next to Add Attributes For. A Radius slider appears below the button.
4
Adjust the Radius to set the size of the spheres.
5
Turn on Shading→Smooth Shade All (at the upper left of the workspace).
With the default frame rate of 24 frames/second, the particles move 1/24 of a grid unit each frame. With the default oversampling level of 1, the runtime expression executes once per frame. Maya calculates the runtime expression once for each particle of an object. Because the expression sets the velocity to <<0,1,0>> each frame, the expression executes redundantly. This expression would therefore be more appropriate for a creation expression. However, either type of expression has the same effect in this example.
Example Suppose you’ve created a grid of particles, and your animation’s starting frame number is 0. You create this runtime expression for its velocity attribute: particleShape1.velocity = <<0,time,0>>;
The expression increases the Y component of velocity with the increasing value of time as the animation plays. This makes all particles in the grid rise with increasing velocity as the time increases. An increasing velocity is the same as acceleration.
154
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Increasing upward velocity
You need to use the statement in a runtime expression rather than a creation expression, because you’re increasing a value in the assignment each frame. Using the statement in a creation expression would instead set the velocity to a constant value <<0,0,0>>, because time equals 0 when the creation expression executes for the particle grid.
Example The previous examples gave all particles the same value for the velocity attribute. You can instead give each particle a different value for an attribute. Expressions
Suppose you’ve created a grid of 121 particles.
Suppose further you create this runtime expression for its acceleration attribute: particleShape1.acceleration = sphrand(2);
Using Maya: Hypergraph, Sets & Expressions
155
Particle Expressions Writing runtime expressions The expression executes once for each of the 121 particles each time the runtime expression executes. The sphrand(2) function provides a vector whose randomly selected components reside within an imaginary sphere centered at the origin and with a radius of 2. Each particle receives a different vector value. For details on the sphrand function, see “sphrand” in Chapter 9. Because each particle receives a different random vector for its acceleration each frame, the particles accelerate individually in a constantly changing direction and rate as the scene plays. This gives the acceleration abrupt changes in direction.
Important To give particles a constant acceleration, assign the acceleration attribute a constant value in a runtime expression rather than in a creation expression. Maya simulates the physics of acceleration. It initializes acceleration to <<0,0,0>> before each frame, or if the oversample level is greater than 1, before each timestep. If the oversample level is 2, there are 2 timesteps per frame. If the oversample level is 3, there are 3 timesteps per frame, and so on.
156
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Example Suppose you’ve set your animation’s starting frame to 0, and you’ve used the Particle Tool to place a single particle at the origin:
You then create a runtime expression to control its position: particleShape1.position = <<3,time,0>>;
When you play the animation, the runtime expression takes control of the attribute. In the first frame that plays, the particle jumps to <<3, time, 0>>. At the default frame rate of 24 frames/second, the position is <<3, 0.0417, 0>>, because the value of time is 0.0417. Expressions
Using Maya: Hypergraph, Sets & Expressions
157
Particle Expressions Writing runtime expressions Each subsequent frame moves the particle upward at a rate set by the incrementing value of time.
When you stop and rewind the animation, the particle moves back to the origin, the particle’s original position when you created it with the Particle Tool. When you created the particle, Maya stored its original position in an internally maintained initial state attribute named position0. For details, see “Understanding initial state attributes” on page 162. Because the attribute has no creation expression controlling its value, Maya sets the attribute to its initial state position0 value of <<0,0,0>>. To prevent the particle from jumping back to the origin after rewinding, you can write a creation expression that’s the same as the runtime expression: particleShape1.position = <<3,time,0>>;
When you rewind the animation, the particle moves to position <<3,time,0>>. Because time is 0 at frame 0, the particle starts at position <<3,0,0>> when you rewind the animation. In the second and following frames, it moves upward synchronized with the increasing value of time. Though this example showed how to initialize the position attribute with a creation expression, you could have gotten almost the same result by saving the object’s current attribute values for initial state usage:
To save the current attributes for initial state usage: 1
Select the particle shape node.
2
Advance the animation to frame 1. Here the position of the particle is <<3, 0.0417, 0>>.
3
158
Select Settings→Initial State→Set for Current.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes When you rewind the animation, Maya positions the object at the initial state setting of its position attribute. This setting is <<3, 0.0417, 0>> because you selected Set for Current while the position was equal to <<3, 0.0417, 0>>.
Working with particle attributes When you create a particle object, it has two types of static attributes: •
attributes for its transform node
•
attributes for its particle shape node These attribute are permanently part of a particle object. You typically won’t work with the static attributes that are part of its transform node, for example, scaleX, translateX, and so on. These attributes control the position and orientation of the transform node of the entire particle object, not the position and orientation of the individual particles. You’ll instead work with the static attributes of the particle shape node, for example, position, velocity, acceleration, and age. These attributes appear in the Attributes list of the Expression Editor’s when you choose Object Filter→Dynamics→Particles for the selected particle object.
Adding dynamic attributes
When you add a dynamic attribute to an object, the attribute names appear in the Expression Editor’s Attributes list.
Note See “List of particle shape attributes” on page 196 for attributes you can use with particle objects.
Using Maya: Hypergraph, Sets & Expressions
159
Expressions
You also use expressions to control dynamic and custom attributes you add to a particle shape node. See “Attributes” in Chapter 5 for details on the differences between static, dynamic, and custom attributes. See “Assigning to a custom attribute” on page 169 for details on working with custom attributes.
Particle Expressions Working with particle attributes
Understanding per particle and per object attributes You can dynamically add two types of attributes to a particle shape node: •
per particle
•
per object A per particle attribute lets you set the value of the attribute individually for each particle of the object. A per object attribute lets you set the attribute value for all particles of the object collectively with a single value. For example, a per particle opacityPP attribute lets you set a unique opacity value for each particle of an object. With a per object opacity attribute, you must give all particles of the object the same opacity. A per particle attribute holds the attribute values for each particle in the object. For example, though there is only one opacityPP attribute in a particle object, the attribute holds the value for each particle’s opacity value. The attribute holds the values in an array. In simple terms, an array is a list. Though per particle attributes are best for creating complex effects, you can’t keyframe them. You can keyframe per object attributes. You can add per particle or per object attributes for opacity, color, lifespan, and other effects. For a particle shape node attribute, you can tell whether it’s a per particle or per object attribute by examining the Attribute Editor’s particle shape folder. All per particle attributes appear in the Per Particle (Array) Attributes section of the folder. The per object attributes appear elsewhere in the folder. Most appear above the Per Particle (Array) Attributes section, for example, in the Particle Attributes and Render Attributes sections. For many dynamically added attributes, you can also tell whether they are per particle or per object by their names in the Expression Editor. If a name ends with PP, it’s per particle. Otherwise, it’s usually per object. Note that position, velocity, and acceleration are per particle attributes, though their names don’t end with PP.
160
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes The most common way to create dynamic per object or per particle attributes for a particle shape is by clicking one of the following buttons in the Add Dynamic Attributes section of the Attribute Editor:
For example, if you click the Opacity button, a window appears and lets you choose whether to add the opacity characteristic as a per object attribute or a per particle attribute. If you choose per particle, the Attributes list of the Expression Editor displays a new attribute for the selected particle shape node: opacityPP. If you choose per object, an opacity attribute is displayed instead. For attributes other than lifespan, if you add both a per particle attribute and a per object attribute for a characteristic, the per particle attribute takes precedence. For instance, if you add opacity and opacityPP, the opacityPP attribute controls the opacity of the particles of the specified object. When you click Lifespan and add both a per particle and per object attribute, Maya adds an additional attribute named useLifspanPP that lets you choose whether lifespanPP or lifespan controls the characteristic.
If you click the Goal button in the Add Dynamic Attributes section of the Attribute Editor, Maya adds a per object attribute and a per particle attribute. The attributes are named goal and goalPP. Neither attribute has precedence. Maya multiplies the value of the per object goal attribute by the per particle goalPP attribute to create the final goal effect for each particle.
Using Maya: Hypergraph, Sets & Expressions
161
Expressions
By default, the Attribute Editor setting of useLifespanPP is on, so the lifespanPP attribute control the characteristic. If you turn useLifespanPP off in the Attribute Editor, lifespan controls the characteristic.
Particle Expressions Working with particle attributes
Important You can use per particle attributes only in particle expressions. You can use per object attributes in particle or nonparticle expressions. If you use a runtime expression to read or write a per object attribute of a particle object with many particles, you can speed up expression execution by reading or writing the attribute in a nonparticle expression. Nonparticle expressions execute only once per object. Particle expressions execute once for each particle in the object. Because reading or writing a per object attribute more than once per frame is redundant, you can save processing time by working with them in nonparticle expressions.
Understanding initial state attributes For all static per particle attributes, Maya keeps a corresponding attribute with a name ending in 0. For example, the static attributes position, velocity, and acceleration have counterparts position0, velocity0, and acceleration0. An attribute name that ends in 0 holds the initial state value of the attribute. When you save a particle object’s current attribute values for initial state usage, Maya assigns those values to the initial state attributes. To save a particle object’s attribute values for initial state usage, use either of these commands: •
Settings→Initial State→Set for Current This saves all per particle attribute values for the selected particle shape node or rigid body.
•
Settings→Initial State→Set for All Dynamic This saves all per particle attribute values for all dynamic objects in the scene—in other words, all particle shape nodes and rigid bodies. When you dynamically add a per particle attribute by clicking one of the buttons in the Add Dynamic Attributes section of the Attribute Editor, Maya also adds a corresponding initial state attribute with name ending in 0. For example, when you click the Lifespan button in the Attribute Editor, Maya adds lifespanPP0. Though an initial state attribute doesn’t appear in the Expression Editor, you can read its value to retrieve the initial state.
162
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes When you use the Add Attribute window to add a custom per particle (array) attribute to a particle shape, you must choose whether you want to add it with Add Initial State Attribute on or off. If you choose on, Maya creates a corresponding initial state attribute for the added attribute. If you choose off, Maya doesn’t create a corresponding initial state attribute for the added attribute. Without this corresponding attribute, you can’t save a particle object’s current attribute values for initial state usage. You must write a creation expression if you decide to initialize the custom attribute’s value upon rewinding the animation.
Note A per particle attribute is called an array attribute in the Add Attribute window. The two terms have the same meaning. See “Assigning to a custom attribute” on page 169 for details. You can see whether a custom attribute was added with Add Initial State Attribute on or off by using the MEL listAttributes command. (See the online MEL documentation for details.)
When you add a custom attribute to a particle shape, do not end the name with a 0 character. You’ll subvert Maya’s naming scheme for the initial state attribute associated with an attribute. For any attribute, if you don’t initialize its value with a creation expression or save its value for initial state usage, Maya gives the attribute a default value at the animation’s first frame. It typically assigns the attribute the value 0 or <<0,0,0>>, as appropriate for the data type. In other cases, for instance, opacityPP and opacity, Maya assigns the attribute a default value of 1. If you know you’re going to write a creation expression for a custom attribute, you can set Add Initial State Attribute off when you add the attribute. Otherwise, set Add Initial State Attribute on whenever you add a custom attribute. When a creation expression assigns a value to an attribute, the value overrides the attribute’s initial state value for all particles whose age is 0.
Using Maya: Hypergraph, Sets & Expressions
163
Expressions
You might want to read the value of an initial state attribute in an expression, for instance, to use its original (rewind) value for some calculation. If you assign a value to an initial state attribute. Maya will overwrite the value if you save the attribute value for initial state usage.
Particle Expressions Working with particle attributes
Example of assigning to a dynamic per particle attribute Suppose you’ve used the Particle tool to create a small number of particles named Bubbles:
The following steps show how to assign a different lifespanPP value for each of the particles to make them disappear as the scene plays.
To use a per particle lifespanPP attribute: 1
Select the particle shape node for Bubbles in the Outliner or Hypergraph.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Lifespan button. A window appears that prompts you to choose whether to add the attribute per object or per particle.
3
Select Add Per Particle Attribute, then click the Add Attribute button. This adds a lifespanPP attribute to the particle shape node for Bubbles. You can set this attribute to give each particle a different value for how long it lives.
4
Select Bubble’s particle shape node in the Expression Editor.
5
Turn on Creation in the Expression Editor.
6
Create the following expression: BubblesShape1.lifespanPP = rand(5); print("Hello\n");
7
164
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Because lifespanPP is a per particle attribute and the object’s particle shape node is selected in the Expression Editor, the expression does an execution loop of both statements once for each particle in the object. Because the expression is a creation expression, it executes after the expression compiles. It also executes when you rewind the animation after playing it. For each of the particles, the first statement assigns the lifespanPP attribute a random floating point number between 0 and 5. The rand function returns a different random number each time it executes, so each particle has a different lifespanPP value between 0 and 5. For details on the rand function, see chapter 9, “Functions.” The second statement displays Hello in the Script Editor, once for each particle. The creation expression gives each particle a random lifespanPP of less than 5 seconds. The particles disappear from the scene at random times between 0 and 5 seconds of scene play. (Maya gives particles created with the Particle tool an age of 0 in the first frame of the animation.)
Expressions
Particles remaining after three seconds, with creation expression for lifespanPP.
When you rewind the animation, the particles reappear in the scene. Playing the scene again makes them disappear at random times within 5 seconds.
Using Maya: Hypergraph, Sets & Expressions
165
Particle Expressions Working with particle attributes It’s important that you use a creation expression for this effect. If you were to use a runtime expression, the particles would disappear more quickly as the animation plays, and Hello would appear 100 times each frame. The reason for this is subtle: In each frame, a runtime expression would assign a different random value between 0 and 5 seconds to the lifespanPP of each particle. The expression would likely assign one or more of the particles a lifespanPP near 0. Meanwhile, the age of each particle increases from 0 at the first frame of play. Maya checks the age of each particle every frame. If the age is greater than the lifespanPP value, Maya removes the particle. Because the expression would reassign new random lifespanPP values to each remaining particle in each frame, the new assignments would likely give a few particles a lifespanPP that’s less than their current age value. Maya deletes such particles. This causes the object’s particles to disappear quickly from the scene.
Particles remaining after one second, with runtime expression for lifespanPP.
166
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Example of assigning to a dynamic per object attribute Suppose you’ve used the Particle tool to create the same Bubbles particle object described in the previous topic.
The following steps show how to give the particles a single lifespan. All particles disappear at the same time when you play the scene.
To use a per object lifespan attribute: Select the particle shape node for Bubbles in the Outliner or Hypergraph.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Lifespan button. A window appears that prompts you to choose whether to add the attribute per object or per particle.
3
Select Add Per Object Attribute, then click the Add Attribute button. This adds the lifespan attribute to the particle shape node for Bubbles.
4
In the Expression Editor, turn on Creation.
5
Create this creation expression: BubblesShape1.lifespan = 1.33; print("Hello\n");
Because this is a creation expression, it executes after the expression compiles. It also executes when you rewind the animation after playing it.
Using Maya: Hypergraph, Sets & Expressions
167
Expressions
1
Particle Expressions Working with particle attributes For each of the 100 particles, the first statement assigns the lifespan attribute the value 1.33. The second statement displays Hello in the Script Editor once for each particle. 6
Play the animation. Because all particles have a lifespan of 1.33, they disappear from the scene after 1.33 seconds of animation play. When you rewind the animation, the particles reappear in the scene. Playing the scene again makes them disappear again after 1.33 seconds.
1.32 seconds of animation
1.33 seconds of animation
If you had put the preceding statements in a runtime expression, the particles would still disappear in 1.33 seconds. The expression would assign a lifespan of 1.33 seconds to all 100 particles redundantly each frame. The age of the particles is 0 in the first frame of their creation. (Maya gives particles created with the Particle tool an age of 0 in the first frame of the animation.) Reassigning lifespan 1.33 each frame has no effect on the age of the particles. Their age increases from the first frame regardless of the lifespan value. Note that, unlike particles created with the Particle Tool, the age of emitted particles starts in the frame where they’re emitted.
168
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Assigning to a custom attribute You can add a custom attribute to a particle shape node and control its value in an expression.
To add a custom attribute: 1
Select the object’s particle shape node rather than its transform node. Use the Hypergraph or Outliner to select the shape node.
2
Choose Modify→Add Attribute. or In the Add Dynamic Attributes section of the Attribute Editor, click the General button. The Add Attribute window appears:
Expressions
3
Enter a name for the attribute in the Attribute Name box.
Using Maya: Hypergraph, Sets & Expressions
169
Particle Expressions Working with particle attributes 4
Make sure Make attribute keyable is on.
5
Select one of the following data types:
6
•
Vector
Creates a vector attribute consisting of three floating point values.
Float
Creates a floating point attribute.
Integer
Creates an integer attribute.
Boolean
Creates an attribute consisting of an on/off toggle.
Select one of the following attribute types: Scalar
Creates a per object attribute that you can set to a single value that applies to every particle in the object. A vector scalar is considered a single value with three numbers.
Array
Creates a per particle attribute. You can set this type of attribute to different values for each particle.
If you select Scalar, you can specify Minimum, Maximum, and Default values for a Float or Integer attribute. Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value displayed for the attribute. Because you’re going to control the attribute’s value with an expression, you might want to skip entering values for these options. An expression isn’t bound by the Minimum and Maximum values. The attribute receives whatever value you assign it in the expression. The expression can read the attribute’s Default value or any other value you give it in the Attribute Editor or Channel Box. When you select Scalar, you can’t create a counterpart initial state attribute by turning on Add Initial State Attribute.
•
If you select Array, you can also create a counterpart initial state attribute by turning on Add Initial State Attribute. See “Understanding initial state attributes” on page 162 for details. You can’t set Minimum, Maximum, or Default values for an Array attribute.
7
170
Click Add if you want to add more attributes. Click OK to add the attribute and close the Add Attribute window.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes The new attribute appears under the Dynamic Attributes section of the Attribute Editor.
To assign values to a custom attribute: You can assign values to a custom attribute with the same techniques you use to assign values to static or dynamic attributes.
Example Suppose you’ve created a 100-particle object named sunspot, and you add to its particle shape node a vector per object attribute named glow. You assign the glow attribute a vector value in a creation expression as follows: sunspotShape1.glow = <<3,0,0>>; print(sunspotShape1.glow + "\n");
When you rewind the animation, the glow attribute of sunspotShape1 receives the value <<3,0,0>>. The print statement displays the values in the Script Editor.
Example
float $randomNumber = rand(1); sunspotShape1.heat = <<$randomNumber,0,0>>; print(sunspotShape1.heat + "\n");
When you rewind the animation, the expression loops through 100 executions, once for each particle. The first statement sets the $randomNumber variable to a random number between 0 and 1. The next statement assigns a vector to the heat attribute of a single particle. The left component of the vector assigned to heat is a different random number each time the statement executes. The middle and right components are always 0. One particle might have the value <<0.57, 0, 0>>, another <<0.32, 0, 0>>, another <<0.98, 0, 0>>, and so on. The print statement displays the values in the Script Editor.
Using Maya: Hypergraph, Sets & Expressions
171
Expressions
Suppose you add a vector per particle attribute named heat to the 100particle sunspot shape node. You can give each particle a different value as in this creation expression:
Particle Expressions Working with particle attributes
Note If you add a custom vector attribute to an object, Maya displays the attribute in the Attribute Editor, but you can’t enter its value there. You must enter a value for it in an expression or with the Component Editor available from the Attribute Editor.
Assigning to a particle array attribute of different length You can assign the array attribute of one particle shape node to another node having a different number of particles. The assignment is affected by which node you select in the Object Selection list in the Expression Editor. The number of particles in the selected particle shape node sets the number of statement executions, and, therefore, affects the assignment.
Example Suppose your scene contains an object named ThreePts made of three particles and an object named TwoPts made of two particles. The three particles in ThreePts are at these positions: -5 0 0 -4 0 0 -3 0 0
The two particles in TwoPts are at these positions: 5 0 0 6 0 0
172
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Suppose you write this runtime expression with TwoPtsShape2 selected in the Object Selection list: ThreePtsShape1.position = TwoPtsShape2.position; print(ThreePtsShape1.position+"\n");
In the first frame of runtime expression execution, this assigns the position attribute of TwoPts to the position attribute of ThreePts. In other words, the expression repositions the three particles to the position of the two particles. Because you selected TwoPtsShape1 in the Object Selection list, the expression will execute once for each of its two particles. When you play the scene, the runtime expression executes. The first particle of ThreePts now is at the position of the first particle of TwoPts. The second particle of ThreePts is at the position of the second particle of TwoPts. The third particle of ThreePts doesn’t change position. The expression executes only twice each frame. In summary, the particles in ThreePts are at these positions: 5 0 0 6 0 0 -3 0 0
Expressions
Suppose you write the preceding runtime expression instead with ThreePtsShape1 selected in the Object Selection list. Again, the expression repositions the three particles to the position of the two particles. Because you selected ThreePtsShape1 in the Object Selection list, the expression executes once for each of its three particles. When you play the scene, the runtime expression executes. The first particle of ThreePts moves to the position of the first particle of TwoPts. The second particle of ThreePts moves to the position of the second particle of TwoPts. Using Maya: Hypergraph, Sets & Expressions
173
Particle Expressions Working with particle attributes Because TwoPts lacks a third particle, the third particle of ThreePts is repositioned at the position of the first particle of TwoPts. You can’t see this in the workspace because the particles are in the exact same position. The three particles in ThreePts are at these positions: 5 0 0 6 0 0 5 0 0
As this example shows, the assignment statement executes three times. When it runs out of counterpart particles to assign to, it loops around and assigns to the previous particles. It starts with the first particle in the object, and continues through the other particles. For example, suppose you create a five-particle object named FivePts with the Particle Tool, and position the particles somewhere in the workspace. Suppose further you select the particle shape node of FivePts in the Expression Editor, then make this assignment in a runtime expression: FivePtsShape1.position = TwoPtsShape2.position;
The five particles move to these positions as soon as the runtime expression executes for the first time: 5 6 5 6 5
0 0 0 0 0
0 0 0 0 0
Using creation expression values in a runtime expression A runtime expression can’t read a variable you’ve defined in a creation expression unless you define the variable as global. However, you can create a custom attribute, assign it a value in a creation expression, then read or write its value in a runtime expression.
174
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes For example, suppose you assign a particle object’s position to a variable named $oldposition in a creation expression: vector $oldposition = particleShape1.position;
The runtime expression for the same particle shape node can’t read the contents of the $oldposition variable. To solve this problem, you can create an attribute for the object, assign it a value in the creation expression, then use the attribute value in a runtime expression. For example, suppose you create an attribute named oldpos, and assign it the following position in a creation expression: particleShape1.oldpos = particleShape1.position;
You can read the value of particleShape1.oldpos in a runtime expression. Note that you don’t need to create an attribute to hold the object’s initial position. The initial position already exists in its initial state attribute named position0. This attribute doesn’t appear in the Expression Editor’s Attributes List.
Working with position, velocity, and acceleration
Unless you have a solid grasp of physics, avoid setting a combination of the position, velocity, and acceleration attributes. To give a smooth, random motion to particles with a runtime expression, use a random number function such as sphrand to assign random numbers to the particle shape’s acceleration attribute. A change in acceleration always gives smooth motion no matter how abruptly its value changes. To give a jittery random motion to particles with a runtime expression, use a random number function such as sphrand to assign random numbers to the particle shape’s velocity or position attributes. See “Random number functions” on page 239 for details on how to use random number functions. If an expression and a dynamic field control an object’s position, velocity, or acceleration, Maya calculates the expression’s effect first, then adds the field’s effect.
Using Maya: Hypergraph, Sets & Expressions
175
Expressions
To create various types of particle motion, you can assign vector values to the position, velocity, or acceleration attribute. See “Writing runtime expressions” on page 153 for examples of working with these attributes.
Particle Expressions Working with particle attributes
Example Suppose a particle drops under the influence of a gravity field with default gravity options. Gravity accelerates the particle at 9.8 units per second per second down the Y-axis. In other words, the default acceleration of gravity is <<0,-9.8,0>>. Suppose further you write the following runtime expression for the particle: velocity = velocity + <<1,0,0>>;
As each frame plays, Maya first calculates the particle’s velocity from the expression statement. The velocity increases 1 unit per second in an X-axis direction. Maya then adds the gravitational acceleration to the velocity. Maya uses the combined result to compute the particle’s position. Of course, you won’t see this calculation process. The frame displays the particle in the appropriate position after all computation. Note that the expression adds the constant <<1,0,0>> to the particle’s velocity each frame as the animation plays. This makes the particle move with increasing velocity in an X direction as the time increases. An increasing velocity is the same as acceleration. The ball represents the particle’s position after several frames. The white squares represent the particle’s position as time increases.
Gravity alone
176
Using Maya: Hypergraph, Sets & Expressions
Gravity in combination with velocity = velocity + <<1,0,0>>
Particle Expressions Working with particle attributes The acceleration attribute works differently than the position or velocity attributes in an important way. Maya initializes its value to <<0,0,0>> before each frame. If the oversample level is greater than 1, this initialization occurs before each timestep.
Example Suppose you write the following runtime expression for a five-particle object unaffected by gravity: acceleration = acceleration + <<0,1,0>>;
Rather than adding <<0,1,0>> to the acceleration value each frame, acceleration remains a constant <<0,1,0>> for each of the particles. This happens because Maya initializes the value of acceleration to <<0,0,0>> before each frame. Suppose you connect the particle object to gravity with default settings. The acceleration of the particle becomes <<0,1,0>> plus <<0,-9.8,0>>, which equals <<0,-8.8,0>>. The acceleration assigned in the expression slows the downward acceleration of the gravity. Suppose you change the previous expression to this: acceleration = acceleration + sphrand(3);
acceleration = sphrand(3);
As each frame plays, Maya first calculates each particle’s acceleration from the expression statement. Each particle receives the result of the sphrand(3) function. The sphrand(3) function provides a vector whose randomly selected components reside within a spherical region centered at the origin with radius 3. Each particle receives a different vector value. Finally, Maya adds gravity’s acceleration to the expression acceleration resulting from sphrand(3). The frame displays each particle in the resulting position. Because of the random values resulting from the expression, each particle has an acceleration that differs slightly from gravity in direction and magnitude. Because the sphrand(3) function executes for each particle each frame, the acceleration of each particle varies each frame.
Using Maya: Hypergraph, Sets & Expressions
177
Expressions
Because Maya sets acceleration to <<0,0,0>> before each frame, the statement has the same result as the following statement:
Particle Expressions Working with particle attributes
Gravity in combination with acceleration = sphrand(3)
Position at rewind
Gravity alone (shown for comparison) Position after one second
This example shows that you can take advantage of the additive effect of fields and the acceleration attribute to create custom field effects.
Tip You can turn off the effect of all fields on a particle shape node attribute by setting its dynamicsWeight attribute to 0.
Working with color Coloring particles is a fundamental task for expression writers. As the techniques for coloring particles are easiest to learn by example, we provide the following lesson.
Example Suppose you’ve used the Particle tool to create a randomly positioned collection of particles named Bubbles. You can use a creation expression to give the particles a constant color during animation play.
178
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
To give the particles a constant color: 1
Select the particle shape node for Bubbles in the Hypergraph or Outliner. To write an expression to color particles, you must dynamically add the attribute that lets you color them.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Color button.
3
Select Add Per Particle Attribute, then click the Add Attribute button. This adds an rgbPP attribute to the particle shape node for Bubbles. Because you’re adding this attribute as a per particle attribute, you can give each particle a different color.
4
Choose Shading→Smooth Shade All. This step is necessary to make the correct particle color appear when you assign the rgbPP attribute a value in an expression.
5
In the Expression Editor, select Bubble’s particle shape node.
6
Turn on Creation in the Expression Editor. Because you’ll give the particles a color that doesn’t change during the animation, you use a creation expression.
7
Enter this expression: BubblesShape1.rgbPP = <<1,0,0>>;
Using Maya: Hypergraph, Sets & Expressions
179
Expressions
A window appears that prompts you to choose whether to add the attribute per object, per particle, or connected to a shader.
Particle Expressions Working with particle attributes When you click the Create button in the Expression Editor, Maya checks the syntax of the expression. Assuming you made no typing errors, the expression executes once for each of the 100 particles. The expression colors all particles in the object red. The double angle brackets << and >> enclose a vector that sets the red, green, and blue components of the rgbPP attribute to 1, 0, and 0. In the RGB color scheme, this gives the object a red color. 8
Play the animation. Because the expression is a creation expression, it executes when you rewind the animation. The particles remain red for entire animation because the red color is never changed by a runtime expression.
Tip See the online version of this documentation for colored illustrations. The following steps show how to give the particles a randomly changing color as the animation plays.
To give the particles a randomly changing color: 1
With BubblesShape1 selected in the Expression Editor, turn on Runtime.
2
Enter this runtime expression: BubblesShape1.rgbPP = sphrand(1);
180
3
Click the Create button to compile the expression.
4
Rewind the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Because the creation expression executes when you rewind, the particles are red. 5
Play the animation. The runtime expression takes control of the rgbPP attribute. Because rgbPP is a per particle attribute, the runtime expression executes for each particle in the object each frame. For each particle, the expression assigns the rgbPP attribute the output from the execution of the sphrand function with an argument of 1. The sphrand function assigns each particle’s rgbPP color a random vector. The vector represents a random point in a spherical region of radius 1. The left, middle, and right rgbPP color components have a value no less than -1 and no greater than 1. Values less than 0 are treated as 0. The sphrand function returns a different random vector each execution. So each particle has a different random rgbPP value, and therefore, a different color. The color of each particle changes each frame.
You can slow the change of colors to create a flashing Christmas light effect. The following steps make the particles change colors every second of animation.
To slow the change of color: 1
Change the runtime expression to this: if ((frame % 24) == 0) BubblesShape1.rgbPP = sphrand(1);
Using Maya: Hypergraph, Sets & Expressions
181
Expressions
If you rendered the animation and played it back at 24 frames per second, you would have trouble seeing the color of a particle in any instant because the color changes so quickly.
Particle Expressions Working with particle attributes This expression uses the modulus operator (%) to control when the rgbPP attribute of the particles receives a random color. The modulus operator returns the remainder after division. For example, 24 divided by 24 returns 0, but 25 divided by 24 returns 1. (Dividing 25 by 24 equals 1 with a remainder of 1.) If the value of frame divided by 24 is equal to any number with a remainder of 0, the assignment to BubblesShape1.rgbPP occurs. In other words, the assignment occurs when frame equals 24, 48, 72, and so on. At an animation rate of 24 frames/second, the assignment happens once each second.
Important Avoid using the modulus operator with floating point values. Because of number rounding in floating point division, you won’t likely get a return value of exactly 0 with the modulus operator. Instead use an integer value when possible. 2
Rewind and play the animation. When you rewind the animation, the particles turn red because the creation expression executes. When the animation plays, the particles receive a random color once each second.
1 second
2 seconds
3 seconds
Note that you can change the red rewind color to random colors by changing the creation expression to this: BubblesShape1.rgbPP = sphrand(1);
This is the same expression as the runtime expression.
182
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Working with emitted particles If you make an object emit particles, you can write a creation or runtime expression for attributes of the emitted particles. For example, you can assign the emitted particles a value for lifespan, opacity, and color.
To write an expression for emitted particles: 1
Create the emitter.
2
Add the desired dynamic attribute to the emitter shape node.
3
Select the shape node of the emitted particles in the Expression Editor, then write the expression to control the attribute.
Example Suppose you’ve created an emitter and added a per particle lifespanPP attribute to it. The following creation expression gives the emitted particles a lifespan of 2 seconds: particleShape1.lifespanPP = 2;
Each particle disappears two seconds after it’s emitted.
Important Expressions
Avoid assigning a per particle attribute to another object’s per particle attribute if the particles of either object die. As particles die, the order of expression evaluation changes for the object’s particles. This causes unexpected results. You can, though, assign from one attribute to another in the same object with dying particles. The array indexes of the different attributes are in synch with each other. For example, don’t write an expression like this: emittedShape1.lifespanPP = 2; emittedShape1.rgbPP = otherParticleShape2.rgbPP
Working with collisions If you make a particle object collide with an object, you can write an expression to trigger expression statements after the collision. For example, you can change the color, opacity, or lifespan of the colliding particles.
Using Maya: Hypergraph, Sets & Expressions
183
Particle Expressions Working with particle attributes
To prepare for writing the expression: 1
Select the particle shape node of the particles in the Outliner or Hypergraph.
2
Select Settings→Particle Collision Events from the Dynamics menu bar. The Particle Events window appears.
3
Click Create Event. This adds an event attribute to the selected particle shape node. The Expression Editor displays the added event attribute in the Attributes list. Close the Particle Events window.
To write the expression: 1
Select the particle shape node of the emitted particles.
2
Write the runtime or creation expression using the value of any of these attributes of the emitted particle’s shape node: Long name
Short name
event
Description
Data Type
Contains the number of times each particle in the object has hit something (on a per particle basis).
float array
eventCount
evc
Total number of events that have occurred for all particles of the object.
integer
eventTest
evt
True if an event has occurred since the last time an expression or MEL getAttr command read the eventTest value.
boolean
The eventCount and eventTest are static attributes. A particle shape node has them as soon as you create the particle object. Though they don’t appear in the Expression Editor, you can use their values in an expression. You must first create the event attribute as described previously.
184
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Example Suppose you’ve created a five-particle object named Peas that falls with gravity and collides with a plane.
You can make the particles turn red when the first particle hits the plane. Select PeasShape1 in the Outliner or Hypergraph.
2
From the Dynamics menu bar, select Settings→Particle Collision Events.
3
In the Particle Events window, click Create Event, then close the window. This adds an event attribute to PeasShape1.
4
In the Add Dynamic Attributes section of the Attribute Editor, click Color. The Particle Color window appears.
5
Select Add Per Particle Attribute, then click Add Attribute. This adds a per particle attribute named rgbPP. This attribute controls the red, green, and blue color scheme of each particle. The particles turn black after you add the rgbPP attribute. Adding the rgbPP attribute turns off the default coloring of the particles and gives them a value of <<0,0,0>>.
6
Choose Shading→Smooth Shade All. This step is necessary to make the correct particle color appear when you assign the rgbPP attribute a value in an expression.
Using Maya: Hypergraph, Sets & Expressions
185
Expressions
1
Particle Expressions Working with particle attributes 7
With PeasShape1 selected in the Expression Editor, create this runtime expression: if (event == 1) rgbPP = <<1,0,0>>; else if (event == 2) rgbPP = <<0,1,0>>; else if (event >= 3) rgbPP = <<0,0,1>>; else rgbPP = <<1,1,1>>;
8
Rewind the animation. Upon rewind, the particles are black. The particles have the default black rgbPP color because no creation expression exists for the object.
9
Play the animation. The particles fall toward the plane. The runtime expression executes as each frame plays. The event attribute is a per particle attribute. This isn’t obvious because its name doesn’t have PP as the last two characters. Because event holds a running count of collisions for each particle, event contains 0 for each particle until the first collision with the plane. Until the first collision occurs, the final else statement executes: else rgbPP = <<1,1,1>>;
This statement executes because event doesn’t equal 1, 2, 3, or a number greater than 3. The vector <<1,1,1>> in the RGB color scheme represents the color white. When the first particle of PeaShape1 hits the plane, Maya sets the event attribute for that particle to 1. This triggers execution of the first assignment, which sets the colliding particle’s rgbPP value to <<1,0,0>>. In the RGB color scheme, this vector value represents red. (When red equals 1, green equals 0, and blue equals 0, the resulting color is red.)
186
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Red particle after collision
Tip See the online version of this documentation for colored illustrations. Note that the value of the event attribute reflects the collision count in the frame after each collision. For example, if a particle collides with the plane in frame 10, event is updated in frame 11. Expressions
When the other particles hit the plane for the first time, they also turn red after they collide.
A particle stays red until it collides with the plane for the second time, when event equals 2. After a second collision, the particle turns green.
Using Maya: Hypergraph, Sets & Expressions
187
Particle Expressions Working with particle attributes After a third collision, when event is equal to or greater than 3, a particle turns blue. Each particle stays blue for all subsequent collisions as the animation plays.
10 Rewind the animation. The particles turn black again because they receive the default rgbPP value <<0,0,0>>. When you play the animation again, the particles turn white, red, green, and blue in the same sequence as before. You can refine the animation by giving the particles a color other than black for the frame that appears upon rewinding. For example, you can give the particles a white color upon rewinding with two techniques: •
Write this creation rule for PeasShape1: rgbPP = <<1,1,1>>;
This statement executes for each particle in the object, so they all receive the same white color when you rewind the scene. •
Select PeasShape1, rewind the animation, and play one frame.
11 Choose Settings→Initial State→Set for Current. This saves all PeasShape1 attribute values from the current frame for the initial state of the attributes. The current value for rgbPP will be used when you rewind the animation. Because you played the second frame of the animation, this saves the white color of the particles at that frame for use upon rewinding the animation.
188
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Note that Set for Current saves all attribute values, including position, velocity, acceleration, and so on. In cases where you have several changing attribute values during playback, Set for Current might save undesired attribute values in addition to the desired ones. In such cases, use a creation expression.
Working with specific particles A per particle attribute holds the attribute values for each of an object’s particles. For example, the rgbPP attribute holds the value for each particle’s rgbPP value. Each particle has a unique numerical particle identifier. A particle’s identifier is stored in a per particle particleId attribute for the particle object. As you create the particles of a particle object, Maya assigns each particle a particleId in sequential order starting at 0. For example, suppose you use the Particle tool to create a five-particle object by clicking positions in the workspace. The first click of the mouse creates a particle with particleId 0, the second click creates a particle with particleId 1, the third click creates a particle with particleId 2, and so on.
You can assign per particle attribute values to specific particles using the particleId attribute.
Example Suppose you’ve used the Particle tool to create a grid of eight particles named ColorGrid. In the Attribute Editor, you’ve set the Render Type of the particles to Spheres. You’ve chosen Shading→Smooth Shade All to display the particles with shading.
Using Maya: Hypergraph, Sets & Expressions
189
Expressions
When an emitter emits particles, Maya assigns particleId numbers in sequential order starting with the first particle emitted. The first emitted particle has particleId 0, the second has particleId 1, the third has particleId 2, and so on.
Particle Expressions Working with particle attributes
You can give the particles different colors based on their particleId.
To color the particles based on particleId: 1
Select the ColorGrid.
2
In the Add Dynamic Attributes section of the Attribute Editor, click Color. The Particle Color window appears.
3
Select Add Per Particle Attribute, then click Add Attribute. This adds a per particle attribute named rgbPP, which controls the red, green, and blue color scheme of each particle. The particles turn black after you add the rgbPP attribute. Adding the rgbPP attribute turns off the default coloring of the particles and gives them a value of <<0,0,0>>.
4
In the Attribute Editor, choose Numeric from the Render Type menu. The particleId of each particle is displayed instead of spheres:
190
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes 5
With ColorGridShape1 selected in the Expression Editor, enter this creation expression: if (particleId <= 2) rgbPP = <<1,0,0>>; else if ((particleId > 2) && (particleId < 6)) rgbPP = <<1,1,1>>; else rgbPP = <<0,0,1>>;
The creation expression executes whenever you rewind the animation. The particles don’t show the color assignments yet. The Numeric particle render type ignores color assignments to rgbPP. 6
In the Attribute Editor, set Render Type of the particles to Spheres again. The left, middle, and right columns of particles are red, white, and blue:
Expressions
The expression’s first statement assigns a red color to all particles whose particleId is less than or equal to 2. The value <<1,0,0>> is red in the RGB color scheme. The second statement assigns a white color to all particles whose particleId is greater than 2 and less than 6. The value <<1,1,1>> is white in the RGB color scheme. The third statement assigns a blue color to all particles that don’t meet the conditions in the prior two statements. In other words, all particles whose particleId is greater than or equal to 6 become blue. The value <<0,0,1>> is blue in the RGB color scheme. The following steps show another common way to control an attribute based on the particleId attribute.
Using Maya: Hypergraph, Sets & Expressions
191
Particle Expressions Working with particle attributes
To color half the particles red, and half the particles blue: 1
Enter the following runtime expression: if ((particleId % 2) == 0) rgbPP = <<1,0,0>>; else rgbPP = <<0,0,1>>;
2
Play the scene. The runtime expression executes each frame as the animation plays. Half the particles are blue, half are red.
The first statement uses a modulus operator (%) to calculate the remainder of dividing a particleId by 2. It then compares the remainder to 0. If the remainder equals 0, the statement assigns the particle a red color. The value <<1,0,0>> is red. The second statement assigns a particle a blue color if the remainder of the modulus operation doesn’t equal 0. The value <<0,0,1>> is blue. For example, dividing particleId 0 by 2 equals 0 with remainder 0. Because the remainder is 0, the particle having particleId 0 receives a red color. Dividing particleId 1 by 2 equals 0 with remainder 1. Because the remainder is 1, the particle having particleId 1 receives a blue color. Dividing particleId 2 by 2 equals 1 with remainder 0. With remainder 0, the particle having particleId 1 receives a blue color. The expression executes for each particle in the object. The result is that even-numbered particleIds become red, odd numbered particles become blue. 3
192
Rewind the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Assigning to vectors and vector arrays The creation expression executes. The particles become red, white, and blue as described for the previous expression. 4
Play the animation. The runtime expression executes each frame. The particles are red and blue as the animation plays.
Note to programmers You cannot assign values to individual particles with the array index notation commonly used in programming languages. For example, suppose you’ve created an opacityPP attribute for an object made of three particles. You can’t assign values as in this example: opacityPP[0] = 0.3; opacityPP[1] = 0.5; opacityPP[2] = 1;
Assigning to vectors and vector arrays
Expressions
Previous topics in this chapter show general techniques for working with vector array attributes. Vector array attributes are also called per particle attributes. Subtle details of assigning to vector and vector array attributes and variables follow.
Assigning to a vector variable You can assign a literal vector value or another vector variable to a vector variable. Enclose a literal vector value in double angle brackets.
Examples vector $top_velocity = <<2,2,5>>;
This assigns the vector $top_velocity the value <<2,2,5>>. vector $temp; vector $temp = $top_velocity;
This assigns the value of vector variable $top_velocity to the vector variable $temp.
Using Maya: Hypergraph, Sets & Expressions
193
Particle Expressions Assigning to vectors and vector arrays
Using the vector component operator with variables You can use a vector component operator (.) to read a component of a vector variable or vector array variable. Format
Meaning
$variable.x
left component
$variable.y
middle component
$variable.z
right component
Examples float $temp; vector $myvector = <<1,2,3>>; float $temp = $myvector.z;
This assigns the right component of $myvector, 3, to the floating point variable $temp. Suppose you have a vector initialized as follows: vector $myvector = <<1,2,3>>;
To replace the right component of $myvector, 3, with a new value such as 7, use this technique to preserve the other two components: $myvector = <<$myvector.x,$myvector.y,7>>;
This statement is incorrect: $myvector.z = 3;
An error occurs. A statement can read, but not directly assign, a component of a vector variable.
Assigning to a vector array attribute component An expression can neither read nor assign a component of a vector or vector array attribute. The following example shows a technique for working around this limitation. For details on working with color attributes, see “Working with color” on page 178.
194
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Assigning to vectors and vector arrays
Example Suppose you have 100-particle Cloud of randomly positioned particles. CloudShape1.position = sphrand(1); vector $pos = CloudShape1.position; CloudShape1.rgbPP = <<0,$pos.y,0>>;
The three statements execute once for each particle in Cloud. The first statement gives a particle a random position within a spherical region of radius 1. The sphrand(1) function gives the X, Y, and Z position components a value no less than -1 and no greater than 1. The second statement assigns a particle’s position to a vector variable $pos. The third statement assigns an RGB color to a particle’s rgbPP attribute. The left, middle, and right vector components of CloudShape1.rgbPP represent red, green, and blue components of the RGB color scheme. The third statement therefore assigns 0 (no color) to the red and blue components of a particle’s colorRGB. It gives a particle’s green component the value of its Y coordinate position.
This colors the particles from black to green, depending on the position.
Increasingly green
Using Maya: Hypergraph, Sets & Expressions
195
Expressions
Because a value of 0 or less results in a 0 green value, a particle is black if it’s below the XZ plane. If a particle’s Y coordinate position is above the XZ plane, it has a green component varying from nearly 0 to a fully saturated green.
Particle Expressions List of particle shape attributes
Example particleShape1.rgbPP = <<1,0,CloudShape1.position.z>>;
This causes an error. Maya interprets CloudShape1.position.z as being an attribute named z of an object named CloudShape1.position. You can get the intended result with these statements: vector $temp = CloudShape1.position; particleShape1.rgbPP = <<1,0,$temp.z>>;
The first statement reads all three components of vector attribute CloudShape1.position and assigns it to the vector variable $temp. The second statement reads the value of the right component of $temp, which contains the right component of CloudShape1.position. It then assigns this component to the right component of particleShape1.rgbPP.
Example particleShape1.rgbPP.y = 1;
This also causes an error. You can’t assign a value to a vector array attribute component.
List of particle shape attributes The following table describes the static and dynamic attributes that affect particle shape nodes on a per object or per particle basis. Note the following: •
Attributes you can read but not write are marked with an asterisk (*).
•
Empty boxes in the Render Type column indicate the render type is irrelevant to the attribute’s usage.
•
You can read and write per particle attributes only in particle expressions. See Using Maya: Dynamics for more details on the attributes.
196
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions List of particle shape attributes
Description
Per particle
Render Type
acceleration (acc)
Sets acceleration.
yes
vector array
age* (ag)
Contains number of seconds each particle has existed in scene.
yes
float array
attributeName
Specifies name of attribute whose value is displayed at particle positions.
Numeric
string
betterIllumination
Toggles increased self shadowing.
Cloud
boolean
colorAccum
Toggles additive display effect for RGB and opacity of overlapping particles for this object.
MultiPoint MultiStreak Points Streak
boolean
colorBlue
Sets blue component of RGB color.
float
colorGreen
Sets green component of RGB color.
colorRed
Sets red component of RGB color.
Blobby Surface Cloud MultiPoint MultiStreak Points Sphere Sprite Streak
conserve (con)
Sets amount of momentum conservation.
float
count* (cnt)
Contains number of particles in object.
integer
depthSort (ds)
Toggles depth sorting of particles for rendering.
MultiPoint MultiStreak Points Streak Sprite
Data Type
Expressions
Attribute long name (and short name)
float float
boolean
Using Maya: Hypergraph, Sets & Expressions
197
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
dynamicsWeight (dw)
Scales effect of dynamic fields and collisions on particle object.
event*
Contains number of times each particle in the object has hit something.
eventCount* (evc)
Contains total number of events that have occurred for all particles of the object.
integer
eventTest* (evt)
Contains 1 if an event has occurred on the object since last time an expression or MEL getAttr command read the eventTest value.
boolean
goalPP
Sets how much the particles try to follow goal on a per particle basis.
goalWeight (gw)
Sets how much the particles try to follow goal.
incandescence
Sets glow color.
incandescencePP
Sets glow color.
inheritFactor (inh)
Sets fraction of velocity inherited from the emitter of this particle object.
float
isDynamic (isd)
Toggles dynamics for object.
boolean
lifespan
Sets when all particles die.
float
198
Using Maya: Hypergraph, Sets & Expressions
Per particle
Render Type
Data Type
float
yes
float array
yes
float array
float
yes
Cloud
vector
Cloud
vector array
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
Per particle
Render Type
Data Type
lifespanPP
Sets when particles die on a per particle basis.
yes
levelOfDetail (lod)
Scales number of particles that can be emitted into the object.
lineWidth
Sets width of particle.
mass
Specifies physical mass of particles. As mass increases, the effect of dynamic forces change.
maxCount (mxc)
Sets maximum number of particles that can be emitted into this object.
multiCount
Sets number of points you want displayed for each particle. This number applies to each particle in the object.
MultiPoint Point
float
multiRadius
Sets radius of spherical region in which particles are randomly distributed.
MultiPoint MultiStreak
float
normalDir
Sets direction of normal for particles. Used with useLighting.
MultiPoint MultiStreak Points Streak
integer (1-3)
float array float
MultiStreak Streak yes
float float array
integer
Expressions
Using Maya: Hypergraph, Sets & Expressions
199
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
opacity
Sets amount of transparency.
opacityPP
Sets amount of transparency.
particleId* (id)
Contains id number of each particle.
pointSize
Sets size of particle points.
position (pos)
Sets position.
radius
Sets radius size of all particles.
Blobby Surface Cloud Sphere
float
radius0
Sets starting point radius for tube render type.
Tube
float
radius1
Sets ending point radius for tube render type.
Tube
float
radiusPP
Sets radius size on a per particle basis.
Blobby Surface Cloud Sphere
float array
200
Using Maya: Hypergraph, Sets & Expressions
Per particle
Render Type
Data Type
MultiPoint MultiStreak Points Streak Sphere Blobby Surface Cloud Sprite
float
yes
MultiPoint MultiStreak Points Streak Sphere Cloud Sprite
float array
yes
Numeric
float array
MultiPoint, Numeric Points
float
yes
yes
vector array
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
primaryVisibility (rea)
Per particle
Data Type
Toggles whether surface will be rendered by software renderer.
Cloud Blobby Surface Tube
boolean
visibleInReflections (rrl)
Toggles whether object is visible in reflections.
Cloud Blobby Surface Tube
boolean
visibleInRefractions (rrr)
Toggles whether object is visible in refractions.
Cloud Blobby Surface Tube
boolean
castsShadows (rsh)
Toggles whether object casts shadows.
Cloud Blobby Surface Tube
boolean
rgbPP
Sets color.
MultiPoint MultiStreak Points Sphere Sprite Streak
vector array
selectedOnly
Toggles display of id numbers for selected particles.
Numeric
boolean
spriteNum
Sets image number index for image sequence.
Sprite
integer
spriteNumPP
Sets image number index for image sequence.
Sprite
integer array
spriteScaleX
Sets X-axis image scale.
Sprite
float
spriteScaleXPP
Sets X-axis image scale.
Sprite
float array
spriteScaleY
Sets Y-axis image scale.
Sprite
float
spriteScaleYPP
Sets Y-axis image scale.
Sprite
float array
spriteTwist
Sets image’s rotation angle.
Sprite
float
yes
yes
yes
yes
Using Maya: Hypergraph, Sets & Expressions
Expressions
Render Type
201
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
Per particle
Render Type
Data Type
spriteTwistPP
Sets image’s rotation angle.
yes
Sprite
float array
surfaceShading
Sets level of shading.
Cloud
float
tailFade
Sets opacity of tail fade.
MultiStreak Streak
float
tailSize
Sets length of tail.
MultiStreak Streak Tube
float
threshold
Sets distance between particles at which lofting occurs.
Blobby Surface Cloud
float
useLighting
Toggles whether scene lighting lights up particles.
MultiPoint MultiStreak Points Sprite Streak
boolean
velocity (vel)
Sets velocity.
202
Using Maya: Hypergraph, Sets & Expressions
yes
vector array
9
Functions In expressions, you can use built-in operations called functions to create motion, particle positioning, and other effects. This chapter explains the most commonly used functions and a few useful MEL commands. A hermite function shaped the lightning’s soft body geometry, dnoise animated its turbulence, and sphrand enhanced its randomness.
Expressions
Matt Baer
For easy reference, this chapter groups functions by their purpose. For example, all math functions are grouped in the same section. To find out about:
See page:
Understanding functions
205
Function syntax
206
Limit functions abs ceil floor clamp min max sign trunc
209 210 210 210 211 212 212 212 213 Using Maya: Hypergraph, Sets & Expressions
203
Functions
204
To find out about:
See page:
Exponential functions exp log log10 pow sqrt
214 214 214 214 215 215
Trigonometric functions cos cosd sin sind tan tand acos acosd asin asind atan atand atan2 atan2d hypot
216 216 218 219 224 224 225 225 226 226 226 227 227 227 228 228
Vector functions angle cross dot mag rot unit
229 230 230 231 231 232 233
Conversion functions hsv_to_rgb rgb_to_hsv deg_to_rad rad_to_deg
234 235 235 234 234
Using Maya: Hypergraph, Sets & Expressions
Functions Understanding functions
See page:
Array functions clear size sort
236 236 237 237
Random number functions gauss noise dnoise rand sphrand seed
239 239 241 242 243 244 246
Curve functions linstep smoothstep hermite
249 249 252 254
General commands eval print system
259 259 261 263
Other functions and commands
264
Expressions
To find out about:
Understanding functions A function generates a value where it occurs in an expression statement. It takes action based on parameters called arguments that you enclose in parentheses next to the function name.
Example Suppose you have an object named Star whose translateX attribute is set with this expression statement: Star.translateX = rand(10);
In this statement, the rand function has the argument 10. With this argument, the function generates a randomly selected floating point number between 0 and 10 each time the statement executes. For example, translateX Using Maya: Hypergraph, Sets & Expressions
205
Functions Function syntax might be assigned 6.5409 the first time the statement executes, 3.2974 the second time, 8.7389 the third time, and so on. This causes Star to jump to random points from 0 to 10 units away from the X-axis as the scene plays. Though functions can be more or less complicated than this example, they all have at least one argument and generate one value. Note that a function is part of an expression statement. They don’t stand alone in an expression. Many functions do mathematical operations. For example, the sin function generates the sine of a specified angle. Though we often provide explanatory figures and details, we assume you’re familiar with the mathematical purpose of such functions. For details on the math behind such functions, see a more elementary reference. Note that the following functions are important to learn if you want to go beyond the basics of expression writing: •
sin or sind
•
linstep
•
smoothstep
•
hermite
•
noise
•
dnoise
•
rand
•
sphrand
•
print
Function syntax To help you quickly reference different functions, this chapter includes a syntax format statement for each function. The format follows: datatype
function(datatype argument)
function is the name of the function. datatype to the left of an argument indicates the data type of the argument. argument is a parameter you type with the function. datatype to the left of the function name indicates the data type returned when the function executes.
206
Using Maya: Hypergraph, Sets & Expressions
Functions Function syntax Note that for either datatype, you don’t type a value. The datatype tells you the type of data you must enter or the data type returned by the executed function. The data types are in small type size for easy identification in the syntax definitions.
Example 1 int
abs(int number)
float
abs(float number)
vector abs(vector number)
The function name is abs, which returns the absolute value of the number of your choice. The absolute value of a number is the number without its positive or negative sign. This example shows the abs function has three formats. Each version requires an argument with a different data type and returns a value with a different data type. The first version indicates that you can type an integer argument, and the function returns an integer result. For example, abs(-3) returns 3.
The third version indicates you can type a vector, and the function returns a vector. For example abs(<<3, -6.3, -2>>) returns <<3, 6.3, 2>>.
Example 2 Many functions have only one format, for example, the deg_to_rad function: float
deg_to_rad( float degrees )
This function returns the radian equivalent of to a degree value. It expects a floating point argument and returns a floating point number. Note that Maya ignores spaces between components of functions. For example, the functions in each of these expressions work the same: rotateY = deg_to_rad (45); rotateY = deg_to_rad(45); rotateY = deg_to_rad( 45 );
Using Maya: Hypergraph, Sets & Expressions
207
Expressions
The second version indicates that you can type a floating point argument, and the function returns a floating point result. For instance, abs(-7.54) returns 7.54.
Functions Function syntax
Data types In many cases, entering a data type other than the type expected by a function causes an error and prevents the expression from executing. For example, if you enter a vector argument where a floating point number is expected, an error occurs. For a function argument that expects a floating point number, however, you can instead type an integer—a number without a decimal point. Maya converts an integer to a floating point number in arithmetic operations. If an error occurs when you create an expression, check that you’re using the appropriate data types for all arguments.
Notes In this book, examples of floating point return values show no more than three digits to the right of the decimal point. If you display the contents of an attribute or variable in the Script Editor, you’ll see as many as 10 digits to the right of the decimal point. For instance, an example might show a return value as 3.539 rather than the precise value 3.538654390. The examples round up such numbers for ease of reading. Note also that converting radians to degrees and vice versa results in rounding errors. For example, converting a radian value might result in 89.99999996 degrees rather than 90.0 degrees.
Understanding function examples in this chapter Most function examples in this chapter show the use of the function outside of an expression statement. This makes the examples less cluttered and easier to read. For instance, the first example for the abs function on page 209 is: abs(-1)
This returns the value 1 where it occurs in an expression statement. For a function to have effect, you must use it within an expression that assigns a value to an attribute or variable.
208
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions
Examples Ball.scaleY = abs(-1);
This statement assigns Ball.scaleY the value returned by the abs(-1) function. If you use a function in an expression statement and do not assign the returned value to an attribute, the statement has no effect. abs(-1);
Returns 1, but doesn’t assign it to an attribute. This has the same result as the following meaningless statement: 1;
In some function examples in this chapter, the function’s purpose is easier to understand in the context of an expression. In such cases, we show examples of the function in an expression.
Limit functions The limit functions are math functions that impose limits on numbers.
abs
int
Expressions
Returns the absolute value of number. The absolute value of an integer or floating point number is the number without its positive or negative sign. The absolute value of a vector is a vector with components stripped of negative signs. abs(int number)
float
abs(float number)
vector
abs(vector number)
number is the number for which you want the absolute value.
Examples abs(-1)
Returns the value 1. abs(1)
Returns the value 1.
Using Maya: Hypergraph, Sets & Expressions
209
Functions Limit functions abs(<<-1,-2.43,555>>)
Returns <<1, 2.43, 555>>. abs(Ball.translateY)
If Ball.translateY contains -20, this returns 20.
ceil Returns a number rounded to the smallest integer value greater than or equal to a floating point number. float
ceil(float number)
number is the number you want to round.
Examples ceil(2.344)
Returns 3. ceil(3.0)
Returns 3. ceil(Rock.scaleY)
If Rock.scaleY contains -2.82, this returns -2.
floor Returns a number rounded to the largest integer less than or equal to a floating point number. float
floor(float number)
number is the number you want to round.
Examples floor(2.344)
Returns 2. floor(3.0)
Returns 3.
210
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions floor(Head.height)
If Head.height is -2.8, this returns -3.
clamp Returns a number within a range. You can use the clamp function to confine an increasing, decreasing, or randomly changing number to a range of values. float
clamp(float minnumber, float maxnumber, float parameter)
minnumber and maxnumber specify the range of the returned value. parameter is an attribute or variable whose value you want to clamp within the range. If parameter is within the numerical range of minnumber and maxnumber, the function returns the value of parameter. If parameter is greater than the range, the function returns the maxnumber. If parameter is less than the range, the function returns the minnumber.
Examples clamp(4,6,22)
clamp(4,6,2)
Returns 4, because 2 is less than 4, the minimum number of the range. clamp(4,6,5)
Returns 5, because it’s within the range. Ball.scaleY = clamp(0,3,time);
Returns a value between 0 and 3 each time the expression executes. When you rewind the animation to frame 1, the above expression executes and Ball’s scaleY attribute receives the value of time—a number slightly above 0. The clamp function returns the value of time because time is within the range 0 to 3. When you play the animation, time increments slightly with each frame. The expression executes with each frame and Ball’s scaleY attribute receives the value of time until time exceeds 3. When time exceeds 3, the clamp function returns the value 3. Using Maya: Hypergraph, Sets & Expressions
211
Expressions
Returns 6, because 22 is greater than 6, the maximum number of the range.
Functions Limit functions
min Returns the lesser of two floating point numbers. float
min( float number, float number)
number is a number you want to compare.
Examples min(7.2,-3.2)
Returns -3.2. Desk.height = -2; Lamp.height = 9; $Mylight = min(Desk.height,Lamp.height);
Sets $Mylight to -2.
max Returns the larger of two floating point numbers. float
max(float number, float number)
number is a number you want to compare.
Examples max(7.2,-3.2)
Returns 7.2. Desk.height = -2; Lamp.height = 9; $Mylight = max(Desk.height,Lamp.height);
Sets $Mylight to 9.
sign Returns one of three values representing the sign of a number. Returns -1 if the number is negative, 1 if positive, 0 if 0. float
sign( float number )
number is the number whose sign you want to determine.
212
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions
Examples sign(-9.63)
Returns -1. sign(0)
Returns 0. sign(10)
Returns 1. sign(Ball.translateX)
If Ball.translateX is 5, this returns 1.
trunc Returns the whole number part of a floating point number. float
trunc(float number)
number is the number you want to truncate.
Examples trunc(2.344)
Expressions
Returns 2. trunc(0.3)
Returns 0. trunc(-2.82)
Returns -2. trunc(time)
If time equals 3.1234, this returns 3.
Using Maya: Hypergraph, Sets & Expressions
213
Functions Exponential functions
Exponential functions The following functions work with exponential values.
exp Returns e raised to the power of a number, enumber. The predefined variable e is the base of the natural logarithm, which is 2.718. float
exp(float number)
number is the exponent to which you want to raise e.
Examples exp(1)
Returns 2.718, the value of e. exp(2)
Returns 7.389, the value of e2.
log Returns the natural logarithm of a number, logenumber. The natural logarithm uses the constant e, which is 2.718. float
log(float number)
number is the positive number for which you want the natural logarithm.
Examples log(10)
Returns 2.303. log(2.718282845904)
Returns 1.000.
log10 Returns the log base 10 of a number. float
log10(float number)
number is the positive number for which you want the log base 10.
214
Using Maya: Hypergraph, Sets & Expressions
Functions Exponential functions
Examples log10(100)
Returns 2. log10(10)
Returns 1.
pow Returns a base number raised to an exponent. float
pow(float base, float exponent )
base is the base number you want to raise to the exponent. A negative base number with a decimal component causes an error message. exponent is the exponent.
Examples pow(2,3)
Returns 8. pow(-2,3)
Expressions
Returns -8. pow(2,-3)
Returns 0.125.
sqrt Returns the square root of a positive number. float
sqrt(float number)
number is the positive number of which you want the square root. A negative number displays an error message.
Examples sqrt(16)
Returns 4.
Using Maya: Hypergraph, Sets & Expressions
215
Functions Trigonometric functions sqrt($side)
If $side is 25, this returns 5.
Trigonometric functions The following functions return trigonometric values. Each function has two formats that let you choose the type of angular unit you work with: degrees or radians. For example, the cos function expects an argument in radians, while cosd expects an argument in degrees. A radian equals 180 degrees divided by pi, or roughly 57.3 degrees. Note that pi equals 3.1415927, which is also 180 degrees.
cos Returns the cosine of an angle specified in radians. float
cos(float number)
number is the angle, in radians, whose cosine you want. For any right triangle, the cosine of an angle is the following ratio:
adjacent B cos θ = ------------------------------ = ---hypotenuse C Y
Y
C
θ
A
θ
B B
X
X
A C
If θ is less than 1/2 pi radians and more than 3/2 pi radians (from 270 to 90 degrees), cos θ is a value between 0 and 1.
216
Using Maya: Hypergraph, Sets & Expressions
If θ is between 1/2 pi radians and 3/2 pi radians (90 to 270 degrees), cos θ is a value between 0 and -1.
Functions Trigonometric functions The cosine ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the cosine of the measure of the angle. The cosine ratio is a value between -1 and 1. With a steadily increasing or decreasing argument, the cos function returns steadily increasing or decreasing values between 1 and -1. This is useful for creating rhythmic, oscillating changes in attribute values. The cos function works like the sin function except its return values are 90 degrees, or pi/2, out of phase. See page 219 for ideas on how to use the cyclical characteristics of the sin and cos functions.
Example 1 cos(1)
Returns 0.5403, the cosine of 1 radian.
Example 2 To animate the motion of Ball in a cosine wave pattern, use this expression:
Ball starts at the origin and moves in the X direction at a rate set by the incrementing animation time. Its Y translation moves cyclically up and down according to the return values of the cos function. The cos function uses translateX, and therefore indirectly, time, as its argument. As time increases from 0 to 6.283 seconds, the cos function returns values that change in fine increments from 1 to -1 and back to 1. The value 6.283 is 2 times the value of pi. As time increases beyond 6.283 seconds, the same cycle repeats for each span of 6.283 seconds.
Using Maya: Hypergraph, Sets & Expressions
217
Expressions
Ball.translateX = time; Ball.translateY = cos(Ball.translateX);
Functions Trigonometric functions
Ball.translateY = cos(Ball.translateX);
time = 6.283 (2 * pi seconds)
Compare the same expression using the sin function: Ball.translateY = sin(Ball.translateX);
time = 6.283 (2 * pi seconds)
The cosine curve is 1.571 (pi/2) seconds ahead of (or behind) the sine curve, and vice versa.
cosd Returns the cosine of an angle specified in degrees. float
cosd(float number)
number is the angle, in degrees, whose cosine you want. For more details on the cosd function, see the cos function in the preceding topic. The cosd and cos functions do the same operation, but cosd requires its argument in degree measurement units.
218
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Example cosd(45)
Returns 0.707, the cosine of 45 degrees.
sin Returns the sine of an angle specified in radians. float
sin(float number)
number is the angle, in radians, whose sine you want. For any right triangle, the sine of an angle is the following ratio:
opposite A sin θ = ------------------------------ = ---hypotenuse C Y
Y
C A
θ
θ
B
X
A C
If θ is from 0 to pi radians (0 to 180 degrees), sin θ is a value between 0 and 1.
If θ is from pi to 2 pi radians (180 to 360 degrees), sin θ is a value between 0 and -1.
The sine ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the sine of the measure of the angle. The sine ratio is a value between -1 and 1. With a steadily increasing or decreasing argument, the sin function returns steadily increasing or decreasing values between -1 and 1. This is useful for creating rhythmic, oscillating changes in attribute values. Using Maya: Hypergraph, Sets & Expressions
219
Expressions
X
B
Functions Trigonometric functions For example, you can use the sin function to manipulate: •
an object’s translate attributes to create snake-like motion
•
a body’s scale attributes to create a breathing cycle
•
a particle object’s opacity or color attributes to cycle a color or opacity pattern
Example 1 float $pi = 3.1415927; sin($pi/2)
Returns 1, the sine of pi/2 radians.
Example 2 Ball.translateY = sin(Ball.translateX);
This statement sets Ball’s translateY attribute equal to the sine of its translateX attribute. If you drag Ball along the X-axis, Ball’s translateY position moves up and down in a cyclical pattern:
Example 3 To animate Ball to the path of the preceding example, use this expression: Ball.translateX = time; Ball.translateY = sin(Ball.translateX);
220
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions Ball starts at the origin and moves in the X direction at a rate set by the incrementing animation time. Its Y translation moves cyclically up and down according to the return values of the sin function. The sin function uses translateX, and therefore indirectly, time, as its argument. As time increases from 0 to 6.283 seconds, the sin function returns values that change in fine increments from 0 to 1 to -1 to 0. The value 6.283 is 2 times the value of pi. The resulting motion resembles a horizontal S-shape:
time = 6.283 (2 * pi seconds)
As time increases beyond 6.283 seconds, the same S-shaped cycle repeats for each span of 6.283 seconds.
This expression animates Ball with larger up and down swings: Ball.translateX = time; Ball.translateY = sin(Ball.translateX) * 2;
By multiplying sin(Ball.translateX) by a number greater than 1, you increase the amplitude of the sine wave pattern. The amplitude is half the distance between the minium and maximum values of the wave.
Amplitude
Using Maya: Hypergraph, Sets & Expressions
221
Expressions
Example 4
Functions Trigonometric functions You can decrease the amplitude of the sine wave by multiplying by a number less than 1, for example, 0.5.
Example 5 This expression increases how often the sine wave completes a cycle: Ball.translateX = time; Ball.translateY = sin(Ball.translateX * 2);
By multiplying Ball.translateX by a number greater than 1, you increase the frequency of the sine wave pattern. The frequency is how long it takes the wave to make a complete cycle.
Frequency
You can decrease the frequency of the sine wave by multiplying by a number less than 1, for example, 0.5. This number is known as a frequency multiplier because it multiplies (or divides) the frequency of the sine pattern.
Example 6 This expression offsets the wave pattern higher up the Y-axis: Ball.translateX = time; Ball.translateY = sin(Ball.translateX) + 2;
By adding 2 to sin(Ball.translateX), the wave pattern starts further up the Yaxis. You can, of course, also subtract a number to offset the wave pattern lower on the Y-axis.
222
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Offset of 2
Example 7 The following expression sets a frequency multiplier, amplitude, and offset of a sine pattern in a single statement: Ball.translateX = time; Ball.translateY = (sin(Ball.translateX * 2) * 2) + 2;
Expressions
The following diagram shows which values set the frequency multiplier, amplitude, and offset. Frequency multiplier Amplitude Offset Ball.translateY = (sin(Ball.translateX * 2) * 2) + 2;
A general equation showing the factors you can use to create a sine wave pattern follows: attribute = (sin(frequency * frequency multiplier) * amplitude) + offset;
Using Maya: Hypergraph, Sets & Expressions
223
Functions Trigonometric functions
sind Returns the sine of an angle specified in degrees. float
sind(float number)
number is the angle, in degrees, whose sine you want. For more details on how to use the sind function, see the sin function in the preceding topic. The sind and sin functions do the same operation, but sind requires its argument in degree measurement units.
Example sind(90)
Returns 1, the sine of 90 degrees.
tan Returns the tangent of an angle specified in radians. float
tan(float number)
number is the angle, in radians, whose tangent you want. For any right triangle, the tangent of an acute angle is the following ratio:
opposite A tan θ = ----------------------- = --adjacent B Y
Y
C
θ
A
θ
B B
X
X
A C
224
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions The ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the tangent of the measure of the angle.
Example tan(1)
Returns 1.557.
tand Returns the tangent of an angle specified in degrees. float
tand(float number)
number is the angle, in degrees, whose tangent you want. For more details on the tand function, see the tan function in the preceding topic. The tand and tan functions do the same operation, but tand requires its argument in degree measurement units.
Example tand(45)
Returns roughly 1, the tangent of 45 degrees.
Returns the radian value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to pi. float
acos(float number)
number is the cosine of the angle, and must be from -1 to 1.
Example acos(1)
Returns 0. acos(-0.5)
Returns 2.0944 radians.
Using Maya: Hypergraph, Sets & Expressions
225
Expressions
acos
Functions Trigonometric functions
acosd Returns the degree value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to 180. float
acosd(float number)
number is the cosine of the angle, and must be from -1 to 1.
Example acosd(1)
Returns 0 degrees. acosd(-0.5)
Returns 120 degrees.
asin Returns the radian value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -pi/2 to pi/2. float
asin(float number)
number is the sine of the angle, and must be from -1 to 1.
Example asin(0.5)
Returns 0.525 radians.
asind Returns the degree value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -90 to 90. float
asind(float number)
number is the sine of the angle, and must be from -1 to 1.
226
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Example asind(0.5))
Returns 30 degrees.
atan Returns the radian value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -pi/2 to pi/2. float
atan(float number)
number is the tangent of the angle and can be any value.
Example atan(1)
Returns 0.785.
atand
float
atand(float number)
number is the tangent of the angle and can be any value.
Example atand(1)
Returns 45 degrees.
atan2 Returns the radian value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in radians, from -pi to pi, excluding -pi. float
atan2(float Y, float X )
X is the X coordinate of the point. Using Maya: Hypergraph, Sets & Expressions
227
Expressions
Returns the degree value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -90 to 90.
Functions Trigonometric functions Y is the Y coordinate of the point.
Example atan2(1,1)
Returns 0.785 radians.
atan2d Returns the degree value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in degrees, from -180 to 180, excluding -180. float
atan2d(float Y, float X )
X is the X coordinate of the point. Y is the Y coordinate of the point.
Example atan2d(1,1)
Returns 45 degrees.
hypot Returns the magnitude of two-dimensional vector from the origin to a point with coordinates X, Y. Y
hypot
(X,Y) X
228
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions As shown in the preceding figure, the hypot function returns the radius of a circle whose center is at one end of a right triangle’s hypotenuse and perimeter is at the other end of the hypotenuse. The following equation gives the magnitude of the vector: 2
x +y float
2
hypot(float x, float y)
X is the X coordinate of the point. Y is the Y coordinate of the point.
Example hypot(3,4)
Returns 5.
Vector functions Expressions
The following functions do operations with vectors. The functions take vector arguments and return floating point numbers or vectors.
angle Returns the radian angle between two vectors. Vector1
Angle
Vector2
float
angle( vector vector1, vector vector2)
vector1 is one of the vectors.
Using Maya: Hypergraph, Sets & Expressions
229
Functions Vector functions vector2 is the other vector. The returned angle is the shortest angle between the two vectors. The measurement is always less than 180 degrees.
Example angle(<<2,-1,1>>,<<1,1,2>>)
Returns 1.0472 radians, which equals 60 degrees.
cross Returns the cross product of two vectors. For two vectors, the cross product returns the vector that’s normal to the plane defined by the two vectors. Vector1
Vector2
Cross product
vector
cross(vector vector1, vector vector2)
If the cross product is 0, the two vectors are parallel or colinear. If one or both vectors are <<0,0,0>>, the cross product returns <<0,0,0>>. vector1 is one of the vectors. vector2 is the other vector.
Example cross(<<1,2,-2>>,<<3,0,1>>)
Returns <<2, -7, -6>>.
230
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions
dot Returns the floating point dot product of two vectors. The dot product takes two vectors as arguments and returns a scalar value. float
dot(vector vector1, vector vector2)
If the dot product returns 0, the two vectors are perpendicular. vector1 is one of the vectors. vector2 is the other vector.
Example dot(<<1,2,-2>>,<<3,0,1>>)
Returns 1. The dot product of this example is (1 * 3) + (2*0) + (-2*1), which equals 1.
mag Returns the magnitude of a vector. This is the length of the vector. Y-axis
X
Expressions
Z
<> Y X-axis
Z-axis Magnitude float
mag(vector vector)
vector is the vector whose magnitude you want.
Using Maya: Hypergraph, Sets & Expressions
231
Functions Vector functions The mag function converts a vector into a floating point number using the following formula. 2
2
x +y +z
2
Example mag(<<7,8,9>>)
Returns 13.928. 2
2
2
7 + 8 + 9 = 13.928
rot Returns a vector that represents the position of a point after it’s rotated a specified number of radians about a specified axis. Rotation is counterclockwise as viewed downward from the axis end position. Position of point before rotation Angle Position of point after rotation
Axis
vector
rot(vector point, vector axis, float angle )
point is the position of a point in the world coordinate system. axis is the axis around which the point rotates. The axis is a line that passes through the origin and the specified axis position. angle is the number of radians the point rotates.
232
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions
Example 1 rot(<<3,3,0>>,<<1,0,0>>,0.5)
Returns <<3, 2.633, 1.438>>. This is a vector representing the position of point <<3,3,0>> after rotating it 0.5 radians around the axis represented by <<1,0,0>>.
Example 2 particleShape1.position = rot(position,<<0,1,0>>,0.1);
Suppose your scene has a single-particle object at position <<4,6,0>>, and you wrote the above runtime expression for its particle shape node. When you play the scene, the particle rotates in a circular pattern around the Y-axis (the axis represented by <<0,1,0>>). In each frame, the particle’s position rotates 0.1 radian, roughly 5.7 degrees. Motion Particle
Expressions
unit Returns the unit vector corresponding to a vector. The unit vector has the same direction as the specified vector, but with a magnitude of 1. vector
unit( vector vector)
vector is the vector whose unit vector you want.
Example unit(<<1,1,1>>)
Returns <<0.577, 0.577, 0.577>>. Using Maya: Hypergraph, Sets & Expressions
233
Functions Conversion functions
Y <<1, 1, 1>> <<0.577, 0.577, 0.577>>
X Z Unit vector (magnitude = 1)
Conversion functions The following functions convert color scheme values or angle measurements.
deg_to_rad Returns the radian equivalent of a degree value. One radian equals roughly 57.29578 degrees. float
deg_to_rad( float degrees )
degrees is the degree angle you want to convert to radians.
Example deg_to_rad(90)
Returns 1.571, which is the same as pi/2.
rad_to_deg Returns the degree equivalent of a radian value. One radian equals roughly 57.29578 degrees. float
rad_to_deg(float radians)
radians is the radian angle you want to convert to degrees.
234
Using Maya: Hypergraph, Sets & Expressions
Functions Conversion functions
Examples rad_to_deg(1)
Returns 57.296. float $pi = 3.1415927; rad_to_deg($pi)
Returns 180.
hsv_to_rgb Converts an HSV vector to an RGB vector. vector
hsv_to_rgb(vector hsv)
hsv is a vector representing the hue, saturation, and value components.
Example hsv_to_rgb(<<1,0.5,0.6>>)
Returns <<0.6, 0.3, 0.3>>.
Tip
In the window’s hexagonal color wheel, drag the pointer to a color of interest. The edit boxes in the window list the color’s values for hue, saturation, and value—and their counterpart red, green, and blue values. Note, however, that the Hue value in the Color Chooser has a range of 0 to 360, while the H component of an HSV vector has a corresponding proportional range of 0 to 1. When you launch the Color Chooser by entering colorEditor, it’s useful only for learning about color. You can’t use it to change the color of objects in your scene.
rgb_to_hsv Converts an RGB vector to an HSV vector.
Using Maya: Hypergraph, Sets & Expressions
235
Expressions
To see the relationship between HSV and RGB color components, enter the MEL command colorEditor at the Command Line. This displays the Color Chooser window.
Functions Array functions vector
rgb_to_hsv(vector rgb)
rgb is a vector representing the red, green, and blue components.
Example rgb_to_hsv(<<0.6,0.6, 0.6>>)
Returns <<0, 0, 0.6>>.
Array functions The following functions work with integer, floating point, and vector arrays. If you need more information, see a reference book on the C programming language.
clear Empties the array’s contents, freeing all memory reserved for the array. After you clear an array, its size is 0. When you no longer need to use an array, use the clear function to free memory. int
clear(array array)
array is the name of the array you want to clear. The clear function returns 1 if the function succeeds, 0 if it fails. The return value is not typically used in expressions.
Example int $myInts[] = {1,2,3,4,5,6}; print("size of $myInts is: "+size($myInts)+"\n"); clear($myInts); print("size of $myInts is: "+size($myInts)+"\n");
The third statement above clears the array $myInts. The second and fourth statements display the following text in the Script Editor: size of $myInts is: 6 size of $myInts is: 0
236
Using Maya: Hypergraph, Sets & Expressions
Functions Array functions
size Returns the number of elements in an array or the number of characters in a string. int
size(array array)
int
size(string string)
array is the name of the array whose size you want. string is the string whose number of characters you want.
Example 1 string $s = "Hello"; $stringlen = size($s);
The size($s) function returns 5, then the statement assigns 5 to $stringlen.
Example 2 int $myInts[] = {1,2,3,4,5,6}; $numInts = size($myInts);
The size($myInts) function returns 6, then the statement assigns 6 to $numInts.
Returns an array sorted in alphabetical or ascending numerical order. The returned array has the same number and type of elements as the original array. array sort(array array)
array is the name of the array to be sorted.
Example 1 int $myInts[] = {3,6,1,4,2,5}; int $afterSorting[] = sort($myInts); print("After sorting, the array contains:\n"); for ($i = 0; $i < 6; $i = $i + 1) { print($afterSorting[$i]+"\n"); }
Using Maya: Hypergraph, Sets & Expressions
237
Expressions
sort
Functions Array functions The sort function sorts the elements of $myInts in ascending order. The following appears in the Script Editor: After sorting, the array contains: 1 2 3 4 5 6
Example 2 string $myName[] = {"Peewee","Michael","Kennedy"}; string $afterSorting[] = sort($myName); print("After sorting, the array contains:\n"); for ($i = 0; $i < 3; $i = $i + 1) { print($afterSorting[$i]+"\n"); }
The sort function sorts the elements of $myName in alphabetical order. The following appears in the Script Editor: After sorting, the array contains: Kennedy Michael Peewee
238
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
Random number functions The following functions generate random numbers. Random numbers are useful when you want the position, motion, or color of an object’s particles or vertices to have a random appearance.
gauss Returns a random floating point number or vector. The number returned falls within a Gaussian (bell curve) distribution with mean value 0. float
gauss(float stdDev)
vector
gauss(float XstdDev, float YstdDev)
vector
gauss(vector stdDevVector)
stdDev specifies the value at which one standard deviation occurs along the distribution. This gives a one-dimensional Gaussian distribution. XstdDev and YstdDev specify the values for one standard deviation. This gives a two-dimensional Gaussian distribution in the XY plane. The right component of the vector returned is 0. stdDevVector specifies the vector component values for one standard deviation. This gives a three-dimensional distribution.
Example gauss(5)
Returns a random floating point value such as 0.239.
Using Maya: Hypergraph, Sets & Expressions
239
Expressions
To control the random values returned by this function, see “seed” on page 246.
Functions Random number functions If you were to execute gauss(5) repeatedly and chart the values returned, they would occur roughly with this frequency: Mean One standard deviation
About 2/3 of returned values will be within one standard deviation.
Number of occurrences
0
-5
5
Value returned
If you were to execute gauss(2) repeatedly, return values would occur with this frequency: Mean One standard deviation
About 2/3 of returned values will be within one standard deviation.
Number of occurrences
-2
0
Value returned
240
Using Maya: Hypergraph, Sets & Expressions
2
Functions Random number functions
noise Returns a random number from -1 to 1 according to a Perlin noise field generator. float
noise(float number)
float
noise(float xnum, float ynum)
float
noise(vector vector)
number specifies a number that generates a random number. This gives a one-dimensional distribution of return values. xnum and ynum specify numbers for generating a random number. This gives a two-dimensional distribution of return values. vector specifies a vector for generating a random number. This gives a threedimensional distribution of return values. If you execute this function with the same argument value repeatedly, the function returns the same random value each time it executes. If you execute this function with an argument value that steadily increases or decreases in fine increments over time, the function returns random values that increase and decrease over time.
noise(time)
Returns a value between -1 and 1 each time the expression executes as an animation plays. Because time increases in fine increments, the values returned increase and decrease in smooth, yet random, patterns. If you were to chart the values returned over a period of time, they might occur as in this figure:
1 Return value 0 -1 noise(time) as animation plays
Using Maya: Hypergraph, Sets & Expressions
241
Expressions
Example 1
Functions Random number functions
Example 2 noise(frame)
Returns a value between -1 and 1 each time the expression executes as an animation plays. Because frame increases in larger increments, the values returned increase and decrease in rougher patterns. If you were to chart the values returned over a period of time, they might occur as in this figure:
1 Return value 0 -1 noise(frame) as animation plays
The value returned by noise(frame) and noise(time) is the same when frame contains the same number as time. For example, when frame equals 10, noise(frame) returns the same value that noise(time) returns when time is 10.
dnoise Returns a vector with each component containing a random number from -1 to 1. It works like the noise function except it expects and returns a vector argument. The returned vector represents the gradient of the noise field in three dimensions. vector
dnoise(vector argument)
argument specifies a vector for generating a random number. This gives a three-dimensional distribution of return values. See the noise function for more details on dnoise operation.
Example dnoise(<<10,20,-30>>)
Returns <<-0.185, 0.441, 0.686>>.
242
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
rand Returns a random floating point number or vector within a range of your choice. float
rand(float maxnumber)
float
rand(float minnumber, float maxnumber)
vector
rand(vector maxvector)
vector
rand(vector minvector, vector maxvector)
maxnumber specifies the maximum number returned (in the first syntax format listed above). The minimum number returned is 0. In other words, the returned value will be a random number between 0 and maxnumber. minnumber and maxnumber specify the minimum and maximum numbers returned. maxvector specifies the maximum value for each component of the vector returned. The minimum value is 0. Each component returned is a different random number. minvector and maxvector specify the minimum and maximum value for each component of the vector returned.
Example 1 rand(5)
Returns a random floating point number between 0 and 5, for example, 3.539.
Example 2 rand(-1,1)
Returns a random floating point number between -1 and 1, for example, 0.452.
Using Maya: Hypergraph, Sets & Expressions
243
Expressions
To control the random values returned by this function, see “seed” on page 246.
Functions Random number functions If you were to execute rand(-1,1) repeatedly as an animation plays, its return values might occur as in this figure:
1 Return value 0 -1 rand(1,-1) as animation plays
Example 3 rand(<<1,1,1>>)
Returns a random vector in which each component is between 0 and 1, for example, <<0.532, 0.984, 0.399>>.
Example 4 rand(<<1,1,1>>,<<100,200,300>>)
Returns a random vector in which the left component is between 1 and 100, the middle component is between 1 and 200, and the right component is between 1 and 300. An example is <<81.234, 49.095, 166.048>>.
sphrand Returns a random vector value that exists within a spherical or ellipsoidal region of your choice. An ellipsoid is a sphere scaled along its X-, Y- or Zaxes. vector
sphrand(float radius)
vector
sphrand(vector vector)
radius is the radius of a sphere in which the returned vector exists. vector is the radius of an ellipsoid along the X-, Y-, and Z-axis. To control the random values returned by this function, see “seed” on page 246.
244
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
Example 1 sphrand(1)
Returns a vector whose randomly selected coordinates reside within an imaginary sphere centered at the origin and with a radius of 1. An example returned vector is <<0.444, -0.427, 0.764>>.
Outer boundary of returned value Origin
1
radius
Example 2 sphrand(<<2,1,1>>)
Radius in Z 1
2
Radius in X
1
Outer bound of returned value Radius in Y
To create a particle ellipsoid: You can use the sphrand function, for example, to create a cluster of 500 particles randomly positioned within an ellipsoid having a radius of 2 in the X-axis, 1 in the Y-axis, and 1 in the Z-axis. Using Maya: Hypergraph, Sets & Expressions
245
Expressions
Returns a vector whose coordinates reside within an ellipsoid centered at the origin and with a radius of 2 along the X-axis, 1 along the Y-axis, and 1 along the Z-axis.
Functions Random number functions 1
Select Particles→Particle Tool-❒.
2
Enter 500 for Number of Particles, and 1 for Maximum Radius.
3
Click the mouse somewhere in the workspace to position the particles.
4
Select the particle shape node of the particle object in the Expression Editor.
5
Turn on Creation.
6
Enter this expression: position = sphrand(<<2,1,1>>);
Maya executes the expression once for each particle. It gives each particle a different random position around the origin within the ellipsoid specified by <<2,1,1>>.
seed Sets a seed value the gauss, rand, and sphrand functions use to generate random numbers. If you assign a value to the seed then execute the gauss, rand, or sphrand function repeatedly, an identical sequence of random numbers is generated. For clarification, see the example below and “Reproducing randomness” on page 123. int
seed(int number)
number sets an arbitrary number to be used as the seed value.
Example Suppose you create a NURBS sphere named Ball then enter this expression: Ball.translateX = rand(5);
246
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions When you rewind the animation, Ball’s translateX attribute receives a random value between 0 and 5, for example, 1.392. When you play the animation, the translateX attribute receives a different random value between 0 and 5 each frame. When you rewind the animation again, the translateX attribute receives a value that’s different from the value it received the first time you rewound, for example, 3.223. When you play the animation again, the translateX attribute receives a value each frame that’s different from the values it received the first time you played the animation. In short, every time the rand(5) executes, it gives a different random value. Suppose you change the expression to this: if (frame == 1) seed(1); Ball.translateX = rand(5);
Rewinding the scene to frame 1 executes the seed(1) function. It then assigns translateX a random value between 0 and 5, for example, 4.501. When you play the animation, the rand(5) function executes each frame and returns a different value. Example returned values follow: Value
1
4.501
2
3.863
3
3.202
4
3.735
5
2.726
6
0.101
Expressions
Frame
Each time you rewind and play the animation, translateX receives the same sequence of random values. For different seed values, the sequence of numbers returned will differ. You can’t predict the values in the number sequence based on the value of the seed.
Using Maya: Hypergraph, Sets & Expressions
247
Functions Random number functions Suppose you change the expression to this: if (frame == 1) seed(500); Ball.translateX = rand(5);
The rand(5) function returns these values as you rewind and play the animation: Frame
Value
1
4.725
2
2.628
3
0.189
4
0.004
5
4.834
6
0.775
By changing the seed function’s value, you change the sequence of random numbers generated. A common mistake while using the seed function follows: seed(1); Ball.translateX = rand(5);
When you rewind the animation, Ball’s translateX attribute receives the value 4.501. When you play the animation, the translateX attribute receives 4.501 each time the expression executes. Because you assign a value (1) to the seed before each execution of rand(5), you initialize the random number sequence. The rand(5) function therefore returns the first value of the number sequence each time it executes.
Important When you set a seed value in an expression or MEL script, the seed value affects the rand, sphrand, and gauss functions in other expressions and MEL scripts. Such functions are affected by this seed value in all scenes you open subsequently in the current work session.
248
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Curve functions The step functions let you make smooth, incrementing transitions between values.
linstep Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. This function lets you increase an attribute such as opacity from 0 to 1 linearly over a time range. float
linstep(float start, float end, float parameter)
start and end specifies the minimum and maximum values. parameter is the value you want to use to generate the proportional number. If parameter is less than start, linstep returns 0. If parameter is greater than end, linstep returns 1.
Example Suppose you’ve used the Particle Tool to create a collection of particles named Cloud: Expressions
Suppose further you’ve added a dyamic per object opacity attribute to Cloud (see “Working with particle attributes” in Chapter 8). You then write this runtime expression for Cloud’s particle shape node: CloudShape1.opacity = linstep(0,5,age);
Using Maya: Hypergraph, Sets & Expressions
249
Functions Curve functions This expression increases the per object opacity attribute of CloudShape1 in equal steps from 0 to 1 for the first 5 seconds of the object’s existence. Because you created the object with the Particle Tool, the particles existence begins in the first frame of the animation. All particles in the object fade in from transparent to opaque for the first 5 seconds of animation. At the first frame that plays, the age of the particles is 0, so the linstep function returns 0 for the opacity. An opacity of 0 is transparent. In each subsequent frame, the linstep function returns a proportionally larger opacity value. When the age of the object reaches 5, the linstep function returns 1 for the opacity. An opacity of 1 is 100% opaque. When the age exceeds 5, the linstep function returns 1. The opacity stays 100% opaque. Here are some values returned for the object’s opacity:
250
Age
Opacity
0.0417
0.0083
0.0833
0.0166
0.125
0.025
0.1667
0.0333
0.2083
0.0417
2.5
0.5
1.0
0.2
3.75
0.75
5
1
5.041
1
5.083
1
10
1
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions As the table shows, the opacity increases in linear increments for the first 5 seconds of the object’s age. At the midpoint of the specified 0 to 5 second age range, the opacity is 0.5. At 3/4 of the way between 0 and 5 seconds, the opacity is 0.75. At 5 seconds of the object’s age, opacity is 1. After 5 seconds, the opacity stays at 1. 1
opacity
0
5 age (in seconds)
Suppose you edit the runtime expression as follows: CloudShape1.opacity = linstep(5,10,age);
This increases the opacity attribute linearly from 0 to 1 as the object’s age increases from 5 to 10 seconds. Expressions
1
opacity
0
5 age (in seconds)
10
Suppose you edit the runtime expression as follows: particleShape1.opacity = 1-linstep(0,5,age);
This decreases the opacity attribute linearly from 1 to 0 for the first 5 seconds of the object’s age. Subtracting linstep(0,5,age) from 1 causes the opacity to fade out rather than fade in.
Using Maya: Hypergraph, Sets & Expressions
251
Functions Curve functions
1
opacity
0
5 age (in seconds)
smoothstep Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. The smoothstep function lets you increase an attribute such as opacity from 0 to 1 gradually, but nonlinearly, over a time range. The smoothstep function works like the linstep function, except it increases values more quickly near the middle values between the minimum and maximum value. The function uses hermite interpolation between minimum and maximum values. float
smoothstep(float start, float end, float parameter)
start and end specifies the minimum and maximum values. parameter is the value you want to use to generate the smoothstep number. If parameter is less than start, linstep returns 0. If parameter is greater than end, linstep returns 1.
252
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions The following figure compares values returned by smoothstep and linstep over time: parameter
smoothstep
start
linstep
end
Example Suppose you’ve used the Particle Tool to create a collection of particles named Cloud: Expressions
Suppose also you’ve added a dynamic per object opacity attribute to Cloud (see “Working with particle attributes” in Chapter 8). You then write this runtime expression for Cloud’s particle shape node: CloudShape1.opacity = smoothstep(0,5,age);
Using Maya: Hypergraph, Sets & Expressions
253
Functions Curve functions This increases the opacity attribute of CloudShape1 in steps from 0 to 1 for the first 5 seconds of the object’s age. This makes the object fade in from transparent to opaque. The fade in and fade out of the opacity occurs more quickly around 2.5, the midpoint between 0 and 5. 1
opacity
0
5 age (in seconds)
See the linstep function for details on similar examples.
hermite Returns values along a hermite curve. You can use the hermite function, for instance, to move a particle object’s position smoothly along a curve. As the examples in the following pages show, you can create various curve shapes by altering the arguments to the hermite function. vector float
hermite(vector start, vector end, vector tan1, vector tan2, float parameter)
hermite(float start, float end, float tan1, float tan2, float parameter)
start is the start point of the curve. end is the end point of the curve. tan1 is the tangent vector that guides the direction and shape of the curve as it leaves the start point of the curve. The vector’s position starts at the start point of the curve. tan2 is the tangent vector that guides the direction and shape of the curve as it approaches the end point of the curve. The vector’s position starts at the end point of the curve. parameter is an floating point value between 0 and 1, for example, the value returned by a linstep function. In the second format, the arguments and return values work in a single dimension.
254
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Example 1 Suppose you create an object named dust made of one particle at the origin. To guide its motion along a short upward-bound curve for the first four seconds of animation, you can write the following runtime expression: dust.position = hermite(<<0,0,0>>,<<2,2,0>>, <<3,0,0>>, <<0,3,0>>, linstep(0,4,time));
When you play the animation, the particle moves from the start point <0,0,0> along a curve to the end point <2,2,0>. The tangent vector <3,0,0> sets the curve’s direction and shape as it leaves the start point. The tangent vector <0,3,0> sets the curve’s direction and shape as it approaches the end point. From zero to four seconds of animation play, the particle moves along the curve as defined by the linstep function. (See page 249 for details on linstep.) The function arguments and resulting path of the object follow: Y
tan2 = <<0,3,0>>
Expressions
end = <<2,2,0>>
Object’s path
start = <<0,0,0>>
tan1 = <<3,0,0>>
X
Example 2 Suppose you change the third argument of the previous example expression to <<6,0,0>>: dust.position = hermite(<<0,0,0>>,<<2,2,0>>, <<6,0,0>>, <<0,3,0>>, linstep(0,4,time));
Using Maya: Hypergraph, Sets & Expressions
255
Functions Curve functions The slope of the path curve steepens because of the longer tan1 vector: Y
tan2 = <<0,3,0>>
end = <<2,2,0>>
Object’s path X start = <<0,0,0>>
tan1 = <<6,0,0>>
Example 3 The following expression moves dust in an S pattern: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,3,0>>, <<0,3,0>>, linstep(0,4,time)); Y
tan1 = <<0,3,0>>
tan2 = <<0,3,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
The tan1 vector <<0,3,0>> sets the direction of the curve from the start point to a positive Y direction. The tan2 vector <<0,3,0>> sets the direction of the curve to a positive Y direction as it approaches the end point. Values between the start and end point curves are interpolated to form an S pattern.
256
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Example 4 Suppose you change the fourth argument of the previous example expression to <<0,-3,0>>: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,3,0>>, <<0,-3,0>>, linstep(0,4,time));
The dust particle moves in a pattern resembling a half-circle: Y
tan1 = <<0,3,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
Expressions
tan2 = <<0,-3,0>>
The tan1 vector <<0,3,0>> sets the direction of the curve from the start point to a positive Y direction. The tan2 vector <<0,-3,0>> sets the direction of the curve to a negative Y direction as it approaches the end point.
Example 5 Suppose you change the third argument of the preceding example to <<0,10,0>>: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,10,0>>, <<0,-3,0>>, linstep(0,4,time));
Using Maya: Hypergraph, Sets & Expressions
257
Functions Curve functions
Y tan1 = <<0,10,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
tan2 = <<0,-3,0>>
Because of the longer tan1 vector, the slope of the path curve steepens as it rises from the start point. Because the tan2 vector has a smaller Y magnitude than the Y magnitude of the tan1 vector, the slope of the path curve is flatter as it approaches the end point. The curve’s rise in the Y direction is greater than the previous example because the magnitude of tan1’s Y component is larger (10 instead of 3).
258
Using Maya: Hypergraph, Sets & Expressions
Functions General commands
General commands The following functions do various actions in Maya.
eval Executes a MEL command. string
eval(string command)
command is either a command string enclosed in quote marks or a string variable containing a command. The returned value contains command output returned by the command’s execution.
Example 1 eval("select -cl")
Executes the command select -cl, which deselects all objects in the scene. Though the return value is not used in this example, it contains the command output.
Example 2
The first statement assigns the command string select -cl to the string variable $cmd. The second statement executes the contents of $cmd, which is the command select -cl.
Example 3 string $mycommand = "sphere"; eval($mycommand+"-r 5");
The first statement assigns the string sphere to the variable $mycommand. The second statement appends -r 5 to the string sphere and executes the complete command sphere -r 5. This creates a sphere with a radius of 5 grid units.
Using Maya: Hypergraph, Sets & Expressions
259
Expressions
string $cmd = "select -cl"; eval($cmd);
Functions General commands
Example 4 string $a[]; $a = eval("ls -lights"); print($a);
The first statement defines an array of strings named $a. The second statement executes the MEL command ls -lights, then assigns the command’s output to array $a. The third statement displays the contents of $a to the Script Editor as follows: ambientLightShape1 directionalLightShape1
Note that each line of command output appears on a new line. Each command output line is an array element. Maya formats array output with each array element on a new line.
Example 5 Suppose you’ve created a MEL script file named bunk.mel in your Maya scripts directory and it contains this procedure: global proc string bunk() { string $fog; if (rand(2) < 1) $fog = "particle"; else $fog = "sphere"; return $fog; }
Further suppose you create this expression: string $name = bunk(); eval($name); print($name);
The first expression statement executes the bunk() procedure in the bunk.mel script file. In the bunk procedure, the if-else statement generates a random floating point value between 0 and 2, then compares its value to 1. If the value is less than 1, the statement assigns the MEL command string particle to $fog. If the value is greater than 1, $fog receives the command string sphere.
260
Using Maya: Hypergraph, Sets & Expressions
Functions General commands The procedure finishes executing and passes the value of $fog back to the calling procedure, bunk() in the expression. This assigns the command string to the variable $name. The eval function executes the command string stored in the $name. For example, the statement might execute particle, which creates a particle at the origin of the workspace. The fourth statement displays the contents of $name, for example, particle. The expression executes each frame and creates a new particle or sphere.
print Displays text in the Script Editor. You can use this function to display the contents of attributes and variables. This is helpful for debugging an expression. print(string text) print(vector number) print(float number) print(int number) print(array number)
number is a number without the quote marks. Numerical arguments display as strings. There is no returned value for this function. Note the following display considerations. •
You can format displayed text with standard C language escape characters. For example, you can create a new line with “\n” or a tab character with “\t” in the argument.
•
Displaying a floating point value shows the number with up to 10 digits to the right of the decimal point, for example 0.3333333333.
•
Insignificant 0 digits are truncated from floating point numbers. For example, floating point number 2.0 is displayed as 2.
Using Maya: Hypergraph, Sets & Expressions
261
Expressions
text is either a string enclosed in quote marks or an attribute name or string variable containing text.
Functions General commands •
A vector appears with a space separating components and no double angle brackets. Each vector component has a floating point value with up to 10 digits to the right of the decimal point. For example, a vector <<1.518876356, 0, -1.290387446>> appears in the Script Editor as this: 1.518876356 0 -1.290387446
•
Arrays are formatted with each array element on a new line.
•
You can use the + operator to join two strings in an argument: "text1" + "text2"
This is displayed as: text1text2
•
You can also append a number to a string: "text" + 1
This is displayed as: text1
•
You cannot use the + operator with a string array.
•
If you assign a string to a variable that’s not a string data type, the following text appears if you display the variable: Variable data type
String assignment
Data displayed
float
"3.14"
3.14
int
"3.14"
3
vector
"3.14"
3.14 0 0
float
"pi is 3.14"
0, error message
As shown in the last row of the table, if a variable is assigned a string that starts with a nonnumerical character, Maya converts the string to 0. •
262
For a nonparticle expression consisting of only print statements, Always Evaluate must be on in the Expression Editor for the expression to execute.
Using Maya: Hypergraph, Sets & Expressions
Functions General commands
Examples print(time); print("\n");
The first statement displays the value of time. The second statement displays a new-line character after the value of time, so the time appears on a separate line in the Script Editor. float $f = 3.14159; print($f);
Displays the floating point number 3.14159. string $s = "Hello There"; print($s);
Displays the string Hello There. vector $v; $v = <<1.2,2.3,3.4>>; print($v);
Displays the vector as 1.2 2.3 3.4. string $a[]; $a = eval("ls -lights"); print($a+" are the lights in my scene.\n");
Expressions
The print function causes an error message because you cannot use the + operator with a string array.
system Passes a UNIX command to the shell where you launched Maya. int
system( string command)
command is either a command string enclosed in quote marks or a string variable containing a command. The returned value is the output resulting from the command’s execution.
Example string $cmdout; $cmdout = system("date"); print($cmdout+"\n");
Using Maya: Hypergraph, Sets & Expressions
263
Functions Other functions and commands Executes the UNIX date command, which outputs your workstation’s date and time to the $cmdout variable. The final statement displays the date in the Script Editor.
Other functions and commands In addition to the functions described in this chapter, you might find the following less commonly used functions and administration commands helpful. For details on usage, see the MEL online documentation. General
Math
Curve
String
File
alias
acosh
besselj0
gmatch
fopen
catch
asinh
besselj1
match
fclose
chdir
atanh
besseljn
size
fflush
env
constrainValue
besselyn
strcmp
popen
error
erf
substitute
pclose
exists
erfc
substring
fprint
getenv
expm1
tokenize
frewind
getpid
fmod
tolower
feof
gmatch
gamma
toupper
fgetline
putenv
log1p
pwd
fwrite
source
fread
trace
filetest
warning whatIs
264
fgetword
Using Maya: Hypergraph, Sets & Expressions
Index Symbols
abbreviating attribute names 112, 116 abs function 209 absolute value 209 acceleration 197 acceleration attribute assigning constant value to 156 assigning with runtime expression 155 changing value randomly 156 field’s effect on 175 initialization to zero 177 working with 175 acos function 225, 226 Add Attribute window 50, 120, 169 Add Dynamic Attributes 49, 161 Add Initial State Attribute checkbox 163, 170 adding custom attributes 119, 169 age 197 age of particles at rewind 150 how to examine 150 runtime expression execution and 152 when created with Particle tool 168 alias UNIX command avoiding use with text editor 109 Always Evaluate 130 Always Evaluate checkbox 118 amplitude of sin function 221 angle function 229
angular units conversion of 128 degrees 29, 127 radians 29, 127 arc cosine 225, 226 arc sine 226 arc tangent 227, 228 arguments in functions 205 arithmetic operators 63 array (per particle) attributes 163 assigning to array of different length 172 array functions 236 array indexes invalid assigment to 193 Array option for per particle attributes 170 arrays 93 clearing contents of 236 display format 262 element assignment 95 example initialization and usage 93 exceeding memory capacity of 93 expansion of 93 invalid assignment to indexes 193 obtaining size of 237 sorting 237 asin function 226 assigning to attributes 55 to int or float variables 60 to specific particles 189 to vector attributes 56 to vector components 193, 194 to vector variables 61 vector to three scalar attributes 56 assignment operator 47
Using Maya: Hypergraph, Sets & Expressions
265
Index
! 87 - 63 -- 92 != 65, 66 $ 59, 73 % 63, 182 %= 92 && 67 * 63 *= 92 + 63 ++ 92 += 92 / 63 // 75 /= 92 < 65 << >> 53, 73, 180, 193 <= 65 -= 92 = 47, 55 == 65, 66, 74 > 65 >= 65 ?: 86 \n 261 { } 39, 70, 72, 73 | 140 || 67
A
Index
atan function 227 atan2 function 227 atan2d function 228 atand function 227 attribute names renaming as short names 137 attributeName 197
266
attributes abbreviating names 112, 116 assigning conditionally 32 assigning to 55 assigning to multiple 13, 23 assigning to multiple objects 13, 28 connecting to symbolic placeholders 135 custom 50 data types 51 deleting from expressions 131 disconnecting from expressions 132 displayed in Attributes list 18 displaying contents of 123 displaying disconnected 132 dynamic 49 eliminating expression control of 122 full name 51 initial state 158, 162 linking 11, 15, 26 long names 114 name syntax 47 not selecting for particle shape node 112 particle shape node 159 per object 12, 160 per particle 12, 160 reading in expressions 133 removing from expressions 131 seeing abbreviations of 113, 115 static 49 unexpected values 141 Attributes list 103
Using Maya: Hypergraph, Sets & Expressions
B base number raised to exponent 215 bell curve function 239 betterIllumination 197 blank lines in expressions 74 Booleans 52 handling as floating point 65 symbolic constants 95 braces 72 in statements 39, 40 matching pairs of 73 brackets double angle 53, 73, 180, 193 break instruction 79
C C language escape characters 261 syntax in expressions 75 case sensitivity in variable names 59 castsShadows 201 ceil function 210 centimeters 127 Channel Box displaying attribute values in 30 choice command 132 circular motion of NURBS sphere 119 clamp function 211 clear function 236 clearing an expression 106 array contents 236
Index
conversion of angular units only 128 of data types 143, 144 of user selected units 127 conversion functions 234 converting degrees to radians 129 measurement units 128 statements to comments 131 copying text in expressions 105 cos function 216 comparison with sin function 218 cosd function 218 cosine 216, 217, 218 cosine wave pattern animating a ball 217 count 197 Create button 22 Create Event 184 creating new expressions 111 creation expressions 148 assigning to rgbPP 179 dynamics start frame 149 example assignment to lifespan 165, 167 example assignment to lifespanPP 164 execution for emitted particles 149 how often execution occurs 148 using values in runtime expressions 174 when to use 150 cross function 230 cross product of two vectors 230 curve functions 249
custom attributes 50 adding to an object 119 adding to particle shape node 169 assigning to 169 examples of assignment 171 when to use 118 custom variables 59 declaring 59 using globally 61 cyclical pattern with sin function 220
D data types attribute 53 Boolean 52 conversion during assignment 143, 144 conversion of displayed strings 262 conversion with arithmetic operators 145 data entry limitations 54 float array 52 floating point 52 functions 208 integers 52 matrix 55 vector array 52 debugging expressions with print function 261 decimal deletion in data type conversion 144 decimal precision in display 261 declaring variables 59 default object in Expression Editor 104 making an object the 115 defining variables 26 deg_to_rad function 234
Using Maya: Hypergraph, Sets & Expressions
267
Index
collision example of controlling color resulting from 185 working with particles 183 color Christmas light effect with particles 181 giving object constant color 179 giving particles randomly changing color 180 understanding RGB and HSV 235 working with 178 colorAccum 197 colorBlue 197 colorEditor 235 colorGreen 197 colorRed 197 comments converting statements to 131 in expressions 75 compiling an expression 19, 62, 118 conditional assignment to attributes 32 conditional statements 69 else-if 71 if 34, 69 if-else 70 confining numerical range 211 connectAttr command 135 connecting an attribute 135 Connection Editor 132, 135 conserve 197 constants 62 Boolean 95 continue instruction 80 controlling flow in statements 77
Index
degrees 29 converting to radians 129, 234 deleting attribute names 131 expressions 112, 134 text from expressions 105 depthSort 197 discarded remainders in data type conversions 146 disconnectAttr command 132 disconnecting an attribute 132 displaying attribute contents 123 disconnected attributes 132 text 261 variable contents 123 dnoise function 242 do loop 78 dollar sign ($) in variable names 59, 73 dot function 231 dot product 231 dot product operator 64 double angle brackets 53, 73, 180, 193 dynamic attributes 49 adding to object 49, 50, 161 dynamic per object attribute example assignment to lifespan 167 dynamic per particle attribute example assignment to lifespanPP 164 dynamics changing start frame 149 how often Maya evaluates 149, 152 Dynamics Controller 149, 152 dynamicsWeight 198 dynamicsWeight attribute 178
268
E e raised to power 214 Edit button 22 editing expressions in text field 99, 105 else keyword 38 else-if statements 71 emitted particles age of 149 assigning lifespanPP for 183 creation expression execution and 149 working with 183 English common names for attributes 114 equal to (==) operator 36 errors common expression 95 comparing floats with the == operator 89 from wrong data types in functions 208 in flow control statements 88 logic 95 message format of 95 syntax 36, 73, 95 where they appear 96 eval function 259 event 198 event attribute 184 when collision count increases 187 eventCount 198 eventCount attribute 184 eventTest 198 eventTest attribute 184 examining two or more expressions 106
Using Maya: Hypergraph, Sets & Expressions
executing MEL commands in expressions 137 MEL commands with eval function 259 MEL procedures in expressions 139 nonparticle expressions 118 UNIX commands in expressions 263 execution slow expression 127 exp function 214 exponential functions 214 Expression Editor starting 13
Index
slow execution of 127 speeding execution of 127 text field 14 tutorials 15 type case sensitivity 18 when unusable 12 Expressions list 100, 104
F fading opacity 249, 253 fields influence on expression 175 turning off effect in an expression 178 filtering attributes by connected attribute 104 from Expression Editor 104 filtering expressions 99 finding expressions by connected attribute 101 by expression name 100 by item type 102 by selected object 101 float 52, 57 float arrays data type 52 floating point 52 floor function 210 flow control errors 88 flow control statements 77 for loop 79 for-in loop 81 forward slashes (//) for comments 75 frame 0 reason for using in examples 43 frame playback rate 16, 58 frame variable 57 frequency multiplier of sin function 222
frequency of sin function 222 full attribute name 51 functions 47 arguments in 47, 205, 206 array 236 as expression elements 47 complete list of 203 conversion 234 curve 249 data type of arguments 206 data type of returned values 206 essential for advanced expression writing 206 format of 206 introduction to 203 limit 209 others in online documentation 264 random number 123, 239 spaces in 207 trigonometric 216 understanding book examples 208 vector 229
G gauss function 239 Gaussian distribution 239 General button 49 general commands 259 global procedures declaring 139 global variables 61 declaring 62 initializing 62 goal attribute 161 Goal button 161 goalPP 198 goalPP attribute 161
Using Maya: Hypergraph, Sets & Expressions
Index
expressions advantage of separate 31 advantage of single 31 comments in 75 common errors 95 comparison with MEL scripts 46 compiling 19 copying text 105 creating 13 creating new 111 creation 148 default object 104 deleting 112, 131 deleting text in 105 displaying connected attributes only 104 editing in text field 99 editing with text editor 106 elements of 46, 47 eliminating control of attributes 122 erasing 106 examining two or more 106 execution for nonparticle shapes 118 field’s influence on 175 filtering 99 finding 100, 101, 102 for particles 147 input to 133, 135 keywords 76 names for particle shape node 100 naming conventions 18 output from 134, 136 programming features 75 redundant execution 130, 154 reloading 106 required elements of 48 runtime 148 runtime execution 152 saving to file 107
269
Index
goalWeight 198 gravity field acceleration’s effect on 177
H half-circle creating motion with hermite function 257 hermite function 254 HSV conversion to RGB 235 hsv_to_rgb function 235 hypot function 229
I if statements 32, 34, 69 if-else abbreviation 86 if-else statements 38, 39, 70 incandescence 198 incandescencePP 198 increment operations and unexpected values 142 inheritFactor 198 initial state attributes 158, 162, 163 creation expression execution 150 naming convention 163 saving values for 158 input to expressions 135 integers 52, 57 handling as floating point 65 internal conversion of units 127 isDynamic 198
jot text editor 107
K keyframes eliminating expression to use 122 keywords in expressions 76
L levelOfDetail 199 lifespan 198 lifespan attribute 161 example assignment in creation expression 167 Lifespan button 161 lifespanPP 199 lifespanPP attribute 161, 164 assigning for emitted particles 183 limit functions 209 lineWidth 199 linking attributes 11, 15, 26 linstep function 249 comparison with smoothstep 253 listAttributes MEL command 163 log base 10 214 log function 214 logic errors 95 logical operators 67 && 67 || 67 long attribute names 114 looping errors 88
J joining text in strings 262
270
Using Maya: Hypergraph, Sets & Expressions
M mag function 231 magnitude of a vector 67, 231 mass 199 matrix data type 55 max function 212 maxCount 199 measurement units 127 MEL commands 45, 46 executing with eval function 259 using alone in statements 137 using with eval function 138 using within single quotes 138 MEL procedures using in expressions 138 MEL scripts 46 millimeters 128 min function 212 mixed data types using with arithmetic operators 145 modulus operator (%) 63, 182, 192 risk of using with floats 182 motion creating jittery 175 creating smooth, random 175 multiCount 199 multiRadius 199
N natural logarithm 214 new line characters in print statement 261
Index
noise function 241 returned values with frame argument 242 returned values with time argument 241 normalDir 199 not (!) operator 87 number sequences generating consistently random 125 numeric render type 190
O object names omitting in expressions 115 path of 140 Objects list 103 offset with sin function 222 omitting object names in expressions 115 online function documentation 264 opacity 200 opacity attribute 161 fading over time 249, 253 Opacity button 161 opacityPP 200 opacityPP attribute 161
operators arithmetic 48, 63 assigning values to 36 dot product 64 equal to 36, 65 greater than 65 greater than or equal to 65 less than 35, 65 less than or equal to 65 logical 48, 67 not equal to 65 precedence 68 relational 48, 65 shortcut assignment 91 shortcut increment and decrement 92 order of statements 37 output from expression 134, 136 oversample level 152, 156
P parentheses matching pairs of 73 use in conditionals 68, 73 particle array attributes assigning to different lengths 172 particle attributes list of 196 Particle Collision Events 184 particleId 200 particleId attribute 189
Using Maya: Hypergraph, Sets & Expressions
271
Index
particles age of 150 assigning to specific 189 attribute data types 52 expressions for 147 moving position with hermite function 254 selecting shape node 148 shape node attributes 159 transform node attributes 159 using sphrand to create ellipsoid of 245 working with collisions 183 path names of objects 140 per object attributes 12, 160 keyframing 160 naming conventions 160 scalar option 170 per particle attributes 12, 53, 160 Array option 170 assigning to individual particles 189 how to distinguish 160 naming conventions 160 Perlin noise field 241 playback rate 58 pointSize 200 position 200 position attribute assigning with creation expression 158 assigning with runtime expression 157 field’s effect on 175 working with 175 pow function 215 precedence of operators 68 precision of float display 261 predefined variables 57 frame 57 time 57 primaryVisibility 201
Index
print function 261 programming features 75
R radians 29, 127 angle between two vectors 229 converting to degrees 234 radius 200 radius0 200 radius1 200 radiusPP 200 rand function 140, 243 rand functions 123 random lifespan of particles 165 random number functions 123, 239 random numbers making return values consistent 124 redundant expressions 130 relational operators 65 reloading expressions 106 removing an attribute 131 renaming an object 136 render type numeric 190 rewinding effect on creation expressions 149 unexpected values 141 RGB conversion to HSV 235 rgb_to_hsv function 235 rgbPP 201 rgbPP attribute example use of 179 rotate function 232
272
rotating object around its axis 28 point’s position 232 rounding errors from converting radians to degrees 208 rounding numbers 210 rules of syntax 73 runtime expressions 148, 153 assigning rgbPP in 181 how often execution occurs 148, 152
S saving an expression 107 saving attribute values for initial state 158, 188 Scalar option for per object attributes 170 scale multiplying by percentage 41 slowing increase of 21, 26 Script Editor error display 96 scripting with MEL 45 scripts directory 139 seed function 246 making consistent random values 125 selectedOnly 201 Selection list 103, 104 semicolon terminator 18, 48, 73 Set for All Dynamic 162 Set For Current 150 Set for Current 158, 162, 188 shaded spheres how rendered in examples 154
Using Maya: Hypergraph, Sets & Expressions
short attribute names renaming as long names 137 shortcut operators assignment 91 increment and decrement 92 sign function 212 sin function 219 equation for various uses of 223 sind function 224 sine 219, 224 size function 237 Smooth Shade All 154 smooth shading setting all objects to 16 smoothly increasing opacity 250 smoothstep function 252 comparison with linstep 253 soft body attributes in common with particles 50 spaces in expressions 74 in functions 207 specific particles assigning to 189 speeding expression execution 127, 128 spheres how shaded in examples 154 sphrand function 123, 140, 156, 177, 244 use with random color 181 spriteNum 201 spriteNumPP 201 spriteScaleX 201 spriteScaleXPP 201 spriteScaleY 201 spriteScaleYPP 201 spriteTwist 201 spriteTwistPP 202
Index
sqrt function 215 square root 215 S-shaped cycle sin function and 221 S-shaped motion creating with hermite function 256 standard deviation with Gaussian values 239 starting the Expression Editor 13 statements between { } 70 order of 37 static attributes 49 strings 57, 90 assigning to a vector 91 concatenating with + 90 data type conversion 91, 262 joining 262 syntax rules 90 surfaceShading 202 switch instruction 83 symbolic placeholders 132, 134 syntax errors 36, 73, 95 rules 73 system function 263
T
U unexpected values after incrementing 142 after rewinding 141 in mixed data type division 146 of attributes 141, 143
unit function 233 unit vector 233 units internal conversion of 127, 128 UNIX commands executing from expressions 263 useLifspanPP attribute 161 useLighting 202
V variables 56 as expression element 48 assigning to vector 61 data type of 57 declaring 59 defining 26 displaying contents 123 predefined 57 unexpected values 143 vector functions 229 vectors 57 assigning to component of array attribute 194 assigning to variable 193 component operator 194 data type 52 definition 52 dot product 231 format in print function output 262 formula for magnitude 67, 231 magnitude of 2D 228 random vectors with sphrand 244 velocity 202
Using Maya: Hypergraph, Sets & Expressions
273
Index
tab characters in expressions 74 tailFade 202 tailSize 202 tan function 224 tand function 225 tangent 224, 225 terminator statement 73
text editor changing operation settings 110 quitting 107 selecting 107 selecting default startup 110 using on expression 106 using unlisted 109 valid options 109 threshold 202 time changing 152 default use of seconds 33 definition 57 dividing by 27 multiplying by 27 negative value of 59 predefined variable 19 relationship to frame 59 value at different frames 19 Time Slider setting start and end range 16 timesteps 156 transform nodes not used for particle expressions 151 trigonometric functions 216 trunc function 213 truncating insignificant numbers 213, 261 tutorials for expressions 15
Index
velocity attribute assigning with creation expression 150 assigning with runtime expression 153, 154 field’s effect on 175 working with 175 vi text editor 107 vim text editor 107 visibleInReflections 201 visibleInRefractions 201
W while loop 77 white space in expressions 74 WINEDITOR setting 109, 110
X xemacs text editor 107
274
Using Maya: Hypergraph, Sets & Expressions
Maya Fundamentals This tutorial covers the basic layout of the Maya user interface and is intended to get you up to speed on Maya terminology and usage techniques.
A Taste of Maya
In this tutorial: n
Maya’s user interface components
n
Commonly used UI windows
n
Working in Maya’s camera viewport
n
Selecting and manipulating objects in Maya
n
Using Maya, Selection/Action vs. Tool based interactions
Maya UI Tour
Note:
Questions? visit www.aliaswavefront.com/tasteofmaya
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install. Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
Maya’s User Interface Maya’s user interface is an amazing step forward in 3D graphics applications. The first impression of Maya can be overwhelming. Maya has a huge range of capabilities and the UI (User Interface) will reflect this fact. When you understand how it all fits together and the common modes of functionality that run through Maya you will begin to see a pattern of usability. This pattern will enable you to explore any aspect of Maya on firm footing. Sections inside this tutorial: User Interface Components The first section of this tutorial explores the main menu sets, windows and editors as well as components of Maya’s UI. Working with Objects and Cameras The second section focuses on selecting and manipulating objects and cameras. Selection-action and tool based commands are discussed.
The Components of Maya’s User Interface In the following tutorial steps you will be exploring Maya’s user interface or UI for short. 1 Open Maya and a new scene file n Start Maya There are several ways to start Maya in Windows NT: Double click the Maya program icon on the desktop. Double click a Maya scene file from the explorer window. Navigate from the start menu to Programs → Maya 2.5 Evaluation → Maya. n
A New Untitled scene file is opened automatically to provide a clean slate to start with.
For the process of getting familiar with the interface you will turn off all of the interface and one by one turn on each component. 2 Pop-up help In Maya if you hold the mouse cursor over an icon in the user interface without moving it for a second a pop up help will show up with the name of the tool you are over. 3 Turn off all of the UI components To turn off the UI components you will use the Options menu pull down.
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Maya UI Tour
n
Select the Options menu.
n
Notice the two parallel bars at the top of the Options menu. If you LMB (Left Mouse Button) click on these bars you can detach the menu. Detach the menu and drag it to the side out of the way. This menu contains menus and UI components for customizing your UI and Maya preferences. It also contains two commands for quickly showing and hiding pieces of the UI: Show Only Viewing Panes Show All Panes
n
Select Show Only Viewing Panes This will turn off all of the elements that are listed above the command in the Options menu. The remaining elements are the camera viewport and the main menu.
4 Turn on individual UI components n One by one select the UI elements that make up the list in the Options menu starting with the Status Line:
Status Line with Menu Set selector highlighted n
Status Line: The Status Line contains many useful items, from left to right: Main menu set selection Selection locking Selection masking Hierarchy, Object, Components selection Pick Mask Snapping: Grid, Curve, Point, and View Planes Make selected object live Input and Output operations lists Toggle construction history on/off
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Maya UI Tour
n
Questions? visit www.aliaswavefront.com/tasteofmaya
Shelf: The Shelf UI is comprised of two sections. The Mini-Bar section on the far left-hand side and the userdefined “shelf” or tabbed command storage sections on the right hand side. The mini bar contains commonly used tools including Selection, Move, Rotate, Scale, the Show Manipulator Tool, and the Currently Active Tool. The hotkeys for the items in the minibar from left to right are Q,W, E, R,T, Y. Maya shelves are user defined. They can be created for several purposes but mainly are used to store commonly used organizations of commands. MEL (Maya Embedded Language) commands can be drag and dropped to the shelf to create a shelf button. To use the shelf icons you just need to click on one of the icons. For example if you click on the sphere icon in the shelf it will create a sphere.
n
Feedback Line: The Feedback Line communicates information back to the user. Depending on the manipulator or tool you are currently using, different information will be displayed in the Feedback Line. If you are rotating the camera for example, this rotation will be displayed in degrees on the Feedback Line.
n
Layer Bar: The Layer Bar contains layer creation and display buttons. Layers in Maya are a powerful method of organizing the display and collection of objects in your scene.
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
For example, in preparation for compositing, you could put all your background objects on one layer. Your hero object could exist on its own layer while the foreground objects could make up yet another layer. Layers are mutually exclusive, an object can only exist in one layer at a time. RMB clicking on the layer in the layer bar displays a menu allowing you to control the contents and display characteristics of its contents. Clicking the button at the far left of the Layer Bar creates a new layer.
n
Time Slider: The Time Slider contains the display and control of time playback, pause, rewind and some keyframing functions. From the Time Slider you can set the current frame as well as advance or retreat from the next keyframe on the selected object. The LMB can be used to LMB drag and “scrub” the current time. Shift + LMB drag selects a region of time (highlighted in red) which can then be moved around the time slider, in effect moving keyframes around as a group. Pressing RMB in the main region of the time slider displays a menu with a list of choices. For example you can Cut and Paste a selected region of keyframes back into the Time Slider or onto a different object entirely.
n
Range Slider: The Range Slider contains more UI used for controlling animation parameters. You can establish the range of animation frames in the scene and, by growing or shrinking the range slider, you can focus on certain regions of frames.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
On the right-hand side of the range slider are buttons to select the current Character, and toggle Auto Keyframing. The button on the far right-hand side displays the General Preferences Animation Preferences. n
Command Line: MEL stands for Maya Embedded Language and is Maya’s built in scripting language. The Command Line contains a single line with which you can view and write MEL commands. The left-hand portion of the command line is a text field where you can enter MEL commands. The righthand portion is a text field that displays the last printed line of MEL feedback visible in the Script Editor. The far right-hand side contains a button to raise the Script Editor window.
n
Help Line: The Help Line is very useful for new users as this line displays information about tools and procedures that the user is presented with as you work in Maya. As you drag your mouse over areas of the interface, information is displayed in the Help Line describing the item. When you are working with a command or tool the Help Line prompts you for the next expected action or present tips on using the current tool. Popup Help is also available in Maya. Toggle Popup Help from the Help pull down menu.
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Channel Box The last two items in the Options list are Channel Box and Attribute Editor. Since the Channel Box and Attribute Editor are similar in the information presented you will usually want one or the other displayed at one time. It is very handy to quickly change between these two windows. Also having them as part of the main Maya window is important to avoid cluttering the interface with floating windows. n
Channel Box: The Channel Box is the work horse UI of Maya. This is where you will view and enter information into Maya. Maya is about nodes and the attributes on these nodes. The Channel Box is a simple lightweight UI for accessing and editing these attributes. The top section of the Channel Box contains basic information about the selected object. These are the attributes that control where the object in the scene is. Below this section are the nodes related to this object. The Shape nodes which carry information about an object beyond just its position, rotation and scale. For example the makeNurbCube shape node contains information about width, length to height ratio, and Patches in U and V directions. These attributes are editable and keyframable. Also listed in the Channel Box are the input and output nodes related to the selected object. By selecting these objects you can address these related objects. Some Attribute fields in the Channel Box contain preset pulldown choice menus where applicable. LMB on an attribute field to see if it also contains a pulldown choice menu.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Maya UI Tour
Note:
Questions? visit www.aliaswavefront.com/tasteofmaya
In the Channel Box and the Attribute Editor you can use your RMB when the cursor is over attributes and you will have access to a drop down menu specific to that attribute. RMB can be used in other areas as well. For example if you create a sphere and place the cursor over it and RMB a marking menu will show up specific to that object
Attribute Editor n
Attribute Editor: The Attribute Editor is a more detailed version of the Channel Box. Whereas the Channel Box is an abbreviated list of keyable attributes, the Attribute Editor is a listing of all attributes on the selected node or object. The Attribute Editor includes things like sliders, pulldown menus and drag and drop connections functionality.
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Maya UI Tour
Objects in Maya have a top level node called a Transform node. This is the basic node used to control an objects position, rotation, and scale. These attributes are known as the Transform Attributes. Objects in Maya have a secondary node known as a Shape node. The shape node contains information about an object’s surface history, render properties, and display quality. Other nodes like texture and material nodes are best edited using the Attribute Editor in conjunction with the Hypershade/Visor windows. The tabs located at the top of the Attribute Editor let you choose which node to edit. The items displayed in the body of the Attribute Editor are the attributes associated with that node. n
Preferences: Maya’s preferences are broken up into several areas. General, UI, and Customizing:
General Preferences General Preferences: The General Preferences is where the majority of Maya’s preference settings are be modified. These settings control general usability and functionality of commands. In the General Tab, for example, you can establish how big your Undo Queue is. TIP: For now set your Undo Queue to Infinite. In the Units Tab, for example you can set your frame rate and scene scale units. In the above image in the top right corner you will see to buttons with arrows pointing left and right. They are used to scroll through the tabs.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
UI Preferences: The UI Preferences allow you to set many of the options for how the UI will behave by default or on start up of Maya. For example in the Windows Tab, you should set the Open Attribute Editor to: In Main Maya Window so that the Attribute Editor will not be floating when you press the hotkey Ctrl - a. Customize UI: The Customize UI menu contains separate editors for customizing your interaction with Maya: Hotkeys...: The Hotkeys Editor is where you establish how commands are executed by short-cut key stroke combinations. Colors...: The Colors Editor is where you set or change the way objects and interface components are colored. Marking Menus...: The Marking Menus Editor is where you establish or customize the actions associated with Marking Menus. Marking Menus are a handy UI concept pioneered by Alias|Wavefront that display specialized menus at the location of your cursor. To activate a marking menu you press a key while LMB dragging in the viewport. This action activates a system of menus that you can navigate. For example press the w key and then m. A marking meny will appear under the mouse which will allow you to change the move tool and the . An example of marking menus exists by pressing the space bar to activate the hotbox. From in the hotbox you can LMB drag in different zones to initiate different related sets of marking menus. Shelves...: The Shelves Editor is where you customize your shelves. From this editor you can create, reorganize and edit the contents of your shelves. Panels...: The Panels Editor is also the Layout Editor. This editor lets you establish and edit the windows and configuration of windows (panels) that are displayed in Maya. Working efficiently in Maya will demand that you become comfortable with building layouts made of groups of panels. By building layouts for certain tasks like rendering, modeling and animating you can avoid having floating windows that get in your way. A common method of accessing layouts is by building shelf buttons that activate certain layouts. The Panels Editor is where you can build layouts and make shelf buttons to activate these layouts. Animation | Modeling | Dynamics | Rendering Maya has four basic modes of menu set organization. On the far right side of the Status Line is a pulldown menu for these menu sets. By selecting a menu set you are selecting the menus displayed in the main menu bar along the top of Maya. The four basic modes of menu set organization are: n
Animation: The Animation menu set contains menus for: Setting keyframes, creating Set Driven Key relationships, Path animation and Constraints. Skinning and IK skeleton creation menus are also part of this menu set as are the menus supporting the Deformers.
n
Modeling: The Modeling menu set contains menus for creating curves and surfaces as well as Polygon creation and editing tools.
n
Dynamics: The Dynamics menu set contains menus for Particles, Rigid and Soft Body creation and editing tools. The Effects menu contains many pre-made dynamics effects tools and examples of what can be done with Maya’s dynamics tools.
n
Rendering: The Rendering menu set contains menus for creating lights and materials as well as texture application tools. The Paint Effects toolset menus are also located in this menu set. Rendering menus are also located here that allow you to do batch rendering which is how you render out a sequence of animation.
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Maya UI Tour
Common Menus The first seven menus from the left are common to all the menu sets: File | Edit | Modify | Create | Display | Window | Options. When the menuset is change, these seven menus do not change. n
File: The File menu contains scene management menus and tools. Scene saving and import/export commands are found here as are the project management commands and menus.
n
Edit: The Edit menu contain the common commands that you perform on objects in the course of editing them. Duplicating, Deleting, Selecting, Parenting and Grouping are some of the commands presented here.
n
Modify: The Modify menu is a potpourri of commands and menus used to work with objects in a special manner. Enabling and Disabling nodes, centering an object’s pivot point, or enabling the Artisan tools are examples of some of the tools found here.
n
Create: The Create menu is where you go to create curves, primitive objects, cameras and locators and text objects.
n
Display: The Display menu contains commands that have to do with the display of objects and their components as well as Interface components like the grid and axes.
n
Window: The Window menu is how you access the windows and editors in Maya.
n
Options: The Options window as mentioned above is where you customize your Maya environment and set your preferences for how Maya will handle different circumstances.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Hotbox Hotbox By pressing and holding down the space bar you invoke the Hotbox. The Hotbox is a centralized heads-up display for all the menus in Maya. The Hotbox contains marking menus and zones of interaction that can greatly increase your productivity. The Hotbox can take a while to get used to but it can also unlock a great amount of screen space by removing the need for the main menus. Using the Hotbox: Press and hold the spacebar to invoke the Hotbox. The Hotbox is divided into quadrants. In the above image you can see a big X that radiates out from teh A|W in the centre. This defines the quadrants. To access a quadrant while holding the spacebar just move the cursor into the quadrant (but not over a menu) and press the LMB: North: LMB select the layout views marking menu South: LMB select the editor windows marking menu East: LMB select the UI components marking menu West: LMB select the object and component mask marking menu The Hotbox Controls menu located in the West quadrant of the Hotbox contains menus for setting Hotbox properties. From this menu you can select how many menu sets are included in the Hotbox. The Center A|W Hotbox button contains a marking menu for selecting camera views and the Hotbox style.
Windows and Editors in Maya The following section explores the main windows and editors that you will use in Maya.
12 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Outliner Window Outliner There are two main methods of looking at the contents of a Maya scene file: the Outliner and the Hypergraph. The Outliner displays the contents of your scene file in a listed format. The contents of the Outliner are presented as nested groups if the items under this group are part of a hierarchy. Using the Outliner: Create a few objects by clicking on the sphere and cone icons in the shelf bar or open a scene file from one of the other tutorials (File →Open Scene...) Open the Outliner from Window → Outliner Select an object with LMB click. Re-order an object by MMB click drag (Line between other objects).
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 13
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Parent on object by MMB click drag (Lines Outline parent). Expand/Collapse hierarchy by LMB on the + and - symbols. Show Shape Nodes by RMB click select menu item. Select multiple continuous objects in list, Shift LMB select top object then bottom object of list. Select multiple non-continuous objects in list, Ctrl LMB select each object. Hypergraph The Hypergraph presents the contents of your scene in a different manner. The Hypergraph has two modes of operation for looking at the contents of your scene in two different ways.
Hypergraph Scene Hierarchy mode The first mode is the Scene Hierarchy mode. This mode lets you see objects and their hierarchies much like the Outliner does but in a more freeform layout. Using the Hypergraph: Scene Hierarchy mode Open the Hypergraph from Window → Hypergraph Select an object with LMB click. Navigate around the window using the camera controls: Zoom: alt + LMB +RMB Pan: alt + MMB Frame selected: press f Frame all: press a Re-order an object by LMB click drag (First select Options > Layout > Freeform Layout from the Hypergraph menus). Parent an object by MMB click dragging one object on top of another object or group. Expand/Collapse hierarchy by RMB select Expand or Collapse from menu. Show Shape Nodes by selecting Options > Display > Shape Nodes in the Hypergraph Options menu. Select multiple contiguous objects in list, LMB drag box around objects. Select multiple non-contiguous objects in list, Shift LMB select each object.
14 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Maya UI Tour
The second mode is the Upstream and Downstream Connections mode. This mode lets you see how the flow of information is moving from one node to another through connected attributes. This can be thought of as similar to a production line where each information travels between nodes, each with a specific task it performs on the information before passing it along to the next node in the stream.
Hypergraph Upstream and Downstream mode Using the Hypergraph: Upstream and Downstream Connections Enable the Upstream Downstream mode by pressing the Upstream Downstream button or select Graph > Up and Downstream Connections in the Hypergraph menus. View Attribute Connections by moving your cursor over the line that connects the nodes together. The complete object names and input and output attributes are listed at each end. Delete Connections by LMB selecting the connecting line then press backspace (The line will turn yellow to signify it has been selected). Connect nodes together by MMB dragging one node on top of another node. If a logical and obvious connection can be made then it will be made automatically, otherwise, the Connection Editor will be opened with the correct nodes already inside the Connection Editor ready allowing you to specify which attributes should be connected. Hypershade / Visor The Hypershade and Visor windows are used to build and manage textures and materials for establishing the rendered look of your scene. Although these are listed as separate UI elements they are most often used together and appear as a single UI component.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 15
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Hypershade / Visor window The Hypershade portion of the Hypershade/Visor shares similar functionality to the Hypergraph. In earlier versions of Maya the Hypergraph was used to create and manipulate shader networks. The Hypershade displays materials and textures much like the Hypergraph displays nodes and attribute connections. The Visor is the portion of the Hypershade/Visor combination where you will find your scene elements that you have in your scene or may want to bring into your scene to help create the look of objects when they are rendered. Lights, Cameras, Textures, Sourceimages, and Materials can be found in the Visor. You can also use the Visor to navigate around your hard drives to find other elements not associated with your current project.
16 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Using the Hypershade/Visor: The Hypershade/Visor is found under Window → Hypershade... or Window → Visor... The Hypershade area is a work area most commonly used for creating and editing shader networks. Drag materials from the Visor to the Hypershade work area using MMB. Clear the Hypershade work area by pressing the eraser icon. Drag a material into the Hypershade work area then press the show up and downstream connections button to see the related nodes on the shader. The Visor has two main areas; The Rendering area where you see the items already in your scene. The Create area where you can create items like materials, lights and textures to bring into your scene. Navigate the view of the Hypershade and Visor windows with the same camera controls you use for the Hypergraph and modeling viewports. Zoom: alt + LMB +RMB Pan: alt + MMB Frame selected: press f Frame all: press a Graph Editor
Graph Editor The Graph Editor is where you manage the keyframe animation that you have created. The Graph Editor presents keyframe animation in terms of curves called animCurves.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 17
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Using the Graph Editor: Open up a scene file from one of the other tutorials first so you have something to work with. File → Open Scene... and select jelly4.ma.
The Graph Editor is found under Window → Animation Editors → Graph Editor... Select objects and attributes for animation editing from the left-hand side “Outliner” type list. The related animCurves will be displayed in the right-hand graph portion. Press a or f to frame all or the selected animCurves in the Graph Editor. Select the animCurve with LMB and then select the keyframe knots on the curve to edit the tangency or position of the keyframe. Press w to enable the translate manipulator (manip for short) then press MMB and drag to reposition or press r to enable the Scale manipulator. You can snap to time or value by pressing the Time Snap button or the Value Snap button. Buffer Curves allow you to see a ghosted image of where the curve was before you manipulated it. Enable Buffer Curves by View > Buffer Curves (In the Graph Editor menu). You can snap your curve back to the original shape by Curves > Swap Buffer Curve. (In the Graph Editor menu) The Stats section lets you see and edit the keyframe values manually. Navigate the view of the window with the same camera controls you use for the Hypergraph: Zoom: alt + LMB +RMB Pan: alt + MMB Frame selected: press f Frame all: press a Render Globals General rendering settings are made in the Render Globals window. From the Render Globals window you can adjust settings for the rendered image size or resolution, Anti-aliasing quality, Raytracing quality, Motion blur, and IPR options among many others.
18 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Render Globals Using the Render Globals: Open the Render Globals from Window → Render Globals... Set image naming syntax and padding from the Image File Output section. Set render size or resolution aspect from the Resolution section. Lock Device Aspect Ratio should be on for digital video work that requires “non-square” pixels. You can choose from the list of common standard formats or create a custom resolution and aspect ratio. Anti -aliasing Quality settings control how smoothly curved surfaces are rendered as well as filtering quality of textures. There are presets available for varying degrees of quality or you can create your own custom settings. These settings will have a large impact on render times vs. quality. Raytracing can be turned on and off from this section. If you are Raytracing you can also control what degree of Raytracing is performed. Reflections, refractions, and shadows can have separate sampling rates.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 19
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Field Options is where field rendering settings are made. Field dominance and scanline ordering can be set from this section. Motion Blur is essential for realistic motion as our eyes and the camera see movement. Maya has 2 types of motion blur: 2D motion blur is done as a post process and, for many circumstances, will create very realistic motion blur effects. This is a much faster method of rendering motion blur. With the 2D blur being used you have options for setting the blur length and blur sharpness. 3D motion blur involves much more computation as object positions are calculated and used to establish the effect of blurring an object that is moving in 3 dimensions. If you have objects that are crossing in front of other moving objects or a complex movement of the camera you may want to use this method of motion blur. Render Options section is where many special post processes are enabled and executed. Environment Fog is established from this section as well as Gamma Correction and other general settings. IPR Options are set from this section. IPR is Maya’s Interactive Photorealistic Renderer. With IPR you can edit your lighting and material assignment and settings very quickly. This section controls which parts of IPR rendering takes place. Post process effects are toggled on and off. Paint Effects Rendering Options section enables you to render the paint effects strokes separately from the other elements in the scene. Very useful for compositing.
Render View Render View The Render View window is where you test render your scene. The Render View window is also where you use IPR, Maya’s Interactive Photo-realistic Renderer. Using the Render View Window: Open the Render View window from Window → Rendering Editors → Render View...
20 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Quickly establish a wire frame Snapshot of what you will be rendering by selecting Render → Snapshot → Current (In the Render View menu). To render a region LMB drag a box around the area you want to render then select Render → Render Region (In the Render View menu).
To render the full image as the perspective camera sees things select Render → Render → Current(persp).
To keep an image for comparison in the Render View window’s buffer select File → Keep Image in
Render View (In the Render View menu) or press the Keep Image button.
To save the image to your hard drive select File → Save Image... (In the Render View menu). To view separate components of the image select Display → Mask Plane or Red Plane for example. To use IPR first you must create a deep raster image by selecting IPR → IPR Render → Current (persp) (In the Render View menu). Once the IPR image has been created you are prompted to select a region to update. LMB drag a box to select a region to IPR render. Now as you update your materials or light positions for example the region will update in a scrolling manner from bottom to top. Depending on your system configuration this update can happen very quickly and interactively.
Working in Maya’s Camera Viewport
Using the Camera Viewing your scene in 3D is made very easy in Maya using the camera viewports. The hotkey and mouse interaction for camera manipulation in Maya is widely regarded as the best in the industry. Camera manipulation: By default a new scene in Maya will contain 4 cameras, a perspective camera and 3 orthogonal cameras. Perspective Camera: The perspective camera mimics the way a film or television camera operates and displays your scene. Orthogonal Camera: Top, Side, Front, orthogonal cameras are provided by default. These cameras display the scene without a vanishing line of sight or perspective view. They are used to accurately position objects in relation to world space and the grid that is used to measure distances.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 21
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
Camera Hotkeys: The cameras and views in Maya are positioned and oriented by depressing the alt key in conjunction with the LMB (Left Mouse Button) and MMB (Middle Mouse Button). Orbit: alt + LMB Zoom: alt + LMB + RMB Pan: alt + MMB Frame selected: press f Frame all: press a Display Hotkeys: The viewport has hotkeys that control display properties such as shaded and wireframe modes: Press 1, 2, or 3 keys for lowest to highest resolution display smoothness on selected NURBS objects. Press 4 key for wireframe display Press 5 for shaded display no textures Press 6 for shaded display with textures Press 7 for shaded display with textures and lights Viewport menus: The camera viewport has its own set of menus that further control viewport display properties and camera attributes. View: Camera settings and bookmarking of camera views. Shading: Various shading and display settings Lighting: Lighting display settings Show: Filtering for object type display Panels: Shortcut to Panel and Layout settings as well as camera selection and creation. 1 Start a new scene and create a primitive object n File → New Scene n
Create a primitive object to view and move. Create → NURBS Primitive → Torus
Press 1, 2, 3, 4, and 5 keys to see varying degrees of surfaces smoothness and shaded mode display. 2 View the primitive object with the perspective camera In the Perspective viewport: n
Press f to frame this object
n
Orbit the object by pressing and holding down the alt key while pressing and dragging the LMB.
n
Pan the camera around using alt + MMB.
n
Zoom in to the object using alt + LMB + MMB.
Translate | Rotate | Scale manips Moving objects around your scene is made easy with Maya’s move tools. To activate the move tool manipulator: Translate: Press w Rotate: Press e Scale: Press r Quit Move Tool: Press q
22 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Maya UI Tour
Special Tool manips: Press t These keys make up the QWERTY keys on the keyboard. These keys have been chosen for these often used functions due to the comfortable and easy reach with which the left hand’s fingers can reach them. 3 Duplicate and translate a series of primitive objects In the Perspective viewport: n
LMB drag to select the primitive object in your perspective view.
n
Press Ctrl + d to duplicate your primitive object.
n
Translate the new duplicated object up. Press w to activate the Translate manip. Select the green Y manip handle arrow. LMB drag to move the object in the Y direction only.
n
Rotate the primitive object.
n
Scale the primitive object.
n
Press Backspace to delete the duplicated torus.
4 Select the makeNurbsTorus node in channel box Now you will select the node that controls a primitives construction history and manipulate these attributes with the shown manipulator tool associated with this object. n
Display the Channel Box if it is not displayed Select Options → Channel Box to toggle the Channel Box
n
Select the original NURBS torus that you created. In the Channel Box the nurbsTorus1 transform node is displayed. Below is the nurbsTorusShape1 node and below that listed as an Input node is the makeNurbTorus1 node.
n
In the Channel Box click on the makeNurbTorus1 node.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 23
Maya UI Tour
Questions? visit www.aliaswavefront.com/tasteofmaya
5 Manipulate the nurbsTorus using the Show Manipulator Tool n Press t to show the makeNurbTorus1 construction history manipulator tool. Select the handles presented by the Show Manipulator Tool with your LMB. Drag these manips to get a feel for what each one does. As you move the manipulators notice the values change in the Channel Box. These values can be keyframed and animated. (RMB in the attribute field and select key selected) Selection Action vs. Tool based Commands In Maya there are two methods of carrying out commands on objects. A command is a process that you perform or apply to one or more objects or nodes. Applying a deformation to an object is an example of this process.
6 Apply a Lattice Deformer to your primitive object The Lattice Deformer is a very powerful deformer. A lattice is a cage shaped deforming tool that gets created around the selected object or objects. This lattice can be manipulated to deform the underlying object. n
Select your primitive object, in this example the nurbsTorus1 object.
n
Select Deform → Create Lattice (from the Animation Menu set) A Lattice deformer is created and applied to the selected object. This is an example of a Selection/Action command. An object was selected and then an Action was applied to this object.
24 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Maya UI Tour
7 Adjust the Deformation Membership Once you have applied a deformer you can control which part of the affected object is obeying the deformation. This is called Editing the Membership. n
Select the Lattice Points LMB drag over the lattice to select it in the viewport Press RMB over the Lattice A marking menu is displayed with viable choices for the selected object. In this case the Lattice Points marking menu is displayed. RMB gesture to select the Lattice Points marking menu LMB drag a box around a collection of Lattice Points
n
Press w to display the Translate manip Translate the group of Lattice points to deform the primitive object. Exit this component mode by pressing F8 twice
n
Select Deform → Edit Membership Tool Note the name on this command includes the word “Tool”. This signifies that when you select this menu item you will be placed into a tool that will prompt your actions in order.
Note:
To see these prompts make sure the Help Line is displayed.
Note the cursor changes to a special arrow shape The Help Line prompts you with: Edit Membership Tool: Select a Set or a Deformer
If the lattice is not selected. n
Select the Lattice in the viewport The CVs of the torus are displayed and the Help Line prompts you with: Edit Membership Tool: ffd1Set: Add with Shift+LMB. Remove with Ctrl+LMB.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 25
Maya UI Tour
n
Questions? visit www.aliaswavefront.com/tasteofmaya
Follow these directions and remove some of the CVs from the Lattice’s membership. Note that the shape of deformation changes as these CVs are not participating in the deformation.
n
Press q to quit the Edit Membership Tool
This is how a Tool based command in Maya will typically work. You enter a mode and you follow the directions in the Help Line. In multiple choice tools you may be prompted to press the Enter key to validate a certain step before moving to the next step of the tool.
CONCLUSION This has been a brief exposure to the Maya user interface. The Maya on-line documentation is another place that you should investigate for answers to user interface questions and coverage of the other windows, editors and UI components omitted from this tutorial. There are many options in Maya. These options are what make Maya a powerful and flexible application. As you get comfortable with one area of Maya you will also find yourself getting comfortable with other areas of Maya due to the continuity of usage and usability that is carried throughout the application. Use the Help Line. By always displaying the Help Line and Pop Up Help you will have a prompt that explains what a button is and how to proceed in a tool based command.
26 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Growing Grass Logo Paint Effects is Maya’s flexible system for interactively painting brush strokes and particle effects on a 2D canvas or on 3D geometry. Preset brushes such as plants, hair, fire, feathers, and others can be used to get amazing effects quickly. This tutorial explains how to create a Maya logo out of growing grass. The focus is on setting and animating the Paint Effects brush and strokes.
A Taste of Maya
The following topics are discussed: ■
Brushes vs. Strokes
■
Assigning brushes to a stroke
■
Changing brush parameters
■
Loading brush settings into the template brush
■
Making multiple strokes share a single brush
■
Animating the growth of the grass along the strokes
■
Using the same strokes with other brushes
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install.
Note:
Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
Growing Grass To create the animated grass, you will apply paint effects strokes to NURBS curves. Then, a preset brush will be applied to all of the strokes and keyframes will be set to make the grass grow along the strokes. Stroke: A curve attached to an underlying NURBS curve (or curves). The underlying NURBS curve
defines the shape and direction of the stroke’s painting path. Brush: The attribute settings that define the appearance and behavior of a stroke.
Once you have the animation on the strokes, you can change the brush to anything you want (for example, a neon, hair, or liquid style brush).
Assigning the brush to the curves 1 Open scene file and playback ■ File → Open; select mayaGrass_start.ma This file contains several NURBS curves, a pre-made paint effects brush, and some lighting. ■
Playback and watch the grass on the M grow. In the following steps, you will complete the logo by making grass grow on the other letters.
2 Load the settings of the supplied brush into the template brush Since you are going to apply the same brush used on the M to the rest of the letters, you need to store the settings of the animated grass brush used on the M for easy access. ■
Select stroke1 in the Outliner
■
Press F5 to enable the rendering menu set
■
Paint Effects → Get Settings from Selected Stroke
This is like a copy/paste operation. Maya copies all the attributes from the stroke (including the brush properties that belong to that stroke) and stores them in a “template brush”. 3 Create strokes and apply the template brush settings ■ Drag select in the modeling window so the curves for the remaining letters of the Maya logo are highlighted as shown
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo
Selected curves prepared to add brushes ■
Choose Paint Effects → Curve Utilities → Attach Brush to Curves The settings stored in the template brush are applied.
4 Playback and view ■ Rewind and press play on the timeline. The grass grows on all the letters.
The grass brush applied to the entire logo 5 Look at the Outliner and Attribute Editor to see what was built ■ Look in the Outliner to see the newly created strokes
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo
Outliner showing one paint effects stroke for each NURBS curve in the logo ■
■
Look in the Attribute Editor (Windows → Attribute Editor) to see how the strokes and brushes are related (look at the tabs at the top of the Attribute Editor) The scene file mayagrass_withstrokes.ma has been set up to include the strokes and applied brushes for you up to this point.
Changing the look and motion of the grass The Grass brush that you attached to the strokes is one that already had some values defined. You can now modify those values to your own liking. 1 Set up Brush Sharing If you use the Attribute Editor to change some brush settings on stroke1 then select stroke2 and change its brush settings, you’ll notice that the attributes on the two brushes are changed independently. This is fine if you want different brush control on each letter. In this case, you want the same brush for all the letters so everything looks consistent and can be changed from one place. To do this, you need to share one brush among the many strokes. ■
Select all seven strokes in the Outliner
■
Paint Effects → Share One Brush
This shares the brush of the last selected stroke in the selection list to all of the other selected strokes. ■
Now when you change any brush attribute, all letters update to reflect that change.
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo Animate stroke lengths
2 Modify stroke density for the Y stem The stem of the Y is a little sparse and could be filled in with a little more grass. This can be easily seen if you advance to frame 100. You can change the sample density on the stroke for the y stem only to help fill this in. ■
Use the Outliner to select only the stroke for the stem of the Y You can find the stroke for the stem of the Y by clicking on each of the strokes listed in the Outliner and watching for the stem of the Y to become highlighted in your camera viewport.
■
At the top of the Attribute Editor click on the “strokeShape” tab for the stroke
■
Set Sample Density of this stroke to 1.5 in the Attribute Editor
■
Although the brushes are shared, the strokes are still independent from one another.
The same stroke with two different stamp densities
ANIMATE STROKE LENGTHS Currently, the grass all grows in evenly across the 3 letters you have done. The next step is to animate the length of each stroke so the grass appears to climb along the letter. 1 Animating the length of the small “a” strokes ■ Select the stroke for the curly “a” (not the stem of the a though)
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo Animate stroke lengths
Selecting only the “a” stroke ■
At the top of the Attribute Editor click on the “shape” tab for the stroke
■
Locate the Max Clip attribute (within End Bounds section)
■
Drag the Max Clip slider back and fourth between 0 and 1 to see the length of the stroke change in the modeling window.
■
Rewind to frame 1, set Max Clip to 0 and RMB (right mouse button) click on the Max Clip input field and choose Set Key
Max Clip keyed on the shape node of the “a” stroke ■
Advance to Frame 100, set Max Clip to 1 and set another keyframe.
■
Playback to see the grass grow along the letter.
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo Animate stroke lengths
Frame 40: Grass growing around the small “a” 2 Key the growth of the stem The small “a” has a stroke associated with the stem as well. This should start to grow as the animation of the main stroke for the “a” gets close to the stem. ■
Use the Outliner to select the stroke associated with the stem of the “a”.
Selecting only the a “stem” stroke ■
Advance to frame 32, set Max Clip to 0 and set a keyframe
■
Advance to frame 100 set Max Clip to 1 and set a keyframe.
3 Repeat for the remaining strokes. Now, continue this process with the other strokes, keyframing the Max Clip between 0 and 1 as shown below. Or, open the completed file called mayaGrass_final.ma
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo Animate stroke lengths
Y “stem” stroke ■
Max Clip: 0 at frame 1
■
Max Clip: 1 at frame 75
Y “branch” strokes ■
Max Clip: 0 at frame 74
■
Max Clip: 1 at frame 100
Pointed “A” stroke ■
Max Clip: 0 at frame 1
■
Max Clip: 1 at frame 100
4 Playblast to get a rough idea of motion ■ Set your time slider range to 1, 150 ■
Click in the perspective view
■
Open Window → Playblast - ❐
■
Press Reset then press Playblast
5 Render a frame ■ Advance to frame 150 ■
Window → Rendering Editors → Render View
■
Render → Render → Persp
A test render in the Render View window Dealing with unwanted “creeping” You may notice that the tips of the “a stem” and “y stems” seem to start growing away from the curve before the grass reaches them. This can be corrected by making the “a stem” and the two “y stems” share their own separate brush. Then, on that brush set the start time in the flow animation section to 1 to prevent this creeping. This is not a requirement, just something that will prevent the first frame from having grass in unwanted areas.
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo Animate stroke lengths
Adding a different brush to the same strokes Now that you have set up the animation on the strokes, you can begin experimenting with different brushes. Think of this as trying different kinds of paint.
1 Select a new brush from the Visor ■ Continue on from the last step or open mayaGrass_newBrush.ma This file still has the grass applied to it, you will switch the grass brush to a fire brush so Maya is written in fire. ■
In the Visor Window (Windows → Visor) locate the brushes directory. Inside that directory locate the fire directory. MMB drag one of the fire brushes to your shelf (fire4 works well).
Fire Brushes in the Visor
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo Animate stroke lengths
2 Apply the fire brush to the strokes ■ Use the Outliner to select all the strokes of the logo ■
Click the fire brush you dragged to the shelf
■
Paint Effects → Apply Settings to Selected Strokes This copies the settings from the brush you selected into the brush that is applied to the strokes. However, the name of the brush will still be called grassBlow1 unless you rename it in the Attribute Editor
Note:
3 Change shading mode and adjust global scale ■ MMB click in the persp window to set focus in that window ■
Press 8 to display the Paint Effects Window
■
Select any stroke, in the Outliner then open the Attribute Editor.
■
Click the grassBlow1 tab at the top of the Attribute Editor and set Global Scale to 50
■
If you want to see a more detailed version in the Paint Effects window choose Stroke Refresh → Rendered
Fire Brush in Paint Effects window with Stroke Refresh set to Render
Tip:
■
Experiment with other attribute settings or other brush presets to get the look you want.
■
The scene mayaLogo_Fire.ma contains a finished version of the fire logo. If the refresh is too slow, you can set stroke refresh to wireframe, or select all the strokes and lower the displayPercent attribute in the Channel Box.
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Growing Grass Logo
CONCLUSION You have now worked through a typical Paint Effects session in Maya and have seen the interactiveness and flexibility of this part of Maya. To recap, the following were the key topics in this tutorial: ■
Strokes and Brushes defined
■
Assigning brushes to a stroke
■
Changing brush parameters
■
Making multiple strokes share a single brush
■
Animating the growth of the grass along the strokes using Max Clip.
■
Using the same strokes with other brushes
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
3D Tutorials : Maya
Maya Tutorials
How To Build a Head Using Maya Unlimited 4.0 By Irina Carriger
● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
3D Studio Max Animation Master Cinema 4D General 3D Lightwave Maya Poser Rhino Shockwave 3D softimage truespace Classified Ads 3D Help Wanted Chat
3D FAQ 3D Industry 3D Schools 3D Studios 3D Stores Mail & Forums Mags and EZines News Groups
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (1 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
Other Sites Reviews Render Farms Spectrum Wave Report
Step 1. Open Maya. Bring your Front and Side Image Planes by going to View-Camera Attribute Editor... Scroll to Enviroment option and click Create. It will bring up the Image Plane Attributes option. Navigate your image. Do the same with Side view.
Modelers Commercial Modelers Shareware Web 3D CAD 3D Terrain Generation Converters Compositing Image Processing Multi-Media Misc Tools Lip Synch
After Effects Plugins Adobe Premier Plugins Cinema 4D Plugins EI Universe Plugins Lightwave PlugIns Max Plugins Maya Plugins softimage Plugins truespace Plugins PhotoShop Plugins
Step 2. Go to Create - NURBS Primitives - Circle Sections - 20.
3D Studio Max Cinema 4D Poser Shockwave 3D Strata truespace ZBrush
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (2 of 10) [5/30/2002 8:05:34 PM]
. Select Edit - Reset Settings. Number of
3D Tutorials : Maya ● ●
● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ●
Commercial Objects Free Objects
Step 3. Start pulling CV's to form a shape of the head. This is how it should look after about 15 minutes to one hour of work, depending on your experience.
Commercial Free
3D Animation 3D Programming 3D Studio MAX/Viz After Effects Bryce 3D Carrara CAD Cinema4D Director Electric Image Form-Z General Infini-d Lighting Lightwave Mac Maya PhotoShop Poser Ray Dream Renderman Rhino softimage truespace Web 3D
Step 4. Select first and second Curves and go to Surfaces - Loft. Surface should appear. Press 3 and then 5. Continue lofting Curves using key G on you keyboard (in Maya G repeats previous operation).
DirectX Engines & ToolKits OpenGL Visual Basic Java Delphi
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (3 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya ● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
Other Languages Game Development General Plugin Devel - truespace Plugin Devel - Max Plugin Devel - Lightwave
Step 5. After all Curves are lofted, you should see something like on the picture below. If you don't like the shape of your head, you can always delete Surface and play with Curves a little more. Or you can hide Surface by going to Show - NURBS Surfaces. This way your invisible Surface will be modified while you are modifing your Curves. After you finish, delete the history on Surface and delete or hide Curves.
3D Scanners Chips Digital Video General Immersion Motion Capture Video Boards Systems Sensing
3DLinks Gallery Gallery Links Animation Gallery
3D Studio MAX Animation Master AutoCAD Bryce Carrara Cinema4D Combustion Lightwave Maya Misc 3D Tutorials Poser Povray Ray Dream Rhino softimage Strata truespace
Step 6. At this point, cut your head in half and make a mirror copy if you need to see a whole head. Now select your model and go to Edit NURBS - Sculpt Surface Tool - . Sculpt your lips, eye area and nose. Pull and push CV's where it's needed.
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (4 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya ● ● ● ●
● ● ● ● ●
● ● ●
Vue D'Esprit VRML World Builder ZBrush
Contact Us Advertise Privacy Statement Suggest A Link Link to Us
Site Search Wave Report Spectrum Step7. After you have something like the image below, you will need to build the eye area and ears. Note that they are built separatly.
Step 8. We are done with NURBS. Now we need to convert NURBS to Polygons. Go to Modify Convert - NURBS to Polygons - . In the options menu, select Control Points. Do the same with the eye area and ear. http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (5 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya
Step 9. You will need to cut holes where your eyes and ears should be. After you have finished with the holes, select all of the parts of your head and go to Polygons - Combine. Now you can connect your parts by using Edit Polygons - Merge Multiple Edges or Edit Polygons - Merge Vertices. Don't worry if your head looks funny. We will make it right.
Step 10. After you have connected all of your edges, mirror the half of the head and connect it. Then http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (6 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya
select your head and go to Modify - Convert - Polygons to Subdiv. This is what you should get after that.
Step 11. Now select your head, right mouse click and go to Display Level - 0. Right mouse click again and select Face. Select all the faces and go to Subdiv Surfaces - Automatic Mapping. This way you apply UV's to your model. After that, you can take your 3d Paint Tool and apply some guides to the eyes, lips, etc.
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (7 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya
Step 12. Build lashes and apply your texture to your model. This is how my model looked before I rendered it and the next image is a texture, if it helps...
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (8 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (9 of 10) [5/30/2002 8:05:34 PM]
3D Tutorials : Maya
Bottom Banner always Free!
© 1997-2002 International Computer. All rights reserved. Duplication strictly prohibited without permission.
http://www.3dlinks.com/tutorials/maya/maya_tutorials.cfm?tutorial=head2 (10 of 10) [5/30/2002 8:05:34 PM]
IPR This tutorial shows you Maya’s Interactive Photo-realistic Rendering system, IPR for short.
A Taste of Maya
In this tutorial: ■
Rendering in Maya Overview
■
IPR Workflow
■
Creating a Rendering Layout
■
Adjusting Shaders using IPR
■
Adjusting Lights and Shadows using IPR
■
Lighting Effects, Fog and Lens Flare
IPR
Note:
Questions? visit www.aliaswavefront.com/tasteofmaya
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install. Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
Rendering In Maya Maya’s rendering system is the culmination of research and development stemming from a rich history of worldwide efforts. Creating visually pleasing imagery or photo realistic representation of 3D worlds is the ultimate goal of the rendering process. In Maya you have many options for creating this imagery. You have complete control over how detailed and exacting the renderer will behave. If you want perfectly anti-aliased imagery and highly filtered textures you have the power to do so. If you want a lighting environment that includes atmospheric elements and lighting interplay with a virtually lensed camera, you can achieve this too. Typically, tasks that involve creating finished or specific rendering requires an interactive process. That is, you tweak, you test render, you tweak, you test render. Getting fast feedback to you as you tweak is the point of the IPR side of the Maya renderer. Using IPR boosts productivity, speeding up this process of tweaking, to the point where you will find yourself using it exclusively for many tasks. Rendering User Interface Maya’s rendering system is best accessed using the Hypershade/Visor in conjunction with the Render View/ IPR panels. The other UI elements you will work with include the Attribute Editor and Attribute Spreadsheet as well as your Camera View panels. Because you will be accessing these panels consistently it is strongly recommended that you create Layouts utilizing these panels arranged to your taste. Avoid detached or floating windows that can get in your way and slow you down. A sample layout using the Render View window and Hypershade/Visor panels is shown below. This tutorial will step you through creating this layout.
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
Rendering Layout with Hypershade/Visor, Render View, Perspective Camera also note Attribute Editor inside the Main Interface. This layout can be accessed by a shelf button or hotkey. Once you have your base layouts in place with shelf buttons you can quickly jump from one configuration to another without floating windows and without having to constantly open the same windows from the pull down menus.
Two Methods of Adjustment There are two methods of working with the Maya renderer. Rendering preview by test rendering to the Render View window or Interactively rendering using IPR. Render View Overview The Render View window (Windows → Render View) is where you test render your scene. This window will allow you to create a test render of a single frame that is exactly what a batch or sequenced render will look like.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
Render View Window The Render View window contains pull down menus at the top of the panel. These pull down menus can also be accessed from the Right Mouse Button while your cursor is in the Render View window. There are also buttons that quickly let you access often used functions. To use the Render View window: ■
Position your perspective camera to frame your scene.
■
In the Render View window select Render → Render → Current(persp) The entire Render View window will initialize and begin rendering in blocks.
■
Press the 1 : 1 button to view the image at the real size or actual resolution. If the Render View is scaled to a size other than the actual Render Globals resolution, the image may appear to be aliased or jagged.
Note:
■
To render a region, LMB drag a box in the Render View window and select: Render → Render Region Render in this fashion when you are testing the look of raytraced rendered effects and other rendering elements that are not viewable in IPR. The Render View window is also where IPR is accessed.
IPR Using IPR is similar to rendering in the Render View window with the addition of an extra step, creating the IPR render file. When you IPR Render, you create an image that contains more information then just the pixel color and matte information. This is called a “Deep Raster” image. Deep Raster technology is the process of keeping track of the information that went into creating the pixel color, including lighting, shadows and material definitions. When you adjust a related node such as a light or material only the changed value is recomputed as opposed to the entire chain or graph which is normally evaluated during a regular render. This greatly speeds up the rendering process for editing. This enables the Interactive portion of the Interactive Photo-realistic Rendering system.
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
For most tasks that involve repeated tweaking and rendering, the IPR system steps in and speeds up the process. There are some options that have not made it into IPR .... yet. ■
Raytraced shadows, refraction and reflections are not displayed in IPR.
■
Volumetric particle rendering attributes are not updated in IPR but surface shading can be tuned on a stand in geometric object.
■
Displacement mapping, depth of field as well as 3D motion blur are not displayed in the IPR deep raster based image.
IPR is Awesome for: IPR lends itself to these traditionally time consuming activities. ■
Material attribute tweaking
■
Texture placement, Color balancing and filtering settings
■
Lighting: Placement Intensity and Fall-off Fog Density and Color Shadow Color and Intensity Light Glow and Lens Flare
■
Reflection Map tweaking
■
Shader to lighting and texture interactions
■
2D and 3D texture attribute tweaking
■
Many more things...
Use IPR anytime you feel that you are spending too much time testing and waiting for feedback. IPR is the next level of tuning after you have established your scene using the hardware display for texture placement and rough lighting. Using IPR Overview: Here is a general overview of steps to using IPR. Later in this tutorial you will go through the actual steps of working with a Maya scene. ■
Position your perspective camera to frame your scene.
■
In the Render View window select IPR → IPR Render → Current(persp) The entire Render View window will initialize and begin rendering in blocks. This is the creation of the deep raster image. This image file is created in the iprImages directory of your current Maya project. A deep raster image can be quite large, a typical image file size for a 720 x 486 (D1) resolution IPR image can be between 45 and 100meg. So take care that you have suitable disk space and real memory. If you have limited system resources you may want to consider working with smaller resolutions.
■
When the IPR render is completed you are prompted to select a region to begin tuning. LMB drag select a region to tune. The region you select will be the area that is updated. This portion of the deep raster is loaded into ram and cached for quick system access. The size of the region you select will determine how much system overhead is needed.
■
In the Hypershade/Visor select the light or material you wish to edit, the Attribute Editor will update to display the attributes associated with the selected item.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
Adjust these attributes while observing the IPR region updating. ■
Tip:
Render your test image using the regular render view Render command. You can stop a test render in the Render View window at any time by pressing the Escape key.
Learn to work quickly and load only the object layers that you are editing. Be conscious of the IPR tuning options you have selected. If you are not working on shadows or glows, make sure these options are not selected. You can control these options globally from the IPR section of the Render Globals window. Or from the Render View’s IPR pulldown menu. Also work at the lowest resolution that gives you adequate feedback.
Pipes in Tunnel
Scene File pipeSystem.ma Scene file descriptions:
pipeSystem.ma: This is the scene file you will start with. It contains several layers of objects that compose a subterranean tunnel. Layers: The elements used to compose pipeSystem.ma have been organized into layers. These layers can be made visible by accessing the layer bar, Options → Layer Bar. To toggle the visibility of each layer press the RMB (Right Mouse Button) on the layer button, and select Visible.
Layers in pipeSystem.ma Tunnel Layer: This layer is the base geometry for the tunnel system. It was constructed from NURBS cylinders that were trimmed and trimmed again with a cube to make the lower shaft and a lofted surface to make the overhead shaft.
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
Pipes Layer: This layer is the pipes that run through the tunnel. Walkway Layer: This layer is composed of instanced geometry, objects that have been duplicated with instancing option. With instanced geometry you can create a base object that when duplicated will act a reference. Any edits made to this base object are mirrored in the instanced copies. The walkway has been made very light, that is with as few objects as possible. Light Layer: This scene is mostly composed using lights. Lights can give the objects volume and a sense of weight. This layer contains the lights in the scene. There are point, directional and spot lights used to create various lighting conditions.
IPR Example The scene file you have been provided with is a typical setup. Your goal is to maneuver your camera around the scene and frame up interesting angles and then render them. The objects have been textured and the lights have been roughly setup. Feel free to experiment with the shaders and the lighting to create your own images.
Closeup of Pipes and lights
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
Wide View of Pipes and Tunnel 1 Open pipeSystem.ma scene file ■ Start Maya ■
Select File → Open Scene...
■
Select pipeSystem.ma
■
Press Open
This file contains several objects and groups of objects: tunnelGroup pipesGroup lightsGroup walkwayGroup instancedWalkwayGroup Open the Outliner to view these object groups as well as lighting and camera objects. These objects are actually groups of objects. In the Outliner you can LMB on the + sign to the left of the object name to open the nested objects. These objects may be parents of other objects as well. The tunnel objects have been texture mapped. Press the 5 key for shaded display, 6 key for texture shaded and the 7 key for textures with lighting in the perspective view. Because these textures are mostly very dark you will not see much in textures mode.
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
If your system does not allow you to tumble the scene quickly you should either restrict your viewing to wireframe or hide some of the layers. When all layers are displayed in the shaded modes most systems without adequate graphics memory will not tumble freely.
Note:
Render Quality The pipeSystem.mb scene file has been set to render at a Preview Quality. When you test render this scene you will see various artifacts such as edge aliasing and low resolution light fog shadows. The scene file pipeSystemFinish.mb has had various Render Global settings and light attributes adjusted to create a hi-resolution image that is representable of Production Quality. This file will take longer to test render due to the higher texture sampling and edge anti-aliasing settings. Display Accuracy Display your rendered image at a 1 to 1 display resolution by pressing the 1:1 button in the Render View window. If you are viewing a rendered image at a scale other than 1 to 1 you will see display artifacts from this scaling. This can make an otherwise good looking image look aliased and chunky. This can be misleading. Expanding the Render View window: ■
Make the Render View window active by LMB clicking in the window then press the SpaceBar to expand this window to full view.
■
Press the 1:1 button to scale the image to actual rendered resolution.
Layout with Render View, Persp, Hypershade/Visor and Attribute Editor windows forming a Layout.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
2 Create a layout for rendering It is important to create a quick method of moving between windows and editors. Layouts in Maya give you preset organizations of windows and editors that you can quickly select from a shelf or hotkey. In this section you will create a layout for working with IPR and rendering in general. There are also premade layouts in Maya available in the Camera viewport panel under, Panels → Saved Layouts. ■
Select Options → Customize UI → Panels... from Main menu bar.
■
In the Panels window select the Layouts tab
Panels Editor with Layouts tab selected ■
Press the New Layout button.
■
Rename this new layout Hypershade/Render in the Name field and press Enter to validate.
■
Press the Add to Shelf Button If you want to delete a shelf item you can MMB drag it to the trash can icon on the right-hand side of the shelf bar.
Note: ■
Select the Edit Layouts tab in the Panels window
■
Select 3 Pane Left Split from the Configuration pulldown menu.
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
Panels Editor with Edit Layouts tab selected ■
Select the Contents tab in the Edit Layouts section. In Panel 1 Select Render Window Panel In Panel 2 Select Hyper Shade Panel In Panel 3 Select Persp Panel
Now when you select this shelf button your layout will change to this configuration. You may want to create several layouts in this manner. Using the above layout you can work with only the Outliner as a floating window. Many people use a hotkey to raise and lower the Outliner. Other people have layouts for the Hypershade with the perspective view replaced by the Outliner. You can also create a layout that includes all 4 windows. Toggle the Attribute Editor from a hotkey or from the Options → Attribute Editor/Channel Box
Render Optimization Render Globals and Anti-Aliasing Before you begin tuning with IPR you may want to review your Render Globals settings. Of most importance is the level of Anti-Aliasing that is set in the Render Globals’ Anti-Aliasing section. ■
Window → Render Globals...
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
Anti-Aliasing Section of Render Globals Set Anti-Aliasing to Preview Quality for initial testing in IPR. When you are closer to final tests you can turn up the quality to Production Quality settings. The pipeSystem.mb file has these settings adjusted for you. You can adjust them to suit your pace and the performance of your system. Depth Map Fog Shadows Another setting that will have a big impact on render times in this scene is the Fog Shadow Samples under the shadow casting light’s Shadows > Depth Map Shadows section. ■
Select each of the spot lights in the scene that are casting depthmap shadows and have a light fog attached. (domeLightShape, northSpotShape, southSpotShape are located inside the lightingGroup node in the Outliner)
■
Adjust the Fog Shadow Samples in the Attribute Editor for a smooth look. Each light has its own values in the Attribute Editor which you can adjust. If you have multiple objects selected at the same time, only one of them at a time will be displayed for editing in the Attribute Editor. You can edit multiple selected items using the Channel Box. When this value is turned down to 15 or so you will see chunkier fog shadows but faster render times. When you are ready for a finished render turn this up to a value around 70.
12 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
Render Resolution When you are rendering in Render View or IPR you will want to work at the smallest resolution that will still enable you to see what you are working on. In this scene file the resolution is set to 720x486 or Digital Video CCIR601. But you can test render at other resolutions. In the Render View window select Options → Test Resolutions → 50% Globals This will select a test rendering resolution for Render View and IPR that is 1/2 the pixel resolution set in the Render Globals Resolution setting. This is very adequate for working with most items in the pipeSystem.mb scene.
Light Fog on northSpot 1 Tune the Light Fog for the norhtSpotLight The junction of the tunnels has a shaft overhead that contains a spot light named domeLight. This light has a light fog added to it and it is casting depth map shadows. The North and South tunnels also have spotlights, mid-tunnel, that are casting shadows and have lightFog attached. ■
Select the northSpot object in the Outliner or Hypershade’s Visor windows
■
press f to frame the light. Pull your camera back to frame the spotlight with enough room to see the extent of the cone of light being cast from this light.
■
Hide the walkway layer. RMB on the Layer button and toggle the visibility.
■
Render an IPR image (Window → Rendering Editors → Render View → IPR Render → persp)
■
LMB drag a region to tune that includes some of the light fog.
■
In the Hypershade/Visor window open the Lights directory by LMB clicking on the folder icon. LMB select the northSpot icon in this folder if this light is not selected.
■
In the Attribute Editor open the Light Fog section found under the Light Effects section. You can adjust these attributes or you can traverse the Light Fog attribute to the lightFog node by clicking on the “Connection Arrow Button” on the right-hand side of the attribute. The lightFog node allows you to adjust fog color and density.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 13
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
Adjust the northSpot Intensity and the Dropoff to see how this affects the light fog.
Closeup of Pipe Shading 2 Tune the Pipes Shader The pipes in this scene are all being shaded by the same material. This material is a Blinn material. The Blinn material is extra good at making things look metallic due to the specular highlight and control over this highlight it gives you. This material has a texture applied to it to provide bump and specular highlight. Since this material has more to it then just a plain material it can be considered a “Shader”. ■
Position your camera close to the central pipe so that you can see the effect of tuning this shader.
■
Hide the walkway and tunnel layers.
■
Render an IPR image
■
LMB drag a region to tune that includes pipes.
■
Select the metalBumpPipe material for editing. In the Hypershade/Visor window open the Materials directory in the Visor portion by LMB clicking on the folder icon under the Rendering section (not the Create section). LMB select the metalBumpPipe material. MMB drag the metalBumpPipe material from the Visor to the Hypershade work area.
■
Press the “Show Up and DownStream Connections” button in the top right-hand corner of the Hypershade/Visor window. This will display the related nodes of the shader you have selected.
14 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
■
IPR
In the Attribute Editor begin adjusting the attributes of the metalBumpPipe shader. Adjust the Diffuse attribute Note the effect the Eccentricity attribute has on the highlight. Work both the Specular Rolloff and the Eccentricity together. The Specular Color attribute is being controlled by a 3D texture. In the HyperShade work area LMB select the bump3d node. Adjust the Bump Depth attribute to make the bumps more defined or more subtle.
The metalBumpPipe also has a 3D Brownian procedural texture attached to it. This texture is connected to the Bump Mapping attribute as well as the Specular Color attribute. This is a simple trick to get the Specular highlight to follow the bump. By adjusting the metalPipeBrownian texture you are adjusting both bump and specular properties at once.
Warning Lights Shader Glow and cornerLight lens flare 3 Tune the Warning Light Glow You can tune shader glows in IPR. By applying a little incandescence and a little glow to a material you can create nicely glowing surfaces. The walkway safety lights have had this glow applied to them as have the windows on the vertical pipe. ■
In the Outliner open the Pipes Group. In the Pipes group you will find another group called warningLight. Select this group.
■
Press f to frame current selection in your current camera view. Position the Camera to frame the warning lights and maybe part of the pipes.
■
Hide the walkway and tunnel layers.
■
IPR render this view.
■
Select a tuning region around one of the warning lights.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 15
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
■
Select the yellowWarningLight material for editing. In the Hypershade/Visor window open the Materials directory by LMB clicking on the folder icon under the Rendering section (not the Create section). LMB select the yellowWarningLight material.
MMB drag the yellowWarningLight material from the Visor to the Hypershade work area. ■
Adjust the attributes on this Blinn material and note the updates in IPR. Notice the interaction between the Specular Color and Glow intensity. Note the role that the incandescence plays in the glow. Try negative and positive values for the Eccentricity. Adjust the Glow Intensity under the Special Effects section of the material. Change the Color of the material.
These attributes are all inter-related and require tweaking to find the right combination. IPR makes this possible. Imagine trying to juggle these attribute settings without interactive feedback.
Lens Flare attributes on OptiFX node
16 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
4 Tune the Lens Flare on the cornerPointLight The blue corner safety light has a lens flare associated with it. Adjust these attributes with an IPR render. ■
Select the cornerPointBlue light (and press f to center the camera’s center of interest on this object).
■
Position the camera back from this light to ensure that the lens flare is caught by the camera.
■
Render an IPR image.
■
Adjust the attributes listed under the cornerPointBlueShape tab of the Attribute Editor.
■
Under the Light Effects section you will find an attribute called Light Glow. This attribute has a node connected to it called opticalFX1. Navigate to this node by pressing the right-hand side button arrow on the Light Glow attribute.
Lens Flare attributes on OptiFX node ■
The opticalFX1 node contains many attributes associated with lens flare, halo and glow. Experiment with what these values do. Because the Halo pulldown is set to None, you will not see a halo effect on this light and the attributes associated with Halo will have no effect.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 17
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
5 Tune the Tunnel Highlight Using the same workflow as above, select and tune the tunnelWallBlinn material. This material is connected to the tunnel surfaces and contains some more interesting applications of textures and material. There are several techniques used in this shader to achieve the look of a bumpy slimy surface. The way in which this surface treats specularity defines much of it’s look. ■
Adjust the specular aspects through Eccentricity and Specular Roll Off attributes on the tunnelWallBlinn material.
■
Adjust the Bump through several points including the Mask attribute on the tunnelStencil node and the Bump Depth on the tunnelBump node.
■
Adjust the Specular Color from the Color Balance > Color Gain on the tunnelBrownian node.
IPR view of tunnel hi-lite, pipes and walkways hidden
18 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
IPR
Finished Render of All elements 6 Render a Finished View Now that you have tuned some of your scene it is time to render using the Render into Render View workflow. Check to see how your IPR edits stand up to the final render. You may want to work with the attributes in the Render Globals window to increase anti-aliasing. If you have turned down your Fog Shadow Samples attributes on your shadow casting lights, turn these back up to around 80 for a smooth render of the depth map fog shadows. You can also open the pipeSystemFinish.mb file which has had these settings adjusted for Production Quality.
CONCLUSION The fastest part of a renderer is how fast a user can make a decision about their scene. Regardless of the horsepower available to do the final render waiting to see the results of a complex and interdependent shader or lighting setup can be painful. By seeing the adjustment in real-time or close to real-time you will be making fewer test renders especially, at the critical period when you are just getting started. This greatly increases your job turn around and quality tests up-front. Test rendering in Maya can be done by two methods: 1. Render into Render View your selected camera then test regions after each tweak. If you are testing Ray Traced renderings you will use this method to see how reflections, raytraced shadows and refractions are coming out. Use this method to test 3D motion blur. 2. Render an IPR deep raster file and get fast interactive update on each tweak. Use this method when you are tweaking shaders, lights, depth map shadows, shader glow, lighting glows and optical fx like lens flare as well as 2D motion blur.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 19
IPR
Questions? visit www.aliaswavefront.com/tasteofmaya
Both of these methods have their strengths and weaknesses. But together they provide very accurate and fast feedback on the final look of your scene.
20 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
The Jellyfish This tutorial goes through the steps to model, texture, animate and add Paint Effects tentacles.
A Taste of Maya
The following topics are discussed: ■
Creating surfaces
■
Transforming objects and components
■
Basic texturing
■
Nonlinear deformers and keyframe animation
■
The Graph Editor for modifying animation curves
■
Adding tentacles with Paint Effectsto a jellyfish.
Jellyfish
Questions? visit www.aliaswavefront.com/tasteofmaya
The Jellyfish
Note:
This final image was created by compositing the single jellyfish a number of times to populate the scene.
Note:
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install. Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
MODEL THE JELLYFISH 1 Start a new scene with File → New Scene 2 In the front window, use Create → CV curve tool to draw a NURBS curve as shown ■ Press F3 to access the Model menu sets. ■
To draw a curve start clicking with the left mouse button to place CV’s. A CV is a control vertice and is used to control the shape of the curve. You will need to place a minimum of four CV’s before you will see the curve. You can use the x key to snap the CV’s to the grid. You can also use the y key to undo any mistakes.
Start of curve
CV’s
End of curve
Curve to be revolved into jellyfish body
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
The first two CV’s and the last two CV’s of the curve should lie directly on the Y axis. If they do not, the jellyfish will have a hole in the top and bottom when you revolve in the following step. If you snap the first and last two CV’s to the grid like in the picture the CV’s will lie directly on the Y axis.
Note:
3 Select the curve and create a surface using the revolve tool ■ Press q to change into select mode or click on the Select Tool icon ■
Select Surfaces → Revolve
4 Create → NURBS Primitives → Torus 5 Move and Scale the torus to fit inside the Jellyfish body ■
The hotkeys for Move and Scale are w and e respectively.
If you press w you will see a manipulator at the centre of the torus that has arrows pointing along the x, y and z axis. Use these manipulators to move the torus. If you press the e key the manipulator changes from arrows to boxes. These boxes control the scale of the torus. If you click on an arrow or box then the move or scale will be constrained to that axis. Notice that if you click directly on an arrow or box that it turns yellow. If you click on the box at the center of the manipulator then you can move or scale the object in all axis at once. ■
In the Channel Box, increase the sections to 16 In the Channel Box click on the name makeNurbTorus1 under INPUTS. You will see more attributes that are available. Click on the number beside Sections and enter 16.
■
You may also lower the Height Ratio to get a better fit Click on the number beside Height Ratio and change the value to adjust the thickness of the torus
6 In the top view press F8 to change to component mode and select the CVs as shown F8 toggles between object and component mode. If you watch the Status Line when you press F8 you will see it change from object to component mode. Component mode is similar to an edit mode which allows you to tweak the shape of your object at a CV (or other component) level. ■
Hold the shift key down and select the same CV’s as in the image below by clicking and holding the LMB and dragging it over the CV’s. If you accidentally select some of the wrong CV’s keep holding the shift key down and click drag over them again. This will deselect them.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Questions? visit www.aliaswavefront.com/tasteofmaya
The Jellyfish
Select these CVs to create the inner part of the jellyfish 7 Scale the CVs to give the torus a series of ridges ■ Press e and scale the selected CV’s down You may need to increase the Scale of the torus to fit the jellyfish body.
Note:
8 The jellyfish model should look as shown below ■ Click in the perspective view to make it the active view ■
Press 5 to go into shaded mode
■
Select both surfaces
■
Press the 3 key to increase the display smoothness of the surfaces
■
select Shading → Shade Options → X-Ray from the perspective panel in order to see through the surfaces in shaded mode
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Completed jellyfish body Note:
To see the jellyfish in shaded mode press 5. To increase the smoothing, with the model selected, press 3. To see the model in X-Ray mode use Shading → Shade Options → X-Ray.
9 Press F8 to return to object mode and select the body and the torus and Edit → Group 10 Rename group1 to jellyfish in the Channel Box ■ In the Channel Box click on the name group1 and type in jellyfish Tip:
The curve you revolved may be deleted by selecting it and pressing the Delete key.
TEXTURE THE JELLYFISH 1 Open the file jelly1.ma or continue from the last step 2 To create a material open Window → Hypershade 3 Create a material for the jellyfish ■ MMB drag/drop a Blinn material from the Visor on the left to the Workspace on the right
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Questions? visit www.aliaswavefront.com/tasteofmaya
The Jellyfish
The Blinn material can be located under Create → Materials in the visor.
Note: ■
Double click on the new Blinn material to open the Attribute Editor.
■
In the attribute editor Click on the Color swatch to the right of the word color to open the Color Chooser.
■
Change the color to blue and click Accept to close the Color Chooser
■
Increase the Transparency slider to about the mid range point
Creating a material in the Hypershade window 4 Assign the material to the jellyfish ■ Select the jellyfish (the group node) ■
In Hypershade use the RMB on the Blinn shader (place the mouse pointer over the blinn shader ball and press the RMB) and select Assign Material to Selection If you are in shaded mode the surfaces should look similar to the blinn swatch.
ANIMATE THE JELLYFISH 1 Open the file jelly2.ma or continue from the last step 2 Press F2 to switch to the Animation menu set 3 With the jellyfish node selected, Deform → Create Nonlinear → Squash Note:
Drag selecting across the jellyfish body will not select the jellyfish node at the top of the hierarchy. With the body selected, press the Up Arrow key. This will walk up one node in the hierarchy. You can confirm this by checking that the Channel Box now displays the jellyfish node.
6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
4 Parent the squash deformer to the jellyfish node ■ In Window → Hypergraph... MMB drag/drop the squash1Handle node onto the jellyfish node If you don’t do this when you move the jellyfish node the squash deformer won’t follow it. If you do not see the nodes in the Hypergraph window, press a to frame all of the nodes in the window.
Note:
5 Select the jellyfish node and set keyframes ■ Drag the timeslider to 0 and keyframe the Y translate of the jellyfish by selecting Translate Y in the Channel Box and RMB → Key Selected You may need to set the range slider minimum value to 0 so that frame 0 is included in the time range.
Note: ■
Drag the timeslider to 10 and RMB → Key Selected (with Translate Y selected in the Channel Box)
■
Drag the timeslider to 30, Move the jellyfish up about 10 units and RMB → Key Selected
■
Drag the timeslider to 40 and RMB → Key Selected
6 Cycle the animation ■ In Window → Animation Editors → Graph Editor, select the Translate Y and Curves → Post Infinity → Cycle with Offset To select the y translate curve you can select the green curve in the Graph Editor or click on the Translate Y attribute name in the Graph Editor. ■
In the Graph Editor select View → Infinity in order to see the cycled curve. It will be represented by a dotted line.
The jellyfish Y Translate curve cycling with offset in the Graph Editor
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Questions? visit www.aliaswavefront.com/tasteofmaya
The Jellyfish
7 Select the Nonlinear Squash deformer and animate it ■ select squash1Handle ■
Drag the timeslider to 0
■
set Factor to about -0.2 The Factor attribute is found in the Channel Box when you click on squash1 under the INPUTS
■
keyframe the Factor of the squash by selecting Factor in the Channel Box and RMB → Key Selected.
■
Drag the timeslider to 20, set Factor to about 0.5 and RMB → Key Selected
■
Drag the timeslider to 40, set Factor to about -0.2 and RMB → Key Selected
8 In Window → Animation Editors → Graph Editor, select the Factor and Curves → Post Infinity → Cycle 9 Press play to view the animation
ADD TENTACLES WITH PAINT EFFECTS 1 Open the file jelly3.ma or continue from the last step 2 Press F5 to change to the Rendering menu set 3 Select the body of the jellyfish 4 Activate Paint Effects with Panels → Panel → Paint Effects 5 Select Paint Effects → Make Paintable while the jellyfish is active 6 Reset the template brush with Paint Effects → Reset Template Brush 7 Paint Effects → Template Brush Settings... and set the following Brush options: Global Scale: 5 ■
Tubes
Tubes: On Creation (sub menu of Tubes)
Tubes Per Step: 1 Length Min: 1.5 Length Max: 2 Tube Width 1: 0.02 Tube Width 2: 0.01 Segments: 100 Elevation Min: 1 Elevation Max: 1 Behaviour Forces Gravity: 0.1 Momentum: 0 Length Flex: 0.45
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Behavior → Turbulence (sub menu of Tubes)
Turbulence: World Displacement Turbulence Interpolation: Smooth over Time and Space Turbulence: 0.34 Turbulence Frequency: 2.4 Turbulence Speed: 0.155 ■
Shading
Color1: Blue Incandesence1: Darker Blue Transparency1: Medium Tube Shading (sub menu of Shading)
Color2: Blue/Purple Incandesence2: Darker Blue/Purple Transparency2: Medium
Paint Effects Settings January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
The Jellyfish
Questions? visit www.aliaswavefront.com/tasteofmaya
8 Paint a circular curve onto the bottom of the jellyfish
Paint a curve onto the jellyfish
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
9 Test the look of the jellyfish by pressing the Redraw Paint Effects View button that displays two red arrows flowing in a circle.
The jellyfish in the Paint Effects view
CONCLUSION You have now explored some simple modeling, textureing and animation using Maya. To recap, this tutorial covered the following areas: The following topics were discussed: ■
Creating surfaces
■
Transforming objects and components
■
Basic texturing
■
Nonlinear deformers
■
Keyframe animation
■
The Graph Editor for modifying animation curves
■
Adding tentacles with Paint Effects
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
The Jellyfish
12 A Taste of Maya
Questions? visit www.aliaswavefront.com/tasteofmaya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
HIGHEND3D > Maya > Tips & Tutorials
Layered Texture Tutorial by The-Real-Mrhell
In this tutorial you will learn how to use the alpha channel of your projected image to "stencil" your image over/under other images on your geometry with the use of a layered shader. first off build your self a nurbs sphere, make it look some thing like this: (You don't have to but it will look better!) [Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Test Center - Tools - Tips & Tutorials - Users Links
Open up your MultiLister and create a BlinnSG (Make sure Shading group is ticked).
http://www.highend3d.com/maya/tutorials/layeredtexture/ (1 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation Map the color of your Blinn to a "layered texture"
Now map the "color" of your first layer to a "file"
push the "interactive Placement" button Use "cylindrical" as the projection type turn off "wrap" in the Effects dropdown Use the supplied "Flames.iff" file turn the default color to black Turn off "wrap U" and "wrap V" in the place2dTexture node. After you have got your "placeFlames3D" box in the right position, change the texture Quality to High.
http://www.highend3d.com/maya/tutorials/layeredtexture/ (2 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
And you should get something like this
http://www.highend3d.com/maya/tutorials/layeredtexture/ (3 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
If you now look at your Shading group in the hypergraph you should have this. (I recormend renaming your nodes so that it's easier to understand later on)
If you now go to your layered texture node and make another layer, you can't see it!!! Next we have to tell maya to use the alpha channel of our picture to "over" the flames on to the layer below. Duplicate the "Proj_Flames" node and rename it "Proj_Flames_A" (A as in alpha:)) We want our "placeFlames3D" to put the alpha in the same place as the original flames, SO this is what we do! In the HyperGraph select the "placeFlames3D" and middle-mouse drag it onto your "proj_Flames_A" node, this will bring up the connections editor. first select World Inverse Matrix[0] then Placement Matrix . This tells the "placeFlames3D" to put the alpha in the same place as the flame picture.
http://www.highend3d.com/maya/tutorials/layeredtexture/ (4 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
Select the "Proj_Flames" node and middle-mouse drag it onto the "proj_Flames_A" node this again will bring up the Connections Editor. first select projType then projType Close the connections editor. (this means that when you change the projection type in your "Proj_Flames" node it also changes it in your "Proj_Flames_A" node) By this stage you should have this
Next we will tell the Alpha node what to project
http://www.highend3d.com/maya/tutorials/layeredtexture/ (5 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation Select the "flames" node and middle-mouse drag it onto the "Proj_Flames_A" node. This again will bring up the Connections Editor. first select outAlpha then imageR Close the connections editor.
(This takes the Alpha channel of the flame picture and places it in the red channel of our new alpha proj node). Next select the "Proj_Flames_A" node and SHIFT middle-mouse drag it on to the "layeredTexture" node. first select OutColorR then Inputs[0].Alpha Close the connections editor.
http://www.highend3d.com/maya/tutorials/layeredtexture/ (6 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
(This tells the layeredtexture node to use the red channel from the alpha node as an alpha channel for layer "0") You should end up with something like this
http://www.highend3d.com/maya/tutorials/layeredtexture/ (7 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
But Wait thats not quite right!!!!!!! Change the "default color" for the "proj_Flames_A" node to black.
http://www.highend3d.com/maya/tutorials/layeredtexture/ (8 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
You should now have this
http://www.highend3d.com/maya/tutorials/layeredtexture/ (9 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
Here is the same object with a planar projection also layered on
http://www.highend3d.com/maya/tutorials/layeredtexture/ (10 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
This is what the hypergraph looks like
Add a couple more NURB spheres and a few more images...TA-DA!!! Everyone loves a flam'in race'in skull!!!!
http://www.highend3d.com/maya/tutorials/layeredtexture/ (11 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
This is what the final hypergraph node looks like...Youch!
http://www.highend3d.com/maya/tutorials/layeredtexture/ (12 of 13) [29.10.2001 13:14:53]
Maya Tutorials - Wrap Skinning for Bone/Muscle Driven Skin Deformation
The-Real-Mrhell
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board
Produced by Will McCullough. Copyright © 1997-2001 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/layeredtexture/ (13 of 13) [29.10.2001 13:14:53]
Contact Us
Advertise
Learning Maya Artisan
Version 1.0
January 1998, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A, All rights reserved. Assist Publishing Group: Don Chong, Bob Gundu, Robert Magee Assist Team: Lincoln Holme Special thanks to: Jill Jacob, Susan Park, Desiree Sy The following are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited: Alias Maya Maya Artisan Maya F/X Maya PowerModeler
MEL Alias Metamorph OpenAlias Alias OpenModel Alias OpenRender
Alias PowerTracer Alias QuickRender Alias QuickShade Alias QuickWire Alias RayCasting
Alias RayTracing Alias SDL Alias ShapeShifter Alias StudioPaint ZaPiT!
The following are trademarks of Alias|Wavefront, Inc.: Advanced Visualizer Wavefront Composer Dynamation
Explore Wavefront IPR Kinemation
MediaStudio MultiFlip VizPaint2D
3Design
Graph Layout Toolkit Copyright 1992-1996 Tom Sawyer Software, Berkeley, California, All Rights Reserved. All other product names mentioned are trademarks or registered trademarks of their respective holders. This document contains proprietary and conÞdential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, nor its employees shall be responsible for incidental or consequential damages resulting from the use of this material or liable for technical or editorial omissions made herein.
Alias|Wavefront ❚ 210 King Street East ❚ Toronto, Canada M5A 1J7
Contents Introduction: Learning Maya Artisan ......... 3 The Maya Artisan tools . . . . . . . . . . . . . . . . . . . . . 4 The Artisan settings . . . . . . . . . . . . . . . . . . . . . . . . 4 Maximum displacement . . . . . . . . . . . . . . . . . . . . 5 Opacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 The brush stamp radius . . . . . . . . . . . . . . . . . . . . . 5 Brush shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Sculpt operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Reflect painting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 The reference surface . . . . . . . . . . . . . . . . . . . . . . . 7 The Erase surface . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Installing tutorial files . . . . . . . . . . . . . . . . . . . . . . 7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Lesson 1: Sculpting a Mask ....................... 9 Setting up Artisan . . . . . . . . . . . . . . . . . . . . . . . . . 10 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Start sculpting the surface . . . . . . . . . . . . . . . . . . 11 Creating a new shading group . . . . . . . . . . . . . . 12 The sculpting tools . . . . . . . . . . . . . . . . . . . . . . . . 13 Updating the reference surface . . . . . . . . . . . . . . 14 Sculpting the nose . . . . . . . . . . . . . . . . . . . . . . . . . 15 Sculpting the eyes . . . . . . . . . . . . . . . . . . . . . . . . . 17 Sculpting the mouth . . . . . . . . . . . . . . . . . . . . . . . 18 Duplicate the face . . . . . . . . . . . . . . . . . . . . . . . . . 19 Selecting CVs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Masking selected CVs . . . . . . . . . . . . . . . . . . . . . . 21 Sculpting another face . . . . . . . . . . . . . . . . . . . . . 22 Other poses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 ANIMATING THE FACE . . . . . . . . . . . . . . . . . . 23 Blend Shape between faces . . . . . . . . . . . . . . . . . 24 Blend Shape history . . . . . . . . . . . . . . . . . . . . . . . 26 Painting cluster weights . . . . . . . . . . . . . . . . . . . . 26 Animate the cluster . . . . . . . . . . . . . . . . . . . . . . . . 27 Learning Maya 1
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Lesson 2: Detailing a Head
.....................31
Initial set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Defining Artisan hotkeys . . . . . . . . . . . . . . . . . . 32 Sculpting facial details . . . . . . . . . . . . . . . . . . . . . 33 Sculpting across surfaces . . . . . . . . . . . . . . . . . . 34 Painting geometry . . . . . . . . . . . . . . . . . . . . . . . . 34 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Lesson 3: Animating a Cape .....................39 Initial set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Creating the cape . . . . . . . . . . . . . . . . . . . . . . . . . 40 Sculpt the cape . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Apply soft body dynamics . . . . . . . . . . . . . . . . . 42 Paint the goal weights . . . . . . . . . . . . . . . . . . . . . 44 Finishing touches . . . . . . . . . . . . . . . . . . . . . . . . . 46 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Index .............................................................47
2 Learning Maya
Maya Artisan is an add-on module to Maya 1.0 that uses an intuitive paint and sculpt interface to let you work more interactively with Maya.
Introduction
The Artisan brush-based interface offers a more artistic approach to certain modeling and animation tasks in Maya. Workflows such as pushing and pulling CVs or setting weights on a cluster are enhanced by ArtisanÕs ability to use brush strokes. In this way, you can add realistic details to a surface or soften the effect of a cluster deformer. As you work through this book, you will quickly see how Artisan speeds up these kinds of workflows while giving you artistic control over the results. This book contains three quick lessons that take you through the Artisan functionality. The lessons can be used to familiarize yourself with how Artisan works and where the various Artisan tools are located.
Lesson 1: Sculpting a mask
Lesson 2: Detailing a head
Lesson 3: Animating a cape
Introduction
Learning Maya Artisan
Introduction The Maya Artisan tools
The Maya Artisan tools Maya Artisan includes four tools that each add different levels of functionality to Maya. All of these tools will be explored in the Learning Maya Artisan lessons.
to show you where different weights have been applied.
Weight = 1.0
Sculpt Surfaces tool Weight = 0.5
The Sculpt Surfaces tool lets you push and pull CVs to sculpt a NURBS surface. This tool also lets you smooth and erase your brush strokes for added interactivity.
Weight = 0.0
Painted cluster weights Script Paint tool Pull
Sculpting a surface
The Script Paint tool lets you add new functionality to Artisan using MEL (Maya Embedded Language) scripts. In this book, you will work with the geometryPaint script which lets you paint geometry over a surface and the softBodyPaint script which lets you paint goal weights on a soft body.
Paint Select CVs tool
The Paint Select CVs tool lets you select CVs on a NURBS surface. You can then use the selected CVs within Maya or you can use them as a mask for sculpting with Artisan.
Weight = 1.0
Weight = 0.7
Weight = 0.4
Animated soft body with painted goal weights
The Artisan settings Selecting CVs Paint Weights tool
The Paint Weights tool lets you vary the CV weights over the cluster using brush strokes. Artisan also gives you feedback by displaying a grayscale map on the surface 4 Learning Maya Artisan
When you are working with Artisan, you will learn to use its brush-based interface. This means that whether you are selecting CVs or sculpting a surface, you are directly manipulating the surface. This makes it easier to evaluate the impact of your edits.
Learning Maya Artisan Maximum displacement
Brush stamp radius icon
Pull
Introduction
The tools in Artisan have different options that are found in the Tool Settings window. Some of these settings are visually displayed as part of the cursor icon that appears as you paint on the surface. The icon shown below uses icons to indicate the brush radius and the maximum displacement. The icon also clearly labels the tool operation as either push or pull.
Opacity = 1.0
Opacity = 0.5
Opacity settings Tip:
As you work through the lessons, you will learn that it is best to use low maximum displacement and opacity settings so that you can build up your brush strokes gradually.
Push
The brush stamp radius Maximum displacement icon
Typical cursor icons
Maximum displacement When you are sculpting with Artisan, you can set the maximum displacement value. This value determines how much the surface will displace with a single brush stroke.
The brush stamp radius determines how much of the surface will be affected by the brush stroke. When you are using a tablet, you can set an upper and a lower radius which can be used to help you control the radius with the pressure of the stylus.
Brush radius
Maximum displacement
Different displacement values
Opacity
Brush radius
If you would like to build up your brush strokes, you can set the opacity of the stroke so that only part of the maximum displacement is used.
Learning Maya Artisan 5
Introduction Brush shape
Brush shape You can also set the brush shape in Artisan. This lets you determine how the brush paints on the surface. Artisan includes eight brush shapes for your to choose from.
Smooth
Smoothing the surface Brush shapes
Sculpt operations When you are using Artisan to sculpt, there are four main operations that you will use.
Erase
The erase operation lets you undo your sculpting operations using a brush stroke. This lets you selectively erase brush strokes.
Push and Pull
These operations let you push and pull the CVs on a surface. Most of your sculpting will start with one of these operations.
Reflect painting If you are working with models that require symmetrical detailing, ArtisanÕs reflect paint options can be used so that, as you paint on one side of the surface, brush strokes are automatically added to the opposite side. You can also use this method over two different surfaces.
Pushing and pulling Smooth
As you push and pull the surface, your strokes may create an uneven look to the surface. In these cases, you can use the smooth operation to soften the look of the sculpted surface. You can also flood the surface with a smooth operation to clean up all of the strokes at the same time. Reflect painting
6 Learning Maya Artisan
Learning Maya Artisan The reference surface
Installing tutorial files
As you sculpt with Artisan, each stroke is placed in relation to the reference surface. As you push and pull the surface, you cannot displace the reference surface beyond the maximum displacement value. You can update the reference surface from time to time if you want to build up brush strokes.
For some of the Learning Maya Artisan lessons, you will require scene files that contain surfaces for sculpting.
The reference surface can be set to automatically update after each brush stroke. This means that you can build up your brush strokes beyond the set maximum displacement.
How to copy the learningMaya directory
Strokes can build up with updated surface
Strokes can only pull to Max displacement
These files can be found in a directory named learningArtisan. You can access this directory from the Discover Maya CD-ROM. ■
Mount the Discover Maya CD-ROM
■
Follow the instructions on the CD for copying the learningArtisan directory into your Maya projects directory.
Conclusion Now that you are familiar with the basic Artisan tools and concepts, you can start working with a real project. Tip:
Fixed reference surface
Updated reference surface
Before starting these lessons, it is recommended that you complete the Learning Maya tutorials.
Reference surface
The Erase surface When you use the Erase tool, it is possible to erase back to your starting point. This is called your Erase surface. If you want your Erase surface to change, then you can update it so that the new surface is the surface you erase to. Updated erase surface
In Lesson 1, you will sculpt facial features onto a surface to create a mask. You will then animate the mask using MayaÕs Blend Shape functionality and a cluster that uses Artisan painted CV weights. Note:
This book also integrates soft body effects that use the Maya F/X package. If you do not have this Maya module, then you will not be able to complete Lesson 3 which has been labeled as Maya F/X only.
Erasing back to erase surface
Erase surface Learning Maya Artisan 7
Introduction
The reference surface
Introduction Conclusion
8 Learning Maya Artisan
1
Sculpting a Mask
Lesson 1
The sculpted mask Once you have sculpted the facial poses, you will use Maya tools, such as blend shape and clusters, to animate the mask. Then you will use Artisan to paint cluster weights. In this lesson you will learn the following: ■
How to sculpt surfaces by painting with Artisan
■
How to use different brush operations
■
How to set different brush options
■
How to select CVs by painting
■
How to animate the facial poses using blend shape
■
How to paint graduated weight values on a cluster
Lesson One
In this lesson, you will sculpt facial features onto a mask using Maya Artisan to push and pull the CVs on the surface. This lesson allows you to explore how you can use Artisan to work creatively as you sculpt, smooth and erase. You will be surprised how quickly you can sculpt several different facial poses.
Lesson 1 Setting up Artisan
Setting up Artisan Maya Artisan is an add-on module to the base Maya package. When you first load Maya, you must set it to recognize the Artisan functionality. 1 Launch Maya ■ Double-click on the Maya icon.
■
A window opens to show you a list of the current projects. ■
Click on the learningArtisan directory.
■
Click on Set Project. Now you are working with this project directory structure as you open and save your files.
Or ■
Enter maya in a shell window.
2 Activate Maya Artisan ■ Select Options → General Preferences. ■
Click on the hidden tabs at the far right and choose Packages from the list.
■
Under Load on Startup, set Maya Artisan to On.
■
Click Save.
Go to the File menu and select Project → Set...
2 Open an existing scene ■ Select File → Open Scene. ■
Click on the mask.mb file.
■
Click on Open. A single surface appears. This is the starting point of a mask model that you will now develop in Artisan.
3 Relaunch Maya Quit Maya and relaunch to make use of the new settings. ■
Select File → Quit.
■
Relaunch Maya.
Getting started You will now use the learningArtisan project. See the introduction to find out how to copy this directory into your maya/projects directory. 1 Set the courseware project To manage your files, you can set a project directory that contains sub-directories for different types of files that relate to your project.
10 Learning Maya Artisan
Mask surface 3 Increase the surface smoothness ■ Select the surface. ■
Press the 3 key to set the surface smoothness. This makes the surface look more dense. You have increased the display smoothness without making the surface more complex.
Sculpting a Mask Start sculpting the surface 4 Turn on smooth shading ■ Press the 5 key to turn on hardware smooth shading.
Lesson One
5 Change your view ■ Use the Alt key to tumble, track and dolly in the view. You can use the following mouse combinations: Alt + LMB to tumble; Alt + MMB to track; Alt + LMB & MMB to dolly.
You will be changing views frequently while using Artisan as you begin working around the object in three dimensions. ■
Set up a view where the mask surface is at the left side of the view panel to make room for the Tool Settings window.
Start sculpting the surface You will now sculpt the surface of the mask by painting on it using the Artisan Sculpt Surfaces tool. At first, you will just test the tools to get a feel for them. Later, you will erase these brush strokes so that you can paint real facial features. 1 Open the Tool Settings window ■ Go to the Modeling menu set. ■
Select Edit Surfaces → Sculpt Surfaces Tool - ❐. This opens the Tool Settings window which includes all of ArtisanÕs sculpting options.
Tool Settings window ■
Click on the Reset Tool button to make sure that you are starting with ArtisanÕs default settings.
■
Place the new window to the right of the mask model. You will work with this window open, until you are familiar with how to use hotkeys.
2 Paint on the surface ■ Move your cursor over the mask surface. The cursor icon changes to show an arrow surrounded by a red circular outline. The arrow indicates how much the surface will be pushed or pulled while the outline indicates the brush radius. ArtisanÕs brush icon is context sensitive. It changes as you choose different tool settings.
Learning Maya Artisan 11
Lesson 1 Creating a new shading group ■
Click-drag on the surface. You are now painting on the surface to sculpt it.
Now it is easier to see the results of your sculpting.
You can either click-drag using a mouse, or preferably, draw directly with a stylus. Artisan works more intuitively with a tablet and stylus, since the input device mimics the use of an actual paintbrush.
Tip:
This brush stroke pushes in the surface. The brush stroke is sculpting the surface.
Second brush stroke
Creating a new shading group You will now create a shading group that will display more pronounced highlights to help you to see the surface as you are sculpting. 1 Create a new material node ■ Go to the Rendering menu set. ■
First brush stroke 3 Change the Artisan display ■ Click the Display tab in the Tool Settings window. ■
Click on Show Active Lines to turn this option off. Now you can focus on the surface without displaying isoparm lines.
4 Paint another stroke ■ Paint a second stroke across the mask surface.
Select Shading → Create Shading Group → Blinn.
2 Assign the new shading group ■ Select the mask surface again. ■
■
Select Shading → Assign Shading Group → blinn1Grp. Click in open space to deselect the surface.
3 Edit the shading group attributes ■ Select Shading → Assign Shading Group → blinn1Grp - ❐. ■
In the Attribute Editor, open the Common Material Attributes and set the following attribute: Diffuse to 0.5.
12 Learning Maya Artisan
Sculpting a Mask The sculpting tools ■
Click on the swatch next to Color and set it to any color you like. This lesson uses an orange color.
■
Under Specular Shading, click on the color swatch next to Specular Color and in the Color Chooser, set: Value to 0.8.
2 Smooth out the results ■ Under Operation, click on Smooth. ■
This increases the size of your brush. You can see that the red outline has increased in size. This is the brush feedback icon.
New shading group assigned
The sculpting tools You will now explore some of the Artisan sculpting operations to see how they work. So far, you have been pushing on the surface. Now you will learn how to pull, smooth and erase.
Under Stamp Profile, change the Radius (U) to 1.0.
■
Paint all of the strokes to smooth the details. If you stroke over an area more than once, the smoothing becomes more evident.
1 Pull on the surface ■ Select the mask surface. ■ ■
Go back to the Modeling menu set. Select Edit Surfaces → Sculpt Surfaces Tool - ❐.
■
In the Tool Settings window, click on the Sculpt tab.
■
Under Operation, click on Pull.
■
Tumble around to the other side of the model.
■
Paint on the surface to create a few strokes that pull out.
Smoothing the brush strokes 3 Erase some of the brush strokes ■ Under Operation, click on the Erase option. Learning Maya Artisan 13
Lesson One
Pulling the surface with several brush strokes
Lesson 1 Updating the reference surface ■
Paint along the surface to begin erasing the existing sculpt edits. DonÕt erase all the edits.
surface untouched until you decide to update it manually. 1 Change the brush operation and radius ■ Under Operation, click on Pull. ■
Under Stamp Profile, change the Radius(U) to 0.5.
2 Pull the surface with two strokes ■ Paint on the surface to create two crossing strokes that pull out. ■
Erasing the brush strokes 4 Flood erase the surface ■ In the Stamp Profile section, click on the Flood button next to Opacity.
Tumble the view to see the strokes from the side. The second stroke built on top of the first stroke. Therefore, where the two strokes intersect, the height of the pull is higher.
This uses the current operation and applies it to the whole surface using the current opacity setting.
Overlap
Painting with reference update
Fully erased surface
Updating the reference surface When you paint in Artisan, you paint in relation to a reference surface. By default, the reference surface updates after every stroke so that you can build your strokes on top of each other. You can also keep the reference 14 Learning Maya Artisan
3 Change the reference update ■ In the Tool Settings window, scroll down to the Surface section, and click on the Reference Srf: update on each Stroke to turn this option Off. 4 Paint several strokes ■ Paint on the surface to create a few strokes that pull out.
Sculpting a Mask Sculpting the nose ■
Tumble the view to see the strokes from the side. This time, the strokes do not overlap.
Painting on updated reference layer 7 Flood erase the surface ■ Under Operation, click on the Erase option. ■
Click on the Flood button.
Sculpting the nose No overlap
Painting with no reference update 5 Update the reference layer ■ In the Surface section, click on the Update button next to Reference Srf.
Now that your surface is clean again, you can sculpt a real face beginning with the nose. This gives you the chance to gain more control over the Artisan tools. 1 Turn reference updating back on ■ In the Surface section, click on the Reference Srf: update on each Stroke to turn this option to On.
6 Paint on the surface ■ Paint another two strokes over the last set of strokes. The overlapping strokes are again building on top of each other.
This will let you build up the facial details as the reference surface updates. 2 Change your stylus pressure setting If you are working with a tablet and a stylus, you can set up your stylus to create more subtle results. ■
Click on the Stroke tab.
■
Under Stylus Pressure, click on Radius.
Learning Maya Artisan 15
Lesson One
The reference surface does not update, therefore the strokes can only displace to the Maximum Displacement value as defined in the Tool Settings window. You cannot displace beyond that value until you update the reference surface.
Lesson 1 Sculpting the nose This means that the harder you press, the larger the radius of the brush stroke. You can now set the upper radius (Radius (U)) and lower radius (Radius (L)) sizes that will be used by the stylus.
This is an alternative method for changing the tool operation without using the Tool Settings window. ■
As you work through this lesson, explore the various stylus settings to see how they can help you paint.
If you donÕt like any of your strokes, you can undo the action using the z key, or you can Erase back to the original surface. Artisan gives you this flexibility in order to let you explore design alternatives.
3 Change your Stamp Profile settings ■ Click on the Sculpt tab. ■
Change the Radius(U) to 1.0.
■
Change the Radius(L) to 0.25. This means that the lowest your stroke will go is 0.25 and the largest will be 1.0.
■
Paint from the top of the nose to the tip. Use several strokes to build up the bridge of the nose and the nostril areas. You may need to tumble your view to complete these strokes.
Change the Opacity to 0.2. This means that each stroke will only have 0.2 of the effect. This lets you use softer strokes to build up a shape.
■
Change your stamp setting to the second icon, which has more feathering at the brushÕs edge.
New brush shape 4 Paint the length of the nose ■ Press the u key and click to bring up the Artisan marking menu. This marking menu is context sensitive and changes depending on which Artisan tool you are using. ■
Select Pull from the marking menu.
16 Learning Maya Artisan
Sculpting the nose 5 Flood smooth the shape Since these strokes appear somewhat bumpy, you can smooth all the strokes using the Flood button. ■
Press the u key and select Smooth from the Artisan marking menu.
■
In the Tool Settings window, click on Flood twice. This smooths out some of the bumps. Because the opacity setting is set to 0.2, the smoothing is more
Sculpting a Mask Sculpting the eyes subtle. It is a good idea to smooth your shape regularly to clean up your strokes. 6 Pull out the tip of the nose ■ In the Sculpt Variables section, change the Ref. Vector to Z-Axis.
■
Press the u key and select Pull from the Artisan marking menu.
■
Paint the tip of the nose to pull it out.
■
Click on the Stroke tab.
■
Under Reflect Paint, set Reflection to On. By default, it is set to reflect around the U-axis.
■
Move your cursor over the surface. You can see that the reflection is going the wrong way.
Reflecting in U ■
Pulling the tip of the nose along the Z-axis 7 Save your work ■ Select File → Save Scene As... ■
Enter the name my_mask and Save.
Sculpting the eyes
Click on V Isoparm for reflecting.
2 Push the eye sockets in ■ Press the u key and select Push from the Artisan marking menu. ■
Paint one of the eye socket areas to push it in. The other socket is pulled by the reflection.
You now want to sculpt two eye sockets. Ideally, you want the strokes you apply to the left eye to be mirrored on the right eye. Artisan makes painting symmetrical strokes very simple.
Learning Maya Artisan 17
Lesson One
This means that now you will pull out along the Z-axis instead of normal to the surface.
1 Turn Reflection on ■ Press the y key to re-select the Sculpt Surfaces Tool.
Lesson 1 Sculpting the mouth
Sculpting the mouth You will now sculpt the mouth. You will start by pulling out the lips then pushing in the mouth.
Reflected stroke
Painted stroke
1 Change the brush radius ■ Press the Ctrl key and the left arrow key to make the radius smaller. The right arrow key makes the radius bigger.
Pushing in eye sockets 3 Pull the eyebrows out ■ In the Sculpt Variables section, change the Ref. Vector to Normal. ■
■
Press the u key and select Pull from the Artisan marking menu. Paint the eyebrow areas to pull them out.
In the next lesson, you will learn how to set up hotkeys to change the Artisan settings more interactively.
Note:
2 Pull out two lips ■ Press the u key and select Pull from the Artisan marking menu. ■
Paint the lip area to pull two lips
out.
Reflected stroke
Painted stroke
Pulling out eyebrows 4 Flood smooth the surface ■ Press the u key and select Smooth from the Artisan marking menu. ■
Click on the Flood button two times.
Pulling out two lips 3 Push in the mouth ■ Press the u key and select Push from the Artisan marking menu. ■
18 Learning Maya Artisan
Paint between the lips to push in a mouth area.
Sculpting a Mask Duplicate the face ■
Change to a Smooth operation and smooth the mouth brush strokes.
erased Ð not to the plain mask, but rather to the more detailed pose you have already sculpted. 1 Update the Erase surface ■ Select the mask surface. ■
■
Paint the area above the upper lip to push it in.
Make sure that you save a backup of the old surface in another file.
Tip:
■
Press the u key and select Erase from the Artisan marking menu.
■
Paint the face to see if you can erase any of the strokes. You wonÕt be able to. The updated Erase surface means that you cannot erase any more on this surface until you start painting again.
Pushing in the upper lip
2 Duplicate the face and move it ■ With the mask selected, select Edit → Duplicate. ■
5 Save your work
Duplicate the face
Move the new surface along the Xaxis until it is beside the original surface.
You will now update the Erase surface then duplicate the face. This lets you sculpt a second face with a different facial pose. By updating the Erase surface, any brush strokes used to create the second facial pose can be
Learning Maya Artisan 19
Lesson One
Now, you can no longer erase to the original surface. You should update the Erase surface any time you are pleased with how the surface looks.
Pushing in mouth 4 Add the upper lip detail ■ Press the u key and select Push from the Artisan marking menu.
In the Surface section of the Sculpt tab, click on the Update button next to Erase Srf.
Lesson 1 Selecting CVs 2 Select CVs on the face ■ In the Tool Settings window, click on the Select tab. ■
Make sure that your options are the default by clicking on the Reset Tool button found at the bottom of the window.
■
Paint over the surface to select the CVs around the mouth.
The duplicated surface
Selecting CVs Another Maya Artisan tool is the Paint Select CVs Tool. This tool lets you easily select a region of CVs. You will select CVs using this tool, then use the selection to mask out the area of the face that you want to re-sculpt. 1 Select the Paint Select CVs tool ■ Track and dolly closer to the mouth of the second face. ■
Select Modify → Paint Select CVs Tool - ❐. The Component selection mode is activated and the CVs are displayed on the face.
Selected CVs 3 Reverse the selection ■ In the Tool Settings window, go to the Global Selection section and click on the Toggle All button. Now, the unselected CVs become selected and the selected CVs become unselected. 4 Unselect some CVs ■ Under Selection Type, click on Unselect CVs. ■
Activated CVs
20 Learning Maya Artisan
Paint over the mouth area to unselect a slightly larger area.
Sculpting a Mask Masking selected CVs
5 Save an image of the selection ■ Click on the Map tab in the Tool Settings window. ■
In the Export Attribute Map section, type mouthSelect and press the Enter key.
Masking selected CVs You can now use the selected CVs as a masked area on the face. This means that you can set up the sculpting tools to affect only unselected CVs. 1 Sculpting around masked CVs ■ Select Edit Surfaces → Sculpt Surfaces Tool - ❐. ■
Press the u key and select the Push operation.
■
Click on the Mask tab.
■
Under CV Masking, set the following: Selected CVs to On; Display CVs to Off.
Selection map export 6 View the saved image ■ Scroll up to the Import Attribute Map section. ■
Click on the Browse button.
■
Click on mouthSelect then click on the See Image button.
This hides the selected CVs but uses them to mask the surface. ■
Paint on the surface near the edge of the mask. You will see that unaffected in the areas where they are masked.
This is what your painted region looks like as a map. You will reuse this map later in the lesson. Learning Maya Artisan 21
Lesson One
Saved selection map
Reversed selection
Lesson 1 Sculpting another face
Painting near the mask 2 Flood erase the surface ■ Set the Opacity to 1.0. ■
Choose the Erase operation.
■
Click on the Flood button.
3 Paint a smiling mouth ■ Set the Opacity to 0.2. Remember that it is better to use a low opacity setting to build up your work.
Tip:
■
Press the u key and select the Push operation.
■
Click on the Stroke tab and turn Reflection to On. Make sure that V Isoparm is being used.
■
Paint the corners of the mouth to create a smile. You may decide to change the radius, brush type or any other settings to draw the smile that you want. Remember, that you can erase if you donÕt like what you paint or use the Undo command by pressing the z key.
22 Learning Maya Artisan
Painted smile
Sculpting another face You will now sculpt another face so that you have a sad facial pose. To mask out the mouth area, you will load the map you saved earlier. 1 Select and duplicate the first face ■ Select the Select tool. ■
Click on the original face.
■
Select Edit → Duplicate.
■
Move the new face beside the second face.
Third mask 2 Load the selection mask ■ Select Modify → Paint Select CVs Tool - ❐.
Sculpting a Mask Other poses Click on the Select tab.
Other poses
■
In the Selection Type section, turn Select CVs to On.
■
Click on the Map tab.
■
In the Import Attribute Map section, click on the Browse button next to Map Name.
You can now create five more faces that each have their own facial expressions, or poses. In the following diagram, you can see each of the faces. For each pose, choose either the eyes or the mouth for your edits. This works better with Blend Shape, since you can now blend different eye and mouth poses together.
■
Select mouthSelect from the list and click Import. Now, the CVs around the face are selected just like before.
When you are finished, name each surface using the names indicated on the diagram. By naming the surfaces, the Blend Shape controls will be easier to read later.
open
sad
smile
neutral
hollow
puffy
squint
frown
Imported selection map 3 Paint another facial pose Use the same method that you used for the smiling face to Paint a sad facial pose for the mouth.
Other facial poses
ANIMATING THE FACE You will now animate the neutral face using two different Maya deformers. The Blend Shape deformer will be used to deform the neutral face using the other seven faces as targets. The second deformer will be a cluster that you will use to bend the face forward and back.
Sad mouth position Learning Maya Artisan 23
Lesson One
■
Lesson 1 Blend Shape between faces
Blend Shape between faces
The pose shown below uses following settings:
You will start by blending between the various facial poses. The neutral face will be used as the base shape.
smile to 1.0; sad to 0; open to 1.0;
1 Apply the Blend Shape deformer ■ Select the eight faces. Be sure to select the neutral face last. This can be verified by the neutral face being highlighted in green. The neutral face is the base shape. ■
Go to the Animation menu set.
■
Select Deformations → Blend Shape.
hollow to 0; puff to 0; squint to 0.329; frown to 0.
The Blend Shape node is added to the neutral surface. You can see it in the Channel box in the Input node section. 2 Hide the target shapes ■ Select all of the faces except for the base shape. ■
3 Open the Blend Shape window ■ Select Window → Animation Editors → Blend Shape... ■
Pose at frame 1
Press Ctrl h to hide them.
You can now click-drag on the various sliders to set up combined versions of the target poses.
If you want to exaggerate one of the poses, you can set the blend shape value to more than 1.0.
Tip:
4 Set a key for the first pose ■ Go to frame 1. ■
In the Blend Shape window, click on the Key All button.
5 Set poses at frame 10 ■ Go to frame 10. ■
24 Learning Maya Artisan
Change your facial poses and again select the Key All button. The pose
Sculpting a Mask Blend Shape between faces shown below uses the following settings: smile to 1.0; sad to 0; open to 0; hollow to 0; squint to 0;
Pose at frame 20
frown to 0.
7 Set poses at frame 30 ■ Go to frame 30. ■
Change your facial poses and again select the Key All button. The pose shown below uses the following settings: smile to 0; sad to 1.0;
Pose at frame 10 6 Set poses at frame 20 ■ Go to frame 20. ■
Change your facial poses and again select the Key All button. The pose shown below uses the following settings:
open to 0; hollow to 0.866; puff to 0.439; squint to 0; frown to 1.0.
smile to 0; sad to 0; open to 0.659; hollow to 0; puff to 0.439; squint to 0; frown to 0.695.
Pose at frame 30
Learning Maya Artisan 25
Lesson One
puff to 1.0;
Lesson 1 Blend Shape history 8 Playback the animation You will now see the mask animating between the various facial poses.
2 Rotate the cluster ■ Rotate the cluster forward around the X-axis. Because all of the cluster CVs are weighted at 1.0 by default, the whole surface rotates.
Blend Shape history When you originally set up the Blend Shape node, you hid the target shapes. Once you start blending, you can tweak any of the targets by showing and repainting it. The construction history of the Blend Shape will then make sure that the repainted target updates on the base surface when that target is invoked.
Painting cluster weights To further animate the surface, you will add a cluster deformer onto the surface. The rotation of the cluster will be animated to add a second layer of motion onto the face. Maya Artisan will then be used to paint cluster weights so that you can vary the effect of the cluster on the surface. 1 Create a cluster ■ Select the neutral surface. ■
Rotated cluster 3 Open the paint weights tool ■ Select the neutral surface. ■
Select Deformations → Paint Weights Tool - ❐.
■
Click on the Display tab.
■
In the Values section, make sure that Color Feedback is On and then click on the Use Set Color to turn it On.
Select Deformations → Cluster.
This means that the cluster weights will be displayed on the surface as a color value. By default, the surface is white (value of 1.0). You will now paint other cluster values onto the surface.
Cluster handle
4 Paint a weight of 0 on the cluster ■ Click on the Weight tab. ■
New cluster
26 Learning Maya Artisan
In the Stamp Profile section, set the Value to 0.00.
Sculpting a Mask Animate the cluster ■
In the Operation section, make sure Replace is set to On.
■
Paint on the bottom of the face to set the value.
■
You will have to tumble around to get all of the CVs on this part of the surface.
Weight = 0.5
Painted cluster weights
Animate the cluster Weight = 1
Weight = 0
Cluster weights at 0 and 1
To animate the cluster, you will set keys on its rotation at four key frames. Two key frames will be set for the start position of the cluster while the other two will be set for rotations to the left and right. The soft blend of the cluster weights will let the top of the face animate faster than the bottom. 1 Key the cluster rotation at frame 1 ■ Go to frame 1. ■
5 Paint other weights on the cluster ■ Change the weight to 0.5. ■
Paint the middle of the face.
■
Change the operation to Smooth.
■
Click Flood twice. This creates a nice blend of the weights from the top of the mask down to the base.
Select the cluster using the cluster
handle. ■
Press Shift e to set keys on the rotation channels.
2 Key the cluster rotation at frame 30 ■ Go to frame 30. ■
Press Shift e to set keys on the rotation channels.
3 Key the cluster rotation at frame 10 ■ Go to frame 10. ■
Rotate the cluster to the left and
back. ■
Press Shift e to set keys on the rotation channels. Learning Maya Artisan 27
Lesson One
As you paint them, they will pop back to an unrotated position. They will also turn black, which represents a weight of 0.
Lesson 1 Animate the cluster ■
Press the u key and select Smooth from the marking menu.
■
Paint the kinked area of the surface to smooth the deformation.
Scroll through the animation to see if other frames show this kind of kinking. You can then smooth the cluster weights there, too.
Rotated cluster at frame 10 4 Key the cluster rotation at frame 20 ■ Go to frame 20. ■
Rotate the cluster to the right.
■
Press Shift e to set keys on the rotation channels. You may notice some kinking at the side of the mask. You can use Artisan to fix this by smoothing the weights at these points as shown below.
Corrected weights 6 Playblast the results ■ Select Window → Playblast... to preview the animation.
Kinked surface
Rotated cluster at frame 20 5 Use Artisan to smooth the weights ■ Select the neutral surface. ■
Select Deformations → Paint Weights Tool - ❐.
28 Learning Maya Artisan
Playblast of animation
Sculpting a Mask Conclusion 7 Save your work
Conclusion
Lesson One
If you like, you can now set up a set and some textures just like the cover image of this lesson. Use your knowledge of creating and applying shading groups to complete the scene. You can now see how Maya Artisan can be used to accomplish many tasks in Maya mor easily than standard methods. You can push and pull CVs, select CVs and paint cluster weights as you model and animate your models. It is important to note how Artisan can be used to help you set up models for animation. In the next lesson, you will explore the use of Artisan on a more complex head model.
Learning Maya Artisan 29
Lesson 1 Conclusion
30 Learning Maya Artisan
2
Detailing a Head In this lesson, you will take an existing model of a head and add detail using several Maya Artisan tools. You will start by sculpting the cheek and jaw areas. Because the head is built out of two half surfaces, you will need to reflect paint across the two surfaces and paint across the seam that separates the two halves of the surface.
Lesson 2
Lesson Two
The sculpted head Once you have the details painted, you will use the Script Paint tool to paint spiked cones directly onto the head surface. You will then use a special script called the geometry paint script to complete the painting of the cones. In this lesson you will learn the following: ■
How to sculpt multiple surfaces
■
How to sculpt across a seam
■
How to use the Script Paint tool
■
How to use the geometry paint script
Lesson 2 Initial set-up
Initial set-up
Defining Artisan hotkeys
You are going to complete this lesson using a model of a head that has already been created using MayaÕs surfacing tools. In general, Artisan is best suited for refining models at the later stages of the modeling process rather than building complex models from scratch.
By setting up hotkeys, you will have faster access to Artisan tool settings. It is a good idea to set up hotkeys for the upper brush radius, the maximum displacement and the opacity.
To start this lesson it is very important that you place the geometryPaint.mel script into your maya/scripts directory. See your Maya Artisan installation instructions for details. 1 Open an existing scene ■ Select File → Open Scene. ■
Click on the head.mb file.
■
Click on Open. A model of a womanÕs head appears. This model includes two surfaces which define the right and left sides of the head, as well as two spheres which represent the eyeballs. All these pieces are grouped together. To select the whole group, you can use the selection handle at the base of the neck.
Two surfaces
1 Open the Hotkeys editor ■ Select Options → Customize UI → Hotkeys... ■
Scroll down to the Maya Artisan Tools section of the Hotkeys window.
2 Define an upper brush radius hotkey ■ Click on Activate Modify Upper Brush Radius (Press). ■
In the Key Settings section, set the following: Key to b; Action to Press.
■
Click the Apply New Settings button. If the b key is already defined as a hotkey, then you can either replace it with the Brush Radius or you can choose another key.
Note:
■
Click on Activate Modify Upper Brush Radius (Press).
■
In the Key Settings section, set the following:
Group selection handle
Key to b; Action to Release. ■
Head surfaces
32 Learning Maya Artisan
Click the Apply New Settings button.
Detailing a Head Sculpting facial details Now you can paint on both sides of the head even though it is built out of two separate surfaces.
Later, when you are working with the Artisan tools, you can see how this hotkey works. 3 Define other hotkeys for Artisan ■ Use the technique outlined above to set the n key for the activation and deactivation of Maximum Displacement modification. Use the techniques outlined in step 2 to use the m key for the activation and deactivation of Opacity modification.
■
If desired, map other Artisan attributes to hotkeys.
■
Click Save then Close. These settings are now available when you start working on the head surfaces.
Reflecting over two surfaces 2 Push in the cheeks ■ Press the u key and make sure that your operation is set to Push. ■
Sculpting facial details To start, you will paint some facial details onto the two surfaces. In the last lesson, you were able to reflect paint on the same surface. You will use a similar technique to reflect paint across two surfaces. 1 Paint on both the surfaces ■ Go to the Modeling menu set. ■ ■
Select both of the head surfaces.
Select Edit Surfaces → Sculpt Surfaces Tool - ❐.
■
Click on the Display tab and set Show Active Lines to Off.
■
Click on the Stroke tab and, under Reflect Paint, set Reflection and Multiple Surf to On.
Press the b key and click-drag to set the Radius (U) to 0.3. As you click-drag, you will notice the value changing. Release the mouse button when you reach the desired value.
■
Press the n key and click-drag to set the Max Displacement to 0.35.
■
Press the m key and click-drag to set the Opacity to 0.2.
■
Click-drag on the cheeks to push in this area of the face.
Learning Maya Artisan 33
Lesson Two
■
Lesson 2 Sculpting across surfaces
Pulling across two surfaces
Sculpted cheeks
Sculpting across surfaces You will now add detail to the forehead and the nose where you need to sculpt across the two surfaces. This means sculpting across the seam that separates the two common edges. 1 Sculpt the forehead area ■ In the Tool Settings window, click on the Stroke tab and set Reflection to Off. ■
Press the u key and make sure that your operation is set to Pull.
■
Paint across both surfaces along the forehead area. The seam between the surfaces is maintained by Artisan throughout the brush stroke. This can be controlled by the Seam Autocreations settings. You can read more about working with seams in the Using Maya Artisan book.
2 Sculpt the nose area ■ Dolly into the nose area. ■
Use your hotkeys to set a small brush radius.
■
Paint the bridge of the nose to pull it out. Again the seam is maintained. At first, the stroke pulls the surfaces apart, but the seam pulls the surfaces back together.
Sculpted nose
Painting geometry Another important tool in Artisan is the Script Paint tool that lets you use a MEL (Maya Embedded Language) script to add functionality to Artisan. You will paint a 34 Learning Maya Artisan
Detailing a Head Painting geometry spiked hairstyle of primitive cones onto the head using the reflect option. 1 Move the head back You will move the head back to give yourself room to build the cone. ■
Dolly out to see all of the head.
■
Select the head group using the
selection handle at the base of the neck. This selects all of the pieces of the head. ■
Move the head back along the Z-
New primitive cone ■
axis.
Select Edit → Delete by Type → History.
■
This function lets you keep the current shape of the cone while returning its transform values back to default values.
Moved surface 2 Build a primitive cone ■ Select Primitives → Create NURBS → Cone. ■
Scale the cone around the origin to make it smaller, and then Scale it along the Y-axis to make it taller.
Select Modify → Freeze Transformations.
3 Rename and hide the cone ■ In the Channel box, rename the cone to spike. ■
Select Display → Hide → Hide Selection. The geometry does not have to be visible for you to use the geometry painting.
4 Load the build rotation node plug-in To use the geometry paint scriptÕs align option, you need the buildRotationNode plug-in. The script uses this node type to
Learning Maya Artisan 35
Lesson Two
You deleted history because, when you later paint multiple copies of the cone onto the head, you do not want to also make copies of the history nodes.
Lesson 2 Painting geometry create and maintain the alignment of the geometry to the surface. ■
■
In the Options section, turn Align to On.
Select Window → General Editors → Plug-in Manager...
■
Click on the loaded button next to buildRotationNode.so. If you want to use this function on a regular basis, click on the auto load button.
■
Close this window.
5 Set up the Script Paint tool You will now load the geometry paint script into the Script Paint tool so that you can use the added functionality. ■
Geometry Paint Settings window ■
Select the two main surfaces of the
head. ■
Select Modify → Script Paint Tool - ❐.
■
Click on the end of the tabs and choose the Setup tab.
■
In the Tool Setup Cmd: field, type the following:
7 Set up the paint options ■ In the Tool Settings window, click on the Display tab and under Surface, turn Show Active Lines to Off. ■
geometryPaint ■
Press the Tab key to accept this entry.
Opacity to 1.0; Value to 0.6. ■
■
In the Geometry Paint Settings window, type spike in the Geometry: field. Press Enter.
36 Learning Maya Artisan
Return to the Script Paint tab and in the Stamp Profile section, set the following: Radius (U) to 0.75;
This opens up the Geometry Paint Settings window that includes options offered by the script. 6 Load the cone geometry The first thing that you need to do is to tell the script which piece of geometry you want to paint with.
Minimize this window so that you can change the settings later.
Make sure that the Operation is set to Replace.
8 Set up the reflect options ■ Click on the Stroke tab. ■
Under Reflect Paint turn Reflection and Multiple Surf to On.
Detailing a Head Painting geometry 9 Paint the geometry onto the surface ■ Paint around the skull area of the head. The spikes are placed randomly over the surface using different scale sizes. The reflect option also adds the spikes to the other side of the head.
Increased grid for painting ■
Painted geometry To optimize performance when tumbling views, set the display smoothness of the head to 1.
Tip:
10 Paint more cones onto the back ■ Maximize the Geometry Paint Settings window. ■
Completed head
Change the following settings: U Grid Size to 50; V Grid Size to 50.
■
Paint the back of the skull with the spike cones.
Learning Maya Artisan 37
Lesson Two
You can now add more geometry to the head using the geometry paint script to create a ÔpunkÕ look for the character.
Lesson 2 Conclusion
Conclusion In Maya Artisan, you can sculpt on multiple surfaces. Using common edge detection, you are able to paint over the seams separating the surfaces so that they appear as if there is no break. The Script Paint tool offers another level of functionality in Maya Artisan where a MEL script can be used to offer new uses for the Artisan brush stamps. In the next lesson, you will explore another MEL script that lets you paint goal weights on a dynamic soft body object.
38 Learning Maya Artisan
3
Animating a Cape
The animated cape After completing this lesson, people who are comfortable with writing MEL scripts can take a look at the script used in this lesson to see how it was written. In this lesson you will learn the following: ■
How to set up a surface for sculpting
■
How to sculpt a surface using an imported file texture
■
How to set up a soft body simulation
■
How to use a MEL script to paint goal weights
Important Note: This lesson requires the Maya F/X module.
Lesson Three
Lesson 3
In this lesson, you will create an animated cape using a simple surface that you convert into a soft body object. This lesson uses Maya Artisan to help you control the soft body surface by painting goal weights. The script used in this lesson is an example of the added functionality that you can load into Artisan using the Script Paint tool.
Lesson 3 Initial set-up
Initial set-up
■
Move the plane about 8 units above
the ground grid.
To start this lesson it is very important that you place the softBodyPaint.mel script into your maya/scripts directory. See your Maya Artisan installation instructions for details. 1 Create a new file ■ Select File → New Scene. You will be building and animating the cape from scratch.
Creating the cape To start this lesson, you will build a primitive plane that you will reshape into a cape. You will then make the surfaceÕs topology more complex to give Artisan the detail it needs. 1 Create a primitive plane ■ Go to the Modeling menu set. ■
Select Primitives → Create NURBS →
Cape surface 3 Scale the top of the cape To taper the cape surface, you will scale the top row of CVs. ■
Press the F8 key to go into component mode.
■
Select the top four CVs on the surface.
■
Scale them down to taper the top of
Plane. ■
Select Edit → Delete by Type → History.
the cape.
You do not need construction history since you will be pulling CVs. When you pull CVs, the ability to edit the number of spans in the planeÕs input node is broken. ■
Press the 5 key to turn on hardware shading.
■
Press the 3 key to increase the surface smoothness.
2 Place the primitive plane ■ Scale the plane to a size of 12 along the X-axis and 9 along the Z-axis. ■
Rotate the plane 90 degrees around
the Z-axis.
40 Learning Maya Artisan
Scaled CVs 4 Create the neck of the cape To create the collar of the cape, you will pull the two outer CVs forward then scale them in.
Animating a Cape Sculpt the cape ■
Select the two outer CVs at the top
■
of the cape. ■
In the option window, set the following:
Move them forward along the X-
Number of Spans U to 20;
axis.
Number of Spans V to 10. ■
Click Rebuild then Close.
Sculpt the cape You will now use Maya Artisan to sculpt some detail into the cape. To give it a random look, you should apply a fractal map to one of the sculpting operations.
Moved CVs ■
Scale them in along the Z-axis.
1 Create a fractal map You will start by creating a procedural 2D texture. ■
Select Window → Multilister...
■
In the Multilister, select Edit → Create...
■
2 Convert the map into an image Since Artisan needs a file texture to map a sculpting operation, you will convert the procedural texture. Scaled CVs 5 Rebuild the surface complexity To add more CVs to the surface so that Artisan can sculpt more easily, you will need to rebuild the surface so that it has more spans along the U and V directions. ■
■
Press F8 to return to object selection mode. Select Edit Surfaces → Rebuild Surfaces - ❐.
■
In the Textures section of the Multilister, click on the fractal1 map.
■
In the view panel, Select the cape surface.
■
In the Multilister, select Edit → Convert Solid Texture.
This creates a file texture in the Multilister that works with the cape surface. The actual texture is saved in the sourceimages directory.
Learning Maya Artisan 41
Lesson Three
Click on the Textures tab then click on the Fractal button under 2D Textures.
Lesson 3 Apply soft body dynamics
Procedural texture
File texture
4 Save your work ■ Select File → Save Scene As... and save your file as cape_01.
Apply soft body dynamics Two texture nodes 3 Load the image into sculpting tool The new file texture can be loaded into ArtisanÕs sculpting tool. When you load a map, the active operation is then applied using the map as if it was a complex brush stroke that was covering the whole surface. ■
■
Select Edit Surfaces → Sculpt Surfaces Tool - ❐. Set the following options:
To animate the cape, you will use soft body dynamics. This will let you turn the cape into a special surface that deforms based on the various dynamic forces that are applied to it. You will also use a hidden version of the original surface as a goal for the soft body. This ensures that the soft body tries to return to its original shape as it is being blown around. 1 Create a soft body ■ Select the cape.
Operation to Pull;
■
Opacity to 1.0;
■
Max Displacement to 0.5. ■
Click on the Map tab.
■
Click on the Browse button next to Map name.
■
Sculpted surface 42 Learning Maya Artisan
Select Bodies → Create Soft Body - ❐ and set the following options: Convert to On; Duplicate to On; Hide Original Object to On; Enable Goal Weight to On;
Select the saved fractal map from the sourceimages directory. Artisan uses this map to Pull the surface using the chosen settings.
Go to the Dynamics menu set.
Weight to 0.5. ■
Click Create then Close.
Surface converted into a soft body
Animating a Cape Apply soft body dynamics 2 Add a gravity field By adding gravity, the cape will drop towards the ground as it blows around. ■
Select Fields → Create Gravity. Because the soft body was selected, you connected this field as it was created.
3 Add turbulence You will now add a turbulence field to randomize the motion off the cape. ■
■
Open up an Outliner panel and Select only the softObject.
4 Add wind You will now add a wind force to blow the cape backwards. ■
Select the softObject.
■
Select Fields → Create Air - ❐.
■
Click on the Wind button then set the following attributes: Magnitude to 20; Direction X to -1.
■
Click on Create then Close.
■
Move the air field icon up in front of the cape.
Select Fields → Create Turbulence. Again, the field is connected to the soft body as it is created.
■
In the Channel box, change the following turbulence attributes:
The wind’s direction X is -1.0
Magnitude to 25; Use Max Distance to On. ■
Move the turbulence icon up into
the center of the cape area.
Moved air field 5 Add springs To help the soft body spring back as it is affected by the dynamic forces, you will add springs. ■
Select the softObject.
■
Select Bodies → Create Springs - ❐.
■
Under Spring Methods, set the following: Set Min/Max to On;
Moved turbulence field
Max Distance to 1.
Under Spring Attributes, set: Stiffness to 20.
Learning Maya Artisan 43
Lesson Three
Max Distance to 5;
Lesson 3 Paint the goal weights ■
Click on Create then Close. This creates a mesh that strings together the particles on the soft body. You can hide the springs since they do not need to be visible to be part of the simulation.
one at a time and apply the weights that way. Maya ArtisanÕs Script Paint tool lets you use a more intuitive method. 1 Set up the Script Paint tool ■ Go to frame 1. ■
Select the softObject.
■
Select Modify → Script Paint Tool - ❐.
■
Click on the Setup tab and in the Tool Setup Cmd: field enter: softBodyPaint goalPP
■
Press the Tab key to accept this entry.
■
Click on the Display tab and under Surface, turn Show Active Lines to Off.
■
Return to the Script Paint tab and, under Stamp Profile, set the following:
Springs ■
Select Display → Hide → Hide Selection. By hiding the springs, you will speed up the simulation.
Value to 1.0. ■
6 Playback the simulation To see the effect of all these forces, you can playback the scene to view the simulation. ■
■
Set your playback range from 1 to 200 frames. Playback the simulation. Not much is happening. The particles only move a little as they hang off of their original goal. A constant goal weight of 0.5 is too limiting for this simulation.
Paint the goal weights To increase the action in the simulation, you need to vary the goal weights across the soft body. You could pick the soft body particles
44 Learning Maya Artisan
Click on the Flood button. Now the whole surface uses a goal weight of 1.0. This gives you a good starting point.
2 Paint the cape with goal weights ■ Under Stamp Profile, set the following: Value to 0.3. ■
Paint the bottom of the cape.
This script lets you visualize the painting of the value by actually painting a grayscale value onto the surface.
Animating a Cape Paint the goal weights
Value = 1.0 Value = 1.0 Value = 0.7 Value = 0.4
Value = 0.3
Painted CV weights
Painted weights ■
Playback the simulation.
■
Playback the simulation.
Now the cape is beginning to flow with the various forces being applied to it. It looks like 0.3 is a little too loose.
Animated soft body surface 3 Repaint the cape ■ Go to frame 1. ■
■
Change the Stamp Profile Value to 0.4.
4 Add folds to the cape You can add some complexity to the simulation by varying the weights along the length of the cape. ■
Go to frame 1.
■
Change the Stamp Profile Value back to 0.4.
■
Make your Radius (U) Ð the upper brush radius Ð smaller.
■
Paint three strokes down the length of the cape.
Repaint the bottom of the cape using
this value. ■
Change the Stamp Profile Value to 0.7.
■
Paint the middle area of the cape.
Learning Maya Artisan 45
Lesson Three
Animated soft body surface
Lesson 3 Finishing touches same time, you may want to play with other parts of the simulation such as the speed of the wind or the magnitude of the turbulence. Set these along with the soft body goal weights to get the cape to animate the way you want it to.
Painted CV weights 5 Smooth the stripes To soften the effect of these new brush strokes, you will smooth them out with the Flood button. ■
Change the stamp Opacity to 0.2.
■
Change the Operation to Smooth.
■
Click the Flood button twice.
■
Playback the simulation. Now you can see the creases forming where the new brush strokes were applied.
Animated soft body
Conclusion You have now seen how you can use ArtisanÕs Script Paint tool to add new functionality to the Maya environment. Artisan has replaced a more time-consuming task with the faster and more intuitive paint paradigm. Be sure to refer to the Using Maya Artisan guide to learn about other scripts that can be used to extend the Artisan functionality. If you enjoy creating MEL scripts, then you can take a look at the script used in this lesson and explore how you can create your own Artisan tools.
Animated soft body
Finishing touches You can now continue to paint the surface to get the animated look that you want. At the
46 Learning Maya Artisan
Index
Index
A air fields, see wind animating 23 clusters 27 goal weights 46 key all 24 playback 26 set key 24 soft body surfaces 46 surfaces 26 testing results 28 Attribute Editor 12 attributes shading groups 12
B Blend Shape 7, 23, 24 brush 11, 38 opacity 16 radius 5, 13, 16, 18, 22, 32 shape 6, 16 size 13 stroke 12 brush-based interface 4
pulling 40 scaling 40 selection 20 CVs, see control vertices (CVs)
D deformations 23, 26 Blend Shape 24 clusters 26 paint weights tool 26 displacement maximum displacement 5, 15 display smoothness 10 dollying views 11 duplicate 19, 22 dynamics 43 goal weights 46 soft body dynamics 42
E Erase surface 7, 19 erasing 6, 7, 13, 15, 16, 22
F
H hardware shading 11, 40 hide 24, 35, 42, 44 highlights 12 history, see construction history hotkeys 11, 18, 32 customizing 32 maximum displacement 33 opacity 33 upper brush radius 32
I input devices mouse 12 stylus 5, 12, 15, 16 tablet 5, 12, 15 intersecting strokes 14
L launching Artisan 10 launching Maya 10 layers 14 Learning Maya tutorials 7
C clusters 26 animating 27 cluster weights 26 color feedback 26 paint weights tool 26 rotating 26 smoothing weights 28 stamp profile 26 color 13 cluster weights 26 color feedback 26 use set color 26 value 26 common edge detection 38 construction history 35, 40 control vertices (CVs) 20 goal weights 44 masking 21
48 Learning Maya
facial poses 19, 23 file management 10 opening files 10 saving files 10 flood 6, 16, 44, 46 flood erase 14, 15, 22 fractal maps 41 freeze transformations 35
G geometry 34, 37 geometry paint script 37 Geometry Paint Settings 36, 37 goal weights 4, 42, 44, 45, 46 gravity 43 groups 32
M maps 42 marking menu 16 masking 4, 22 CVs 21 maximum displacement 5, 7, 32 Maya Embedded Language (MEL) 4, 34, 38, 46 Maya F/X module 7, 39 MEL, see Maya Embedded Language modeling 32 move 22, 35 Multilister 41
N
R
naming surfaces 23 non-uniform rational b-splines (NURBS) 4, 35, 40 NURBS, see non-uniform rational b-splines
randomizing 43 reference surfaces 7, 14, 15 reflect paint 6, 31, 33, 36 reflection 17 rendering 12 rotate 26
O S opacity 5, 32 operations 6, 19 erase 6, 13, 15, 22 pull 5, 6, 13, 14, 34, 42 push 5, 13, 33 replace 36 smooth 6, 13, 46 overlap 14
P paint select CVs tool 4, 20 paint weights tool 4, 26 painting 11, 12, 18 brushes 11 geometry 34, 36, 37 goal weights 45 masking 21 paint 12, 16 reflection 6, 17 sculpting 12 symmetry 17 particles, see dynamics playback 26, 44 Playblast 28 Plug-in Manager 35 poses 23 set pose 24 target poses 24 previews 28 primitives 40 cones 35 projects set project 10 pulling 13, 14, 16, 18 pushing 18
saving files 17 scaling 35, 40 scenes 10 script paint tool 4, 36, 38, 44, 46 scripts, see Maya Embedded Language (MEL) sculpt surfaces tool 4, 42 sculpt variables reference vectors 17 sculpting 11, 13 across seams 34 facial details 15 painting 12 surface complexity 41 seams 31, 34 selection 20, 22 component mode 40 export attribute map 21 import attribute map 21, 23 selection maps 21 selection handles 32 selection masks 21, 22 set key 24 set pose 24 shading groups 12 attributes 12 materials 12 specular shading 13 shapes base shapes 24 target shapes 24 smooth 19 smoothing 13, 16, 19 soft body dynamics 4, 42 spans 41 springs 43 stamp profile 38, 44
opacity 14, 16, 46 radius 5, 13, 14, 16, 18, 22 shape 16 upper brush radius 45 surfaces animating 26 complexity 41 displacement 5 duplicating 19 Erase surface 19 highlights 12 kinking 28 moving 19 naming 23 neutral surfaces 24 operations 13 pushing 12 rebuild surfaces 41 reference surfaces 7, 14, 15 reflection 17 sculpting 13 seams 34 show active lines 36, 44 smoothing 4, 16, 28 smoothness 10 tapering 40 updating 7, 15 symmetry 6, 17
T testing results 28 textures convert solid texture 41 file textures 41, 42 fractal maps 41 procedural textures 41 Tool Settings window 5, 11 Display 12 global selection 20 Map 21 reset tool 20 Sculpt 13, 16 tracking views 11 tumbling views 11, 27 turbulence 43
Learning Maya 49
Index
U undo 6, 16, 22 user interface 5
V views changing views 11, 27
W weights 7 smoothing 28 wind 43 windows maximizing 37 minimizing 36
50 Learning Maya
Character Animation
Contents Character Animation 10 Understanding Character Animation Modeling the character
168
Building, posing, and animating the skeleton Skinning the skeleton Using flexors
181
Workflow summary
183
184
11 Building Skeletons Understanding skeletons
187 188
188
Joint chains Limbs
170
178
Animating the character
Joints
167
189
190
IK handles and IK solvers
191
Using Maya: Animation
3
Contents Creating a joint chain or limb
192
Viewing a skeleton’s hierarchy Resizing joint display Positioning joints Inserting joints Removing joints
195
195
196 197 198
Mirroring limbs or skeletons Connecting skeletons
199
202
Disconnecting a joint to make two skeletons Rerooting the skeleton
204
205
Setting joint creation options
206
Viewing joint creation options Setting degrees of freedom
207 208
Setting automatic joint orientation
208
Setting scale compensation
210
Setting automatic joint limits
210
Setting automatic creation of IK handles Setting IK handle options automatically Editing joint attributes
216
Editing a joint’s preferred angle
217
217
Editing joint orientation
219
Editing scale compensation Editing joint limits
212
214
Editing degrees of freedom Editing stiffness
220
220
Dampening rotation near joint limits
4
Using Maya: Animation
211
211
Viewing editable joint attributes Renaming a joint
211
223
Contents
12 Posing and Animating Skeletons Understanding posing and animating skeletons Forward kinematics
225 226
226
Posing and animating with forward kinematics Inverse kinematics (IK)
228
229
Posing and animating with inverse kinematics (IK) IK handles and IK chains IK solvers
230
230
231
Single chain (SC) solver
231
Rotate plane (RP) solver
233
Spline solver
237
Multi-chain (MC) solver Creating IK handles
237
238
Adding an IK handle
238
Creating an IK chain
239
Displaying IK handle’s end effector
240
Displaying IK handle’s goal and goal’s axis
240
Displaying IK handle’s twist disc and pole vector’s axis Setting IK handle creation options
241
Viewing IK handle creation options Setting the current solver
Setting sticky
243
243
Setting solver enable Setting snap enable
241
242
Activating the multi-chain (MC) solver Setting autopriority
240
244 244
244
Setting priority
245
Setting weight
245
Setting position vs. orientation (PO) weight Editing IK handle attributes
246
246
Viewing editable IK handle attributes
247 Using Maya: Animation
5
Contents Renaming an IK handle
249
Editing transform attributes Editing skeleton info
249
250
Editing IK handle attributes
250
Editing IK solver attributes and choosing an IK solver Editing pivots
251
Editing limit information Editing display
252
252
Editing node behavior Editing IK solvers
253
253
Editing IK solver attributes Editing node behavior Using IK systems
253
254
254
Creating an IK system
254
Accessing an IK system
255
Renaming an IK system
255
Viewing an IK system’s IK solvers
255
Editing global snap and global solve Editing node behavior Posing IK chains
255
256
256
Posing with single chain (SC) solver IK handles
256
Positioning with rotate plane (RP) solver IK handles Twisting with rotate plane (RP) solver IK handles
257 257
Eliminating flip in rotate plane (RP) solver IK handles Sticky posing
257
258
Using IK spline handles
259
Creating IK spline handles Animating the joint chain
259 261
Setting options before creating the IK spline handle
265
Setting attributes after creating the IK spline handle
271
Preventing unwanted start joint flipping
6
251
Using Maya: Animation
272
Contents Working with soft body curves
274
Tips for working with IK spline handles Working with human skeletons
276
Working with animal skeletons
277
274
Working with sinuous motion on skeletons Animating IK chains Keyframing
280
280
Motion capture
281
13 Skinning Skeletons Understanding skinning
283
284
Closest point skinning
284
Partition set skinning
285
Skin point set colors
285
Bind pose
278
285
Skin detachment and reattachment Binding by closest point Binding by partition set
285 287
Binding multiple objects as skin Returning to bind pose
288
289
Displaying skin point set colors Editing skin point sets
285
290
290
Detaching and reattaching skin
290
Detaching skin without preserving skin groups and percentages Detaching skin while preserving skin groups and percentages Reattaching skin while preserving skin groups and percentages
291 292 292
Using Maya: Animation
7
Contents Animating with skin and skeleton groups
14 Using Flexors
292
295
Understanding flexors
296
Lattice flexors
296
Sculpt flexors
298
Cluster flexors
299
Creating lattice flexors
301
Positioning lattice flexors after creation Editing joint lattice flexor attributes
302
Viewing joint lattice flexor attributes Renaming joint lattice flexors Editing creasing
303
Editing rounding
305
Editing length in
306
Editing length out Editing width left
303
303
308 310
Editing width right
311
Editing bone lattice flexor attributes
313
Viewing bone lattice flexor attributes Renaming bone lattice flexors Editing length in
314
Editing length out Editing width left
316 318
Editing width right
8
Editing bicep
321
Editing tricep
322
Using Maya: Animation
302
319
314
313
Contents Creating sculpt flexors
324
Editing sculpt flexor attributes Joint-driven sculpting Creating cluster flexors
325
325 326
Editing cluster flexor attributes
328
Editing with cluster flexor manipulators
328
Using Maya: Animation
9
Contents
10
Using Maya: Animation
10
Understanding Character Animation
This chapter presents an overview of animating an articulated, hierarchical 3D character in Maya. Animating a character includes the following: •
“Modeling the character” on page 168
•
“Building, posing, and animating the skeleton” on page 170
•
“Skinning the skeleton” on page 178
•
“Using flexors” on page 181
•
“Animating the character” on page 183 This chapter concludes with a summary of Maya’s workflow for skeletal character animation: “Workflow summary” on page 184.
Using Maya: Animation
167
Character Animation
As a character animator using Maya, you can create the illusion of life. You can animate virtually any character imaginable, no matter how realistic, abstract, or surreal. The essence of character animation is timing and motion. Maya offers the most sophisticated tools available for defining the timing and motion of characters. Using Maya: Animation, Character Animation, describes how to use Maya’s skeleton-based shape deformation tools to animate articulated, hierarchical 3D characters with forward or inverse kinematics techniques.
Understanding Character Animation Modeling the character
Modeling the character Modeling is the process of creating a geometry for the character. Modeling is the first step in animating a character.
For best results, create the geometry with limbs outstretched. This will make building a skeleton much easier. A geometry can be a non-uniform rational B-spline (NURBS) geometry or a polygonal geometry. A geometry defines the shape of the character’s surface.
168
Using Maya: Animation
Understanding Character Animation Modeling the character
Character Animation
To create a geometry for a character, use the modeling tools in Maya’s Model menu. When you create the geometry, you should also define how the character will look when rendered. For rendering, use the tools in Maya’s Render menu. Note that you can also use Maya’s particle system to define the character’s features. To use the particle system, use the tools in Maya’s Dynamics menu.
Note To use the animation tools this document describes, be sure you have Maya’s Animation menu selected. The next step in animating a character is to create a skeleton so you can control a character’s actions. First you build a skeleton for the character’s geometry, and then you bind the geometry to the skeleton. This lets you control the geometry’s shape and actions.
Using Maya: Animation
169
Understanding Character Animation Building, posing, and animating the skeleton
Building, posing, and animating the skeleton A skeleton is a structure for animating a character’s articulated, hierarchical actions.
The skeleton you build for a character need not exactly resemble what the character’s skeleton would be like in real life. You might create a skeleton for a character that would lack one in real life. Depending on the effect you want to create, you might even have the skeleton influence the geometry from a location outside of the geometry. A skeleton consists of joints connected by the bones of the joints. Additionally, a skeleton can consist of special tools called inverse kinematics (IK) handles. IK handles enable you to pose the character easily, and they facilitate animation. You could begin building a skeleton for a human character by creating some legs.
170
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Character Animation
In this example, each leg consists of a simple series of joints connected by bones. For clarity, these legs are shown without a geometry in the scene. When you create a skeleton, you should have the geometry in your current scene so you can be sure the skeleton fits the model properly. When we think of a real skeleton, we tend to think first of the bones and then of the joints that enable movement. When it comes to animating movement, however, we must first focus on the joints and their hierarchical relationships. In Maya, the joints of a skeleton always exist in a hierarchy that defines how they can move in relation to each other. Any two connected joints have a hierarchical relationship for defining articulated actions. This relationship is indicated by the bone that connects the two joints.
Using Maya: Animation
171
Understanding Character Animation Building, posing, and animating the skeleton
Joint Bone Joint
Note that the bone has a wedge shape. The joint at the thicker end of the wedge is higher in the hierarchy than the joint at the thinner end. Whenever the joint at the thicker end rotates, the bone and the joint at the thinner end will have to move in an arc. But when the joint at the thinner end rotates, the joint at the thicker end will not have to move. This is just like how a real skeleton moves. The joint at the thicker end is called the parent joint in relation to the joint at the thinner end, which is called the child joint. We can think of the parent joint as being “above” the child joint and the child “below” the parent.
Parent joint
Child joint
Parent joint’s bone
As far as hierarchical movement is concerned, the bone that connects the two joints is really part of the parent joint. A bone belongs to a parent joint, which completely controls the bone’s movements. Note that a joint can have more than one bone, each bone connecting the parent joint to a different child joint.
172
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Parent joint of joint chain
You can create very elaborate skeletons consisting of multiple joint chains organized into a complex hierarchy. A limb consists of one or more joint chains that branch off from one another in a tree-like structure.
Using Maya: Animation
173
Character Animation
Any simple series of joints connected together by bones is called a joint chain. The highest joint in the joint chain’s action hierarchy is called the parent joint of the joint chain. The action of a joint chain’s parent joint affects everything below it in the chain.
Understanding Character Animation Building, posing, and animating the skeleton
The highest joint in a skeleton’s hierarchy is called the root joint; when the root joint moves or rotates, everything must move or rotate with it. The order in which you create joints and their bones defines their action hierarchy for rotation and movement. In the leg, the hip joint is the highest joint in the action hierarchy. The hip joint was created first, then the knee joint, and so on.
174
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Character Animation
You can limit how joints rotate so that you can easily put the character in realistic poses. For example, you can limit how a knee joint can rotate so it can’t bend from side to side but only forward and back.
Using Maya: Animation
175
Understanding Character Animation Building, posing, and animating the skeleton Setting and editing the characteristics of the knee joints will make the animation of a walk cycle much easier. You can set each joint’s characteristics as you create a skeleton and later tweak them as you pose and animate the character. Chapter 11, “Building Skeletons”describes creating and editing joints and bones. After you’ve created all the joints and bones that make up a skeleton for your character, you’ll want to move the skeleton around and put it in various poses. In Maya, there are two basic ways to pose a joint chain: forward kinematics and inverse kinematics. With forward kinematics, when you pose a joint chain you have to specify the rotations of each joint individually, starting from the parent joint on down to all the joints below. This approach is excellent for creating detailed arc motions. With inverse kinematics, when you pose a joint chain all you have to do is tell the lowest joint in the joint chain’s hierarchy where you want it to be, and all the joints above it will rotate automatically. Inverse kinematics offers a very intuitive way to pose a joint chain because it enables goal-directed posing. When you reach for an object, you don’t think about how you are going to rotate your shoulder, your elbow, and so on. You just think about where the object is that you want to reach, and your body automatically does the rest. That’s how inverse kinematics works, too. To pose a joint chain with inverse kinematics, you need to add some special tools to a skeleton. These tools are called inverse kinematics (IK) handles. An IK handle enables you to pose a joint chain intuitively. An IK handle begins at a joint chain’s parent joint and can end at any joint below the parent joint. For example, for each leg you could create an IK handle that controls the joint chain beginning at the hip joint and ending at the ankle joint.
176
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Character Animation You can select the IK handle where it ends at the ankle joint and move the chain with it in the same way that you would think about moving your own ankle. In addition to posing a skeleton, IK handles also play an important role in the animation of the skeleton. The movement of a chain between the keyframes of an animation is also automatically solved by the chain’s IK handles. IK handles figure out how to rotate and move all the joints in the chain for you by using an inverse kinematics (IK) solver. An IK solver is the motor intelligence behind an IK handle. Maya offers several different types of IK solvers for different types of movement effects. For further control, you can also specify the characteristics of the IK solvers themselves. You’ll want to create IK handles for all of a skeleton’s joint chains that you want to pose. Chapter 12, “Posing and Animating Skeletons” describes how to use IK handles and IK solvers. You can pose and animate a skeleton, but such an animation would show only the timing and motion of a character lacking form and shape. The next step is to bind the character’s model to the character’s skeleton so that the skeleton can control the model’s actions.
Using Maya: Animation
177
Understanding Character Animation Skinning the skeleton
Skinning the skeleton After you’ve created the character’s geometry and the character’s skeleton, the next step is to bind the two together. When a geometry is bound to a skeleton, the geometry can be referred to as the skeleton’s skin. When you pose the skeleton, the skin moves with the skeleton automatically.
The process of binding a geometry to a skeleton is called skinning. NURBS geometries are shaped by points called control vertices (CVs), and polygonal geometries are shaped by points called vertices. In both cases, Maya can control shape by means of points. After a geometry has been bound to a skeleton, these points are called skin points. To bind a geometry to a skeleton, Maya first divides the geometry’s points into sets according to each point’s proximity to a joint. The newly formed skin point sets are identified by various colors. (Note that some expert users call skin point sets partitions because any given point can be in only one set.) Next, Maya binds each skin point set to the nearest joint so the skin points in each skin point set will move with the nearest joint.
178
Using Maya: Animation
Understanding Character Animation Skinning the skeleton
Character Animation Note that because skin points are bound to joints by means of deformation tools called joint clusters, expert users sometimes call skin points joint cluster points. Once the skin is bound to the skeleton, exercise the character by putting it into various poses. It’s important to do this because you need to observe how the skin acts in response to the skeleton’s actions. Depending on the pose of the geometry and skeleton during binding, a few of the skin points could join an inappropriate skin point set.
Using Maya: Animation
179
Understanding Character Animation Skinning the skeleton
If so, you can easily move those skin points from one skin point set to another.
Chapter 13, “Skinning Skeletons”describes skinning in more detail.
180
Using Maya: Animation
Understanding Character Animation Using flexors
Using flexors You can animate skin deformation effects by using special deformation tools called flexors. Flexors are high-level deformeration tools for use with skins and skeletons. The effects of flexors can be driven by how you pose and animate a skeleton. Maya offers three types of flexors: lattice flexors, sculpt flexors, and cluster flexors. A lattice flexor influences skin around joints or the bones of joints. It can smooth or wrinkle skin around joints, and provide muscle definition around bones.
A cluster flexor controls the points in a skin point set around a joint with varying percentages of influence. It can provide very realistic smoothing effects. Let’s look at a lattice flexor attached to a joint. With a lattice flexor, a joint can directly influence skin points, changing the shape of the character’s skin. You can create a lattice flexor that will deform skin when the joint it is attached to rotates. For example, you can create a flexor that wrinkles the skin around an elbow as you bend a character’s arm.
Using Maya: Animation
181
Character Animation
A sculpt flexor provides anatomically based deformations such as muscle bulges, knee caps, and elbow caps. A sculpt flexor can influence skin around joints or the bones of joints.
Understanding Character Animation Using flexors
Similarly, a lattice flexor attached to a bone can influence the skin around a bone. You can use lattice flexors attached to bones for animating muscle definition.
182
Using Maya: Animation
Understanding Character Animation Animating the character Chapter 14, “Using Flexors” describes using flexors for skin deformation in more detail. Using Maya: Animation, Basic Deformers provides further information on Maya’s free form deformation tools. Unlike flexors, these deformation tools need not work in conjunction with a skeleton. These tools include sculpt deformers, wire deformers, lattice deformers, cluster deformers, and blend shape deformers. Blend shape deformers, for example, are excellent tools for facial animation. The time you put into building a skeleton, binding the geometry, and creating flexors is time well spent. The effort you put into these steps will pay off when you animate the character. Character Animation
Animating the character The more carefully you design and construct the character, the easier animating the character will be. You can animate the character by keyframing or by using motion capture data. For general information on keyframing animations in Maya, refer to Using Maya: Animation,Keyframe. For information on motion capture, see Using Maya, Animation,Motion Capture. In keyframing, you pose a character in key postures and set these postures as keys. Maya then interpolates the actions between the keys for you, playing the animation. For example, here is a frame from a walk cycle.
Using Maya: Animation
183
Understanding Character Animation Workflow summary
When Maya interpolates the actions between keyframes, it uses the IK handles, the IK solvers, the lattice flexors, sculpt flexors, cluster flexors, and all the other attributes of the character that you have defined to produce the animation. Chapter 12, “Posing and Animating Skeletons” describes how to pose and animate skeletons; note that the information there also applies to skeletons with skins. Chapter 13, “Skinning Skeletons” explains how to bind geometries to skeletons for posing and animating characters. Finally, Chapter 14, “Using Flexors” describes posing and animating skin deformations with flexors.
Workflow summary Animating an articulated, hierarchical 3D character in Maya involves using Maya’s skeletal deformation tools: skeletons and flexors. After you create a geometry for the character with Maya’s modeling tools, you can build a skeleton for the geometry and then bind the geometry to the skeleton. This binding process is called skinning. Skinning the geometry to the skeleton binds the model’s shape to the skeleton’s movement. The geometry has become the skeleton’s skin, and the skin’s shape will deform as appropriate when you pose and animate the skeleton. Skeletons can be posed and animated with Maya’s forward or inverse kinematics tools. Special inverse kinematics tools include IK handles and IK solvers.
184
Using Maya: Animation
Understanding Character Animation Workflow summary In addition to using a skeleton to create skin deformation effects, you can also use special deformation tools called flexors. Flexors provide a way for you to pose and animate skin deformation effects that complement the deformations being provided by the skeleton alone. Flexors are skin shape deformation tools whose effects can be driven by the actions of a skeleton. For example, the rotation of a joint can drive the bulging of some skin, indicating muscle. The next chapters cover the following topics: Chapter 11, “Building Skeletons”
•
Chapter 12, “Posing and Animating Skeletons”
•
Chapter 13, “Skinning Skeletons”
•
Chapter 14, “Using Flexors”
Character Animation
•
Using Maya: Animation
185
Understanding Character Animation Workflow summary
186
Using Maya: Animation
11
Building Skeletons After you’ve created a geometry for your character, the next step is to build a skeleton for the geometry. In general, you’ll want to have the geometry in the scene as you create the skeleton so can be sure the skeleton fits the geometry. You could create a character’s skeleton before you create the geometry, but you may have to scale the geometry and adjust the skeleton before you bind them together. Character Animation
This chapter describes how to build skeletons. Building skeletons includes the following: •
“Understanding skeletons” on page 188
•
“Creating a joint chain or limb” on page 192
•
“Resizing joint display” on page 195
•
“Positioning joints” on page 196
•
“Inserting joints” on page 197
•
“Removing joints” on page 198
Using Maya: Animation
187
Building Skeletons Understanding skeletons •
“Mirroring limbs or skeletons” on page 199
•
“Connecting skeletons” on page 202
•
“Disconnecting a joint to make two skeletons” on page 204
•
“Rerooting the skeleton” on page 205
•
“Setting joint creation options” on page 206
•
“Editing joint attributes” on page 211 Note that adding inverse kinematics (IK) handles and using IK solvers are important when animating a skeleton. For information about IK handle and IK solvers, see Chapter 12, “Posing and Animating Skeletons.”
Note To use the tools for building skeletons, be sure you have Maya’s Animation menu selected.
Understanding skeletons Skeletons are hierarchical, articulated structures for animating geometries. Skeletons provide a basis for animating hierarchical actions in much the same way that a human skeleton determines how the human body can move. When you build a skeleton, the grid can be quite useful for judging the size and shape of the skeleton. You can position and rescale the grid to suit your work. Also, use multiple camera views when building a skeleton to make sure that your skeleton fits the model appropriately in all three dimensions.
Joints Joints are the building blocks of skeletons. Each joint can have one or more bones attached to it. The action of a bone attached to a joint is controlled by the joint’s rotation and movement. Various joint attributes specify how the joint can act. For example, you can specify limitations on how far a joint can rotate. A root joint is the highest joint in a skeleton’s hierarchy. A skeleton can have only one root joint.
188
Using Maya: Animation
Building Skeletons Understanding skeletons A parent joint is any joint higher in a skeleton’s action hierarchy than any of the other joints that are influenced by that joint’s action. Joints below a given parent joint in the action hierarchy are called child joints.
Root joint (selected)
Character Animation
Parent joint of joint “A” Joint “A” Bone of joint “A” Child joint of joint “A”
Sample skeleton
Joint chains A joint chain is any group of joints and their bones connected in a series. The joints are connected linearly; you could draw a line through a joint chain’s series of joints and their bones without having to retrace your path. A given joint chain begins at the highest joint in the joint chain’s action hierarchy. This joint is the joint chain’s parent joint.
Using Maya: Animation
189
Building Skeletons Understanding skeletons
Joint chain Joint chain
Joint chain Joint chain
Joint chains
Limbs A limb is any group of one or more connected joint chains. The chains may branch off from one another, forming a tree-like structure. Unlike a joint chain, a limb’s joints may not be connected linearly; you may not be able to draw a line through all of a limb’s joints and their bones without doubling back. A given limb begins at the highest joint in the limb’s action hierarchy. This joint is the limb’s parent joint. When you begin building a skeleton that will have many symmetrical limbs, start in the center of the workspace near the scene’s world origin. Starting near the center will make it easier for you to create skeletons with many symmetrical parts.
190
Using Maya: Animation
Building Skeletons Understanding skeletons
Limb Limb
Character Animation
Limbs
IK handles and IK solvers IK handles are special tools for posing and animating joint chains. On any given chain, the joint where the IK handle begins is called the start joint and the joint the where IK handle ends is called the end joint. Note that experienced users sometimes refer to joint chains that have IK handles as IK chains. IK solvers provide the motor intelligence of IK handles. IK handles and IK solvers are described in Chapter 12, “Posing and Animating Skeletons.” When you create joint chains and limbs for your character, think about how you are going to use IK handles to pose the joint chains. Joint chains that consist of four or fewer joints are much easier to pose with IK handles than those that have many more joints.
Using Maya: Animation
191
Building Skeletons Creating a joint chain or limb Expert users have found that if a skeleton lies entirely in one plane before you bind the geometry to the skeleton, posing the character with IK handles can be somewhat awkward in extreme cases. Having some of the joints rotated slightly at various appropriate angles will make the character easier to pose later on.
Creating a joint chain or limb You begin building a skeleton by creating a joint chain, which is a series of joints and their bones. You can then add to the joint chain by continuing that joint chain or by creating new joint chains starting from any of the joint chain’s joints. In this way you can create a complex structure of various joint chains and limbs. These joint chains and limbs define a skeleton’s action hierarchy. Finally, you can view an outline of a skeleton’s hierarchy. This outline view is useful for getting a clear picture of how your skeleton is structured, and for selecting various parts of the skeleton.
To create a joint chain: 1
Select Skeletons→Joint Tool.
2
Click in the workspace at the position of the first joint. The joint is created. You can set a joint’s attributes while you create the joint or anytime after you have created it. To set a joint’s attributes while you create it, see “Setting joint creation options” on page 206. To modify a joint’s attributes after you have created it, see “Editing joint attributes” on page 211.
3
Move the pointer to where you want the second joint, and then click. The two joints are connected with a bone that indicates the direction of the joint chain’s hierarchy: the thinner end of the bone’s triangle points to the child joint.
4
Move the pointer to where you want the next joint, and then click. Continue moving the pointer and clicking until you’re done creating the joint chain you want.
5
To indicate you’ve finished creating the joint chain, press the Enter key or select another tool. If you want to change the positions of the joints, see “Positioning joints” on page 196.
192
Using Maya: Animation
Building Skeletons Creating a joint chain or limb
Character Animation
Creating a joint chain
To add to a joint chain: 1
Select Skeletons→Joint Tool.
2
Click on a joint in the joint chain. To continue a joint chain, click on the last joint in the joint chain. (The last joint is the lowest joint in the joint chain’s hierarchy.) To create a new joint chain that branches out from an existing chain, click on any joint other than the last joint in an existing chain. A group of one or more connected joint chains is called a limb.
3
Click where you want to create a new joint.
4
When you finish creating all the joints in the joint chain, press the Enter key or select another tool.
Using Maya: Animation
193
Building Skeletons Creating a joint chain or limb
Continuing a joint chain
1. Click here to continue the joint chain
2. Click to create more joints
or Creating a new joint chain from an existing joint chain
1. Click here to continue the joint chain
Adding to a joint chain
194
Using Maya: Animation
2. Click to create more joints
Building Skeletons Viewing a skeleton’s hierarchy You can rapidly build a skeleton for animating a character by continuing joint chains and creating new joint chains that branch out from existing joint chains.
Viewing a skeleton’s hierarchy To view an outline of a skeleton’s hierarchy Select Window→Outliner to view an outline of a skeleton’s hierarchy. Use the Outliner to see the structure of the skeleton, to select parts of the skeleton, and to see the names of the parts of the skeleton.
You can resize the display of a skeleton’s joints. Increasing the display size can make the joints and their bones easier to pick. Decreasing the display size can make other objects such as flexors easier to pick. Here is a skeleton displayed at normal size:
Skeleton at normal size Here is the same skeleton displayed at 25% of normal size: Using Maya: Animation
195
Character Animation
Resizing joint display
Building Skeletons Positioning joints
Skeleton at 25% normal size
To resize joint display: 1
Select Display→Joint Size.
2
Move the pointer to the arrow at the end of the Joint Size line.
3
Choose from the percentages listed to resize the joints, or choose Custom to set your own percentage. Percentages are relative to the default setting, which is always 100% or 1.00.
Positioning joints While you are creating a joint chain, you can edit the positioning of any joint without affecting the joints below it in the joint chain’s action hierarchy.
Note To edit the position of a joint after the skeleton is created and accepted, toggle on (the Select by Component Type icon) and (the Pivot icon), then use the right mouse button on the Pivot button to turn on Joint Pivots in the Pivot pick mask.
196
Using Maya: Animation
Building Skeletons Inserting joints
To position a joint as you create it: 1
Hold down the left mouse button to create a joint and drag it to a new position.
2
Release the mouse button when you’ve positioned the joint at the desired location.
To position the most recently created joint while creating the joint chain: While in create mode, you can use the middle mouse button to modify the most recent joint (the one currently selected). Character Animation
The transform manipulator appears and you can move the joint in any direction.
To position any joint in the hierarchy while creating a joint chain: 1
Press Insert on the keyboard. The transform manipulator appears at the end joint.
2
Move any joint in the skeleton by selecting and dragging it with the left mouse button.
3
Press Insert to toggle back to creating more joints for the skeleton. This will return you to the last created joint in the chain.
Inserting joints You can insert a joint anywhere in a skeleton’s action hierarchy below the root joint.
To insert a joint in a created skeleton: 1
Select Skeletons→Insert Joint Tool.
2
To position the new joint, use the left mouse button to drag from the joint you want as the new joint’s parent.Until you press Enter or select another tool, you can insert more joints.
3
When you have finished inserting joints, press Enter or select another tool.
Using Maya: Animation
197
Building Skeletons Removing joints
1. Click to add a joint below this one 2. Drag to position the new joint
Inserting a joint
Removing joints You can remove any joint from a skeleton except the root joint. The root joint is the highest joint in a skeleton’s action hierarchy, and deleting the root joint would delete the entire skeleton.
To remove a joint: 1
Select the joint you want to remove. Note that you can only remove one joint at a time.
2
Select Skeletons→Remove Joint. The joint is removed. The bone of the joint above the removed joint is extended to the joint below the removed joint.
198
Using Maya: Animation
Building Skeletons Mirroring limbs or skeletons
Click to delete the joint
Bone is resized
Character Animation
Removing a joint
Mirroring limbs or skeletons A group of one or more connected joint chains is called a limb. You can duplicate or make mirror copies of limbs. A mirror copy is a copy that is symmetrical about a selected plane; in effect, the reflection of the original in the plane is turned into a real copy of the original, but with all the aspects of the limb mirrored accordingly. The origin of the plane is at the parent joint of the limb. Joint attributes and IK handles are mirrored as well as the joints and their bones. Mirroring is extremely useful when you are creating the limbs for a character. For example, you can build a right arm and hand, and then create a mirrored copy of it for the left arm and hand. Mirroring affects all aspects of the creation of the left arm, including the joint limits. You don’t have to reset the joint limits so that the left arm’s joint limits will be symmetrical to the right arm’s joint limits; Maya will do it for you. You can also make a mirror copy of an entire skeleton. The procedure is the same as for creating mirror copies of limbs, except that the skeleton will be mirrored about the scene’s world origin.
Using Maya: Animation
199
Building Skeletons Mirroring limbs or skeletons
1. Click here to mirror this limb
2. A mirror copy of the limb is created
Mirroring a limb
200
Using Maya: Animation
Building Skeletons Mirroring limbs or skeletons
Click the root to mirror the whole skeleton
Skeleton is mirrored about the world origin
Character Animation
Mirroring a skeleton
To mirror a limb or skeleton: 1
Select the parent joint of the limb you want to duplicate, or select the root joint if you want to mirror an entire skeleton.
2
To choose the plane for mirroring, first select Skeletons→Mirror Joint-❐ to open the Mirror Joint Options window. Next, click the desired Mirror Across option to choose the plane in which you want the joint chain mirrored. The default is XY. If you are mirroring a limb, this indicates the XY plane whose origin is at the limb’s parent joint. If you are mirroring a skeleton, this indicates the XY plane whose origin is the scene’s world origin.
3
Click Mirror in the Mirror Joint Options window, or select Skeletons→Mirror Joint. If you are mirroring a limb, the limb is mirrored across the selected plane whose origin is at the limb’s parent joint. If you are mirroring a skeleton, the skeleton is mirrored across the selected plane whose origin is the scene’s world origin.
Using Maya: Animation
201
Building Skeletons Connecting skeletons
Connecting skeletons You can connect two skeletons in two ways: by combining joints and by connecting joints with a bone. First, you can connect two skeletons by combining the root joint of one skeleton with any joint of another skeleton except that skeleton’s root joint. The skeleton that becomes a limb of the other skeleton will change its position in the scene so that it is directly connected to the other skeleton’s joint. Second, you can connect the root joint of one skeleton to any joint of another skeleton by extending a bone to the root joint from the joint of the other skeleton. The skeleton that becomes a limb of the other skeleton will not have to move.
To connect skeletons by combining joints: 1
Select the root joint of the skeleton you want to be a limb of another skeleton.
2
On the other skeleton, select any joint other than the skeleton’s root joint.
3
Select Skeletons→Connect Joint-❐. The Connect Joint Options window is displayed.
4
In the Connect Joint Options window, turn on the Connect Joint mode. The skeleton that will become the limb moves so that its root is in the same place as the selected joint of the other skeleton.
5
In the Connect Joint Options window, click Connect. (Alternatively, select Skeletons→Connect Joint.) The two skeletons are connected.
202
Using Maya: Animation
Building Skeletons Connecting skeletons
Two joints are combined
Character Animation
Connecting skeletons by combining joints
To connect skeletons by connecting joints with a bone: 1
Click the root of the skeleton you want to be a limb of another skeleton.
2
On the other skeleton, select any joint other than the skeleton’s root joint. You can connect only to a non-root joint of the parent skeleton.
3
Select Skeletons→Connect Joint-❐. The Connect Joint Options window is displayed.
4
In the Connect Joint Options window, turn on the Parent Joint mode. Parent Joint mode connects the skeletons by creating a new bone between the selected root joint and the joint you’re connecting it to. The two skeletons do not move.
5
In the Connect Joint Options window, click Connect. (Alternatively, select Skeletons→Connect Joint.) Maya connects the skeletons with a bone. Note that connecting skeletons using Parent Joint mode is identical to the result you get by selecting Edit→Parent.
Using Maya: Animation
203
Building Skeletons Disconnecting a joint to make two skeletons
Bone created to connect the two skeletons
Connecting two skeletons by connecting joints with a bone
Disconnecting a joint to make two skeletons You can break up a skeleton into two skeletons by disconnecting any joint other than the root joint. The disconnected joint will become the root joint of the new skeleton. Note that if you disconnect a joint in a joint chain that has an IK handle, that IK handle will be deleted. For information about IK handles, see Chapter 12, “Posing and Animating Skeletons.”
204
Using Maya: Animation
Building Skeletons Rerooting the skeleton
Select joint you want to disconnect
Character Animation
Disconnecting a joint
To disconnect a joint to make two skeletons: 1
Select the joint you want to disconnect. This joint will become the root joint of the new skeleton.
2
Select Skeletons→Disconnect Joint. The joint is disconnected. The disconnected joint is now the root joint of the new skeleton.
Rerooting the skeleton You can change the hierarchical organization of a skeleton by changing which joint is the root joint. This process is called rerooting. Note that any IK handles that pass through the joint selected to be the new root joint will be deleted. Also, any animation of the skeleton’s root joint will be affected when you reroot.
Using Maya: Animation
205
Building Skeletons Setting joint creation options
Current root joint
Click to create new root joint
Rerooting a skeleton
To reroot a skeleton: 1
Click the joint where you want the new root. If you select the child of the entire joint chain, the hierarchy will reverse. If you select a joint in the middle of the skeleton to become the new root, you will have two child joints with separate hierarchies below the root joint.
2
Select Skeletons→Reroot Skeleton.
Setting joint creation options A joint’s various options and attributes define how a joint can be posed and animated. Specifying these is an important part of building a skeleton. You can set joint creation options before you create individual joints, or you can edit a joint’s attributes at any time after you have created it. This section describes how to set joint attributes automatically by setting the Joint Tool’s Tool Settings. To find out how to edit joint attributes, see “Editing joint attributes” on page 211. Setting joint attributes during joint creation includes:
206
Using Maya: Animation
Building Skeletons Setting joint creation options •
Viewing joint creation options
•
Setting degrees of freedom
•
Setting automatic joint orientation
•
Setting scale compensation
•
Setting automatic joint limits
•
Setting automatic creation of IK handles
•
Setting IK handle options automatically
Viewing joint creation options
Tool Settings window
To view joint creation options: Select Skeletons→Joint Tool-❐. The Joint Tool’s Tool Settings window is displayed. Using Maya: Animation
207
Character Animation
When you create a joint, you use the Joint Tool. You can set the Joint Tool’s options so that certain joint options and attributes will be set automatically. The Joint Tool’s options are displayed in the Joint Tool’s Tool Settings window.
Building Skeletons Setting joint creation options
Setting degrees of freedom Each joint has a local axis whose origin is at the center of the joint. The X-axis of the local axis is red, the Y-axis is green, and the Z-axis is blue. How a joint can rotate is defined in terms of this local axis. A joint’s degrees of freedom specifies which of its local axes it can rotate about during IK posing and animation.During IK, a joint is rotated by an IK handle, and how the IK handle performs depends on the type of IK solver the IK handle is using. A joint can have at most three degrees of freedom: the freedom to rotate about its X-axis, Y-axis, and Z-axis during IK. Expert users often call a joint with three degrees of freedom a ball joint because it can rotate about all three of its axes like a ball. Note that two types of IK solvers, the single chain solver and the plane solver, require that their start joints be ball joints that have no limitations on the extent they can rotate about each axis. You can limit a joint so that it has only two degrees of freedom or only one degree of freedom. A joint with two degrees of freedom can only rotate about any two of its local axes during IK. A human wrist would be a good example of a joint with two degrees of freedom, though the joint has limitations on the extent it can rotate about its axes. A joint with only one degree of freedom can rotate only about its local X-axis, or Y-axis, or Z-axis during IK. Expert users often call a joint with only one degree of freedom a hinge joint. A human knee would be a good example of a hinge joint.
To set degrees of freedom: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, click the X, Y, and Z, Degrees of Freedom check boxes to select the joint’s degrees of freedom.
Setting automatic joint orientation Maya can set the orientation of a joint’s local axis automatically. You can have the joint’s local axis oriented relative to the joint’s first child joint, or you can have the joint’s local axis oriented relative to the scene’s world axis. The orientation of a joint’s local axis is largely a matter of personal
208
Using Maya: Animation
Building Skeletons Setting joint creation options preference. Some expert users like to have the local axis of joints automatically orient towards first child joints, and other expert users prefer to have the local axis initially oriented the same as the scene’s world axis. By default, the orientation of a joint’s local axis is xyz. In this orientation, the positive X-axis points in the same direction as the joint’s wedge-shaped bone. That is, the X-axis points towards the center of the joint’s child joint. If the joint has more than one child joint, the X-axis points at the child joint that was created first. The Z-axis points sideways from the joint and its bone connecting the child joint, and the Y-axis points at right angles to the X-axis and Z-axis. All three axes are aligned according to the right hand rule.
You can select various combinations of the X-, Y-, and Z-axes to specify the orientation of a joint’s local axis. The first axis in the combination is the axis that points at the joint’s first child joint. The third axis points sideways from the joint and its bone connecting the child joint, and the second axis points at right angles to the first axis and third axis. All three axes are aligned according to the right hand rule. In terms of yaw, pitch, and roll, rotation about the first axis produces roll, rotation about the second axis produces yaw, and rotation about the third axis produces pitch. Instead of orienting the joint’s local axis relative to the first child joint, you can set the local axis to have the same orientation as the scene’s world axis. In this case, the orientation would be set to “none.”
To set automatic joint orientation: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, select one of the Auto Joint Orient options. Note that None orients the joint to the scene’s world axis.
Using Maya: Animation
209
Character Animation
For example, in a human skeleton the elbow joint’s X-axis would be pointing towards the wrist joint. With the arm lying flat, the elbow joint could twist about most of the X-axis, turning the rest of the arm. The elbow joint could partially swing up and down about the Z-axis, but it would not be able to pivot about the Y-axis.
Building Skeletons Setting joint creation options
Setting scale compensation When you scale the size of a joint, you can either scale the child joints also or prevent the scaling of the child joints. For example, if you increase the length of a lower arm bone by scaling the elbow joint, the wrist joint and its bones can either increase in size also or stay the same size. Either you can scale the hand as well as the lower arm or you can just scale the lower arm. Normally, when you scale a joint Maya will scale everything below it in the skeleton’s action hierarchy. However, by setting a joint’s Scale Compensate option on, you can prevent that joint and everything below it in the action hierarchy from being scaled when the joint’s parent joint is scaled. Additionally, expert users like to have Scale Compensate on to prevent inappropriate shearing deformation effects on a character’s skin. Shearing can occur when a given joint is scaled only along one or two of its axes.
To set scale compensation: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, click the Scale Compensate check box on or off.
Setting automatic joint limits You can have Maya automatically limit the extent a joint can rotate about its axes according to the angles at which you build the skeleton’s joints. With Auto Joint Limits on, the smaller inner angle of a joint rounded off to 180 degrees is set as the allowable range of rotation. For example, when you are creating a knee joint, if you create the joint slightly bent back, the joint will automatically not be able to swing the lower leg bone forward of the upper leg bone, nor will it be able to wobble from side to side. The joint will not be able to rotate in any other way except through the inner angle rounded off to 180 degrees. However, note that this limitation does not change the joint’s Degrees of Freedom setting.
To set automatic joint limits: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
210
In the Tool Settings window, click the Auto Joint Limits check box on or off.
Using Maya: Animation
Building Skeletons Editing joint attributes
Setting automatic creation of IK handles Maya can automatically create an IK handle for you when you finish creating a joint chain. The joint chain’s parent joint will become the IK handle’s start joint, and the last joint in the joint chain will become the IK handle’s end joint.
To set automatic creation of IK handles: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, click the Create IK Handle check box on or off.
See Chapter 12, “Posing and Animating Skeletons,” for descriptions of the IK handle options you can set when you create IK handles.
To set joint attributes: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, select IK Handle Options.
Editing joint attributes A joint’s attributes can be set automatically when you create the joint, or you can edit a joint’s attributes at any time. This section describes how to edit joint attributes with the Attribute Editor. For more information on using the Attribute Editor, please see Using Maya: Maya Basics, Building Objects and Scenes, Chapter 5, “Working with General Editors.” To find out how to set joint attributes automatically, see “Setting joint creation options” on page 206. Editing a joint includes: •
Viewing editable joint attributes
•
Renaming a joint
•
Editing degrees of freedom
Using Maya: Animation
211
Character Animation
Setting IK handle options automatically
Building Skeletons Editing joint attributes •
Editing stiffness
•
Editing a joint’s preferred angle
•
Editing joint orientation
•
Editing scale compensation
•
Editing joint limits
•
Dampening rotation near joint limits You can access settings for a joint’s attributes, and also the Attribute Editor, by pressing the right mouse button while the cursor is on the joint you want to edit.
Viewing editable joint attributes To view or edit a joint’s attributes, use the Attribute Editor.
212
Using Maya: Animation
Building Skeletons Editing joint attributes
Character Animation
Attribute Editor for joints Using Maya: Animation
213
Building Skeletons Editing joint attributes
To view editable joint attributes: Choose Window→Attribute Editor to open the Attribute Editor. The Attribute Editor is displayed.
Renaming a joint Maya names joints for you when you create them. By default, joints are numbered consecutively as you create them. However, you can rename the joints to better reflect their purpose in your character’s skeleton. It’s a good idea to give joints meaningful names so they are easier to select when you are working with Maya’s editors, using the Hypergraph, or using the Outliner.
To rename a joint: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Enter the new name in the joint: field. The new name takes effect immediately.
214
Using Maya: Animation
Building Skeletons Editing joint attributes
Character Animation
Examples of meaningful joint names in the Outliner
Using Maya: Animation
215
Building Skeletons Editing joint attributes
Editing degrees of freedom Each joint has a local axis whose origin is at the center of the joint. The X-axis of the local axis is red, the Y-axis is green, and the Z-axis is blue. How a joint can rotate is defined in terms of this local axis. A joint’s degrees of freedom specifies which of its local axes it can rotate about during inverse kinematics (IK) posing and animation. During IK, a joint is rotated by an IK handle, and how the IK handle performs depends on the type of IK solver the IK handle is using. A joint can have at most three degrees of freedom: the freedom to rotate about its X-axis, Y-axis, and Z-axis during IK. Expert users often call a joint with three degrees of freedom a ball joint because it can rotate about all three of its axes like a ball. Note that two types of IK solvers, the single chain solver and the plane solver, require that their start joints be ball joints that have no limitations on the extent they can rotate about each axis. You can limit a joint so that it has only two degrees of freedom, or only one degree of freedom. A joint with two degrees of freedom can only rotate about any two of its local axes during IK. A human wrist would be a good example of a joint with two degrees of freedom, though the joint has limitations on the extent it can rotate about its axes. A joint with only one degree of freedom can rotate only about its local X-axis, or Y-axis, or Z-axis during IK. Expert users often call a joint with only one degree of freedom a hinge joint. A human knee would be a good example of a hinge joint. Note that you can have a joint’s degrees of freedom set automatically when you create the joint. To find out how to set a joint’s degrees of freedom automatically, see “Setting degrees of freedom” on page 208.
To edit a joint’s degrees of freedom:
216
1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
In the Attribute Editor, click the X, Y, and Z Degrees of Freedom check boxes to select the joint’s degrees of freedom.
Using Maya: Animation
Building Skeletons Editing joint attributes
Editing a joint’s preferred angle This attribute influences how an IK handle will prefer to rotate a joint during inverse kinematics. If you are not familiar with inverse kinematics (IK), IK handles, and IK solvers, see Chapter 12, “Posing and Animating Skeletons.” The IK solver often can rotate a joint in a number of different ways in order to reach the goal. Similarly, when more than one IK handle passes through a joint, the first priority of all the IK solvers is to make all the IK handles reach their goals. Often a variety of joint rotations can allow the IK handles to reach their goals.
Preferred angles can enable smoother motion during animation.
To edit a joint’s preferred angle: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Use the Preferred Angle fields to set the angle you prefer the joint to be in. The three values refer to the X, Y, and Z axes respectively. The angles are relative to the local coordinate system of the joint.
Editing stiffness This attribute influences how stiffly an IK handle can rotate a joint during inverse kinematics. If you are not familiar with inverse kinematics (IK), IK handles, and IK solvers, see Chapter 12, “Posing and Animating Skeletons.” When you use inverse kinematics to move a joint chain for animation, you can set some joints to move less freely than others. You can set joints in the mid-back of a human to move and bend less freely than those in the lower back, for example. The resistance to movement of a particular joint is called its stiffness.
Using Maya: Animation
217
Character Animation
Depending on how you want your character to move, some rotations are more appropriate than others. You can identify preferred angles for your character’s actions. Two types of IK solvers, the single chain IK solver and the rotate plane IK solver, will then give those angles priority over other possible angles during joint rotation. The angles you give priority to are called preferred angles.
Building Skeletons Editing joint attributes Stiffness operates relatively between joints in a joint chain controlled by IK handles. IK solver calculations for stiffness can require a little more time than usually required, so use stiffness only when its effect is particularly important. You set the stiffness for each axis separately. You can use this for joints that move in several directions. For example, a wrist joint moves more freely bending toward the forearm than it does from side to side.
Set stiffness high in Z-axis
Set stiffness low in X-axis
Set stiffness to create realistic animation Expert users have found that when stiffness is specified, the solver adjusts the internal energy strictly under the constraint that the end effectors stay fixed. Therefore, if there are no redundant degrees of freedom, the stiffness won’t modify the single chain IK solver’s solution.
To edit a joint’s stiffness 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
In the Stiffness fields, enter values from 0 to 100.0 for the X-, Y-, and Z-axes. The X-, Y-, and Z-axes are in the local coordinate system. 0 means the joint moves freely, 50 is moderately stiff, and 100 fuses the joint so that it’s immovable. With stiffness set to 0, no stiffness is specified. This is the recommended setting unless creating the effect of stiffness is particularly important.
218
Using Maya: Animation
Building Skeletons Editing joint attributes
Editing joint orientation You can edit the orientation of a joint’s local axis. You can have the joint’s local axis oriented relative to the joint’s first child joint, or you can have the joint’s local axis oriented relative to the scene’s world axis. The orientation of a joint’s local axis is largely a matter of personal preference. Some expert users like to have the local axis of joints automatically orient towards first child joints, and other expert users prefer to have the local axis initially oriented the same as the scene’s world axis.
For example, in a human skeleton the elbow joint’s X-axis would be pointing towards the wrist joint. With the arm lying flat, the elbow joint could twist about most of the X-axis, turning the rest of the arm. The elbow joint could partially swing up and down about the Z-axis, but it would not be able to pivot about the Y-axis. You can select various combinations of the X-, Y-, and Z-axes to specify the orientation of a joint’s local axis. The first axis in the combination is the axis that points at the joint’s first child joint. The third axis points sideways from the joint and its bone connecting the child joint, and the second axis points at right angles to the first axis and third axis. All three axes are aligned according to the right hand rule. In terms of yaw, pitch, and roll, rotation about the first axis produces roll, rotation about the second axis produces yaw, and rotation about the third axis produces pitch. Instead of orienting the joint’s local axis relative to the first child joint, you can set the local axis to have the same orientation as the scene’s world axis. In this case, the orientation would be set to “none.”
To edit a joint’s orientation: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Enter new values in the Joint Orient fields. The three values refer to the X-, Y-, and Z-axes respectively. Using Maya: Animation
219
Character Animation
By default, the orientation of a joint’s local axis is xyz. In this orientation, the positive X-axis points in the same direction as the joint’s wedge-shaped bone. That is, the X-axis points towards the center of the joint’s child joint. If the joint has more than one child joint, the X-axis points at the child joint that was created first. The Z-axis points sideways from the joint and its bone connecting the child joint, and the Y-axis points at right angles to the X-axis and Z-axis. All three axes are aligned according to the right hand rule.
Building Skeletons Editing joint attributes
Editing scale compensation When you scale the size of a joint, you can either scale the child joints also or prevent the scaling of the child joints. For example, if you increase the length of a lower arm bone by scaling the elbow joint, the wrist joint and its bones can either increase in size also or stay the same size. Either you can scale the hand as well as the lower arm or you can just scale the lower arm. Normally, when you scale a joint Maya will scale everything below it in the skeleton’s action hierarchy. However, by setting a joint’s Scale Compensate option on, you can prevent that joint and everything below it in the action hierarchy from being scaled when the joint’s parent joint is scaled. Additionally, expert users like to have Scale Compensate on to prevent inappropriate shearing deformation effects on a character’s skin. Shearing can occur when a given joint is scaled only along one or two of its axes.
To edit a joint’s scale compensation: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Toggle Segment Scale Compensate. Turn on Segment Scale Compensate so that this joint will compensate for scale factors applied to its parent. If the parent is scaled, this joint’s translation values will be scaled but the scale will not apply to any of this joint’s children.
Editing joint limits You can restrict a joint to a certain range of motion so that it cannot rotate beyond the angles you set as limits. You set these limits in the Limit Information panel of the Attribute Editor for joints. Expert users have found that it is best to not set joint minimum and maximum limits extremely close (±5 degrees or less). These restrictive limits can sometimes cause joints to get stuck during rotation.
To edit joint limits:
220
1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
Using Maya: Animation
Building Skeletons Editing joint attributes 3
Toggle on the boxes by the Min and Max limits of any value you want to change. For example, to set minimum and maximum limits for rotation in X, click the boxes to the left and right of Rot Limit X.
4
In the Limit X, Y, and Z fields under Translate, Rotate, and Scale, enter the angles between which you want to limit the joint’s motion.
Character Animation
Using Maya: Animation
221
Building Skeletons Editing joint attributes
Range of motion if the Z-axis rotation limits are set to -15, 45
Range of motion if the X-axis rotation limits are set to -45, 90
Restricting joint rotation with the Limits attributes
222
Using Maya: Animation
Building Skeletons Editing joint attributes
Dampening rotation near joint limits For most living creatures, when a joint rotates as far as it can, it tends to slow down or “dampen” before reaching its limit. For example, an elbow does not snap straight, but gradually slows down as the lower arm aligns with the upper arm. In animation terminology, the effect is that of an “ease-in.” Joint dampening applies resistance to a joint as it approaches its joint limits. Instead of the joint abruptly stopping when it reaches its limits, you can use damping to slow it down smoothly. Depending on the strength and range you set, a joint with dampening will not reach its limit boundary, unless forced.
Two settings in the Attribute Editor control a joint’s dampening: Damp Range and Damp Strength. •
Minimum and Maximum Rotate Damp Range set the number of degrees inside the joint limits at which resistance begins to occur.
•
Minimum and Maximum Rotate Damp Strength set the amount of resistance in the damp range.
Using Maya: Animation
223
Character Animation
The dampening factor for joints affects only the solution computed by an IK solver; it does not affect joints that are animated by other means.
Building Skeletons Editing joint attributes
Maximum damp range
Minimum damp range Maximum damp strength affects this area
Maximum damp strength affects this area
Maximum Zaxis joint limit (45)
Minimum Zaxis joint limit (-15)
Damping the limits of a right wrist joint in the Z-axis
To dampen rotation near joint limits: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Use the Min and Max Rotate Damp Range and Rotate Damp Strength fields to set the joint dampening attributes. The Rotate Damp Range values let you set the angles inside the minimum and maximum joint limits. The Rotate Damp Strength of the resistance can range from 0, which takes the joint all the way to its limit with no resistance, to 100, which stops the joint at the outer edge of the damp range. The values are relative within the IK handle’s joint chain.
224
Using Maya: Animation
12
Posing and Animating Skeletons After you’ve created a skeleton for your character, you skin the skeleton by binding the geometry to the skeleton. You can then create flexors for further skin deformation effects. Animating the character includes animating the skeleton and animating the effects provided by the flexors. Character Animation
This chapter describes posing and animating skeletons. Posing and animating skeletons includes the following: •
“Understanding posing and animating skeletons” on page 226
•
“Creating IK handles” on page 238
•
“Setting IK handle creation options” on page 241
•
“Editing IK handle attributes” on page 246
•
“Editing IK solvers” on page 253
•
“Using IK systems” on page 254
•
“Posing IK chains” on page 256 Using Maya: Animation
225
Posing and Animating Skeletons Understanding posing and animating skeletons •
“Using IK spline handles” on page 259
•
“Animating IK chains” on page 280
Understanding posing and animating skeletons When you pose and animate a skeleton, you are specifying the skeleton’s motion. The term for the specification of motion is kinematics. Posing and animating skeletons involves two types of kinematics: forward kinematics and inverse kinematics. Although the terms sound complicated, what they refer to is easy to understand. Forward kinematics is ideal for creating detailed arc motions because it requires the direct specification of each joint rotation. Inverse kinematics is ideal for creating goal-directed motion because it only requires the specification of a position and orientation that the joints in a joint chain will rotate to reach.
Forward kinematics In forward kinematics, when you pose a joint chain you rotate each joint individually. For example, if you want a joint chain to reach for a particular location in space, you have to rotate each joint individually so that the joint chain can reach the location. To do this, you would rotate the joint chain’s parent joint, then the next joint, and so on down the joint chain. When you animate a skeleton posed with forward kinematics, Maya interpolates the joint rotations starting with the root joint, then the root’s child joints, and so on down through the skeleton’s action hierarchy. Maya proceeds “forward” through the action hierarchy, starting at the root joint. Posing and animating skeletons with forward kinematics is an excellent approach for specifying detailed arc motions, but it can take a fair amount of time if you are animating a large, complicated skeleton. Also, forward kinematics is often not very intuitive for specifying goal-directed motion. When you think about moving your hand to some location in space, you don’t normally think about how you are going to rotate all the joints in your arm. The following sequence of five images illustrates the steps required to extend a W-shaped joint chain with forward kinematics posing.
226
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Character Animation
Forward kinematics posing: joint chain’s root joint selected
Forward kinematics posing: root joint rotation
Forward kinematics posing: subsequent joint rotation
Using Maya: Animation
227
Posing and Animating Skeletons Understanding posing and animating skeletons
Forward kinematics posing: subsequent joint rotation
Forward kinematics posing: joint chain extended
Posing and animating with forward kinematics To pose a skeleton with forward kinematics, you move, rotate, or scale joints directly. You can do this in the same way that you move, rotate, or scale other objects in Maya. For example, you can use the move, rotate, and scale transform tools in the minibar. Alternatively, you could move, rotate, and scale joints by using the Channel Box. To animate a skeleton with forward kinematics, you can save keys in selected frames as described in Using Maya: Animation, Keyframe. If you would like to use motion capture data to drive the character animation, see Using Maya: Animation, Motion Capture. This chapter focuses on posing and animating with Maya’s inverse kinematics tools.
228
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Inverse kinematics (IK) In inverse kinematics (IK), you can pose a joint chain based on a location in space you want the joint chain to reach. Inverse kinematics is more intuitive for goal-directed motion than forward kinematics because you can focus on the goal you want a joint chain to reach without worrying about how each joint will have to rotate. However, unlike forward kinematics, inverse kinematics requires that you use special tools for posing and animating. These tools are called IK handles and IK solvers.
The IK solver is the motor intelligence behind the IK handle. For example, if you want a joint chain to reach a particular location in space, you can move the entire chain by using the IK handle that runs through the chain. Given where you want the joint chain to reach, the IK solver figures out how to rotate all the joints in the joint chain for you by means of Maya’s inverse kinematics methods. The following sequence of two images illustrates the steps required to extend a W-shaped joint chain with inverse kinematics posing.
Inverse kinematics posing: IK handle selected
Using Maya: Animation
229
Character Animation
An IK handle is like a wire that can run through a joint chain, providing a way for you to pose the entire joint chain in one action. As you pose and animate the joint chain with the IK handle, the IK handle automatically figures out how to rotate all the joints in the joint chain by using its IK solver.
Posing and Animating Skeletons Understanding posing and animating skeletons
Inverse kinematics posing: joint chain extended
Posing and animating with inverse kinematics (IK) To pose and animate joint chains with inverse kinematics, you use IK handles. The motor intelligence of an IK handle is provided by an IK solver.
IK handles and IK chains An IK handle runs through a selected joint chain like a wire, providing you with a way to move the entire joint chain. The joint the IK handle starts at is called the start joint. The last joint in the joint chain controlled by the IK handle is called the end joint. The start joint could be the skeleton’s root joint, or any joint in the skeleton’s action hierarchy above the end joint. The IK handle can pose all the joints in the chain, from the start joint to the end joint. A joint chain that has an IK handle is called an IK chain. IK chains are easy to use. However, some background on how they work can help you get the most out of posing and animating with inverse kinematics. The end of the IK handle, which is located at the end joint by default, is called the end effector. The reason the end of the IK handle is called the “end effector” is because it helps to bring about how the IK handle rotates the joints in the joint chain so that the end of the chain can reach some location in space. By telling the IK handle’s IK solver where the end of the IK handle is, the end effector provides information the IK solver needs to figure out how to rotate all the joints for you.
230
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons When you are posing and animating an IK chain, you also need to tell the IK solver the position and orientation in space where you would like the end effector to move to next. That information is provided by the IK handle’s goal. When you interactively pose an IK chain, what you are really doing is moving the IK handle’s goal. The IK solver looks at where the goal is, looks at where the end effector is, and figures out how to rotate all the joints in the IK chain to get the end effector to be where the goal is.
IK solvers IK solvers provide the motor intelligence of IK handles. IK solvers figure out how to rotate all the joints in a joint chain controlled by an IK handle. Maya offers four types of solvers: •
Single chain (SC) solver
•
Rotate plane (RP) solver
•
Spline solver
•
Multi-chain (MC) solver
Single chain (SC) solver The single chain (SC) solver is ideal for posing and animating the IK chains for a character’s limbs, such as arms and legs. The single chain solver provides a straightforward mechanism for posing and animating a chain anywhere the joint chain can reach in the scene’s world space. The joint chain will tend to stay within the plane that best includes all the joint chain’s joints. An IK handle using a single chain is displayed as follows:
Using Maya: Animation
231
Character Animation
A skeleton can have as many IK handles as you think you need for posing and animating its joint chains. However, be sure you are happy with which joint is the skeleton’s root joint before you begin creating IK handles. The skeleton’s root must not be between an IK chain’s start joint and end joint. You cannot create an IK chain that includes the root joint unless that joint is the start joint. Also, if you change which joint is the root joint, you will invalidate IK chains that include the new root joint unless the joint is the start joint of an IK chain.
Posing and Animating Skeletons Understanding posing and animating skeletons
Handle vector End joint
Start joint
Goal
Handle wire End effector
IK handle using single chain solver
Start joint The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle. The start joint could be the skeleton’s root joint or any other joint in the skeleton’s action hierarchy above the end joint.
End joint The end joint is the last joint in the joint chain controlled by the IK handle. The end joint must be below the start joint in the skeleton’s action hierarchy.
Handle wire The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle.The handle wire begins at the start joint’s local axis and by default ends at the end joint’s local axis.
End effector The end effector is the end of the IK handle. By default, the end effector is located at the end joint’s local axis. However, the end effector can be offset from the end joint. The end effector does not move from its location at the end joint (or at some offset from the end joint) during posing and animating. Also, note that the end effector is parented to the parent joint of the end joint, not to the end joint.
232
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Goal The goal indicates where you want an IK handle’s end effector to be. The goal, which is indicated by an axis, rests at the IK handle’s end effector. During posing, you can move the goal to any location in the scene’s world space. The IK handle’s end effector tries to keep up with the goal at all times. The IK handle’s single chain (SC) solver figures out how the end effector can have the same position and orientation as the goal’s position and orientation. The single chain (SC) solver figures out how to rotate the joint chain’s joints so that the end effector can reach the goal. However, depending on the rotational limits and fully extended length of the joint chain, the end effector might not be able to reach the goal’s current position and orientation.
The handle vector is the line drawn from the start joint to the IK handle’s end effector. The end effector is normally located at the IK chain’s end joint. The purpose of the handle vector is to indicate at which joints the IK handle starts and ends. Because of the handle vector’s similarity to what some systems call a limb axis, some expert users refer to the handle vector as the limb axis.
Single chain solver behavior The single chain solver first looks at the position (the translate X, Y, and Z attributes) and orientation (the rotate X, Y, and Z attributes) of the goal. Next, the solver figures out how to move the position and orientation of the end effector as close to the goal’s position and orientation as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. Expert users have found that single chain solver IK chains that consist of between two and four joints are the easiest to pose. Extremely long IK chains can become awkward to pose and animate. Note that the joint chain controlled by an IK handle using a single chain solver cannot have any other IK handles running through any of its joints.
Rotate plane (RP) solver Like the single chain (SC) solver, the rotate plane (RP) solver is ideal for posing IK chains for a character’s limbs such as arms and legs. However, the rotate plane solver offers more manipulator tools for posing the chain than does the single chain solver. Also, the rotate plane solver is ideal for IK
Using Maya: Animation
233
Character Animation
Handle vector
Posing and Animating Skeletons Understanding posing and animating skeletons chains that you would like to stay in more or less the same plane, even though that plane can rotate. For example, the shoulder, elbow, and wrist joints of an arm all stay within the same plane, but that plane rotates as the shoulder joint rotates. An IK handle using a rotate plane solver is displayed as follows:
Pole vector axis
Twist disc Plane indicator
Goal Handle vector
Pole vector Handle wire End joint Rotate disc Start joint
IK handle using rotate plane solver
Start joint The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle.The start joint could be the skeleton’s root joint, or any other joint in the skeleton’s action hierarchy above the end joint.
End joint The end joint is the last joint in the joint chain controlled by the IK handle.The end joint must be below the start joint in the skeleton’s action hierarchy.
Handle wire The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle. The handle wire begins at the start joint’s local axis and by default ends at the end joint’s local axis.
234
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
End effector The end effector is the end of the IK handle. By default, the end effector is located at the end joint’s local axis. However, the end effector can be offset from the end joint. The end effector does not move from its location at the end joint (or at some offset from the end joint) during posing and animating. Also, note that the end effector is parented to the parent joint of the end joint, not to the end joint. You can use the Hypergraph to view the relationships between the end effector and the joints in the joint chain.
Goal
Handle vector The handle vector is the line drawn from the start joint to the IK handle’s end effector. The end effector is normally located at the IK chain’s end joint. Because of the handle vector’s similarity to what some systems call a limb axis, some expert users refer to the handle vector as the limb axis.
Joint chain plane The joint chain plane is the plane that would best contain all the joints in the joint chain. By always containing the joints in the joint chain, the joint chain plane controls how the joint chain can twist. The joint chain plane is not displayed because you can infer it from where the joint chain’s joints are located. However, the joint chain plane’s orientation is indicated by the plane indicator displayed in the rotation disc. The joint chain plane can rotate about the handle vector. Rotating the joint chain plane about the handle vector has the effect of twisting the joint chain. (The degree of twist is measured relative to the reference plane, which is the plane defined by the handle vector and the pole vector.)
Using Maya: Animation
235
Character Animation
The goal indicates where you want an IK handle’s end effector to be. The goal, which is indicated by an axis, rests at the IK handle’s end effector. During posing, you can move the goal to any location in the scene’s world space. The IK handle’s end effector tries to keep up with the goal at all times. The IK handle’s rotate plane (RP) solver figures out how the end effector can have the same position as the goal’s position. The rotate plane (RP) solver figures out how to rotate the joint chain’s joints so that the end effector can reach the goal. However, depending on the rotational limits and fully extended length of the joint chain, the end effector might not be able to reach the goal’s current location.
Posing and Animating Skeletons Understanding posing and animating skeletons
Rotation disc The rotation disc is located at the start joint. The rotation disc indicates how the joint chain plane can rotate, which twists the joint chain. An indicator in the rotation disc, called the plane indicator, shows the orientation of the joint chain plane.
Twist disc The twist disc is located at the end joint. You can use the twist disc as a tool to twist the joint chain by rotating the joint chain plane.
Plane indicator The plane indicator indicates the orientation of the joint chain plane, which is the degree of twist in the joint chain relative to the reference plane. The plane indicator can be thought of as the reflection of the joint chain plane in the rotation disc.
Reference plane For the joint chain plane to rotate and twist the joint chain, the plane must rotate relative to some other plane so that the degree of twist can be measured. The plane that the joint chain plane rotates relative to is the reference plane. The difference between the two planes indicates the amount the joint chain twists. The reference plane is defined by the handle vector and the pole vector.
Pole vector Like the handle vector, the pole vector starts at the start joint. Unlike the handle vector, which always ends at its IK handle’s end effector, the pole vector can end anywhere you want it to end. The purpose of the pole vector is to help define the reference plane. During posing, you can sometimes move the end effector through the reference plane, which moves the handle vector through the reference plane. When that happens, the handle vector and pole vector can appear to cross as the joint chain suddenly flips because the degree of twist suddenly changes by 180 degrees. Because the reference plane is defined by the handle vector and the pole vector, you can prevent the flipping effect by simply moving the end of the pole vector to redefine the reference plane.
236
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Rotate plane solver behavior The rotate plane solver first looks at the position (the translate x, y, and z attributes) of the goal. Next, the solver figures out how to move the position of the end effector as close to the goal’s position as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. Unlike the single chain solver, the rotate plane solver does not look at the orientation (the rotate x, y, and z attributes) of the goal. That is, the rotate plane solver figures out how to rotate the joints based on the goal’s position, but not on the goal’s orientation. The orientation of the entire joint chain can be controlled by twisting the joint chain with the twist disc. However, unlike the single chain solver, you cannot rotate the joint chain by rotating the IK handle’s goal.
Note that the joint chain controlled by an IK handle using a rotate plane solver cannot have any other IK handles running through any of its joints.
Spline solver The IK spline solver lets you manipulate a long, flexible joint chain that conforms to the shape of a curve. This solver is useful for animating the motion of tails, spines, tentacles, snakes, long necks, and similar objects. Expert users have found that spline solver IK chains that include ten or more joints with relatively short bones are ideal. For information on using IK handles with the spline solver, please see “Using IK spline handles” on page 259.
Multi-chain (MC) solver The multi-chain (MC) solver is ideal for IK chains that can be posed and animated by more than one IK handle. In such a case, each IK handle should use the multi-chain solver. For information on using the multi-chain (MC) solver, please see “Activating the multi-chain (MC) solver” on page 243.
Using Maya: Animation
237
Character Animation
Expert users have found that rotate plane solver IK chains that consist of between two and four joints are the easiest to pose. Extremely long IK chains can become awkward to pose and animate.
Posing and Animating Skeletons Creating IK handles
Creating IK handles IK handles are tools that help you pose and animate joint chains with inverse kinematics. You can create an IK handle for almost any joint chain. A joint chain that has an IK handle is called an IK chain. In any IK chain, the joint where the IK handle starts should be closer to the skeleton’s root joint than the joint where the IK handle ends. Also, an IK chain should not include the root joint unless the root joint is the start joint. You use the IK Handle Tool to create IK handles. You can set certain IK Handle attributes during IK handle creation from the IK Handle Tool’s Tool Settings window. After you create the IK handles, you can edit IK handle attributes by using the Attributes Editor. Note that you can also use Maya Embedded Language (MEL) commands to create and edit IK handles. Some expert users like to define hotkeys based on MEL commands for quickly creating customized joint chains and IK handles. During inverse kinematics posing and animating, the rotations of all the joints in the IK chain are calculated, or “solved,” by an IK solver. Note that IK handles using the single chain (SC), rotate plane (RP), and spline solvers require that the joint chains they control be solved only by them. For example, two IK handles using one of the single chain (SC), rotate plane (RP), or spline solvers cannot overlap, allowing both to solve some of the same joints. Expert users have found that IK chains that consist of between two and four joints are the easiest to pose and animate. Extremely long IK chains can become awkward. In creating IK handles, you can add IK handles to existing joint chains, or you can create IK chains (joint chains with IK handles).
Adding an IK handle You can create an IK handle for any joint chain.
To create an IK handle: 1
Select Skeletons→IK Handle Tool.
2
To change the tool options, select Skeletons→IK Handle Tool-❐ to open the IK Handle Tool Options window. See “Editing IK handle attributes” on page 246 for a description of the IK Handle Tool options.
238
Using Maya: Animation
Posing and Animating Skeletons Creating IK handles 3
With the left mouse button, click the start joint and end joint for the IK handle. You can click the joints in either order: the IK handle is created with the end effector on the child joint.
Creating an IK chain An IK chain is a joint chain that has an IK handle. You can create IK chains in the same way that you create joint chains, but you must set the Joint Tool’s Create IK Handle option.
To create an IK chain: Select Skeletons→Joint Tool-❐ to open the Joint Tool’s Tool Settings window.
2
Toggle on the Create IK Handle option. You can set IK handle options within the IK Handle Options heading. Click the triangle on the heading line to view the options. For information on IK Handle options, see “Editing IK handle attributes” on page 246.
3
Create the joint chain as you would any skeleton. First, Click in the workspace at the position of the first joint. The joint is created.
4
Move the pointer to the position you want the second joint to be and click again. The two joints are connected with a bone that indicates the direction of the joint chain’s hierarchy: the thinner end of the bone’s triangle points to the child joint. See “Positioning joints” on page 196 for tips on editing the positions of joints.
5
Continue moving the pointer and clicking until you have created the chain of joints for the skeleton.
6
When you finish creating all joints in the chain, press the Enter key. Ending the joint chain creates the IK handle. You can edit the IK handle in the Attribute Editor to change its attributes.
Using Maya: Animation
239
Character Animation
1
Posing and Animating Skeletons Creating IK handles
Displaying IK handle’s end effector A marker that identifies an IK handle’s end effector is not displayed by default when you create an IK handle. However, if you would like to see the end effector, you can tell Maya to display it.
To display end effector: 1
Choose Window→Hypergraph to open the Hypergraph.
2
In the Hypergraph, select the IK handle’s end effector.
3
With the end effector selected, continue to press the right mouse button, and from the pull-down menu, select Show. An axis-shaped icon indicates the end effector.
Displaying IK handle’s goal and goal’s axis Markers that identify an IK handle’s goal and the local axis of the goal are not displayed by default when you create an IK handle. However, you can tell Maya to display them after you create the IK handle.
To display goal and goal’s axis: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Display if not opened.
4
In Display, click Display Handle on to display the IK handle’s goal.
5
In Display, click Display Local Axis to display the axis of the IK handle’s goal.
Displaying IK handle’s twist disc and pole vector’s axis An IK handle using the default rotate plane (RP) solver has two manipulators that are not displayed by default when you create an IK handle. These manipulators are the twist disc and the pole vector’s axis.
To display twist disc and pole vector’s axis:
240
1
Select the IK handle.
2
Click the Show Manipulator Tool icon.
Using Maya: Animation
Posing and Animating Skeletons Setting IK handle creation options If the IK handle uses the default rotate plane (RP) solver, the twist disc is displayed at the IK chain’s end joint. Also, the pole vector’s axis is displayed. If the IK handle uses the single chain (SC) solver, no additional manipulators are displayed.
Setting IK handle creation options
Setting automatic IK handle attributes includes: •
“Viewing IK handle creation options” on page 241
•
“Setting the current solver” on page 242
•
“Setting autopriority” on page 243
•
“Setting solver enable” on page 244
•
“Setting snap enable” on page 244
•
“Setting sticky” on page 244
•
“Setting priority” on page 245
•
“Setting weight” on page 245
•
“Setting position vs. orientation (PO) weight” on page 246
Viewing IK handle creation options The IK handle creation options can be set from the IK Handle Tool’s Tool Settings window. When you create an IK handle, you use the IK Handle Tool. You can set the IK Handle Tool’s settings so that certain IK handle attributes will be set automatically.
Using Maya: Animation
241
Character Animation
You can have the various options and attributes of IK handles set automatically when you create the IK handle, or you can edit the IK handle’s attributes at any time. This section describes how to set IK handle creation options. To edit attributes after you create an IK handle chain, see “Editing IK handle attributes” on page 246.
Posing and Animating Skeletons Setting IK handle creation options
The IK Handle Tool’s Tool Settings window
To view automatically set IK handle attributes: Select Skeletons→IK Handle Tool-❐. The IK Handle Tool’s Tool Settings window is displayed.
Setting the current solver You can have either the single chain solver or the rotate plane solver set as the current solver automatically provided when you create an IK handle.
To set the current solver: 1
242
Select Skeletons→IK Handle Tool-❐.
Using Maya: Animation
Posing and Animating Skeletons Setting IK handle creation options 2
From the Current Solver pop-up menu, select either ikRPsolver or ikSCsolver. The rotate plane (RP) solver (called the ikRPsolver) is the default solver. The other solver you can select here is the single chain solver (called the ikSCsolver). Depending on the plug-ins you are using, other solvers may be available. To use the spline solver, you must work directly with the IK Spline Handle Tool (Skeletons→IK Spline Handle Tool). You can select the multi-chain (MC) solver if it has already been activated.
The multi-chain (MC) solver is only available through the use of a Maya Embedded Language (MEL) command. Once you enter the command, you can choose the multi-chain solver from the IK Handle Tool’s Tool Settings window.
To activate the multi-chain solver: 1
Choose Window→General Editors→Command Shell...
2
In the Command Shell, enter the following command at the mel: prompt: createNode ikMCsolver. Now you can choose the multi-chain (MC) solver in the IK Handle Tool’s Tool Settings window.
Setting autopriority You can control the order in which IK chains are solved by having Maya automatically set their priority based on where the start joints are in the skeleton’s action hierarchy. When Maya automatically sets priority, IK chains whose start joint is the skeleton’s root joint have a priority of 1. IK chains whose start joints are child joints of the root joint have a priority of 2, and so on down the skeleton’s action hierarchy. The further an IK chain’s start joint is from the root joint, the lower its priority.
To set autopriority: 1
Select Skeletons→IK Handle Tool-❐.
2
Click Autopriority on or off. If off, all IK handles are given a priority of 1.
Using Maya: Animation
243
Character Animation
Activating the multi-chain (MC) solver
Posing and Animating Skeletons Setting IK handle creation options
Setting solver enable After you create an IK handle for a joint chain, you can immediately begin posing the new IK chain with inverse kinematics. However, if you would like to pose with forward kinematics, you can temporarily turn off the IK handle’s IK solver.
To set solver enable: 1
Select Skeletons→IK Handle Tool-❐.
2
Click Solver Enable off or on (the default is on).
Setting snap enable During posing, an IK handle’s goal can exceed the reach of the IK chain. Maya will show you this by continuing to draw a line between the end effector, which is located at the IK chain’s end joint by default, and the goal. When you release the mouse button, the goal will snap back to the IK handle’s end effector by default. If you prefer, you can have the goal remain wherever you have moved it last, rather than have it snap back to the end effector. Whether the goal snaps back or remains in its last location is largely a matter of personal preference. At times some expert users like to see where the goal is after it has exceeded the reach of the IK chain so they can make adjustments more easily to the overall position of the entire skeleton.
To set snap enable: 1
Select Skeletons→IK Handle Tool-❐.
2
Click Snap Enable off or on (the default is on).
Setting sticky You can have an IK handle’s goal stick to any location in the scene. When you move the start joint of the IK chain, or even the entire skeleton, the end joint of the IK chain with a sticky IK handle will stick to its location while the IK solver provides the appropriate joint rotations. For example, if you are animating a human character that is reaching up or out while standing in place, you can animate the natural articulation of the legs much more easily by making the IK handles that end at the character’s feet sticky.
To set sticky: 1
244
Select Skeletons→IK Handle Tool-❐.
Using Maya: Animation
Posing and Animating Skeletons Setting IK handle creation options 2
Click Sticky on or off.
Setting priority You can control the order in which a skeleton’s various IK handles calculate joint chain action during animation. Each IK handle can be assigned a priority. IK handles with a priority of 1 will be solved first, IK handles with a priority of 2 will be solved second, and so on. Maya can set these priorities for you based on where an IK handle’s start joint is in a skeleton’s action hierarchy, or you can give all IK handles a priority of 1. Having varied priorities for IK handles can improve overall inverse kinematics performance. Character Animation
To set priority: 1
Select Skeletons→IK Handle Tool-❐.
2
Slide Priority value to desired setting. Highest priority is 1.
Setting weight During animation, a skeleton with many IK chains can perform a wide variety of motions. Because of the specific ways the motions of IK chains can affect the overall position and orientation of the character’s skeleton, not all the end effectors may be able to reach their goals simulaneously. Consequently, some of the interpolated IK chain motions might not provide the effects you wish. For example, on a given limb with two IK chains that have the same priority, neither of the two IK chains might be able to reach their goals because they are pulling the limb in different directions. You can alleviate this situation by assigning the IK handles of those IK chains a weight. The assigned weight, combined with the current distance between an IK handle’s end effector and its goal, serve to prioritize the solutions of IK chains whose IK handles have the same priority settings. When the end effectors of two or more IK handles with the same priority cannot reach their goals simultaneously, the IK handles whose end effectors are furthest from their goals and whose weights are greatest will be solved first.
To set weight: 1
Select Skeletons→IK Handle Tool-❐. Using Maya: Animation
245
Posing and Animating Skeletons Editing IK handle attributes 2
Slide Weight value to desired setting (must be 0 or greater).
Setting position vs. orientation (PO) weight During animation, an IK handle’s end effector might be able to reach the goal’s position or the goal’s orientation, but not both. You can control the extent to which the end effector can reach the goal’s position versus the goal’s orientation by setting the position vs. orientation (PO) weight. The value of the PO weight ranges between 0 and 1. With a PO weight of 1, the end effector will seek to reach only the goal’s position. With a PO weight of 0, the end effector will seek to reach only the goal’s orientation. With a PO weight of 0.7, the end effector will seek to reach the goal’s position more than the orientation. Finally, with a PO weight of 0.5, the end effector will try to reach the goal’s position and orientation as equally as possible. Note that IK handles using the rotate plane (RP) solver do not consider the orientation of the goals, only the position. With IK chains being solved by the RP solver, you control IK chain orientation by means of the twist disc.
To set position vs. orientation (PO) weight: 1
Select Skeletons→IK Handle Tool-❐.
2
Slide POWeight value to desired setting.
Editing IK handle attributes You can edit the attributes of an IK handle at any time by using the Attribute Editor. This section describes how to use the Attribute Editor to edit an IK handle’s attributes. Editing IK handle attributes includes:
246
•
“Viewing editable IK handle attributes” on page 247
•
“Renaming an IK handle” on page 249
•
“Editing transform attributes” on page 249
•
“Editing skeleton info” on page 250
•
“Editing IK handle attributes” on page 250
•
“Editing IK solver attributes and choosing an IK solver” on page 251
•
“Editing pivots” on page 251
•
“Editing limit information” on page 252
Using Maya: Animation
Posing and Animating Skeletons Editing IK handle attributes •
“Editing display” on page 252
•
“Editing node behavior” on page 253 Note that you can access settings for an IK handle’s attributes, and also the Attribute Editor, by pressing the right mouse button while the cursor is on the IK handle you want to edit.
Viewing editable IK handle attributes To view or edit an IK handle’s attributes, use the Attribute Editor.
Character Animation
Using Maya: Animation
247
Posing and Animating Skeletons Editing IK handle attributes
Attribute Editor for IK handles
248
Using Maya: Animation
Posing and Animating Skeletons Editing IK handle attributes
To view editable joint attributes: Choose Window→Attribute Editor to open the Attribute Editor. The Attribute Editor is displayed.
Renaming an IK handle
To rename an IK handle: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Enter the new name in the ikHandle: field. The new name takes effect immediately.
Editing transform attributes An IK handle’s transform attributes include the following: •
Translate, rotate, scale, and shear transformations
•
Rotate order
•
Rotate axis
•
Inherits transform option
To edit transform attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Transform Attributes if not opened.
Using Maya: Animation
249
Character Animation
Maya names IK handles for you when you create them. By default, IK handles are numbered consecutively as you create them. For example, the first handle would be called “ikHandle1,” the second “ikHandle2,” and so on. You can rename the IK handles to better reflect their purpose in posing and animating your character. It’s a good idea to give IK handles meaningful names so that they are easier to select when you are working with Maya’s editors, using the Hypergraph, or using the Outliner. For example, you could name an IK handle that goes from a right shoulder joint to a right wrist joint “RShtoWrist.”
Posing and Animating Skeletons Editing IK handle attributes 4
In Transform Attributes, you can make changes to the translate, rotate, scale, and shear transformations. You can set the rotate order, which is by default set to xyz. You can change the location of the rotate axis, which is by default set to 0.0, 0.0, 0.0. Finally, you can toggle whether or not the IK handle inherits transformations.
Editing skeleton info An IK handle’s skeleton info include the following: •
Start joint
•
End effector
To edit skeleton info: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Skeleton Info if not opened.
4
In Skeleton Info, note that the names of the IK handle’s start joint and end effector are displayed. You can edit either of these by clicking on the right arrow buttons next to their names.
Editing IK handle attributes An IK handle’s handle attributes include the following: •
Snap enable
•
Stickiness
•
Priority
•
Weight
•
Position vs. orientation (PO) weight
To edit IK handle attributes:
250
1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open IK Handle Attributes if not opened.
4
In IK Handle Attributes, you can edit snap enable, stickiness, priority, weight, and position vs. orientation (PO) weight.
Using Maya: Animation
Posing and Animating Skeletons Editing IK handle attributes
Editing IK solver attributes and choosing an IK solver An IK handle’s solver attributes include the following: •
Solver enable
•
IK solver selection (single chain solver, rotate plane solver, or the multichain solver if activated)
•
Pole vector’s end location
•
Twist
To edit solver attributes and choose IK solver: Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open IK Solver Attributes if not opened. In IK Solver Attributes, you can choose the IK solver, snap enable, stickiness, priority, weight, and position vs. orientation (PO) weight.
4
In IK solver, choose the IK solver you want to assign to the IK handle. By default, only two IK solvers are offered here: the single chain solver (ikSCsolver) and the rotate plane solver (ikRPsolver), which is the default IK solver. To use the spline solver, you must work directly with the IK Spline Handle Tool (Skeletons→IK Spline Handle Tool).
Editing pivots An IK handle’s pivots attributes include the following: •
Display rotate pivot toggle
•
Display scale pivot toggle
•
Local space rotate pivot and scale pivot
•
World space rotate pivot and scale pivot
To edit pivots attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Pivots if not opened. Using Maya: Animation
251
Character Animation
1
Posing and Animating Skeletons Editing IK handle attributes 4
In Pivots, you can edit the display rotate pivot toggle and the display scale pivot toggle. Also, you can edit the coordinates for the local space pivot’s rotate and scale transformations and the world space pivot’s rotate and scale transformations.
Editing limit information An IK handle’s limit information attributes include the following: •
Translation transformation limits
•
Rotation transformation limits
•
Scale transformation limits
To edit limit information attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Limit Information if not opened. Below it you can open Translate, Rotate, and Scale.
4
In Translate, Rotate, or Scale, edit the minimum, current, and maximum transformation limits.
Editing display An IK handle’s display attributes include the following: •
Display handle
•
Display local axis
•
Select handle
•
Show manipulator default
•
Visibility
•
Template
To edit display attributes:
252
1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Display if not opened.
Using Maya: Animation
Posing and Animating Skeletons Editing IK solvers 4
In Display, toggle the Display Handle and Display Local Axis settings. Edit the coordinates of the Select Handle location. Select Show Manip Default as None, Translate, Rotate, or Scale. Check Visibility on or off, and check Template on or off.
Editing node behavior Maya’s system thinks of all its entities, including IK handles, as nodes. An IK handle’s node behavior attributes include the following: •
Caching
•
Node state Character Animation
To edit node behavior attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Node Behavior if not opened.
4
In Node Behavior, check Caching on or off. Select Node State as Normal, HasNoEffect, or Blocking.
Editing IK solvers You can edit the settings of the IK solvers from the Attribute Editor. By default, Maya names the single chain solver the “ikSCsolver” and the rotate plane solver the “ikRPsolver.” Editing IK solver settings includes: •
Editing IK solver attributes: maximum iterations and tolerance
•
Editing node behavior
Editing IK solver attributes An IK solver’s attributes include the following: •
Maximum iterations
•
Tolerance
To edit solver attributes: 1
Select the IK solver.
2
Choose Window→Attribute Editor to open the Attribute Editor. Using Maya: Animation
253
Posing and Animating Skeletons Using IK systems 3
Open IK Solver Attributes if not opened.
4
In IK Solver Attributes, edit the Max Iterations setting and the Tolerance setting.
Editing node behavior Maya’s system thinks of all its entities, including IK solvers, as nodes. An IK solver’s node behavior attributes include the following: •
Caching
•
Node state
To edit node behavior attributes: 1
Select the IK solver.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Node Behavior if not opened.
4
In Node Behavior, check Caching on or off. Select Node State as Normal, HasNoEffect, or Blocking.
Using IK systems An IK system can organize and manage a collection of IK solvers.
Creating an IK system To create an IK system: 1
Choose Window→Attribute Editor to open the Attribute Editor.
2
Choose List→Auto Update, clicking auto update off (not checked).
3
Choose List→Kinematics→IK Systems.
4
Choose Object→ikSystem. The Attribute Editor will now show information about an IK system whose default name is “ikSystem.” You can change the name by typing in a new name in the ikSystem: field.
254
Using Maya: Animation
Posing and Animating Skeletons Using IK systems
Accessing an IK system To access an IK system: 1
Select an IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
In the Attribute Editor, click on Set Focus. The Attribute Editor will now display information about the IK system.
Renaming an IK system You can rename an IK system.
1
Access the IK system with the Attribute Editor.
2
In the ikSystem: field, replace the current name with the name you would like to use.
Viewing an IK system’s IK solvers You can view and select the IK solvers Maya provides from the IK system.
To view available IK solvers: 1
Access the IK system with the Attribute Editor.
2
Open ikSystem if not opened. The available IK are listed. By default, three IK solvers are listed: the single chain (SC) solver (default name: ikSCsolver), the rotate plane solver (default name ikRPsolver), and the spline solver (default name: ikSplineSolver). You can select and edit the solvers by double-clicking on the names in the list. When you double-click, Maya creates folders for the selected solvers in the Attribute Editor.
Editing global snap and global solve You can edit the global snap and global solve settings.
To edit global snap and solve settings: 1
Access the IK system with the Attribute Editor. Using Maya: Animation
255
Character Animation
To rename an IK system:
Posing and Animating Skeletons Posing IK chains 2
Open ikSystem if not opened. Note the Global Snap and Global Solve check boxes below the listing of available IK solvers.
3
Click the Global Snap and Global Solve settings on or off.
Editing node behavior Maya’s system thinks of all its entities, including IK systems, as nodes.The IK system’s node behavior attributes include the following: •
Caching
•
Node State
To edit node behavior attributes: 1
Select the IK solver.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Node Behavior if not opened.
4
In Node Behavior, check Caching on or off. Select Node State as Normal, HasNoEffect, or Blocking.
Posing IK chains Posing IK chains includes the following: •
Posing with single chain (SC) solver IK handles
•
Positioning with rotate plane (RP) solver IK handles
•
Twisting with rotate plane (RP) solver IK handles
•
Eliminating flip in rotate plane (RP) solver IK handles
•
Sticky posing
Posing with single chain (SC) solver IK handles To pose single chain (SC) solver IK handles: 1
256
Select the IK handle.
Using Maya: Animation
Posing and Animating Skeletons Posing IK chains You can select the IK handle directly or from the Hypergraph. In the Hypergraph, note that next to each end effector there is an icon you can click on to select the IK handle that the end effector belongs to. 2
Select the Move Tool or the Rotate Tool.
3
Press the right mouse button and pose the IK handle.
4
The joint chain will move or rotate as you move the mouse.
Positioning with rotate plane (RP) solver IK handles To position rotate plane (RP) solver IK handles: Select the IK handle.
Character Animation
1
You can select the IK handle directly or from the Hypergraph. In the Hypergraph, next to each end effector is an icon you can click on to select the IK handle that the end effector belongs to. 2
Select the Move Tool.
3
Press the right mouse button and position the IK handle. The joint chain will move as you move the mouse.
Twisting with rotate plane (RP) solver IK handles To twist a joint chain with a rotate plane (RP) solver IK handle: 1
Select the IK handle. You can select the IK handle directly or from the Hypergraph. In the Hypergraph, next to each end effector is an icon you can click on to select the IK handle that the end effector belongs to.
2
Select the Show Manipulator Tool.
3
Click on the twist disc (located at the end joint of the joint chain). With the right mouse button pressed, move the mouse to twist the joint chain.
Eliminating flip in rotate plane (RP) solver IK handles To eliminate flip: 1
Select the IK handle if not already selected.
Using Maya: Animation
257
Posing and Animating Skeletons Posing IK chains You can select the IK handle directly or from the Hypergraph. In the Hypergraph, next to each end effector is an icon you can click on to select the IK handle that the end effector belongs to. 2
Select the Show Manipulator Tool.
3
Select the pole vector. Note that the triangular object in the rotation disc is not the pole vector. That object is the plane indicator. The plane indicator indicates the orientation of the joint chain plane.
4
Drag the pole vector so that it will not cross the handle vector. Preventing the handle vector from crossing the pole vector will eliminate flipping. The joint chain might twist while you drag the pole vector. This is because when you change the pole vector, you change the orientation of the reference plane. The joint chain’s twist is defined in terms of the difference in degrees between the reference plane and the joint chain plane.
Sticky posing When you position a joint chain with IK handles, you might want to stick one or more IK handles to a location in space while you move other IK handles. This “sticking” feature of IK handles is useful for positioning characters engaging in movement where some part of the skeleton is stationary during part of the motion. For example, your character might be interacting with a solid object such as a floor or a step on a stairway. When you make an IK handle sticky, the IK handle sticks as if stuck by a piece of gum. The IK handle tends to stay stuck, but can be pulled away depending on how you are moving the skeleton. The IK handle’s goal and end effector tend to stay together, but can sometimes separate. A sticky IK handle is indicated by a dark red sphere on the IK handle’s goal. Note that sticky IK handles are only for interactive placement of a skeleton in a keyframe. They are not active when you play an animation.
To do sticky posing:
258
1
Select the IK handle if not already selected.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open IK Handle Attributes if not opened.
4
In IK Handle Attributes, set stickiness to sticky.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles The dark red sphere at the IK handle’s goal indicates that the IK handle is now sticky. The IK handle’s goal is now set to the goal’s current position and orientation for as long as the IK handle is sticky. 5
Pose the skeleton as desired. The sticky IK handle tries to keep its joint chain always reaching for where you’ve stuck the IK handle’s goal.
Using IK spline handles
Character Animation
You can add an IK spline handle to a joint chain to animate the motion of tails, necks, spines, tentacles, bullwhips, snakes, and similar objects. After you add the handle, Maya’s IK spline solver rotates the joints when you manipulate a curve that’s part of the handle.
The seven IK spline handles on this creature control its neck, back, tail, and flippers.
Plesiosaur by Matt Dougan
Creating IK spline handles You add an IK spline handle to a joint chain. To animate the joint chain, you manipulate a curve that’s part of the handle. You don’t manipulate the translation of the handle. You can also roll or twist the joint chain with convenient manipulators.
Using Maya: Animation
259
Posing and Animating Skeletons Using IK spline handles The joint chain can be an independent hierarchy or part of a larger hierarchy. By default, a curve is created for you when you create an IK spline handle. Instead, you can create your own curve before you create the handle. In either case, the joint chain mimics the shape of the curve.
To create an IK spline handle with a default curve and options: 1
Create a joint chain. To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
2
Select Skeletons→IK Spline Handle Tool.
3
Select the start joint for the IK handle.
4
Select the end joint for the IK handle. The IK spline handle appears on the joint chain with an automatically created curve. The joints in the chain rotate to adapt to the shape of the curve.
To create an IK spline handle with your own curve and options: 1
Use modeling tools to create the curve. Create a simple curve with no sharp bends to ensure the joint chain moves smoothly when you animate the curve. If you create a curve with fewer CVs, your control of the curve’s shape and skeleton’s movement will be less precise, but you’ll be able to manipulate the curve and its joint chain easier. With fewer CVs, you spend less time selecting and dragging CVs, and you’re more likely to have a smooth curve. Start with a curve having as few CVs as necessary. Add CVs only as needed to improve control.
2
Create a joint chain. To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
3
Select Skeletons→IK Spline Handle Tool-❐. The Tool Settings window appears. Set options as described in “Setting options before creating the IK spline handle” on page 265. Turn off Auto Create Curve. The option settings are saved for future use.
4
260
Select the start joint for the IK handle.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles 5
Select the end joint for the IK handle.
6
Select the curve. The IK spline handle appears on the joint chain. The joints in the chain rotate to adapt to the shape of the curve. If the curve is shorter than the joint chain, the extra length of the joint chain points out from the end of the curve in a straight line.
Animating the joint chain To animate the joint chain, you set keys for the appropriate attributes after you do any of these actions: manipulate the CVs of the curve
•
twist and roll the joint chain
•
slide the joint chain along the curve
•
translate, rotate, and scale the curve
Character Animation
•
To see the effects of animating the joint chain more clearly, bind skin to the joint chain.
To manipulate the CVs of the curve: 1
Select the curve. To select a curve without selecting joints or other objects in the workspace, turn on (Select by object type) and limit the selection specifiers to NURBS Curves. See Using Maya: Basics for details. You can also select the curve conveniently in the Outliner or Hypergraph. It’s helpful to display CVs and hulls as you work with CVs. With the curve selected in Select by object type mode, turn on Display→NURBS Components→CVs and Hulls.
2
Move the CVs. Turn on
(Select by component type) and use the Move tool on the CVs.
or From the Modeling menu, select Curves→Curve Editing Tool. 3
Select Keys→Set Key to set keys at the desired frames.
Using Maya: Animation
261
Posing and Animating Skeletons Using IK spline handles
Tip To improve speed as you play and scrub your animation, set keys only for the CVs you animate. For instance, select the CVs, then choose Keys→Set Key. If you use the Curve Editing Tool, select Keys→Set Key-❒, turn on All Manipulator Handles, and click the Save button. Thereafter when you choose Set Key, Maya sets keys only for the necessary CVs.
To twist and roll the joint chain: 1
Select the IK spline handle. To select the handle in the workspace, drag a selection box around the end joint. The default selection priority ensures you’ll select the handle rather than the end joint.
2
Select Modify→Transformation Tools→Show Manipulator Tool. Circular manipulators appear at the start joint and end joint.
Twist manipulator
Start joint End joint
Roll manipulator
262
3
To roll the entire joint chain, click and rotate the circular manipulator at the start joint.
4
To twist the joint chain, click and rotate the circular manipulator at the end joint.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles You can also adjust twist and roll by selecting the IK handle and entering values for Roll and Twist in the Channel Box or Attribute Editor. In the Attribute Editor, expand the IK Solver Attributes section to see these attributes. 5
Set keys for the handle’s Roll and Twist attributes. If the IK handle’s Solver Enable is on, the solver doesn’t use the IK handle’s Translate, Rotate, and Scale values as it rotates joints.
To slide the joint chain along the curve: 1
Select the IK handle.
2
Choose Window→Attribute Editor to display the Attribute Editor.
3
Expand the IK Solver Attributes section.
4
Turn on Root on Curve.
Character Animation
To select the IK handle, turn on (Select by object type) then drag a selection box around the end joint of the handle. The default selection priority ensures you’ll select the handle rather than the end joint.
This constrains the start joint of the IK spline handle to a position on the curve. It also provides an offset manipulator to slide the start joint along the curve. 5
Choose Modify→Transformation Tools→Show Manipulator Tool. The offset manipulator appears at the start joint.
Using Maya: Animation
263
Posing and Animating Skeletons Using IK spline handles
Offset manipulator at the start joint
6
Drag the manipulator to slide the joint chain along the curve. If you drag the start joint to the end of the curve, the child joints move off the end of the curve in a straight line.
Offset manipulator at the end of the curve
You cannot drag the manipulator past either end of the curve. You can also enter values for Offset in the Attribute Editor to move the start joint’s offset manipulator along the curve. Try various values over 0 to get the desired position.
264
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles The Offset attribute is ignored if you turn Root on Curve off. 7
Set keys for the Offset at the desired frames.
Note If you use Offset (or the offset manipulator) to animate a joint chain sliding on a curve, the start joint might flip unexpectedly. Use Offset only for small movements or when the start joint doesn’t rotate much. You can also use a motion path to prevent joint flipping. See “Preventing unwanted start joint flipping” on page 272.
To translate, rotate, and scale the curve: Select the curve.
2
Use the Move, Rotate, and Scale tools to translate, rotate, or scale the curve. If you created the handle with Root on Curve off, translating, rotating, and scaling the curve doesn’t translate the start joint.
3
Set keys for the appropriate Translate, Rotate, and Scale attributes.
Setting options before creating the IK spline handle This topic describes how to set IK spline handle tool options available before you create the handle. See “Tips for working with IK spline handles” on page 274 for additional information on how to use several of these options. For details on options you can set after creation, see “Setting attributes after creating the IK spline handle” on page 271.
To set IK Spline Handle Tool options: Select Skeletons→IK Spline Handle Tool-❐ Set the following options in the Tool Settings window.
Using Maya: Animation
265
Character Animation
1
Posing and Animating Skeletons Using IK spline handles
Root on Curve If you turn this option on, the start joint of the IK spline handle is constrained to a position on the curve. You can drag an offset manipulator to slide the start joint (and its children) along the curve. If you turn this option off, you can move the start joint away from the curve. The start joint is no longer constrained to the curve. Maya ignores the Offset attribute, and no offset manipulator exists at the start joint.
266
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles
Character Animation
You can move the start joint and its children off the curve by turning off Root on Curve.
Note If Root on Curve is off, the solver ignores any motion you previously keyed with Offset. Set keys with Root on Curve off or on, not a mixture of both. If Root on Curve is off and you move the start joint far enough away from the curve so that none of the joints can reach the curve, the bones point straight at the closest point on the curve. If the curve is wavy, the joints jump from closest point to closest point as you move the straightened joint chain towards parts of the curve. This is correct operation. The following figure shows a joint chain in four positions as it points towards the closest part of the curve.
Using Maya: Animation
267
Posing and Animating Skeletons Using IK spline handles
You can also turn Root on Curve on or off after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window→Attribute Editor.
Auto Create Root Axis This option creates a parent transform node above the start joint in the scene hierarchy. You can avoid unexpected start joint flipping by moving and rotating this transform node rather than the start joint. See “Preventing unwanted start joint flipping” on page 272 for details. You can turn this option on only when Root on Curve is off. If you turn on Auto Create Root Axis, you must turn off Auto Parent Curve if you want to use the curve as a motion path. Otherwise, a dependency graph loop occurs, which results in the display of a warning message and incorrect handle operation. You can set Auto Create Root Axis in the Tool Options window only as you create the IK spline handle.
Auto Parent Curve If the start joint has a parent, this option makes the curve a child of that parent. The curve and joints therefore move with the transformations of the parent. If you create a handle that starts at a joint in the chain lower than the root joint of your skeleton, turn this option on so the joint chain moves with the transformations of its parent joint. You can set this option in the Tool Options window only as you create the IK spline handle.
268
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles
Snap Curve To Root This option affects the handle only if you create your own curve for the handle. If this option is on when you create the handle, the start of the curve snaps to the position of the start joint. The joints in the chain rotate to adapt to the shape of the curve. If you want to move the joint chain to the curve to use the curve as a fixed path, turn this option off. Otherwise, turn this option on. You can set this option in the Tool Options window only as you create the IK spline handle.
Auto Create Curve If you turn on Auto Create Curve and turn off Auto Simplify Curve, the curve passes through all the joints. This often creates so many CVs that the curve is unwieldy to manipulate. For this reason, consider turning on Auto Simplify Curve. If you turn on Auto Create Curve and Auto Simplify Curve, creating the handle automatically creates a simplified curve that has a shape similar to the joint chain. The higher the Number of Spans, the closer the curve matches the joint chain. The curve has a curve degree of 3 (cubic). If you turn off Auto Create Curve, you must supply a curve for the joint chain. If the joint chain is part of an existing skeleton, you’ll typically turn this option on. If you’re using a curve as a path for sliding the joint chain, you’ll typically turn this option off. You can set Auto Create Curve in the Tool Options window only as you create the IK spline handle.
Auto Simplify Curve This option sets the automatically created curve to the specified Number of Spans. The number of spans corresponds to the number of CVs in the curve. The curve has a curve degree of 3 (cubic). If you create a curve with fewer CVs, your control of the curve’s shape and skeleton’s movement will be less precise, but you’ll be able to manipulate the curve and its joint chain easier. With fewer CVs, you spend less time selecting and dragging CVs, and you’re more likely to have a smooth curve.
Using Maya: Animation
269
Character Animation
This option creates a curve used by the IK spline handle.
Posing and Animating Skeletons Using IK spline handles This option works only if Auto Create Curve is on. You can set Auto Simplify Curve in the Tool Options window only as you create the IK spline handle.
Number of Spans This option specifies the number of CVs in the curve as follows: Number of Spans
CVs
1
4
2
5
3
6
4
7
This option is available only if Auto Create Curve is on. You can set the Number of Spans in the Tool Options window only as you create the IK spline handle.
Root Twist Mode This option turns on Power Animator IK spline twisting. As you turn the twist manipulator at the end joint, the start joint twists slightly with the other joints. With this option off, the start joint doesn’t twist. Use the roll manipulator at the start joint to turn the start joint. You can also set this option after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window→Attribute Editor.
Twist Type This option specifies how the twist occurs in the joint chain:
270
•
Linear twists all parts evenly.
•
Ease In twists more at the end than the start.
•
Ease Out twists more at the start than the end.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles •
Ease In Out twists more at the middle than at either end. You can also set Twist Type after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window→Attribute Editor.
Setting attributes after creating the IK spline handle After you create an IK spline handle, you can specify settings for several attributes.
To set attributes after creating the IK spline handle: Select the IK handle.
2
Choose Window→Attribute Editor to display the Attribute Editor.
3
Expand the IK Solver Attributes section.
Character Animation
1
The following attributes are displayed: Solver Enable
Turning this off disables the IK spline solver. If you’ve bound skin to the joint chain, turn this option off before returning the joint chain to the bind pose. While this option is on, avoid moving individual joints or you might encounter unexpected joint rotations. You also cannot move or rotate the IK handle. Be aware that the IK spline solver doesn’t operate if there are joint limits on any of the joints controlled by an IK spline handle.
Offset
See the following note.
Roll
See “Animating the joint chain” on page 261.
Twist
See “Animating the joint chain” on page 261.
Twist Type
See the following note.
Root on Curve
See the following note.
Root Twist Mode
See the following note.
Using Maya: Animation
271
Posing and Animating Skeletons Using IK spline handles
Note Twist Type, Root on Curve, and Root Twist Mode are available when you select Skeletons→IK Spline Handle Tool-❐. In the Attribute Editor, Offset affects the joint chain only if you turn on Root on Curve. For details on these attributes, see “Setting options before creating the IK spline handle” on page 265.
Preventing unwanted start joint flipping The start joint might flip undesirably when you move or rotate a curve or its CVs in some directions or slide the joint chain along its curve. If flipping occurs, it’s likely to do so only in a small range of rotation. The flipping is a normal outcome of IK spline solver calculations. If the orientation of a joint is more than 90 spatial degrees from its zerorotation value, it might flip unexpectedly as you rotate the curve or CVs. The zero-rotation value is where the joint’s RotateX, RotateY, and RotateZ attributes are 0 (relative to its parent joint’s coordinate system). Flipping is most pronounced near 180 degrees. Joint is at its zerorotation value.
Unwanted start joint rotation might occur in the half-spherical region. Flipping is pronounced in the conical region.
You can prevent start joint flipping in most cases by positioning joints appropriately when you create the joint chain. When you create each joint after the start joint, position it roughly in its rest position—the average position of its entire range of motion.
272
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles If you’ve positioned joints appropriately and joint flipping is still a problem, try parenting the start joint to another joint or to a transform node. See “Auto Create Root Axis” on page 268 and “Auto Parent Curve” on page 268. Unexpected start joint flipping might also occur when you animate a joint chain along its curve, for instance, when you slide a snake along a motion path. To prevent flipping in such cases, do these steps.
To prevent flipping when a joint chain slides down its curve: Select Skeletons→IK Spline Handle Tool-❐ to display the Tool Settings window.
2
Turn off Root on Curve, Auto Parent Curve, Auto Create Curve, and Snap Curve to Root.
3
Turn on Auto Create Root Axis.
4
Select the start joint, then the end joint, and then the curve you’ve created. This creates the IK spline handle with a parent transform node above the start joint. In a subsequent step you’ll put the node on a motion path that prevents the start joint flipping.
5
Select the parent transform node, then Shift-click the curve. To select the parent transform node, drag a selection box around the start joint.
6
Select Paths→Attach to Path-❐. The Attach to Path Options window appears.
7
Turn on Start/End.
8
For the Start Time and End Time, enter the frame range for the joint chain’s motion. The parent transform node and its child joint chain will move from the start of the curve to the end of the curve in the specified frame range.
9
Turn on Follow. If the curve has a 3D looping shape, you might also need to turn on Normal for the Up Direction to avoid unwanted flipping.
10 Leave other options at the default settings. 11 Click the Attach button.
Using Maya: Animation
273
Character Animation
1
Posing and Animating Skeletons Tips for working with IK spline handles When you play the animation, the parent transform node and joint chain move along the curve path. The movement will likely be free of unexpected flipping. However, flipping is unavoidable in some complex paths. Note that you can still roll and twist the joint chain with the IK handle’s roll and twist manipulators for additional control.
Working with soft body curves If you change an IK spline curve to a soft body, you can add dynamic forces to change the curve’s motion. For example, you can connect turbulence to the curve to create random, erratic motion. See Using Maya: Dynamics for details.
Tips for working with IK spline handles This section provides tips for working with IK spline handles on most characters. Subsequent topics offer suggestions specific to the type of character and motion you’re creating. •
To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
•
Create a simple curve with no sharp bends to help make the joint chain move smoothly when you animate the curve. Use a small number of CVs.
•
When you add an IK spline handle to the skeleton of most creatures— including fish and snakes moving along a motion path—parent each IK spline start joint to a transform node or parent joint that’s not controlled by an IK spline handle. This makes the joint chain move with the transformations of the parent while avoiding unexpected joint flipping. See “Preventing unwanted start joint flipping” on page 272 for details. If you’re working on a character with a root joint that rotates little, for instance, a swaying tree, you don’t need to parent the start joint to a transform node or joint. The start joint can serve as the character’s root joint.
•
274
For a character such as a fish or snake moving along a motion path, if you create a handle that starts at a skeleton’s root, turn on Auto Create Root Axis when you create the IK spline handle. This prevents unexpected joint flipping as you animate the automatically created parent transform node along a motion path. Also turn off Auto Parent Curve.
Using Maya: Animation
Posing and Animating Skeletons Tips for working with IK spline handles If you create a handle that starts at a joint other than the skeleton’s root, turn on Auto Parent Curve and turn off Auto Create Root Axis so the handle’s curve and start joint move with the transformations of the parent joint. When you manipulate a tail or neck parented to a spine, avoid moving the first CV of the curve for the tail or neck. Move the second CV minimally, preferably only along an imaginary line extending straight out from the end of the spine. Manipulate the other CVs freely. This technique ensures that the skin flows naturally where the spine meets the tail or neck.
•
To prevent unexpected results, Maya doesn’t let you overlap the same joint with two IK spline handles.
•
Do not parent the curve to the start joint. This creates a dependency graph loop that causes the start joint to chase the curve as the curve moves. To detect such loops, use the MEL cycleCheck -all command described in the online MEL documentation.
•
Do not parent the curve to a transform node that would use that same curve as a motion path. In other words, don’t turn on Auto Create Root Axis and Auto Parent Curve if you plan to put the transform node on that curve. This creates a dependency graph loop.
Using Maya: Animation
275
Character Animation
•
Posing and Animating Skeletons Tips for working with IK spline handles
Working with human skeletons Because a human spine often twists, turns, and bends, an IK spline handle is ideal for controlling it. For example, you can position the handle’s start joint one joint hierarchically below (and positionally above) the skeleton’s root joint. This causes the IK spline joint chain to move with the root’s movement without unexpected joint flipping.
IK spline handle
IK spline handle Start joint Root joint
Zoomed view of image on left
276
Using Maya: Animation
Posing and Animating Skeletons Tips for working with IK spline handles
Working with animal skeletons Because an animal’s tail, back, and neck twist and turn independently, multiple IK spline handles are ideal for controlling them. This skeleton has three IK spline handles: on the tail, back, and neck. The handles give precise control of the spine. Handle Handle
Character Animation
Handle
Pelvic region
Here’s a close-up of the pelvic region of the preceding skeleton: Handle Handle
Close-up of previous image’s pelvic region
Note that you can use two rather than three handles for skeletons: one for the tail and one for the neck and back combined.
Using Maya: Animation
277
Posing and Animating Skeletons Tips for working with IK spline handles The start joint of the tail’s handle and the start joint of the back’s handle are near the position of the skeleton’s root, but one joint below the root in the skeleton’s hierarchy. This causes the IK spline joint chains to move with the root’s movement without unexpected joint flipping. If you use this approach, turn on Auto Parent Curve when you create the handles. This ensures the curve and joints move with the transformation of the root. For most creatures, using only one handle for the tail, back, and neck won’t give you adequate control.
Working with sinuous motion on skeletons IK spline handles are useful for animating land or sea creatures that move in sinuous or undulating patterns, for example, snakes, fish, and seals. The skeleton’s root location is crucial for achieving the desired motion. To animate a creature that glides smoothly along a path without abrupt direction changes at the head or tail, put the root of the skeleton at the character’s tail end. Turn on Auto Create Root Axis to prevent unexpected joint flipping as you transform the automatically created parent transform node. Also turn off Auto Parent Curve. An example skeleton follows:
Handle
Handle Handle Handle
Handle The skeleton’s root is at its tail.
278
Using Maya: Animation
Posing and Animating Skeletons Tips for working with IK spline handles Though not visible in the preceding figure, a parent transform node appears hierarchically above the start joint of the handle on the spine. If the creature’s head or tail moves abruptly, put the skeleton’s root between the spine’s midpoint and tail, for instance, near the pelvic region:
Handle Handle Handle
Character Animation
Handle Handle Handle
Handle
The root is in the pelvic region.
Handle
Handle
Handle
Handle
Close-up of previous image’s pelvic region
Using Maya: Animation
279
Posing and Animating Skeletons Animating IK chains Each handle’s start joint in the figure is separated from the root by one joint. None of the IK spline handles pass through the root. This causes the IK spline joint chains to move with the root’s movement without unexpected joint flipping.
Animating IK chains You can animate IK chains by keyframing or by using motion capture data.
Keyframing For information on keyframing, please see Using Maya: Animation, Part 1: Keyframe, which describes the tasks and tools for keyframing, including how to set keys, edit key options, use the Graph Editor, use the Dope Sheet, and use the Playblast window. Please note the following keyframing tips for character animation: •
Set a minimum number of keys
•
Use the Channel Box
Set a minimum number of keys You can set a key for every transformation attribute in a scene. However, in character animation, most expert users find that setting a minimum number of keys assures the best use of system resources. They only key transformation attributes that they want to be sure will be interpolated between frames. For example, if only the transformation attribute for translation along the X-axis of an IK handle’s goal has changed, expert users will save a key for only that transformation attribute, not the entire IK handle.
Use the Channel Box In addition to the selections from the Keys pull-down menu, many expert users often use the Channel Box to set keys for particular transformation attributes. For example, if you select the Translate X channel and then press the right mouse button, you can choose Key Selected to save a key for that channel only. (Note that in the Channel Box, transformation attributes are identified as channels.)
280
Using Maya: Animation
Posing and Animating Skeletons Animating IK chains
Motion capture For information on motion capture, please see Using Maya, Animation, Part 4: Constraints and Motion Capture. You can have motion capture data drive the IK handle’s goals, thereby posing the IK chains.
Character Animation
Using Maya: Animation
281
Posing and Animating Skeletons Animating IK chains
282
Using Maya: Animation
13
Skinning Skeletons
This chapter explains skinning. Skinning skeletons includes the following: •
“Understanding skinning” on page 284
•
“Binding by closest point” on page 285
•
“Binding by partition set” on page 287
•
“Binding multiple objects as skin” on page 288
•
“Returning to bind pose” on page 289 Using Maya: Animation
283
Character Animation
Skinning skeletons is the process of binding a geometry to a skeleton so that the skeleton’s actions can deform the geometry. A geometry can be either a non-uniform rational B-spline (NURBS) geometry whose points are control vertices (CVs), or a polygonal geometry whose points are vertices. Once bound, the geometry becomes the skeleton’s skin. In effect, the skeleton’s skin provides the shape of the character’s surface. The skin moves as the skeleton’s joints move, because during skinning the geometry’s points (CVs or vertices) are identified as skin points and organized into skin point sets that are bound to the skeleton’s joints.
Skinning Skeletons Understanding skinning •
“Displaying skin point set colors” on page 290
•
“Editing skin point sets” on page 290
•
“Detaching and reattaching skin” on page 290
•
“Animating with skin and skeleton groups” on page 292 Note that skinning skeletons often requires use of the Set Editor. If you are not familiar with the Set Editor, please refer to Using Maya: Hypergraph, Sets, and Expressions.
Understanding skinning Skin is a geometry that has been bound to a skeleton, and skinning is the process of binding a geometry to a skeleton. After you’ve built a skeleton and exercised how that skeleton can be posed and animated, you are ready to give the skeleton some skin. First, pose the skeleton so that it fits the geometry properly. Next, bind the geometry to the skeleton, making the model the skeleton’s skin. This skin provides the surface of your character. In Maya, there are two ways to skin a skeleton: •
Closest point skinning
•
Partition set skinning
Closest point skinning In binding by closest point, the geometry’s points (CVs or vertices) are automatically organized into skin point sets based on the proximity of each point to a joint. For each joint with a bone, a skin point set is created that includes the points that are closest to the given joint. The points are then identified as skin points, with each skin point being a member of only one skin point set. In Maya, a collection of sets that can have no members in common is called a partition. In organizing the geometry’s points for binding, Maya partitions them into skin point sets. Because skin point sets can have no members in common, a skin point cannot be bound to more than one joint. In binding by closest point, Maya creates the skin point sets for you. You can edit the sets after they are created to fine-tune the binding of individual skin points.
284
Using Maya: Animation
Skinning Skeletons Binding by closest point
Partition set skinning If the geometry has its points (CVs or vertices) organized into a partition whose sets you want to bind to joints, you can bind by closest partition. During modeling, you can partition a geometry’s points (CVs or vertices) into sets. A geometry that has the same number of sets as the skeleton has joints can be bound to the skeleton by partition set. In binding by partition set, a geometry’s already existing partition sets are bound to the skeleton’s joints as skin point sets. Each partition set is bound to the nearest joint as a skin point set.
Skin point set colors
Bind pose After you’ve given the skeleton some skin, whe posed and animated the skin will deform based on the skeleton’s action. The only pose in which the skin is not deformed relative to the original geometry is the bind pose, which is the pose the skeleton was in when you bound the geometry to it.
Skin detachment and reattachment You can detach and reattach the skeleton’s skin at any time. Expert users detach and reattach when they want to add or remove a skeleton’s joints, change the skeleton’s bind pose, do some more modeling on the skin, or detach and then bind a different geometry for the skin.
Binding by closest point In binding by closest point, Maya automatically creates jointClusters for each joint, and distributes the points closest to each joint into that joint’s jointCluster set. Binding by closest point is the most common way to skin a skeleton.
Using Maya: Animation
285
Character Animation
Whether you bind by closest point or by partition set, Maya assigns each skin point set a color. The points in a given skin point are displayed in the set’s color. You can also have the skin point set’s joint be displayed in the skin point set’s color.
Skinning Skeletons Binding by closest point If you plan to bind additional skins to the skeleton at a later time, you will want to be able to return easily to the pose at which the first skins were bound (the bind pose). Maya saves bind pose information for joints at which you bind the skin, but not joints without skin. Binding to the skeleton from the bottom of the skeleton’s action hierarchy can make it difficult to return the skeleton to its bind pose. The easiest way to ensure that you can return to the bind pose is to always bind from the top of the hierarchy downwards. In cases where you wish to concentrate on the lower part of the skinning first, it is best to bind simplistic substitute skins to the upper part of the skeletal hierarchy to ensure that Maya saves bind pose information for the entire skeleton. Late, you can delete the substitute skins when you are ready to bind the actual skin.
To bind by closest point: 1
Select the geometry and skeleton. If you are binding to the complete skeleton, select any joint. Maya will understand that you want to bind the geometry to the entire skeleton hierarchy that corresponds to the joint you have whose joint you have selected. If you are binding to selected joints only, explicitly select each joint that you want to bind to. Note that you can attach more than one geometry at a time. Select all the geometries that you want to bind to the skeleton by clicking on one and then Shift-clicking the others to select them.
2
Select Skinning→Bind Skin-❐. The Bind Skin Options window is displayed.
3
In Bind to, choose Complete Skeleton or Selected Joints.
4
Click Coloring on to color the joints according to the colors assigned to the skin point sets.
5
In Bind Method, click Closest Point.
6
At the bottom of the Bind Skin Options window, click Bind. The geometry binds to the skeleton. Maya puts the geometry’s points (CVs or vertices) into skin point sets, and each set is controlled by the jointCluster of the closest joint. The jointCluster name will correspond to the name of its joint. For example, if a joint is named elbow, the corresponding jointCluster will be named elbowCluster1.
286
Using Maya: Animation
Skinning Skeletons Binding by partition set When you first bind the skin, all cluster percentages will be set to 1.0, giving the skin a rigid look around the joints. You can apply lattice or jointCluster flexors to smooth the transition about the joints, or modify the cluster percentages directly using the Set Editor. Note that because the skin is bound to the skeleton, the skin’s transformation attributes are locked. If you try to manipulate the transformation attributes, the manipulator appears gray, indicating the attributes are locked. If you decide you want to modify the geometry that you’ve bound to the skeleton as its skin, you must first unbind the skin from the skeleton. After you’ve modified the geometry, you can then rebind it to the skeleton. 7
Binding by partition set In binding by partition set, Maya binds a geometry’s existing partition sets to a skeleton. The number of sets should equal the number of joints with bones. For information on creating partitions in Maya, see Using Maya: Hypergraph, Sets, and Expressions.
To bind by partition set: 1
Select the geometry and the skeleton or the specific joints to you wish to bind.
2
Select Skinning→Bind Skin-❐ The Bind Skin Options window is displayed.
3
In Bind to, choose Complete Skeleton or Selected Joints.
4
Click Coloring on to color the joints according to the colors assigned to the skin point sets.
5
In Bind Method, click Partition Set. In the Partition window, select the name of the partition you wish to bind. Only partitions composed of point sets are valid for binding by partition. Default Maya partitions such as the renderPartition and layerPartition are not valid for binding since they contain sets of objects, not points.
6
At the bottom of the Bind Skin Options window, click Bind.
Using Maya: Animation
287
Character Animation
Exercise the skeleton to see how the skin point sets have been created. Note how the skin point sets move with the joints to which they are bound. You might want to edit skin point set membership. To edit set membership, see Using Maya: Hypergraph, Sets, and Expressions.
Skinning Skeletons Binding multiple objects as skin Maya binds the selected partition’s sets to the skeleton, with each set bound to the nearest joint. Note that because the skin is bound to the skeleton, the skin’s transformation attributes are locked. If you try to manipulate the transformation attributes, the manipulator appears gray, indicating the attributes are locked. If you decide you want to modify the model that you’ve bound to the skeleton as its skin, you must first unbind the skin from the skeleton. After you’ve modified the geometry, you can then rebind it to the skeleton. 7
Exercise the skeleton to see how the skin point sets have been created. Note how the skin point sets move with the joints to which they are bound. You might want to edit skin point set membership. To edit set membership, see Using Maya: Hypergraph, Sets, and Expressions.
Binding multiple objects as skin Maya allows you to bind many objects as skin. You can attach new objects as skin at any time. There are two ways to attach additional objects to a skeleton which already has a bound skin: using the bind skin menu, or using set editing tools.
Binding additional objects with the Bind Skin menu: When you add new objects as skin, the skeleton must be in the same position that was in when you bound the original skin. This position is called the bind pose. The following section contains more details on returning the skeleton to the bind pose. Once the the skeleton is at the bind pose, follow the bind by closest point instructions to bind additional skins to the skeleton.
Binding additional objects using set membership: A second way to attach new skins is with the Set Editor by adding points to existing jointClusters. If you choose to attach new skins with set editing tools, note that if the skeleton is not at the bind pose, the new skins will immediately be deformed by the skeleton as soon as they are added to the jointCluster’s set. If this deformation is not desired, move the skeleton to the bind pose before adding the points into the jointCluster’s set.
288
Using Maya: Animation
Skinning Skeletons Returning to bind pose
Returning to bind pose The pose a skeleton is in during skinning is called the bind pose. When you pose a character, the skeleton’s action causes skin deformations. The only pose that does not cause skin deformations is the bind pose; when the skeleton is in the bind pose, the skin is in the same shape that it was in when it was a geometry. Yo will want to return the skeleton to the bind pose before binding new skin geometries. You will also want to return the skeleton to the bind pose before adding lattice flexors.
To return a skeleton to its bind pose: Select any joint on the skeleton.
2
Choose Skinning→Go to Bind Pose. The skeleton assumes the pose it had during skinning, when the geometry was bound to the skeleton. If possible, the skeleton assumes the pose it had during skinning, when the geometry was bound to the skeleton. It may not be possible for Maya to move the skeleton to the bind pose. Constraints, keyframed IK Handles, IK Handles using the spline solver, locked attributes and expressions can all create situations where a skeleton is unable to go to the bind pose. If the skeleton is unable to move to the bind pose, you will receive an error message saying: Error: Could not reach bindPose due to constraints, expressions, or keyframed handles. When this happens, a quick way to allow the skeleton to reach the bind pose, is to disable the source of the conflict:
3
Choose Modify→Disable Nodes→All. Maya only stores the bind pose for joints which have skin attached. It is best to always bind skin from the top-down so that there are no joints above the bound skin that do not have skin attached. Otherwise, going to the bind pose may cause your skeleton or skin to become distorted. For this reason , it is best to have all of the skeleton and skins displayed when you go to the bind pose. If either the skeleton or the skins are distorted, undo, and consider resetting the skeleton’s bind pose to a new position.
To reset a skeleton’s bind pose: You might want to reset a skeleton’s bind pose. You can do so as follows:
Using Maya: Animation
289
Character Animation
1
Skinning Skeletons Displaying skin point set colors 1
Select any joint on the skeleton.
2
Choose Skinning→Preserve Skin Groups→Detach Skeleton. The skin on the skeleton will move its undeformed position. If the undeformed position is not appropriate for the new bind pose, position the skin based on the new bind pose.
3
Choose Skinning→Preserve Skin Groups→Reattach Skeleton. The new bind pose will be set at the current postion of the skeleton.
Displaying skin point set colors Maya assigns each skin point set a color. When the points (CVs or vertices) in a skin point set are displayed, the points are displayed in the assigned color.
To display the skin point set colors: 1
Select the skin.
2
If the skin is from a NURBS geometry, choose Display→ NURBS Components →CVs. If the skin is from a polygonal geometry, choose Display→Polygon Components→Vertices. If the skin is a lattice geometry, choose Display→Object Components→Lattice Points.
Editing skin point sets You can edit skin point sets by using the Set Editor. For information about the Set Editor, please refer to Using Maya: Hypergraph, Sets, and Expressions.
Detaching and reattaching skin Occasionally, you might want to modify the skeleton, reset the bind pose, or do some further modeling on the skin. To do so, you first need to detach the skin from the skeleton. When you finish editing the skeleton or modeling the skin, you can reattach the skin to the skeleton. You can detach the skin in two modes:
290
•
Detach
•
Preserve Skin Groups - Detach
Using Maya: Animation
Skinning Skeletons Detaching and reattaching skin Typical reasons for using Detach include the following: •
You no longer want the geometry to act as a skin.
•
You plan to change the topology of the skin geometry before reattaching.
•
You want to reset the skin groups and percentage values to their default. Typical reasons for using Preserve Skin Groups - Detach include the following:
•
You do not want to lose the current skin groups and percentage values.
•
You want to reset the bind pose on the skeleton.
•
You want to modify the skeletal hierarchy.
Detaching skin without preserving skin groups and percentages To detach skin without perserving skin groups and percentages: 1
Select the skin(s) you want to unbind.
2
Choose Skinning→Detach Skin. The Detach Skin Options window is displayed.
3
From History, choose Delete History, Keep History, or Bake History. The Delete History option will unbind the skin, move it to its undeformed position, and delete any unused jointClusters. The Keep History option will unbind the skin, and move it to its undeformed position, but will not delete unused jointClusters. The Bake History option will unbind the skin without moving it to its undeformed position, and delete unused jointClusters.
4
Click the Coloring check-box to set whether to remove joint colors.
5
At the bottom of the Detach Skin Options window, choose Detach to detach the skin. Unless you use the Bake History option, the skin will move to its uneformed location. The skin’s transformation attributes (translate,rotate, and scale) will be unlocked. Unused jointCluster’s in the skin’s history will be deleted unless you use the Keep History option. Using Maya: Animation
291
Character Animation
Important: In order to reattach the skin while preserving skin groups, you must detach the skin in preserve skin groups mode. If you detach the skin using the standard detach option, you must reattach the skin by reperforming the bind skin operation.
Skinning Skeletons Animating with skin and skeleton groups
Detaching skin while preserving skin groups and percentages To detach skin while preserving skin groups and percentages: 1
Select a joint in the skeleton or explicitly select the joints which you wish to detach.
2
Choose Skinning→Preserve Skin Groups→Detach Skeleton or Skinning→Preserve Skin Groups→Detach Selected Joints based on how much of the skeleton you wish to detach. The skin affected by the detached joints will move to its undeformed position. Its transformation attributes (translate, rotate, and scale) will be unlocked so that you can reposition it. To reattach the skin with its old percentages and groups, use the Preserve Skin Groups - Reattach technique.
Reattaching skin while preserving skin groups and percentages You can only reattach the skin using this method if you detach the skin using the Preserve Skin Groups - Detach options. If you detach the skin using the Detach Skin method, your skin groups and percentages were deleted so you should the basic Bind Skin operation to reattach the skin.
To reattach skin while preserving skin groups and percentages: 1
Select the skeleton or explicitly select the joints which you wish to reattach.
2
Choose Skinning→Preserve Skin Groups→Reattach Skeleton or Skinning→Preserve Skin Groups→Reattach Selected Joints based on how much of the skeleton you wish to reattach.
Animating with skin and skeleton groups After skinning, create a group for your character that includes the character’s skeleton and skin. Having a group that includes everything that your character consists of can greatly ease the management of the character within an animation, particularly when you have many characters in an animation. You can easily view everything a character’s group can include from the Hypergraph. For more information on using the Hypergraph, please see Using Maya: Hypergraph, Sets, and Expressions.
292
Using Maya: Animation
Skinning Skeletons Animating with skin and skeleton groups
To group skin and skeleton: 1
Select a skeleton and its skin.
2
Choose Edit→Group. A group for the character is created. Note that this group node should only be used for organizational purposes. It should not be used to translate, rotate, or scale the character. Moving the group node causes the skin to get doubly transformed since it is transformed once by the skeleton and a second time by the group node.
Character Animation
Using Maya: Animation
293
Skinning Skeletons Animating with skin and skeleton groups
294
Using Maya: Animation
14
Using Flexors Maya offers a wide variety of deformer tools for creating deformations. Flexors are high-level deformer tools for deforming a skeleton’s skin; their effects can be linked to the actions of the skeleton.
Character Animation
For more information about Maya’s basic deformer tools, please see Using Maya: Animation, Basic Deformers. This chapter describes flexors. Using flexors includes the following: •
“Understanding flexors” on page 296
•
“Creating lattice flexors” on page 301
•
“Positioning lattice flexors after creation” on page 302
•
“Editing joint lattice flexor attributes” on page 302
•
“Editing bone lattice flexor attributes” on page 313
•
“Creating sculpt flexors” on page 324
•
“Editing sculpt flexor attributes” on page 325 Using Maya: Animation
295
Using Flexors Understanding flexors •
“Joint-driven sculpting” on page 325
•
“Creating cluster flexors” on page 326
•
“Editing cluster flexor attributes” on page 328
•
“Editing with cluster flexor manipulators” on page 328
Understanding flexors Flexors are high-level deformers that deform skin based on how a skeleton moves. There are three types of flexors: •
Lattice flexors (joint lattice flexors and bone lattice flexors)
•
Sculpt flexors (joint sculpt flexors and bone sculpt flexors)
•
Cluster flexors (joint cluster flexors only)
Lattice flexors Lattice flexors are tools for deforming the skin around joints and the bones of joints. They can smooth or wrinkle skin around joints and provide muscle definition around bones. You could use a joint lattice flexor to ease and smooth the skin around a joint as it bends, or you could use a bone lattice flexor to show bulging muscles around the bones of joints.
296
Using Maya: Animation
Using Flexors Understanding flexors
Character Animation
Skin bending around joint without lattice flexor (note creases)
Using Maya: Animation
297
Using Flexors Understanding flexors
Skin bending around joint with lattice flexor (note smoothed crease)
Sculpt flexors Sculpt flexors provide a way to create various types of bulges and dips in a character’s skin.
298
Using Maya: Animation
Using Flexors Understanding flexors
Character Animation Sculpt flexors are ideal for deformations such as muscle bulges, knee cap action, or elbow cap action. You can create sculpt flexors at joints (joint sculpt flexors) or at the bones of joints (bone sculpt flexors).
Cluster flexors Cluster flexors can provide realistic smoothing effects by allowing you to control the points in a skin point set around a joint with varying percentages of influence.
Using Maya: Animation
299
Using Flexors Understanding flexors
To understand cluster flexors, you need some background on the role of the basic cluster deformers in the skinning process. When you skin a skeleton, the skin points are organized into a partition of sets called skin point sets. A skin point set is created to correspond to each joint and bone combination. Also automatically created for each skin point set is one of Maya’s basic deformers, the cluster deformer. Cluster deformers that enable skinning are called joint cluster deformers. A joint cluster deformer is what glues a skin point set to a joint-and-bone combination so that the skin moves with the skeleton. A joint cluster deformer is like a basic cluster deformer except that it acts specifically on a skin point set. (For more information on basic cluster deformers, please refer to Using Maya: Animation, Basic Deformers.) Cluster flexors are high-level tools that provide you with a way to manipulate joint cluster deformers. Cluster flexors can be created only at joints (joint cluster flexors only) because they control joint cluster deformers.
300
Using Maya: Animation
Using Flexors Creating lattice flexors
Creating lattice flexors Lattice flexors create a lattice deformer around a joint (joint lattice flexor) or bone (bone lattice flexor). The flexor’s effect on the skin around the joint or bone can be driven by the action of a joint. When you create a lattice flexor, the lattice’s reset (base) position corresponds to the bind pose. To edit a joint lattice flexor, see “Editing joint lattice flexor attributes” on page 302. To edit a bone lattice flexor, see “Editing bone lattice flexor attributes” on page 313. Character Animation
To create a lattice flexor at a joint or bone: 1
Put the skeleton in bind pose by clicking any joint or bone and choosing Skinning→Go to Bind Pose. It’s possible to create a flexor on a skeleton that’s not in the bind pose, but it’s not recommended—you might get unexpected results.
2
Select the joint or joints on which you want to create a joint flexor. To create a bone flexor, select the parent joint of the bone. To create flexors on all joints or bones, select any joint on the skeleton.
3
Choose Skinning→Create Flexor... . The Create Flexor window is displayed.
4
From the Flexor Type: pull-down menu, choose lattice.
5
To create one or more joint lattice flexors, use the Joints box. In the Joints box, click At Selected Joint(s) to create flexors only at the selected joints, or click At All Joint(s) to create flexors at all the skeleton’s joints.
6
To create one or more bone lattice flexors, use the Bones box. In the Bones box, click At Selected Bone(s) to create flexors only at the bones of the selected parent joints, or click At All Bone(s) to create flexors for all the bones.
7
To specify the divisions of the lattice, use the Lattice Options box. The default is 2 S divisions, 5 T divisions, and 2 U divisions. You can enter new numbers for the divisions or use the sliders. The greater the number of divisions, the smoother the deformation effect; the smaller the number of divisions, the faster the performance.
Using Maya: Animation
301
Using Flexors Positioning lattice flexors after creation 8
Click Position the flexor if you want to adjust the location of the lattice flexor before closing the Create Flexor window.
9
If you would like to move, rotate, or scale the flexor without worrying about deforming the skin, you can do so now. Click Position the Flexor. Then choose one of the transform tools (move, rotate, or scale) and change the flexor’s position.
10 To create the lattice flexor(s), click OK. Once you have created the lattice flexors, you edit them to control how they deform the skin. To edit joint lattice flexors, see “Editing joint lattice flexor attributes” on page 302. To edit bone lattice flexors, see “Editing bone lattice flexor attributes” on page 313.
Positioning lattice flexors after creation To position a lattice flexor after creation: 1
Put the skeleton in bind pose by selecting it and choosing Skinning→Go to Bind Pose.
2
Select the lattice group from the Outliner. The lattice group is the highest-level lattice in the Outliner. If you open this lattice (the default name is lattice followed by a number), you’ll see the lattice that deforms the skin underneath it (the default name is deformed followed by a number).
3
Select a transform tool. The manipulator of the selected tool appears on the lattice.
4
Move the lattice with the manipulator.
Editing joint lattice flexor attributes The attributes of joint lattice flexors control how the flexors deform the skin around joints. Use the Attribute Editor to edit joint lattice flexor attributes. Editing joint lattice flexor attributes includes:
302
•
“Viewing joint lattice flexor attributes” on page 303
•
“Renaming joint lattice flexors” on page 303
•
“Editing rounding” on page 305
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes •
“Editing creasing” on page 303
•
“Editing length in” on page 306
•
“Editing length out” on page 308
•
“Editing width left” on page 310
•
“Editing width right” on page 311
Viewing joint lattice flexor attributes To view joint lattice flexor attributes: 1
Make sure the skeleton is not in the bind pose.
2
Select a joint lattice flexor.
3
Choose Window→Attribute Editor... . The Attribute Editor is displayed. In the Attribute Editor, you can modify the attributes of lattice flexors on joints to create specific effects.
Renaming joint lattice flexors By default, joint lattice flexors are given the name “jointFlexor” with a number added at the end. You can change the default name. Using names that describe the purpose of the lattice flexor can be helpful when you have a complex character with many flexors.
To rename a joint lattice flexor: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In the flexorShape: field, enter a new name.
Editing creasing The creasing attribute affects the bulging of a joint’s point groups on the inside of a bend. When you enter a creasing value, the flexor points on the inside of the bend move inward or outward to change the shape of the bulge. •
A positive creasing value causes the skin to bulge outward.
•
A negative creasing value causes the skin to tuck inward. Using Maya: Animation
303
Character Animation
Flexors don’t deform skin in the bind pose. To see the effects of flexors, you must view the skeleton in another pose.
Using Flexors Editing joint lattice flexor attributes The following figures illustrate positive and negative creasing.
Positive creasing effect with joint lattice flexor
Negative creasing effect with joint lattice flexor
To edit creasing: 1
304
View the joint lattice flexor’s attributes in the Attribute Editor.
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes 2
In Creasing, enter a new value or use the slider. Note that you can also edit the creasing attribute from the Channel Box.
Editing rounding Rounding affects the bulging of a joint’s point groups on the outside of a bend. When you enter a rounding value, the flexor points on the outside of the bend move outward or inward to change the shape of the bulge. •
A positive rounding value causes the skin to bulge outward.
•
A negative rounding value causes the skin to bulge inward. Character Animation
The following figures illustrate positive and negative rounding:
Positive rounding effect with joint lattice flexor
Using Maya: Animation
305
Using Flexors Editing joint lattice flexor attributes
Negative rounding effect with joint lattice flexor
To edit rounding: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Rounding, enter a new value or use the slider. A positive rounding value causes the skin to bulge outward, and a negative rounding value causes the skin to bulge inward. Note that you can also edit the rounding attribute from the Channel Box.
Editing length in The Length In attribute affects the locations of flexor points along the joint’s point group around the upper bone. When you enter a Length In value, the flexor planes along the upper bone move away from or towards the joint.
306
•
A positive Length In value causes the lattices to move away from the joint, spreading the bend effect up the upper bone.
•
A negative Length In value causes the lattices to move towards the joint, making the bend effect more local to the joint.
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes When you change the Length In value, you modify the regions affected by the round, crease, and width effects. The following figures illustrate positive and negative length in effects.
Character Animation
Positive length in effect with joint lattice flexor
Negative length in effect with joint lattice flexor Using Maya: Animation
307
Using Flexors Editing joint lattice flexor attributes
To edit length in: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Length In, enter a new value or use the slider. A positive value causes the deformation to spread farther up the bone towards the joint’s parent joint. A negative value causes the deformation to concentrate towards the joint. Note that you can also edit the length in attribute from the Channel Box.
Editing length out The Length Out attribute affects the locations of flexor points along the joint’s point group around the lower bone. When you enter a Length Out value, the lattices along the lower bone move away from or towards the joint. •
A positive Length Out value causes the flexor lattices to move away from the joint, spreading the bend effect down the lower bone.
•
A negative Length Out value causes the flexor lattices to move towards the joint, making the bend effect more local to the joint. When you change the Length Out value, you modify the regions affected by the round, crease, and width effects. The following figures illustrate postive and negative length out effects.
308
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes
Character Animation
Positive length out effect with joint lattice flexor
Negative length out effect with joint lattice flexor
Using Maya: Animation
309
Using Flexors Editing joint lattice flexor attributes
To edit length out: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Length Out, enter a new value or use the slider. A positive value causes the deformation to spread farther down the joint’s bone. A negative value causes the deformation to concentrate towards the joint. Note that you can also edit the length out attribute from the Channel Box.
Editing width left The Width Left attribute affects the bulging of a joint’s point groups on the left side of a bend. When you enter a Width Left value, the flexor points on the left side of the bend move outward or inward to change the shape of the bulge. •
A positive Width Left value causes the skin to bulge outward.
•
A negative Width Left value causes the skin to bulge inward. The following figures illustrate positive and negative width left effects.
Positive width left effect with joint lattice flexor
310
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes
Character Animation
Negative width left effect with joint lattice flexor
To edit width left: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Width Left, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width left attribute from the Channel Box.
Editing width right Width Right affects the bulging of a joint’s point groups on the right side of a bend. When you enter a Width Right value, the flexor points on the right side of the bend move inward or outward to change the shape of the bulge. •
A positive Width Right value causes the skin to bulge outward.
•
A negative Width Right value causes the skin to bulge inward. The following figures illustrate positive and negative width right effects.
Using Maya: Animation
311
Using Flexors Editing joint lattice flexor attributes
Positive width right effect with joint lattice flexor
Negative width right effect with joint lattice flexor
To edit width right: 1
312
View the joint lattice flexor’s attributes in the Attribute Editor.
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes 2
In Width Right, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width right attribute from the Channel Box.
Editing bone lattice flexor attributes To edit bone lattice flexor attributes, use the Attributes Editor. Editing bone lattice flexor attributes includes: “Viewing bone lattice flexor attributes” on page 313
•
“Renaming bone lattice flexors” on page 314
•
“Editing length in” on page 314
•
“Editing length out” on page 316
•
“Editing width left” on page 318
•
“Editing width right” on page 311
•
“Editing bicep” on page 321
•
“Editing tricep” on page 322
Character Animation
•
Viewing bone lattice flexor attributes To view bone lattice flexor attributes: 1
Make sure the skeleton is not in the bind pose. Flexors don’t deform skin in the bind pose. To see the effects of flexors, you must view the skeleton in another pose.
2
Select a bone lattice flexor.
3
Choose Windows→Attribute Editor... . The Attribute Editor is displayed. In the Attribute Editor, you can modify attributes of lattice flexors on bones to create specific effects.
Using Maya: Animation
313
Using Flexors Editing bone lattice flexor attributes
Renaming bone lattice flexors By default, bone lattice flexors are given the name “boneFlexor” with a number added at the end. You can change the default name. Using names that describe the purpose of the lattice flexor can be helpful when you have a complex character with many flexors.
To rename a bone lattice flexor: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In the flexorShape: field, enter a new name.
Editing length in The Length In attribute affects the locations of flexor points along the bone’s point group. When you enter a Length In value, the flexor planes move away from or towards the center of the bone. •
A positive Length In value causes the lattices to move away from the center, spreading the bend effect to a greater area of the bone.
•
A negative Length In value causes the lattices to move towards the center, making the bend effect more localized. By changing the Length In value, you can lengthen or shorten the bulging created by the other deformation parameters. The following figures illustrate no effect, positive length in effect, and negative length in effect.
314
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Character Animation
No length in effect with bone lattice flexor
Positive length in effect with bone lattice flexor
Using Maya: Animation
315
Using Flexors Editing bone lattice flexor attributes
Negative length in effect with bone lattice flexor
To edit length in: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Length In, enter a new value or use the slider. A positive value causes the deformation to spread away from the center of the bone. A negative value causes the deformation to concentrate towards the center of the bone. Note that you can also edit the length in attribute from the Channel Box.
Editing length out The Length Out attribute affects the locations of flexor points along the bone’s point group. When you enter a Length Out value, the flexor planes move away from or towards the center of the bone. •
A positive Length Out value causes the lattices to move away from the center, spreading the bend effect to a greater area of the bone.
•
A negative Length Out value causes the lattices to move towards the center, making the bend effect more localized. By changing the Length Out value, you can lengthen or shorten the bulging created by other deformation parameters.
316
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes The following figures illustrate positive and negative length out effects.
Character Animation
Positive length out effect with bone lattice flexor
Negative length out effect with bone lattice flexor
Using Maya: Animation
317
Using Flexors Editing bone lattice flexor attributes
To edit length out: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Length Out, enter a new value or use the slider. A positive value causes the deformation to spread away from the center of the bone. A negative value causes the deformation to concentrate towards the center of the bone. Note that you can also edit the length out attribute from the Channel Box.
Editing width left Width Left affects the bulging of a bone’s point group on the left side of a bend. When you enter a Width Left value, the flexor points on the left side of the bend move outward or inward to change the shape of the bulge. •
A positive Width Left value causes the skin to bulge outward.
•
A negative Width Left value causes the skin to bulge inward. The following illustrate positive and negative width left effects.
Positive width left effect with bone lattice flexor
318
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Character Animation
Negative width left effect with bone lattice flexor
To edit width left: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Width Left, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width left attribute from the Channel Box.
Editing width right Width Right affects the bulging of a bone’s point group on the right side of a bend. When you enter a Width Right value, the flexor points on the right side of the bend move inward or outward to change the shape of the bulge. •
A positive Width Right value causes the skin to bulge outward.
•
A negative Width Right value causes the skin to bulge inward. The following figures illustrate positive and negative width right effects.
Using Maya: Animation
319
Using Flexors Editing bone lattice flexor attributes
Positive width right effect with bone lattice flexor
Negative width right effect with bone lattice flexor
To edit width right: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Width Right, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width right attribute from the Channel Box.
320
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Editing bicep Bicep affects the bulging of a bone’s point group on the inside of a bend. When you enter a Bicep value, the flexor points on the inside of the bend move outward or inward to change the shape of the bulge. •
A positive Bicep value causes the skin to bulge outward.
•
A negative Bicep value causes the skin to bulge inward. The following illustrate positive and negative bicep effects.
Character Animation
Positive bicep effect with bone lattice flexor
Using Maya: Animation
321
Using Flexors Editing bone lattice flexor attributes
Negative bicep effect with bone lattice flexor
To edit bicep: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In the Attribute Editor, choose Extra Attributes.
3
In Bicep, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the bicep attribute from the Channel Box.
Editing tricep The Tricep attribute affects the bulging of a bone’s point group on the outside of a bend. When you enter a Tricep value, the flexor points on the outside of the bend move outward or inward to change the shape of the bulge. •
A positive Tricep value causes the skin to bulge outward.
•
A negative Tricep value causes the skin to bulge inward. The following illustrate positive and negative tricep effects.
322
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Character Animation
Positive tricep effect with bone lattice flexor
Negative tricep effect with bone lattice flexor
To edit tricep: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In the Attribute Editor, choose Extra Attributes.
Using Maya: Animation
323
Using Flexors Creating sculpt flexors 3
In Tricep, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the tricep attribute from the Channel Box.
Creating sculpt flexors You can create sculpt flexors at joints (joint sculpt flexors) or at the bones of joints (bone sculpt flexors). You can use sculpt flexors to make skin slide more realistically over a joint, or use them on bones to create bulges or dips as the joint moves.
To create a sculpt flexor: 1
Put the skeleton in bind pose by selecting any joint and choosing Skinning→Go to Bind Pose. It’s possible to create a sculpt flexor on a skeleton that’s not in the bind pose, but it’s not recommended—you might get unexpected results.
2
324
Select the joint or joints on which you want to create the flexor. If you want to create a bone sculpt flexor, select the bone’s parent joint. To create flexors on all joints or bones, select any joint of the skeleton.
Using Maya: Animation
Using Flexors Editing sculpt flexor attributes 3
Select Skinning→Create Flexor. The Create Flexor window is displayed.
4
From the Flexor Type: pull-down menu, choose sculpt.
5
Click the boxes under Joints and Bones to indicate where you want to position the flexor or flexors: at selected joints or all joints, and at selected bones or all bones.
6
Set the Max Displacement, Dropoff Distance, Dropoff Type, Mode, and Inside Mode options as you would for a basic sculpt object. These options are described in Using Maya: Animation, Basic Deformers.
7
Click OK to create the flexors on the joints and bones you indicated.
Editing sculpt flexor attributes To edit sculpt flexors: 1
Select the flexor you want to modify.
2
Open the Attribute Editor by selecting Window→Attributes. The sculpt flexor’s attributes are displayed.
3
Change the attributes as desired. These attributes are described in Using Maya: Animation, Basic Deformers.
Joint-driven sculpting To have a joint’s attributes drive the sculpt deformation, use the Set Driven Key tool. (For more information on Set Driven Key, please refer to Using Maya: Animation, Keyframe.)
To set joint-driven sculpting: 1
Put the skeleton in bind pose by selecting any joint and choosing Skinning→ Go to Bind Pose.
2
Select the sculpt flexor.
3
Select Keyframe→Set Driven Key... .
Using Maya: Animation
325
Character Animation
Once you have created the sculpt flexors, you manipulate them to deform the skin when the joints move. See “Joint-driven sculpting” on page 325.
Using Flexors Creating cluster flexors The Set Driven Key window is displayed. A default driver and driver attribute are loaded for you. The driver is the joint whose motion controls the animation of the sculpt deformation. The Attribute is the transform of driver joint that the sculpt deformation is specifically keyed to. Driver attributes include the following: autoGuide
The guide axis (or axes) correspond to the axes the joint is permitted to rotate in (based on the Joint Limits setting in the Attribute Editor). Auto Guide is the default and works well in most cases.
rotateX
The guide axis is the joint’s X-axis.
rotateY
The guide axis is the joint’s Y-axis.
rotateZ
The guide axis is the joint’s Z-axis.
maxXYZ
The guide axes are the joint’s X-, Y-, and Z-axes.
4
In the browser, select the attribute you want to animate.
5
Set the key by clicking Key. The key for the bind position of the character is created.
6
Select the handle of the joint chain, move the joint chain, and continue setting keys by clicking Key.
Creating cluster flexors Cluster flexors allow you to control how smoothly skin moves around joints during posing and animating.
326
Using Maya: Animation
Using Flexors Creating cluster flexors
Character Animation During skinning, cluster deformers are automatically created to bind skin point sets to joints. These cluster deformers that bind skin point sets to joints are called joint clusters. Joint clusters indicate their deformation effects on skin point sets by their drop-off values. The drop-off values are percentage values that indicate the range and magnitude of the deformation effects. By controlling the range and magnitude of drop-off, you can control the smoothness of skin around a joint. Cluster flexors provide a way for you to manipulate the drop-off directly. Rather than having to specify actual values for the percentages, you can use the cluster flexor’s manipulators to edit the deformation effects.
To create a cluster flexor: 1
Put the skeleton in bind pose by selecting any joint and choosing Skinning→Go to Bind Pose.
2
Select the joint (or joints) on which you want to create the flexor.
3
Choose Skinning→Create Flexor... . The Create Flexor window is displayed.
4
From the Flexor Type: pull-down menu, choose jointCluster.
Using Maya: Animation
327
Using Flexors Editing cluster flexor attributes 5
Click the boxes under Joints to indicate where you want to position the flexor or flexors: at selected joints or at all joints. Except for simple cases, you will probably want to adjust the cluster to position it and change the percentages for the best effect on the skin bending around the joint.
6
Click Create. Cluster flexors are created at the selected joints.
7
Open the Hypergraph by choosing Window→Hypergraph... . The Hypergraph will indicate the cluster flexor(s) as a “jointFlexor” with a number appended. The number indicates the order in which the flexors have been created. When you select the cluster flexor, note that a “J” is displayed near the cluster flexor’s joint.
Editing cluster flexor attributes To edit cluster flexors: 1
Select the cluster flexor you want to edit.
2
Open the Attribute Editor by selecting Window→Attribute Editor... . In the Attribute Editor, you can edit the attributes of the cluster flexor, the cluster flexor’s shape, and the joint cluster deformer (the cluster deformer that binds skin point sets to joints). The cluster flexor’s attributes folder is identified as “jointFlexorn,” the cluster flexor’s shape attributes folder is identified as “jointFlexor_Shape,” and the joint cluster deformer (the cluster deformer that binds skin point sets to joints) attributes folder is identified as “JointnClustern.”
3
Edit the attributes as desired. Note that the attributes of cluster deformers are described in Using Maya: Animation, Basic Deformers.
Editing with cluster flexor manipulators You can use the cluster flexor’s manipulators to edit the deformation effects of joint clusters. A cluster flexor’s manipulators include of pair of rings.
328
Using Maya: Animation
Using Flexors Editing with cluster flexor manipulators
Character Animation
Cluster flexor manipulator rings Each ring includes two manipulators: a diamond manipulator and a radial manipulator.
Using Maya: Animation
329
Using Flexors Editing with cluster flexor manipulators
Diamond manipulator
Diamond manipulator (selected) Located at the center of the ring, the diamond manipulator controls the range of smoothing. The diamond manipulator controls the range of dropoff of the joint clusters acting on the skin point sets bound to the current joint and the current joint’s parent joint.
330
Using Maya: Animation
Using Flexors Editing with cluster flexor manipulators
Radial manipulator
Character Animation
Radial manipulator (selected) Located on the ring, the radial manipulator controls the magnitude of smoothing. The radial manipulator controls the magnitude of drop-off of the joint clusters acting on the skin point sets bound to the current joint and the current joint’s parent joint.
To edit with the cluster flexor manipulators: 1
If you have just created the cluster flexor, you need to choose to have the cluster flexor manipulators displayed. In the Hypergraph, select the cluster flexor (identified as “jointFlexorn”). Open the Attribute Editor; from Display, click on Display Handle. A cross-shaped mark is displayed at the center of the joint, near the “J” that identifies the cluster flexor.
2
Select the joint with the Show Manipulator Tool. The cluster flexor manipulators are displayed.
3
Be sure the joint is not in the bind pose. Flexors do not provide deformation effects when the skeleton is in the bind pose. By having the joint in some other pose, you can see the effects of your editing.
4
To edit the range of smoothing, select one of the diamond manipulators.
5
Use the left mouse button to click and drag the diamond manipulator towards or away from the joint. The range of smoothing changes as you drag the manipulator. Using Maya: Animation
331
Using Flexors Editing with cluster flexor manipulators 6
To edit the magnitude of smoothing, select one of the radial manipulators.
7
Use the left mouse button to click and drag the radial manipulator towards or away from the joint. The magnitude of smoothing changes as you drag the manipulator. Note that you can also edit the drop-off values of joint clusters from the Attribute Editor. The Upper Value of the current joint’s joint cluster and Lower Value of the parent joint’s joint cluster are controlled by radial manipulators. The Upper Bound of the current joint’s joint cluster and Lower Bound of the parent joint’s joint cluster are controlled by the diamond manipulators. For total smoothing, the values, which are expressed as percentages, should be equal 100. Editing which skin points are in which skin point sets can also help to control smoothing effects.
332
Using Maya: Animation
Index
A
C
D
animating characters 11, 27 IK chains 124 keyframing 124 motion capture 125 necks, tails, spines 103 with skin and skeleton groups 136 attributes editing joints 55 setting IK spline handle 115 Auto Create Curve 113 Auto Create Root Axis 112, 122 Auto Joint Limits 54 Auto Joint Orient 53 Auto Parent Curve 122 Auto Simplify Curve 113 Autopriority 87
characters animating 27 deforming 25 flexors 25 geometry 12 modeling 12 skeletons 14 skinning 22, 127 child joints 16, 33 closest point binding by 130 cluster flexors 25, 143 creating 171 editing attributes 172 editing with manipulators 175 manipulators 172 Connect Joint 46 control vertices (CVs) 22 creating cluster flexors 171 IK chains 83 IK handles 82 IK spline handle 103 joint chains 36 joints 36 lattice flexors 145 parent transform with IK spline 112 sculpt flexors 168 Curve Editing Tool 105 curves auto-creating with IK spline handle 113 auto-simplifying with IK spline handle 113 IK spline handle 103 transforming IK handle 109
dampening joints 67 Degrees of Freedom 52, 60 dependency graph loops IK spline 112, 119 diamond manipulator 173 Disconnect Joint 49
B
end effectors 76, 79 displaying 84 end joints 35, 74, 76, 78
F fish animating with IK spline 118, 122 flexors 25, 140 cluster flexors 25, 143 lattice flexors 25, 140 sculpt flexors 25, 142 flipping eliminating in rotate plane (RP) solver IK handles 101 preventing IK spline start joint 116 flipping in motion path preventing IK spline start joint 117 forward kinematics 20, 70
Index
ball joints 52, 60 Bicep deformation 165 bind pose 133 reseting 133 returing to 133 binding by closest point 130 binding by partition set 131 binding multiple objects 132 bone lattice flexors 145 bones 14 bone lattice flexors 145 compensating scale 54, 64
E
G geometry 12 skin 22 skinning 127 Using Maya: Modeling
333
Index
goal displaying 84 goal’s axis displaying 84 goals 77, 79
H handle vectors 77, 79 handle wires 76, 78 human spines IK spline handle 120
I IK chains 35 animating 124 Autopriority 87 creating 83 posing 100 IK handles 14, 20, 35, 74 Autopriority 87 creating 82 editing attributes 94 editing display 96 editing limits 96 end joints 74 Priority 89 setting creation options 85 setting PO weight 90 setting weight 89 Snap Enable 88 Solver Enable 88 start joints 74 Sticky 89 IK solvers 21, 35, 75 editing attributes 97 IK spline solvers 81 multi-chain (MC) solvers 81 rotate plane (RP) solvers 77 single chain (SC) solvers 75
334
Using Maya: Modeling
IK spline handle 103 animating sinuous motion 122 auto-creating curve 113 auto-parenting curve 112 creating 103 curve 103 human spines 120 manipulating curve CVs 105, 119 motion path 117 offset 108 parenting to transform or joint 118 rolling 106 selecting 107 setting keys 106 sliding joint chain 107 snapping curve to start joint 113 soft body on curve 118 tail, back, and neck 121 tips for using 118 tool options 109 twisting 106 IK systems 98 accessing 99 creating 98 renaming 99 viewing available IK solvers 99 Insert Joint Tool 41 inverse kinematics 20, 70
J joint chain planes 79 joint chains 17, 33 adding to 37 creating 36 inserting joints 41 limbs 17
joint cluster points 23 joint clusters 23 joint lattice flexors 145 joint limits 64 Joint Orient 63 Joint Tool 36 joints 14, 32 Auto Joint Limits 54 Auto Joint Orient 53 ball joints 52 child joints 16, 33 compensating scale 54, 64 dampening 67 Degrees of Freedom 52, 60 disconnecting 49 editing attributes 55 editing joint limits 64 end joints 35, 74 inserting 41 joint chains 17, 33 joint lattice flexors 145 Joint Orient 63 limbs 34 local axis orientation 63 parent joints 16, 33 positioning 40 Preferred Angle 61 removing 42 renaming 58 resizing display 40 root joints 18, 32 Rotate Damp Range 68 Rotate Damp Strength 68 Scale Compensate 54 Segment Scale Compensate 64 setting creation options 50 start joint 35 start joints 74 Stiffness 62
Index
K
N
keyframing 124 minimum keys 124 using Channel Box 124 kinematics 70
Number of Spans 113, 114
L lattice flexors 25, 140 bone lattice flexors 145 creating 145 editing bone lattice flexor attributes 157 editing joint lattice flexor attributes 146 joint lattice flexors 145 positioning 146 Length in deformation 150, 158 Length out deformation 152, 160 limbs 17, 34 mirroring 45 limits joint limits 64
M
offset IK spline handle 108 overlapping IK spline handle joints 119
P parent joints 16, 33 partition set binding by 131 partitions 22 pelvic region positioning skeleton root in 123 plane indicators 80 PO weight 90 points 22 skin point sets 22 skin points 22 pole vector’s axis displaying 84 pole vectors 80 posing IK chains 100 sticky posing 102 Power Animator IK spline twisting in Maya 114 Preferred Angle 61 Priority 89
R radial manipulator 173
S Scale Compensate 54 sculpt flexors 25, 142 creating 168 editing attributes 169 joint-driven sculpting 169 seals animating with IK spline 122 Segment Scale Compensate 64 selecting IK spline handle 107
Using Maya: Modeling
335
Index
Mirror 45 Mirror Across 45 Mirror Joint 45 mirroring 43 modeling 12 motion capture 125 motion paths IK spline handle 117 moving start joint off IK spline curve 111 multi-chain (MC) solvers 81 activating 87
O
reference planes 80 Remove Joint 42 Reroot Skeleton 50 rerooting skeletons 50 rolling IK spline handle 106 root joints 18, 32 Root on Curve 107 Root Twist Mode 114 Rotate Damp Range 68 Rotate Damp Strength 68 rotate plane (RP) solvers 77 behavior 81 end effectors 79 end joints 78 goals 79 handle vectors 79 handle wires 78 joint chain planes 79 plane indicators 80 pole vectors 80 reference planes 80 rotation discs 80 start joints 78 twist discs 80 rotation discs 80 Rounding deformation 149
Index
setting keys IK spline handle 106 single chain (SC) solvers 75 behavior 77 end effectors 76 end joints 76 goals 77 handle vectors 77 handle wires 76 start joints 76 sinuous motion IK spline handle 122 skeletons 14, 32 animating 14 building 14, 31 combining 46 construction strategies 50 disconnecting 49 flexors 25 mirroring 45 posing 14 rerooting 50 skinning 22, 127 viewing hierarchy outline 39 skin binding 127 skin point sets 22 skin point sets 22 displaying colors 134 editing 134 skin points 22 skinning 22, 127 binding by closest point 130 binding by partition set 131 binding multiple objects 132 detaching skin 134 reattaching skin 134 sliding joint chain along curve 107 snakes animating with IK spline 118, 122
336
Using Maya: Modeling
Snap Curve To Root 113 Snap Enable 88 Solver Enable 88 IK spline handle 115 spline solvers 81 start joint flipping in motion path 117 preventing IK spline 116 start joints 35, 74, 76, 78 stickiness 102 Sticky 89 sticky posing 102 Stiffness 62
T tips building skeletons with grid 32 IK chain length 35 IK chains with rotate plane (RP) solvers 81 IK chains with single chain (SC) solvers 77 IK spline handle creation 118 skeletons with many limbs 34 using mirroring to create limbs 43 tool options IK spline handle 109 transforming IK spline handle curve 109 Tricep deformation 166 twist discs 80 displaying 84 Twist Type 115 twisting IK spline handle 106
V vertices 22
W Width left deformation 154, 162 Width right deformation 155, 163
Z zero rotation IK spline joint orientation 116
Books24x7 Mastering MAYA Complete 2
Mastering Maya Complete 2 Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Mastering Maya Complete 2 Cete Courtesy of: P0WDER, bookmarks added by crystal_fish John Kundert-Gibbs Peter Lee Associate Publisher: Cheryl Applewood Contracts and Licensing Manager: Kristine O Callaghan Acquisitions & Developmental Editor: Cheryl Applewood Editors: James A. Compton, Marilyn Smith, Jeff Gammon, Pat Coleman, Pete Gaughan Project Editor: James A. Compton Technical Editors: Mark Smith, Mike Stivers Book Designers: Patrick Dintino, Catalin Dulfu, Franz Baumhackl Graphic Illustration: Publication Services Electronic Publishing Specialists: Robin Kibby, Grey Magauran, Nila Nichols Project Team Leader: Lisa Reardon Proofreaders: Jennifer Campbell, Molly Glover Indexer: Nancy Guenther Companion CD Compilation: Mark Smith Companion CD Production: Keith McNeil, Kara Schwartz, Ginger Warner Cover Designer: Design Site
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=1 (1 of 5) [11/27/2000 9:38:55 PM]
Books24x7 Mastering MAYA Complete 2
Cover Illustrator: Sergie Loobkoff Copyright © 2000 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights reserved. No part of this publication may be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph, magnetic or other record, without the prior agreement and written permission of the publisher. Copyright © 2000 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights reserved. The authors created reusable Maya scripts and project files in this publication expressly for reuse by readers. Sybex grants readers permission to reuse for any purpose the code found in this publication or its accompanying CD-ROM so long as authors are attributed in any application containing the reusable code and the code itself is never distributed, posted online by electronic transmission, sold or commercially exploited as a stand-alone product. Aside from this specific exception concerning reusable scripts and project files, no part of this publication may be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph, magnetic or other record, without the prior agreement and written permission of the publisher. SYBEX is a registered trademark of SYBEX Inc. Mastering is a trademark of SYBEX Inc. Screen reproductions produced with Collage Complete. Collage Complete is a trademark of Inner Media Inc. The CD Interface music is from GIRA Sound AURIA Music Library © GIRA Sound 1996. Interviews of Duncan Brinsmead and Mark Sylvester, courtesy of Alias|Wavefront, a division of Silicon Graphics Limited. © 1999 Silicon Graphics Limited. Used by permission. All rights reserved. Maya is a registered trademark of Silicon Graphics Inc. exclusively used by Alias|Wavefront, a division of Silicon Graphics Limited, and Paint Effects is a trademark of Alias|Wavefront, a division of Silicon Graphics Limited. TRADEMARKS: SYBEX has attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following the capitalization style used by the manufacturer. The author and publisher have made their best efforts to prepare this book, and the content is based upon final release software whenever possible. Portions of the manuscript may be based upon pre-release versions supplied by software manufacturer(s). The author and the publisher make no representation or warranties of any kind with regard to the completeness or accuracy of the contents herein and accept no liability of any kind including but not limited to performance, merchantability, fitness for any particular purpose, or any losses or damages of any kind caused or alleged to be caused directly or indirectly from this book. Library of Congress Card Number: 99-66406 ISBN: 0-7821-2521-2 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=1 (2 of 5) [11/27/2000 9:38:55 PM]
Books24x7 Mastering MAYA Complete 2
Software License Agreement: Terms and Conditions The media and/or any online materials accompanying this book that are available now or in the future contain programs and/or text files (the Software ) to be used in connection with the book. SYBEX hereby grants to you a license to use the Software, subject to the terms that follow. Your purchase, acceptance, or use of the Software will constitute your acceptance of such terms. The Software compilation is the property of SYBEX unless otherwise indicated and is protected by copyright to SYBEX or other copyright owner(s) as indicated in the media files (the Owner(s) ). You are hereby granted a single-user license to use the Software for your personal, noncommercial use only. You may not reproduce, sell, distribute, publish, circulate, or commercially exploit the Software, or any portion thereof, without the written consent of SYBEX and the specific copyright owner(s) of any component software included on this media. In the event that the Software or components include specific license requirements or end-user agreements, statements of condition, disclaimers, limitations or warranties ( End-User License ), those End-User Licenses supersede the terms and conditions herein as to that particular Software component. Your purchase, acceptance, or use of the Software will constitute your acceptance of such End-User Licenses. By purchase, use or acceptance of the Software you further agree to comply with all export laws and regulations of the United States as such laws and regulations may exist from time to time. Software Support Components of the supplemental Software and any offers associated with them may be supported by the specific Owner(s) of that material but they are not supported by SYBEX. Information regarding any available support may be obtained from the Owner(s) using the information provided in the appropriate read.me files or listed elsewhere on the media. Should the manufacturer(s) or other Owner(s) cease to offer support or decline to honor any offer, SYBEX bears no responsibility. This notice concerning support for the Software is provided for your information only. SYBEX is not the agent or principal of the Owner(s), and SYBEX is in no way responsible for providing any support for the Software, nor is it liable or responsible for any support provided, or not provided, by the Owner(s). Warranty SYBEX warrants the enclosed media to be free of physical defects for a period of ninety (90) days after purchase. The Software is not available from SYBEX in any other form or media than that enclosed herein or posted to www.sybex.com. If you discover a defect in the media during this warranty period, you may obtain a replacement of identical format at no charge by sending the defective media, postage prepaid, with proof of purchase to: SYBEX Inc. Customer Service Department 1151 Marina Village Parkway Alameda, CA 94501 (510) 523-8233 Fax: (510) 523-2373 e-mail: [email protected] WEB: HTTP://WWW.SYBEX.COM After the 90-day period, you can obtain replacement media of identical format by sending us the defective disk, proof of purchase, and a check or money order for $10, payable to SYBEX.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=1 (3 of 5) [11/27/2000 9:38:55 PM]
Books24x7 Mastering MAYA Complete 2
Disclaimer SYBEX makes no warranty or representation, either expressed or implied, with respect to the Software or its contents, quality, performance, merchantability, or fitness for a particular purpose. In no event will SYBEX, its distributors, or dealers be liable to you or any other party for direct, indirect, special, incidental, consequential, or other damages arising out of the use of or inability to use the Software or its contents even if advised of the possibility of such damage. In the event that the Software includes an online update feature, SYBEX further disclaims any obligation to provide this feature for any specific duration other than the initial posting. The exclusion of implied warranties is not permitted by some states. Therefore, the above exclusion may not apply to you. This warranty provides you with specific legal rights; there may be other rights that you may have that vary from state to state. The pricing of the book with the Software by SYBEX reflects the allocation of risk and limitations on liability contained in this agreement of Terms and Conditions. Shareware Distribution This Software may contain various programs that are distributed as shareware. Copyright laws apply to both shareware and ordinary commercial software, and the copyright Owner(s) retains all rights. If you try a shareware program and continue using it, you are expected to register it. Individual programs differ on details of trial periods, registration, and payment. Please observe the requirements stated in appropriate files. Copy Protection The Software in whole or in part may or may not be copy-protected or encrypted. However, in all cases, reselling or redistributing these files without authorization is expressly forbidden except as specifically provided for by the Owner(s) therein. To our families and friends (especially Philip, Michele, Kristin, Joshua, and Kenlee), whose love, insight and countless hours of sacrifice have made this book possible.
Acknowledgments A book like this doesn t appear by smoke and mirrors, but by the hard work and dedication of a great number of people. While everyone who had any part in this book deserves credit, we have room to mention only a special few. First, we d like to thank the hard-working, inspired people at Alias|Wavefront for making such fantastic tools for us. We are especially indebted to Chris Ford, Mark Sylvester, Duncan Brinsmead, Russell Owen, Jackie Farrell, Sharon Zamora, Mike Stivers, Katriona Lord-Levins, Tracy Hawken, and Vic Fina. Their contributions to this book have been invaluable. We are privileged to thank Ellen Pasternack and Habib Zargarpour from Industrial Light & Magic, who were always willing to help, and went beyond the call of duty with their time and effort, and also Don Davidson of New Jersey Newsphotos, for his eternal faith and patience. We would also like to thank the acquisitions, editorial, and production team assembled by Sybex for their insightful, timely, and professional management of the evolving work, especially Jim Compton, Cheryl Applewood, Mark Smith, and Adrienne Crew. Marilyn Smith, Jeff Gammon, Pat Coleman, and Pete Gaughan also contributed greatly to the editing. On the production side, Robin Kibby, Lisa Reardon, Teresa Trego, Molly Glover, and Jennifer Campbell displayed their usual skill and resourcefulness in turning the edited manuscript into a finished book. Keith McNeil, Kara Schwartz, and Ginger Warner made the companion CD-ROM a reality.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=1 (4 of 5) [11/27/2000 9:38:55 PM]
Books24x7 Mastering MAYA Complete 2
Thanks also to our agency, Studio B Literary Agency, who made the contracts go smoothly and were our champions from day one, especially Neil Salkind and Sherry Rogelberg. Without the generous support and freedom our employers have given us, this book could never have been written. A special thanks to Richard Silver of Cambridge Electronics and the staff at The Lighthouse. We would also like to thank the faculty and staff of two fine universities, California Lutheran University, and the University of North Carolina at Asheville, especially the late Dr. Jonathon Boe, Michael Arndt, Mike Adams, Joan Wines, Tom Cochran, and Jim Pitts. Our loved ones have been with us throughout this book s production, and have given their time and energy to this work as much as we have. From this large group, we would like to give special thanks to Joan and Lee Gibbs, Michele Harovas, Marilyn Harovas, and the late Philip Harovas, Peter Lee s parents, Melanie and Jim Davis, and Kristin, Joshua, and Kenlee Kundert-Gibbs.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=1 (5 of 5) [11/27/2000 9:38:55 PM]
Books24x7 Mastering MAYA Complete 2
Mastering Maya Complete 2 Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Foreword Welcome to the wonderful world of Maya. Little did I realize fifteen years ago that I would be writing the foreword to a book about a product that is the result of an idea I had in 1984 to do something with computers and art. I can imagine how excited you must be. You have the book, the software, and a hot computer; and now you are going to get busy and educate yourself in the many disciplines that it takes to be an accomplished Maya animator. Good luck to you. The investment you are about to make in yourself is worth every minute you put into it and every hour, week, weekend, and holiday that you work through as you babysit that final render or rush to make a 9 a.m. deadline. There are thousands of people just like you who have dedicated themselves to becoming world-class experts at Maya. This book is now a part of your continuing education program. When we started Wavefront in 1984, we had a vision of how an artist would use our tools to create amazing images. That vision attracted many like-minded people to our way of doing things. Coincidentally, during that same spring in 1984, two other companies were having the same conversations: in Paris the early developers of Explore from Thomson Digital Images (TDI), and in Toronto the founding team at Alias Research. Each of the companies had attracted like-minded artists and animators that gravitated to our approach to the computer graphics problem. Now those various methodologies, features, functions, and workflows are represented in our next-generation application, Maya. Maya is the combination and, in many ways, a culmination of hundreds of man years of effort at creating a computer graphics system that meets the demanding requirements of users from the ultrahigh-end film studios to the start-up animation companies that are springing up in garages around the planet. Maya effectively brings together the best thinking of all three systems plus new technologies, workflow, and usability features that were impossible to imagine fifteen years ago. There is a lot here to learn. Nevertheless, diligence, patience, and an open attitude will help you succeed as you go through the exercises in this book. Challenge yourself.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=756847364 (1 of 3) [11/27/2000 9:39:15 PM]
Books24x7 Mastering MAYA Complete 2
Learning Maya is a lot like learning the Japanese game of GO. They say it takes minutes to learn and a lifetime to master. You can get through the Alias|Wavefront tutorials in a couple of days. However, that just gets you to beginner status. You obviously want to improve your skills beyond this you purchased Mastering Maya Complete 2 to move beyond Maya s beginning tutorials. Your ability to utilize the skills that you learn in this book in creative ways will enable you to develop unique solutions to your future graphics problems. It is only after years of grappling with tough visual problems that you achieve expert status. Remember, there are usually more than a few ways to solve the same problem within Maya. Everything can be combined with everything else, and this is one of the most powerful aspects of the software. This book will get you acquainted with Maya Complete Version 2. When we started work on Maya in 1995, after the merger of Alias and Wavefront, we wanted to deliver a software system that would change the way computer animation was created by challenging established ways of working even those we pioneered ourselves. In Version 1, we set our goals high, and we met most of them. Version 2 now completes our original design plans for the software and its architecture. Software is never actually done, just as a great painting always seems to need just a little more if I only had the time. I had the chance to review a few of chapters of this book while they were still being edited, somewhat like getting a look at Alpha software. The great thing about a book not written by a product s manufacturer is that certain liberties can be taken by the authors. They can have fun with the lessons and their comments. I am sure you will appreciate the tone the book uses as you are led though lessons that will reinforce your knowledge of each of the various aspects of Maya. The lessons build upon themselves, which is great for taking you through the process incrementally. I have always enjoyed learning this way. The best part of the book is the enclosed CD. This way, you know you have a safety net; if you make a mistake, you can always reload the lesson examples. Once you have gotten a good feel for the software and its potential, it will be time to meet others who share your enthusiasm for Maya. Internet news groups, online chats, Maya rings, and the various Alias|Wavefront and Maya Web sites are all good forums to meet others and discuss specific aspects of the software, its uses, and how much this book helped you in getting more out of the software. I encourage you to take time regularly to interact with other users. See if there is a user group in your community and make sure you plan a trip to Siggraph each year for the Global Users Association s annual meeting. Well, enough about how great life will be once you have learned Maya; it is time to get to work and start exercising your gray cells. I hope that this book becomes just one more part of your investment in lifelong learning and continuing education. This is just the beginning. Have fun. I still do every day! Ride the wave, Mark Sylvester Ambassador Alias|Wavefront Santa Barbara, California November, 1999
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=756847364 (2 of 3) [11/27/2000 9:39:15 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=756847364 (3 of 3) [11/27/2000 9:39:15 PM]
Books24x7 Mastering MAYA Complete 2
Introduction Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Introduction Maya a word full of mystery, wonder, and power. It conjures up all sorts of imagery. Not coincidentally, so does the software, which can be a magical imaging tool. But as with any other tool, making magic requires an artist who knows the proper way to use that tool. In Mastering Maya Complete 2, you will learn how to use Maya to create images that the rest of us have never seen before. How can we be sure of that? Because you are unique, with your own life experiences, point of view, and artistic flair. We can guarantee that no one has seen the images you will create, because they come from YOU. The point to reading this book is to give yourself the knowledge you need to use this tool called Maya to the best of your ability. Then, and only then, will the imagery you create come closer to what you see in your mind.
What You Will Learn from This Book Maya Complete is an incredibly rich, full-featured 3D graphics and animation program that encapsulates tremendous computational power. As you ll see in this book, Maya s dynamics engines literally put the laws of physics at your fingertips to make objects behave in perfectly realistic ways or not-so-realistic, if that s where your imagination takes you. Maya presents this power through a user interface that is both logical and consistent enough for you to learn quickly and flexible enough to adapt to the needs of any user or project. Mastering Maya Complete 2 is a comprehensive, practical guide to every aspect of the program. You ll begin with a tour of the user interface and its tools for optimizing your workflow. Then you ll learn the basics of computer modeling and the major types of modeling available in Maya: NURBS, polygon, and organic. You ll work through the stages of animation and rendering, and you ll learn to use the MEL scripting language. In the last group of chapters, you ll work with some of Maya s most advanced tools, including its particle dynamics. Finally, you ll be introduced to the amazing Paint Effects module, which is new in Maya 2.5.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383714714 (1 of 2) [11/27/2000 9:39:22 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383714714 (2 of 2) [11/27/2000 9:39:22 PM]
Books24x7 Mastering MAYA Complete 2
Introduction Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What s the Best Way to Use This Book? Mastering Maya 2 Complete is not just a reference manual. As working animators and 3D artists, we knew from the beginning that simply marching through the menus and dialog boxes would not be an effective way for you to learn how to use the software or for us to share our insights and experiences. We knew that hands-on is always the best approach for learning software, and nowhere is that more true than with 3D modeling and animation. So we ve built each chapter around examples and tutorials that let you try out each new feature as you re studying it. To implement this approach, we ve created a fully integrated book and CD-ROM. The companion CD includes working files Maya project files, sketches, TIF images, and MEL scripts that will get you started with each exercise, as well as rendered images and animations you can use to check your progress as you go. (The CD also includes some illustrations that are best viewed in color, and bonus material, as described at the back of the book.) Nearly every exercise is intended to create production-quality finished work, but most of them can be done by anyone who has a little experience with 3D software and some patience and persistence. You don t need to be an accomplished draftsperson, but you do need to work with care. And you should be willing to step away from a project and come back to it when you are ready. A few exercises are intended for more advanced users and are identified that way. Even though some projects begin in one chapter and continue in another, you don t need to read the whole book straight through from beginning to end. (Of course, we like to think that once you start, you ll find it hard to stop.) As with any how-to book, you can focus on the subjects that interest you or the tasks you need to accomplish first, particularly if you are already working at an intermediate level.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=820620853 [11/27/2000 9:39:33 PM]
Books24x7 Mastering MAYA Complete 2
Introduction Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Who Should Read This Book This book is intended for a range of Maya users, from beginners to experts, but we expect that most readers will be in the advanced beginner or intermediate range. We assume that most people who invest in a professional-quality 3D graphics program (and the hardware to run it) have already begun working with some modeling/animation software and now want to hone their skills and take advantage of the breakthroughs in software technology that Maya makes available. You may be working in a production environment already, or in a training program, or working in a related field and preparing to make the jump to 3D modeling and animation. Of course, few people are experts in all things; so everyone should be able to learn something useful or cool here, or at least learn a new way of doing things. If you are a relative beginner, or if you are self-taught and feel that your background in the fundamentals has a few holes in it, you should start from the beginning and work through the first half of the book. Here you will learn how to create a human model from the ground up, texture it, add a skeletal control system (IK) to it, and animate and render it. You will also learn how to populate your world with objects that behave as they do in the real world. Users at the intermediate level will find plenty of interest beyond the fundamentals. Two chapters introduce the MEL scripting language, giving you enough of a foundation to get started learning how to harness the full power of Maya and make the software handle repetitive operations for you. As you ll see, you don t need to learn the entire scripting language in order to customize your workspace for automation and efficiency. The last five chapters provide an in-depth look at the advanced topic of particle dynamics and a hands-on introduction to Maya s newest and most powerful tool, Paint Effects. In fact, if you re beyond the absolute beginner stage, you can find valuable information in practically every chapter. Scan through the Table of Contents to find the topics you re most interested in, or check the What s New in Maya 2 notes to see what new features are covered in a chapter. Again, everyone who tries out the exercises will find a wealth of fun, useful, educational, and sometimes dazzling projects. Note As an added attraction, and to inspire you to create dazzling work of your own, we ve collected 16 pages of some of the most beautiful color illustrations created in Maya. You ll see artwork developed in the exercises, along with pictures and animation stills created by the authors and other Maya artists, with hints about the Maya tools they used.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=410442342 (1 of 2) [11/27/2000 9:39:39 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=410442342 (2 of 2) [11/27/2000 9:39:39 PM]
Books24x7 Mastering MAYA Complete 2
Introduction Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
How This Book Is Organized Depending on your interests and skill level, you can either study each chapter from beginning to end or start with what you need to know first. Here s a quick guide to what each part and chapter covers. Part I: Maya Fundamentals introduces Maya and its tools with the following topics: Chapter 1: Your First Maya Animation uses a hands-on example building and launching a rocket ship to introduce the basic elements of Maya: modeling, texturing, lighting, animation, dynamics and rendering. This provides a good foundation if you aren t accustomed to using Maya. Next we explore the Maya interface further in Chapter 2: The Maya Interface. We look in depth at the elements that make up models and windows, and the various menus and interfaces you ll work with. In Chapter 3: Techniques for Speeding Up Workflow, we introduce Maya tools that allow you to work efficiently, with the largest amount of screen real estate and in the fastest way. Chapter 4: The Hypergraph: Your Roadmap to a Scene shows how the Hypergraph (or dependency graph) gives Maya its power. The Hypergraph is the heart of Maya, bringing together all of its elements. Don t underestimate its power and simplicity. Part II: Modeling offers a detailed exploration of Maya s modeling techniques: Chapter 5: Modeling Basics uses simple objects to introduce basic modeling concepts and Maya s way of implementing them. The example projects are a great way to learn about construction history. In Chapter 6: NURBS Modeling we open up the world of NURBS modeling, showing what elements make up a NURBS surface, how to edit them, and finally how to apply these concepts by modeling an aftershave bottle. As we introduce more tools, you ll create a more advanced aftershave bottle, and finally a human face.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=849101359 (1 of 3) [11/27/2000 9:39:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7: Polygon Modeling explores the basic ingredients that make up a polygonal model and how to edit them. Extrusions, UV mapping, edge smoothing and model smoothing are also explored. The hands-on project is the creation of a human hand in polygons. All the work you ve done so far leads up to Chapter 8: Organic Modeling. In this chapter, we show you how to take a dog from a sketch to a finished model. Chapter 9: Working with Artisan, is a guided tour of Artisan. You ll learn why it s such a useful set of tools and what you can do with it besides just denting your models, and you ll get a preview of MEL scripting in Artisan s MEL script painting function. Part III: Animation shows how to add motion to models you ve created: In Chapter 10: Animating in Maya you will get started creating, controlling, and editing animation in Maya. We take our human model further by using Set Driven Keys to control our polygonal human hands fingers. In Chapter 11: Paths and Bones you are introduced to setting up skeletons correctly the first time, and you ll learn how to animate cameras and objects properly and quickly, with motion paths. Chapter 12: Deformers and Chapter 13: Skinning and Character Setup show you how to use deformers to add secondary animation to your Inverse Kinematics (IK) characters, and also how to use these deformers to create facial expressions and phonemes. Chapter 14: Character Animation: a Walk Cycle and More introduces and explains walk cycles, showing how to add emotion to your character s movements. You ll also learn how to animate run cycles, catching and throwing a ball, and more complex movements such as somersaults. In Chapter 15: Working with Rigid Body Dynamics you will learn what rigid bodies are and how to control them, how to use fields and forces for different results, and how to bake the animation when you are done, speeding up interactivity and ensuring that no discrepancies occur while batch rendering. Part IV: Working with MEL shows how to make the Maya Embedded Language work for you, even if you re not a programmer: Chapter 16: MEL Basics is a jumping-off point for beginning MEL users, ending with examples that put the theories into practice. Chapter 17: Programming with MEL takes MEL scripting further, showing you how to create, debug, and edit MEL scripts and MEL interfaces. Part V: Rendering takes you through the details of producing rendered images and animations: Chapter 18: Rendering Basics explores the way Maya defines a rendered image, how to use Interactive Photorealistic Rendering (IPR), image planes, and Depth of Field. You will also learn how to set up renders that allow for changes to be made quickly and without rerendering the entire animation. With Chapter 19: Shading and Texturing Surfaces you will learn how to texture surfaces right the first time, and how to create effects with layered shaders that would be hard or impossible without them. The examples used are those of texturing the dog model and the clothing and skin of the child model.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=849101359 (2 of 3) [11/27/2000 9:39:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20: Lighting examines the Maya lighting system, the shadow types available, effects you can add to lights, and proper studio lighting of your subjects. You will learn how to balance speed and quality with depth-mapped shadows and when to use raytraced shadows, as well as fog, light color, glows and halos. Part VI: Advanced Maya Effects extends your Maya skills to work with particles and soft bodies, as well as the new Paint Effects tool: In Chapter 21: Particle Basics we show you how and when to use particles, how to control them, and give you several examples of uses for them. Then, in Chapter 22: Particle Rendering, we show you the different ways to render particles, and why each has its own place in your rendering pipeline. With Chapter 23: Using Particle Expressions and Ramps we really get our hands wet with particles, as we show you how to add expressions to grow and move the particles, as well as to define their lifespan and what happens to them at death. Chapter 24: Dynamics of Soft Bodies takes the particle and rigid body knowledge you have gained, and puts it to use in soft body simulation. We cover Goal Weights, springs, contraints and more. The chapter concludes with two great uses of soft bodies: simulated water ripples from a fountain and a water tentacle out of science fiction. Chapter 25: Paint Effects takes you into the world of the newest Maya tool. You will learn what it can do and what its hundreds of attributes mean, to help you immediately understand and start using Paint Effects. The tutorial that ends the chapter takes you step-by-step into adding real hair to the child model, explaining how to approach it and why each step is taken. Finally, the Appendix offers some food for thought as Perry Harovas and John Kundert-Gibbs interview four of the leading lights in animation and computer graphics. You ll learn about how Maya was created and the challenges it may tackle next; how the new Paint Effects tool was developed; the philosophy behind the Maya user interface; and how Maya was used in the latest Star Wars movie.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=849101359 (3 of 3) [11/27/2000 9:39:51 PM]
Books24x7 Mastering MAYA Complete 2
Introduction Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hardware and Software Considerations Maya 2 Complete is available for both Windows NT and IRIX platforms. Alias|Wavefront has been able to implement the same feature set and user interface on both platforms, so all of the information in this book applies to both NT and IRIX. The CD-ROM accompanying this book, however, has been tested only on NT; so we cannot guarantee that all parts of it will work exactly as described on IRIX systems. Alias|Wavefront provides a Qualification Chart in the printed documentation and on its Web site (www.aliaswavefront.com/qual_charts), certifying particular combinations of processors, operating system versions, graphics cards, and drivers for operation with Maya NT. Be sure to check this chart for your configuration. Alias|Wavefront lists the following minimum hardware requirements for running Maya Complete on Windows NT; to work at a comfortable pace, you ll probably want more processor speed, RAM, and disk space: "
Pentium processor, at least 200MHz
"
128MB RAM
"
CD-ROM drive
"
High-performance graphics card. See the Qualification Chart for current recommendations.
"
Hardware lock provided by Alias|Wavefront with the Maya shipment
"
Three-button mouse with mouse driver software. The Microsoft Intellimouse is not supported in this release.
"
Sound card (optional)
"
Wacom tablet (optional)
"
Magellan Spaceball (optional)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=486589099 (1 of 2) [11/27/2000 9:40:04 PM]
Books24x7 Mastering MAYA Complete 2
"
Disk space as follows for an NTFS file system (for a FAT file system, space requirements would be approximately doubled)
"
220MB for Maya Complete
"
Up to 15MB temporary space on the C: drive to start the installation program
"
4 MB for Invigorator
"
45 MB for Fusion Lite
The minimum software requirments are as follows: "
Windows NT 4.0 (with Service Pack 5)
"
TCP/IP network protocol software (for Maya batch rendering and other features)
"
Web browser: Netscape Navigator 3.0 or Internet Explorer 3.0 (or higher)
"
Graphics card driver software (available from the card manufacturer s web site)
"
Appropriate driver software for optional hardware
"
Appropriate networking software and hardware if you plan to use and share files on IRIX workstations
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=486589099 (2 of 2) [11/27/2000 9:40:04 PM]
Books24x7 Mastering MAYA Complete 2
Introduction Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What s Next? By the time you finish this book, you ll be well on your way to mastery of Maya 2. A number of chapters offer suggestions for further reading related to animation and 3D graphics, and the accompanying CD contains links to some of the most important Web sites in the field. Be sure to check the sites maintained by Perry Harovas (www.lighthousepost.com) and Sybex (www.sybex.com) for updates and bonus material as Maya evolves. As you work through this book and begin exploring Maya on your own, you ll probably think of topics you d like us to cover further and other improvements we can make. You can use the Sybex Web site to provide feedback (click the Contact link and then the Book Content Issues link to display a form where you can type your comments) or send e-mail directly to Perry Harovas ([email protected]), John Kundert-Gibbs ([email protected]), or Peter Lee ([email protected]). Now it s up to you to make the most of the tools that Maya offers. Have fun, and remember that the most important tool is your own imagination!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675861958 [11/27/2000 9:40:16 PM]
Books24x7 Mastering MAYA Complete 2
Part I - Maya Fundamentals Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part I: Maya Fundamentals Chapter List Chapter 1: Your First Maya Animation Chapter 2: The Maya Interface Chapter 3: Techniques for Speeding Up Workflow Chapter 4: The Hypergraph Your Roadmap to a Scene
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=414647830 [11/27/2000 9:40:24 PM]
Books24x7 Mastering MAYA Complete 2
Part I - Maya Fundamentals Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part Overview Create your first Maya animation Use the Maya interface Speed up your workflow Use the Hypergraph tool effectively
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=899134115 [11/27/2000 9:40:31 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 1: Your First Maya Animation Overview Welcome to Mastering Maya 2 Complete! Although this book will give you a great deal of in-depth knowledge about all aspects of Maya Complete, if you re like us, you d probably like to get your feet wet before bothering with the nuts and bolts of the program. Well that s what this chapter is here for: you ll try out modeling, keyframing, texturing, and using Maya s built-in dynamics, all in one animation that shows off the power of Maya s interface and renderer. You ll also learn the basics of maneuvering around a Maya scene, and you ll start to see where adjusting various options would lead to different results. While we won t deal with theory or do a lot of explaining in this chapter (that s what the rest of the book is for!), if you follow along, you should get a very good idea of what Maya is about and how you can use it in your future endeavors. Before you start the animation in this chapter, take a few minutes to read through the Introduction to this book. It contains information that will make it easier to work through the tutorials, and it will give you an overview of how to best use the book to get the results you want. If you are already familiar with other 3D animation packages, going through this chapter should get you ready to use Maya proficiently. If you are new to the whole world of 3D animation, or if you would like a little more grounding in the fundamentals of Maya, you may want to read Chapters 2 and 3 before reading this chapter. Those two chapters will get you up to speed on both the Maya interface and many of the conventions of 3D animation. But enough talk let s do some animating!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=568545495 [11/27/2000 9:40:40 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Setting the Scene: Modeling In this chapter, we re going to build, texture, light, and animate a little rocket ship that takes off, loses power after a couple of seconds, and crashes back to earth. While this modeling and animation project is a bit simplified, it is definitely a real world example of work you can do in Maya. Don t get discouraged if things don t turn out well immediately (especially if you are new to 3D modeling and animation). Remember that you can return to this project as you progress through the book, refining your work. Given a bit of time and practice, you should be able to get this project looking very good even if you ve never done 3D work before! To give you an idea of what you re working toward, here s a still shot from the completed animation. (To get the full effect, see the Chapter 1 Color Gallery on the CD).
The first step to almost any animation in Maya is to build your scene elements; therefore, we ll build the rocket (and ground) as our first step. To build our little ship, we ll use just a couple of the many different modeling techniques Maya has available for you.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (1 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
1. First, let s create a project and save our file, so it has a home. Open Maya by double-clicking its desktop icon. Now, from the File menu, choose File Ø Project Ø New. In the New Project options window, click the Use Defaults button, type in a name for your project (something like rocketProject) in the Scene File Locations text box, and click Accept to accept these choices. You now have your project saved in your default directory on your hard drive. To save your actual scene, you need to choose File Ø Save Scene As, and then choose an appropriate name for the file (like rocket1.ma). Tip Your project consists of several folders (or directories) of information about the scene (which is where your scene file is stored), any rendering jobs, source images, output images, textures, and so forth. Whenever you first create a new scene in Maya, there are two steps to saving: first, save your project (which contains all the proper places for Maya to store your project s information), and then save the actual scene file. Warning Maya is based on the Unix operating system, which means you must never use spaces in your filenames even if you re running the NT version of Maya. If you do, Maya will give you an error when you try to open your scene later, and you won t be able to access your earlier work! The operating system will allow you to save according to its filename conventions, but Maya s file system won t recognize any names with spaces. Tip It is a very good idea to append a number to the name of every scene (for example, rocket1). As you work, you will want to save your scene often, in case you run into any problems, and, rather than just saving over your old scene, you should save a new scene each time, numbered sequentially (rocket2, rocket3, and so on). Every time you are told to save in this project, remember to save a new file with a higher number. If you are concerned about disk space on your hard drive, you can erase earlier versions of your project as you work through later ones. We generally save about 2. One you have saved your project and file, look over the interface for a moment (see Chapter 2 for a tour of the interface if you have never used Maya before). Then change your scene window from the default perspective view to a four view of the scene by first clicking in the scene (big) window and then pressing and releasing the spacebar quickly. Your scene window should change to four smaller panes, each labeled for its view angle (top, side, front and persp perspective). Select the side view by clicking your mouse inside this pane, then press and release the spacebar quickly again to make the side view take up the entire viewing pane.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (2 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
Note If switching between panes is difficult for you (or if you are completely new to Maya), you should read through Chapter 2 to learn about the Maya interface, before continuing in this chapter. To create the body of the rocket, we ll use an EP (Edit Point) curve tool to define four points that make up the rocket s outline, and then revolve this curve into a surface. 3. Pick the EP Curve tool (Create Ø EP Curve Tool); your cursor should turn into a cross, indicating that you re now using the EP Curve tool. Because we want the first (top) point of the curve to lie directly on the Y axis (the thick vertical line at the center of the pane), we need to turn on the snap to grid button before we create the first point on the curve click the Snap to Grid button on the Status Line in Maya (the topmost toolbar).
4. A little below the top of the window, where the X axis meets one of the other grid lines, click once (with your left mouse button) to create your first point. Now turn off the Snap to Grid button (click it again), and create three more points, approximately like the following image. If you hold down the mouse button when you click to create a point, you can move that point around until you like its positioning; you can also hit the backspace key to remove the last point you made. When you are satisfied with the shape of the ship, hit the Enter key to save the points (the curve will turn green). 5. Our next step is to create an actual surface from our outline. Be sure Modeling is showing on the Status Line (at the far left top of the screen). If not, choose it from the pop-up menu there. Now revolve the curve by choosing Surfaces Ø Revolve Ø. Tip The Ø symbol in Maya is known as an option box. Selecting this box with your mouse will open a window where you can change the options of your command in this case, the Revolve command. 6. In the Revolve options window, click the Reset button and then set the segments to 16 (instead of the default 8). Click the Revolve button and close the options window. You should now see your curve transformed into a squat looking rocket ship body! To see your rocket ship shaded, hit the 3 key (on the main keyboard; not the numeric keypad) and the 6 key the 3 key changes your view to high-resolution, while the 6 key turns on flat shading mode (instead of wire frame).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (3 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
7. Rename your object (shown in the Channel box, at the right of the main window) from revolvedSurface1 to something more appropriate, like body: click once on the name (revolvedSurface1) and type in your new name, replacing the old one. Save your work now.
Tip If you don t see the object name listed (and a Channels menu directly above it), try holding down the Ctrl key and pressing the A key. This should change your view to the Channel box view. Tip If something goes wrong on this or any step in the project, remember that you can always hit the Z (undo) key to move back one or more steps in your work.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (4 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
8. Now we need to build our rocket engine exhaust nozzle. We ll use the same method we learned to create the rocket itself: Choose the EP curve tool (or hit the Y key, which will reselect the last used tool for you), and then click several points in the shape of an exhaust cone.
Tip To make the size (scale) of the curve easier to see, try creating the exhaust nozzle directly below the rocket body. 9. When you are satisfied with the look of your exhaust nozzle, hit the Enter key and, while the engine is still selected (green), choose Surfaces Ø Revolve to revolve the engine (note that we don t have to use the options this time; this revolve operation will use the same options you set for the rocket body last time). Hit the 3 key to smooth out the view of the engine nozzle; then rename the object (in the Channel box) from revolvedSurface2 to nozzle and save your work. 10. We now need to move the engine into the base of the rocket. Choose the engine (if it s not green, click or drag a selection marquee on the engine be sure not to highlight the rocket body), then press the W key to bring up the Move tool. You should see several colored arrows (above the engine) around a yellow box. Click and drag up on the green arrow until the nozzle is where you want it to be.
Maya Shortcut Keys The QWERTY keys (across the top left of your keyboard) are shortcut keys. Memorize these keys now using shortcut keys is one secret to getting work done in Maya quickly! Here s the function for each one: " The Q key puts Maya into elements).
select
mode (where you can only select, not modify, scene
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (5 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
" The W key places Maya in Move mode. " The E key places Maya in Rotate mode. " The R key places Maya in Scale mode (not rotate mode!). " The T key places Maya in Manipulator mode (we won t deal with this tool in our work here). " Finally, the Y key places Maya in whatever mode besides Move, Scale, and Rotate was last chosen (the EP Curve Tool, in our work). 11. Now let s create a cockpit for our ship from a default sphere. Click the sphere (ball) button on your tool shelf, or choose Create Ø NURBS Primitives Ø Sphere (remember to press the 3 key to display the sphere in hi-res mode). You won t be able to see the sphere, as it is currently inside the rocket body, so change to Move mode (press the W key) and move the sphere to the right of the rocket body. Now change to scale mode (the R key) and stretch the sphere up until it is about twice as tall as it is thick, by pulling the green scale handle up. Finally, change back to Move mode (the W key) and move the sphere into position near the front end of the rocket body. Be sure to change the name of the object (in the Channel box) from nurbsSphere1 to cockpit, and save your work.
Note If you are not familiar with shelves, see Chapter 2 for an introduction to them. 12. No space ship would be complete without some fancy fins on it. We ll create one fin using a default cone, and then adjust its points to make it look more like a fin. Choose Create Ø Polygon Primitives Ø Cone Ø, set the Subdivisions along Height option to 5 (instead of 1), click Create and close the Cone Options window; then name the cone fin1. Set Maya to Move mode, and then move the cone out so it is below the cockpit. Now change to Rotate mode (the E key) and rotate the cone so it points away from the side of the ship. To do this, grab the outermost ring of the Rotate tool and drag to the right.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (6 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
13. The fin is almost correctly placed, but it s currently much too small. Change to scale mode (the R key), and then scale the whole cone out (click the yellow box in the center, and then drag to the right) until it is the right size. We re getting closer, but now the cone has been scaled out in all directions. To fix this, change to four-view mode (press the spacebar quickly), and, in front or top view, click on the red (X axis) scale button and scale the fin so it is thin in that dimension.
14. Now that the cone/fin is thin, return to the side view (click in the side view, and then press and release the spacebar). Highlight the fin so it is green; then press the F8 key to go into Component selection mode. Drag a selection marquee around the point at the tip (it will turn yellow), and then move that point down so it is about as low as the exhaust nozzle-don t worry that it looks very angular right now. Next, draw a selection marquee around the second row of points in from the tip (be sure to select only this row), and move them down some as well. Finally, choose the bottom set of points on the next two rows in (toward the body), and move them up a bit. You should now have a curved fin. Save your work.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (7 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
15. When you like the shape of the fin, press the F8 key again to return to Object mode. While the fin is nice, it could use some smoothing. Be sure the fin is still selected (green), and then choose Edit Polygons Ø Smooth to smooth out the angles between polygon facets. At this point, you might wish to move the fin in toward the body more, so there is no gap between the fin and body. 16. Great, we have one fin. Now we need to make two more. Rather than model these new fins, let s make Maya do the work. First, we need to move the pivot point of the fin (the point around which it rotates) to 0 on the X and Z axes, then we ll just tell Maya to make two duplicates and rotate them.
17. Click on the fin to highlight it, press the Insert key on your keyboard, click the blue handle (it may be difficult to see), and drag it to the center line. To see if the pivot point is close to 0, look at the feedback line (just above the scene panel) and watch the Z component move. Stop when you are as close to 0 as you can get. When the pivot point has been moved, press the Insert key again to return to Normal mode. 18. Now choose Edit Ø Duplicate Ø and, in the options window, click the Reset button, and then set Rotate Y (the middle box) to 120 (120 degrees, or one third of a circle), and Set Number of Copies to 2. Press Duplicate and close the window. You will now have three fins spaced evenly around the body of the ship Maya even names the other fins fin2 and fin3 for you! 19. As a last step, we need to make some ground for our rocket to take off from. Choose Create Ø NURBS Primitives Ø Plane Ø, click the Reset button (in the options window), and then set the Width to 1000 (so the ground is very big). Click Create and Close; then rename the plane ground. You ll note that the plane is right in the middle of the rocket. Using the Move tool, move the plane down until it is a significant distance below the ship don t let the rocket body, fins, or nozzle touch the plane, or you will have big problems later in this chapter!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (8 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
20. Now that we have all of our pieces, we need to get rid of the construction history for each of them, and then erase the curves that generated them (otherwise we ll have problems later on in the animation process). First, select everything in the scene (or RM choose Select All in the scene window); then choose Edit Ø Delete by Type Ø History. Now find the curves you used to build the body and nozzle of the rocket (you can choose any component of the rocket and then use the right and left arrow keys to scroll through all the components or you can use the outliner or hypergraph to find the curves). When you have each curve selected, just hit the Backspace key to delete it. Note If the phrase RM choose operations in Chapter 2.
is unfamiliar, see the list of Maya three-button mouse
21. As a last step, we need to make all our rocket components into one group (we ll call it rocket), and move the pivot point of our rocket down to the ground plane (the reason for this will be apparent as we animate the ship). 22. Drag a selection marquee around the ship and all its components (be sure not to include the ground, though!); then hold down the Ctrl key and press G. This creates a new group (called group1) that contains all the pieces of the rocket we have modeled. Rename this group rocket. Tip In the future, if you click on any component of the rocket (the body, say) and press the up-arrow key, Maya will automatically move up the group s hierarchy and choose the rocket group for you. 23. Be sure the rocket group is still selected (check to see that its name is showing in the Channel box); then press the Insert key. Move the pivot point down (using the green handle) until it is below the bottom of the nozzle. Moving the pivot point will be important when we animate the scale of the ship (otherwise the ship will scale around its middle, instead of its bottom). Be sure to press the Insert key again when you are done moving the pivot point. Save your work.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (9 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
24. Let s take a look at our handiwork. Change to perspective view in the scene panel (remember the spacebar trick), change to shaded mode (press the 6 key), and then rotate around your ship by holding down the Alt key and left mouse button (LM button) and dragging around the scene window.
If your results are very different from those you see in the book, you may wish to return to the area that is different and rework it until you are satisfied with the results. Save your work and take a break good job so far!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682783349 (10 of 10) [11/27/2000 8:18:49 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Texturing Your Models Using the Hypershade You might find the model you ve created so far a bit& well& gray. Let s remedy that situation now by adding materials to the different model elements, giving them a bit more color and interest. To create these materials, we ll use the new Hypershade in version 2 of Maya (if you have a copy of Maya 1, try to follow along as best you can using the Multilister instead of the hypershade). Note Materials in Maya are the general container for a shading network, which gives an object its color, transparency, reflectivity, and so forth. Normally, you create a material, then edit the material s settings or add textures (images or procedural textures) to it to get the look you want. Think of materials in Maya as your own virtual paint can. 1. Select the cockpit and then choose Window Ø Hypershade, opening the Hypershade window. 2. To create a new material, look down the left-hand side of the Hypershade until you find the Create section. Choose the Phong shader (the very center sphere) and, with your middle mouse button, drag (MM drag) the phong material into the window on the right. Name the window cockpitPhong by holding down the Ctrl key, double-clicking the default name (phong1), and then typing in the new name.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=772250977 (1 of 5) [11/27/2000 8:19:10 PM]
Books24x7 Mastering MAYA Complete 2
3. To assign this new material to the cockpit, just MM drag the material ball onto the cockpit in the scene window. Because the phong material is still gray, you won t see much difference yet. 4. To adjust the color of the new material, double-click it in the Hypershade. This will open the Attribute Editor (to the right of the scene panel or in its own floating window), with several options you can control for color and other attributes.
5. All we re interested in for the cockpit is its color. Click on the gray rectangle next to the word color, and, in the color picker that pops up, choose a very dark blue (almost black) color. You can watch the cockpit itself change as you adjust the color. When you get a color you like, click the Accept button. 6. Let s make another phong material for the body of the rocket. MM drag a phong material onto the right side of the Hypershade window, and then rename this material bodyPhong. Now MM drag the material ball onto the body of the rocket.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=772250977 (2 of 5) [11/27/2000 8:19:10 PM]
Books24x7 Mastering MAYA Complete 2
7. First, adjust the color of the new material to a very pale blue-gray (the color of brushed aluminum). To make this work right, you ll need to set the saturation of your color very low (we set it to 0.075). 8. When you accept the color, you ll probably notice that the highlights on the rocket body are big and ugly. Fortunately, we can compensate for this. In the Attribute Editor, set the Cosine Power (the size of the highlight) to a large number, like 75, and set the Specular color to a darker gray (drag the slider to the left). When you finish, you should have a more pleasing highlight. 9. To create the ground shade (we don t want a highlight on the ground!), let s use the lambert shader, which cannot create a highlight. MM drag a lambert material (top right) onto the right side of the Hypershade; then rename it groundLambert. Then MM drag the new material onto the ground plane, assigning it to the plane. 10. In the Attribute Editor, set the color of the ground plane to a dusty orange-yellow (a desert dirt color). 11. The last two materials we ll make will be a bit more interesting. First, let s create a material with a procedural texture for the nozzle. Create a new phong shader, name it nozzlePhong, and assign it to the nozzle. 12. Instead of assigning a color to the new material, click the little checkerboard next to it (to the right of the color slider). This will bring up the Create Render Node window. Click on the Checker button, and your material will have a checker pattern to it.
13. While this texture as it currently looks might be all right for playing checkers, it s not what we re after. In the Attribute Editor, make both of the colors in the checker pattern a shade of gray (drag the sliders next to the color swatches). Finally, decrease the Contrast setting to about 0.7. These changes will make the pattern much subtler. 14. Now click on the place2Dtexture1 tab (at the top of the Attribute Editor) and set the Repeat UV to 16 and 0.5, respectively. This will give the nozzle the ringed appearance common to rocket nozzles.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=772250977 (3 of 5) [11/27/2000 8:19:10 PM]
Books24x7 Mastering MAYA Complete 2
15. Finally, let s create the fin material, using a ramp to get our effect. First, create a new phong material (called finPhong), and assign it to all three fins you will probably have to rotate the scene panel in order to see all three fins so you can do this. 16. In the Attribute Editor, click the checker box next to Color again to bring up the Create Render Node window. Choose Ramp from the list of 2D textures. You should see a default ramp appear, and all the fins should have the colors applied to them.
17. While the smooth transitions of the default ramp are nice, they re not what we need for our fins. From the Interpolation pop-up menu, choose None. This turns off the smooth interpolation of the colors, making the ramp a series of color bars. 18. To change the ramp colors, select the ramp node (the circle to the left of the color bar) and then click on the Selected Color swatch to bring up the color picker. To create a new color node, just click in the color swatch where you want it. To move a color up or down, drag the circle on the left of the color bar. Finally, to remove a color, click on the box to the right of the color bar. You can use whatever colors you like for the ramp, but when you are finished, you should have something like the following.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=772250977 (4 of 5) [11/27/2000 8:19:10 PM]
Books24x7 Mastering MAYA Complete 2
We now have a fully textured ship and ground plane. While none of these materials is terribly complex, they give the ship some color, and add to the cartoonish feel of the world we re creating. To be able to see our ship when we render it, we ll next need to add some lights to the scene.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=772250977 (5 of 5) [11/27/2000 8:19:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Lighting the Scene To light this scene, we ll add four lights: one ambient light to shade the whole scene, and three spotlights. This lighting setup will give the scene a night-time quality, which is a bit more fun than one big light for the sun. Additionally, we ll make two of the lights track (or aim toward) the ship at all times. 1. First, let s create our ambient light. Select Rendering from the pop-up menu at the top left of the screen. Then, choose Lights Ø Create Ambient Light Ø. In the options box, set the intensity to 0.2, and then click Create and Close. Tip To see how the scene is lit so far, press the 7 key on your keyboard to go into lighted mode (the scene should be almost dark). Press the 6 key to return to flat shaded mode. 2. Now let s create our spotlights. From the shelf, choose Lights Ø Create Spot Light Ø. In the option window, click the Reset button, and then set the penumbra angle to 10 (this fades the edges of the spotlight). Click Create and Close. Rename this light frontSpot (if the Channel box isn t open, press Ctrl+A to toggle it back on). Press the W key to get into Move mode, and then move the light up and away from the ship, toward the camera. Be sure the light is above the rocket by a significant amount; otherwise, it won t light the ground below the ship (which gives depth and solidity to the scene).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=400094751 (1 of 3) [11/27/2000 8:19:32 PM]
Books24x7 Mastering MAYA Complete 2
Tip To move your lights, you will need to use the top and side views (use the spacebar to see these views), and scale these views out by holding down the Alt key, along with the left and middle mouse buttons, and dragging to the left in each window pane. 3. Because we want this spotlight to aim at the ship at all times, let s add an aim constraint to it. First, click on any part of the ship; then press the up-arrow key (be sure the Channel box says rocket in its title area). Then, holding down the Shift key, click (or drag around) the light, highlighting it as well. Finally, from the Animation menu set (choose Animation from the top-left pop-up menu), choose Constrain Ø Aim. The focus of the spotlight will now be locked onto the rocket, wherever it goes. 4. We now need to create another light, this one off to the right side of the ship. Create a new spotlight (Lights Ø Create Spot Light), call it rightSideSpot, and move it off to the right of (and above) the ship.
5. We want this light to follow the ship as well, so we ll do the same trick again: First, select the rocket (remember to press the up-arrow), then Shift+select the rightSideSpot light. Finally, choose Constrain Ø Aim to force the light to look at the ship. 6. Finally, let s create our last spotlight (which will stay pointed at the launch area). Once again, create a spotlight; then name the new light leftSideSpot, and move it to the left and above the rocket.
7. As we won t be auto-aiming the light, we ll need to do it manually. In the top view (with the light still selected), from the panel menu at the top of the top view panel, choose Panel Ø Look Through Selected to change the view to show what the light sees (nothing at this point). Rotate the view until the rocket is centered in the view (hold down the Alt key and drag with the left mouse button). To return to top view, choose Panel Ø Orthographic Ø Top.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=400094751 (2 of 3) [11/27/2000 8:19:32 PM]
Books24x7 Mastering MAYA Complete 2
8. To see how your scene is lit, press the 7 key again. It should be well (and evenly) lit across the ship and the ground near it. If not, try moving your lights around, or increasing their intensity. 9. Save your work and take a break. Good job so far! Tip It is often difficult to see how well lit your scene is using the flat (openGL) renderer. To get a better view of your scene, choose Render Ø Render into New Window from the Rendering menu set (the top-left pop-up menu). This will create a quick little rendering of your scene.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=400094751 (3 of 3) [11/27/2000 8:19:32 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Animating the Scene If things haven t been fun and interesting enough so far, we re really going to have fun here: We ll animate our little ship, and use some of the power of Maya s dynamics engine to bring it back to earth.
Keyframed Animation First we need to create a keyframe animation of the ship about to take off. For our simple animation, we ll only animate the scale of the ship as it squashes, getting ready for takeoff, and then stretches as it leaps off the ground. This is classic cartoon anticipation and overshoot you ll recognize the effect from any old Tex Avery cartoons you run across. Note Keyframe is an old animation term for important moments in an animation (key frames). In digital animation, you tell the computer which frames are important (the keyframes), and the computer in-betweens the rest of the frames between these key frames, creating an animation. 1. To create the initial keyframe, first be sure you re on the first frame of the animation (use the VCR-like controls at the bottom-right of the screen, and check to see that the timeline marker is at 1). 2. Next, select the rocket (be sure it s the whole rocket, and not just the body); then, in the Channel box, drag your mouse over the names of the three scale channels (scale X, Y, and Z). Then, with the right mouse button over the selected channels, choose (RM choose) Key Selected from the pop-up menu. The channels for scale should turn orange, indicating that they re now keyframed.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=766969479 (1 of 5) [11/27/2000 8:19:50 PM]
Books24x7 Mastering MAYA Complete 2
3. Once you have created your first keyframe manually, you can make Maya automatically keyframe your channels from that point on. Check to be sure the auto-keyframe option is on by verifying that the key icon at the bottom-right of the screen (below the VCR-like time controls) is red. If it s not, simply click on it to turn it red.
4. Now we need to make our animation longer (it defaults to 24 frames, or one second of animation). In the number field for the end time (to the right of the time range slider), set the frame range to 100 frames a bit over four seconds.
Note Maya defaults to 24 frames per second film speed. Thus, 24 frames are one second, and 96 frames are four seconds. 5. Move the time marker (the gray bar in the time slider) out to 48 frames (2 seconds) by dragging it across the time slider or just click about where the 48th frame would be. Be sure your rocket is still selected, and then enter scale mode (R key) and scale down the Y (green) axis so that the rocket becomes shorter (a scale of about 0.7 on the Y axis channel should do). You may notice that this simply shrinks the rocket; we also need to scale out the X and Z axes to make the rocket appear more squashed. While we could do this via the X and Z scale handles, it is easier to do so in the Channel box itself. Click in the scale X box, and then enter a value of 1.4. Do the same in the scale Z box. Your rocket should now look squashed.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=766969479 (2 of 5) [11/27/2000 8:19:50 PM]
Books24x7 Mastering MAYA Complete 2
6. We now need to hold this squashed look for some frames (a hold keyframe). Move the time marker to frame 60, select the scale X, Y, and Z channel names again, and RM choose Key Selected (alternatively, you could reenter the numbers you had before, forcing Maya to create a new keyframe via the auto-keyframe option). 7. At this point, it s a good idea to play back your animation to see how it looks so far. Click the Rewind button on the VCR-like controls (or press Alt+Shift+V); then click the Play button (or press Alt+V) to play the animation. The rocket should squash down and then hold its appearance and then the animation loops and repeats itself. 8. Now let s make the rocket stretch out, as if stretching to take off from the ground (don t worry for now that it s not moving up). Move to frame 70 and set the X, Y, and Z scales to 0.7, 1.4, and 0.7, respectively (the rocket should look stretched out now). 9. We need another hold keyframe (with the rocket stretched out), so move to frame 78, choose the scale channels, and RM choose Key Selected once again. 10. Now move to frame 90 (close to four seconds), and reset all the scale channels to 1 the ship will now return to its original shape at 90 frames. When you play back the animation, you should see the rocket squash, preparing for takeoff, then stretch up (as it takes off don t worry, we ll take care of that next!), and finally return to its original shape. If you don t like how the animation runs, you can Shift+click on any keyframe (highlighting it in red), and then drag that keyframe left or right on the timeline, thereby adjusting the speed of the animation between each keyframe.
Using Dynamics for Animation We ve completed our keyframed animation for this project. Now let s make Maya do the rest of the work. We ll make the ship rise into the air by giving it a force (or impulse), and then drag it back down using gravity. Finally, we ll make the ground and rocket collide. To do all this, we ll use what is known as rigid body dynamics to tell Maya what forces act on our object (the rocket). As explained in Chapter 15, Maya (specifically, its dynamics engine) will use our input to do all the calculations necessary for realistic movement. 1. First, we need to make both the rocket and ground rigid bodies, so they ll react to each other and the forces we apply to them. Select the ground plane, and then change to the Dynamics menu set (from the pop-up menu at the top left of your screen). Choose Bodies Ø Create Passive Rigid Body Ø. (Be sure not to select Active!) In the options window, set the Static and Dynamic Friction to 0.5, and set the Bounciness to 0.2. Click Create and Close to create the rigid body. 2. Now let s make the rocket a rigid body. Select any of the rocket s body parts and press the up-arrow (be sure rocket is the name selected in the Channel box). Choose Bodies Ø Create Passive Rigid Body Ø. In the options window, set the rocket s mass to 1000, set the Impulse Y to 5000, and set the Impulse Position Y to 12 (this forces the impulse to be above the rocket s body, so the rocket won t spin around when you launch it). Click Create and Close.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=766969479 (3 of 5) [11/27/2000 8:19:50 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you get an error when you try to create the rocket s rigid body, check (using the hypergraph or outliner) to be sure you have erased the two curves for the nozzle and body of the rocket. If you haven t, do so this should take care of any error messages. 3. With the rocket still selected, choose Fields Ø Create Gravity Ø. In the options window, set the magnitude of gravity to 25 (this setting is far heavier than Earth s gravity, which is 9.8, but it makes the animation look better!), and then click Create and Close. Because the rocket was selected when you created the gravity field, it will be attached to gravity (that is, affected by it). 4. If you play back the animation now, you will see that it looks just the same as before. That s because our rocket is still a passive rigid body (meaning that no forces can affect it). What we have to do is keyframe the rocket to be an active rigid body just at the frame where it should take off. Be sure the rocket is selected, and then move to frame 62. Under the Shapes node (in the Channel box), you should see a channel called Active (toward the bottom) that is set to off. Click once on the text (the word Active), and then RM choose Key Selected to set a keyframe. Now move to frame 63, click in the text box that says off, and type in the word on. This will set a keyframe, turning the rocket s rigid body on, so it can now be affected by forces. 5. Before you play back the animation, you ll want it to run longer. Set the playback length to 1000 instead of 100. (Type 1000 in the end-time number box just to the right of the time range slider.) The frame range should now go from 1 to 1000. Rewind and play back the animation: you should see the rocket zoom off into parts unknown. Tip If the rocket gets stuck in the ground, you ve got a rigid body interpenetration error, a problem you ll learn more about in Chapter 15. To fix it, move the ground down a bit and run the animation again. Warning When playing back dynamics animations, it is extremely important to rewind the animation before you play it back each time. If you don t, Maya will become confused about its calculations, and you will see very strange results! 6. To make our ship stop going up and up, we need to turn off our impulse. Go to frame 104 (with the rocket still selected), select the channel for Impulse Y, and RM choose Key Selected. Move to frame 105, and type 0 in the Impulse Y number field (setting the impulse to 0 from this point on). When you play back the animation, the rocket should rise out of sight, and then, around frame 450, crash back down into the ground, bouncing around until it comes to rest. Tip To see the animation better, try zooming your camera back (press Alt with the left and middle mouse buttons, and drag left) this is called scaling the view. Also, if you don t like the way the rocket bounces off the ground, you can set the ground s bounciness setting to lower (or higher), and you can change the rocket s impulse setting from 5000 at the start to some other very similar number (like 5001). This small change will make the bounces go in very different directions. You should now have a complete rocket animation, using keyframes for part of it, and making Maya do the calculations for the rest. Next, we ll discuss how to make a new camera, and have it aim at the ship at all times; then we ll talk about how to render the whole animation out. Tip Save your work and take a break. Good work!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=766969479 (4 of 5) [11/27/2000 8:19:50 PM]
Books24x7 Mastering MAYA Complete 2
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=766969479 (5 of 5) [11/27/2000 8:19:50 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating a Follow Camera As you may have noticed, the default perspective camera s view of this animation leaves something to be desired. What we need is a camera that follows the rocket into the air and back again we need to aim our camera at the ship, just as we did with the lights. Note Aiming a camera at an object is not a good idea for realistic animation; it is generally better to keyframe the camera to follow the object s motion, as this introduces human errors into the camera tracking (making the motion look like a person operating a camera instead of a computer operating one). For our cartoonish animation, having a camera follow the rocket is all right; however, if you wish, you are welcome to keyframe the motion instead. 1. Create a new camera (Create Ø Camera) and name it followCamera. Using the four view panes, move the camera down the X axis (to the right in the top view), and then move it up a bit off the ground plane do not rotate the camera at this point! 2. Select the rocket, and then Shift-select the new camera. In the animation menu set, choose Constrain Ø Aim to force the camera to point at the rocket. 3. To look through your new view, choose a panel (the top view, say), and choose Panels Ø Look Through Selected. Make this your sole viewing pane (press the spacebar), and then play back the animation. You should see the camera follow the rocket up into the air, and then back down again. 4. Save your work. Tip If the camera is too close to the action, or too far away, just zoom your view (Alt+LM and RM buttons and drag) to get a better view.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=398927643 [11/27/2000 8:19:57 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Rendering the Animation While watching the animation play in your scene window is great, it s probably a bit bumpy (especially if you have a slower machine). There are two ways to render a cleaner view of your animation: playblasting and final rendering (batch rendering). While a final rendering gives very high-quality results, it takes a great deal of time to produce its results. Playblasting, on the other hand, produces a rougher (flat shaded) look, but goes as fast as your video card can spit out images. Thus, for a quick look at the animation, playblasting is a far better choice than a final rendering. Playblasting the animation is one step: Choose Window Ø Playblast and watch as Maya creates an animation for you, using the basic shading mode of your computer. Once the animation is complete, you will be able to view it in its own little movie window. You ll learn more about playblasting in Chapter 11.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=509772671 (1 of 3) [11/27/2000 8:20:04 PM]
Books24x7 Mastering MAYA Complete 2
Rendering the final product is a bit more complex and takes much longer. Essentially, a final (batch) rendering creates a high-quality snapshot of each frame of the animation, using all the lighting, material, and animation information your scene can provide. The results of a final rendering can be excellent, but it is a fairly slow process, as your computer has to do many calculations for every pixel of every image. Thus, you will only want to proceed with these steps when you re sure you re happy with your animation. 1. Choose Window Ø Render Globals to open the Render Globals option window. In the Image File Output section, set the Frame/Animation Extension to name.ext.#, set the end frame to about 700 (you want to be sure it s a large enough number that the rocket has come to rest first), set the Frame Padding to 4 (this adds zeroes before your frame number, so the frame will be numbered render.001, render.002, and so forth, instead of render.1, render.2, etc.), and set the active Camera to followCamera (otherwise Maya will use the default persp camera, and you will waste your rendering time). 2. Twirl down the Resolution arrow, and set the Render Resolution to 320∞240. 3. Twirl down the Anti-aliasing Quality arrow, and set the Presets field to Intermediate Quality (this makes for faster rendering, but with decent quality). 4. When you have finished your settings, close the Render Globals window, and open the Rendering menu set (the top-left pop-up menu). Choose Render Ø (Save) Batch Render. Type in a name (like rocketRender) in the File box, and click Save/Render. 5. Maya will render out all 700 frames of the animation (which will take some time). You can view the progress of each frame in the Feedback line (at the bottom-right of the screen), or, to view the current frame that is rendering, choose Render Ø Show Batch Render. To cancel the render at any time, choose Render Ø Cancel Batch Render. 6. When the rendering job is finished, you can view it using the fcheck utility. In IRIX, type fcheck in a shell window; in NT, choose Run (from the Start menu), and type fcheck in the text field. A window will open, letting you navigate to your images directory (it should find this for you automatically). Choose the first frame of your animation and hit OK. Fcheck will cycle all frames into memory and then play back the animation at full speed.
Congratulations! You have modeled, textured, lit, animated and rendered an animation in Maya. If patting yourself on the back isn t your style, you can move on to the advanced section (next), where you will learn how to create a particle exhaust trail for the rocket. If this was enough practice for a start, just skip right on to Chapter 2 and learn about the Maya interface.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=509772671 (2 of 3) [11/27/2000 8:20:04 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=509772671 (3 of 3) [11/27/2000 8:20:04 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Advanced Topic: Adding Exhaust If you ve worked extensively with other animation packages, what we ve done so far may seem fairly straightforward. In that case, you re probably ready to explore another area of Maya dynamics, namely particles. We ll use a particle emitter to create a shower of particles, and then texture them to look like smoke and flames. To make it appear that the exhaust is powering the rocket, we ll turn the emitter on and off (via keyframes) at the appropriate moments. 1. First, we need to create our emitter. Select the nozzle on the rocket this will be the emitter s parent, forcing the emitter to go along for the ride when the rocket launches. In the Dynamics menu set (the top-left pop-up menu), choose Particles Ø Add Emitter Ø. In the options window, make the name of the emitter exhaustEmitter, set the emitter type to Directional, set the Rate to 0, and the Spread to 0.3. Twirl down the Emission Direction arrow, and set the DirectionY to 1 (so the emitter points downward). Twirl down the Emission Speed arrow and set the Speed to 60. Finally, click Add and Close. You now have a particle emitter attached to the nozzle of the rocket. 2. Right now (if you play back the animation), the particle emitter will shoot out no particles, because its rate is set to 0 particles per second. Just before the rocket takes off (frame 63) we need to turn on the engine our particles. Go to frame 59, select the Rate channel text for the emitter in the Channel box , and RM choose Key Selected to set a keyframe at 0 for this frame. 3. Now go to frame 60 and set a rate of 200 so there are suddenly many particles shooting out from the ship. If you play back the animation now, a shower of particles (points by default; we ll fix that in a moment) will shoot out from the exhaust nozzle.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=510515888 (1 of 3) [11/27/2000 8:20:22 PM]
Books24x7 Mastering MAYA Complete 2
4. Now we need to turn off our rocket. Go to frame 104 and set a keyframe for the Rate at 200 (select the Rate text, and RM choose Key Selected). Now, at frame 105 (where the impulse turns off as well), set a new keyframe for Rate at 0. When you now play back the animation, the particles will stop coming out of the rocket at frame 105 however, the particles hang around forever (they never die). We need to give our particles a life span so they will die off like good flames should. 5. With the emitter still selected, press Ctrl+A to toggle on the Attribute Editor. Once in the Attribute Editor, click on the particleShape1 tab at the top; then, in the Add Dynamic Attributes section, click the Lifespan button. In the resulting window, choose Add Per Object Attribute, and click the Add Attribute button.
6. If you now scroll back up to the Render Attributes section, you will see that a new attribute, Lifespan, has been added with a default value of 1 (for one second). As this value is fine for our purposes, we can leave it at 1 second. When you now play back the animation, you should see the particles die out a second after they are created (thus the trail of particles follows the rocket up as it takes off). Save your work. 7. Now that we have a good trail of particles to work with, let s change the rendering type from points to something more interesting. In the Attribute Editor (with the particleShape1 node still selected), under the Render Attributes section, set the Render Type to Cloud (s/w for software rendered). Next, click the Current Render Type button to add the attributes that belong with the cloud render type. 8. In the new fields, make the radius 1, the Surface Shading 1, and the Threshold 0.5. When you play back the animation (which will now run significantly slower), you should see that the exhaust particles are now spheres. To see what they would look like in a real rendering, choose Render Ø Render into New Window (from the Rendering menu set).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=510515888 (2 of 3) [11/27/2000 8:20:22 PM]
Books24x7 Mastering MAYA Complete 2
9. Now we re closing in on a good exhaust cloud. The last piece of the puzzle is to create a texture for the particles. Play the animation to a frame where the particles are showing, then open the hypershade (Window Ø Hypershade). To create a cloud texture, we need to create a volumetric texture. To do so, scroll down the left-hand window until you reach Create: Materials, and click the + sign to the left of the Materials folder. A Volume folder will appear below the materials swatches, and clicking on it will open the volume materials. MM drag the particleCloud material (the light blue ball) onto the right-hand window of the hypershade, and then rename the material exhaustVM.
10. MM drag the material onto the exhaust particles, move over to the Attribute Editor, and set the color of the material to a bright yellow. Set the Transparency to a light gray (by moving the slider to the right), and set the Glow Intensity to 0.5. Test render your current frame the exhaust should now glow a bright yellow as it is emitted from the nozzle. If you re not satisfied with the look of the exhaust, try adjusting some of the material settings or the render attributes of the particleShape1 node. Save your work again. When you are satisfied with the look of your exhaust, you can render out the entire animation sequence (see the rendering section, above) to see how things look with your exhaust plume. To compare your work with mine, you can take a look at 01rocket.mov on the CD-ROM.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=510515888 (3 of 3) [11/27/2000 8:20:22 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 1 - Your First Maya Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary Congratulations! You have completed a real-world animation project your first time out. If your work is not up to the way you would like it, that s all right: it can take quite a while to get an animation package producing just what you had in mind. No matter how you did, you can always return to this project as you continue through this book. You may find that after a few more chapters, you d like to give this project another try. My suggestion in that case is to use this chapter as a reference, not a guide. In other words, try to do the work by yourself, and read the directions here only when you get stuck. In this way, you ll make the project your own, and you ll learn even more from it. Whether you tried this rocket animation with years of digital 3D experience under your belt or it was your first foray into the wonderful world of 3D, you should see by now how powerful the Maya environment can be. Now that you have an idea of what Maya can do, it s time to learn why and how Maya does what it does. Throughout this book, we ll give you a great deal more explanation about what we re doing than we did in this chapter, but you ll also still be working on real world projects, refining both your understanding of and skill with Maya. You ve taken your first step into the world of Maya now use this book as your guide to a journey through your new and exciting world.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=457091957 [11/27/2000 8:20:29 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 2 - The Maya Interface Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 2: The Maya Interface Overview If you did the modeling and animation work in Chapter 1, you have certainly seen the power Maya can bring to your work. You may, however, have been a bit overwhelmed by the program s vast range and depth, especially if you are new to Maya. But as you ll see, Maya s user interface has been carefully and intelligently designed to make all this power easily accessible to new users and to allow experienced users to customize it to meet the needs of particular projects. In this and the following two chapters, we will back off for a bit from specific projects and explore in more depth some of the interface and tools Maya has and how to make these elements work for you. If you are already very familiar with the Maya interface, you may wish to skip these chapters; however, we will cover several aspects of the program that have changed significantly in version 2, so you should at least skim through to find out about these new features. If you are new to Maya, reading these three chapters should get you up to speed to handle the rest of this book. What s New in Maya 2 While the Maya interface may at first glance appear much as it did in version 1, there are many significant changes too many, in fact, to detail here. Here are some highlights of the revised interface: " A new Create menu that contains all object-creation items (except lights), and replaces the more awkward Primitives menu. " The Hypershade, a Hypergraph-like window for the creation, modification, and connection of materials and textures. " The Visor, a sub-window of the Hypershade, which allows you to create, view, and manage images, textures, and materials. " A new, spreadsheet-type Component Editor.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516579742 (1 of 2) [11/27/2000 8:20:34 PM]
Books24x7 Mastering MAYA Complete 2
" A new Relationship editor, which allows you to manage the relationship of sets, partitions, light linking, and other matters from just one window. " All Maya buttons, fields, icons, and sliders now have pop-up text that describes the function. " Maya Complete adds Artisan and F/X tools, built-in, while Maya Unlimited also provides Cloth, Fur, and Maya Live.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516579742 (2 of 2) [11/27/2000 8:20:34 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 2 - The Maya Interface Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What s Behind the Maya Interface? Maya (from the Sanskrit word for world of illusion ) is a program designed to produce groundbreaking, photorealistic models and animations. Built into this program are an abundance of tools and subtools that can overwhelm even the most wizened old 3D artist. To make all of Maya s tools work together in a logical, consistent, and intuitive manner is a monumental task. In fact, it is still ongoing, as witnessed by the changes to version 2 of the program. Still, the basic structure of the Maya interface is not only solid enough for most users to quickly learn and use, it is so revolutionary and intuitive that several other 3D software manufacturers are copying much of Maya s look. What makes Maya different? First, interacting with it is very intuitive, for several reasons. All scene windows, plus the Hypershade and Hypergraph windows, are easily navigated via the same keyboard and mouse combinations for zooming, tracking, and rotation (in perspective camera views only). Because navigating all these windows is the same, you only have to learn one set of commands to get around Maya s world. Moving objects around a Maya scene window is similarly intuitive: Select the move, scale, or rotation (or any other) tool, grab a manipulator handle (or the center box, to manipulate on all axes simultaneously), and alter the object. To try out an example, you can create a new scene in Maya, add a ball (by clicking the sphere object in the toolbar, or by choosing Create Ø NURBS Primitives Ø Sphere). Now rotate around the ball by holding the Alt key down and pressing the left mouse button. This type of rotation is known as camera, or scene rotation. To rotate the ball itself, choose the rotate tool from the toolbar (or simply press the E key on the keyboard), then choose any of the manipulator rings around the ball and rotate it by dragging with the left mouse button. To move an object, choose the move tool (or press the W key). To scale, choose the scale tool (or press the R key).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=720668712 (1 of 3) [11/27/2000 8:20:42 PM]
Books24x7 Mastering MAYA Complete 2
Three-Button Mouse Conventions in Maya Maya makes extensive use of all three mouse buttons. This book like the Maya manuals uses a shorthand notation to describe the basic mouse operations. Click, or LM click, means to click (press and release) with the left mouse button. Drag, or LM drag, means to click the left mouse button, hold it down, and drag. Shift+click means to LM click, then hold down the Shift key, and click another item. Choose means to either click or hold the left mouse button down and choose an item from a menu. MM drag means to click and drag with the middle mouse button. RM choose means to hold the right mouse button down (in a specified area) and choose an item from the pop-up contextual menu. Rotate view means to rotate the (perspective) camera; that is, hold the Alt key and the left mouse button down, and then drag in the perspective window to rotate the view. Move view means to move (any) camera; that is, hold the Alt key and the middle mouse button down, and then drag in any scene window to move the view. Scale view means to scale or zoom (any) camera; that is, hold the Alt key and the left and middle mouse buttons down, and then drag in any scene window to scale (or zoom) the view in or out. Another powerful difference between Maya and other packages lies in how you interact with Maya s GUI (its graphical user interface). There are nearly always two or more ways to accomplish a task called workflows in Maya. For example, if you prefer not to use menus on top of the screen, you can use Maya s hotbox (which is itself customizable) to access all menus, or any grouping therein, by merely pressing and holding the spacebar.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=720668712 (2 of 3) [11/27/2000 8:20:42 PM]
Books24x7 Mastering MAYA Complete 2
You can also, as noted before, create items via the toolbar or, equivalently, via menu commands. Most impressive, however, is that Maya will let you decide how you interact with it. If you are not satisfied with Maya s interface, you have many ways you can alter it, including creating marking menus, toolbar buttons, and hot keys. All of these can be created fairly quickly (especially the toolbar buttons) but can contain extremely complex instructions. Note For more on how to tune Maya s GUI for your own work, see Chapter 3, for Speeding up Workflow, or Chapter 16, MEL Basics.
Techniques
Finally, Maya s plug-in architecture (or API) and especially its built-in scripting language, MEL, are very open and comprehensive. Because of Maya s API, plug-ins (like the built-in Artisan and FX) fit seamlessly into the program, so much so that it is often difficult to determine where the main program stops and the plug-in begins. While the API is fairly complex and is best left to knowledgeable programmers, MEL (or Maya Embedded Language) is a reasonably simple scripting language that gives just about anyone with a bit of programming experience access to nearly all of Maya s very powerful features in a program environment. Not only can you create specialized, time-saving scripts with MEL, you can also create entire windows, or even a whole new GUI for the program (because Maya s entire GUI is built on MEL scripts in the first place). This feature can allow, for example, a technical director to create a custom interface for her artists, allowing them to deal with character animation without their having to know anything about the low-level details of the construction and stringing (or animation setup) of the character. As should be obvious from these features, Maya provides a very modern, intuitive, and customizable environment for you. Whether you are a shop of one person or one hundred, Maya s adjustable interface will get you building complex animations far more quickly than other even more expensive packages. Let s now take a more thorough tour through the Maya interface, looking at several important areas of the GUI.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=720668712 (3 of 3) [11/27/2000 8:20:42 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 2 - The Maya Interface Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Interface Elements Although there are many elements to Maya, they can be grouped into about nine categories. We will work through each category in turn.
Scene Windows The scene windows are your primary interface with the objects (and lights and cameras) you create. When you open a new Maya scene, it opens the default configuration, which is one large scene window (the default perspective camera), alongside either the Channel box (or the Attribute Editor if your preferences are set to toggle between the Attribute Editor and the Channel box).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (1 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Tip New to Maya 2 is that you can set the Attribute Editor to be a window adjacent to the perspective window (replacing the Channel box), rather than a floating window. You can then toggle between the Attribute Editor and the Channel box by pressing Alt+A. Should you wish to force the Attribute Editor to toggle with the Channel box, choose Options Ø UI Preferences and select the Open Attribute Editor In Main Maya Window radio button. Once the default window is open, you can select the perspective view by clicking anywhere inside the window. When this (or any) window is selected, its borders turn blue. At this point, you can rotate, scale, or translate the view to adjust what you see in this window (for specifics on how to do this, please see the earlier sidebar on mouse conventions). The default scene window is called the Persp (for perspective) view and is just the view from the default perspective camera that Maya builds upon opening a new scene. Tip You can build other perspective cameras by choosing Create Ø Camera. To view the scene through this new camera, select the camera (click on it in the scene window or choose it in the Hypergraph or Outliner), and choose Panels Ø Look Through Selected, or, equivalently, choose Panels Ø Perspective Ø camera1. In addition to the default perspective camera, Maya also creates three orthographic views Top, Side, and Front that you can also see (in what s called a four view layout) by selecting the perspective window and then quickly pressing and releasing the spacebar.
To make one of the orthographic views fill the screen, click in it (to select this window), and press and release the spacebar again. Being able to switch quickly between different view layouts and window sizes greatly speeds up your workflow in Maya, as no extensive menu selection process is required to rapidly change views. Tip To switch views in Maya without losing your current selection, MM click in the view you wish to activate (e.g., the front view), then press the space bar. Orthographic and Perspective Views
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (2 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
An orthographic view is a nonperspective view from a 90 degree (or orthogonal) angle. Because these are not perspective views, they do not reduce the size of objects as they move away from the camera. A perspective view of a row of columns, for example, would show the back column as smaller than the one nearest the camera, as the further an object gets from a camera, the smaller it appears. An orthographic view, on the other hand, will show all columns as the same size, as there is no scale reduction (perspective) in this view. An orthographic view may be thought of as similar to a blueprint drawing, while a perspective view is like a camera picture.
Moving in Scene Windows Moving around scene windows is fairly straightforward, once you learn the key and mouse combinations for doing so. Additionally, because you move in all scene windows (plus the Hypergraph and Hypershade) using these same commands, once you learn how to move in one window, you can move in all. As the perspective window has the most options (you can rotate as well as zoom and translate), let s quickly look at how to maneuver around the default perspective window. Open a new scene in Maya; then hold down the Alt key and the left mouse button and drag the mouse around. The scene should spin around as you drag the mouse. Tip If the scene does not rotate as you drag (you may see the cursor become a circle with a line through it), you may be in an orthographic view, which does not allow rotations. To move to a perspective view, hit the spacebar to show the four-view layout; then click in the perspective window (top right) and hit the spacebar again. To translate a scene (move up/down or left/right), hold the Alt key down once again, hold down the middle mouse button (MMB), and drag the mouse around. You will see the scene move around with the mouse movements (note that the camera is actually moving opposite to your mouse movements: as you drag right, the camera moves left, so the objects appear to move right. You can see this clearly if you make cameras visible and look at the camera in a different view as you drag).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (3 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
To scale your view (zoom the camera in and out), hold down the Alt key once again, hold down both the left and middle mouse buttons, and drag. As you drag right, the scene grows larger (you re zooming in); as you drag left, the scene grows smaller (you re zooming out). If you wish to quickly zoom into a specific area of your scene, hold down the Alt and Ctrl keys, and then drag (with the left mouse button only) a box around the area of the scene you are interested in, starting on the left side. When you release the mouse, the scene will zoom in, covering the area you outlined. If you drag the mouse from right to left, the scene will zoom out so that the entire scene window you start with fits into the box you drag (the smaller your box, the further out you zoom). If you now open the Hypergraph or Hypershade (Window Ø Hypergraph or Window Ø Hypershade), you can use the same key/mouse combinations to scale or move around either of these windows. You will note, however, that you cannot rotate either of these views, as this would accomplish nothing useful. Note You can think of the Alt key as the movement key. Whenever you hold down the Alt key, you are in move mode, rather than in object manipulation (or some other) mode. The consistent use of the Alt key for movement is just one more example of the thought that has gone into the Maya interface.
Scene Objects Scene objects (geometry, curves, cameras, and lights) are the fundamental building blocks from which you create a Maya scene or animation. The procedure for creating and manipulating any object is generally the same: Create the object (most often in the Create menu), choose a manipulation tool (like Translate or Rotate), and alter the object. You can also adjust the pivot point (or center ) of an object, and you can manipulate the individual components of geometric objects.
Creating Scene Objects Because most scene objects are created in very much the same fashion, we ll go through a few representative examples here, rather than a thorough examination of how to create all possible objects in Maya. Should you have specific questions about creating a type of object that is not covered here, you can always check Maya s online documentation (accessed via the Help menu). Tip Maya s built-in help files are a great (and easy) resource. To access them, just use the Help menu, and choose Maya Library (or the specific aspect of the program you are interested in) from the Help menu. Within the startup window (which will open in a Web browser, as it is an HTML document), you will be able to search for a term, browse through a complete index of all Maya documents (the index alone is about 1.7MB of data!), or read any of the Maya manuals in electronic form. To create a piece of geometry (a sphere or cone, for example), you choose the type of geometry you wish to create from the Create menu. For a three-dimensional object (like a torus or a cube), you can choose from either polygonal or NURBS primitives. Using the NURBS option, you can also select a two-dimensional (non-surface) square or circle. When you create an object, you can either use the last saved settings or open the Creation Options window and adjust the object s settings to what you desire before creating it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (4 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Note NURBS (or Non-Uniform Rational B-Spline) objects are created via a series of curves (or isoparms) that are mathematically derived from several points (control vertices, or CVs). NURBS surfaces are more complex to calculate, but they can be warped and twisted more before they show excessive unnatural creasing. Polygonal surfaces, on the other hand, are created by placing many small triangular or rectangular surfaces together. Polys are simpler to calculate at least for simple surfaces but tend to show their constituent blocks if they are bent or distorted too much especially if the surfaces are created with a minimal number of polygons, or facets. NURBS surfaces tend to be better suited to organic forms (like bodies), while polygonal surfaces generally work better for more mechanical objects (like space ships); but this is by no means a hard-and-fast rule. As an example, let s create a default polygonal sphere, and then use the options box to create a NURBS cylinder. To create the poly sphere, simply choose Create Ø Polygon Primitives Ø Sphere. On releasing the mouse, you should see a sphere appear at the center of Maya s default grid. If you look closely, you will note that the sphere consists of many rectangular objects (more accurately called quadrilaterals) that butt up against each other, forming the sphere. Now move the sphere aside (press the W key and move the sphere away from the center of the grid) and create a NURBS cylinder with nondefault options. To access the options window of the NURBS cylinder, choose Create Ø NURBS Primitives Ø Cylinder Ø (choosing the Ø symbol the option box in a Maya menu item always brings up an option window). Upon releasing the mouse button, you should see the following window.
This window provides a great number of options. You can define any of the following: "
the pivot point
"
the axis the cylinder will use as its long axis
"
the start and end angles of the cylinder
"
the radius
"
the height-to-radius ratio (a higher number will make a taller cylinder)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (5 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
"
the number of spans (vertical pieces) and sections (horizontal pieces) that make up the cylinder
For the purposes of this little example, try setting the End Sweep Angle to 270 (this will create a three-quarters cylinder), the Height to Radius to 4 (making the cylinder taller), and the Caps option to Both (creating a cap on both the top and bottom of the cylinder). When you click the Create button at the bottom, you should get an object like this:
Tip You can almost always reset an object to its default settings by using the Reset button in the options window. Tip To get a smoothly shaded object (instead of a wireframe), press the 6 key on your keyboard (not the numeric keypad). To view an object at a higher resolution, press the 3 key. The image above uses these settings to display the cylinder. Creating a camera object is as simple as creating a geometry object. Choose Create Ø Camera and a new perspective camera (initially called camera1, camera2, etc., until you save it with a more specific name) is created. To adjust the camera s options as you create it, choose the option box (Ø), and change the camera s settings. While all the settings in the camera options box are a bit much for an introductory chapter, most are fairly self-explanatory to anyone familiar with photography or 3D animation. Note For more on camera options and other rendering basics, please see Chapter 18. Some notable options are that you can make any new camera orthographic (as opposed to perspective), you have control over near and far clipping planes (where the camera stops seeing objects that are too far away or too close), and you can choose to have two or three nodes on the camera (allowing you to manipulate where the camera is looking, for example, via a manipulator handle outside the camera itself). Try creating a camera with two nodes (under Animation options). When you create this camera, it will automatically have a second manipulator handle you can move (by pressing the W key and dragging the handle around), and the camera follows where the manipulator handle goes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (6 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
To create lights, use the Lights menu (under the Rendering menu set, or via the hotbox). Note Maya has four menu sets: Animation, Modeling, Dynamics, and Rendering. To switch between them, use the pop-up menu on the left of the toolbar to select the appropriate set. Optionally, you can choose Hotbox Controls Ø Show All (brought up by pressing the spacebar); the hotbox will then show all menu sets. When creating lights, you can choose from Ambient (a light which fills all space evenly, like indirect sunlight in a room), Directional (parallel light rays from one source, mimicking direct sunlight), Point (radial light like that from a bare light bulb), and Spot (light as from a theatrical spot light). For example, create a spot light (Lights Ø Create Spot Light Ø) with the following options: Intensity 1.5, Cone Angle 50, Penumbra 10, and Color a light blue (click the default white color chip to bring up the color picker; then choose a light blue color). The penumbra controls how quickly your spotlight fades out around its edges: a value of 0 means that the spotlight goes from full intensity to 0 at its edges (not a very natural look); a value of 10 or 20 degrees makes the spotlight fade out from full intensity to 0 over that number of degrees. If your spotlight were aimed at a simple plane, the rendered image would look something like the light on the right (on the left is a spotlight with a penumbra of 0).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (7 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
You can also create either CV (control vertex) or EP (Edit Point) curves via the Create menu (Create Ø EP Curve Tool or CV Curve Tool). The CV Curve Tool creates a CV with each click of the mouse. The EP Curve Tool creates Edit Points as you click the mouse button. Control vertices lie off the curve they control, while Edit Points lie on the curve. Each type of curve tool is useful under certain circumstances the basic rule of thumb is that for smoother curves, use the CV curve tool, while for more tightly controlled curves, use the EP curve tool. In the following image, matching a CV curve and an EP curve created with identical mouse clicks, note that the CV curve (on the left) is smoother, its extremes much less pronounced than the EP curve (on the right), as the CV curve is not forced to pass through each point you define, whereas the EP curve must.
Note After an EP curve is created, it is automatically converted into a CV curve. You can see this by switching to component mode and noting that the edit points have changed into CVs, and that their position is no longer the same. To create, say, a CV curve, choose Create Ø CV Curve Tool (or click the CV Curve Tool button on Shelf 1), and then click several times in the scene window with the mouse. You can also drag the points around as you create them, or even erase points by hitting the Delete or Backspace key, or by pressing the Z key to undo the last action. When you are satisfied with the curve, hit the Enter key, and the curve is constructed.
Moving Scene Objects Once you have created an object, you will probably wish to move, rotate, and/or scale it. Because the procedures are the same for all objects (and lights, cameras, and curves), let s just use a cylinder as an example here. Create a new cylinder with default options (Create Ø NURBS Primitives Ø Cylinder Ø; then hit the Reset button, followed by the Create and Close buttons). To move this cylinder, press the W key on the keyboard you should now see a move tool manipulator handle that allows you to move the cylinder on any or all axes.
Tip If you do not see the manipulator handle, be sure the cylinder is highlighted by clicking (or click+dragging) on it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (8 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
To move the cylinder on the X axis only, click and drag on the red arrow; to move on the Y axis, click and drag on the green arrow; to move on the Z axis, click and drag on the blue arrow. To move the object freely in all directions, click and drag on the yellow box at the center of the manipulator handles. Try moving the object up a little on the Y axis and to the right on the X axis. Note All manipulator handle colors are consistent with the axis marker, on the bottom-left of a scene window X is red, Y is green, and Z is blue. This consistency lets you know what axis you are adjusting, no matter from what angle you are viewing the scene. To scale the cylinder, press the R key, and then scale the object on the X (red), Y (green), or Z (blue) axis or click and drag on the yellow box at the center of the manipulator to scale on all axes simultaneously. Try scaling the cylinder up on the Y axis and then out in all directions, as shown on the left below.
To rotate the cylinder, press the E key, and then rotate around the X (red), Y (green), or Z (blue) axes or click the yellow circle on the outside to rotate on all axes at once (rotating on all axes at once is difficult to control and therefore not advisable). Try rotating clockwise on the Z axis and then counter-clockwise on the X axis, as shown on the right below. Note Manipulator controls have their shortcut keys arranged so that they follow the top row of a QWERTY keyboard Q for select, W for move, E for rotate, R for scale, T for the Manipulator tool, and Y for the Last Used Tool (like the CV curve tool, for example). This layout makes the manipulator tools very easy to access, and it s easy to remember their shortcut keys. Finally, it is possible to move the pivot point of your cylinder (or any object) so that it is not in the object s center. To move the pivot point, press the Insert key on your keyboard (turning the manipulator handle into the pivot-point handle); then move the handle to where you want the object s center of rotation, movement, and scaling to be. Try moving the pivot point of the cylinder to its bottom, so that any further rotation will occur from that point. Tip Once you have moved the pivot point, you must return the manipulator to its state by pressing the Insert key once again.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (9 of 22) [11/27/2000 8:21:10 PM]
normal
Books24x7 Mastering MAYA Complete 2
Objects versus Components All geometric objects are made up of component elements. When you are in object mode, clicking or dragging on any part of an object selects the entire object. In component mode, however, you can choose only some pieces of an object to manipulate. Using the cylinder from the last section as an example (just create a default cylinder if you ve deleted it), select the object (so it turns green) while in object mode and choose the Select By Component Type button (or just press the F8 key) to change to component mode. You will now see the CVs that make up the cylinder if you had created a polygonal cylinder, you would see the points defining the edges of the polygonal facets.
As shown below, the Select By Component Type button is on the Status line, just to the right of the word Objects (or Components, if that is selected). The leftmost of these three buttons is Select by Hierarchy; the middle button is Select by Object; the right button is Select by Component Type.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (10 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
You can adjust components of an object just as you would an object itself by using the move, rotate, and scale tools. Try selecting the top row of CVs on the cylinder (click-drag a square around them), then moving them up some, scaling them out on the X and Z axes, and rotating them around a bit.
Tip To select several CVs (or facets) at once, you can drag a selection marquee around them. To add more components, hold down the Shift key and drag (or click) more points. (If the points are already selected, Shift+clicking or dragging them will deselect them.) Remember that you can always maneuver around the scene window (hold down the Alt key as you drag the mouse) to make the selection easier. If you now switch back to object mode, you will once again be able to choose and manipulate the entire object. Modeling (and even animation) is often a dance between object-mode and component-mode manipulation of your objects, and remembering that the F8 key switches between these two modes can be a real time saver.
Selecting by Component Type One of the trickier aspects of Maya (at least for me) is picking the proper component of an object when in component mode. There are many types of components you can select, including CVs, surfaces, curves, dynamic objects, and so forth (and there are usually several options in each of these choices), but there are only two ways to make these selections. One method is more thorough; the other is better suited to quick selections of the most common component types.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (11 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
The quicker, easier method for selecting specific component types is to use a contextual menu while your mouse is over an object. To try this, create a sphere in an empty scene and then, with your mouse over the sphere, hold down the right mouse button. You will be presented with several options for component masking, plus a menu of actions you can perform on the object (such as templating or untemplating it).
By selecting Control Vertex (for example) from this pop-up menu, you can easily move into component selection mode for CVs, and begin manipulating your CVs as you wish. To return to object mode, press the F8 key twice. While the contextual menu method is quick and easy, it does not give you access to all the component types you might wish to choose from. To choose a component type not listed in the pop-up menu, you need to use the Status line. To the right of the Object/Component text field and Hierarchy/Object/Component icons is a set of eight blue icons, each representing a class of components you can enable or disable in your selection process. To the left of these icons is a black triangle; this allows you to enable or disable all objects for selection. The component types you enable here will then be available when you drag your mouse over an object in component mode.
Warning If you turn off all components, you will not be able to select anything in the scene window including objects in object mode! This is a good place to look first if you discover you cannot choose any objects in a scene. If you hold down the right mouse button on any of the blue icons, you will see a menu of subtypes you can either enable (check) or disable (uncheck) for component selection. Enabling or disabling component types is known as selection masking, and it s a great way to simplify the task of picking a specific object or component in a complex scene. If you are not familiar with components or selection masking, try playing around with these options in Maya before going on.
Window Layouts In addition to the default window layout (the perspective view plus either the Channel box or the Attribute Editor), there are many other built-in layouts Maya provides, and as is consistent with the Maya interface philosophy if you wish, you can create your own.
Built-in Layouts
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (12 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Maya offers two types of built-in layouts: generic layouts and prebuilt, or saved ones. Generic layouts are just basic layouts elements (like a four-view layout), while saved layouts are useful combinations of the basic elements prebuilt into layouts for different purposes. To begin with, let s look at how to access a generic layout. Under the Panels Ø Layouts menu (accessed either via the Panels menu in the scene panel, or, as shown below, the hotbox) are several layout choices for your scene windows.
Choosing the Four layout (the first choice) will place the view you currently have active (often the perspective view) in the upper-left quadrant of a four-view layout. (note that this is different from the layout you get by pressing the spacebar, as the perspective view or whichever view you have active ends up in the top-left quadrant, instead of the usual top-right.) The 3 Top/Left/Right/Bottom Split views place the active window on the top (or left/right/bottom) half of the screen, then split this view into two; the other half of the screen has a single view window. The 2 Stacked or Side by Side layouts are similar, except that they don t split the active view in half (thus the active view and one other view share the screen space evenly, either top-and-bottom or left-and-right). There is also a single view, which is the same as selecting a view and pressing the spacebar to make it fill the entire screen. While the generic views can be useful (especially for building your own layouts discussed below), the prebuilt layouts are more commonly used because they fulfil specific needs. To access the saved layouts, choose Panels Ø Saved Layouts and then select a saved layout to use.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (13 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Single Perspective View and Four View are the views you are already familiar with. Rather than look at each saved layout in a list, let s examine just a few once you understand a couple of the saved layouts, the rest are fairly self-explanatory. The Persp/Graph/Hypergraph is a generic three view (as described above) with the top half split between the perspective view and the Hypergraph, while the bottom half of the screen is occupied by the Graph Editor. This view was created from the generic 3 Top Split view by changing each panel to the Perspective/Hypergraph/Graph Editor view and then saving it. New in version 2 of Maya are several layouts involving the Hypershade. The Hypershade/Outliner/Persp view is a generic 3 Bottom Split, with the Hypershade occupying the top half of the screen and the Outliner and perspective view splitting the bottom half. Also new in version 2 is the Persp/Relationship Editor layout, which stacks the perspective view on top of the Relationship Editor. Toward the bottom of the menu are several layouts specifically for use with Maya Live, including Maya Live Setup, Track, Solve, and Manual MatchMove.
Building Your Own Layout If the prebuilt Maya layouts don t quite fit your needs, never fear: the final choice in the Saved Layouts menu (Edit Layouts) lets you create and save your own layout for later use. You can even erase any or all of the prebuilt layouts from the menu. Warning If you decide to erase a saved layout, be sure that you (or anyone else working on your machine) is not interested in using it any further. To get the layout back, you ll either have to reconstruct it manually or reinstall Maya. As an example of how to create your own layout for later use, let s create a layout with the perspective view filling half the screen on the top, and the bottom being split between the Hypergraph and the Hypershade. (This can be a useful layout if you need to connect several materials to several objects at a time, as selecting the objects in the perspective window can become tedious.) As with most things in Maya, you have a choice about how to create your new layout: you can either start from a generic layout or modify one of the prebuilt ones. Although starting from a prebuilt layout is often simpler, we will start from a generic layout in order to describe the whole procedure. 1. Choose Panels Ø Layouts Ø 3 Bottom Split. 2. Make sure the top half of the window is occupied by the perspective view (if not, select the top half, then choose Panels Ø Perspective Ø Persp). 3. Now select the lower left quadrant and choose Panels Ø Panel Ø Hypergraph. This should turn the lower left window into a view of the Hypergraph. 4. Finally, select the lower right quadrant and choose Panels Ø Panel Ø Hypershade, turning this corner into a view of the Hypershade.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (14 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
5. To save our new layout, choose Panels Ø Saved Layouts Ø Edit Layouts, which brings up a window with several tabs. 6. The Layouts tab should be selected (if not, choose it). 7. In the layouts tab, choose New Layout, then rename the layout from its default name (Panel Configuration 20) to something more memorable, like Persp/Hypergraph/Hypershade, and hit the Enter key to change the name. On closing the window, your new layout will be placed at the bottom of the Saved Layouts menu. If you later choose to discard this new layout, return to the Edit Layouts menu, select the new layout, and click the Delete button.
Note You can actually build a custom configuration directly inside the Edit Layouts menu, by using the Panels and Edit Layouts tabs. This method is more difficult than the one outlined above, however, so my recommendation is to stick with the above method.
The Hotbox
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (15 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
The hotbox in Maya is a tool for displaying all of the menus relevant to your work at a given moment, without taking up any screen real estate when it s not in use. While you can do everything you wish in Maya without ever using the hotbox, once you get used to the way the hotbox conserves space and puts nearly all of Maya s tools in easy reach, you ll wonder how you ever got along without it. The hotbox is so universally useful that one member of this author team has created a default setup with no menus showing at all, allowing that much more room for the scene windows. If you haven t ever used the hotbox before, it is accessed merely by pressing (and holding) the spacebar. In its default configuration, you will see something like the following.
The top row of the hotbox always shows the general menus (the menus that are available in all menu sets), like the Window, Options, Create, and Modify menus. The second row replicates the menu set of the active panel (in this case, the perspective view), with menu items such as View, Lighting, and Panels. The third row has a Recent Commands menu (showing the last 15 commands you performed) and a Hotbox Controls menu, which allows you to fine-tune how the hotbox (and general menus) displays its information. The bottom row of menus is, in this case, the Modeling menu set, with specialized menus for editing curves, surfaces and polygons. In the very center of the hotbox (where the A|W logo sits) is a quick way to change views from perspective to front to side to top, as well as an options menu for how the hotbox displays. Access to all these menus is the same: press (and hold the hotbox menus will not remain open when you release the mouse button) the left mouse button over the menu, then drag inside the nested menu to select the item you wish, releasing the mouse when it is over your selection.
In addition to the menus you can see, there are four regions, called zones (defined by the four lines proceeding out from the hotbox at 45-degree angles), which have special functions. The top zone allows you to quickly select from several saved layouts. The right zone allows you to toggle elements of Maya s GUI on or off (we will discuss customizing your workspace in the following chapter). The bottom zone lets you change the selected window to any of several useful views (like the Hypergraph or the Hypershade). The left zone lets you toggle between object and component mode (mimicking the F8 key), and it also lets you toggle on and off several masking modes. While you can use the hotbox in its default configuration, it is more useful (if a bit more cluttered) when you turn on all menu sets (Modeling, Rendering, and so on) at once. In the Hotbox Controls menu, choose Show All, which displays all menu sets at once.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (16 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
In this configuration, you have access to nearly all of Maya s tools in one place, and it s all available at the press of the spacebar. If you are not familiar with using the hotbox, try forcing yourself to use it for all your menu choices for a couple of hours of work; you will soon find out how powerfully useful the hotbox is, and you ll probably use it for most of your future work.
Menus While we have discussed menu sets on and off throughout this chapter, let s take a moment to look at how Maya s menus are organized. The top row of menus (or the top row in the hotbox) is split into two parts: the menus that are always present (the constant menus) and those that change according to the mode the program is in (the mode menus, like the Animation menu set, for example). Always present are File, Edit, Modify, Create, Display, Window, and Options. To change the variable menus, choose the menu set you want from the Status line (just below the menus or under Hotbox Controls in the hotbox). The sets you can choose from are Modeling, Animation, Dynamics, and Rendering. The elements listed in these menus are fairly obvious, for the most part; the only real curveball is that in order to create a light, you must be in the Rendering menu set (lights cannot be created via the Create menu). In addition to the general menus, nearly every view window in Maya has a built-in menu. The perspective view, for example, has the following menus: View, Shading, Lighting, Show, and Panels (the Show menu allows you to show and hide different types of objects). The Hypergraph view contains these menus: Edit, View, Bookmarks, Graph, Rendering, Options, Show, and Help. For perspective and orthographic views, you can either access these menus from the top of the window pane or use the second row of menus in the hotbox. For views like the Hypergraph or Hypershade, pressing and holding the right mouse button will bring up the menus (or you can use the menu across the top of the window). There are also menus for the Channel box and Attribute Editor. Generally speaking, most windows in Maya have their own menu set, which explains why Maya doesn t just use one menu bar across the top of the screen: there are at least one hundred individual menus, and there would be no space to place all these menus across one screen. Attempting to nest all these menus, on the other hand, might have taken 10 or more levels of nesting to fit all the menus into one menu bar, making the task of picking any individual menu item both laborious and baffling. Given the complexity of the task, organizing Maya s windows into contextual subsets was both a necessity and a more elegant solution to the problem.
Shelves
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (17 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
While we have not touched on shelves much in this chapter, they offer a convenient way of grouping your most frequently used commands and tools together in one place. The shelf bar is one of the most noticeable features of Maya s GUI. It appears just below the Status line. Labeled with Shelf1, Shelf2, and so on, the left side of the Shelf line contains the manipulation tools that we have discussed above. Additionally, there are several buttons, organized into a tab called Shelf1 (and Shelf2, etc.) that perform useful commands. For example, to create a NURBS sphere, you merely click on the blue sphere button; to create a spotlight, click the spotlight button; to create a CV curve, click the CV curve button (the leftmost button on the right side of the shelf).
Note You can customize these shelf buttons to suit your needs. For more on how to do this, see Chapter 3 or Chapter 16. Having these buttons available on a shelf makes the process of creating each item much more straightforward than having to find them in a hierarchical menu set.
The Outliner and Hypergraph While we will cover the inner workings of the Outliner and the Hypergraph later in this book (Chapter 4 is devoted entirely to the Hypergraph), let s take a quick look at these two scene management windows. The basic purpose of the Outliner and the Hypergraph is the same: to allow you to see an abstract (or outline) of the scene. The way the two display a scene s outline, however, is very different. If you have used a 3D animation program in the past, you will probably be familiar with a scene management tool like the Outliner. From top to bottom, the Outliner (Window Ø Outliner) lists all objects in your scene, including cameras (note that the orthographic views top, side and front are just cameras listed in the Outliner), lights, curves, and geometric objects. If you have objects that are parented to one another (a leg, for example, is parented to a body so that they move together), the Outliner will indicate this by a twirl-down arrow to the left of the parent object (the body in this case). Clicking the arrow will show the child object (the leg) which, because it is the child object, is tabbed in under the parent. The Outliner menu contains several options, which will be discussed further in the following chapter.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (18 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
The Hypergraph, by contrast, is probably like nothing you ve seen before. It is, essentially, a linked (or hyperlinked) outline of your scene, showing not only your scene elements, but how they are connected. While the Hypergraph may at first appear bewildering, its fashion of laying out a scene can prove invaluable. The following image shows how the scene shown in the Outliner, above, would look in the Hypergraph.
Again, you ll learn much more about the Hypergraph in Chapter 4.
The Channel Box/Attribute Editor New to version 2, the Channel box and Attribute Editor can be set to toggle back and forth, filling the right-hand portion of your screen (to make the Attribute Editor and Channel box toggle, choose Options Ø UI Preferences Ø Open Attribute Editor in Main Maya Window). The Attribute Editor gives you access to all an object s attributes, while the Channel box gives a more simplified view of only the object s keyable (or animatable) attributes. As these two panels are counterparts, it makes sense for them to be grouped together, and this is the layout we use.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (19 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Note The Channel box is so named because elements that can be animated in a 3D program have often been termed channels. To animate a ball going up and down, you would animate its Y-axis channel (by setting several keyframes over time). While Maya uses the term attribute for anything that could potentially be keyable in a scene, those which have actually been set to keyable are placed in the Channel box. As you ll see throughout this book, the Attribute Editor and Channel box are your keys to controlling all of an object s attributes, including numerical inputs for translation, rotation, scale, and visibility, as well as its construction history, like spans of CVs and the radius of a circular object. The Attribute Editor, in addition (via its tabbed windows) allows you to access materials, tessellation criteria, and other features. To toggle between the Channel box and Attribute Editor, or to bring up the Attribute Editor in a separate window, just press Ctrl+A. Note Materials? Tessellation? If you re new to 3D animation, don t worry about absorbing all the jargon right away. The following chapters introduce all the essential concepts in a logical and straightforward way. If you click on the name of an attribute in the Channel box and then MM drag in the scene window, you will get a virtual slider that controls the number next to the channel name. This is a very powerful, time-saving feature in Maya.
The Timeline The timeline, just below the main scene window(s), is the key to animation in Maya.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (20 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
The numbers on the timeline by default are set to frames (and by default, frames per second is set to film rate 24 so 24 frames equals one second of animation). To the right of the time slider is the current time marker (probably set to 1.00) see the image above for where the current time (and other timeline items) is. To change the current time in your animation, you can either drag the time marker in the time slider or double-click in the current time field and enter a number (like 5) you will then see the time marker move to that frame larger numbers (like frame 20) are, of course, later in the animation. Below the time slider is a range marker (the gray bar with a 1 on one end and a 24 on the other) that lets you control the range of the time slider within a larger animation. To change the position of the time slider while maintaining the same range (24 frames by default), just drag the range bar by its middle. To change the starting point of the range, drag the left square left or right. To change the ending point, drag the right square to the left or right.
To the left of the time range bar are two numeric fields. The left-most field sets the animation start frame (often people will set this number to 0 for the first frame instead of 1). The field to its right sets the starting frame of the time range (changing this number is equivalent to dragging the left square of the time range slider). To the right of the time range bar are two more fields; the left one sets the ending time of the animation range (equivalent to dragging the right square on the time range bar), while the right field controls the end point of the animation (set to 48 frames as a default). To change the settings for the time slider, open the animation preferences window (either click the Animation Preferences button, to the right of the key icon at the bottom right of the screen) or open it by choosing Options Ø General Preferences Ø Animation tab. In this tab, you can control how the units are displayed on the timeline and numeric fields, set playback to normal or free (required for playback of dynamics), and even adjust animation beginning and end points and so forth. Under the Units tab, you can change from the default film (24fps) to (25fps), (30fps), seconds, minutes, or even hours for your slider units. Tip To play back an animation, you can either use the VCR-like controls to the right of the time line, or press Ctrl+V to start and stop the animation, and Ctrl+Shift+V to reset the animation to its starting frame.
The Command Line, Feedback Line, and Script Editor At the bottom of the Maya screen are the Command and Feedback lines. These two lines function in tandem, and are simply the last lines of the Script Editor s Input and History windows, respectively. Therefore, let s first take a quick look at Maya s Script Editor. As most of your interaction with Maya is via the GUI, most of what you actually tell Maya to do is passed to it via MEL (the Maya Embedded Language). The selections and other actions you make in the GUI are recorded as MEL commands. Creating a NURBS sphere, for example, is simply the command sphere followed by several optional flags. To access the Script Editor, either click on the Script Editor icon just to the right of the feedback line (at the bottom right of the screen), or use the menu (Window Ø General Editors Ø Script Editor). The Script Editor is split into two halves. The top, which is the History window, probably has several lines of code in it (these would be the last commands you have issued to Maya). The Input window at the bottom awaits any MEL commands you might wish to give to Maya.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (21 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Note For information on how to use MEL commands with the Script Editor, please see Chapter 16, MEL Basics. To see how the Script Editor works, type sphere (in lowercase letters) into the input window and press the Enter key on the numeric keypad (not the alpha keyboard). You should see the line // Result: nurbsSphere1 makeNurbsSphere1 // appear in the history window (telling you what Maya has done to complete your command), and a sphere will appear at the origin of your scene. Because the Command line is just the last input line in the Script Editor, you don t have to open the Script Editor for a simple command. Try closing the Script Editor and then, in the Command line, type in cone (all small letters), and press either Enter key. A cone should appear in your scene, and the Feedback line (to the right of the Command line) should now read Result: nurbsCone1 makeNurbsCone1 letting you know what actions Maya has taken to complete your command. Tip To focus on the Command line when you are in a scene window (so you don t have to click in the Command line field with your mouse), just press the ` key at the top-left of your keyboard.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=675102439 (22 of 22) [11/27/2000 8:21:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 2 - The Maya Interface Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary You ve seen in this quick tour that while Maya is a very deep and complex program, a great deal of thought has gone into making the interface as intuitive as possible. Consistent interface elements (like using the Alt key and mouse drags to move around many different windows), grouping tools together, and even placing clues about your orientation in space and the type of tool you re using directly in the scene windows all of these features work together to ease the new user s entrance into this complex environment. More importantly, the interface is completely customizable, from its smallest to its largest detail, so that you can tailor the program to meet your needs. As you grow more comfortable with using Maya, you will want to optimize its interface to allow you to work more quickly with less clutter. In the following chapter, we will explore exactly this issue, looking into built-in options, creating buttons and menus of your own, and making the best use of some of Maya s organizational windows (like the Outliner and Hypergraph). If you are very new to Maya, spend a bit of time playing with the interface after reading this chapter. If you are an advanced beginner or beyond read through the next chapter to see how you can make Maya work even better for you.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=156467829 [11/27/2000 8:21:40 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 3: Techniques for Speeding Up Workflow Overview In Chapter 2, we examined many of Maya s interface features. Here, we will look at ways in which the default Maya interface can be adjusted to optimize the ways you interact with the program. From adjusting basic interface options to using hotkeys, shelves, and marking menus, and on to proper use of the Outliner and other windows, this chapter will show you how to customize Maya to do what you want quickly and easily. Finally, we will end with a quick demonstration of how to use Maya s tools to perform a modeling task with a minimum of pain and effort. What s New in Maya 2 In addition to several subtle improvements that make the interface more consistent and easier to use, the new Hypershade is a striking improvement in the way Maya handles textures, materials, and the like. Because the Hypershade works much like the Hypergraph, working with materials and textures now feels similar to working with geometry in the Hypergraph, and navigating the complexities of a shading network is simplified greatly. This reworking of the Maya interface for version 2 (plus a little effort on your part to get to know the Hypershade) can greatly improve workflow in Maya, speeding up complex tasks, and making simpler ones & well, simpler.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=229585740 [11/27/2000 8:21:46 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Adjusting Interface Options The first and most obvious place to start customizing Maya s interface to optimize your work is via the general interface options. Changing these options can make the interface cleaner allowing you to work with fewer distractions and also give over more space to the main scene view. Most interface options are, fittingly enough, under the Options Ø UI Preferences menu. On selecting this choice from the menu, you will see a multi-tabbed window that allows you to adjust many of Maya s UI settings.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=623946280 (1 of 2) [11/27/2000 8:21:51 PM]
Books24x7 Mastering MAYA Complete 2
For each tab, you have the option of saving your preferences automatically (on quitting) for use in you next Maya session, or saving them explicitly (by clicking the Save button) by saving explicitly, you can alter your preferences for one session without affecting the interface when you restart Maya. If you are unsure how to return to a default set of options, try using the Save Explicitly option until you are sure you like the interface changes you make. Under the Windows tab, you can adjust top and bottom dimensions for both the main window and Script Editor, though it is probably easier to do this interactively in the Maya window itself. You can also turn off the title bar and main menu bar doing so removes the blue border at the top of the screen (which contains the title of the scene) and the menu set at the top of the main window, saving about 30 or 40 pixels of space for your scene window, and cleaning up the interface look a bit. You can also tell Maya to either remember or forget where you position your windows, and whether the Attribute Editor appears in a separate, floating window (as in version 1) or replaces the Channel box when Ctrl+A is pressed. Tip You can also turn off the main menu bar and/or pane menus under the Hotbox Controls menu in the hotbox: display the hotbox and choose Controls Ø Window Options Ø Show Main (or Panel) Menu Bar. Under the Shelf tab, you can adjust how the shelf icons are presented, and you can tell Maya whether to save shelf contents automatically or only when you explicitly tell it to save (generally it is better to have Maya save the contents automatically, unless you are experimenting with a new look). The Layout tab allows you to turn all components of the window (except the main scene window) on or off. If, for example, you are only modeling for a time, you could turn off the time and range sliders, freeing up more space for your scene. The Panels tab allows you to turn panel menus on or off, and also lets you specify how the main scene window will first appear when you open a new Maya scene (it defaults to Single Perspective view). Tip You can also quickly turn panel menus on or off directly in the Options menu (Options Ø Layer Bar, for example). Being able to turn panels on and off quickly makes it easy to switch from, say, a modeling user interface (UI) set to an animation UI set. The Miscellaneous tab lets you choose how your Web browser (usually Netscape Communicator or Microsoft Internet Explorer) will be activated upon a request for online help. You can also choose which menu set Maya defaults to on opening, and whether the focus (the cursor) will stay on the command line after you execute a MEL command from it.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=623946280 (2 of 2) [11/27/2000 8:21:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using the Hotbox Instead of Menu Sets As we discussed in the previous chapter, using the hotbox instead of dealing with all of the different Maya menu sets can really speed up your work, as well as clean up your Maya environment. In general, most professionals turn off menu bars (main and panel), and use the hotbox to choose menu functions. To turn off menus, either use the UI Options menu or uncheck the main and panel menus under the Hotbox Controls menu (Hotbox Controls Ø Window Options Ø Show Main (Panel) Menu Bar). Once the menus are off, just press and hold the spacebar to bring up the hotbox. Any or all menu sets can be displayed in the hotbox, depending on your choices under the Hotbox Controls menu. Again, generally speaking, most advanced users tend to display all menu sets (Animation, Modeling, Dynamics, Rendering, Maya Live, Cloth and Fur) at once, making the hotbox fairly complex to look at, but, once you find where all the different menus are, it s only a one-step procedure to access any menu from that point on. Note For more on how to use the hotbox and how to set its options, see Chapter 2. Note This discussion of customizing shelves, hotkeys, and marking menus is very basic. Because MEL scripts are the most efficient tool for customizing these interface elements, you ll find a much more thorough discussion of these topics in Chapter 16.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=218739145 [11/27/2000 8:21:55 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Shelves While we briefly discussed shelves in the previous chapter, they might have appeared only marginally useful. What makes shelves really useful is not what appears on them by default, but the fact that you can easily add new buttons to any shelf. You can, for example, make any menu item a shelf button, or even place MEL scripts on the shelf, allowing you to perform complex tasks at the click of your mouse. Additionally, as you can create and use multiple shelves (to create a new shelf, choose Options Ø Customize UI Ø Shelves, select the Shelves tab, and click the New Shelf button), you can make a shelf specific to a task. For example, a shelf could be devoted to just MEL scripts, and another could be given over to common tasks for a specific project you re working on. To switch to a new shelf (shelf2, for example), simply click its tab on the shelf bar. To create a new shelf button from a menu item, hold down the Ctrl, Alt, and Shift keys (all together), and choose the menu item from the menu bar (not the hotbox). A new button will appear on the active shelf, and clicking this button will be the same as selecting the menu item you had chosen. Warning You must create shelf buttons from the main (or panel) menu bar, not the hotbox. As many users turn off these menu bars, it is a bit of a pain to create new shelf buttons you first have to reactivate the menu bar, then create the button, and finally turn the menu bar off again. To delete any shelf button, just MM drag it onto the trash can at the top right of the shelf bar. To move an item to a different place on the shelf, simply MM drag it to the place you wish it to be. Other shelf items will adjust themselves to the new placement. As an example, let s create a button that automatically creates a NURBS cylinder, and place it just next to the NURBS sphere button on shelf 1. First, be sure you have shelf 1 selected by making sure its tab is frontmost. Next, hold down the Ctrl, Alt, and Shift keys and, from the main menu bar, select Create Ø Nurbs Primitives Ø Cylinder. A new button should appear at the far right of shelf 1. Finally, just MM drag the new button between the sphere and cone icons on the shelf. Voilà, one more primitive you can now create without resorting to the menu bar!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=198081892 (1 of 2) [11/27/2000 8:22:01 PM]
Books24x7 Mastering MAYA Complete 2
Tip You could also create a NURBS cylinder button that automatically brings up the options window. Just hold down the Ctrl, Alt, and Shift keys and choose Create Ø Nurbs Primitives Ø Cylinder Ø. You can create as many of these buttons as you wish (though you might have to scroll through the list if you create too many on one shelf), and/or delete any of the default buttons Maya provides for you, thus customizing your shelves to contain buttons that are the most useful to you (buttons for items like the Hypergraph and Hypershade are very nice to place on shelf 1 for easy access). You can also create new shelves by opening the Shelves Options window (Options Ø Customize UI Ø Shelves). Under the Shelves tab, click the New Shelf button, give it a name, click Save All Shelves, and close the window. You can also turn MEL scripts into shelf buttons. To see how this works, let s create a very simple example. Open the Script Editor (click the Script Editor icon at the bottom right of the screen, or choose Window Ø General Editors Ø Script Editor). In the input (bottom) section of the window, type in the following: sphere
n ball
r 2;
Highlight this text (drag over it, or triple-click the line), MM drag the text up to the shelf, and a new button will appear. Now, whenever you click this new button, a new NURBS sphere named ball, with a radius of 2, will appear at the origin of your scene. Even this simple example makes it clear how powerful a little MEL scripting can be; clicking one button not only creates a sphere, but names it and gives it the radius you wish. You could even build a whole shelf for geometric primitives, with a group of buttons for each primitive type, each button having a different option set. Tip You can also highlight any text in the history (top) section of the Script Editor, recording your actions into a macro. You could therefore perform several complex steps in the Maya interface (that you wish to repeat later), and turn all these steps into a button by highlighting all the text in the history window and MM dragging it to a shelf. Thus, with no MEL programming knowledge, you can create buttons that do very complex actions. For specific examples, see Chapter 16.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=198081892 (2 of 2) [11/27/2000 8:22:01 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hotkeys If you have used Maya for any time, you are already familiar with many of its hotkeys, which are simply shortcuts to commands (or command modifiers) that are accessible by a keystroke. Accessing the Move tool, for example, is a simple matter of pressing the W key. As with most of Maya s interface, you are not limited to the hotkeys Maya has built in: You can create your own hotkeys, or even change or delete the hotkeys Maya has built in. Note Again, you ll find a more thorough discussion of customizing hotkeys in Chapter 16. As an example of how to create a hotkey, let s make a keyboard shortcut to bring up the Hypergraph. First, open the hotkeys options window (Options Ø Customize UI Ø Hotkeys). In this window, scroll down until you reach the Window Menu set, then find Window >Hypergraph and highlight it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=408919452 (1 of 2) [11/27/2000 8:22:10 PM]
Books24x7 Mastering MAYA Complete 2
First, we need to find a key that is not currently mapped to any other hotkey. Under Key Settings, in the Key text field, type a lowercase h (H is different from h for hotkeys!), be sure the Press radio button is enabled, and check the Alt box (which means the hotkey will be Alt+h, not just h). Now click the Query Key button to see if any hotkey currently uses this combination. You should see a dialog telling you no command is currently mapped to this key (if not, try another key/modifier combination). To enable the new hotkey, click the Apply New Settings button; you should now see (in the text window at the top) that Alt h Press has been assigned to the Hypergraph command. Press the Save button to save your changes. To test the new button out, close the hotkeys options window, then press Alt+h in the scene window. The Hypergraph should pop right up for you! Tip You can also create your own commands and assign them to hotkeys. This is covered briefly in the next section, and more thoroughly in Chapter 16.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=408919452 (2 of 2) [11/27/2000 8:22:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Marking Menus In addition to shelves and hotkeys, you can also create entire contextual menus (called marking menus) that appear either in the hotbox or when you press a hotkey combination. Note You ll find a more thorough discussion of creating and using marking menus in Chapter 16. Let s create a marking menu that will create a sphere using one of four options: radius = 1, radius = 2, radius = 3, radius = 4. First, open the Marking Menus options window (Options Ø Customize UI Ø Marking Menus). In this window, you will see listed several marking menus that have already been created for Maya, including the region menus that appear to the north, east, south, and west in the hotbox (for more on this, see Chapter 2).
For our purposes, we want to create a new marking menu, so click the Create Marking Menu button. This brings up the Create Marking Menu window, with several blank boxes that we will use to create our own marking menu. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=104601359 (1 of 4) [11/27/2000 8:22:16 PM]
Books24x7 Mastering MAYA Complete 2
First, give the marking menu a name, such as CreateSpheres. Because we will create a marking menu with four options, it is logical to use the top, right, bottom, and left boxes as our menu positions. There are a couple of ways to assign a command to a menu item: you can MM drag a shelf button that you have made (or one of the default buttons, like the cone button) onto a menu box, you can MM drag MEL scripts or lines to the menu item, or you can RM click on a menu item and choose Edit Menu Item (the option we will use here). Starting at the top center box, RM choose Edit Menu Item, and in the window that pops up, type Sphere radius 1 in the Label field, and type sphere r 1; in the Command(s) field (be sure the sphere command is in lower case!). Finally, click Save and Close to save your changes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=104601359 (2 of 4) [11/27/2000 8:22:16 PM]
Books24x7 Mastering MAYA Complete 2
Now, move over to the right center (east) box, RM choose Edit Menu Item, and repeat the steps from above, but this time label the button Sphere radius 2, and make the MEL command sphere r 2;. Move to the south and west boxes, and repeat the steps, making the south box create a sphere of radius 3 and the west box create one of radius 4. When you are finished, your Create Marking Menu window should look as follows.
To test the buttons, click in the Click Here to Test box. You should see all your menu options appear, and if you choose an option, an appropriately sized sphere should appear in your scene window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=104601359 (3 of 4) [11/27/2000 8:22:16 PM]
Books24x7 Mastering MAYA Complete 2
Once you have your menu working as you want, click Save and then Close to return you to the Marking Menus Options window. Your new CreateSpheres menu should now appear at the bottom of the list, highlighted (if it s not highlighted, do so). We now have our menu, but we can t access it from the scene window. To do so, we need to choose whether we want the menu to be part of the hotbox or accessible via a keystroke. This time, let s create a marking menu that will appear when we press a special key: under Settings, choose Hotkey Editor from the pop-up menu and then click the Apply Settings button. To the right of the CreateSpheres item in the list at the top of the window, there should now be the message Accessible in Hotkey Editor, meaning that we can now make a hotkey for our new menu. Close the Marking Menu Options window and open the Hotkeys Options window (Options Ø Customize UI Ø Hotkeys). Scroll all the way to the bottom of the hotkey list, and, in the User Defined section, you should see CreateSpheres (Press) and CreateSpheres (Release). Tip The press and release states are important to a marking menu. When the hotkey is pressed (the press state), the menu will appear; when the key is released (the release state), the menu disappears. If you forget to define a release state for your menu, it will not disappear when you release the hotkey! Now we just follow the steps we used in the last section to define a hotkey. First, select the CreateSphere (Press) item; then query a key Ctrl+r should be open for your use. When you have found an open key combination, be sure your Action radio button is set to Press; then click the Apply New Settings button. You should see that CreateSphere (Press) is now set to Ctrl r Press in the top list. To define the release state, select the CreateSphere (Release) item, type r and the control modifier in the Key Settings, and be sure the Action is set to Release (not Press). Then click the Apply New Settings button, and the release state should be mapped. Finally, press the Save and Close buttons in the Hotkeys Options window. (Whew!) To test your new marking menu, hold down Ctrl+r, and press the left mouse button. You should see your marking menu, ready for use!
Although there are many steps involved in creating a marking menu (so you probably wouldn t create one for a quick, simple task), consider the power a marking menu gives you: a complete new menu with multiple items (and even subitems) that you can access anywhere in the scene window at the click of a key. Marking menus are relatively easy to create, and a great idea for tasks you repeat often especially if they have multiple options.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=104601359 (4 of 4) [11/27/2000 8:22:16 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Working in Layers Working in layers can be particularly useful when you are modeling a multiple-part, complex object (the inner workings of a mechanical clock, for example, or a complex creature like a human or dog). By placing groups of objects in layers (fingers in one layer, hand in another, arm in another), you can easily hide, display, template or otherwise adjust large groups of objects all at once, rather than tediously selecting each object and then changing it or, worse yet, being unable to select one object that is hidden behind another. The Layer bar is a quick visual reference for working in layers, so if you have it turned off, turn it back on again (Options Ø Layer Bar). The Layer bar should appear just above your scene window, with the Default layer already selected (the Default layer is where all objects that have not been assigned to other layers are stored). To create a new layer, just click the layer icon (the icon to the far left of the Layer bar that looks like three sheets of paper). If you double-click on the default layer name (layer1), a dialog box will open, allowing you to rename the layer to whatever you wish. Once you have made and named a layer, create a couple of simple objects (like a sphere and a cylinder), select them, and, from the triangle button to the left of the layer name, choose Assign Selected. The objects you had selected are now part of your new layer. Return to the scene window, deselect all objects, and (again from the Layer pop-up menu), choose Select All in Layer. You will see your objects selected once again, as they are a part of this new layer. To get a better view of your new layer, choose Edit Membership from the layer pop-up menu. This brings up the Relationship Editor, with all layers on the left side, and all objects on the right side.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=628588013 (1 of 2) [11/27/2000 8:22:23 PM]
Books24x7 Mastering MAYA Complete 2
When you click on a layer name, all objects in that layer become highlighted on the right. You can then click on any object on the right side, toggling its inclusion in the layer (highlighted means it is included; not highlighted means it is not). You can quickly change which layer you are working with, and which objects are included in each layer by using this window. Try placing one object in your layer, another in the default layer. Note Each object can only belong to one layer. Therefore, if you highlight your sphere in the default layer (for example), it will be unselected from your other layer. Tip You can also adjust each layer s attributes by choosing Layer Attributes from the Layer pop-up menu. To quickly hide or show all objects in a layer, check the Visible box in the Layer pop-up menu. This menu can also change the state of each layer individually. The Standard state is your normal working state. The Template state turns the objects into templates (they cannot be selected or moved, and they turn a pinkish orange). The Reference state makes the layer a reference layer, once again making all objects in it unselectable, but keeping their display properties. While working in layers for a simple scene like our example may seem a waste of time, as we move on to more ambitious projects you ll see how useful being able to select, hide, template or otherwise alter several objects in a complex scene can be. If you have not used layers before in Maya or any other program, try modeling an intricate object that has many overlapping pieces and you ll quickly appreciate how useful layers can be.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=628588013 (2 of 2) [11/27/2000 8:22:23 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
The Outliner There are two basic ways to look at all of the information in your scene: the Outliner and the Hypergraph. While the Hypergraph is the more flexible and powerful of the two, the Outliner is usually easier for a new Maya user, and it performs several tasks in a more straightforward fashion than does the Hypergraph. Conceptually, the Outliner is exactly what its name implies: it is an outline of the scene you are working on. To open the Outliner, choose Window Ø Outliner from the main menu set (or hotbox). If you had created a default sphere, and it was selected, the Outliner window would look as shown on the facing page.
The first four items in the Outliner are the four default cameras (plus any other cameras you might have created). Next are listed geometric objects (like the sphere). Finally, sets (groupings of objects, like the default light and object sets) are listed. Any highlighted objects (in gray) are selected in the scene, and vice versa. You can rename any object listed in the Outliner by double-clicking its name. You can also bring up the Attribute Editor and focus it on any object in the Outliner by double-clicking on its icon.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=636585882 (1 of 2) [11/27/2000 8:22:33 PM]
Books24x7 Mastering MAYA Complete 2
There are several viewing options available in the Outliner, accessed either via the Outliner s menu or by holding down the right mouse button anywhere inside the Outliner window. Some options you have are to show only specific types of objects, like geometry (Show Ø Objects Ø Geometry), to show shape nodes for objects (more on this in Chapter 4), or to show all objects, rather than just the DAG (Directed Acyclic Graph a technical term for the common objects you see in the scene) objects. If, for example, you turn on Show Shapes, a plus sign appears to the left of any object in the scene that has a shape node (as a sphere or other geometric object would have). By clicking on the plus sign, you can expand the outline to see the shape node; in the case of our sphere, this would reveal the nurbsSphereShape1 node.
The Outliner can be used in several ways, but there are two that are probably the most appropriate: to get a quick look at the scene as a whole, and to access objects in a complex scene in a more convenient manner than having to pick the object. The first use for the Outliner getting an overview of the scene is the function of any good outline (from the outline of a term paper to the schematic outline of an electrical circuit). Because you can show or hide any type of object in the Outliner, you could, for example, look only at the lights in a scene; this would allow you to see quickly how many lights there are, and, by double-clicking on the light icons, you could just as quickly bring up the Attribute Editor to examine or adjust their options. The second main use for the Outliner allowing quick selection flows from the first. As the Outliner provides easy access to any or all objects in the scene, you can rapidly choose, alter (via the Attribute Editor), or rename objects in a convenient list form, rather than having to hunt through a scene to find them, never knowing for sure if you have forgotten an object. In complex scenes, the ability to choose objects becomes even more important. Consider an object like a Christmas tree with a hundred ornamental lights on it. The tree itself might consist of two or three dozen objects (branches, base, and so on), and the hundred lights would be intertwined in the tree, making them very difficult to select for modification. In the Outliner, however, this job would be easy. First you would choose to show only light objects (Show Ø Objects Ø Lights) and then move down the outline of the scene, selecting and adjusting lights at will. As should be apparent, this method of interacting with your scene can be a real lifesaver.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=636585882 (2 of 2) [11/27/2000 8:22:33 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
The Hypergraph The Hypergraph performs many of the same functions as the Outliner, but it uses a completely new interface design. The whole of the next chapter is devoted to the Hypergraph, so we will only mention it briefly here. This tool is worth noting in a chapter on interface optimization, as it can radically reduce the time you spend hunting through the scene and other windows, and it can really speed up your workflow. To bring up the Hypergraph, choose Window Ø Hypergraph from the main menu set. For a scene with a single sphere, the Hypergraph would look as follows when you first bring it up.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=297803908 (1 of 2) [11/27/2000 8:22:42 PM]
Books24x7 Mastering MAYA Complete 2
In its simplest incarnation (with many options turned off), the Hypergraph is actually simpler to understand than the Outliner. There is only one object apparent in the Hypergraph for the scene in this case, the NURBS sphere. When an object is selected in a scene, the corresponding box in the Hypergraph turns yellow; if the object is not selected, the object remains gray (similar to the default shading color of all objects in Maya). Clicking on a box in the Hypergraph is the same as selecting the object in the scene window: the box turns yellow (indicating it is selected) and the object in the scene is highlighted in green. You can select multiple objects in the Hypergraph by either Shift+clicking on them or simply dragging a selection marquee around them. To deselect a single item, Shift+click on it in the Hypergraph. To deselect everything, just click in the empty space in the Hypergraph window. The Hypergraph contains many menus, and while a complete discussion of them must wait until the next chapter, it is worth noting that you can choose to display only certain objects in the Hypergraph (Show Ø Objects Ø NurbsObjects, for example), or show object components like shape nodes (Options Ø Display Ø Shape Nodes). Where the Hypergraph really shines is in its ability to act like any other scene window. You can scale and track through the Hypergraph just as you would in any scene window, allowing you to see the entire sweep of a complex scene, or any part thereof, very easily. You can also focus on a selected object very quickly (say, for example, the object is selected in a scene window) by pressing the F key on the keyboard; or you can expand the view to contain all elements of a scene by pressing the A key. For simple scenes, the Outliner is a very useful tool, but for complex ones, the Hypergraph can be a much faster interface, as it allows such tracking and focusing across hundreds of scene elements. Which scene outline interface you want to use is, of course, your choice, but you should become familiar with both; one author, in fact, often uses both the Outliner and the Hypergraph in tandem on very complex scenes, allowing him to work in both views at once.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=297803908 (2 of 2) [11/27/2000 8:22:42 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
The Hypershade While the multilister from Maya 1 was a useful interface for working with textures, materials, and utility nodes, it was not intuitive, and its interface did not fit in with the rest of Maya s interface conventions. Version 2 provides the Hypershade to remedy that problem (though you can still, of course, use the multilister). Using a similar convention to the Hypergraph, the Hypershade not only shows you interactive previews of what a material or texture will look like, it shows how the elements of a shader network are connected, giving you more information in a more intuitive interface than the multilister. Also, as with the Hypergraph, you can zoom and track the Hypershade like any Maya scene window, and use the F key (frame selected) and A key (frame all) to quickly focus on any element(s) you wish, making it easier to navigate scenes with large numbers of shading groups. To open the Hypershade, choose Window Ø Hypershade.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=476443927 (1 of 3) [11/27/2000 8:22:51 PM]
Books24x7 Mastering MAYA Complete 2
On the left is the Visor window, which is similar to the Outliner but contains graphic icons of textures and allows you to create, as well as view, any material node you wish. On the right is a Hypergraph-like window, known as the graphing window, with all materials listed in a new scene, there will only be two materials listed, the lambert1 shader (the default shader for geometry) and the particleCloud1 shader (the default shader for particles). Tip The three buttons at the top left control your view of the Hypershade window. Click the left button to turn off the visor, so that the graphing window fills the Hypershade, or click the right button to turn off the graphing window and view only the visor. (Click either button a second time to restore the view.) Click the middle button to clear the view. To select a material, simply click on it (it highlights in yellow to show that it is selected). You can then view that material s upstream connections, its down stream connections, or both by clicking the appropriate button at the top right of the Hypershade window or by choosing Graph and the connection type from the Hypershade menu. The particle cloud, for example, has several inputs and outputs that appear as shown next if you click the Show Up and Downstream connection button. To get back to a general view of materials, choose Materials from the pop-up menu at the top of the Hypershade window.
Note An upstream connection is any Hypershade node that feeds into the selected node (its output is fed into the currently selected node or it is upstream in the data flow). A downstream connection is any node that the currently selected node feeds data into thus it is downstream from the selected node in the data flow. Tip You can also view shading groups, utilities, lights, cameras, and so on, by choosing the item from the pop-up menu. In addition to looking at materials, textures, and such, you can also create these items directly in the Hypershade in one of two ways. To create a material graphically, find the Create subsection of the visor (below the Rendering section), click on the Materials folder to open it (unless it is already open), and MM drag a material ball into the Hypershade side try the phongE material, for example. After dragging, you will get a new phongE material in the Hypershade, ready for you to adjust. To assign this new material, you can just MM drag it on top of any object in your scene window. (Or you can click on the triangle below the phongE name and choose Assign Material to Selected; this is a good method of assigning the material to several objects at once.) To change the material s attributes (color or transparency, for example), double-click on the material ball to bring up the Attribute Editor, and then make any changes you wish to the material. The ball in the Hypershade, as well as any objects that have this material assigned to them, will be automatically updated with your changes. The other method for creating a new material is simply to choose Create Material from the menu in the Hypershade Create Ø Materials Ø phongE, for example. This produces a new material in the Hypershade window, just as MM dragging the material icon from the visor does.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=476443927 (2 of 3) [11/27/2000 8:22:51 PM]
Books24x7 Mastering MAYA Complete 2
To assign a texture to your new material, you can again choose to create the material via menu commands (Create Ø Textures Ø 2D Ø Fractal, for example), or just MM drag a swatch from the Create: Textures folder in the visor on top of your material.
Once you complete the drag, a menu will open, letting you select which element of the material (which input) you wish to assign the fractal (or other) texture to. The most common choice is simply Color, so choose that. The Hypershade window will be updated to show that there is a texture input connection (coming from the left is input; going to the right is output) of a fractal texture, and the phongE material ball, plus any objects with the phongE material in your scene, will update to show the new texture.
While there are many other functions the Hypershade can perform besides the basics we have covered here, the centralized power of being able to create, modify, connect and disconnect materials, textures, and so forth, should be obvious from the quick tour we have taken. It is worth the effort to get to know the Hypershade, as it will save you a great deal of time and effort later on in your work with Maya s shader networks. Tip For more on rendering with the Hypershade, see Chapter 18.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=476443927 (3 of 3) [11/27/2000 8:22:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
A Workflow Example: Building an Arm Let s take all the interface/optimization information we ve gathered over the past two chapters and put it to use in a practical example. Over the next few pages, we ll model an arm, and then string it to bend at the elbow, using an Inverse Kinematics (IK) chain. Throughout this example, we ll put our understanding of Maya s interface to good use, making our modeling task that much easier. Open a new scene in Maya. Either sketch out a top and side view of an arm and then scan it into your computer, or use the sketches included on the CD-ROM (ArmTop.tif and ArmSide.tif). Tip Sketching your image before you model is always a good idea even if you have no skill at drawing. It is much easier to see what you re creating by quickly drawing it on paper than it is to try to create an object in 3D space out of your head. You will find that sketching an object before modeling it, far from taking extra time, will save you a great deal of time, and give you better-looking results as well. Note When you sketch an object for use as a background image for modeling, it is important that your two views (top and side here) are exactly the same size. We generally use graph paper in these circumstances, as it is easy to see how large the image is on this type of paper. As we will use these sketches to make our model, they need to be loaded into Maya s top and side views so we can reference them as we build our arm. First, open the Outliner and select the top camera icon, double-clicking it to open the Attribute Editor. In the Attribute Editor, click the Environment triangle, and then click the Image Plane: Create button to create an image plane for the top view camera. When you click this button, the Attribute Editor will focus on the image plane (imagePlane1), but you still need to assign your arm image to the plane. To do so, scroll down to the Image Name line and click the Browse button. Find your top arm image (or use the ArmTop.tif image on the CD) and choose it. Repeat this process for the side view, using the side arm view image instead. When you are finished, your four view (press the space bar quickly to get this) should look as follows.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511793451 (1 of 5) [11/27/2000 8:23:04 PM]
Books24x7 Mastering MAYA Complete 2
In order to keep from accidentally selecting one of these planes as we continue to work, let s put them on their own layer and make that layer a reference (unselectable) layer. From the layer bar, click the Create a New Layer button, rename this layer ImagePlanes, select both image planes, and choose Assign Selected from the layer menu. To make the layer a reference layer, choose Reference from the layer menu. There are several good modeling techniques to use from this point on, but we will use a common, fairly painless, method that produces good results quickly: lofting a series of circles into a shape. Note Lofting creates a shape in something like the way a wooden ship hull is laid (or lofted) over a skeleton of wood that defines the shape the hull will have once the lofting process is complete. (The metaphor of shipbuilding and hulls will become quite familiar, as it underlies much of the terminology of 3D modeling.) First, create a new layer (click the New Layer button in the Layer bar) and name it Circles we will assign our circles to this layer so they are separate from our eventual lofted surface. Next, expand one of the views (the top, say) to fill the screen (click in that pane, and then press the spacebar quickly). We could create our circles by going to the menu each time, but let s speed up our workflow by quickly making a button on the shelf to make our circles. Hold down the Ctrl, Alt and Shift keys and, from the main menu bar (this won t work from the hotbox!), choose Create Ø Nurbs Primitives Ø Circle; a new button should appear on your shelf, and clicking that button will create a circle. If you now click the Circle button, the circle will probably be flush with the plane, which means we would have to turn it perpendicular to the plane each time. Rather than do this every time we create a circle, let s change the options once and save them, so that each new circle will be oriented correctly. Choose Create Ø Nurbs Primitives Ø Circle Ø, and in the options window, change the Normal Axis setting to the Z axis. (From our angle, the circle will now appear as a line.) Click the Save button (to save the settings) and close the window. The old Circle button on the shelf will remember its original settings (when you created it), so you will need to MM drag this button to the trash can on the shelf bar, then recreate the button (or, if you have read this far before starting the process, just change the circle settings first!).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511793451 (2 of 5) [11/27/2000 8:23:04 PM]
Books24x7 Mastering MAYA Complete 2
Now we re ready to build our arm. In the top view (don t worry about the side view yet), Click the Circle button, move the new circle down to the bottom of the arm, and scale it to the same size as the bottom of the sketched arm. Remember that you can zoom your view in to see how accurately you re placing the circles.
Tip If you find the background image too distracting, select the camera (top here), open the Attribute Editor, click the imagePlane1 tab, and reduce the alpha gain to about 0.5. This will fade the image back a bit, giving you a clearer view of the circles you are creating. To create the arm, create several circles, and position and scale them to fit the sketch of the arm in the top view. Be sure to place more circles around the elbow area, as that area will eventually bend (as any good elbow should), and therefore needs more definition. When you are finished, your arm should look similar to the following image.
When you have finished with the top view, you will now need to switch to the side view, this time scaling and moving the circles so they fit from this view as well. (Don t move them along the X axis, however!) Your completed side view should look similar to this.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511793451 (3 of 5) [11/27/2000 8:23:04 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you find you need a new circle to help build the shape in the side view, add one just be sure to go back to the top view and adjust it there! We now have the outline of our arm finished it s time to create the arm itself! We need to select all the circles that will make up our arm and then loft them. But don t just drag a selection marquee around the circles; the loft tool depends on the order in which you select your circles, so we need to be careful about the order we select them. Starting at either end (the top or bottom of the arm), Shift+click on each circle in order, until all are selected. Before we loft these circles, first assign them to the Circles layer for later use (choose Assign Selected from the Circles layer menu). Now let s see how we did: Loft the circles into a surface (Surfaces Ø Loft). You should see an arm-like tube appear in your perspective window.
Because of the image planes, it s a bit difficult to see our arm. From the imagePlane layer menu, uncheck the Visible box to make the planes disappear. You will probably find that the arm doesn t look quite realistic. Fortunately, because Maya remembers construction history, you can go back and tweak the position, scale, and rotation of the circles (using the same techniques we used to create the circles, above) to get the arm to look the way you want it. When you like your arm, turn off the circle layer s visibility so you can see the surface more clearly. Tip Templating the lofted surface (Display Ø Object Components Ø Templates) so you can t accidentally select it is a real time saver. To untemplate the object when you are finished with adjustments, select the lofted surface in the Outliner or Hypergraph, and choose Display Ø Object Components Ø Templates again.
Now we need to string our arm with an IK chain so we can move it around like a natural arm. Make the side view fill your workspace, and then choose the IK Joint tool from the shelf (or choose Skeleton Ø Joint Tool). Starting at the top (shoulder), click (or drag) the tool where the shoulder joint should be, then click again where the elbow should be, and finally, click where the wrist would be. If you don t like where your joint is, undo the last click (press the Z key) and try again. When you are satisfied with the look of the joints, press the Enter key to confirm the new skeleton.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511793451 (4 of 5) [11/27/2000 8:23:04 PM]
Books24x7 Mastering MAYA Complete 2
Warning Be sure not to make all three joints follow a straight line. Maya s IK solver uses the direction of the joint s initial bend to determine which direction it will bend later. If you make the joints straight, Maya won t know which direction to bend the arm, and you will get bizarre results.
We could now manipulate the joints using the rotate tool, but it is generally easier to create an IK chain to make the moving process simpler. To do so, choose the IK Handle tool on the shelf (or choose Skeleton Ø IK Handle Tool) and click first on the shoulder joint and then on the wrist joint. (Skip the elbow joint so that the kinematics chain will go through the elbow, allowing it to bend with the wrist movements). You should now see a green line connecting the shoulder and wrist joints. If you wish, you can now move the joint around by drag selecting the wrist IK handle and moving the arm however only the joint moves at present; we need to attach the arm to our new joint. Tip If you move the joint around before attaching the arm to it, be sure to undo (press Z) back to the original position before attaching the arm. The final step, attaching the arm surface to the arm joint, is a process of selecting the joint and surface and binding them together. First, select the root joint of the arm skeleton (the shoulder joint), then Shift-select the arm surface. Finally, choose Skin Ø Bind Skin Ø Smooth Bind to bind the two together. To see your beautiful new arm at work, drag-select the wrist joint and use the move tool to move the wrist around. The skeleton (and arm surface) should follow the wrist where you drag it.
Note You may notice that the elbow doesn t bend properly (it folds too much). You can use the Artisan tool to adjust the joint goal weights of the arm to make the bend far more realistic looking. For more on how to do this, see Chapter 9.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511793451 (5 of 5) [11/27/2000 8:23:04 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 3 - Techniques for Speeding Up Workflow Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we went over many elements in Maya that you can either adjust or use as-is to get the most out of your work. Looking at general options, shortcuts, organizational windows like the Hypergraph, the Hypershade, and the Outliner, and working in layers, we saw how much one can adjust Maya s default interface to improve your workflow. The final working example building a moveable arm took many of the workflow lessons we learned in this and the last chapter and put them to real-world use. We created a shortcut button, worked in layers, and used hotkeys to choose the scale, move, and rotate tools, all of which increased the speed with which we completed a reasonably complex task. In the next chapter, devoted to the Hypergraph, we will see how a thorough knowledge of this interface element can improve your workflow on complex tasks even more. Even if much of what you have read in this chapter is a bit confusing to you now, try to remember, as you continue working on your projects, the little tricks and shortcuts we have discussed here. With a bit of practice, many of the techniques discussed in this chapter will become second nature to you, and your Maya skills and products will reflect this.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=387338697 [11/27/2000 8:23:13 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 4 - The Hypergraph-Your Roadmap to the Scene Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 4: The Hypergraph Your Roadmap to a Scene Overview Of you come to Maya from another 3D package (as many of us do), you are probably familiar with a window like Maya s Outliner, which helps you keep track of objects in your scene. On the other hand, it is unlikely that you have run across anything quite like Maya s Hypergraph. For this reason, even many seasoned Maya users steer clear of the Hypergraph (using the Outliner instead), as they can t make heads or tails of its interface. The goal of this chapter is to clear up any confusion you may have about the Hypergraph whether you re a new Maya user or a long-time user who just doesn t use the Hypergraph and reveal how powerful an ally the Hypergraph can be when you are working on anything from simple to very complex scenes. While the Hypergraph may seem confusing on its surface, once you see that its interface was designed to parallel Maya s scene window interface and once you see the many different ways in which the Hypergraph can function you will wonder how you ever got along without it. Even if you are an experienced Hypergraph user, you may find some useful tidbits in this chapter.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=976299956 [11/27/2000 8:25:19 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 4 - The Hypergraph-Your Roadmap to the Scene Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What Is the Hypergraph? The Hypergraph is, in its essence, a hypertext-like view of your scene (thus the name). If you have worked with an HTML authoring tool, you will recognize the web-like appearance of linked objects in the Hypergraph. Every element visible in a scene is represented by a text box, and any linked objects have a line that connects them together, showing their connection in the scene. Passing your cursor over the line, you ll see which elements of each object are connected. Besides displaying the relationships between objects and elements in a scene, the Hypergraph also lets you create or modify those relationships for example, you can parent two objects together or break an input connection directly in the Hypergraph, rather than having to go to the scene window or Relationship Editor. In essence, the Hypergraph is your scene you can do pretty much everything you can do in a scene window, and more, only it s represented as text boxes instead of the objects you would see in the scene windows. Note The types of objects visible in a scene depend on the filtering choices you ve made using the Hypergraph s Options Ø Display menu.
Why Use the Hypergraph instead of the Outliner? The Outliner is exactly what its name implies: an outline of your scene. While you can perform many useful functions in the Outliner, almost all of these can be performed as easily (or more so) in the Hypergraph, and the Hypergraph allows you to do many tasks that are impossible in the Outliner. While the Outliner is, for most people, easier to understand at first, the Hypergraph is actually much more aligned with the way Maya works, as it is organized around navigation and connection conventions used throughout Maya. Thus, once you get accustomed to using the Hypergraph, it will seem much more natural than the Outliner as a means of getting around your scene.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=981349842 [11/27/2000 8:25:26 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 4 - The Hypergraph-Your Roadmap to the Scene Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Getting to Know the Hypergraph Because the Hypergraph offers so much information, it takes a bit of effort for most people to feel comfortable with it. We will therefore work through the Hypergraph piece by piece in the following pages, using examples to clarify certain concepts, but mostly just showing how the interface works. By the time you finish this section, you should feel comfortable enough with the Hypergraph to begin using it in your work (if you don t already) and once you use it a while, it s likely you won t know how you got along without it.
Navigating the Hypergraph Open a new scene in Maya, and create two objects say a sphere and a cone. Now open the Hypergraph by choosing Window Ø Hypergraph from the main menu set. In the Hypergraph window, you should see icons for the objects you created:
Tip Because you will probably access the Hypergraph many times while working in Maya, it is a good idea to create a button on your shelf for it. From the menu bar (not the hotbox), choose Window Ø Hypergraph while holding down the Ctrl, Alt, and Shift keys. A new button will appear on the shelf for the Hypergraph. You can also create a hotkey for the Hypergraph if you prefer (see Chapter 3 for more on how to do this).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (1 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
If you compare this view to a view of the same scene in the Outliner, you can see that the Hypergraph is actually less complex (as it doesn t show the cameras or default sets), but it is organized in a side-to-side manner, rather than top-to-bottom.
You will also notice that the Hypergraph indicates a selected object by coloring it yellow (the cone in this case), while the Outliner highlights the object in a gray bar. Zooming and tracking in the Hypergraph use the same techniques as in the scene windows. To zoom, hold down the Alt key and the left and middle mouse buttons dragging to the left zooms out, while dragging to the right zooms in. To track across (or up and down) the Hypergraph window, hold down the Alt key and the middle mouse button, and then drag the mouse around to track through the window. By tracking and zooming, you can quickly move through even a large scene, finding the nodes you re interested in. Additionally, you can use two hotkeys to frame the Hypergraph around a selected object or around all objects in the Hypergraph. To focus the window on one or more selected objects (highlighted in green or white in the scene window), press the F key. To expand the view to fit all displayed objects, press the A key. If you try this with our example scene (with the cone selected), pressing F will fill the Hypergraph window with the cone node, while pressing A will expand the view to fit both the sphere and the cone. Tip The A and F keys also work in any scene window pressing F will focus the window on the selected object(s), while pressing A will make the entire scene fit in the window. This is another way in which the Hypergraph and scene windows behave in the same manner. If your scene is complex, and you find yourself consistently hunting for a particular object (or group of objects) in the Hypergraph, you can save yourself a great deal of time by bookmarking any or all views you are likely to need at a later point. Although our example scene is too simple to warrant using bookmarks, let s see how the process works by creating three bookmarks: one focusing on the sphere, one focusing on the cone, and the third showing both objects. First, highlight the cone and press the F key (or just zoom and track until the cone box fills the Hypergraph window). Then choose Bookmarks Ø Create Bookmark Ø from the Hypergraph menu set. Choosing the option box will open a window that lets you name the bookmark (if you don t open the option box, Maya will choose a default name for you). In this case, type cone and click the OK button. You now have a bookmark for this view arrangement, which you can return to at any time. Next, select the sphere object and press the F key, then create a bookmark for it (name it sphere). Finally, create a bookmark for the complete view of the scene (press the A key to jump to a complete view of the scene) and name it all.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (2 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
To test your bookmarks, zoom and track the window to a completely different view, and then choose Bookmarks Ø Cone (or Sphere or All) from the Hypergraph menu set. The view should jump back to the one you defined for that bookmark. To edit your bookmarks (add a new one, delete a bookmark, or rename one), choose Bookmarks Ø Bookmark Editor, select the bookmark you wish to edit, and choose the appropriate choice from the Bookmark Editor Edit menu. Again, using bookmarks in a scene as simple as our example is not very useful however, in a scene with hundreds of objects, using bookmarks can save a great deal of time and frustration. Tip You can also create bookmarks for different types of views (with the Hypergraph in different modes as discussed later in this chapter). This functionality can really save time, as you can avoid having to continually reset the Hypergraph s view modes as you switch between different aspects of your project. One other nice feature of the Hypergraph is that it shows you when an object is keyframed, by changing its box shape in the window from a rectangle to a parallelogram. If you keyframe the ball shape, for example, its Hypergraph representation will change to give you a visual indication that it is now a keyframed node.
Doing Work in the Hypergraph Besides viewing selected objects in the Hypergraph, you can also select any object in the Hypergraph window simply by clicking on its box. To select the sphere in our example, click on its box, turning it yellow (and selecting it in the scene window as well). To select multiple objects, you can either Shift-select them or drag a selection marquee around the boxes representing all the objects you wish to select. To deselect one selected object, Shift+click on it. To deselect all objects in the scene, click anywhere in the Hypergraph window outside a text box. To rename an object in the Hypergraph, Ctrl+double-click on the name in the box, and then type in the new name and press Enter. For example, we could rename the sphere ball and the cone hat in our practice scene. Parenting one object to another (the child object will then follow its parent s movements, rotations, and scaling) is just a matter of MM dragging the child object on top of its parent-to-be. In our example, MM drag the ball (sphere) onto the hat (cone). The ball will now appear beneath the hat with a line connecting the two showing that it is now the child of the hat.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (3 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
If you now select the hat, you will notice that the ball also becomes highlighted (in the scene window), and that any transformation you apply to the hat is automatically applied to the ball. To unparent (disconnect) the two objects, MM drag the ball into an empty space in the Hypergraph window. The objects will once again be side by side (with no interconnecting line), indicating that they are independent of each other.
Nodes and the Hypergraph The underlying structure of a Maya scene is based on nodes and attributes. A node is the fundamental element of a scene, and often an object in a Maya scene window (or in a shader network or the like) has several nodes. An attribute is a behavior (or attribute) of a node, and each node can have many attributes, including custom attributes that you create yourself. Nodes are connected together, either by default when you create, say, a geometry object (which has a shape and a transform node connected together), or when you manually connect two objects (for example, by parenting one object to another, or by attaching a new texture to a material group). Most attributes that are of the same data type (for example, floats or vectors) can be attached to each other across two nodes. If you are not used to working with Maya, the entire concept of nodes may seem pretty frightening. The theory may seem difficult, but in practice, nodes and attributes are fairly easy to understand: Nodes are anything that can be shown in the Hypergraph, while attributes are what appears in the channel box or Attribute Editor when a node is selected. (Actually, nodes appear in the Channel box and Attribute Editor as well: They are the boldface items you can click on to rename or to open their attribute groups in the Channel box, or the tabs in the Attribute Editor.) Thus, for the Hypergraph at least, all you see are nodes, and changing Hypergraph display modes just changes which nodes you are looking at for your scene. To see how changing display modes changes the nodes you see in a scene, let s again look at our simple example scene (the ball and hat). From the Hypergraph menu set (or by holding down the right mouse button inside the Hypergraph window), choose Options Ø Display Ø Shape Nodes. Now that shape nodes can be seen in the Hypergraph, you will see the ballShape and hatShape nodes, which are separate from the ball and hat nodes. (The ball and hat nodes are called transform nodes, and are in control of where the object is, its rotation, and its scaling, while the shape nodes are in charge of what the object looks like.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (4 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
You can also show all nodes (many of which are normally invisible) that lead into and out of an object node, revealing the hidden depths of what Maya is doing when you create a simple object. Select the ball node and choose Graph Ø Up and Downstream Connections from the Hypergraph menu set. You will then see all of the input and output nodes connected to your ball.
In this layout, the ball transform node sits atop the others, while the bottom three nodes show the flow of information for this object: the makeNurbsSphere1 node (where you control radius, U and V isoparms, and so forth) outputs to the ballShape node, which then outputs to the initialShadingGroup node, where the ball is given a texture and made visible. Note No objects in Maya are visible unless they are attached to a shading group. While the underlying structure of an object is contained in its shape and transform nodes, it is only in the shading group that the object is given a color and texture therefore, without its connection to a shading group, you could not see the object. If you wish to dig even deeper, choose the initialShadingGroup node, and display the up and downstream connections again. This time, you will see the shapes (plus a lambert shader the default one) that feed into the initial shading group, plus the shading group s output to the renderer and lights, as shown next. To return to your original view, just choose Graph Ø Scene Hierarchy or choose one of the bookmarks you had previously saved: a nice time-saver!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (5 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
Because Maya is constructed on nodes, and the Hypergraph can show just about any node grouping (based on your filtering choices), you should begin to see how valuable a tool the Hypergraph can be as you work through the different stages of your animation process. From modeling to texturing to lighting to animation, the Hypergraph is flexible enough that it can display the data you need and even only the data you need, should you wish for each stage of your work. Just keep in mind that the Hypergraph shows nodes, and Maya is built on nodes, so all you have to do is figure out which nodes you want to see for any given stage of your animation process, and you can get the Hypergraph to display them for you. Know Your Nodes While there are a great number of nodes in Maya, they tend to fall under one of these general categories: " Transform nodes (containing items like Translate X or Rotate Y) " Shape nodes (containing items like the makeObject inputs) " Invisible nodes (like default cameras) " Underworld nodes (nodes that are created, for example, when a curve is drawn on a surface) " Material nodes (like lambert or phongE) " Texture nodes (colors, procedural textures, or image files used to alter the behavior of a material node) " Texture placement nodes (used to place textures on objects) " Light nodes (lights, like a spotlight) " Utility nodes (which provide a utility to a shader network, such as the multiply/divide node)
Menus and Buttons: Where the Action Is
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (6 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
While the Hypergraph s default view is very useful, it is just a first step to viewing your scene in the Hypergraph. By using the Hypergraph s menu choices (the most common of which are repeated in buttons across the top of the Hypergraph), you can make the Hypergraph show you just what you need in an organized, concise manner. To see what the Hypergraph can do, let s take a quick tour through its menus, highlighting several items that might prove especially useful in your later work.
The Edit Menu The Edit menu contains several ways to control the display of selected items (or edit those items). First, you can rename an object this is the same as Ctrl+double-clicking on the object s name. You can also collapse or expand a hierarchy; for example, if the ball has its shape node showing, you can collapse the shape node, hiding it beneath the ball s transform node. A red triangle reminds you that there are collapsed nodes beneath the visible one. To expand the nodes again, just choose Edit Ø Expand.
Tip You can also collapse and expand nodes by simply double-clicking on the top node of the group you wish to hide or reveal. If you have several groups of collapsed nodes beneath a parent node (for example, if you have several child objects, all of which have collapsed subnodes), you can expand all nodes at once by choosing Edit Ø Expand All. The option Show Selected displays items that are selected in the scene window (or Outliner) but have been filtered out of the Hypergraph display. For example, if you have turned off display of NURBS objects in the Hypergraph, but choose a NURBS sphere in the scene window, you can force the Hypergraph to show it by choosing the Show Selected menu item. The Attributes menu item brings up the Attribute Editor for the selected item (the same as selecting the item and pressing Ctrl+A). Note There are also a couple of options in the Edit menu (and elsewhere) for use with the freeform layout, but we will discuss this type of layout below.
The View Menu Under the View menu, you can choose to change the Hypergraph to the last view you used or the next, if you have moved backward and forward in views. This command can be useful if you move a great distance through the Hypergraph in a complex scene and wish to return to where you were previously. The Previous and Next View commands function in a similar manner to bookmarks but change according to the Hypergraph view. You can also frame your selection (this has the same effect as the F key), frame all (the same as the A key), frame the hierarchy, or frame a branch of the hierarchy.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (7 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
These four framing options (Frame All, Selection, Hierarchy, and Branch) can be accessed by the four leftmost buttons in the Hypergraph toolbar, which is located atop the Hypergraph window.
Framing a hierarchy frames the selected object plus any other objects in that hierarchy. Framing a branch frames the selected object plus any objects below it in the hierarchy. If the ball is the child of the hat in our example scene, selecting the ball and then framing the hierarchy would focus the window on the hat and ball nodes; framing the branch would focus the window only on the ball (and any child nodes it might have).
The Bookmark Menu The Bookmark menu lets you create and edit bookmarks for any layout or view you wish to save in the Hypergraph. We discussed bookmarks earlier in the chapter, so here we need only note that two buttons on the Hypergraph toolbar are related to the Bookmark menu: the Add Bookmark button (a book with a red plus on it) and the Edit Bookmark button (a lifted leaf with a book below it). The Add Bookmark button simply adds a bookmark for the current view, while the Edit Bookmark button opens the Bookmark Editor window, allowing you to rename, delete, or add bookmarks.
The Graph Menu The Graph menu controls the general parameters of what the Hypergraph shows. You can graph the upstream connections for an object (all nodes that feed into the selected object), the downstream connections for an object (all nodes that the selected object feeds information into), and both the up and downstream connections for that object. Because choosing one of these options changes the view from the default scene hierarchy, once you have chosen an upstream/downstream graph, you can also choose the Scene Hierarchy view to return to the scene hierarchy. The graph Up and Downstream Connections and Scene Hierarchy menu items are also available as buttons on the Hypergraph toolbar:
Should your graph get behind your scene window (an unlikely event, but possible), you can force the Hypergraph to rebuild itself by choosing Graph Ø Rebuild. By using this command, you can be sure the Hypergraph is up to date if you ever suspect it is not. Finally, the Layout command in the Graph menu lets you change (or reset) the arrangement of items when you are looking at upstream or downstream connections. Arranging these nodes may allow you to make more sense of them or to move unwanted nodes off screen while you work.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (8 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
Note When you graph the up and/or downstream connections in the Hypergraph, you are creating what is known as a dependency graph. Put simply, a dependency graph shows the connections between nodes (like shading network elements) in a Maya scene, allowing you to see the flow of information from one node to another in other words, how each node depends on the others to which it is connected.
The Rendering Menu The Rendering menu lets you focus the Hypergraph on materials, textures, shading groups, lights, and images. You can also use the Rendering Ø Create Render Node command to create a render node directly in the Hypergraph, rather than having to use the Hypershade or the Multilister to do so. Note With the advent of the Hypershade, the Rendering menu set in the Hypergraph is no longer as useful as it once was. It is still very convenient, however, to have all shading information accessible in the same window as the scene hierarchy, especially when you just want to take a quick peek at a shading item rather than work with it extensively.
The Options Menu The Options menu gives you control over how the Hypergraph displays nonstandard (invisible, shape, or underworld) nodes, and also how the Hypergraph as a whole is laid out. Of the Options submenus (Display, Orientation, Layout, Transitions, and Update), the one you will probably use the most is the Display submenu. The Display submenu lets you choose which types of nodes and connections will be displayed in the Hypergraph window. As we have already seen, you can show shape nodes (which control the structural options of an object); you can also display invisible nodes (such as the cameras or any objects you have hidden) and underworld nodes (these are nodes generated by objects such as surface curves, which have their transform nodes in a local rather than a global space). You can also turn on (or off) the display of expression, constraint, or deformer connections. For example, if you aim-constrain the ball to the hat in our example scene (Constrain Ø Aim), you can display the connections Maya makes between the ball, the hat, and the new aimConstraint node.
Note You can also display a background image for the Hypergraph window if you are in freeform layout mode (see below) by choosing Options Ø Display Ø Background Image (in freeform) from the Display submenu.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (9 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
The Orientation submenu of the Display menu lets you toggle between horizontal (the default layout) and vertical layout modes. If you like working in an Outliner-like fashion (with nodes stacked on top of each other), you may prefer the vertical orientation mode. The Layout submenu allows you to choose automatic (default) or freeform layout mode the freeform layout mode lets you move nodes around into any shape you wish, while the automatic mode places the nodes in a predetermined order next to one another. The Transitions submenu enables you to create an animated transition between views when you choose View Ø Previous or Next View. By default, the view changes instantaneously, but by checking the Animate Transitions box (and then choosing how many frames the transitions will be), you can force the Hypergraph window to scroll from one view to the other. While they are cute, transitions are more of a time waster than anything useful unless you need to figure out where one view is in relation to another. The Update submenu lets you choose when to update the Hypergraph window; you can choose to update on a selection, on a node creation, on both (the default), or on neither.
The Show Menu The Show menu lets you make very specific choices about the objects you wish to see in the Hypergraph window. Under Show Ø Objects, you can show (or hide) geometry, lights, sets, and cameras, to name just a few. You can display all objects by choosing Show Ø Show All. You can select several objects (in the scene window or the Hypergraph), and then show only other objects with the same type as your selected objects (Show Ø Show Selected Type(s)). You can also invert the types of objects you display (Show Ø Invert Shown). If, for example, you were working on a scene with 10 lights and 20 geometry objects, you could display only the lights while you worked on lighting the scene and then invert the selection filter to show all your other objects while you tweaked your models or animated the scene.
Making and Breaking Connections in the Hypergraph One of the most interesting features of the Hypergraph is its ability to make and break data connections between nodes. To see how this works, take our example scene (the ball and hat), and add a lattice deformer to the ball (select the ball node, then choose Deform Ø Create Lattice). Select the ball node again, and choose Graph Ø Up and Downstream Connections. In this new view, you will see connecting arrows between the nodes that make up the lattice-ball group. By passing your cursor over one of these arrows, you can see the output/input data connections between nodes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (10 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
To break one of these connections, just click on one of the arrows (highlighting it yellow) and hit the Delete key. You can, for example, break the deformer connection between the lattice and the ball if you highlight the arrow that shows the ffd1LatticeShape.latticeOutput to ffd1.deformedLatticePoints connection (the one shown in the image above). If you alter the deformer (scale it, say), you will immediately see the ball return to its original shape when you delete the connection. Tip As should be obvious, it is dangerous to go around deleting connections between nodes especially if you don t know what you re doing. This is not to say you shouldn t experiment; just save your file before you do start deleting connections, so in case you can t get what you want, you can at least return to a good version of your project. To make a connection between nodes, just MM drag one node on top of another (the node that will output a value will be the one you drag; the one that will accept an input value will be the node you drag onto). Once you have completed the drag operation, the Connection Editor will open, allowing you to choose which attributes to connect. If, for example, you MM drag ffd1Lattice onto ball, you might connect the lattice s visibility attribute to the ball s visibility (click on each of these attributes on the right and left of the Connection Editor to connect them). Then, when you hide the lattice, the ball will hide as well. To confirm that the connection has been made, you will see a new arrow in the Hypergraph showing the connected attributes.
In general, most people use the Hypergraph (and now the Hypershade as well) primarily to make and break connections between shader nodes in a shader network, such as the luminance output of a texture being fed into the transparency of a material node. While the connected attributes are different, however, the method of making and breaking connections is the same as described above. The Ins and Outs of the Connection Editor
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (11 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
The Connection Editor is an extremely useful Maya feature. Essentially, it lets you connect any output of one node to any matching (that is, of the same data type) input of another node. The Connection Editor can do some amazing things, connecting even the most bizarre attributes (as long as their data types match). This base-level control over connections gives you creative control over anything from ramp texture colors to object rotation order based on another object s position (or that of another node on the same object), visibility, node state, or whatever else you can dream up. In shader networks, the output color of one node (like a fractal map) is often automatically input into the input color of another node (like a phongE texture) when you create a texture map. With the Connection Editor, you can also plug the output color of one node into the bump map node a node that controls how bumpy a surface looks of a texture (which is the same as MM dragging the node onto the bump map channel of the texture), or even control the intensity (or height) of a different bump map based on the output of this node. While the number of attributes available to connect via the Connection Editor can be a bit overwhelming, the window s controls are fairly straightforward. Let s take a look at how the Connection Editor works. Using the Connection Editor To make a connection, first load the left and right sides of the Connection Editor with the two nodes you wish to connect (or, alternatively, MM drag one node onto another in the Attribute Editor to automatically open and load the Connection Editor). Then click on the output attribute you wish to use and, from the list of attributes with matching data types (not grayed out), choose the input node. Some data types, like color, have arrows next to them, allowing you to access their component attributes in the case of color, it would be the red, green, and blue components of the color. Thus, while color (a vector) may not be a match (and is thus grayed out) for the X scale of an object, you can connect the red component of color to the object s X scale; depending on the direction of this connection, the object s redness would be controlled by its X scale, or the object s scale would be controlled by its redness. The Connection Editor Controls The controls in the Connection Editor s window are easy to use. The buttons at the top enable you to reload the left or right side of the window (thus changing which node is loaded on each side of the window). By clicking the from -> to button, you can change the direction of the input/output of the two nodes (making it to <- from ). The Right and Left Side Filters menus let you display (in the windows below) only those attributes you are interested in this can be a great way to reduce the clutter of available attributes to a more manageable number. Under the Options menu, you can change the default behavior of the Connection Editor which is to make and break connections automatically as you click on the attributes in the left and right windows to a manual mode. If manual mode is selected, you must press the (now enabled) Make and Break buttons at the bottom of the window to create (or disconnect) the connection between two attributes. The Clear All button removes all connections, and the Remove button removes the loaded nodes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (12 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
Finally, the two arrow keys just below the left and right windows allow you to step through all nodes on an object (for example, the shape to the transform node of a geometric object), saving you a trip back to the Hypergraph to highlight a new node, and then reload it into the Connection Editor. To disconnect two attributes, just click on a connected attribute on one side of the window to unhighlight it. The possibilities for using the Connection Editor are so many and varied that the best advice is just to open a new project, create some objects and shader networks, and play with different connections, so you can get a feel for the different ways you can control one node via another. This way, when you are faced with what might appear a difficult problem in a real world situation, you may see that some clever use of the Connection Editor will do the trick nicely.
Freeform Layout Mode There is one last way you can modify the Hypergraph to make the data in it even more understandable: the freeform layout. This layout mode allows you to place your nodes anywhere you wish in relation to each other (above, beside, around, and so forth). This can be a real help when you build a complex character like a human, as you can arrange the nodes for the hands, say, where the hands of a figure would be. You can even import an image as a background plate for the Hypergraph window (perhaps a sketch of your figure) to serve as a reference in the freeform layout mode. To enter freeform layout mode, either choose Options Ø Layout Ø Freeform Layout, or click the Freeform Layout toggle button on the toolbar in the Hypergraph (the button farthest to the right). Once you are in freeform layout mode, you can drag nodes anywhere in the Hypergraph window that you wish, including into shapes or figures. To load a background image for your new layout, choose View Ø Load Background Image and browse to find your image. You can also reset your freeform layout to its default arrangement by choosing Edit Ø Reset Freeform Layout. Thus, no matter how much mess you make of your node arrangement, you can always return to a clean view at the touch of a button. As an example of using the freeform layout, let s build a human figure in the Hypergraph (we won t actually build a character in the scene window, but if you have one you ve already built, feel free to use that figure instead of our random assortment of primitives). First create 20 or 30 scene primitives (they can all lie on top of each other, as we won t use them in the scene window). If you wish, you can lay them out in the scene window in the form of a person, or you can just arrange them in the Hypergraph. In the Hypergraph, be sure you are in freeform layout mode, then drag nodes up to the head region (renaming them things like skull, nose, right eye, and so on), the body, the arms, and the legs. When you re finished, you should have a graph that looks something like a person, where every node is intuitively related to its (supposed) function in the scene window. Obviously, arranging nodes like this in a complex scene can save you a great deal of time when it comes to finding a particular node (the right eye, for example) that you wish to manipulate.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (13 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=644704454 (14 of 14) [11/27/2000 8:25:49 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 4 - The Hypergraph-Your Roadmap to the Scene Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we have taken a fairly thorough tour of the Hypergraph, exploring its navigation features, the scene-related actions you can perform in the Hypergraph window, the different options for viewing and layout the Hypergraph gives you, and even how to see, make, and break attribute connections from the Hypergraph. You should feel more comfortable using the Hypergraph now, as you now understand how to use it and what options are available to you to aid in laying out the Hypergraph in an intuitive manner. As you proceed in this book (or in your own animation adventures), be sure to continue using the Hypergraph with your scenes. Soon, you will find this tool not only familiar, but indispensable for all your work in Maya.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=352893154 [11/27/2000 8:25:58 PM]
Books24x7 Mastering MAYA Complete 2
Part II - Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part II: Modeling Chapter List Chapter 5: Modeling Basics Chapter 6: NURBS Modeling Chapter 7: Polygon Modeling Chapter 8: Organic Modeling Chapter 9: Working with Artisan
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=612784996 [11/27/2000 8:26:04 PM]
Books24x7 Mastering MAYA Complete 2
Part II - Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part Overview Use the basic modeling tools Perform NURBS modeling Perform polygon modeling Perform organic modeling Use the Artisan add-in
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=676260262 [11/27/2000 8:26:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 5 - Modeling Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 5: Modeling Basics Overview This chapter introduces the basics of modeling. The first section of the chapter will be devoted to the concepts you will need to become familiar with before plunging fully into the modeling tools and actions in Maya 2. A good understanding of the general principles of modeling will enable you to use your time wisely and efficiently as you work. In the following pages you will have an opportunity to try out some of Maya s modeling aids as you learn some modeling fundamentals, and then you will create a living room scene using Maya s primitives.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=425804863 [11/27/2000 8:26:14 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 5 - Modeling Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What Is Modeling? Before we delve into modeling specifically in Maya, we need to go through a few concepts of modeling in general. Let us begin with a working definition of what modeling is in computer animation. Here is one that would seem acceptable to most people: 3D modeling is the process of creating three-dimensional surfaces using a computer for the purpose of rendering them into a picture or a sequence of pictures. But let s think about this for a moment. In fields such as the automobile industry, architecture, or engineering, the digital models are actually built with specific products in mind their purpose is the creation of a physical model or prototype, and ultimately a working automobile, or building, or whatever. For such models, rendering is only a stage they go through in order to get to their ultimate destination. For the 3D artist working in computer animation, however, the ultimate destination for the models they build is pictures that only exist in TV, videos, or movies all 2D environments. This difference gives rise to a very important principle, which determines how we should build models for computer animation. Here is the principle: The only thing that really matters in modeling in computer animation is the picture(s) people will see. Modeling anything that will not be seen, therefore, is (generally speaking) a waste of time.
It s All an Illusion Digital animation, then, is a world of facades. If you will only see the back and right walls of a room (as in the image below), it makes no sense to build the front or the left side. Modeling for the computer animator is all about creating illusions for the eye to feast on build only what the eye (the camera) will see. We will certainly have more to say about this later on, but suffice it to say for now that this is the reason why careful preproduction planning is so crucial, and why well-organized production teams will always create very detailed storyboards before they commit to building anything.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=527103146 (1 of 3) [11/27/2000 8:26:22 PM]
Books24x7 Mastering MAYA Complete 2
Are You a Modeler? Let s face it, a professional sculptor or an architect will usually have a much easier time with modeling on the computer than a person with no such background, just as a painter or a photographer will find it easier to do texturing or lighting in a digital environment. Many of the skills that are used in these fields transfer immediately into the computer environment, and other skills soon follow, as the artist becomes familiar with their surroundings. But don t be too discouraged if you want to become a modeler but have no such background. There are other things to keep in mind. Not all artists are able to transfer their traditional skills fully into the digital environment; and more importantly, there are other skills, specific to digital modeling, that also must be learned. Computer animation is a different world, and the computer, a different tool. Digital modeling should be viewed as a separate and independent artistic medium as different as painting is to sculpting, for example, each with its own sets of rules and technical skills. One must feel as comfortable with the computer as a painter would with a brush, or a sculptor with clay. And just as some painters know nothing about sculpting but still are great painters, so can one be a great 3D modeler without being a sculptor, or an architect, or a painter.
Good Models and Bad Models Good models look good when rendered, and bad models look bad it s that simple. You may think that is stating the obvious, but the catch, of course, is that it takes a lot of time and care to produce models that look good, and always a lot of sweat and effort to produce great-looking models. Tight schedules and deadlines often make this a very difficult if not impossible task. Having said these things, however, there are other, less obvious, factors in the production environment that determine whether a model is good or bad, and these are just as important. The two criteria most frequently used in animation are how heavy or light a model is and how well it can be set up for animation.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=527103146 (2 of 3) [11/27/2000 8:26:22 PM]
Books24x7 Mastering MAYA Complete 2
Improperly built models often end up being computationally heavy, meaning they are built with too much geometry and can cause numerous problems for the animators, or lose precious production time in rendering. A light model, in contrast, does not have a lot of geometry and thus allows the animator to act more interactively with it, producing better animation in shorter time. It generally renders faster, too. If a model is going to be deformed in a certain way in other words, to bend and stretch as it acts a certain way the modeler needs to build the model with that in mind, putting the necessary points where they will deform properly. In some cases, not having points in certain areas is actually better. One reason why modelers build NURBS faces (the next chapter is an in-depth look at NURBS modeling) and not polygon faces (Chapter 7 covers polygon modeling) for facial animation is that a well-built NURBS face (on the left below) is a lot easier to set up for animation than a Polygon face, even though the latter is easier to build. Notice the extra lines in the Polygon model (on the right).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=527103146 (3 of 3) [11/27/2000 8:26:22 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 5 - Modeling Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Modeling Tools Later in this chapter you ll get a taste of the process of modeling in Maya. First, however, let s look at the Maya interface features available to us. Maya has a vast array of tools that can aid us in modeling. Here are some of the more basic and useful functions we will be covering in this chapter: "
Templates
"
Layers
"
Pick-masking
"
Snapping
"
Freezing transformations
"
Construction history
Templates Objects that become templates remain visible but cannot be selected like other objects. The standard way to turn an object into a template is to select the object and then select Display Ø Object Components Ø Templates. You can also open the Attribute Editor (Ctrl+A), choose Display, and toggle on Template.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (1 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
Because the templated object cannot be selected in the usual way by dragging, in order to untemplate it, you have to select it either in the Outliner or the Hypergraph editor, or use a selection mask (see Pick-Masking later in the chapter), and then toggle it back with the same command. There is another way to template objects, and that is by using the Layer Bar (discussed in the next section). A layer also has templating capability, and it is generally the more efficient way to template objects because it can handle groups. Tip Templating using layers is a bit different from templating using the method just described. A regular template can be picked using Selection Mask for templates, but not the ones templated using layers they can only be selected from the Layer menu.
The Layer Bar The Layer Bar is an extremely useful tool. It was originally created for Alias Power Animator, and now, with the release of Maya 2, the Layer Bar is back in its original form. A layer creates an exclusive collection of objects that can be selected, hidden, or templated together. Essentially, it acts as a directory or a folder for objects to aid in organization and work efficiency. The Layer Bar is on by default, but if you don t see it, select Options Ø UI Preferences and turn it on. You can also see the Layers using Windows Ø Layer Editor. To create a new layer, you can click on New Layer in the Layer Editor, or click the New Layer button on the Layer Bar it s the button left of the Default layer.
To add an object or a group of objects, first select them. Then click on the layer to which you want to add the objects, display the Layers menu, and select Assign Selected. To move an object from one layer to another, simply select the object and assign it to the other layer. You can also use the Relationship Editor to do the same thing: display the Layers menu, select Edit Membership to open the Relationship Editor, and connect the objects and the layers the way you would normally do. You can hide the layer objects, template them, or reference them.
Referenced objects of a layer are just like templated objects, except that they can be used for snapping (see the section Snapping below) and they can appear as shaded surfaces. Removing a layer does not delete its member objects, but only the layer itself.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (2 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
Tip Use the Layer Colors palette to identify different groups of objects as belonging to a layer. Double-click on the color box in the Layer Bar to pop open the Layer Colors palette and assign a color, or use the Layer Editor to do the same. Using different colors can not only make things much easier to work with for very complex scenes; it can also make the scene a bit more interesting to look at, as you can see below (and in the Color Gallery on the CD).
Pick-Masking One of the most elegant features of the Maya interface is its ability to limit selection to specific types of objects, components, or hierarchical elements. This function is also known as creating a pick mask or selection mask. (Maya uses the terms interchangeably.) You can RM choose an object to pick-mask elements which specifically apply to that object, or you can use the buttons on the Status Line to pick only the elements you want to select.
When you RM choose an object you are working on, Maya automatically figures out which selections should become available for that specific object type and gives you the appropriate choices. For a curve, you get a different set of marking menu items from the one used for a NURBS surface, as you can see here.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (3 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
The really cool thing about this feature is that depending on the pick mask you choose, Maya adjusts the display of control vertices, edit points, and hulls accordingly so that you will only select what you want to select, and hides the rest. For example, if you pick-mask Control Vertex, Maya will automatically go into the component selection mode and display only the CVs for you to select. Or if you pick-mask Hull, it will only show hulls.
Various selection masks can be created using the Status Line in three different levels. You can limit your selection by component types such as CVs, Edit Points, Faces, Edges, and so on.
You can also create selection masks to pick only object types such as Curves, Surfaces, Joints, and so on.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (4 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
And finally, you can limit selection by hierarchy types, such as pick-masking only the root or leaf level of a hierarchy. When you are in the hierarchy mode, you can also create a pick mask to select only templated objects as well.
Note When you are limiting selection by hierarchy types, the marking menu s component selection masks do not work, because Maya is only allowing root or leaf nodes to be selected. Note that when several elements are active in the selection mask, Maya has a priority list that causes certain elements to be selected before others. Maya s default selection mask is set to select by object type with all the different object types turned on, so when you drag over a NURBS surface and a joint at the same time, it should select both objects. But because Maya s default priority list has joints before NURBS surfaces, it will select the joint and leave the NURBS surface unselected. If you want to see the priority list, go to Options Ø General Preferences Ø Select.
Warning Do not change the default priority list or turn it off unless you have a good reason to. The priority list was defined with careful deliberation, and you will find as you work your way through the various stages of a production in Maya that the default priorities make a lot of sense and are very efficient.
Snapping The snapping tools allow you to transform an object or a component to snap to grids, curves, points, view planes, or a surface. These elements become targets, or magnets, when activated. You can access these tools, in the order just listed as buttons in the Status Line:
You also can use Maya s default hotkeys for snapping to grids, curves, or points. This is a more efficient way of using the snapping tools. These are the hotkeys: "
Press X and click or drag to snap to grid
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (5 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
"
Press C and click or drag to snap to curve
"
Press V and click or drag to snap to a point
Let s briefly try out these tools. Create two curves as shown below. Select Create Ø CV Curve Tool and X+click on the grid. Click six times and press Enter to complete the first curve. Type y to access the CV Curve tool again and draw the second curve.
RM choose to pick-mask CVs over the first curve. Then select the bottom CV, select the Move Tool by typing w, and V+drag to the first CV of the second curve. It should snap to the CV as shown on the facing page. Now try to C+drag the last CV of the first curve to the second curve. It s not snapping because snapping to a curve is distance sensitive. Drag the selected CV over the second curve, making sure it s right over the curve. Now C+drag the CV again back and forth. It should stay on and along the curve. Snap-to-curve also snaps to curves on surface and surface isoparm curves as well. Tip You can also snap the manipulator to stay locked on one of the manipulator handles when you are in the perspective view, restricting the manipulator s movements to XY, XZ, or YZ handles, just as if you were in an orthographic window. Just Ctrl+click on the manipulator handle where you want the snap to happen, and the square plane at the center of the manipulator facing the camera will rotate to face the manipulator handle. Note that the constraint only applies when you drag the manipulator center, not one of the axis handles. To release the constraint, Ctrl+click the center of the manipulator (this actually snaps the manipulator to move along the camera view plane).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (6 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
Making an Object Live Yet another way to snap objects or components is to make an object live. This very useful modeling aid can be applied to any single object. To do this, choose Create Ø NURBS Primitives Ø Sphere, and then select Modify Ø Make Live, or click the Make Live button, (with the magnet icon) on the Status Line.
Trying this on your own computer, you ll see that the sphere has turned green, and if you are in shaded mode, the sphere is no longer shaded. It has become live, a magnet for other elements, and while it is in that mode it cannot be selected. Select Create Ø EP Curve Tool and try clicking a few times in the perspective window. All the Edit Points snap to the sphere surface. Hit Enter to complete the curve and try translating it. The manipulator now shows only X and Y handles, which are actually U and V handles that move the curve along the parameters of the sphere surface. Toggle the Make Live button off, and the curve should translate in the XYZ 3D space again.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (7 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
Using the Construction Plane Maya has a special construction plane, available from the Create menu. It does not render and, with the default setting, is displayed as a 24-unit plane in the XY axis, but it s actually infinite in size, like the ground plane in the perspective window. It exists primarily to be made live and aid in the construction of curves as an alternate ground plane. To appreciate how the construction plane differs from a regular NURBS plane in the way it behaves as a live object, try the following short exercise. Start a new scene. Select Create Ø CV Curve Tool, and X+click to snap the CVs on the ground plane as shown below. Do not press Enter yet. Choose Create Ø Construction Plane Ø, click Apply with everything at default, then set the Pole Axis to YZ and click Apply again. Close the option box. You should see the planes intersecting, as shown here.
Select the hotbox (space bar) Ø North Zone Ø Persp/Outliner. In the Outliner, select plane1 and then select Modify Ø Make Live. Continue to X+click the CVs on the plane1 as shown next, until it comes to the grid next to the intersection point of the two construction planes. Since plane1 is now live, the CVs snap to the plane s grid. Only construction planes allow the CVs to continue to build in this way. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (8 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
In the Outliner, select plane2 and then select Modify Ø Make Live. Start X+clicking the CVs on plane2 until it comes to the grid above the ground plane. Toggle off the Modify Ø Make Live option and finish X+clicking the CVs once again on the ground plane, as shown below. Press Enter to complete the curve!
Tip If you are transforming an existing object to a live plane, you have to move the manipulator s center, not one of its axis handles, to make it snap to the plane.
Freeze Transformations
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (9 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
When you create any object, it is initially placed at the origin, or (0,0,0) in the world space. As you work with the object, transforming it in various ways through translation, rotation, and scaling, there may be times when you want the point where you ve placed the object to become its local origin, or (0,0,0), even though it is not the world space origin. To do this, select the object, and then select Modify Ø Freeze Transformations.
How Maya Handles Construction History Maya 2 s handling of construction history is much more powerful than in its predecessors (Alias Power Animator and Studio). Its procedural structure allows construction history to be maintained much longer in the model-building process than was previously possible, which means you have more control and greater freedom to explore alternative modeling possibilities. Because it makes the scene complex, however, in certain situations you may want to have the construction history turned off. You can do this by toggling the History button off in the Status Line. You can also delete a specific object s construction history by selecting Edit Ø Delete by Type Ø History. You will see more examples of construction history in the next chapter s tutorial.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=136244468 (10 of 10) [11/27/2000 8:26:34 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 5 - Modeling Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Modeling with Primitives Finally, we are ready to begin modeling! Although Maya provides us with many different and interesting ways to do whatever we need to do, in many cases the fastest and easiest way to get the job done is to use primitives ready-to-use basic shapes like those shown below (and in the Color Gallery on the CD). Maya has a wealth of NURBS and polygon primitives: spheres, cubes, cylinders, cones, planes, and, new in version 2, toruses. Maya also has a NURBS circle and square (another new addition), which are made of curves.
Although they are all different in form, many of these primitives are created involving similar variables, an example of which we will see a bit later. By starting with the primitives, you can immediately create simple objects, which then can be manipulated in various ways to produce more complex surfaces easily and quickly.
Building a Staircase
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=331666763 (1 of 6) [11/27/2000 8:26:45 PM]
Books24x7 Mastering MAYA Complete 2
Let s begin exploring primitives by building a spiral staircase. In this example, we will start with a cube to represent an individual step in the staircase, and then copy it many times. Start a new scene, and select Create Ø Polygon Primitives Ø Cube.
Manipulate it as follows: in the Channel box, type 6, 0, and 0.5 for Translate X, Y, and Z respectively, and 5, 0.5, 1 for Scale X, Y, and Z. You should now see the cube placed as follows:
Tip In the Channel box, the default naming convention is set to Nice. For example, you read Translate X in the first line of the Channel box. If you are a beginner, this is very helpful, because everything is clearly stated. But you can also change this to Short format by pressing RM choose Ø Channel Names Ø Short. The first line should now read tx , which looks cleaner, and gives a bit more space for the modeling windows. Keeping the cube selected, go to Edit Ø Duplicate Option box. Set the numbers in the dialog box as follows: Translate 0,0.5, 1; Rotate 0, 10, 0; Number of Copies, 35; Geometry Type, Instance.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=331666763 (2 of 6) [11/27/2000 8:26:45 PM]
Books24x7 Mastering MAYA Complete 2
Click the Duplicate button, and voila! You should now have a spiral staircase. Note that the duplicates here are instances, which means any manipulation to the shape of the original cube will be applied to the duplicates as well. Go to the top view, RM choose Vertex over the original cube, select the four vertices at the top side of the cube, and then rotate and translate them until they overlap the duplicated cube at the bottom side, as shown below.
You can also, by selecting all the vertices of the original cube and translating them in X and Z, get different shapes for the spiral staircase, as shown here.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=331666763 (3 of 6) [11/27/2000 8:26:45 PM]
Books24x7 Mastering MAYA Complete 2
Tip In situations like the example given here, you will find that it is better to use instances rather than make actual copies of the original geometry as they are much lighter (computationally less taxing on the CPU) than copied duplicates, and you can manipulate the shape of the instanced duplicates with the original geometry.
A Look Inside a Primitive: Torus Since the torus primitive is a new addition in Maya 2, let us look at its properties in detail as an example of Maya s primitives. A torus is basically a revolved circle, a donut-shaped surface that is closed on both U and V parameters.
Choose Create Ø NURBS Primitives Ø Torus, and in the Channel box, under INPUTS, click makeNurbTorus1. You will see the various variables that form the shape of the torus.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=331666763 (4 of 6) [11/27/2000 8:26:45 PM]
Books24x7 Mastering MAYA Complete 2
Note You can also get to these same variables before you create the object via the Torus Ø dialog box, or after you create the object via the Attribute Editor. Try doing the same with some other primitives, like the cylinder and the sphere. Note that many of the torus primitive s properties have exactly the same counterparts in the other primitives you should go over those variables with the other primitives as well in order to see the various possible shapes they can form with different settings. Tip When dealing with these settings for the primitives, sometimes you just have to play with it and see what comes out as you experiment with the input variables. The results may surprise you. Now let s experiment with some torus settings. Click on Radius; then, inside the modeling window, MM drag slowly and see what happens to the torus. The radius measures the distance from the center of the geometry to its circumference. In the case of a torus, this measures the center of the circle revolving around it, which effectively means the Radius setting controls the size of the torus. Start Sweep and End Sweep determine in degrees where the torus starts and where it stops revolving along V. For the Degree section, click on Cubic and you will see a pull-down menu with Linear as the other degree choice this setting will give sharp edges to the torus, as shown on the next page. Sections subdivide the torus along V, and Spans subdivide it along U. Warning The subdivisions should all be finalized before any CVs are pulled, as changing the sections or spans of the torus afterward will produce unpredictable results.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=331666763 (5 of 6) [11/27/2000 8:26:45 PM]
Books24x7 Mastering MAYA Complete 2
Height Ratio is the ratio between height and radius; this effectively determines the thickness of the torus. And finally, Minor Sweep determines in degrees the amount of surface (along U) the circle revolving around the torus will have.
Now, before you say, OK, so it s a donut, the facing page shows some example models that were created on the fly with the torus primitive. Though all are simple models, there probably are some examples in the collection that you did not expect to see, which illustrates the point: The primitives are very useful objects, not because of what they are, but because of what they are capable of becoming, and because they can help us create the final surfaces we want.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=331666763 (6 of 6) [11/27/2000 8:26:45 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 5 - Modeling Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-On Modeling: Creating a Living Room Scene with Primitives In this tutorial, we will start building a living room scene with the primitives. Remember our principle, build only what the camera will see ? The first thing we need to do, then, is to visualize what you want to see at the end. Picture the camera capturing a living room at an angle, with a sofa set, a table, a lamp, and a dog by the window! (You ll find the rendered image in the Color Gallery on the CD.) We will get to the lamp and the dog by the window in the later chapters, but for now, we can build the rest with three simple primitives that Maya provides us with. 1. Create a new scene. Drop a sphere into the scene: either click on the sphere icon in Shelf1 or select Create Ø NURBS Primitives Ø Sphere. Go into side view, pick-mask Control Vertex, and drag to select the top two rows of CVs. Type w to use the Move tool.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=200311474 (1 of 5) [11/27/2000 8:26:53 PM]
Books24x7 Mastering MAYA Complete 2
2. Snap the CVs to the first grid above the ground level by X+dragging the Y handle to the first grid above the ground level. Make sure you are not dragging the center of the manipulator, or all the CVs will snap to one point. If the grid isn t displayed, select Display Ø Grid to make it visible. Repeat the same action with the two bottom rows of CVs to the grid below ground level, as below.
3. Go to the top view, and again snap the edge rows of CVs to the unit grids on each side of the sphere, as below.
4. Take the sphere, which now looks more like a cube with round edges, and duplicate it several times (Edit Ø Duplicate), scaling, translating, and rotating it to make the sofa, as shown here.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=200311474 (2 of 5) [11/27/2000 8:26:53 PM]
Books24x7 Mastering MAYA Complete 2
Tip When you are building several objects, it is good form to build each object at the origin and then move it out of the center when it is finished. As long as you do not freeze its transformation or change the pivot, you can always transform it back to its original position for further modifications. 5. For the cushions, copy the sphere, pull the top row of CVs (which looks like a single point) down just a bit, scale and translate it to be on the sofa, and make two more copies to cover the whole sofa. When the sofa is done, select all of its elements and select Edit Ø Group. This makes it a lot easier for us to work with the sofa as one entity. We can hide the sofa for now while we move on to the table and the chair. Select Display Ø Hide Ø Hide Selection. 6. For the table, select Create Ø NURBS Primitives Ø Cylinder Ø, set Caps to Top and click Create. This will become the table top. Move it to a side for now. For the table stump, select Create Ø NURBS Primitives Ø Torus, and set the Height Ratio to 0.2 and Minor Sweep to 190 degrees. Translate the cylinder to the top of the torus, and scale and translate each object to form the table shape you see below. Group the cylinder and the torus; then translate them to the ground level. Select Display Ø Show Ø Show Last Hidden to make the sofa visible again. Place the sofa and the table roughly in the positions shown here.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=200311474 (3 of 5) [11/27/2000 8:26:53 PM]
Books24x7 Mastering MAYA Complete 2
To select the whole hierarchy in the modeling window, select one object in the hierarchy and press the (Up Arrow) key. If there are branches in the hierarchy, press the key until you reach the root level. 7. The chair is a bit trickier. Copy the sphere, and hide all the rest. Translate the sphere to (0.5, 0, 0.5) using the Channel box. Switch to top view, and snap the middle CVs to the grid for each side of the sphere as shown:
8. In the side view, grab the two rows of CVs at the right bottom corner and snap them to the Y axis. Grab the rows of CVs at the left side and snap them to the second grid to the left. Grab the CVs at the top-left corner and drag them down as shown below:
9. In the perspective view, select the CVs as shown and push them back in Z a little. You can also select the CVs at the chair s side and scale them out to make the chair look rounder. If you are having a hard time seeing the right CVs, toggle the hulls to be visible, by choosing Display Ø NURBS Components Ø Hulls.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=200311474 (4 of 5) [11/27/2000 8:26:53 PM]
Books24x7 Mastering MAYA Complete 2
10. To finish, copy one of the cushions from the sofa and put it on the chair. Group the chair and the cushion. Select Display Ø Show Ø All. Create three planes by selecting Create Ø NURBS Primitives Ø Planes for the floor and the two walls, then arrange the furniture as you see fit. Shown below is the final textured and lit living room. We will come back to this scene later to add more interesting pieces.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=200311474 (5 of 5) [11/27/2000 8:26:53 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 5 - Modeling Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary This chapter introduced the basic concepts of modeling and the tools that Maya provides to aid you in creating and editing surfaces. You also learned how to use primitives to build more complex objects such as a staircase or pieces of furniture. In the next two chapters, we will delve further into two major types of modeling: NURBS modeling and polygon modeling. NURBS modeling is often used in high-end productions that demand photorealistic models, while polygon modeling is still the preferred choice for gaming companies.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=582536989 [11/27/2000 8:26:59 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 6: NURBS Modeling Overview This chapter covers modeling with NURBS curves and surfaces. It begins with an explanation of the basic theory and concepts involved in modeling curves. We won t get too technical; the goal is simply to give you a basic understanding of what you are doing as you work with Maya. If you are familiar with these concepts, you may wish to skim through this section. The chapter then introduces the tools that Maya provides for working with curves and demonstrates them in the first of three hands-on tutorials, creating the curves for an aftershave bottle. The second half of the chapter moves on to Maya s tools for creating and editing surfaces and concludes with two more hands-on exercises: one that completes the aftershave bottle and one that creates a human face. The last of these tutorials is quite advanced, in the sense that the operations are more involved and the instructions are not as detailed as in the basic tutorials. It assumes that the reader has more working familiarity with Maya s interface and basic techniques than the earlier tutorials. If you find you are having problems following the advanced tutorial, it may be wise to skip it and come back to it after you ve got more Maya experience under your belt.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=434039323 [11/27/2000 8:27:01 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Curve and Surface Concepts Part of the genius of Maya is that it makes the highly complex mathematics of modeling and animation almost completely transparent to the user. You don t need to know much about what Maya is doing behind the scenes when you use its tools, but it s very useful to know a little about it. Of course, not everyone wants to know what words like NURBS, B-splines, and parameterization mean. When you are striving for artistic expression, mathematical concepts may not be something you d want to delve into deeply. These concepts may seem to you like unwelcome relatives to a hip party you invite them in and exchange pleasantries ( How are you? How are the kids? ) but want nothing to do with them afterwards! Nevertheless, these and other techno-words are built into the very fabric of what computer animation is. Maya is, after all, computer software the better grounded you become in these esoteric concepts, the deeper and further you will be able to go in mastering your art. At the same time, be assured that as dry (or exciting!) as things may get in the following sections, nothing overly technical will be thrown at you. Tip If you find you do not understand many of the concepts being presented in the next few sections, just skip them for now. You can come back later when those topics have become a bit more relevant to you.
Curves Are Equations The curve you draw in the computer is actually a curve segment or a continuous series of segments. One segment is called a span. A curve span is a digital representation on the screen of a mathematical concept called a parametric equation. Because the equation is describing a position in 3D space, it always has three variables (x, y, z), and the power of the variable with the highest degree in the equation determines the classification of the curve. Hence, a first-degree curve is a linear equation, which is a straight line. A second-degree curve is a quadratic equation, or an arc. A third-degree curve is a cubic equation, which can actually twist in 3D space. There are two higher-degree curves: fifth- and seventh-degree curves, which can actually twist twice in one span. Maya has all these degree options in its curve-creation tools, but for most practical purposes, the cubic curve is almost always used. In Maya, the default curve is cubic.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (1 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Curves Are Splines A Control Vertex (CV) is a point in 3D space that determines the shape of the curve it is attached to by defining and influencing its equation. The CVs and the curve segments they control are collectively known as splines. Note Historically, a spline was a plank of wood bent to form part of a ship s hull by forcing it between pairs of posts, known as ducks. The placement of these ducks determined the shape of the plank s curve, just as the placement of CVs determines the shape of a curve in computer graphics. There are different ways to calculate how the CV positions are interpreted into curve shapes, and these different methods types of equations or formulas distinguish the splines further into Bezier curves, B-splines, or NURBS. NURBS, the focus of our attention in this chapter, stands for Non-Uniform Rational B-Splines. Note Unless you re a mathematician, don t worry about all the components of this daunting acronym. The important thing to understand is how a NURBS curve behaves. The advantage a NURBS curve has over the other types of splines lies essentially in the way it can be cut and joined. Regular splines cannot be cut and joined at arbitrary points along the curve, only where their control points are A NURBS curve, however, can be cut and joined anywhere, because any point on the curve can be calculated and located. This advantage carries over into surfaces as well. NURBS surfaces can be attached to other NURBS surfaces with different numbers of spans, or isoparms, for this reason. Edit Points (EPs) are points where curve segments join to form one continuous line. They are also called knots. Maya has a CV Curve tool and an EP Curve tool for creating curves. But make no mistake the two tools may create curves a bit differently, but in the end, both create the same NURBS curve.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (2 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Surfaces and Parameterization Curves cannot be rendered, only surfaces can. In modeling, curves are always created to help in the creation of surfaces. This means that at the end of the day, no matter how many curves you create, only surfaces matter. Any discussion about surfaces, however, needs to discuss parameterization Oh yes, here comes another unwelcome relative. To best understand parameterization, let s go back to curves. Parameterization of a curve is the calculation of where knots (edit points) are placed along the curve, enabling any point on the curve to be assigned a parameter value. The variable representing this value is defined as U, and the curve is given a direction as a result. To see this at work, create a default curve made of two spans: either five clicks of CVs or three clicks of EPs. Now pick-mask Curve Point and try dragging along the curve. At the top of the Maya window you should see the curve parameter value changing as you drag. The start of the curve is assigned a parameter value, U[0]. The second edit point of the curve is assigned the value U[1], and the end of the curve, U[2]. The halfway point between the start of the curve and the second edit point is assigned a value of U[0.5]. Any point on the curve can be similarly assigned a parameter value this way. Easy enough. This method of calculating the point values along the curve is called uniform parameterization.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (3 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Another calculation method in Maya is called chord length parameterization, and the way it assigns the U value to a point on the curve is more complicated. We need not go into discussions of exactly how the calculation is done, but the value assignment is dependent on the distances between successive edit points of the curve, not the number of edit points. So two curves with the same number of edit points but drawn differently will end up with different parameter values at those edit points.
How does all this relate to surfaces? A surface is basically an area in 3D space defined by the parameterization of two variables, U and V. The surface is calculated in such way that at any point inside the area, a UV coordinate can be given, and the area is given UV directions. This is exactly the same situation as with the curves, except now you have the V parameterization of the surface as well.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (4 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Uniform parameterization produces more predictable values for the curves and surfaces than chord length and is therefore the preferred choice for modeling in general. Uniform is the default setting in Maya. The advantage of chord length parameterization is in texturing: it allows more evenly distributed textures on uneven surfaces than the uniform method. The bottles shown here are revolved from curves that have exactly the same CV placements, except that the one on the left uses chord length and the other is uniform:
Surface Normals A surface also has a front side and a back side, and it has normals. A normal is essentially a vector shooting out perpendicularly from a point on the front side of a surface. In other words, it is the direction that surface point is directly facing. The concept of surface normals is very important for using certain modeling tools, as well as for texturing and rendering, and it is important that you become comfortable with the concept. You can use the right-hand rule to determine which side of a surface is front, or which way the normals are pointing. If the thumb points to the increasing U direction, and the index finger points to the increasing V direction, then the middle finger bent perpendicularly to these two fingers is the direction of the surface normals.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (5 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Tip You can see the surface normals of an object while in shaded mode by selecting the object and then selecting Display Ø NURBS Components Ø Normals. Surfaces, like curves, are made up of spans, or rather they span a given number of span areas. The area covered by one UV span is called a patch. The flowing lines separating the patches are called isoparms. These are the surface equivalents of knots, or edit points. Pick-masking the Isoparm element allows you to select any flowing isoparametric curve either with a U value or V value on the surface, just like selecting a curve point on a curve. With surfaces, you can also pick-mask Surface Point, which enables you to select any point on the surface with a UV parameter value. Tip When you select a surface point and choose Edit Surfaces Ø Insert Isoparms, both U and V isoparms are inserted.
Creating Curves http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (6 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Whew, that s about enough with those relatives! Let s move on to creating curves. Maya has several tools for creating curves, and also a Text tool. As mentioned already, Maya can create curves either with edit points or with CVs. Generally, if the curve needs to pass through a specific point, then the EP Curve tool would be a better choice, as the edit points actually lie on the curve. The CV Curve tool should be preferred in most other situations because it is better at controlling the curve shape.
Using the CV Curve Tool Go to front view and select Create Ø CV Curve Tool Ø. Notice the default setting is at Cubic and Uniform. Leave everything at the default and X+click near the origin. Draw the curve on the left shown below. Oops! The last CV placement was a mistake. No problem. Just MM click and you can X+drag the CV back to where it should be placed like the curve on the right:
Tip You can also edit CVs or EPs while you are creating a curve by pressing the Insert key. With this method, you can select multiple points for repositioning. To continue creating the curve, just press the Insert key again.
Pencil Curve Tool Pencil is another great curve-creation tool in the Create menu, especially if you have access to a digitizing tablet. It may look like it is producing a thousand edit points when you are using it, but with a simple rebuild command, Edit Curves Ø Rebuild Curve, you can get an elegantly simple curve. Rebuild Curve Ø has a Number of Spans setting for Uniform Rebuild Type that you can adjust. Because when you release the mouse the Pencil tool completes building the curve, you will often end up with several separate curves when the drawing is done. Again, you can easily attach these curves using Edit Curves Ø Attach Curves. The raw curves on the left here have been rebuilt and attached to create the curve on the right.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (7 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Tip It s far better to end up with several separate curves that better represent what you wanted to draw than to trying to draw everything as one curve.
Arc Tools In contrast to the free form of the Pencil tool, the Arc tools enable you to create circular arcs of various angles. There are two types: the simple two-point circular arc, and the three-point circular arc, which has one more control point than the other tool.
Tip Once you ve created, for example, a three-point circular arc, you can still manipulate the arc edit points. First select Modify Ø Transformation Tools Ø Show Manipulator Tool (or press the T hotkey) and then, in the Channel box, under Inputs, choose makeThreePointCircularArc. The three points should be visible now.
Duplicate Surface Curves
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (8 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Yet another curve creation method is Duplicate Surface Curves, which is actually not part of the Create menu but appears on the Edit Curves menu. It can be a very efficient and powerful curve generator, especially now that in Maya 2 it has the ability to duplicate all the isoparms of a surface. Create a default cylinder, pick-mask Isoparm, select an isoparm anywhere on the surface, and select Edit Curves Ø Duplicate Surface Curves. A curve with the same number of spans as the cylinder has been duplicated.
Translate the duplicated curve out of the cylinder. Select cylinder as object, and repeat Edit Curves Ø Duplicate Surface Curves. This time, all the isoparms of the cylinder duplicated. You can set the options so that only U or V will duplicate. The default is both.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914995626 (9 of 9) [11/27/2000 8:27:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Editing Curves Once you have created the curves you need, Maya provides various actions and tools to edit them. In this section, we ll talk about attaching and detaching curves, aligning curves and surfaces, rebuilding curves, inserting knots, adding points to a curve, cutting and filleting curves, and offsetting curves.
Attaching and Detaching Curves The Attach Curves option requires that you pick either two curves or curve points. For most situations, Maya can automatically figure out which ends of the curves are being attached, and you only need to select curves as objects. In situations where the ends being attached are not correct, you can select curve points to force the proper ends to attach. To pick curve points, pick-mask Curve Point, and then drag the curve point to the curve end you want.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (1 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Tip When selecting curve points on two or more curves, first select the curve point on one curve, then pick-mask Curve Point on the other curve, and Shift+click the second curve point. The first selection stays selected. When both proper end curve points are selected, select Edit Curves Ø Attach Curves. Blend is the default attachment method, and Blend Bias 0.5 means both curves will meet halfway. This is the ideal setting when you need to maintain symmetry. When the Blend Bias is set to 0, the first selected curve will attach itself to the second curve. If you find the curve shapes are changing too much when you attach them, try clicking Insert Knot in the option box. For situations where you absolutely need to have the curves maintain their original shape, you can change the Attach Method to Connect. For this to work properly, however, the curve ends have to be touching already.
Warning When attaching curves or surfaces, if the construction history is on, make sure the Keep Original option (the default setting) is toggled on as well. Odd behavior may occur if it is toggled off and the attached object is modified later. Detach Curves is simple to use. It works by either selecting curve points, or edit points, or both, then selecting Edit Curves Ø Detach Curves. It also works on multiple curves as well.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (2 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Curve and Surface Alignment and Continuity When two separate curves or surface ends are not touching, they are said to be discontinuous. Once they are touching, there are three possible levels of continuity between the two: position continuity, tangent continuity, or curvature continuity. In creating a smooth continuous surface out of patches, you need at least tangent continuity between the connected patches. In this section, you ll work with two example curves to get an understanding of the concept of these degrees of continuity. To set up the example curves, create two CV curves, as below, using X+click to snap them to the grid. Make copies and translate them aside:
Position continuity, also called zero-order continuity (C0), occurs when the two end CVs are placed in the same 3D space. Select the two copied curves and select Edit Curves Ø Align Curves Ø. Set Continuity to Position, and modify Boundary to Both. Click Align to see the result shown here:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (3 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Tangent continuity, also called first-order continuity (C1), occurs when the tangents at the ends of the two curves have the same slope in addition to position continuity. Practically speaking, this occurs when the two end CVs of the curves all line up. Type Z to undo. Select the two original curves, change Continuity to Tangent in the option box, and click Align to see the result shown here:
Curvature continuity, also called second-order continuity (C2), occurs when, in addition to having tangent continuity, the curves curve away from their end points in the same way. Another way of saying this is that the radii of the curvatures of the two curves are the same. Practically speaking, this means that in the curve being modified, the third CV from the end point, in addition to the second CV, is also translated to accommodate the curvature change. Type Z to undo your last change, then select the curves again, and change Continuity to Curvature. Click Align again. Notice the change in position of the third CV from the end.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (4 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Note There are few tools in Maya that give options for curvature continuity: Align is one, and the other is Project Tangent, which is not covered in this book. The default setting for Align Curves and Surfaces (they are the same action) is Modify Position First, which means the first curve selected will move in its entirety to align itself. After you have performed the Align, try playing with the various optional settings in Channel box Ø Inputs to get a better idea of the options.
Rebuilding Curves Rebuild Curves allows you to rebuild curves in various ways. Rebuilding curves is important for creating good surfaces. When you work with curves for a while, they can end up with unnecessary CVs, or CVs bunched up unevenly. They can be cleaned with the Rebuild Curves tool, and from cleanly built (or rebuilt) curves come clean surfaces. Create a curve using the Pencil Curve tool. With the curve still selected, select Edit Curves Ø Rebuild Curve Ø. When the Rebuild Type is set to Uniform, which is the default setting, you have to manually state how many spans the curve should have. The default is set at four spans, but the number will vary greatly depending on the complexity of the required shape. The Reduce setting simplifies the curve according to the set Global or Local Tolerance level. The Match Knots setting requires two curves to be selected: it reparameterizes the first curve to match the number of knots in the second curve. The No Multiple Knots setting gets rid of multiple knots which are sometimes created when curves are attached or knots inserted. A multiple knot occurs when more than one knot, or edit point, occupies the same position on a curve. The Curvature setting redistributes and inserts more edit points in areas of higher curvature according to a Tolerance level just like the Reduce setting.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (5 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Note To change the Global Tolerance setting for the Reduce or Curvature options, go to Options Ø General Preferences Ø Modeling. Let s cover one more option. The Keep CV option allows you to rebuild the parameter of the curve while keeping the CVs in their original position. When you insert knots, the span of the curve increases, along with creation of more CVs, but the parameterized values of points along the curve stay the same as before the insertion. The Keep CV option recalculates the curve parameters to include the inserted knot, while keeping the CVs in the same position.
Inserting Knots Insert Knot allows you to add more edit points or CVs to further edit a curve. To use Insert Knot, you select a curve point on the curve where you want the extra edit point to be created and then choose Insert Knot. Note that another CV is created as well. A new option for Insert Knot in Maya 2, also available for Insert Isoparms for surfaces, is the Between Selections option. Select two edit points; then select Edit Curves Ø Insert Knot Ø, click the Between Selections option, and click Insert. Another edit point is added exactly halfway between the two selected edit points. Warning If you select two curve points with this option, these two curve points will also turn into edit points, along with the new edit point you ve inserted in the middle. This may not be the result you desire.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (6 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Adding Points to a Curve Once the curve has been created and you want to add more curve to it, you can use Edit Curves Ø Add Points Tool. If you want to add points not from the last CV but from the start of the curve, then select the curve and select Edit Curves Ø Reverse Curve Direction. If you want to add additional edit points instead of CVs, just RM choose over the curve and pick-mask Edit Point. Then, when you select Add Points Tool, it will be set to add edit points and not CVs. Note the difference between Insert Knot and Add Points: the former adds more points inside an existing curve, whereas the latter actually creates more curve segments.
Using the Curve Editing Tool Usually you can manipulate a curve by translating the CVs. But at times, you may want an edit point to stay in position while the CVs around it move to change the curve shape. The curve editor is especially useful in such a situation. Create a curve, and then select Edit Curves Ø Curve Editing Tool. Grab the Parameter position handle (see below) and move it along the curve while keeping V pressed to snap the editor to edit points. Once it s on the edit point you want, you can modify the curve tangent direction and scale around the edit point without moving the edit point itself.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (7 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Cutting Curves Edit Curves Ø Cut Curve is another very useful curve editing function. It takes multiple curves and detaches them where they intersect. The default option setting for Find Intersections is In 2D and 3D, which finds the intersections for the curves even if they are not actually touching in 3D space, but only seem to touch in one of the active (2D) views.
Filleting Curves Curve Fillet takes two curves that intersect and creates a fillet. Unlike Cut Curve, which can be projected from a 2D view, the fillet curves actually have to be touching. The default setting creates a circular fillet from the two curves. Where the lines are intersecting, sometimes the fillet occurs at the wrong corner. In such cases, you need to cut the curves first, and then select the curves you want to fillet. The Trim and Join settings in the option box can also save you a lot of time by trimming the curves and attaching the segments into one curve.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (8 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Offsetting Curves Offset Curve duplicates a curve with an offset distance that you set in the option box. There is an important difference between offsetting a curve and copying and scaling a curve. When a curve is duplicated and uniformly scaled, it maintains the curve shape, whereas a curve created from the offset maintains the distance between it and the original curve, though not necessarily the original shape.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=344069705 (9 of 9) [11/27/2000 8:27:24 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-On Maya: Aftershave Bottle, Part 1 Let s try building an aftershave bottle. In part 1 of this exercise, we will create and edit curves using the actions and tools we ve already covered. These curves will then be used to create the aftershave bottle surfaces in part 2. 1. Start with edit points building straight lines. Make sure you are in top view, and X+click the edit points as shown here:
2. Select the two curves at the top-right corner, and fillet the curves with just the Trim option turned on. Do the same for the other three corners. Now you should have eight curve segments. Attach the curves, starting from the top-right corner, with the options set to Connect Attach Method and Remove Multiple Knots. You should have no problems with the corners until the last corner curve:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=786540789 (1 of 4) [11/27/2000 8:27:33 PM]
Books24x7 Mastering MAYA Complete 2
3. With the last corner, use Pick Mask Curve Point to force the curves to attach at the bottom right. With the curve still selected, select Edit Curves Ø Open/Close Curves to close the curve, making it periodic (closed). Rebuild the curve with the options set to Uniform and Keep CVs. The curve should now have a parameter range of 32 spans. Snap the CV at the top middle to the origin as shown here:
4. Using the marking menu, get into the Persp/Outliner view. Although there is now only one curve, you will notice there are a lot of invisible nodes because of the construction history. Since we no longer need the fillet and the attach history, we can delete these: select curve, then Edit Ø Delete By Type Ø History. 5. Select the curve, select Edit Curve Ø Offset Ø Offset Curve Ø, set the Offset Distance to 0.5, and reduce the Max Subdivision Density to 0. This is important in keeping the same number of curve spans for the offset. Click Offset, and check the Attribute Editor (Ctrl+A) to make sure the offset curve created has 32 spans like the original curve. Translate the curve up in Y to 1. Now duplicate the offset curve: Edit Ø Duplicate Ø, set Translate to (0, 2, 0) and Number of Copies to 3. Click the Duplicate button to create three more curves. Close the option box. You should see three curves on top of the offset curve as shown here:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=786540789 (2 of 4) [11/27/2000 8:27:33 PM]
Books24x7 Mastering MAYA Complete 2
Tip Clicking Reset before closing the option box is good practice after actions like Duplicate, especially when you often use the box with a hotkey. Resetting saves the effort of having to go into the Options again, unless of course, you know you will be using the nondefault setting next time as well. 6. Translate the first duplicated curve down in Y to 2, and translate the second one up to 6. Select the third one at the top and Offset it with Offset Distance 0.5. Note that the new offset curve s translation values are at (0, 0, 0). Move it up in Y to 1. Offset the curve again with Offset Distance 0.5. Duplicate the offset curve with the same settings. You should now see ten curves in total, as shown on the next page.
7. Delete the top curve. In the Surface section, we will use these curves further to create an aftershave bottle. Save the scene as Aftershave_1. Tip When you build curves for lofting, it is a good idea to build the curves in the order in which they will be lofted. In our tutorial, we built the curves in order so that we only have to marquee the curves and loft. If they are not built in order, you have to select them one by one sequentially in order for lofting to work properly. Having to select individual curves each time you are lofting, when there are a lot of curves to select, can be frustrating.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=786540789 (3 of 4) [11/27/2000 8:27:33 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=786540789 (4 of 4) [11/27/2000 8:27:33 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating Surfaces Once the curves are all prepared, Maya provides us with various ways of creating surfaces from them. We will now cover these surface creation actions and tools in Maya s Surfaces menu. We will look at the Text tool under the Create menu as well, as it is closely related to the Bevel tool.
Revolve Revolve takes selected curves and revolves them around a designated axis, which you set in the option box. The default revolve axis is vertical, which is Y. The other settings are X, Z, and Free. The last option makes available the Axis boxes, which use the translation values of the Show Manipulator axis handle (see Show Manipulator tool). This means you can interactively change the revolve axis after creating a surface by manipulating the Show Manipulator tool. For a simple example, let s build a lamp to go into the living room we built in the previous chapter. Start a new scene and select CV Curve Tool. Draw curves in the front view as below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (1 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
With the curves selected, select Surfaces Ø Revolve. The default setting works fine for our purpose, and we see a revolved lamp. But wait, the lamp cover seems a bit lacking in design. Let s see if we can make it look a bit more stylish. Select the lamp cover, go to Channel Box Input, and click on revolve2. Change Degree to Linear, and Sections to 12. Now select the profile curve for the lamp cover and, again in Channel Box, translate it (1, 2, 2), rotate it ( 25, 25, 25), and scale it (1, 2, 1). The Chapter 6 Color Gallery on the CD shows the finished version. We can add this lamp to the living room later on, so save the file as Lamp for future use.
Lofting Lofting is without a doubt the most often used function in surface creation, and hence, the most important. The Loft command creates a surface using the selected curves, isoparms, or trimmed edges as spans and edges. The settings for Maya s Loft command are simple, and the default setting need not be changed for most occasions. You can loft any combination of curves, isoparms, and even trimmed edges. One thing you must always be careful about, however, is the order of the curves you pick for lofting. Make sure you are picking all the curves in order and in the direction you want the U to be going. The first curve picked will set the U parameter in the direction of the second curve. Tip If the curves being lofted are uniform curves and have the same number of spans, then the resulting lofted surface will retain the same uniform parameterization and number of spans as the curves. An excellent example to use for learning about lofting is the torus primitive. Create the default torus, and while it s still selected, open Edit Curve Ø Duplicate Surface Curves Ø, click on V, and click Duplicate. Select just the torus and delete it. You are left with eight circles to loft. Select all of them and loft with the default setting by selecting Surfaces Ø Loft. You end up with seven-eighths of a torus, as shown below. Select the surface and check the Attribute Editor. Note that it has seven spans in U, its Form U is Open, and from the top view, its span direction for U is clockwise.
Undo with Z until you have only the curves again. This time, select the circles individually counterclockwise, and in the Loft option box, click on the Close setting. Loft, and you should get a complete torus as in the illustration. Note that now the U span is 8, its Form U is Periodic, or closed, and its span direction for U is counterclockwise.
Extrude
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (2 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
The Extrude command extrudes a surface from selected curves, or curves on surface, or isoparms. Extruding isn t complicated, but it can get confusing because there are so many buttons you can click in the Extrude option box. Extruding usually involves two or more curves, or curves on a surface, or even isoparms. The first curve is the Profile that will be extruded, and the last one is the Path that will guide the extrusion. The Extrude command provides several settings that control the shape of the surface being extruded: "
The Tube setting in the option box makes the profile curve turn with the path.
"
The Flat setting lets the profile curve maintain its own orientation as it moves along the path.
"
The Distance setting only requires one curve, and it activates the Extrude Length slider. With Distance, you can determine the direction of the extrusion with either the Specify setting, in which different axis choices are listed, or the Profile normal, in which the extrusion goes along the direction of the profile curve s normal.
"
The Result Position option lets you either make the path come to the profile curve, which is the At Profile setting, or make the profile go to the path, which is the At Path setting.
The following example illustrates a general method that should work well as a way to create extrusions. Let s say you wanted to build a frame for the fireplace in the living room from Chapter 5. Start a new scene. With the EP Curve tool set to Linear, create the fireplace frame path using a construction plane as shown below. Then, in the top view, create the profile curve for the frame.
Now select the profile, move its center to one of the ends of the path curve and select Surfaces Ø Extrude with everything at the default setting. We should now have a frame shape like the one below. Note that you can adjust the shape of the surface by manipulating the curves.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (3 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
Working with Planars, Text, and Bevel An object is planar if can be wholly mapped to a plane; that is, if it is a 2D object in 3D space. It has length and width, but doesn t have depth. A true planar object, then, cannot be twisted in three directions. As soon as it does, it ceases to be planar. A planar surface is an efficient way to create trimmed surfaces from closed curves. But, again, these curves themselves have to be planar curves. Planars are especially useful when it comes to creating text in Maya; in fact, there is actually a Planar option setting for creating text. For a quick example of a planar, get a circle and apply a default planar on it by selecting the circle, then selecting Surfaces Ø Planar to get a trimmed surface. Pick-mask on the circle and try moving a CV up and down. The trimmed circle surface will disappear and come into existence only when the CV is perfectly on the ground plane. To get a good understanding of working with planar objects, let s create a simple letter M. Start a new scene, select Create Ø Text Ø, and type M inside the Text field (we are being very economical here). Although the Trim option is available here for creating a planar surface, we will create it another way later. Leave everything at its default and click Create. A planar curve outline of the letter M is created. Go to the Perspective window to see the planar curve letter in 3D. You should see the picture a) below. Beveling is almost the opposite of planar in that it usually creates depth in flat things. It is a very flexible and powerful function that can take a curve, an isoparm, or even a trimmed edge and create bevels, or sloping edges. Let s bevel the planar outline of the letter M you created in the previous section. Select the M curve and select Surface Ø Bevel Ø. The options here are not complicated, but they can be a bit confusing because of the orientation: Top Side bevels the back of the letter, Bottom Side bevels the front, and Both bevels front and back. Tip When the text is created in Maya, it is facing front. If you have trouble relating Top to back, Bottom to front, and Height to extrusion depth, just imagine the letters lying face down on the ground. You can make the bevel corners Straight or Circular, and you can have the bevel edges straight, arc in (Concave) with sharp definitions, or arc out (Convex) smoothly. You can leave the Bevel Width, Depth, and Height at default settings we ll be interactively adjusting them afterwards. Click Bevel, and you should see the picture b) below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (4 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
But first, if you want to change the default settings for corners and edges, go to Channel box Ø Input and click on bevel1 to get at those settings. Press T to activate Show Manipulator for Bevel history. You should see three blue dots connected with lines. If you don t see these, go to Channel box Ø Input and click bevel1 again, and they should appear. These blue dots are handles with which you can manipulate Bevel Width, Depth (the depth of the bevels, or the sloping edges), or Height (which is the depth of the actual extrusion of the text curve). Manipulate them until you are satisfied with the shape of the letter M, then pick-mask Isoparm and select the front edge of the bevel surface, as in the picture c) above. Select Surface Ø Planar and you should see the front side of the M now covered. You can use the letter to decorate the living room later. Save the file. You can see a rendered version of the letter in the Color Gallery on the CD.
Boundary The boundary function is most easily described when compared to lofted curves. When two curves are lofted, the result is a four-sided surface, two of whose opposing edges are defined by the curves. The other two edges are automatically calculated to be straight lines going from one curve to the other. When more than two curves are being lofted, the other two edges can become curved, but these, too are interpolations between the curves being lofted. A boundary function, in contrast, enables the four sides of a surface to be created from four curves, thus giving the artist more control over precisely how the surface edges should be defined. Let s take a closer look at boundaries. Start a new scene. Create four different curves with two or three spans each. Place them in such way as to have their ends intersect. You can select the curves in any order you want, or drag-select them all together, but the first curve picked determines the UV parameterization of the boundary surface, as the surface U parameters are determined by the curve s own U parameters. So if the UV direction for the boundary is important, you should keep that in mind when you are building the first curve.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (5 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
Once the curves are all selected, select Surfaces Ø Boundary with the default settings. You should end up with a surface that has three or four UV spans. Save this file, as you can use the same curves for working with birails in the next section. The Boundary function can also create surfaces with only three curves. This type of surface created with the boundary is not really a surface with three edges, but rather a surface with one zero-length edge. The order of picking is significant in this case because the pinched zero-length edge (also called the degenerate surface) occurs between the first two curves picked. This is important in situations where the surface patch needs to be attached to another surface patch.
Note Square works much like Boundary in that it takes three or four curves and produces a surface patch. The way it creates tangency, however, is more complex, and it is considered an advanced tool.
Birails
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (6 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
Birails are functions much like boundaries in that they work to determine the four sides of a surface. Essentially, birails extrude one or more profile curves along two rail curves, or paths. The parameters of the profile curve(s) define the V parameters of the birailed surface, and the two rail curves define the U parameters of the surface. Let s see how birailing works. Get the curves you built for testing the boundary function. Select Surface Ø Birail Ø Birail 1 Tool. (We will delve into the options a bit later.) Maya asks you to select the profile curve; select one of the curves. Now you are instructed to select the two rail curves; select the two curves adjacent to the first picked curve. The birail surface is created. You can try this again with different order of selections and see how the surface differs in each case, and how it also differs from the boundary surface. The fourth curve of the boundary is basically ignored, being replaced by the profile curve. Let s look at the other birail tools. Choose Birail 2 Tool, and again leave all the settings at their defaults. You are instructed to select two profile curves now. Select the two parallel curves. Then pick the two rail curves. A birail is created. Notice how this surface looks much like the boundary surface? That is because the same four curves are used to create the surface. For the Birail 3+ Tool, we need another curve to act as a profile curve. It would be good to build a curve with two or three spans like the other curves, and you should make sure the newly added profile curve is touching the rail curves. You should have something like the curves shown here:
The Birail 3+ tool works a bit differently you select all the profile curves first, hit Enter, and then pick the two rail curves. The birailed surface appears. Birail 3+ is basically a high-level loft, with the U parameter surface edges following the rail curves, and you can have control of the inner areas of a surface with the Birail 3+ tool that you cannot get with boundary or the other birail tools. Let s look briefly at a few option settings. All three types of Birails have Non-proportional or Proportional settings under Transform Control. The first setting modifies only the parts of the profile curve that change when it birails, whereas the Proportional setting maintains the shape of the profile curve thus the name. So if the rail curves grow wider, the Nonproportional setting will only stretch the profile sideways, but the Proportional setting will enlarge the entire profile. The Rebuild option also allows the curves for the birail to have their own rebuild options, which may in some situations give us much lighter surfaces. For the rebuild settings, refer to Rebuilding Curves above.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (7 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2 Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=322544295 (8 of 8) [11/27/2000 8:31:25 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Editing Surfaces Once a surface is created, you will often need to manipulate it to produce its final form. Maya s many surface editing tools and actions behave exactly the same way as their curve counterparts, which we have already covered. We will be going through those pretty quickly, while some others we will be spending more time on, such as the Trim tool. We will also focus more on modeling techniques using these tools.
Attach and Detach Surfaces These actions work exactly the same as their curve counterparts. With curves, you were pick-masking curve points, whereas with these surface actions, you pick-mask isoparms.
Working with Construction History Start a new scene. Select Create Ø NURBS Primitives Ø Cone. Focus in on it by pressing F, and select its isoparm about halfway up. Now choose Detach Surfaces with the default settings. Select the top half, move it up a bit, apply Attach Surfaces, and translate it to the side. You should see something like picture a) shown below. Now grab the top part of the cone again and try transforming it in various ways while observing the effect it has on the new surface. Below are more examples of the various effects produced on the new surface.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (1 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
Inserting Isoparms and Aligning Surfaces The Insert Isoparms command is the surface equivalent of Insert Knots for curves. When the option box is set for Between Selections, selecting isoparms (unlike selecting edit points) can be a bit tricky. (Make sure you are not click-dragging, but just clicking, or you may end up highlighting an isoparametric curve between the isoparms, in which case they will be inserted as isoparms as well.) Tip You can also check the Feedback Line just above the Layer Bar to see if what is highlighted has a neatly rounded parameter value (assuming it is a uniform surface). If it does, it usually means you have selected an isoparm. Align Surfaces is the surface equivalent of Align Curves. They actually use the same option box. In most situations, simply attaching or stitching (see Chapter 8) creates the continuity we desire, but in those cases where you specifically want surface curvature continuity, you would want to use Align Surface first.
Extend and Offset Surfaces Extend Surfaces extends a surface s edge(s) according to a set distance. It can either extrapolate the direction to the way the surface was curving at the edge, or simply go off in a tangential direction. Create a torus. Go to the Inputs, click makeNurbTorus1, set its variables as follows, and you should see a quarter-formed torus:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (2 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
With the torus still selected, select Edit Surfaces Ø Extend Surfaces. Open the Attribute Editor, select the extendSurface tab, and set Extend Side to Both and Extend Direction to V. The Offset Surfaces option is the surface equivalent of Offset Curves, with simpler settings. In its option box, the Surface Fit setting calculates the distance of the offset from the surface, whereas the CV Fit setting calculates the distance of the offset from the CVs. Select the extended torus, and apply Offset Surface. Go into the Inputs window, click on Distance, then in the modeling window, MM drag to interactively adjust the distance of the offset. It seems 0.2 is a good distance. You should see something like the picture below. Tip It s often better to use editing functions at default settings, and then interactively change the settings by using the Attribute Editor or the Channel box with Show Manipulator.
Try offsetting a curve from one of the top edges, lower it a bit, and use it with the two surface edge isoparms to create a loft between the two surfaces. Repeat for the bottom edges, and you should see something like this:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (3 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
Trim and Round Trimming is a way to cut surfaces into desired surface shapes using curves on surfaces (see below). Trimming indiscriminately can produce heavy models because it can create a lot of unnecessary isoparms, and that is always a factor to keep in mind when using the Trim functions; but at the same time, a well-applied trim can save a lot of work and produce better models
Projecting Curves On Surface In order to trim a surface, you need curves on surface first. This is Maya s term for curves that are mapped to the UV parameters of the surface they are on, rather than to the XYZ coordinates of world space. Maya 2 can let us project curves, curves on surface, isoparms, or trimmed edges to a designated surface and create curves on that surface. Let s look at this with an extended example. Let s try building a spherical opening protruding from a wall. We will use projections, trimming, and filleting to do this. Create a NURBS sphere, scale it uniformly to 2 and rotate it 90 degrees in X. Create a NURBS circle, which should appear right inside the sphere. Go to top view, select both, and select Edit Surface Ø Project Curve On Surface, with the default setting. Go back to the Perspective window, and you should see two curves on surface on the sphere (as in the image on the left below).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (4 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
The Trim Tool Select the bottom curve on surface (you should be able to select it like a regular object) and delete it. Select Edit Surface Ø Trim Tool. Select the sphere, and it should turn white. Click on the middle of the sphere to designate that as the part of the sphere you wish to keep. Hit Enter. You should see a trimmed hole as in the image on the right above. Select the sphere and scale it up to (3, 3, 3). Notice that the hole on sphere is keeping its size. When you move the circle, the hole follows it. Select the sphere and apply Edit Ø Delete By Type Ø History to erase the procedural relationship between the circle and the curve on surface.
Untrimming Surfaces Oops! We made a mistake, we wanted to make a hole at the front of the sphere, not at the top since we deleted the history, we can t move the hole. Now we have a bit of a problem. Curves on surface can be deleted like objects, but not trimmed edges. There is a command specifically designed for untrimming surfaces, which is Edit Surfaces Ø Untrim Surfaces. You can choose to delete only the last trim or use the default setting, Untrim All. Select the sphere and apply Untrim Surfaces.
Projecting with Surface Normal Let s try Project Curve on Surface again. Open its option box. The default setting is Active View, which means the curve is projected onto the surface from the camera of whatever view is active. The other option is Surface Normal, which determines the projection of the curve by the normals projecting from the surface. Here the projection is actually done the opposite way. Click on Surface Normal, keep the option box open, select the circle and move it to (0, 0, 4), rotate it ( 60, 0, 0), and scale it (3, 3, 7). With the circle still selected, select the sphere and click Project button in the option box. Notice that you only see one curve on surface created near the circle and not on the other side. That is because the normals on the other side are not seeing the circle. Trim the sphere and delete the circle.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (5 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
Intersect Surfaces As well as projecting curves and isoparms, Maya can also create curves on surfaces when NURBS surfaces intersect. The Edit Surfaces Ø Intersect Surfaces with default settings creates curves on surfaces on both intersecting surfaces. Create a NURBS plane, rotate it 90 degrees in X, translate it 1 in Z, and scale it uniformly to 30. This will be the wall. Drag-select both the sphere and the plane, and select Edit Surfaces Ø Intersect Surfaces. You should see curves on surface on both surfaces. Select the plane and trim out the circle. Trim the sphere as well, and you should see something like below.
Round and Fillet Fillet and Round are similar functions, but Round is considered a more advanced tool. Let s try both, starting with Fillet. Drag-select the plane and the sphere. Select Edit Surfaces Ø Surface Fillet Ø Circular Fillet. The default setting works well here. In other situations, you may have to go into Input and fiddle around with Primary or Secondary Radius to get the fillet to curve the right way. The option box also has a Create Curve on Surface setting for further trimming.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (6 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
Now, to try out Round, undo the fillet action. To use Round, we must have two edges. Select Edit Surfaces Ø Round Tool, and select the trimmed edges. You should see the yellow Round radius manipulator indicating the fillet radius. You can interactively change the radius by grabbing the end handles of the manipulator. The default is 1, which is fine for this example. Press Enter, and you ll see the fillet created once again. But with Round, the surfaces are also trimmed so that the fillet actually joins the trimmed edges of the surfaces. To finish up, you would want to offset the sphere and loft their trimmed edges to get some thickness, and create a tunnel into the wall, as in the picture on the right next.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=724043915 (7 of 7) [11/27/2000 8:31:37 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-On Maya: Aftershave Bottle, Part 2 Now we re ready to return to the aftershave bottle we began creating earlier in the chapter. 1. Open the Aftershave_1 file from the previous exercise. Marquee-select the nine curves (they should be in proper order) and apply Edit Surfaces Ø Loft. Delete all the curves. Duplicate the lofted surface, and enter 1 for Scale Y in the Channel box. Translate it up, and you should see something like image a) below.
2. Pick-mask Control Vertex over the top surface and, in the front view, translate the points down in Y and closer together. You should have something like image b) above.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=374758126 (1 of 2) [11/27/2000 8:31:45 PM]
Books24x7 Mastering MAYA Complete 2
3. Select the edge isoparms and select Edit Surfaces Ø Attach Ø, check off Keep Originals, and click Attach. We now have the body of the aftershave bottle. Select the top edge isoparm of the surface, select Edit Curves Ø Offset Ø Offset Curve Ø, set Offset Distance to 0.5, Max Subdivision Density to 0, and click Offset. An offset curve is created as below. Loft between the surface edge isoparm and the offset curve. Then select the offset curve again, and apply Surfaces Ø Planar with the default settings. You should have the surface s top covered as below.
4. Attach the lofted surfaces together. Put a cylinder and a sphere to the top as the bottle cap. You may want to squash the bottom of the sphere a bit. The modeling part is done. Again, you can find the finished version in the Chapter 6 Color Gallery on the CD.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=374758126 (2 of 2) [11/27/2000 8:31:45 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-On Maya: Building a Face (Advanced) This is an advanced exercise. The steps are complex and presented only in outline form, and you will have to infer a great many little details. There are many different ways to build a human face. The method being used here, generally referred to as the radial method, may not necessarily the best one, but it is one of the most efficient ways to create detailed, ready-to-animate faces. The face we ll create appears in the Chapter 6 Color Gallery on the CD. 1. Start out with a sphere. Cut out the front and the back parts the front will be the mouth, and the back will be the neck. Shape the sphere into a very rough figure of a human head as below.
Note A person s face was used for this model, but it is not shown here for reasons of privacy. When you are modeling a face, make sure you have a picture or a sketch to import as image plane.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=631092046 (1 of 6) [11/27/2000 8:31:56 PM]
Books24x7 Mastering MAYA Complete 2
2. Cut the head in half in the middle. Refine the head more, pulling out the chin, nose, and cheek. When you are moving the boundary edge CVs in the middle, make sure you are moving the CVs beside them as well. You also want to keep the X values of the edge CVs at zero, and only move them in Y and Z. The isoparms should be tightly gathering at the beginning of the neck area as shown on the next page. Insert isoparms where you need them, and delete rows of CVs where you do not need them.
Tip When you are inserting isoparms, make sure you are using the Between Selections option whenever you can. Note the number of isoparms at this stage. We have enough to have a simple head and neck, if not the face. The number of U isoparms isn t so important right now, but there are eight V isoparms radiating from the mouth for half a face, which is about right at this stage. Rebuild the surface with the Keep CVs setting checked, and everything else at default. 3. The mouth should be built first. As a rule, for a simple half face, you want three isoparms for the mouth bottom, three for the mouth corner, and three for the mouth top. This would be listed in the Attribute Editor as eight spans of V isoparms, the first isoparm having the value of zero. Cut the face just around the forehead area. Hide the head. Duplicate the half face, then make its Scale X value 1. This becomes the half face on the right. Open the Connection Editor. Select the first face s shape node and load it into the Output window. Load the second face s shape node into the Input window. Connect World Space to Create as shown in the next illustration. Now the second face on the right deforms when the CVs of the first face on the left are moved.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=631092046 (2 of 6) [11/27/2000 8:31:56 PM]
Books24x7 Mastering MAYA Complete 2
4. Don t create the oral cavity. The surface edge should be right at the end of the inner lip. Concentrate instead on forming a clean mouth, with the CVs all placed properly and not bunched up chaotically, especially in the mouth corner area. You can add U isoparms to make the nose more defined, but do not add V isoparms at this point. Once the mouth looks acceptable, rebuild the surface. The V isoparm count should still be eight spans. 5. Duplicate curves from U isoparms of the face. Unhide the head, and do the same. Delete the surfaces. You are left with only the curves, as in a) shown next. Loft, and tweak the curve CVs to refine the head further, as in b). 6. Cut the face from the head as before, and add U and V isoparms to define the nostril area, as in c). Make sure to insert the isoparms gradually as you are sculpting; otherwise you are unnecessarily challenging yourself. Although the face and the head are detached, they are still procedurally connected to the curves. If you want to make changes involving both surfaces, you can still do so by moving the curves CVs. Their tangency is maintained.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=631092046 (3 of 6) [11/27/2000 8:31:56 PM]
Books24x7 Mastering MAYA Complete 2
7. Once the nose is finished, you can move on to the eyes. What we are going to do is cut the face into four patches. The mouth and the nose are basically done, and there is no reason to add anymore isoparms to it. The eye area requires a lot of isoparm insertions, and we d like to localize the density as much as we can. And cutting the eye area into two patches along the eyeline allows you to create holes for the eyes. 8. Cut the mouth area from the face, selecting the isoparm a bit below the eye sockets. Cut the jaw area from the face, again, along the isoparm just beside the eye sockets. 9. Only the eye area remains to be sculpted and it is probably the most difficult. Before cutting the eye area into eye_top and eye_bot patches, insert all the V isoparms you ll need. You need two isoparms close together to clamp the eye s corner, two on each side, at least three or four isoparms for the eye itself, and at least one isoparm between the eye area and the edge. Once the V isoparms are inserted as in e) above, you can cut the U isoparm along the eyeline. You need to insert the U isoparms in the two eye patches as you are sculpting the eye area, but they should roughly look like e) after a while. The picture d) above is an example of what can go wrong at this stage. The U isoparm was cut prematurely. You can still insert isoparms in the two resulting patches carefully so that they will match, but it isn t efficient. Also, the cut was made without putting in eyeballs to see exactly where the eyeline is. As a result, the cut was made a bit lower than it should have been. 10. The ear is basically a deformed sphere with holes. If there is a trick to building it, it s not much of a trick build the front half first, and then the back half. The ear below has been cut in half to show this. The rest is sculpting, pushing and pulling CVs into the shape you see. The eyes can be as simple as a plain sphere, or as complicated as the one here. There are two spheres, the inner one deformed for realistic pupils, and the outer one transparent and used for specularity only.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=631092046 (4 of 6) [11/27/2000 8:31:56 PM]
Books24x7 Mastering MAYA Complete 2
11. You need to insert two more isoparms in order to fold the eyelids. Since we re building a child, the eyes should become a bit larger and the nose a bit rounder. Once the shapes look OK, attach the left and the right side geometries. Use the Blend with Insert Knot setting. You should end up with eye_top patch, eye_bot patch, mouth patch, and the jaw patch as shown below. If the edges no longer meet perfectly, it is not a problem, as long as they are not too far apart. For the space that gets created between the eyes and the face patches at the corners, stick in a simple polygon face to fill the hole, as shown here. The eye area should be built in such way that the patches will close the eyes without any problem.
12. Use the Global Stitch with Tangency option. Select everything, including the head geometry. If any seams were noticeable, this should get rid of them. Make a copy of the face. You can delete the curves, the original face patches, and other unnecessary nodes. We did not build an oral cavity for this model, but if you wanted to build one, you would start by offsetting the inner mouth edge isoparm, and duplicating the offset curves. You should build it when you are building targets for Blend Shapes. The hair is built from a plane, which starts out from the back and wraps around the head like a towel.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=631092046 (5 of 6) [11/27/2000 8:31:56 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=631092046 (6 of 6) [11/27/2000 8:31:56 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 6 - NURBS Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary This was a long chapter, covering a lot of material. You learned to create and manipulate NURBS curves and surfaces, and saw examples of building things with them. We also went through an advanced tutorial on building a human face, which takes a lot of practice to become good at. The next chapter will also be quite substantial, introducing the world of polygons. Then we will come back to modeling with NURBS again in Chapter 8, where we will proceed to build a puppy dog in patches.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=578095157 [11/27/2000 8:32:03 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 7: Polygon Modeling Overview Polygons are the preferred modeling choice for many gaming companies. If you are interested in going into that field, you should be particularly interested in this chapter. Of course, this chapter also is of interest to anyone who uses Maya for modeling. We begin by introducing some terms and concepts related to polygons. Then we describe how to create and edit polygons using the Maya tools. Finally, we discuss the more advanced topic of mapping textures. To demonstrate all the concepts, the tutorial at the end of this chapter provides instructions for building a hand using polygons.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=665287296 [11/27/2000 8:32:06 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Polygon Concepts and Terms The word polygon is derived from a Greek word meaning many angled . In mathematics, a polygon is defined as a closed figure formed by a finite number of coplanar segments that are not parallel and intersect exactly two other segments only at their endpoints. As far as we (and Maya) are concerned, polygons are triangles, rectangles, pentagons, and other many-sided line drawings. The endpoint is called the vertex, the line is called the edge, and the area inside is called the face.
Polygon Faces Faces have a front side and a back side. When you are building the face, the front side is determined by the direction of the vertices creating the edges (see the Creating Faces section later in this chapter).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=620117594 (1 of 4) [11/27/2000 8:32:12 PM]
Books24x7 Mastering MAYA Complete 2
The most basic polygon surface is the triangular face. The front side of a triangular face has only one normal vector, because triangles are, by definition, planar. Quadrangular polygons (quads) are four-sided faces, which may or may not be planar. You also can create faces that have five or more sides, called n-sided faces. However, as a general rule, you should try to keep your polygon surfaces as triangles or quads. Note We could say that a triangular face is the building block of all modeling. Every type of surface geometry is converted into triangular faces (a process known as tessellation) before it is rendered. Faces in a polygon surface are usually connected (attached to each other), sharing common vertices and edges. They can be extracted with their own unshared edges and vertices while still being part of the polygon surface, but then they will not become soft edges, which means they will not be smoothed in the tessellation process. (Extracting faces is discussed later in this chapter, in the Editing Polygons section.)
Polygon Solids, Shells, and UV Values Polygons are classified as either solids or shells. A polygon solid is made up of connected faces that form an enclosed volume, where each edge is shared by two faces. A polygon shell is a collection of connected faces that leave some of its edges open as border edges. A polygon object can have more than one shell, as in the example shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=620117594 (2 of 4) [11/27/2000 8:32:12 PM]
Books24x7 Mastering MAYA Complete 2
By default, faces have UV values assigned to them when they are created. As explained in Chapter 6, a surface in 3D space is defined by the parameterization of the variables U and V. A UV coordinate can be given at any point inside the area, and the area is given UV directions. UVs are needed for texturing purposes. UVs are difficult to distinguish from the regular vertex points, but they turn bright green when they are selected. Note You may find polygons that do not have UV values, especially when the surface is a model imported from another program. If the UV values are missing from the polygon surface, you need to assign them manually, as described in the Mapping Textures section later in this chapter.
Valid and Invalid Polygon Surfaces When working with polygons, you will often end up creating surfaces with a lot of vertices that you need to tweak, or you may have high-resolution imported or converted models that need to be cleaned up. We will discuss ways to make the process easier in this chapter. However, there are certain rules you should always keep in mind: Some invalid polygon surfaces are illustrated below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=620117594 (3 of 4) [11/27/2000 8:32:12 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=620117594 (4 of 4) [11/27/2000 8:32:12 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating Polygons Polygons are usually created by clicking on vertices, much like creating curves, to generate edges. Two or more edges create a face, which contains face normals and vertex normals. You can also create polygon primitives or convert NURBS into polygons.
Using Polygon Primitives As with NURBS, Maya provides several default polygon primitives you can use as starting points for creating more complex polygonal surfaces. When you select Create Ø Polygon Primitives, you ll see the choices Sphere, Cube, Cylinder, Cone, Plane, and Torus.
Note Notice that the polygon cube, cylinder, and cone surfaces are all one-piece solids, unlike their NURBS counterparts, which are made up of several pieces.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (1 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
As an example, select Create Ø Polygon Primitives Ø Sphere Ø. The Subdivisions Around Axis attribute is equivalent to the Sections attribute of the NURBS sphere, and Subdivisions Along Height is the same as the Spans attribute of a NURBS sphere. You also can choose the axis for the sphere s up direction. The Texture setting, which is turned on by default, maps UV values to the sphere being created. We will talk more about textures toward the end of this chapter. To create the sphere, click Create. You can try editing the sphere s radius and subdivision attributes in the Channel box s Input section or in the Attribute Editor s polySphere tab. In the latter, you can also edit the Axis setting to change the sphere s orientation. The examples below show spheres with different settings.
Displaying Polygons Maya provides many different ways of modifying the display of polygons (perhaps too many, in fact): "
From Display Polygon Components, which is an easily accessible submenu
"
From Display Custom Polygon Display q, which provides more details and the ability to control the display of more than one polygon
"
From Options General Preferences (in the Display Polygons section), which is a detailed display that lets you control multiple polygons, similar to the Custom Polygon dialog box
"
From the Attribute Editor s Shape tab (in the Mesh Component Display section), which focuses on one polygon, as shown next
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (2 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
The following sections describe the display options for the polygon surfaces that are available through these dialog boxes.
Displaying Vertices You can set vertices so that they are visible when the polygon is not selected. Vertex normals also can be made visible. The Backface Culling option for vertices is turned on by default in the Custom Polygon Display Options dialog box (shown below), but it doesn t have any effect if the Backface Culling option is set to Off.
There are three degrees of backface culling, and they can be very useful when you need to select only the front side of a surface (the Attribute Editor and the Custom Polygon Display Options dialog box have slightly different wording for these options): These three modes are illustrated below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (3 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
Displaying Edges and Borders Edges can be displayed in three ways: "
The Standard setting displays all the edges.
"
The Soft/Hard setting displays the soft edges as dotted lines.
"
The Only Hard setting displays only hard edges.
The Border Edges setting is off by default. When you turn on this setting, you can see the border edges in thicker lines. The default width for border edges is 2, but you can increase the thickness. The Custom Polygon Display Options dialog box also offers a Texture Borders option, which represents the starting point and endpoint for the texture UV placement. These display options for edges and borders are illustrated below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (4 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
Displaying Faces The choices for displaying faces are Centers, Normals, Triangles, and Warp. The Triangles option is available if the faces are not triangular, and it displays the faces in triangles made up of dotted lines. When Warp is turned on, it detects any face that is warped, or nonplanar. The different settings for displaying faces are shown below.
Note The Triangles option for face display is different from the Triangulate function, which actually adds the edges to the faces. With the Triangles option, the surface itself does not change; it only displays triangles. You can choose to display face normals, as well as vertex normals, and set different line lengths to represent them.
Displaying Numbers
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (5 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
Through the Custom Polygon Display Options dialog box, you can display numbers for vertices, edges, faces, and UVs of polygon surfaces in the order of their creation. Examples of item numbering for vertices, edges, and faces are shown below. UV topics are covered later in the chapter.
Coloring Vertices You can color vertices in Shaded mode by checking the Color In Shaded Display option in the Custom Polygon Display Options dialog box. To apply color to vertex, select the appropriate vertices and select Edit Polygons Ø Colors Ø Apply Color Ø. In the option box, you can create the color you want for the vertices, and then click the Apply Color button. (See the Color Gallery on the CD for the full effect.)
Displaying the Polygon Count
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (6 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
Another display function that is indispensable in working with polygons is accessed by selecting Polygons Ø Display Poly Count. In many game productions, keeping a model s poly count below a certain number is crucial in maintaining real-time interactivity of the game. Display Poly Count shows the following statistics: "
The numbers in green on the left side of the window show the total polygon count in vertices, edges, faces, and UVs for all the visible polygon surfaces inside the window.
"
The numbers in white on the left side of the window show the numbers of the specific selected components.
"
The numbers in white on the right side of the window show the total polygon count for the selected object.
Creating Faces Let s use the Create Polygon tool to draw two faces: 1. In the side view, select Polygons Ø Create Polygon Tool Ø. 2. Set all the options to their default values by clicking the Reset Tool button, and then change the Limit Points setting to 3. 3. Click in the modeling window in a counterclockwise direction as shown below. On the third click, a triangular face is created.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (7 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
4. Change the Limit Points setting to 1 (the default). Then click again, as shown below. Press Enter after the fourth click to create a quadrangular face.
Note If you leave the Limit Points setting at its default of 1, then after you ve entered the desired number of vertices, you just press Enter to complete the action. 5. Choose Display Ø Custom Polygon Display Ø. Click the All button at the top of the dialog box to set the display for both faces. Then check the Normals check box next to Vertices and the Vertices check box next to Show Item Numbers. Switch to perspective view, and you will see that the normal directions for the faces are opposite, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (8 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
The direction of the vertex creation determines the direction of the normal. This means that the front side of a face is created by vertices going counterclockwise. Note Faces that are not triangular may or may not be planar. If you want to make sure the faces you are building remain planar, you can select the Ensure Planarity option for the Create Polygon and Append To Polygon tools. This option forces the face being built to remain planar.
Adding Faces The Append To Polygon tool is the same as the Create Polygon tool, except that it adds faces to existing faces rather than creating new ones. Let s add some faces to our triangular face: 1. Switch to side view and select Polygons Ø Append To Polygon Tool. 2. Click on the triangular face to select it. You can tell it s selected because the border edges appear thicker. Tip By default, to select a face, you need to click or marquee its center. If you want to be able to just click anywhere inside the face and select it, choose Options Ø General Preferences Ø Modeling, and change the Polygon setting from Center to Whole Face. 3. Select the edge on the left side, and you will see pink arrows going clockwise around the triangular face. Also, a bright green dot appears at the zero vertex. That is where the appending begins. (Because the arrows go in the opposite direction from the way the face is created, this process can be rather confusing if you are not careful.) 4. Click two more times, as shown below. Then press Enter. You now have a quadrangular face attached to the original face. Note the vertex numbers are 3 and 4. You can continue to add faces this way.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (9 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
You can set the Append To Polygon tool to continue adding faces by setting the Limit Points option to 4. You can try this with the quadrangular face. After the second click, another quadrangular face is created, and you are still in the Append mode. You can build polygonal strips in one round of clicking this way, as illustrated below. You also can create a triangular face by pressing Enter after the first vertex placement, but that will exit Append mode. Another technique is to click on one edge, then click on another adjoining edge to create a face that is attached to those two faces, and continue to attach the face to more edges as you go.
Tip You can reposition a vertex while you are creating it, just as you can with curves (see Chapter 6). Just MM click or press the Insert key.
Creating Faces with Holes With the Create Polygon or Append To Polygon tool, you can easily create faces with holes. After you ve positioned the desired number of vertices with the default tool settings, do not press Enter. Instead, press the Ctrl key, and then place a vertex inside the surface area. This becomes the first vertex of a hole inside the surface. If you want to create another hole, Ctrl+click to start again. When you re finished placing holes, press Enter to complete the action. Note that the resulting surface, when triangulated, is pretty messy, so you ll want to clean it up.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (10 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
Converting NURBS to Polygons Maya has an efficient NURBS-to-polygon conversion function. The default is set to triangles and the tessellation method, with a standard fit. You can change the settings to suit your needs. Quadrangles usually convert more cleanly than the triangles. However, after the conversion process, you may prefer to work with triangles or a quadrangulated version, as shown in the center illustration on the next page.
The Count setting forces the converted polygon to try to match a set number of face counts. The Control Points setting creates vertices in place of CVs. After the conversion, you can edit the conversion settings in the Attribute Editor or the Channel box.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=234721277 (11 of 11) [11/27/2000 8:32:29 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Selecting Polygons Before you can edit and manipulate your polygons, you need to select them. As usual, Maya offers several techniques for accomplishing this task. You will most often select components using the selection mask, by RM choosing over the surface you re working on. Alternatively, you can use hotkeys and the tools on the Polygons Ø Selection menu.
Selecting with Hotkeys You can use the following hotkeys for selecting components of polygons: F8
Toggles between object and component selection
F9
Selects vertices
F10
Selects edges
F11
Selects faces
F12
Selects UVs
Ctrl+F9
Selects vertices and faces
To select more than one component, select a component, pick-mask to another selection mode, and then Shift+select the other component. The illustration below shows the marking menu list for the various polygon components.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=719727175 (1 of 4) [11/27/2000 8:32:39 PM]
Books24x7 Mastering MAYA Complete 2
Using the Selection Tools Maya also provides some tools to aid you in selecting components. Select Polygons Ø Selection to see a submenu with selection tools. The Grow Selection Region function increases any selected component elements by one unit. Shrink Selection Region does the opposite. Select Selection Boundary leaves only the boundary of the selected component elements still active and deselects the rest.
You can also convert any selected component elements to another by using the Convert functions on the Selection submenu. As you can see in the illustration below, conversion is not cyclical converting the selected vertices to UVs will give a larger region of UVs than the one you started with.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=719727175 (2 of 4) [11/27/2000 8:32:39 PM]
Books24x7 Mastering MAYA Complete 2
Constraining Selections At the bottom of the Selection submenu is an advanced tool called Selection Constraints. Here are some examples of what you can do with this tool: "
You can constrain the selection to specific locations, such as border components or inside components.
"
You can have only hard edges selected or only soft edges selected.
"
You can select only triangular faces, only quads, or only faces with more than four sides.
"
You can select components with a set amount of randomness.
"
You can expand or shrink a selected region, or select the selection s boundary.
Some examples of polygon selection constraints are shown below. You may notice that the n-sided faces look like they are quads. It s easy to confuse the two, but when you count the vertices or the edges, the selected n-sided faces have more than four. All the n-sided faces have smaller adjacent faces that divide their sides into two edges and three vertices. Another way to tell if a face is n-sided is to turn on the Triangles option in the Custom Polygon Display Options dialog box.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=719727175 (3 of 4) [11/27/2000 8:32:39 PM]
Books24x7 Mastering MAYA Complete 2
Tip The contents of the Selection Constraint dialog box depend on the types of components being constrained. A good practice is to pick-mask the component you wish to select, and then open the dialog box. Another is to make sure to click the Constrain Nothing button before you close this dialog box.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=719727175 (4 of 4) [11/27/2000 8:32:39 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Editing Polygons This section focuses on the tools for working with polygons. You have many options, ranging from moving polygon components to manually softening or hardening a polygon s edges. You can find the editing tools on various menus, including the Edit Polygons menu, the Tool Options submenu, the Booleans submenu, and the Normals submenu. Note The number of Polygon tools available has expanded considerably in Maya 2. Here, we cover the option settings for the functions you are likely to use most often. For information about the other functions option settings, consult the Maya documentation.
Moving Polygon Components You can move, rotate, and scale polygon components using the tools introduced in Part 1. Additionally, you can use the Move Component function on the Edit Polygons menu to translate, rotate, and scale the components. The Move Component function has a local mode and global mode. You can switch between these modes by clicking on the toggle handle, as shown below. In local mode, the Z axis is always pointing in the direction of the surface normal.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (1 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
Extruding and Duplicating Faces When working with faces, you can use the Duplicate Face and Extrude functions on the Polygons menu. The example below shows a sphere that has been extruded and smoothed (smoothing is discussed a bit later in this chapter).
With the Duplicate Face and Extrude functions, you can either keep the resulting faces together or have them remain separate by toggling Polygons Ø Tool Options Ø Keep Faces Together. Note that although the duplicated faces are discontinuous from the original faces, they are still components of one polygon object.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (2 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
You can use a face to create a hole in another face. The examples below were created by duplicating the face, then selecting Polygons Ø Make Hole Tool. With the default settings, the Make Hole tool creates an extrusion with the second face becoming a hole for the first. Alternatively, you can produce holed surfaces by selecting Merge settings in the option box. If you do not want to disturb the position of the original surface, set Merge to First.
To fill surfaces with unwanted holes, use the Fill Hole function on the Polygons menu. You must select edges around the hole before it can be filled.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (3 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
Performing Boolean Operations You can perform simple Boolean operations such as union, difference, and intersection on polygons at the object level. These functions are on the Polygons Ø Booleans submenu. They are simple functions that can aid you tremendously in working with polygons.
After a Boolean operation, the vertices may end up not matching well, requiring some cleanup. For example, in the Difference operation, the first picked object remains, minus the intersecting part. In the operation shown below, the torus ends up with some messy face topology at the intersection point, which will need to be cleaned up.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (4 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
Combining, Extracting, and Separating Polygons The Combine function on the Edit Polygons menu is similar to the Boolean union operation, but there are differences. The Combine function takes any collection of polygonal surfaces and turns them into one object, as the Boolean union does, but it does not trim away the unnecessary parts. As you also can see in the example shown below, the union surface seems to have more triangles than the combined surface. This is because the Boolean operation actually attaches the edges and vertices of the objects being unioned together, whereas the Combine operation leaves them unshared, or extracted.
Combining polygon objects is simple, but dividing one polygon object into separate objects is a bit more involved. Before any of the faces of the polygon object can become separate objects, they must be extracted to become different shells. Note An object that was created through the Combine operation already has extracted pieces. Thus, you can simply apply the Edit Polygons Ø Separate operation to undo the Combine action; you don t need to use Extract first.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (5 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
The Extract function, also on the Edit Polygons menu, does exactly what it says: It extracts the selected faces from their neighbors so that the edges and vertices of the extracted faces are no longer shared. Once a face is extracted, it becomes a separate shell inside the object, and the Edit Polygons Ø Separate operation can be applied.
Merging Vertices and Edges Merging is the opposite of extracting. Whereas the Extract function separates vertices and edges so that they are no longer shared, the Merge function makes them shared by faces. The Edit Polygons Ø Merge Vertices function merges vertices so that instead of there being several overlapping vertices at one point, only one vertex is shared by the edges. Often, you will not see any difference until you try moving the edges or faces, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (6 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
The Edit Polygons Ø Merge Edge function merges border edges. When you select the tool, the border edges become thicker. Click on the first edge, and then the second edge. Both edges turn orange. When you click again, the two edges merge. There are three Merge modes: "
With Middle, the default mode, the first and the second edge merge at the halfway point.
"
With the Merge mode set to First, the second edge snaps to the first edge.
"
With the Merge mode set to Second, the first edge snaps to the second edge.
After the merge, you are still in the Merge mode, and the tool asks for another first edge to be picked. You can also merge adjacent edges to clean up messy polygons or simplify edges. The Edit Polygons Ø Merge Multiple Edges function takes multiple edges and sews them together, as shown below. After you use Merge Multiple Edges, you can polish the results by using the Merge Edge tool.
Deleting and Collapsing Polygon Components Although deleting polygon parts is straightforward, there are a few things to keep in mind when deleting components:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (7 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
"
You can delete only corner vertices, or vertices that are joined by only two edges (called winged vertices).
"
You cannot delete border edges.
"
You can always delete faces. Warning When you delete an edge inside a surface, be sure the vertex of adjoining edges is not a winged vertex. If it is a winged vertex, then you should not delete it.
The Edit Polygons Ø Collapse function does not work like Delete. In contrast, Collapse allows you to collapse faces and edges so that the remaining vertices are shared, as illustrated below.
Subdividing and Splitting Polygons The Subdivide tool on the Edit Polygons menu allows you to automatically and evenly divide an edge or a face into equal parts. The default setting is Subdivision 1, which divides an edge into two edges or divides a face into four quads or triangles. If you are about to refine a rough polygon shape, subdivision provides you with a quick way of gaining more control elements. You can t subdivide faces with holes. In those cases, use Edit Polygons Ø Split Polygon Tool. In fact, the Split Polygon tool is probably one of the tools you ll use most frequently. With this tool, you can divide faces into smaller pieces. Note Do not confuse the Split Polygon tool with the Append To Polygon tool on the Polygons menu. The Append To Polygon tool creates faces at the outer edges of a surface, whereas the Split Polygon tool edits faces by dividing them into smaller pieces. You can insert vertices on edges, thereby splitting an edge into two, and insert edges on faces, thereby splitting the face. Let s see how this works: 1. Create a plane, zoom in from the top view, and select Edit Polygons Ø Split Polygon Tool. The surface is highlighted in green.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (8 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
2. Click on one of the inner edges, as shown below. A bright green dot appears on the edge. 3. Press Enter, pick-mask Vertex, and you ll see that a vertex has been added, splitting the edge into two. 4. Select the tool again, click on the opposite side, and click-drag to the point you first created. Press Enter, and the face splits into two.
You can set the Subdivision option for the Split Polygon tool so that with each click, it creates any number of vertices. This option is especially useful in situations where you want to create evenly distributed vertices, as shown in the lower image below. However, the Subdivision setting will not work if your second click is inside the face and not on another edge, as shown in the upper image below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (9 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
Warning When you want to place a vertex at the end of an edge, don t click on the endpoints of that edge. You may select the wrong edge that way. Instead, click on the middle of the edge you want and drag to the endpoint.
Smoothing and Sculpting Polygons Smoothing is a simple but indispensable function that you will use over and over again. The Smooth tool on the Edit Polygons menu subdivides a surface, or selected faces of a surface, according to the division setting in the option box (the default setting is 1) to create as smooth a surface as its division setting will allow. It always produces quads, and you should generally leave the subdivision setting at the default. If you are going to apply Smooth more than once, you usually want to tweak the surface before applying it again. The Sculpt Polygons tool, or Artisan, on the Edit Polygons menu is also especially useful in polygonal modeling. It can save you hours of pulling and pushing vertices on dense surfaces with just several brush strokes. See Chapter 9 for more information about using the Artisan tools.
Reverse and Soften/Harden A surface needs to have all its normals on the same side. When you re working with various polygons, separating and attaching them, you may find that normals on a surface have become inconsistent. The Reverse function, found on the Edit Polygons Ø Normals submenu, reverses the front and back sides of the selected faces, reversing their normal direction as well. The Reverse and Propagate function is the same as the Reverse function, except that it not only reverses the normal of a selected face, it also propagates to other faces, reversing their normals as well if they are facing the same side of the surface as the first selected face. Soften/Harden, another function found on the Normals submenu, can manually determine if a polygon s edge is to be hard (edgy and sharp) or soft (smooth and rounded). Let s try out this tool: 1. Create a polygon sphere and set its subdivisions to 10.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (10 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
2. Select Display Ø Custom Polygon Display Ø. In its dialog box, turn on both Vertex Normal and Face Normal. 3. Zoom in to look closely at the vertices of the sphere in Shaded mode. You should see normals, as shown below.
4. It may appear messy, but if you look carefully, you can see that each vertex has four normals coming out of it, with each vertex normal in parallel to its corresponding face normal. Pick-mask Edge and select the upper half of the sphere. 5. With the upper sphere s edges still selected, select Edit Polygon Ø Normals Ø Soften/Harden Ø. 6. Click the All Soft (180) button, then the Soft/Hard button. The upper half of the sphere now has only one vertex normal coming out, which is not parallel to any of the face normals, as shown below. The other vertex normals are deleted because the edges are now soft edges. Note that the upper half of the sphere is rendered smoothly as well.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (11 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
7. Open the Attribute Editor for the sphere and go to the tab called polySoftEdge1. 8. Open the Poly Soft Edge History. You ll see the Angle slider set at 180. Try moving the Angle slider down. From around 35 degrees and lower, you should see the deleted vertex normals popping back in, and the edges becoming hard edges again.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=378935742 (12 of 12) [11/27/2000 8:32:56 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Mapping Textures As with NURBS surfaces, textures are mapped to polygon surfaces parametrically, with UV values. But UVs are not an intrinsic part of a polygonal surface. They must be mapped. A polygonal surface can acquire UV values through various types of projection mapping, normalization, or unitization. The best way to explain all this and the other tools you need to use for texturing is to step through some examples, which is what we ll do here. Note This section requires some familiarity with Hypershade. You may want to read through Using Hypershade in Chapter 19 first.
Working in Texture View The Texture View window allows you to view how UVs are mapped to a polygonal surface. The bright green selected UV dots in the modeling window become yellow dots in texture view, and the shapes shown are flat 2D representations of UVs being mapped to faces. You can copy and paste UVs, as well as access the texture-editing functions in the Texture submenu. You can also pick-mask to select vertices, edges, faces, and UVs of the polygon represented in the view. First, let s create a polygon to work with in the Texture View window. 1. Start a new scene and select Edit Polygons Ø Texture Ø Texture View. 2. Select Polygons Ø Create Polygon Tool Ø. Make sure that the Texture option is set to Normalize. 3. Go to top view and create a triangle, as shown below. Press Enter to complete the action, and you will see the triangle appear in the Texture View window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (1 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
4. Create a blinn shader in Hypershade, assign a diagonal ramp to it, and assign the shader to the triangle. 5. Press number 6 to get into Textured Display mode and select the triangle again. Your display should look something like the one shown below. Note that the triangle fits the texture horizontally, which represents U parameterization from 0 to 1. Normalized texture maps to the surface in this manner.
Note You ll find the image above and the following series of images in the Color Gallery on the CD. Tip It s a good idea to keep the Texture View window open when you are working with polygon textures. Most of the Texture submenu options can be accessed from inside this view, and we will be using it constantly in this section.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (2 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
In the Texture View window, the texture image repeats according to the settings in Image Range; the default is 10 repetitions. You may find the repetitions a bit disorienting at first, but it s better to have it repeat than to have it show just once. If you find the default grid setting distracting, you can turn it off or change its display setting. You can transform UVs in the Texture View window in the same way that you transform regular vertices. If the selected faces have a projection mapping, you can edit the Mapping manipulator as well.
Transforming UVs We ll continue and transform the UVs. 1. In the Texture View window, select the UVs and select the Move tool. A 2D Move manipulator appears. Move the manipulator, and you will see the texture in the triangular face update. 2. Select the Rotate tool, and a 2D Rotate manipulator appears. Rotate the UVs, and the texture inside the triangle updates accordingly.
3. Append a quad to the triangle. 4. Open the Append To Polygon Tool option box, turn off Ensure Planarity, and set Texture to Normalize. 5. Select the right edge, then switch to side view and click the vertices up so that you end up with a diagonal face, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (3 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
When it becomes part of the surface, the ramp texture is automatically assigned. As the texture map is normalized, it is mapped to the diagonal face horizontally, from 0 to 1.
Sewing Textures In our example, although the faces are attached to each other with shared edges and vertices, the UVs are mapped separately. If you want to have the two faces share the texture mapping, you can sew the textures. But first, let s position the textures properly. 1. In the modeling window, select the UVs on the edge that joins the faces. 2. In the Texture View window, take note of which two UVs of the triangle and the diagonal face are selected. Select all the UVs of the diagonal face, then rotate and translate them so that the two UVs of the triangle and the diagonal face are next to each other, as shown below.
3. Select the common edge of the two faces. Then in the Texture View window, select Edit Ø Sew Texture. The UVs of the triangle and the diagonal face snap to each other and become shared UVs.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (4 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
Note The Edit Ø Cut Texture option performs the opposite function. It takes shared UVs and separates them, creating two new UVs per edge.
Unitizing UVs Now let s see what happens when we unitize our polygonal surface. 1. Open the Append To Polygon Tool option box. Set Texture to Unitize and turn on Ensure Planarity. 2. In perspective view, select the longest edge of the triangle. When you see pink arrows, click on the nearest edge of the diagonal face. 3. In front view, click a vertex straight up to the diagonal face s height. The new face is planar, and it should look something like the image shown below. The Unitized setting stretches the UVs for the new face to fit the texture UV unit.
4. Repeat the sewing procedure: Rotate and translate the unitized UVs to line up to the triangle and sew it. You should see something like the image shown under step 2 in the next section. Notice that now there is a smooth texture transition from the triangle to the unitized face.
Assigning UVs From time to time, you will encounter models imported from other programs that carry no UV information with them. You will need to assign UV values to these surfaces, following a procedure like the one outlined here. 1. Open the Append To Polygon Tool option box again if you ve closed it. Set Texture to None. 2. Select the top edge of the unitized face. When you see the arrows, select the top edge of the diagonal face. Press Enter to create a triangle, as shown next. Although it is part of the polygonal surface, this new triangle has no UV information, and therefore no texture is displayed. Note that nothing new appears in the Texture View window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (5 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
3. Select the face of the new triangle. Open the Normalize UVs option box from the Texture submenu or the Edit menu in the Texture View window. The default setting will make the triangle stretch from 0 to 1 in both U and V, which is not what we want. 4. Select Preserve Aspect Ratio, and it will normalize only one of the two values, in this case, U. Click on Apply, and texture appears on the new triangle as well as in its normalized UV points in the Texture View window. 5. Sew the new texture to the diagonal face by rotating and translating the new triangle. You should see the UVs connected, as shown below.
Projection Mapping Maya has three types of projection mapping functions available from the Texture submenu: Planar, Cylindrical, and Spherical Mapping. There is also a Create UVs Based on Camera function, which creates UV values of a planar mapping projected from the camera view. Let s try out the planar mapping. 1. Start a new scene and create a polygonal cube. With the cube still selected, open the Texture View window. You should see the cube UVs laid out as shown below. The default setting for the cube normalizes UVs so that they are all connected for the whole object.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (6 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
2. Rotate the cube in the Z axis 45 degrees. Then select its front face. Make sure that the Assign Shader to Each Projection function on the Texture submenu is checked, and apply Planar Mapping with the default settings. The Assign Shader to Each Projection setting automatically creates a default polygon shader with a checker texture and assigns it to the selected polygon. The default planar projection fits the texture to the bounding box of the selected object or face, and projects the map along the Z axis. 3. The black and white checker colors are too intense for viewing in the Texture View window. In Hypershade, select the checker texture and assign dull blue to one color and green to the other. Note how the UV points are mapped as a square rotated 45 degrees in the Texture View window. 4. Select the cube. If you don t see the texture showing in the Texture View window, as shown below, select Image Ø Selected Images Ø texturedFacets pCube1.
Warning Do not confuse projection mappings for polygons with the projections for NURBS. When creating textures for polygons in Hypershade, use the Normal setting. If you need to create a texture as a projection, the Interactive Placement button should be used only for NURBS, not polygons.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (7 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
An example of a situation where mapping would be a bit harder is if we selected the face at the top and rotated it in the Y and X axes to make it near vertical and diagonal, as shown next. If we apply the default planar mapping, we get stretched UVs (as in the top-left image). Note how the UVs are stretched in the Texture View window as well. If we set the option to Y-axis projection, again the result is not what we want (as in the top-right image). We could grab the manipulator handle and rotate and scale until the texture fits the surface straight, but that takes effort. Instead, we can set the option to Fit to Best Plane. The projection will project in the direction of the surface normal, and as a result, we get a perfect fit (as in the bottom-left image). Another option is to apply planar mapping with camera direction (as in bottom-right image). For this example, the cube was selected as object, so all the UVs are mapped exactly as the UVs you see through the camera in the modeling window.
The Cylindrical and Spherical Mapping options are similar in principle to planar mapping, and they are simpler to apply. Often, the shape of the polygonal object will dictate which type of mapping is best suited for it. See the examples below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (8 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=471167698 (9 of 9) [11/27/2000 8:33:09 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-on Maya: Building a Hand It s time to practice using the tools and actions we ve covered in this chapter. Let s build a polygon hand. Hands are usually built as polygons because it s difficult to create a NURBS hand that is not heavy and at the same time deforms well. Note In this tutorial, we will use some tools that haven t been covered yet in this book. You are encouraged to look ahead for more information about those tools, as well as to infer things from looking at the pictures.
Building the Rough Hand We begin by building the rough hand, starting with a poly cube. 1. Start a new scene. Create a poly cube. Select a face on the X axis and extrude it four times. Scale it until you see something like the image shown below. Delete the faces at the back side.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (1 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
2. Select Polygons Ø Tool Options and turn off Keep Faces Together. Select the four front faces and extrude them three times, as shown next. These will be the fingers. As you are extruding, scale the faces down a bit each time to taper them. At every point, you should be tweaking the vertices to try to form a rough hand shape. For example, try to roughly round the wrist area at the back. Tip Turn on the Backface Culling options Keep Wire setting. This will help you to avoid accidentally selecting vertices or faces at the back side of the hand.
3. Push back the pinky finger, pulling it away from the ring finger to the side, and pull the middle finger out a bit. You can select faces to do this; however, in this situation, moving vertices seems to work best. Push up the two vertices where the knuckles should be.
Creating the Thumb Building the thumb is one of the trickiest things you ll do in this tutorial. We ll use the Split Polygon tool to create the shape. 1. On the left side of the hand, draw two edges using Edit Polygons Ø Split Polygon Tool. Next, at the bottom (the palm of the hand), draw four more edges. Pull out the vertex at the side and the one at the bottom beside it, then pull them down. Select the face that sticks out with the vertices, and extrude it twice, turning and scaling it as you do. See the next graphic for guidance. This is going to be the thumb. Save the file as hand_one. (Maya will append a .mb extension automatically.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (2 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
2. Add two lines of edges going around the hand using the Split Polygon tool. Use the tool to place extra faces around where the thumb bends into the hand, and move the triangular face further into the palm. 3. For the wrist, select the border edges, apply Polygons Ø Fill Hole to create an n-sided face, select it, and then extrude the face at the back, as shown next. After you extrude it, delete the face again. Tip Keep the faces you are creating limited to quads and triangles. They should also run smoothly along set lines and not be placed haphazardly.
4. Scale out the hand to make it wider. Bend the fingers straight down, and bend the thumb into the palm at an angle, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (3 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
5. A lot of history has accumulated on the hand by now. Delete the history from the object and save the scene as hand_two.mb.
Creating a Procedural Connection The rough hand is now ready for smoothing. Once smoothing is applied, however, the hand becomes more difficult to shape because there are a lot more vertices to deal with. To make things easier, we ll use the rough hand as a lattice around the smoothed hand. 1. Make a copy of the hand and scale it up a bit. We ll call this the rough hand and call the original one the smooth hand (it isn t yet, but it soon will be). 2. Using Hypershade, assign a material to the rough hand, and make it totally transparent. In the Shaded mode, the rough hand should still display as a wireframe, as shown below.
3. Select Window Ø Connection Editor. Select the rough hand, press the down arrow key to select its Shape node, and load it to the Outputs window by clicking the Reload Left button. Load the smooth hand s Shape node to the Inputs window the same way.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (4 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
4. Scroll down in the left window until you find World Mesh[0] and select it. Scroll down in the right window until you find In Mesh and select it. Both attributes become italicized, as shown next. When you select the rough hand, the smooth hand turns pink to show that the hands are procedurally connected.
5. Select and move some vertices on the rough hand, and the smooth hand should deform along with the rough hand. Note that you can also move the smooth hand s vertices independently. Save the scene as hand_three.mb.
Smoothing, Layering, and Rough Tweaking Now we need to smooth and tweak the hand. We will need to do this in two stages, beginning with applying Smooth and fixing some problems. 1. Select the smooth hand and apply Edit Polygons Ø Smooth to it with the default setting. Some things immediately stand out as needing improvement, such as consistency in the width and the direction of the fingers. We need to fix these problems before we can apply Smooth again. 2. Before we start to tweak, let s put the smooth hand and the rough hand on different layers. Once the smooth hand is in a layer, select the Reference setting for the layer. The Template setting will only display the hand as a wireframe, but the Reference setting will display the hand in Shaded mode, while still disabling it from being selected. 3. Tweak the rough hand until you are comfortable with the shape it has created in the smooth hand, as shown next. You can hide the rough hand for now, and move back to the smooth hand by switching from Reference to Standard in the Layer menu.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (5 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
Fine Tweaking, Smoothing, and Applying Artisan Now we will do some tweaking to prepare the hand for another smoothing. We will also be using the Sculpt Polygons tool to get more surface definition and smooth out any unwanted creases. 1. Place vertices around the fingers and the thumb where the joints will bend. Think ahead to how another edge line will be placed in between every line with the second Smooth. The area between the fingers needs to have a bit more space, and the knuckles should stick out more as well. (Don t worry too much about creating hard edges or creases at this point.)
2. The thumb area needs special attention. Get rid of the extra edges, as shown below. Make sure that there are no winged vertices left behind. If you need to make adjustments that require moving a whole area, use the rough hand. Save the scene as hand_four.mb.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (6 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
3. Apply Smooth one more time. At this point, the density of the surface calls out for the Sculpt Polygon tool. But such areas as the finger joints and fingernails should still be modified by selecting vertices. Notice the vertex placements around the finger joint areas and fingernails shown below.
4. Using Edit Polygons Ø Sculpt Polygon Tool, start pushing and pulling to get more definition for the hand, especially the palm, the knuckles, and the wrist area. Smooth out where the thumb joins the hand as well. If you want to build a more mature-looking hand, you can try making the bones protrude along the back of the hand, and put more space between the fingers. Tip Change the Radius setting according to the specific area you are sculpting, and always set the Opacity low. It may be frustrating to need to click many times, but retaining control of the tool you are using is important.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (7 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
The hand model is pretty much finished at this point. The hand will be used in the child model we will be building in upcoming chapters, so save the file as child_hand.mb.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=710375832 (8 of 8) [11/27/2000 8:33:22 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 7 - Polygon Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, you learned what polygons are, how to create them, and work with them in Maya, and how to texture-map them using the Texture View window. We went through an advanced tutorial, building a polygon hand, which we will use for the child model later in the book. In the next chapter, we will explore NURBS (patch modeling). We will build a dog model in NURBS patches, covering some advanced modeling concepts as we go.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=746173350 [11/27/2000 8:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 8: Organic Modeling Overview: This is a fun chapter. Rather than making you read through discussions of the various organic modeling procedures, we will work through a project. This is a real-life project in which we will build a dog from scratch to finish. A hands-on exercise is the best way to get down to the nitty-gritty details of organic modeling. At the same time, this is a difficult chapter. The time required to build this model will vary depending on your skill level and familiarity with organic modeling, but you probably won t be able to build the whole dog in one session. It is also important to keep in mind that you are not producing a work of art at this point. Spend time learning the tools and techniques of organic modeling, but don t dwell too long on tweaking CVs! (And you can always use the prepared model found on the accompanying CD instead of building it from scratch.) One last reminder. As with any real-life projects, things can get pretty messy as you work your way through this chapter. It is important for you to practice good work habits. Save your work often. Name things carefully. Take regular breaks to clear your head. Always ask why you are doing what you are doing, instead of blindly working through the steps of the project. You will learn much more that way.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=561956898 [11/27/2000 8:33:32 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Laying the Groundwork Start with a Sketch One of the worst ways to start your modeling process is to plunge in without having any idea of how you want your model to look. Such an approach will make your work sloppy and waste a lot of valuable time. Usually, the resulting model will not look as good as if it had good 2D references. The best way to start is to actually sketch your model if you can. This approach encourages you to be aware of the parts you need to create and to think of ways to build them. For this example, we need to know what the dog will look like. We ll start with a sketch of a puppy, which is based on several pictures of various dogs. As long as the body proportions and the bone structures remain similar, the sketch should be sufficient for our purposes. For our project, we will use this sketch as a background image.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=329822333 (1 of 2) [11/27/2000 8:33:36 PM]
Books24x7 Mastering MAYA Complete 2
The next thing we need to know is what this dog is going to be doing. Let s say the dog will be walking or running, so we only need to concern ourselves with the movements of the dog related to those specific actions (walking and running are fairly easy to set up). If the dog were to move in other, more complicated ways, such as sitting or rolling on the ground, then we would need to test the dog to account for those movements as well. Note In studio productions, the models are not considered complete until they have gone through many extreme poses to test their suitability for animation. The designer may need to modify the model if it fails to hold its shape under certain extreme poses at the testing stage. In some cases, different versions of the model may be required for different animation situations.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=329822333 (2 of 2) [11/27/2000 8:33:36 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Building the Head and Body Let s start at the top, with the head and body. To keep things a bit simpler, we will not build eyelids or a mouth for our puppy. 1. Create a new scene and go to side view. To bring in the image of the dog from the accompanying CD, select View Ø Camera Attribute Editor Ø Environment and click the Image Plane Create button. You can use the Image Name field to browse for the image puppy_sketch.tif on the CD. 2. Create a sphere, rotate it 90 degrees in the X axis, and scale it out. Go to the Channel box, open makeNurbSphere1, and set Sections to 10 and Spans to 20. Translate the sphere to about where the puppy s body is, as shown below.
Tip If you find the image plane too bright, you can darken the picture by lowering the Color Gain setting in the Image Plane Attributes section of the Attribute Editor. 3. Pick-mask the sphere s CVs or hulls and transform them using translate, rotate, and scale procedures to get the same profile form as the dog in the picture. Space the isoparms as shown and explained below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=475607562 (1 of 3) [11/27/2000 8:33:41 PM]
Books24x7 Mastering MAYA Complete 2
The Face Two rows of CVs should do for the nose area, because we will place a sphere for the nose later. Also, since we are not including eyelids or a mouth, we can use a minimum number of isoparms for the face three rows of CVs will do. The Body Use three rows of CVs for the back of the head and the neck, and three more for the chest area. Use one row for the stomach area, and three rows for the back leg area. Note that the stomach shape is actually created by three rows of CVs; the row for the stomach area works together with the last row of the chest area and the beginning row of the back leg area. The Tail Two rows tie the tail to the back of the torso, and two more make the tail curve tightly towards the end. The last three rows shape the endpoint of the tail one more than we need. Select the third row of CVs from the end of the tail and press the Delete key to remove it. Scale the last two rows out to fit the profile of the tail. 4. Switch to a two-view layout by selecting Window Ø View Arrangement Ø 2 Side by Side (you can also use the marking menu and select Panels Ø Layouts Ø 2 Side by Side). Make one window perspective view and the other top view. 5. Select hulls again, and scale the CVs in the X axis to make the shape look more like a puppy. You can scale in the Y or Z axis as well, to fine tune the profile shape. You can hide the camera for the perspective view by turning off Show Ø Cameras. You should end with something like the shape shown below. Tip Use the arrow keys to go up and down the UV parameters with the selection of CVs. This technique is especially useful when you are selecting hulls.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=475607562 (2 of 3) [11/27/2000 8:33:41 PM]
Books24x7 Mastering MAYA Complete 2
How Many CVs Do You Need? As you are building your model, you should always be asking yourself how many CVs you need to get the shape you want. In answering that question, there is one simple rule: It takes three CVs to curve a line. It follows that only three rows of CVs are needed to curve a surface. When you study models with this rule in mind, it may surprise you to see how often unnecessary isoparms are placed for simple curvatures on surfaces. You might want to add one more row to tie the curve, making it very tight and edgy. Another way to tighten a curve is to increase the CV weights, instead of adding more CVs. The only drawback to this technique is that sometimes the weight information gets lost when models are transferred to other programs. Be a minimalist when you are starting out. The fewer CVs you have, the easier it is to control the surface area. You can easily insert more isoparms later to refine your model, but it is more difficult to get rid of them without disturbing what you ve already built. Having fewer CVs also lets you concentrate on the big blocks of the model you are creating and ignore the details, which is considered good form in drawing and sculpting.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=475607562 (3 of 3) [11/27/2000 8:33:41 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Cutting Up the Body Things are going to get a bit more complicated from here on. We need to make holes for the legs, which means we need to cut the body into pieces. But first, we need to put in more isoparms in select places for smoother stitching later on.
Selecting and Inserting Isoparms To insert isoparms, you need to select existing isoparms and specify where you want to put the new ones. 1. In perspective view, select the Select tool from the Minibar. Pick-mask Isoparm and click on the first vertical isoparm going around the nose area. In the Feedback line (above the Layer bar), you should read U Isoparm 19.000. When you select the next isoparm, it should say U Isoparm 18.000, and so on. 2. Click on the horizontal isoparm around the eye level. You should see V Isoparm 9.000 in the Feedback line. The isoparm around the mouth level should be V Isoparm 1.000, and so on. If your isoparms show opposite numbers, such as 1.000 in place of 19.000, you can reverse the parameter values by selecting Edit Surfaces Ø Reverse Surface Direction Ø, setting the Surface Direction to V, and then clicking the Reverse button. Tip When selecting isoparms, if the number ends neatly, such as 1.000 or 1.25, it usually means you have selected the proper isoparm. If the number ends not so neatly, such as 9.01 or 15.476, it usually means you ve missed the isoparm. One way to be sure is to select any U or V isoparm near the isoparm you want, then enter the exact value for the isoparm in the numeric input field in the right corner of the Feedback line section. 3. Shift+click U isoparms 13, 12, and 11. Then choose Edit Surfaces Ø Insert Isoparms Ø, select Between Selections, and click Insert. You should see two U isoparms inserted: 12.5 and 11.5. 4. Repeat the procedure for V isoparms 7 and 8 to insert an isoparm 7.5. 5. Insert three isoparms between V isoparms 2 and 3 to get 2.25, 2.5, and 2.75. The inserted isoparms should be placed as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=475027557 (1 of 3) [11/27/2000 8:33:48 PM]
Books24x7 Mastering MAYA Complete 2
Dividing the Surface into Patch Regions Now we re going to cut the puppy into pieces. Yes, this seems cruel, but it will help us a great deal in reducing the amount of work we need to do. 1. Select the V isoparms 2.5 and 7.5, then choose Edit Surfaces Ø Detach Surfaces. Delete the right half. The image should look like the one shown below.
2. Select V isoparms 2.375 (or it may be 3.375 depending on the way you cut your surface) and 1.875 and choose Edit Surfaces Ø Detach Surfaces again to detach those areas. Now there are three pieces. We need to divide these into 15 separate regions. 3. Select the U isoparms 12.5, 11.5, 9, and 7 along the three pieces and detach them. You may want to do this in several steps. Get rid of the patches where the legs will be. We end up with two holes and 13 patches.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=475027557 (2 of 3) [11/27/2000 8:33:48 PM]
Books24x7 Mastering MAYA Complete 2
4. This is a good place to pause and clean up. Group the 13 pieces and name them if you wish. If you haven t saved the file yet, do so now. While you are in the middle of building a model, the naming of objects and their groupings are simply for your own convenience, and they don t need to be organized too carefully. The scene name, however, should be indicative of what you ve done, such as Dog_13pieces, or of where you are in the modeling stage, such as Dog_model_1. Tip It is simplest to rename objects in the Outliner. Just double-click the node and type in the name. When you are naming a series of nodes, such as obj1, obj2, obj3, and so on, you can also copy one name and paste it repeatedly the numbers will be updated automatically. After you ve cut up the surface, the smaller patches retain the parameter values they had before they were detached. They must be parameterized again using Rebuild Surfaces before you can apply stitching. If you don t do this, the results will be unpredictable. We will take care of this a little later in the chapter, in the Rebuilding the Parameters section.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=475027557 (3 of 3) [11/27/2000 8:33:48 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Building the Legs Because we are dealing with only half of the puppy s body, we need to come up with just one front leg and one back leg. Later, we ll duplicate these to add the other two legs. Note that we re deliberately keeping the paws simple. 1. Create a layer, name it something like Dog Body, and assign the 13 patches to it. We can hide them or turn them into templated objects later when we are working with the legs. 2. Create a sphere and set its spans to 20. Detach it in the middle to get a half sphere with 10 spans. Delete the top half. Use move, rotate, and scale procedures to transform the bottom half to the position shown below.
3. Select hulls and build the leg in side view (in the same way that we built the profile of the dog s body). Note the way that the rows of CVs are distributed in the side view shown below. Then scale the leg to the proper size in the X axis in the perspective view or the front view.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=332193075 (1 of 3) [11/27/2000 8:33:54 PM]
Books24x7 Mastering MAYA Complete 2
4. Move the leg to where it should be on the dog, a bit to the side, and tweak the CVs to place the top opening of the leg near where the hole is on the dog s body, as shown on the next page. It is important to try to place the two spans of the leg geometry next to the two spans of the hole on each side. This may be frustrating, but you actually must guess how well the leg is being positioned for stitching with the body pieces. Keep in mind that after you gain some experience, your guesses will become more accurate.
Tip By now, you should be aware that typing in numbers to position items is often not possible when you are building models. Organic modeling is fun and frustrating at the same time because you need to trust your artistic senses more and start guesstimating, as opposed to being precise. Guessing is not being sloppy. It is doing things roughly now, knowing that you will tweak later. 5. Create a layer and name it Dog Legs. Assign the front leg to it and turn off its visibility.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=332193075 (2 of 3) [11/27/2000 8:33:54 PM]
Books24x7 Mastering MAYA Complete 2
6. Build the back leg the same way you created the front leg. Ten spans of isoparms are enough. You now should have something similar to the illustration shown at the top of the next page. Notice how the isoparms are placed around the joints as you are moving the hulls and the CVs. Also, the top end of the back leg is a bit higher and to the back than the hole on the body. This was done intentionally in preparation for stitching.
7. As a final step, we need to cut the legs into four pieces. Select V isoparms 1, 3, 5, and 7 and detach them. For both the front and the back legs, the isoparm values should be the same. Group them accordingly, name them, and assign them to the Dog_Legs layer.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=332193075 (3 of 3) [11/27/2000 8:33:54 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Rebuilding the Parameters Now that we have the patches all built, we are almost ready to stitch them together. However, first we need to rebuild the parameters. Currently, the smaller patches still have the same parameter values they had before they were detached. We need to reparameterize so that we can have the proper calculations between the patches for stitching. 1. Select Edit Surfaces Ø Rebuild Surfaces and make sure the setting is as below. The Keep CVs box should be checked. Don t close this dialog box.
2. In the modeling window, press Ctrl+A to open the Attribute Editor. Select the top patch of the dog s head, and look at the Nurbs Surface History of the geometry. In the Spans UV fields, the values are 8 and 3, but the Min Max Range for U and V have different numbers. We need to reparameterize the patch to get the Max Range numbers to match the Span values (or go from 0 to 1, which is another optional setting in the Rebuild Surface Options dialog box).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=607426184 (1 of 2) [11/27/2000 8:33:58 PM]
Books24x7 Mastering MAYA Complete 2
3. Select all the geometry pieces in the modeling window and click Rebuild. You should see very slight changes in the isoparm placements. Although the changes may seems insignificant, they are necessary for proper calculations between the patches to take place. Select the dog s top head patch again. The Max numbers for UV should now match the corresponding Span values.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=607426184 (2 of 2) [11/27/2000 8:33:58 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Stitching the Puppy Now we re ready to stitch the puppy. However, before we continue, let s take a brief break from building the model and see how stitching works in Maya.
Stitching Basics Maya has three different types of stitching available from the Edit Surfaces Ø Stitches submenu: Stitch Surface Points, Stitch Edges Tool, and Global Stitch. We will use the Stitch Edges tool to put together the different parts of the dog and continue to shape its body, and then use the Global Stitch function to keep the patches seamless.
Stitching Surface Points Stitch Surface Points is a simple tool used to join CV points from different surfaces. To use this type of stitching, select one CV you want to stitch from each of the surfaces and apply Stitch Surface Points. The points should snap together, meeting each other halfway as shown on the left side of the picture below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511783367 (1 of 6) [11/27/2000 8:34:12 PM]
Books24x7 Mastering MAYA Complete 2
Another way to use Stitch Surface Points is to open its option box and turn off the Assign Equal Weights setting. Then when you select CVs and apply the stitching, the first point will stay where it is, and the other points will snap to the first point, as on the right side of the picture above. The points in this setting are said to be in a master-slave relationship. The point that does not move is the master, and the points that move are the slaves.
Stitching Edges The Stitch Edges tool is used to join two surface edges together. The default setting joins the edges in a master-slave relationship. When you open the option box for this tool, you will see that Weighting Factor On Edge1 is set to 1 and Weighting Factor On Edge2 is set to 0. This means the first edge isoparm you picked will not move, and the second edge isoparm you picked will snap to the first edge, as on the top right of the picture shown on the next page. If you want to apply equal weighting for both edges so that they will both move to meet in the middle, adjust the Weighting Factor settings to 0.5 for both edges. The edges will then meet halfway, as in the picture below on the bottom right.
Global Stitching Global Stitch is a new addition in Maya 2. This function can stitch all of the edges of adjacent surfaces together. It automatically gives all the surface edges being stitched equal weights. Note For both the Stitch Edges tool and the Global Stitch function, you have the option of maintaining C0 continuity or C1 continuity, also known as tangent continuity, between the stitched edges. See Chapter 6 for more information about the degrees of continuity.
Stitching between Two Edges Now it s time to put the pieces of the dog together into a seamless whole. For the following procedures, you may want to get into the wireframe or the x-ray viewing mode, because either of these modes makes it easier to pick isoparms. To switch to the x-ray viewing mode, go to the modeling window and select Shading Ø Shade Options Ø X-Ray. First, we ll attach the legs to the dog s body by stitching the leg edges.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511783367 (2 of 6) [11/27/2000 8:34:12 PM]
Books24x7 Mastering MAYA Complete 2
1. In perspective view, select the front leg and press the F key to center the geometry so that you can rotate around it. Select Edit Surfaces Ø Stitch Ø Stitch Edges Tool Ø and click the Reset Tool button to make sure you re using the default settings. Then check the Tangent setting and close the option box. 2. Select the top-edge isoparm (it s also called a surface boundary isoparm) of the leg patch. Then select the patch edge located at the top side of the hole. The patch edge should snap to the leg patch, and the two patches should turn bright green. (You don t need to press Enter to complete the stitching process at this point.)
3. Go to the next boundary isoparm of the leg and repeat the stitching with the side edge of the hole. 4. Repeat the process with the next two edges. You should have a cross shape of green patches coming out from the body to the leg patches, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511783367 (3 of 6) [11/27/2000 8:34:12 PM]
Books24x7 Mastering MAYA Complete 2
5. Press Enter to complete the action. Tip In addition to pressing Enter to complete the stitching action, you can press any of the tool hotkeys, such as the Q key for the selection mode. To repeat the stitch action, press the Y key. 6. Repeat the procedure with the back leg, as shown below. Make sure to select the leg boundary isoparm first and the body boundary isoparm second because the order of selection determines the master-slave relationship. The slave edge snaps to the master edge, and it is important that the leg patches function as master edges.
Stitching the Corners So far, we ve stitched seven body patches to the legs. There are still six corner patches that need to be stitched. Let s try stitching one of the head patches as an example. 1. To stitch the top patch of the dog s head to the adjacent patches, select Edit Surfaces Ø Stitch Ø Stitch Edges Tool (leave the default settings). Select the boundary edge of one of the adjacent patches, and then select the edge of the head patch, as shown on the left side of the image on the next page. Complete the action by pressing Enter. Then repeat the procedure with the other adjoining patch as shown on the right. Even though the head patch may look like it is lined up after the first stitching, you still need to stitch it to the second adjacent patch to make sure that the patches are lined up properly.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511783367 (4 of 6) [11/27/2000 8:34:12 PM]
Books24x7 Mastering MAYA Complete 2
2. Repeat the procedure to stitch the corners on the other five patches. Below is an example of one of the patches that must be stitched three times. The patch represented as number 2 needs to be stitched to three other number 1 patches. Pick the number 1 patch boundary isoparms first each time, and then select the boundary isoparm of the number 2 patch being stitched.
Tweaking the Stitched Surfaces When you look at the final stitched surface in shaded mode, you will probably notice creases. The places where the creases occur and their severity will vary with how you ve built your own model. The one we ve built so far should look similar to the model shown below. Unfortunately, there is no easy way to get rid of these creases.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511783367 (5 of 6) [11/27/2000 8:34:12 PM]
Books24x7 Mastering MAYA Complete 2
In the case of where the stomach meets the back leg, the isoparm has actually folded (as shown on the right side above). In such situations, you need to tweak the CVs of the master edges (the leg patches in our example) to get rid of the creases. Shown on the next page are some of the ways CVs have been pulled and rotated to correct the problems. Note that where the two edges are being joined as in the top-left picture, you must move the four CVs on each of the patches, eight CVs in all, together in order to maintain their tangency. When you move the CVs on the master edges, the slave edges will follow to keep the tangent continuity between the surfaces.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=511783367 (6 of 6) [11/27/2000 8:34:12 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Building the Face In contrast to the elaborate modeling that went into building the body, we ll keep the dog s face simple. Use spheres for the eyes, nose, and ears, as shown below.
Place the eye and the nose in the appropriate positions, and pull in a couple of the CVs on the head to make room for the eye (but don t touch the two end CVs along the boundaries). You can create the ear by deforming the hulls of another sphere with six spans.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=894445525 [11/27/2000 8:34:19 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Mirroring and Attaching the Model Mirroring is a common modeling technique. As its name implies, mirroring duplicates the selected items as a mirror image of the original items along a selected axis. We will use mirroring to duplicate the right half of the puppy. 1. Select all the objects in the modeling window except for the nose. Group them. Select Edit Ø Duplicate Ø, set Scale X to 1, and click Duplicate. You should have a mirrored group of objects. 2. You now see the whole model of the dog. Before you attach the middle patches, make sure you like what you see. Are the body parts proportional? Are the legs too close or too far apart? If you want to modify any parts of the dog, undo the duplication and make the necessary changes before continuing. 3. When you are satisfied with the way everything is, select the edge isoparms of all the patches that meet at the middle, or the Y axis, and attach them using the default settings. You should end up with ten attached pieces making up the profile of the puppy. In the picture of the final model of the puppy, shown below, notice that the left side patches are still stitched together, while the right side patches are not. This is fine, because we no longer need the stitches.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=800165235 (1 of 2) [11/27/2000 8:34:22 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=800165235 (2 of 2) [11/27/2000 8:34:22 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Cleaning Up the Model Now we can clean up our model by deleting the history and the transformation information. We can also group the model parts. 1. Select all the patches in the modeling window and select Edit Ø Delete By Type Ø History. 2. Select Modify Ø Freeze Transformations. Note In our particular project, the history and the transformation information of the patches are no longer needed, so we can delete them. However, in other situations, this information may be important. Of course, this depends on the application of whatever command was used to create the history or the transformation information. So, you ll need to decide whether to delete or retain this information on a case-by-case basis. 3. Group the legs and name them. Give the group nodes sensible names, such as Front_Legs, or L_frontleg. You may not feel you need to name the leaf nodes; however, it is a good idea to rename everything, rather than leaving a node named something like leg33detachedSurface2detachedSurface2. 4. Group the body and the face, renaming them appropriately. 5. Put the face and body pieces into the Dog_Body layer. Put the leg pieces into the Dog_Legs layer.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=380503205 [11/27/2000 8:34:26 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Global Stitching Finally, there s the matter of global stitching, a new surface-editing feature in Maya 2. Unlike regular stitching, global stitching doesn t have master-slave distinction; all the pieces are held together with equal weight. When we were building the model, we didn t use this stitching method because we needed the control provided by the regular stitch, namely the master-slave relationship of the edges being stitched. Now that the model is put together seamlessly with first-order continuity (C1) among the patches, we can easily stitch all the pieces together with one command. 1. Select all the pieces except for the face objects, then select Edit Surfaces Ø Stitch Ø Global Stitch Ø. 2. Click Reset to set everything to the default settings. Then click Global Stitch. Now if you move any of the patches, you will notice that they behave like rubber, stretching to keep themselves together. 3. The model is now ready to be set up for animation. Save the final scene as Dog_Final.mb. You can find this finished version in the working files and a rendered image in the Chapter 8 Color Gallery on the CD.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=391405529 [11/27/2000 8:34:28 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 8 - Organic Modeling Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we stepped through building a complicated patch model of a dog, from scratch to finish. In addition to learning one specific method of building a dog in patches, we also covered the concepts and techniques for building complex models in general. These techniques included rebuilding surfaces, mirroring and attaching parts, and stitching to create seamlessness. We will return to the dog model to fit it with skeletons in Chapter 11, then set it up for animation in Chapter 13. One special tool we did not use in this chapter is Artisan, which is revolutionizing the way that computer animators do their work. The next chapter is devoted to the topic of Artisan.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=223183893 [11/27/2000 8:34:30 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 9: Working with Artisan Overview New in Maya 2 Complete (and Unlimited) is a set of plug-ins called Artisan. Available previously as a separate package, the functionality of Artisan is now yours for Maya s base price. Artisan is a set of nine tools available within standard Maya menus ranging from Deform to Edit Surfaces to Modify (the fact that they are not all grouped together is one big cause for confusion for anyone trying to figure out what Artisan is). These tools are generally used for modeling purposes, but the primary feature that links them is that they all act like virtual paintbrushes, painting on everything from shape to color. In an analogous way to the paint or airbrush tools in Adobe PhotoShop, Artisan paints attributes onto any model you select but Artisan does this in three dimensions! Taken together, the tools that make up Artisan provide one of the easiest and most intuitive ways to model, select, and edit geometry available in any graphics software today and it s all built seamlessly into Maya! Tip Because they work as paintbrushes, Artisan tools are most efficiently used with a graphics tablet. In this book, however, we re assuming a plain vanilla configuration that doesn t include a tablet, so the instructions in this chapter show how to use Artisan with a mouse and keyboard as the only input devices. If you do have a tablet, it should be configured, for the most part, automatically when you launch Maya. For more information on how to use your tablet with Artisan, see the online documentation under Basics: Artisan. What s New in Maya 2
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=590063188 (1 of 2) [11/27/2000 8:34:34 PM]
Books24x7 Mastering MAYA Complete 2
A great deal has changed in Artisan for version 2 of Maya, including the much-needed new polygonal sculpting tool (which lets you sculpt polygons as well as NURBS surfaces). Other new tools have been added, including the extremely versatile Attribute Paint tool, which lets you choose to paint any (paintable) attribute on your geometry say goal weights for soft bodies or polygon facet colors on your model. Other enhancements to Artisan include a more streamlined options window (with more options, grouped in a more logical order) and better control while painting on complex surfaces like multi-surfaces that have been stitched together. Artisan has gone, in its present incarnation, from a cool but underdeveloped plug-in to a robust, easy to use, and incredibly powerful set of tools what s more, these better tools are now built right into Maya Complete!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=590063188 (2 of 2) [11/27/2000 8:34:34 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
The Tools: a Quick Overview Here is a quick run-down of the nine tools in Maya Artisan, with a brief description of what they do and how to open them. Sculpt Polygons This tool allows you to sculpt polygonal shapes as if they were virtual clay. To open this tool, choose (from the Modeling menu set) Edit Polygons Ø Sculpt Polygons Tool. Sculpt Surfaces This tool allows you to sculpt NURBS surfaces as if they were virtual clay. To open this tool, choose (from the Modeling menu set) Edit Surfaces Ø Sculpt Surfaces Tool. Paint Set Membership This tool allows you to paint on membership in sets, rather than having to pick each point and assign it. To open this tool, choose (from the Animation menu set) Deform Ø Paint Set Membership Tool. Paint Selection This tool allows you to select vertices on a NURBS or polygonal surface by painting on the surface rather than selecting points individually. To open this tool, choose Modify Ø Paint Selection Tool. Paint Weights This tool allows you to set the weights of clusters of vertices by simply painting on a surface. To open this tool, choose (from the Animation menu set) Deform Ø Paint Weights Tool. Script Paint With this tool, you can paint onto an object the output of a MEL script using your mouse or graphics tablet, instead of manually running the script at each point. To open this tool, choose Modify Ø Script Paint Tool. Attribute Paint This tool allows you to paint any (paintable) attribute onto your selected model. You can paint on colors, goal weights, or other attributes that you assign to be paintable. To open this tool, choose Modify Ø Attribute Paint Tool. Paint Skin Weights After binding skin to bones, you can use this tool to modify the weights of the bound points to each joint in your bone chain, resulting in smoother, more natural skin motion. To open this tool, choose (from the Animation menu set) Skin Ø Edit Smooth Skin Ø Paint Skin Weights Tool.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=175117371 (1 of 2) [11/27/2000 8:34:40 PM]
Books24x7 Mastering MAYA Complete 2
Paint Vertex Color This tool lets you paint colors directly onto individual polygons on a surface. To open this tool, choose (from the Modeling menu set) Edit Polygons Ø Colors Ø Paint Vertex Color Tool. Tip If you don t see the Artisan tools in the menus listed above, Artisan may not be auto-loading. To get Artisan to load when Maya launches, choose Options Ø General Preferences. Click the Modules tab, check the Artisan check box, and then restart Maya.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=175117371 (2 of 2) [11/27/2000 8:34:40 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Sculpting Polygons: Deforming a Sphere Let s begin our work with Artisan by using one of its most anticipated new tools: the Sculpt Polygons tool. Open a new scene in Maya and create a polygon sphere (Create Ø Polygon Primitives Ø Sphere) don t just click the sphere button on the shelf, or you ll get a NURBS sphere and the Sculpt Polygons Tool won t be very effective! In the Channel box, under Inputs: polySphere1, set the subdivisions X and Y to 40.
Note When using Artisan sculpting tools, it is always important to have a large number of points to work with either vertices (for NURBS surfaces) or facets (for polygon surfaces). If you do not provide enough points for Artisan to work with, it will not push and pull the object s surface in ways you expect. With the sphere selected, choose Edit Polygons Ø Sculpt Polygons Tool Ø (from the Modeling menu set). This brings up the following window, which is generally the same for every Artisan tool. Note As most settings are the same from one tool to another, we will introduce them here and refer back to them in later sections of this chapter.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=824242318 (1 of 5) [11/27/2000 8:35:00 PM]
Books24x7 Mastering MAYA Complete 2
In this window (be sure you re in the Sculpt tab), set Radius U and L to about 0.3, set the Operation mode to Push, and set the Maximum Displacement to around 0.5. When you move your mouse over the sphere now (don t click anything just yet), you will see a red circle with an arrow pointing inward (toward the center of the sphere) and the label Ps. The circle tells you your brush s radius of influence, the arrow is the direction of the effect, plus the amount of influence it will have (longer arrows mean bigger pushes and pulls), and the Ps stands for push, the current mode of the brush. To see how this feedback works, try changing the radius of the brush to a smaller value; the red circle will diminish to match. You can also change the direction of the effect; under Sculpt Variables, choose the X axis radio button. As you now move the mouse around, you will see that the arrow always stays pointing down the X axis. You can try the other settings here as well when you re done, set it back to Normal. Now that you have a feeling for some of Artisan s settings, try clicking and dragging the mouse over the surface. You should see the sphere dent inward as you drag your mouse across its surface, the dent always pointing inward toward the center of the sphere (because the brush option is set to Normal). If you make a few drags across the sphere, you will end up with something like the following.
If you don t like what you have (or just to see how this works), you can erase your work. Click the Erase radio button (under Operation), then paint over the parts you don t like. If you want to reset the entire sphere, click the Flood button near the top right of the window. This will flood the entire sphere with the Erase command, thus resetting the sphere back to its original shape.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=824242318 (2 of 5) [11/27/2000 8:35:00 PM]
Books24x7 Mastering MAYA Complete 2
Tip The Flood button can be used with any operation, such as push and pull, to apply a certain value to an entire object. You can then fine-tune specific parts of your surface by painting on them as normal. You may notice that, as you make several strokes on top of one another, the polygon facets will tend to get very jagged looking (as if the sphere were made up of crinkly paper instead of clay). To smooth out your strokes, there are two options: the Smooth operation or the Auto Smooth option. Let s start with the Smooth operation. Once you have several strokes deforming your sphere (try pulling the points out this time), switch over to the Smooth operation by selecting its radio button on the Sculpt tab. Now brush over the sphere, concentrating on the sharpest edges. You ll see these edges move back toward their original positions on the (undeformed) sphere, and the strokes you have made will smooth out. Note The Smooth operation relaxes whatever you paint over, making it tend to return back to its original position, and thus smoothing the shape back out. Now erase your sphere back to normal, check the Auto Smooth option, and set the Strength slider to about 5. As you paint strokes over the surface of the sphere (be sure you re in push or pull mode!), you will notice that the polygons don t become as jagged as they did when the Auto Smooth option was off. To create smoothly organic shapes, always use a combination of the Auto Smooth option and the Smooth operation mode. Aside from adjusting radius, modes, and other options, you can also change brush shapes, using the row of buttons near the top labeled Shape the icon on each button shows its stamp shape. Erase the sphere back to neutral, and then try stamping the sphere with each of the brush shapes to see how they compare. Note Stamping is simply clicking and releasing your mouse button (without dragging). The brush creates a stamp of its shape right on you object s surface. When you drag over the surface, you are laying down a series of stamps. You can see this effect if you drag very quickly over your object s surface: If the mouse is moving quickly, each stamp will be noticeably separate from the others, rather than all running together. As the Sculpt tool is set up right now, every time you make one stroke on top of another, the sphere will deform more and more (as if the effect were layering on top of itself) because you have the Surface: Update on Each Stroke option turned on.
If you wish to set a maximum amount by which your strokes can deform the sphere, just uncheck the Update on each stroke option. The same strokes will then produce something like this:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=824242318 (3 of 5) [11/27/2000 8:35:00 PM]
Books24x7 Mastering MAYA Complete 2
As you have probably noticed, you can also set the opacity of your brush. Opacity refers to the percentage of a tool s total effect that each application of it will have on your object. As an analogy, consider a real-world paintbrush: If the paint you re applying is highly opaque, one coat may be enough to cover your wall, whereas a semi-transparent paint would take several coats. In Artisan, if you have your brush set to Push with a maximum displacement ( push in ) set to 1, and your opacity is 0.5 (or 50%), when you click on the surface of your sphere, it will only push in about 0.5 units, instead of 1. You can use the opacity setting to reduce the effect of your strokes, making each one subtler, thus allowing you to deform your objects in smaller increments than we have done so far. Before we leave this introductory section, you should note that you can bring up a marking menu with several Artisan options by simply pressing the U key and clicking the mouse button. In addition to the settings available in the marking menu, there are hotkeys defined for several of the most common tasks, and you can create your own hotkeys for most Artisan settings.
Tip In version 1 of Maya, altering the radius of the brush was mapped to the Ctrl+right- and left-arrow keystrokes. In version 2, modifying the upper brush radius is now mapped to B plus mouse-dragging right or left (the new lower radius setting is not yet mapped). Max displacement is now mapped to M plus mouse-dragging right and left. To find out how to map other tool settings to hotkeys, see the Maya help files, or Chapters 3 and 16 in this book.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=824242318 (4 of 5) [11/27/2000 8:35:00 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you have a graphics tablet, you can set the pressure of the stylus to map to brush radius or displacement amount. See the Maya help files for more on how to do this. If you are familiar with Artisan s marking menu and hotkeys, you do not need to keep the options window open for most operations. If you are starting out, however, it is a good idea to keep the window open. Throughout this chapter, we will access all Artisan options via the option window, though experienced users will find it more efficient to access them through the marking menu or hotkeys. Tip For a complete list of Artisan s hotkey functions (and those that are not yet mapped), choose Options Ø Customize UI Ø Hotkeys, and scroll down to the Artisan section of the list (it s near the bottom). If you map any new hotkeys, be sure to save your preferences for future use (Options Ø Save Preferences).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=824242318 (5 of 5) [11/27/2000 8:35:00 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Sculpting NURBS Surfaces: Sculpting across Seams We re now going to look at Maya s Sculpt NURBS Surfaces Tool, and use the head you created in Chapter 6 to see how Artisan works with complex issues like surface seams. Tip If you do not have (or don t like) the head from Chapter 6, use the file headStarter.ma on the CD-ROM. First things first: we don t want to alter the shape of the person s ears or eyes, so hide them from view (select each, and then choose Display Ø Hide Ø Hide Selection).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=529480023 (1 of 4) [11/27/2000 8:35:12 PM]
Books24x7 Mastering MAYA Complete 2
Drag-select the remains of the head, and then open the Sculpt Surfaces Tool (Edit Surfaces Ø Sculpt Surfaces Tool Ø). The entire surface of the head will now be available for sculpting (if you had only selected one portion of the head, it would have been the only part available for sculpting). You will see yellow bands where each surface is stitched to the others if you see all the surfaces isoparms, go to the Display tab and uncheck Show Active Lines. Because there are stitched seams in this model, it will be bit more challenging to sculpt this surface without pulling apart the seams. Note Seams are a highly complex surface structure, and, while Artisan does a great job treating the object as a whole, you have to know how to adjust the Sculpt Surfaces Tool settings to get it to work as well as possible. In the Sculpt Surfaces Tool window, select the Seam tab and adjust the Seam Tolerance and Min Length to 1. Setting these a bit higher than their defaults allows Artisan to see the common edges more easily as you work with the tool. Tip Before you start deforming the face shape, it is a good idea to save a temporary version the project file. If your settings get too messed up, it s easier to go back to that file than to have to go back to the original and hide the eyes and ears again. One problem you will run into (if you let your brush stray too far) is that the upper head will not deform correctly it has too few isoparms to deform well with Artisan. If we were planning to model the upper head next, we would need to insert more isoparms. But since we are not, we can just leave it alone for now (you can even deselect it if you want to be safer). Let s create a heavier pair of eyebrows, using the Pull mode. We don t need to pull out each one, because Artisan has a Reflect mode that will allow us to do both sides simultaneously. Click the Stroke tab, turn the Reflection option on (check the box), and set the reflection mode to V Dir (Horizontal). When you now pass your mouse over the head, you will see two brushes, mirrored around the centerline of the head. Now turn back to the Sculpt tab, set the Operation mode to Pull, and adjust the radius of the brush(es) to something that looks appropriate for eyebrow size, turn the opacity down to about 0.5, and set Max Displacement to about 0.5 as well. Tip By holding down the B key and moving the mouse left and right, you can interactively adjust the brush size and see the changes in the brush right on the face (the range of sizes the brush can take on min to max size is determined by the brush minimum and maximum settings in the Sculpt Surfaces options window). This is a much faster way to adjust brush size to a desired radius. Starting close to the center, pull a stroke along the top of the eyes (where the brows are), and pull out a heavier eyebrow. You ll notice both sides pull out with just one stroke a great time-saver! If you don t like your work, remember that you can erase your model back to its original state again with the Erase function.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=529480023 (2 of 4) [11/27/2000 8:35:12 PM]
Books24x7 Mastering MAYA Complete 2
Once you have eyebrows you re pleased with, let s try creating an indentation below the cheeks that goes back toward the ears specifically, across the seam boundary between the face and cheek patches of the face. Tip This is a well-modeled face: the stitches occur in places that would normally get no tweaking by tools such as Artisan (even though we re going to do that here). Placing seams in areas that won t move is very good practice: even though Artisan works well with stitches, it is not perfect. Whenever possible, it is better if you don t have to tweak stitched surfaces in the first place. You will probably get unsatisfactory results at this point (and you may have to reopen your saved temp file; even erasing sometimes fails to set the stitches back to normal). The two surfaces are obviously not working as one, each one deforming a different amount under the brush s pressure. The solution here is to increase the number of surfaces the tool looks for as it works. (Be sure to get a clean copy of your head to start from first!) Click the Miscellaneous tab and set the number of surfaces to two or more (or just click the Infinite radio button), and turn on the Use Common Edge Info option. With these new settings (and a bit of practice try starting with the brush completely on one surface, then moving it to the other), you should get a nice sunken cheek look. Save this project for use later in this chapter.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=529480023 (3 of 4) [11/27/2000 8:35:12 PM]
Books24x7 Mastering MAYA Complete 2
Although this was a fast and simple introduction to real-world modeling using Artisan, it should give you a good idea of just how powerful the tool can be for making subtle adjustments to your models. All it takes is a bit of practice and some knowledge of what the Sculpt Surfaces Tool can do. Note You can actually stitch surfaces using the Sculpt Surfaces Tool. For more information on how to do this, see Maya s online help (Basics: Chapter 7).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=529480023 (4 of 4) [11/27/2000 8:35:12 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating Sets with Artisan Another sometimes useful tool Artisan now includes is the Paint Set Membership tool. With this tool, you can edit the set membership of points for grouping with bones, for example without having to pick individual points. (And if you ve ever had to do that, you know why this is a useful tool!) Let s use our base head from the last section, and create a few sets of points on it (or you can use the 9headStarter.ma project on the CD-ROM). First drag-select the entire head, then open the Paint Set Membership tool (Deform Ø Paint Set Membership Tool Ø). With the Paint Set Membership tool open, the head should now be made up of several colors, each representing one of the sets that has been created for the head. (See the Chapter 9 Color Gallery on the CD for the full effect.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=406746796 (1 of 4) [11/27/2000 8:35:19 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you do not see a colored face, click the Display tab and be sure the Color Feedback option is on. While here, you can also (if you prefer) turn off Active Display Vertices, which hides the isoparms and CVs on the head. The Paint Set Membership tool works in three modes: Add, Transfer, and Remove. Add adds the painted points to the selected set, Remove deletes points from the selected set, and Transfer transfers points to the selected set. You will notice that there is no opacity setting: all points are either in a set or not there is no in-between. Tip It is important to understand the difference between Add and Transfer. Add places the painted points into the selected set, but does not remove them from membership in any other sets. Transfer both adds points to the selected set and removes them from membership in any other sets. To begin, let s add some points from the top of the head to the shapesSet that has all face points in it (in the Set Membership tab, select shapesSet under Set to Modify). With your brush mode set to Add (you can adjust the radius just as you did previously), paint some points on the top of the head into the shapesSet. The newly added points will change color as they are added to the set. (See in the Chapter 9 Color Gallery on the CD for the full effect.)
Now let s remove some points from set3 (the set around the jaws). Set your Paint Set Membership tool to Remove and paint out some of the points. As the CVs are removed, they disappear from view. (See the Chapter 9 Color Gallery on the CD for the full effect.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=406746796 (2 of 4) [11/27/2000 8:35:19 PM]
Books24x7 Mastering MAYA Complete 2
Finally, let s transfer some points from one set to another. With the Paint Set Membership tool set to Transfer, select set2 (the set of CVs around the mouth), and then paint over the area below the eyes. You will notice that the points change color as they are transferred from their old set to set2. (See the Chapter 9 Color Gallery on the CD for the full effect.) Note The set you select in the Paint Set Membership Tool window is the set the points will transfer to. Points from any other set will be moved into your selected set.
The Paint Set Membership tool can be very useful if you have several objects (such as this head) and you wish to form selection (or deform) sets across object boundaries for use in later deform processes, or just for ease of selection. Rather than have to carefully pick out points and be sure you don t accidentally pick points on the back side of the object! you can intuitively paint these points into your sets with a brush.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=406746796 (3 of 4) [11/27/2000 8:35:19 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=406746796 (4 of 4) [11/27/2000 8:35:19 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting Selections Akin to the Paint Set Membership tool, the Paint Selection tool allows you to pick vertices (or polygon facets) that you can then manipulate in standard ways. Open a new scene, create a NURBS plane, scale it out a bit, and set its U and V patches to around 50 each (to give Artisan enough points to work with). Now open the Paint Selection tool (Modify Ø Paint Selection Tool Ø). The selection types here are Select, Unselect, and Toggle (which selects unselected points and vice versa). There are also global Select, Unselect and Toggle buttons. To quickly see how this works, pick out a brush shape and paint over part of the plane to select its points. You can now use the Move, Rotate, or Scale tools to alter just these points. The advantage of being able to paint on selections may not be obvious with a simple plane, where you could just drag out selections with the Marquee tool. But on something more complex, like our head, the Paint Selection tool can be a great asset. Once again, open your neutral head project (or use the 9starterHead.ma project on the CD-ROM). Now, using the Paint Selection tool, select points around the mouth and make the face smile, using the Move tool and the Scale tool you will probably have to move back and forth between the Paint Selection tool (changing the points selected) and the Move and Scale tools. Tip Remember that the Reflect mode allows you to select points on both sides of the head simultaneously cutting your selection time in half.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=196275651 (1 of 2) [11/27/2000 8:35:25 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=196275651 (2 of 2) [11/27/2000 8:35:25 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting Weights If selecting CVs via painting doesn t give you enough control over the points you re manipulating, you can use the Paint Weights tool to set the goal weight (the amount of effect a manipulation will have on a given vertex or facet) of each CV in an intuitive manner. Note There are several other ways to set CV weights, but the Paint Weights tool is so easy to use, it s not often necessary to go beyond this tool. To see how this tool works, let s create an Aztec (stair-stepped) pyramid just by painting different weights on a simple NURBS plane. Open a new scene, create a NURBS plane with about 50 U and V patches, and scale it out to about the size of the scene grid (for easier viewing). There is one step we must do before we can use the Paint Weights tool we must first make the plane s CVs into a cluster so their weights can be manipulated (select the plane, then choose Deform Ø Create Cluster). If you forget this step (which is very easy to do), you will be extremely confused by the lack of responsiveness the tool has! Now that you have a cluster, drag-select both it and the plane the cluster is mapped to, and open the Paint Weights tool (choose Deform Ø Paint Weights Tool in the Animation menu set). Tip You should see the plane turn white, indicating that its goal weights are all set to a value of 1. If this doesn t happen, be sure you created a cluster from the plane, and then check to see if color feedback is on (it s under the Display tab of the tool). It may be hard to see the color with the plane s isoparms showing, so turn off Show Active Lines as well. First, we need to flood the entire plane/cluster with a goal weight of 0, or no influence (CVs with a 0 weight won t react to any manipulation). Set the operation mode to Replace (which replaces the old goal weight with your selection), set the Value (of the goal weight) to 0, and click the Flood button. The entire plane should turn black, indicating it now has a goal weight of 0. This is the base of our pyramid, which will not move. Now we need to paint our stairs. Choose the square brush option (the button that looks like a blue square), and change the value to 0.1 instead of 0. This next part is a neat trick: Instead of having to manually increase the goal weight value each time, we can place the Paint Weights Tool into Add mode (by clicking the appropriate radio button), and each brush stamp will increase the goal weight by 0.1. Thus, the more times you click on a spot, the higher the goal weight goes, and the lighter the area s shade of gray will become.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=513415075 (1 of 4) [11/27/2000 8:35:30 PM]
Books24x7 Mastering MAYA Complete 2
Tip This tool also has Smooth and Scale operation modes. The Smooth mode smooths transitions between areas of different goal weights. The Scale mode scales (or multiplies) the object s goal weight by the number in the Value box. With the square brush chosen, set the radius of the brush larger than the edges of the plane, center the brush around the origin, and stamp a higher goal weight onto a large square area of the plane (you will probably find this easier to do in the top orthographic view). Note You can set the orientation of any brush that s not round. In the Stroke tab, you can choose from Up Vector (default), U and V Tangent (horizontal and vertical aligned), and Path Direction (which changes the orientation depending on your stroke). You should see a large square portion of the plane become a slightly lighter gray than before. Make the brush radius a bit smaller and repeat the stamp now a smaller portion of the plane should get just a bit lighter. Continue this process until you are at the center with a very small radius. Your plane should look as follows.
To make your pyramid, switch to the Move tool, select the cluster weight only (not the plane you may need to do this in the hypergraph or outliner), and then move it straight up the Y axis. You should see something that looks like a stair-stepped pyramid.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=513415075 (2 of 4) [11/27/2000 8:35:30 PM]
Books24x7 Mastering MAYA Complete 2
As a further exercise, try making a hilly terrain by using a simple plane, a cluster, and painted goal weights. Let s now return to our favorite head either open your own file or use 9headStarter.ma from the companion CD and examine how to weight the mouth clusters to allow for better manipulation of facial expressions. With the head showing, select only the lower face section (with the mouth) and create a cluster out of it. Shift-select the cluster and mouth, then open the Paint Weights tool (you should see the area turn white, indicating a goal weight of 1 for all points). As before, first flood the area with a goal weight of 0 (so the areas we don t want to move won t). Using the Add (or Replace) and Smooth modes, paint the areas around the lips, giving the corners of the mouth, and the cheeks above them, the highest weighting. Try to imagine where the skin bends and stretches the most as you smile and frown (or look in the mirror), and then paint these creases onto the mouth. You may find it necessary to move the mouth and then repaint the goal weights to get the effect you want. Tip Remember that turning on Reflection will cut your work in half.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=513415075 (3 of 4) [11/27/2000 8:35:30 PM]
Books24x7 Mastering MAYA Complete 2
When you are finished, try making the face purse its lips and then frown. You should find that this method of creating facial animations can after a bit of practice become a very powerful tool in your character animation bag.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=513415075 (4 of 4) [11/27/2000 8:35:30 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting Scripts: Hair on a Head The Paint Scripts Tool lets you paint a MEL script onto your selected surface. Maya provides several predefined scripts in the C:\WinNT\Profiles\\maya\2.0\scripts (or ~Maya/2.0/scripts for IRIX) directory, or you can create your own for use in a project. Note To learn how to create your own scripts, see Chapters 16 and 17. The predefined scripts include painting on geometry, particle emitters, and soft body goal weights. For our purposes putting a fuzzy haircut on our head we ll use the geometry paint script. Open your head project (or use 9headStarter.ma on the CD-ROM). In an empty space in the scene, create a short, very narrow cylinder (be sure to cap it in the cylinder creation options, so it s not hollow). As the hairs will be very thin, and we will paint on lots of them, reduce the number of sections to four and be sure there is only one span. In relation to the head, the hair should look something like the small tube to the right of the ear.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=428087272 (1 of 3) [11/27/2000 8:35:37 PM]
Books24x7 Mastering MAYA Complete 2
Now open the Script Paint tool (Modify Ø Script Paint Tool Ø), click the Setup tab, and, in the Tool Setup Command text field, type geometryPaint, and hit the Enter key. This will bring up a window with options for the geometryPaint.mel script. In the Geometry text field, type in nurbsCylinder1 (or whatever you name your hair shape).
Tip If you would like a more random look (as hair isn t usually all the same length!), you can create a second (or third) hair strand. Then, in the geometry field, type in the names of all geometry you wish to use for the hair, with a space between each name. For Operation Mode, select Create/Modify, set the grid to about 100 by 100 (this determines how densely the hair will be placed), be sure the Align checkbox is enabled (so the hair will point out from each point on the head), and set the jitter to 0.3 or greater (this controls how randomly each hair is placed). If you try to use the paint brush now, you will probably see the hair being built all around the head, but not attached to it there is an offset to your geometry (its distance from the origin) that is causing this problem. To correct this problem, move all your hair objects back to 0, 0, 0 on the grid. Back in the Script Paint Tools Settings window, be sure your brush mode is set to Replace, pick a good radius for your brush, and paint some hair on your head! Tip With all the geometry you create building hair, your system response time may become very slow. In a situation like this, you ll need to find a compromise between the amount of hair your head needs and the time (and patience) you have, or feel free to use the hair brushes in Paint Effects (see Chapter 25). You may notice that you have difficulty getting the hair to paint on the head properly. As painting shapes on a complex surface (the head) involves difficult calculations on Maya s part, you may need to adjust several of the settings in the Script Paint settings window to get the right look.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=428087272 (2 of 3) [11/27/2000 8:35:37 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=428087272 (3 of 3) [11/27/2000 8:35:37 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting Vertex Colors Another of Artisan s tools which has a more limited use is the Paint Vertex Colors tool. This tool allows you to paint colors directly onto any polygonal surface using the by now familiar Artisan brush. Create a polygon cone, say, with about 40 divisions in each direction (so there are plenty of facets for Artisan to work with). With the cone selected, open the Paint Vertex Colors tool (choose Edit Polygons Ø Colors Ø Paint Vertices Tool). Set your brush radius to whatever you wish, and then click the color swatch next to Color Value and select a color. All that s left to do is paint on some color! (See the Chapter 9 Color Gallery on the CD for the full effect.) Note The Paint Vertex Colors tool is a simply series of presets of the Attribute Paint tool, which we will use next.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=497573318 (1 of 2) [11/27/2000 8:35:42 PM]
Books24x7 Mastering MAYA Complete 2 Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=497573318 (2 of 2) [11/27/2000 8:35:42 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting Attributes: Painting Goal Weights The Attribute Paint tool is very useful, as you can use it to paint any paintable attribute onto a surface. For our work, we re going to use this tool to paint on the particle goal weight of a soft body, making a simple cylinder into a bendable fishing rod. Tip We could also use the Script Paint tool to do this; it has a predefined script, paintGoalPP, which will do the same thing. Note For information on how to create soft bodies, see Chapter 24. Note For information about how to make an attribute paintable, see Appendix C of Maya Basics in the online help documents. Open the file 9rodSB.ma, on your CD-ROM (or build a skinny cylinder, animate it, and make it a soft body). If you play back the animation, you will see that the entire fishing rod moves back and forth as one solid piece we re going to change that by reducing the goal weights at the top of the rod. Select the rod and open the Attribute Paint tool (Modify Ø Attribute Paint Tool Ø). Click the Attr (attribute) tab and then, under Paintable Object Type, expand the particle selection (click the + sign) until you see goalPP and highlight it. The goalPP attribute will now be placed in the Paintable Object list beneath; highlight this text, then click the right arrow, moving the goalPP over to the Selected side. Finally, click the Save Selection checkbox, so you don t have to repeat these steps if you change tools.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=473777618 (1 of 2) [11/27/2000 8:35:51 PM]
Books24x7 Mastering MAYA Complete 2
Move back to the Attr. Paint tab, set the operation mode to Replace and the Value (goal weight) to 0, and click the Flood button. This sets all goal weights to 0, meaning that the soft body will not move with its (invisible) animated parent anymore you can play back the animation to test this, if you wish. Once you see how the goal weight attribute works, flood the entire rod with a value of 0.5, so there will be some connection between the rod and its animated parent. Once you have the entire rod set to 0.5, set your mode to Add, and set your value to 0.1 we re going to increase the goal weight as we go down the rod by simply painting on a lighter color. Set your brush radius fairly large, so it wraps around the whole cylinder you can also change the brush shape to square if you prefer. To get a smooth transition from dark to light, you will probably need to use the Smooth mode as well as the Add mode. Run a couple of frames of the animation frequently to see how you are progressing. Tip A very good method for getting smooth transitions on an object like this is to start at the bottom and make a series of upward brush strokes, each one going up a bit further. Warning You must rewind animations using soft bodies before playing them back. If you don t rewind, the animation will give you bizarre results.
While it can take a bit of practice to paint goal weights onto objects effectively, learning how to do so can really improve the control you have over soft body animations, allowing you to create much subtler variations of motion than would be feasible without such a paint method for applying goal weights.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=473777618 (2 of 2) [11/27/2000 8:35:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting Skin Weights If you are working with skinned, jointed characters, the Paint Skin Weight tool is just what you need for precise control over how your character s skin bends in relation to joint movement. We will use a simple character setup of a cylindrical arm and an elbow joint to examine how to use this tool. You can either create this scene on your own, or use the 9armStarter.ma file on your CD-ROM. With your project open, try moving the joint up and down (drag-select the bottom joint and then use the Move tool to move it and the arm up and down). You will notice that, while the bound skin moves with the joints, the elbow area doesn t respond correctly: it needs to crinkle just a bit more. Select the cylinder and open the Paint Skin Weights tool (in the Animation menu set, choose Skin Ø Edit Smooth Skin Ø Paint Skin Weights Tool Ø). You should see a grayscale image of the cylinder and, in the Skin Paint tab, you will have a choice of your three joints (joint1 at the shoulder, joint2 at the elbow, and joint3 at the wrist). If you select joint1, for example, the color of the cylinder will show what the bind weight of each point is for this joint. Again, white represents a bind weight of 1, fully affected by any joint motion, and black is a bind weight of 0, not affected at all. Tip If your cylinder is not colored, be sure Color feedback is on (under the Display tab), and also be sure your scene is set to shaded mode (press the 5 or 6 key on the keyboard).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=371805481 (1 of 3) [11/27/2000 8:35:56 PM]
Books24x7 Mastering MAYA Complete 2
You can see by looking at the color feedback (in the Chapter 9 Color Gallery on the CD) that the inside of the elbow is very dark when either joint1 or joint2 is selected, indicating it is not being influenced by either joint very much. Let s paint slightly higher values into this area. First, bend the arm some (as above) so you can see your results as you work. Set your brush mode to Add, set the value to about 0.1, and set your opacity fairly low (like 0.1 or 0.2). Next, set your brush to a fairly small radius, zoom in on the elbow area, and start painting higher goal weights on, switching between joints 1 and 2, and watching what happens. Your goal is to get a nicer crease between the upper and lower arm here, and setting higher goal weights at and just above the elbow for the top toint (or just below the elbow for the bottom joint). The elbow will increase the joint s influence, making it pull the elbow area into more of a crease. Tip If your strokes make the elbow area too lumpy, use the Smooth mode to smooth the lumps out you may not want to smooth out all the lumps, however, as skin does wrinkle as it bends! Once you have worked a while, you should end up with something like the following (also see the Chapter 9 Color Gallery on the CD).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=371805481 (2 of 3) [11/27/2000 8:35:56 PM]
Books24x7 Mastering MAYA Complete 2
The effect here is subtle, but subtlety is what this tool is all about. The difference between the two images above is not great, but the second is far more appealing and realistic than the first and getting this elbow bend without the Paint Skin Weights tool would be very difficult and time-consuming. Once again, Artisan makes a difficult, painstaking task a lot easier.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=371805481 (3 of 3) [11/27/2000 8:35:56 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 9 - Working with Artisan Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary This chapter has presented all the Artisan tools and, while the review was fairly brisk, you should have a very good feel for how Artisan works by now. Keep in mind that all the tools operate in a similar manner, just with different options. You may be thinking at this point that virtual painting is something of an art to master (hence the name Artisan ), but don t be intimidated. Consider this: How would you accomplish any of the tasks we have done in this chapter without Artisan tools? Only when you imagine working without these tools is their power really evident. Artisan s tools take highly complex tasks that used to require custom programming and/or hours of dull, painstaking work and place all of these tasks in easy reach. Artisan is also highly intuitive: after all, just about anyone understands paintbrushes. Because Artisan is now built into Maya Complete (and Unlimited), and with all the new improvements of the tool set in version 2, you can save yourself hours of time and frustration if, the next time a job seems too difficult, you first consider using Artisan.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=150692691 [11/27/2000 8:36:01 PM]
Books24x7 Mastering MAYA Complete 2
Part III - Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part III: Animation Chapter List Chapter 10:
Animating in Maya
Chapter 11:
Paths and Bones
Chapter 12:
Deformers
Chapter 13:
Skinning and Character Setup
Chapter 14:
Character Animation: a Walk Cycle and More
Chapter 15:
Working with Rigid Body Dynamics
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=110773383 [11/27/2000 8:36:03 PM]
Books24x7 Mastering MAYA Complete 2
Part III - Animation Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part Overview Animating in Maya Paths and Bones Deformers Skinning and Character Setup Character Animation: a Walk Cycle and More Working with Rigid Body Dynamics
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=654939307 [11/27/2000 8:36:07 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 10: Animating in Maya Overview This chapter introduces you to animating in Maya. We will go over the fundamental concepts of keyframing, the various interface controls, and the tools for creating and editing keyframes in Maya. The tutorial in this chapter also demonstrates how to use Maya s Set Driven Key tool. The techniques you ll learn in later chapters are quite challenging, so gaining a firm grasp of the basic tools will help you to get through those upcoming chapters more smoothly.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=851615860 [11/27/2000 8:36:09 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Keyframe Animation Animation, at its most basic level, is change over an interval of time. In Maya, almost anything can be changed over time; in other words, almost anything you create in Maya can be animated. You ve learned how Maya has a node-based structure. Any attribute within the node that has a numeric value is keyable. Keying, or keyframing, in Maya is the act of assigning a numeric value to a node attribute at a specific time frame. As the frames change, so can the attribute value. For example, the basic attribute Visibility actually has a numeric value of either 1 (for on) or 0 (for off), so it can be keyframed and animated. Keyframing is a concept taken from classic 2D animation. Senior animators draw important key poses of characters being animated at certain frame intervals, called keyframes. Then the junior animators take over and draw all the frames between the keyframes, which are called in-betweens. The same thing happens when you are animating in Maya. You are the senior animator who establishes the key poses of whatever it is you are animating, and the computer is the whole department of junior animators drawing the in-betweens for you.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=261419617 (1 of 2) [11/27/2000 8:36:12 PM]
Books24x7 Mastering MAYA Complete 2
Note Other kinds of animation include rotoscoping, which is actually a kind of keyframe animation, and motion capture, a way of creating function curves from live actors performances. Motion capture is a complicated procedure, and although the technology is improving quickly, it is still difficult to use it to produce high-quality animation without needing to do manual cleanups. Are You an Animator? There are different levels of animating. At the most basic level, you are moving things from A to B, which almost anyone can do. The next level of animating involves learning and intelligently using certain animation principles, such as squash and stretch, anticipation, key posing, and so on. The 2D cell-animation schools are still the best places to learn these things, although computer animation schools are beginning to offer classes in this area. If you want to be an animator, there is no way around it you must learn these principles. The ability to bring life to a character, however, requires more than just following animation principles. A successful animator also has a good sense of timing, which belongs to the realm of performance. Timing is a skill you are born with as much as it is a learned thing, and certain individuals are naturally better at animating than others, just as some people are naturally better dancers or singers than others. In fact, the ability to create authentic emotions and pathos in animated characters requires great acting skills. A good way to discover if you are an animator or not is to go through a whole animation project, and ask yourself which parts of the project you enjoy spending time on the most. An animator s focus will generally be different from that of the other 3D artists. Modeler and texture artists, for example, are usually interested in how things look; they want to create beautiful images, evoking certain feelings. Animators are usually interested in telling a good story.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=261419617 (2 of 2) [11/27/2000 8:36:12 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Animation Controls Before we get more deeply into keyframing, let s look at some animation control tools: the time slider and the range slider. These and the other tools discussed in this chapter are in Maya s Animation module.
Playing Back and Updating Animations with the Time Slider The time slider comes with playback buttons, which look like those on a video player control panel. You can also use the following hotkeys to control the playback: Alt+V
Toggles between play and stop
Esc
Stops the playback
. (period)
Moves to the next keyframe
, (comma)
Moves to the previous keyframe
Alt+. (period)
Moves to the next frame
Alt+, (comma)
Moves to the previous frame
You can click or drag in the time slider to do various things. When you click on a frame number, that frame becomes the current time. If you drag the mouse, the animation updates interactively, which is called scrubbing.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=434414474 (1 of 3) [11/27/2000 8:36:16 PM]
Books24x7 Mastering MAYA Complete 2
When you MM click or drag, the current time indicator moves to where the mouse is without updating the animation. This is a valuable function when you want to quickly keyframe the values of one frame to other frames. MM dragging is also used for scrubbing only the audio, as opposed to scrubbing the whole scene. The time slider can also become a virtual time slider inside the modeling window, the Graph Editor, or the Dope Sheet. This happens when you press the K key on the keyboard at the same time that you press the mouse buttons. By K+dragging in any window, you can scrub the animation. By K+MM dragging, you can move the current time without updating the scene, and scrub only the audio. This technique can be especially useful when you are editing function curves in the Graph Editor. The Graph Editor and Dope Sheet are discussed later in this chapter, when we get to the topic of editing keyframes. RM choosing inside the time slider opens the Key Edit menu. This menu offers the standard key-editing functions, which we will discuss later in the chapter in the Editing Keyframes section. It also provides access to several useful submenus: "
With the Set Range To submenu, you can control the playback range in various ways. One option here is the Sound Length setting, which you can also use to discover the length of an audio file.
"
With the Sound submenu, you can show, hide, or rename any of the audio files that have been imported.
"
With the Playblast function, you can preview your animation as real-time movie clips (the Playblast function is discussed in Chapter 11). Tip In order to actually play the audio file, you need to set the Playback Speed setting to Normal in Animation Preferences, found under Options Ø General Preferences.
Controlling the Playback Range with the Range Slider The range slider is a simple tool used to control the playback range of the time slider. You can set where the time slider starts and ends by sliding, shortening or lengthening the range slider. The Auto Key button on the range slider (the next-to-last item on the slider) lets you set keys automatically as you transform the selected object in the modeling window. Using Auto Key for keyframing is explained in the Creating Keyframes section of this chapter. The Animation Preferences button on the right end of the range slider lets you view the animation settings in the General Preferences dialog box. The animation settings include options that let you adjust the time slider. For example, setting the Height to 2x or 4x, as shown below, can help you see the audio waves more clearly, which is helpful when you are scrubbing audio files.
You can also select the Units tab of the General Preferences dialog box and adjust the Time setting. The default Time setting is 24 fps (frames per second).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=434414474 (2 of 3) [11/27/2000 8:36:16 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=434414474 (3 of 3) [11/27/2000 8:36:16 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating Keyframes There are many ways of creating keyframes in Maya. You can use the hotkeys, the Set Key or Set Breakdown function in the Animate menu, the Channel box, the Graph Editor, or the Attribute Editor. All of these methods are described in the following sections.
Using Hotkeys for Keyframing Several hotkeys are useful for keyframing: S
Keyframes a selected object at a specified frame (same as Animate Ø Set Key, discussed in the next section)
Shift+W
Keys the translations
Shift+E
Keys the rotations
Shift+R
Keys the scales
Keyframing with Set Key The standard way to keyframe a selected object at a specified frame is to select Animate Ø Set Key. The default setting is to Set Keys on All Keyable Attributes. With this setting, when you click the Set Key button in the Set Keys Options dialog box (or press the S hotkey), all the attributes displayed in the Channel box are keyed. This setting may not be practical for many situations.
Set Key Settings When you change the Set Keys setting to All Manipulator Handles, all the manipulator values are keyed. When the setting is Current Manipulator Handle, as shown below, only the active manipulator handle is keyed. This is a useful setting if you want to restrict the keying to only the attribute values you are changing, such as the Y-axis translation.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=751043158 (1 of 5) [11/27/2000 8:36:31 PM]
Books24x7 Mastering MAYA Complete 2
The Prompt setting lets you set keyframes at multiple frames. If you select Prompt, when you click on the Set Key button (or press the S hotkey), you are prompted for the frames to keyframe. Enter the frame numbers you want keyframed and click OK.
Keyable Attributes All keyable attributes are displayed in the Channel box. The default attributes are Translation, Rotation, Scale, and Visibility. In Maya, each object can have its own keyable attribute settings. You can add or remove the keyable attributes of an object by using the Channel Control. Select an object, then choose Window Ø General Editors Ø Channel Control.
The Channel Control shows a long list of nonkeyable attributes on the right, and a list of ten default keyable attributes on the left. When you select an attribute in either list, the Move >> or the <
Keyframing with Set Breakdown http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=751043158 (2 of 5) [11/27/2000 8:36:31 PM]
Books24x7 Mastering MAYA Complete 2
Set Breakdown, a new feature in Maya 2, works the same way as Set Key, except that instead of setting keys, it sets breakdowns. What distinguishes breakdown frames from keyframes is that when regular keys are inserted into a breakdown curve, the breakdown frames become bound by the regular keys, and the breakdowns maintain a proportional time relationship to those keys. To get a better idea of how breakdowns differ from keys, try the simple exercise in the with Breakdowns section later in this chapter.
Working
Keying Attributes in the Channel Box You can key different attributes in the Channel box. Select an object, open the Channel box, select any attribute(s), and RM choose over the attribute names. A long menu pops up, as shown here, offering many key-editing functions. The Key Selected option keyframes the attributes that are selected in the Channel box. The Key All option keyframes all the keyable attributes for the selected object. The Breakdown Selected and Breakdown All options work the same way for breakdowns. The Lock and Unlock options work on selected attributes.
Tip You can create a user-defined hotkey for Key Selected in the Channel box. Shift+S is a good choice. You may find that selecting attributes in the Channel box and hotkeying them is a very convenient method of keyframing.
Keying Attributes in the Attribute Editor You can also set keys in the Attribute Editor the way you do in the Channel box. A difference is that when you RM choose over the keyable attributes in the Attribute Editor, you don t get as many functions in the menu that pops up.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=751043158 (3 of 5) [11/27/2000 8:36:31 PM]
Books24x7 Mastering MAYA Complete 2
You can lock attributes and set keys, but the keys are set for all X, Y, Z values of translation, rotation, or scale attributes. One advantage of using the Attribute Editor is that you can easily access nonkeyable attributes and keyframe them using the editor.
Keyframing with Auto Key Auto key is probably the most efficient way to keyframe for a lot of situations. When you click the Auto Key button on the right side of the range slider, the key icon turns white and the background turns red. With Auto Key turned on, any change you make to the attributes of selected objects at any frame are automatically keyframed. The only precondition is that a keyframe must already exist for an attribute before that attribute can be auto keyed. The Auto Key button is a toggle; click it again to turn the function off. As an example of using Auto Key, follow these steps: 1. Create a Sphere and set keys for its translation attributes at frame 1. 2. Click the Auto Key button to turn on the function. 3. Move to frame 10, and translate the sphere to a different position. The change is automatically keyframed. 4. Move to frame 20 and try rotating the sphere. Nothing is keyed because there are no initial keyframes for the rotation attributes. Warning If you use Auto Key, make sure you toggle it off when you are finished. If you don t, you may unknowingly keyframe objects and end up with a lot of undesirable and unnecessary animation.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=751043158 (4 of 5) [11/27/2000 8:36:31 PM]
Books24x7 Mastering MAYA Complete 2 Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=751043158 (5 of 5) [11/27/2000 8:36:31 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Editing Keyframes After you ve created the keys or breakdowns, you can edit them using the Edit Ø Keys submenu, Channel box, Graph Editor, Dope Sheet, or time slider. We will cover the Graph Editor first because it is the most important keyframe-editing tool, and you will use it most often.
Working with Animation Curves in the Graph Editor When you create a series of keyframes, these keyframes can be represented as function curves, or animation curves, inside the Graph Editor. The Graph Editor works like a regular orthographic window in that you can use hotkeys like A and F for viewing the function curves, the Alt+MM drag technique to track, and the Ctrl+Alt+LM or MM marquee method for zooming. However, the settings for the Move and Scale tools change in important ways when the Graph Editor is the active window. Tip If you are not familiar with animation curves, the Graph Editor may look complicated to you. It is more complex than most other editors in Maya, but it is very important that you learn to work with the Graph Editor and the animation curves. Animators should know how to read animation curves, visualizing how an object will move differently when the curves are edited a certain way. This alone often separates good animators from bad ones. To see how the Graph Editor works, let s create some animation curves: 1. Create a sphere. Key translation and rotation animation to it over 30 frames. 2. Using the marking menu hotbox, select Persp/Graph View. The top window should now show perspective view, and the bottom should display the Graph Editor. 3. Press A to fit all the curves to the window. You should see six animation curves, one for each channel of the six attributes. 4. Marquee-select a few keyframes near the current time indicator. Notice that the graph outliner to the left shows which curve keys were selected. Move them, and you will see the sphere update interactively.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (1 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
5. You can also work with only the curves you want by selecting those curves in the graph outliner. Select the translate curves, and only those curves are displayed. 6. Make sure the Graph Editor is the active window by clicking inside it, then double-click the Move tool to open the option box. As shown below, listed under MoveKey Options are moveOnly and moveOver. The default moveOver setting lets you move selected keyframes over other keyframes. The moveOnly setting allows you to move the keyframes only between other keyframes.
7. Open the Scale tool option box. Again, you ll see settings that are different in the Graph Editor. The default Gestural setting sets the pivot point for scaling the selected keys to where you place the mouse. The Manipulator setting lets you create a box to move and scale, as shown below. This may be the better setting for many situations.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (2 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
Using the Graph Editor Tools The Graph Editor provides many toolbar tools to help you edit curves.
The Time Snap and Value Snap Tools The Time Snap tool, which makes the keyframes snap to frames, should always be turned on, because it makes editing keyframes easier. You will have fewer occasions to use the Value Snap tool, which snaps the keyframes to the nearest integer values. Before moving on to the other tools, turn on the Time Snap tool. Instead of working without the snap function, then needing to snap the keyframes later, it is much better to have the Time Snap tool on from the beginning. Note There are Time Snap functions in the Graph Editor, the Dope Sheet, and the time slider. You can also access Time Snap in the Animation Preferences section of the General Preferences dialog box, where Snap is On by default. The Move Tool As you saw earlier, the Move tool in the Graph Editor is actually the Move Nearest Picked Key tool, and it works differently from the Move tool you pick from the Minibar. The Move tool moves only one key at a time. It will move anything that is closest to the mouse arrow on an active curve, whether that item is a keyframe or a tangent handle. It will not move curves. You can constrain the tool using the Shift key for horizontal or vertical movements, just as you can constrain the regular Move tool. The Insert Key and Add Key Tools The Insert Key and Add Key tools are similar. Insert Key inserts a key on the curve at the selected frame. Add Key adds a key to whatever value and frame you are clicking, changing the curve shape accordingly. The Tangent Tools The tangent tools let you change the shape of the curve around the keyframes. The Spline (the default shape), Linear, and Flat tools let you pick those shapes. You can see other types on the Tangents menu. Select a few keyframes and play with the types to see how they behave. In situations where you want to break the tangent or increase the roundness of the curve at specific keyframes, you can use the Unify or Break tool (also available from the Keys menu).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (3 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
Before you can free a keyframe s tangent weight and change it, the tangent of the keyframe must become weighted. Select the keyframe (you can also select the entire curve) and select Curves Ø Weighted Tangents. The tangent handles change, as shown on the next page. You can then unlock the weights, using the Free Weight tool, and change the curve shape. After you are finished adjusting the curve shape, you can use the Lock Weight tool to lock the tangent weights of the keyframes.
The Buffer Curve Snap and Swap Tools The Buffer Curve Snap and Swap tools are new features in Maya 2. When you edit a curve, changing its shape, the original shape remains as a buffer (as shown above in the example of the free tangent weight). The Buffer Curve Swap tool snaps the changed curve to the buffer. The Buffer Curve Snap Tool snaps the buffer to the changed curve. The Key Stats Fields Tool The Key Stats Fields tool lets you enter precise values for keyframes. It is especially handy when you need to assign the same values for multiple keyframes.
Using the Graph Editor Menus The Graph Editor menus provide some of the same tools as the toolbar, as well as some other useful functions. Cut, Copy, and Paste Functions Using Edit menu functions, you can cut, copy, and paste selected keyframes. Before you paste, however, make sure to set the proper option settings, or unexpected results could occur. Go to Edit Ø Paste Ø and look over the different settings.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (4 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
The curves shown on the next page were copied from the original curve (shown as a white curve), then pasted with different option settings back to the original curve. The first example shows a curve inserted into the current time with the Connect setting checked. Notice that the curve being pasted has moved up in such a way that the starting point of the curve connects to the original curve at the current time indicator. If you turn off the Connect setting, you get the second example shown on the top right. The pasted curve is still inserted into the original curve, but it is not translated vertically to connect with the original curve. The Merge setting produces the third example, where the curve being pasted merges with the original curve. Note that the last keyframe of the resulting curve is the same as the pasted curve. The fourth example is pasted with the Time Range set to Start and Time Offset set to 30. Note that, in this case, you would get the same result if you set the Time Range to Clipboard and Time Offset to 29, because the copied curve on the Clipboard starts from frame 1.
Note When using functions with numerous optional settings, you will often have different ways of achieving the same result. Different situations will make different settings optimal for those situations. In order to know which are optimal for a particular setting, you need to have a clear understanding of what the settings do. It s frustrating to discover that a function that works for one situation will not work for another because different settings are required, and you don t know what those setting changes should be. Pre and Post Infinity Cycles and Extrapolations View Ø Infinity displays the curve values before and after the first and last keyframes, to infinity. Under the Curves menu, you can select Pre and/or Post Infinity cycles or extrapolations, as shown in the images on the next page. "
The default setting is Constant, which means the values for the first and last keyframes are maintained.
"
The Linear setting takes the slope of the tangent.
"
The Post Infinity Cycle with Offset takes the last keyframe value as the starting point for the next cycle.
"
The Post Infinity Oscillate setting mirrors the cycle before it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (5 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
Add and Remove Inbetween Functions Two other nifty functions are Add Inbetween and Remove Inbetween, found on the Keys menu. These are simple functions that either add or remove a frame into the current time, causing all the keyframes after the current time to move one frame forward or backward. The Auto Load Option In some situations, you may want to deselect an object and select another, but still maintain the keyframes of the first object. In such a situation, you can turn off the Auto Load function on the List menu.
Editing Key Times with the Dope Sheet The Dope Sheet has many of the same editing functions that are available in the Graph Editor. To open the Dope Sheet, select Window Ø Animation Editors Ø Dope Sheet. Because the Dope Sheet edits only key times, it is designed to allow you to easily move around keyframes, curves, and whole groups of curves. The Dope Sheet also has a Dopesheet Summary line, which selects all the keyframes of the selected objects for editing. Alternatively, you can open the summary to select all of the specific keyable attributes of the selected objects for editing. For example, you can select the Move tool, select all objects in the modeling window, select the Dopesheet Summary in the Dope Sheet, and move all the keyframes for the entire scene. You can also open the Dopesheet Summary, select Rotate, and then move only the rotation keyframes of all the selected objects in the scene.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (6 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
Editing Keys in the Channel Box Key editing in the Channel box works the same as in the Graph Editor or the Dope Sheet, except that you don t have access to the option boxes. The Cut, Copy, Paste, and Delete functions, when they are RM chosen inside the Channel box, are performed with the default settings. Note The difference between Delete and Cut is usually not significant, but it is worth knowing. Cut puts the keyframes into the Clipboard. Delete simply deletes. If you have keyframes in the Clipboard that you want to keep, use Delete to remove animation from the selected attributes so that you don t replace the Clipboard items.
Using the Keys Submenu You can access several key-editing functions by selecting Edit Ø Keys. The functions on this submenu work differently from those with the same name in the Graph Editor, and it s important not to confuse these functions. The functions in the Keys submenu edit keyframe curves at the object level. They are used mainly to transfer animation curves between objects. Cut Keys and Copy Keys have the same option settings. Select Edit Ø Keys Ø Copy Ø to open the Copy Keys Options dialog box. The Hierarchy setting Selected copies only the animation curves of the selected object. The Below setting copies all the curves of the object plus all the objects below the hierarchy of the selected object. You can also control the time range of the curves being copied by clicking Start/End and typing values in the Start Time and End Time boxes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (7 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
The Paste options are the same as the Graph Editor s Paste options. If you copy animation curves from a hierarchy, you can paste them into the same hierarchy as well as into other hierarchies. Tip You can cut or copy curves from multiple objects. The objects selection order is important in this case because the curves are copied in the same sequence. Also, when you are pasting to multiple objects, their selection order needs to be the same as the order in which the objects were selected for the Copy Keys function.
Working with the Time Slider The time slider has several key-editing functions, which you can access by RM choosing them. When you select an object that has keyframes, the time slider displays key ticks red vertical lines showing where keyframes are in the time slider. (Breakdowns are displayed as green ticks.) By Shift+clicking and dragging, you can select a frame, or a range of frames, which is displayed in a red block with arrows at the start, in the middle, and at the end of the block. You can then move the frame or frame range by dragging the arrows in the middle of the block, scale it by dragging the arrows at the side, or edit it by selecting the functions with RM choose.
The Cut, Copy, Paste, and Delete functions are the same as those in the Graph Editor, without the options. The Paste function has Connect set to Off. The Paste Connect function works like the Graph Editor s Paste with the default settings.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (8 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=995735073 (9 of 9) [11/27/2000 8:36:44 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Working with Breakdowns Here is a short exercise to clarify how breakdowns work in Maya 2. 1. Create a sphere and keyframe it in the X axis at frame 1. 2. Translate it in the X axis to 5 at frame 20, and 0 again at frame 30, setting breakdowns. You can set breakdowns by RM choosing in the Channel box or by selecting Animate Ø Set Breakdown. Everything should be the same as if keyframes were used, except that the ticks in time slider are red at frame 1 and green at frames 20 and 30, as shown in the next image.
3. Set a keyframe at frame 10 with the X-axis translation value of 10. 4. Open the Graph Editor, select the keyframe at frame 10, and try moving it to frame 15. Note that the breakdowns at frames 20 and 30 move as well, maintaining their curve shape with respect to the keyframe being moved. This is what is meant by breakdowns being bound by keyframes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=586197744 (1 of 2) [11/27/2000 8:36:52 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=586197744 (2 of 2) [11/27/2000 8:36:52 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-on Maya: Setting a Driven Finger In some cases, when one object s attributes change, another object is affected accordingly. For example, consider the way that fingers fold: Whenever the second joint of a finger folds, the third joint generally folds as well. Or whenever a button is pressed, a light may be turned on or a door may open. It would be nice if you could make such processes automatic. The Set Driven Key tool enables you to do this kind of thing.
You can open the Set Driven Key window from the Channel box, Attribute Editor, or Animate menu (select Animate Ø Set Driven Key Ø Set Ø). Its function is to link attributes to each other in a master-slave relationship. The attributes that influence the other attributes are called driver attributes; the ones that are influenced are called driven attributes.
Using One Driver Attribute
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=447325239 (1 of 5) [11/27/2000 8:37:05 PM]
Books24x7 Mastering MAYA Complete 2
Let s try a simple tutorial to see how this works. For this example, we ll use three spheres to represent finger joints and have one of the sphere s rotation drive the other two spheres rotation (whenever nurbsSphere1 rotates in the X axis, nurbsSphere2 and nurbsSphere3 also will rotate in the X axis). 1. Create a torus. Set its values as follows: Translate
(0, 3, 0)
Scale
(1, 4, 1)
Sections
1
Spans
1
Minor Sweep
180
2. Select Move, then press Insert to get into the pivot mode. X+drag the pivot to the origin. Your torus should look something like the one shown below.
3. Duplicate the torus twice. Move one copy to (0, 9, 0), and the other to (0, 15, 0). 4. Create three spheres. Place them at (0, 0, 0), (0, 6, 0), and (0, 12, 0). We ll pretend this is actually a finger, with the spheres being the finger joints. 5. Select All in the modeling window, then select Modify Ø Freeze Transformations. In the Hypergraph window, group the objects into the hierarchy shown below (note that the torus s pivots match the spheres pivots).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=447325239 (2 of 5) [11/27/2000 8:37:05 PM]
Books24x7 Mastering MAYA Complete 2
6. Drag to select all the objects in the modeling window. Then, in the Channel box, select any attribute and RM choose to open the Set Driven Key window. 7. Click Load Driver and Load Driven. All the toruses and spheres are loaded in both the Driver and the Driven lists. We want nurbsSphere1 to be the driver, so select that in the Driver list. You see the default keyable attributes appear in the box on the right. 8. Ctrl+click nurbsSphere2 and nurbsSphere3 in the Driven list to be the driven objects. The default attributes representing both spheres appear in the box on the right. 9. Select rotateX in the Driver and the Driven lists, as shown below, then click Key.
Notice that the nodes for the two driven spheres are now diagonal shaped, indicating they have animation. But there are no red ticks showing in the time slider, because there are no explicit keyframes. If you select either one, you will see in the Channel box that Rotate X field has become shaded as well.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=447325239 (3 of 5) [11/27/2000 8:37:05 PM]
Books24x7 Mastering MAYA Complete 2
10. Select nurbsSphere1 and rotate it in X 90 degrees. Rotate nurbsSphere2 100 degrees in X. Rotate nurbsSphere3 90 degrees in X. Click Key in the Set Driven Key window again. Now select nurbsSphere1 and try rotating it in X. You will see the other two spheres rotating as well. 11. Select nurbsSphere2 and nurbsSphere3 and open the Graph Editor. You will see curves representing the way nurbsSphere1 drives the other two spheres, as shown below. Because the values before the first key and after the last key are constant by default (as explained earlier in the chapter, in the section about using the Graph Editor), when you rotate nurbsSphere1 to a negative value or a value greater than 90 degrees, the other two spheres will remain at zero, or at 100 and 90 degrees, respectively.
12. If you want the driven sphere values to keep changing when the driver sphere values become less than zero or greater than 90, select the curves in the Graph Editor and select Curves Ø Pre Infinity Ø Linear. Then select the curves and select Curves Ø Post Infinity Ø Linear. Now when you rotate nurbsSphere1 in the X axis to any value, the driven spheres will update accordingly. As you can see from this tutorial, using Maya s Set Driven Keys feature is not difficult at all. In our example, one driver sphere was driving two spheres.
Using Multiple Driver Attributes You can also have one attribute be driven by two or more driver attributes. For example, suppose that we want the second joint of our finger to bend with the first joint while the third joint remains straight or even bends the other way (such as what happens when you snap your fingers). Let s try using multiple driver attributes. 1. Continuing with the scene we were working on in the previous section, select nurbsSphere1 and set the rotations to (0, 0, 0). 2. Create another sphere and translate it to (0, 18, 0). Its name should be nurbsSphere4. Group it under nurbsTorus3 in the Hypergraph window, as shown below. Keep it selected, and select nurbsSphere3 as well.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=447325239 (4 of 5) [11/27/2000 8:37:05 PM]
Books24x7 Mastering MAYA Complete 2
3. Open the Set Driven Keys window. Click Load Driver and Load Driven. Select nurbsSphere4 in the Driver list and nurbsSphere3 in the Driven list. Select rotateX for both. Click Key. 4. Select nurbsSphere in the modeling window and rotate it 90 degrees in X. Do the same with nurbsSphere3. In the Set Driven Key window, click Key again. 5. With nurbsSphere3 still selected, go to the Graph Editor. You can see two curves under the nurbsSphere3 attribute for Rotate X. These are the two driver attributes from nurbsSphere1 and nurbsSphere4. Select the nurbsSphere4.rotateX curve and assign linear extrapolation for the pre-infinity and post-infinity curves.
6. Select nurbsSphere1 and rotate it in X 50 degrees. Then select nurbsSphere4 and rotate it to 100 degrees. Notice how the rotation value of nurbsSphere3 changes as it averages its two driven values and rests at 50 degrees in X. The finger is ready for snapping.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=447325239 (5 of 5) [11/27/2000 8:37:05 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 10 - Animating in Maya Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we covered the basic concepts of keyframe animation and the tools Maya offers for creating and editing keyframes. Some of the interfaces are more challenging than others, especially the Graph Editor if you are not familiar with function curves. It is the Graph Editor, however, that you will come to love using as you become more familiar with animating in Maya. The next few chapters are going to be quite challenging, so take a break before you continue.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=384107337 [11/27/2000 8:37:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 11 - Paths and Bones Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 11: Paths and Bones Overview In this chapter, we will continue our examination of animation in Maya by exploring path animation and skeleton construction. Our examples include a chair drifting at sea and a camera following it, a dummy human being built with a skeleton and spheres, and a hierarchy of nodes to set up the dog model (built in Chapter 8) for binding and animation.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=831876303 [11/27/2000 8:37:13 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 11 - Paths and Bones Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Path Animation Path animation is essentially animating objects along a designated path such as a curve. This type of animation is ideal for animating things like roller coasters, ships, and moving cameras.
Attaching an Object to a Path For path animation, you attach an object to a path. To see how this works, let s try creating a simple path animation. 1. Create a curve and a cone, as shown below. Make sure that the time slider range is at 48 frames.
2. With the cone still selected, select the curve as well, then select Animate Ø Paths Ø Attach to Path Ø. Click Reset to make sure you re using the default settings, then click Attach. You should see the cone snap to the beginning of the curve. Try scrubbing through the frames (by dragging the mouse across frames in the time slider) and watch how the cone moves. 3. Under Inputs, you will see motionPath1. Click it, and you will see the U value, which is 0 at frame 1 and 1 at frame 48.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (1 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
4. Go to frame 15 and check that the U value is 0.298. MM drag the current time indicator back to frame 1. The U value should still be reading 0.298. Click the U value, then RM choose and use Key Selected to keyframe that value at frame 1. Now the starting point has changed to U value 0.298, and the cone travels only about 70 percent of the curve from frame 1 to 48.
5. Open the Attribute Editor and click the motionPath1 tab. Change the settings to Follow and World Up. Make sure that X is set as Front Axis and Y is set as Up Axis. Scrub the timeline on the time slider and see how the cone moves differently. Change Front Axis to Y and Up Axis to Z and see how this affects the cone s movement.
Now that you have an idea how path animation works, we ll try a more complex exercise next.
Making an Object Float In this tutorial, we will create a short animation of a chair floating at sea. (You can find a finished version on the accompanying CD; it s named cam_anim.mov.) In addition to exploring further how to use path animation, we will also introduce using cameras and previewing in Maya.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (2 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
1. Open the living room scene you created in Chapter 5, and select the chair group node. Rename it to Chair. Make sure that the cushion is at the bottom of the hierarchy, then select File Ø Export Selection and save the file as Chair.mb. (You can also find this file on the CD.) You ve just exported only the chair hierarchy into a new file. Tip Maya s default Export function exports everything associated with the model(s) being exported, including its history, expressions, and animation. If you want to export only the model, turn the other settings off in the option box. 2. Start a new scene, create a NURBS plane, scale it to 100 uniformly, and increase the Patch UV spans to 30. 3. Switch to the Modeling module. Select Edit Surfaces Ø Sculpt Surfaces Tool Ø and click Reset Tool. Switch to the Map tab and load in the Wave.tif file from the CD-ROM. You will see the plane become wavy, but it s not wavy enough. Click the Reload button three more times. Each time you will see the waves become more pronounced, as the displacement is compounded.
Note If you want to create the Wave.tif file yourself, create a plane and open the Hypershade window. Assign a blinn material with the water texture, and manipulate the variables until you see something like the Wave.tif file. Use the Edit Ø Convert Material to File Texture command, then convert the .iff file to .tif format using Fcheck. See the discussion of Hypershade in Chapter 19 for details on shading and texturing surfaces. 4. Go to the top view and create a simple curve near the middle of the wavy plane. Select both objects and create a curve on the surface by selecting Edit Surfaces Ø Project Curve on Surface, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (3 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
5. Hide the curve (make it invisible). It s better not to delete anything until you are sure you no longer need it; in this case, you may want to adjust the curve on surface later when animating the camera. Import the Chair.mb file into the scene. 6. Set the time slider range to 240 frames. Select the top hierarchy of the chair, then select the curve on surface. Switch to the Animation module and select Animate Ø Paths Ø Attach to Path, with the default settings. 7. Open the Attribute Editor and go to the motionPath1 tab. Click Follow and set Up Direction to Normal. Try different settings for Front Axis and Up Axis until the chair is sitting upright. (It should be X for Front Axis and Y for Up Axis, but you may end up with different results.) Your scene should look something like the one shown next.
Warning When you re using curves on surface as the path, using the Normal for Up Direction setting works well, because it makes the attached object s Up direction the surface s normal. However, when you re using regular curves as the path, the Normal setting does not work as well, because a curve s normal will reverse if the curve s path goes from convex to concave. The attached object, therefore, may end up flipping as it animates along the curve.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (4 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
Moving the Chair The chair is a bit too low in the water, but if you try to move it, it will snap back when you scrub the time slider because it s attached to the path. You can move the node below the top hierarchy to move the chair up, which would actually be the best solution, because the node below the top hierarchy isn t constrained to the path. However, for this tutorial, we will try to move the top node up. 1. Select the top Chair node, and press Insert to show the pivot manipulator. Drag the Y-axis handle down, and you will see the chair go up. This is because the pivot is constrained to the path.
2. Press Insert again to turn off the pivot manipulator. Select the node that is one below the top Chair node and check to make sure its Y rotation value is 0 in the Channel box. Then use Key Select at frame 1. Move to frame 240, enter 360 for Y rotation, and keyframe it. 3. Now as you scrub the animation, the chair should slowly rotate as it floats along the curve on surface. Preview the animation to see how the chair moves.
Animating the Camera The chair seems to be floating, but the water isn t moving. We can make it seem like it is by animating the camera. 1. In the Perspective window, select Panels Ø Perspective Ø New to create the Persp1 view. This will be our animated camera. 2. With the Persp1 camera still selected, zoom in to the curve on the surface and Shift+select it. Select Animate Ø Paths Ø Attach to Path Ø. Check Follow, X for Front Axis, Y for Up Axis, and Normal for Up Direction. Click Attach. 3. Switch to perspective view and press F to center in on the Persp1 camera. You should see the camera positioned as on the next page.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (5 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
4. As you can see, the camera isn t looking exactly where it should be, and it should also be a bit behind the chair. Click motionPath2 in the Channel box, and you will see the Front Twist, Up Twist, and Side Twist input variables. Select them one at a time and try MM dragging in the modeling window to see what effect each has on the camera. Tip If the Twist attributes are grayed out, you probably attached the camera to the curve on surface a bit differently. This isn t a problem. Just select the grayed out areas, RM choose, and select Unlock Selected to unlock the attributes and make them keyable. 5. Return the Front Twist and Side Twist values to 0, and set the Up Twist value to camera should now be looking along the curve.
90. The
6. Select the curve on the surface. In the Channel box, select motionPath1. This is the path animation for the chair. Go to frame 60, then MM drag the current time indicator back to frame 1. Select the U value, which should be at 0.247, and keyframe it. If you scrub the timeline now, the chair should start in front of the camera, as shown in the top picture of the next illustration.
7. Select motionPath2. This is the path animation for the Persp1 camera. Go to frame 200, then MM drag to frame 240. Select the U value again, which should be at 0.8333, and keyframe it. Now the camera should finish behind the chair at the end of the animation, as shown in the bottom picture above.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (6 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
8. The only thing that remains for us to do is to adjust the height of the Persp1 camera. It s sitting too low on the surface plane. Go to Four Views layout, and make one window Persp1 camera view and another one the perspective view. 9. Select the Persp1 camera in the perspective view, select the Move tool, and press Insert to display the pivot manipulator. Grab the Y-axis handle and push it down to make the camera move up. You should scrub the timeline back and forth to come up with the ideal height for the camera. You may even want to move the chair farther away from the camera. 10. When you are satisfied with the camera view, use Playblast, as described in the next section, to see how everything looks. Save the scene as Wave.mb. You may want to use it again later to try texturing the water and the sky.
Previewing and Playblasting When you are previewing an animation, before you click the Play button, you should make the active viewing window as small as you can without losing important details. Select the Four View window setting, then drag the active window to a smaller size. If you can see the animation well in wireframe, then by all means, preview it in wireframe. In the Shaded mode, make the NURBS display Rough (Display Ø NURBS Smoothness), or in the modeling window, select Shading Ø Flat Shade All. Check whether you can still preview the animation clearly. Press Alt+V to play. Press Alt+V again to stop. For most of your animation projects, viewing the animation in real-time or near real-time will not be possible with the Play Control buttons because the scene will be too heavy (built with too much geometry) for that. Maya provides a quick way for you to view these scenes as movie clips or picture sequences. Select Window Ø Playblast Ø, click Reset, adjust your time slider range to about 30 frames for testing purposes, then click Playblast. Maya quickly captures the active window view for the duration of the timeline and makes an .avi movie clip in your C:\Temp directory. This movie clip will be deleted automatically when you exit Maya. Many of the Playblast options are self-explanatory, but a few are not so straightforward: "
The default compressor for the movie player is the standard Microsoft Video 1, which you can change to suit your computer s own capacity by clicking the Compression button.
"
Instead of using the From Window setting for Display Size, you can have a Custom setting set to 320∞240 or something similar in ratio, with Scale set to 1.0, to gain more control over the area of your active window that is captured.
"
If you check Fcheck, picture sequences are created instead of a movie clip. The Fcheck setting enables you to acquire wireframe renders for your model turnarounds in minutes. You can save the .iff picture sequences into any directory by using the Save to File setting, or convert them to other image formats using Fcheck s Save Animation option.
Making the Camera Move In this next brief tutorial, we will set up a moving camera attached to a path that can still remain focused on an object. We will continue working with our floating chair.
Animating Waves
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (7 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
Open the scene you ve just finished. The surface plane is wavy, but is not moving. Let s create some animated waves on it. 1. Select the plane and choose Deform Ø Nonlinear Ø Wave to apply Wave deformation to it (see Chapter 12 for more information about Maya s deformers). 2. Translate the waveHandle node to ( 100, 0, 100) and scale it to 300 uniformly. 3. Set the Amplitude wave property to 0.005 and the Wavelength property to 0.1. Leave the other properties at their default values. 4. Keyframe translate X at frame 1. Keyframe again at frame 240 with the X value at
60.
The waves look more realistic now. The surface still needs smaller ripples, but that s a texturing matter (see Chapter 19 for details on texturing techniques).
Adding a Three-Node Camera Now we can use path animation with a three-node camera to get the proper effect. The default camera Maya creates is a single-node camera, which is what the perspective view is. A two-node camera also has a camera_view node, which determines the camera s center of interest. A three-node camera has an additional camera_up node as well. 1. Create another simple single span curve above the surface to act as the camera path, as shown below. Observe carefully where the CVs are placed in relation to the floating chair. The CVs have been positioned so that the camera will be able to follow the chair from behind and up at an angle.
2. Select Create Ø Camera Ø. At the bottom of the option box, click the Three for Nodes setting. Click Create. 3. Select the camera_group node and then select the curve. Use the Attach to Path function with the Follow and World Up settings checked.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (8 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
4. Select the chair, then Shift+select the camera_view node, and select Constraint Ø Point. The camera_view should now be constrained to the chair (constraints are discussed in detail later in this chapter). 5. Scrub through the animation in camera view. You may find that the upper-right edge of the surface plane is visible for a few frames. You can fix this by going into the motionPath2 properties and rotating the Front Twist setting. 6. Use the Playblast function to see how the curve moves. You may need to tweak the curve to make the camera view stay inside the surface plane.
As you ve seen in these floating chair examples, path animation is relatively easy and can be useful when you want your animation to follow a particular route. Now we will turn to the more complex techniques of skeletons and kinematics.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=460644377 (9 of 9) [11/27/2000 8:37:24 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 11 - Paths and Bones Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Skeletons and Kinematics With skeletons, we are entering the realm of advanced character animation. Using skeletons at a basic level is very easy in Maya, but it can also become very complex.
Skeleton Concepts As in the song that goes The knee bone is connected to the hip bone&, everyone knows that bones are connected and that together they make up a skeleton. A skeleton is a protective structure that houses the vital organs of animals, maintains their shape, and enables them to move about. There are no vital organs in a digital character to protect (not yet anyway), but Maya does provide joints, which enable us to animate characters efficiently and maintain or deform their shapes properly.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (1 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
Skeletons are built with bones and joints. Using the Skeleton Ø Joint Tool, you click to place joints in the modeling window, much as you would edit points for a curve, and the joints are connected by bones. In building skeletons, it s good to know the kinds of joints you can create: "
A Ball joint can rotate in all three axes, like the neck bone. This is the default Joint tool setting.
"
A Universal joint can rotate in two axes, like the wrist bone.
"
A Hinge joint can rotate in only one axis, like the knee bone.
It s better to limit the joints you create according to their functions, because it means more efficiency in your animation and fewer calculations for Maya to perform.
Forward Kinematics Forward Kinematics works well for free rotational motions such as a character s arms swinging when she walks or her spine rotating when she turns. Your main concern with Forward Kinematics is setting up the joints correctly for animation. Let s use the Joint tool to build a human skeleton (a very simple one, of course).
Building a Leg We will begin by building our skeleton s leg. We need to place leg, knee, and foot joints. 1. Select Skeleton Ø Joint Tool Ø. Click Reset Tool to set all the options to their defaults, then check Auto Joint Limits. 2. Go to side view and X+click the joints, as shown below. At any time during the creation of these joints, you can MM drag to adjust the position of the last joint you created, or you can use the Up arrow key to go back to other joints as well. (Note that if you go back up a few joints and click with the left mouse button, you will get another bone branching out of the joint.) When you ve created all the joints, press Enter to complete the action.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (2 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
Note You can use the Move tool to move joints you ve created. If you select a joint and move it using the Move tool, the joints below its hierarchy will move with it. If you select the Move tool and then press Insert to show the pivot manipulator and move the pivot, only the selected joint will move. You can also use Maya s other tools to edit the joints you ve created (or are in the process of creating) to Insert, remove, connect, and disconnect joints, and even to reroot a skeleton. These are all straightforward, easy-to-use functions on the Skeleton menu. 3. Name the joints as Lleg, Lknee, and Lfoot (L is for left). We don t need to worry about the last joint in the chain. 4. Go to the perspective view, select the knee joint, and try rotating it. You ll see that you can only rotate it in the Z axis, and that there is a limit to the Z rotation. The Auto Joint Limit setting creates a Hinge joint, which will not rotate past its parent joint or bend away from it more than 180 degrees. It works well here with the knee.
There are a couple of important things to observe here. The bones were created at an angle, not in a straight line, because the angles between the bones determine which way the bones will bend. Also, the default joint orientation in Maya is XYZ. This means that when a joint is created, its local X axis points into the bone, the Y axis points toward the bending direction, and the Z axis is perpendicular to the bending direction. You can display a joint s local rotational axes, as shown on the next page, by selecting Display Ø Object Components Ø Local Rotation Axes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (3 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
When joints are created with the default setting, Z-axis rotation will always bend the bones, and Y-axis rotation will rotate them from side to side. A corollary of this is that the window in which you decide to build the joints is important. You should figure out how you want the bones to bend, then build them accordingly in the proper window.
Mirroring Joints Now we can use mirroring to create the other leg. Because joints behave differently from regular object nodes, we need to use the Mirror Joint function to duplicate the right leg symmetrically. 1. Select the foot joint and open the Attribute Editor. The foot, unlike the knee, can rotate in the X axis as well as the Z axis. Under the Joint section, for the Degrees of Freedom setting, click X. 2. Move the leg hierarchy to (2, 0, 0). Then select Skeleton Ø Mirror Joint Ø, select YZ as the setting, and click Mirror. Note The rotational limit information should copy into the mirrored joints as well, but you may find that they are not activated. If this happens, go into the Attribute Editor and activate them the numerical information is already there. If some of the Rotate fields are grayed out but the joint is still rotating, click twice on the Degree of Freedom boxes to activate the lock. Also, if you find that the joints are not being mirrored properly, you can group them under another joint, mirror them, and then ungroup them. 3. Try rotating the left and right knee together. They should be rotating like mirror images of each other, as shown next.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (4 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
4. Name the mirrored joints as Rleg, Rknee, and Rfoot.
Building the Rest of Human Skeleton We ll quickly go through the steps for adding the spine and shoulder hierarchy of joints. 1. Go to the side view and create the spine chain with the default Joint Tool option settings, as shown below. The spine joints need to be Ball joints.
2. From the top view, create the left shoulder chain, as shown above. (Remember that we re creating a very simple skeleton.) 3. Name the spine hierarchy as waist, chest, neck, and head. Name the shoulder hierarchy as Lshoulder, Larm, Lforearm, and Lhand. We don t need to worry about the last joint in the chains. 4. In the front view, translate the shoulder chain up until it s a little below the neck bone.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (5 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
5. In Hypergraph or the Outliner, group the legs under waist, and the Lshoulder chain under chest. You should see something like the hierarchy and picture shown below.
6. To put rotation limits on the shoulder joints, open the Attribute Editor and select the Lshoulder joint. The shoulder does not need to rotate in the X axis, so turn off X in the Degrees of Freedom setting. We want the Larm to rotate like a Ball joint, so don t change its settings. The Lforearm is a Universal joint that cannot rotate in the Y axis, so turn off Y. The Lhand is also a Universal joint that can t rotate in the X axis, so turn off X. 7. For these joints and others, you can also set specific minimum and maximum rotational limits. Let s do this for the Lforearm as an example. Select the Lforearm. In the Attribute Editor, open the Limit Information, Rotate attribute. You ll see three Rot Limit fields, with Y rotation grayed out. Put checks in the four Rot Limit X and Z boxes, and the Min and Max fields become unlocked. 8. In the top view, try rotating the Lforearm in the Z axis. When it s straight, the current degree reads about 28, so put in 30 for the Min value. When it starts overlapping Larm, the degree is around 137, so put in 130 for the Max value. 9. For the X rotation, let s assume the palm is facing straight down. In this case, Lforearm should be able to rotate about 90 degrees to make the palm face front, and about 45 degrees the other way. Enter those values for the Min and Max fields.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (6 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
Tip There are limits for Translate and Scale as well, which you may sometimes want to use. Maya also has Rotation Limit Damping settings, which allow the joints to ease in and ease out of the rotation limits. 10. Select the Lshoulder joint and mirror it. You should now have a complete, albeit very simple, human skeleton. 11. Scale, rotate, and translate the spheres to their positions and group them to their respective joints in the Outliner or Hypergraph. It s not all that important exactly how the spheres are shaped or where they are placed, as long as they roughly represent the body parts being controlled by the individual joints. The final dummy human is shown on the next page. Save this scene as Dummy_human.mb. You can try skinning and animating it later.
Reorienting Local Axes of Joints
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (7 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
To gain precise control over how the joints rotate, you need to know how to reorient joints. In the skeleton you ve just created, let s say you ve translated the shoulder joint down one unit using the pivot manipulator. If you display the local rotation axes, you will see that the X axis is no longer pointing directly into the bone s center. It s off about 24 degrees. To reorient the X axis, select the Rotate tool and switch to the component mode. RM choose the question mark button (Miscellaneous) and check Local Rotation Axes, then select the shoulder joint. You can rotate the Y-axis handle in the front view until you see the X axis pointing directly into the shoulder joint. You can also enter precise rotational values by typing in a MEL command in the Command Line field; for example, type rotate r os 0 24 0 to relatively rotate the local axes 24 degrees around the Y axis. For those interested in MEL commands, there is also the joint e oj xyz zso command, which reorients the local axes of a joint automatically. But be careful how you use this command, because it may destroy the mirror properties of symmetrical hierarchies.
Animating the Dummy Human As noted earlier, using Forward Kinematics mainly involves setting up the joints the right way. Now that we ve created and grouped the joints and applied the proper limits to them, all we need to do is transform the joints and keyframe them. Work on the top hierarchy first, then move down to the lower joints until you achieve the poses you desire.
Inverse Kinematics For goal-oriented motions, such as having a character plant her feet on the ground or reach out her hands and open a door, you need to animate using Inverse Kinematics (IK).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (8 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
Inverse Kinematics involves IK handles and IK solvers. An IK handle runs through the joints being affected. The joints being affected are called the IK chain, and a handle wire runs through them. A handle vector starts from the start joint and finishes at the end joint, where the IK handle s end effector is located.
An IK solver looks at the position of the end effector of an IK chain and performs the necessary calculations to make the joints rotate properly, from the start joint to the end joint of the IK chain, in such a way that the end joint will be where the end effector is. When the end effector moves, the IK solver converts the translation values of the end effector to the rotation values for the joints, and the joints update accordingly. Maya s interface has three kinds of IK solvers: the ikRP (Rotate Plane) solver, the ikSC (Single Chain) solver, and the IK Spline solver. Each type of IK solver has its own type of IK handle.
Using the ikRP Handle
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (9 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
Since the ikRP solver is the default setting for the IK Handle tool, let s see how that works first. In the side view, draw a simple joint chain (as in the inset on the upper left shown below). Select Skeleton Ø IK Handle Tool Ø, and reset the tool to its default settings. Click on the first joint, then click on the last joint. You should see that an IK handle has been created. The circle at the top looks complicated (as in the inset below), but it s actually a fairly simple setup, once you ve learned what its components are.
The ikRP solver calculates only the positional value of the end effector, which means it ignores the rotational values of the end effector. The joints are rotated by the ikRP solver in such way that their Y axes are planar, their X axes are pointing to the center of the bones, and their Z axes are perpendicular to the bending direction. This is the default local orientation set up for joints. If you do not see the rotate disc, select the end effector and press the T key to display the Show Manipulator tool. The plane along which the joints are bending is represented by the plane indicator. The plane itself is called the joint chain plane. You can rotate this plane about the handle vector using the twist disc, which rotates the IK chain. The Twist degree is measured relative to a reference plane created by the handle vector and the pole vector, which can be translated and keyframed. Warning At times, the way you want the arm to bend will cause the IK chain to flip with the default reference plane setting. To avoid this flipping, adjust or animate the pole vector. Open the Attribute Editor for the ikRP handle. The Snap, Stickiness, and Solver Enable settings are discussed in the Switching between Inverse and Forward Kinematics section, following the discussion of the ikSC handle. The advantage of using the ikRP handle over the ikSC handle, discussed next, is that you can get more precise control over the rotation of the IK chain. The disadvantage is that it necessarily has more components to deal with.
Using the ikSC Handle
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (10 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
The ikSC handle is simpler than the ikRP handle. To experiment with it, go to the side view and draw another simple joint chain. Select Skeleton Ø IK Handle Tool Ø as before, but this time, select the ikSC solver setting, then close the option box. Click on the first joint, then click on the last joint, and you will see the ikSC handle. If you press T to display the Show Manipulator tool, you will see nothing, because there are no extra manipulators for the ikSC handle everything is controlled by the end effector. Select Rotate and try rotating the end effector. You will notice that only the local X and Y rotate handles seem to have any effect, and that they snap back to certain angles after you release the handles. The ikSC solver calculates the rotational values of the end effector and rotates the IK chain in such way that all the joints in the chain will have the default local orientation for joints. The joint chain plane exists in the ikSC solver, although you do not see any representation of it in the handle.
Open the Attribute Editor for the ikSC handle. The ikSC handles can have a Priority assignment when there are two or more chains overlapping. The handle with the Priority 1 setting will rotate the joints in its chain first, next the handle with the Priority 2 setting will rotate its joints, and so on. The Po Weight setting determines the handle s position/orientation weight. If the weight is 1, then the end effector will try to reach only the handle s position; if the weight is 0, the end effector will try to reach only the handle s orientation. You should leave this setting at the default value of 1. The Snap, Stickiness, and Solver Enable settings are discussed in the next section. The advantage of using the ikSC handle is that you only need to use the end effector to control the IK chain. For situations where you do not need a great amount of IK chain rotations, this would be the more economical method of animating. Tip When you are using the ikSC handle to rotate IK chains, use the Graph Editor to interactively adjust the rotational values. It produces most predictable results. See Chapter 10 for more information about the Graph Editor.
Switching between Inverse and Forward Kinematics Maya allows you to switch back and forth between using ikRP or ikSC handles and rotating joints (forward kinetics). It s easy to do, and you may find it useful. Let s go through the technique using the ikSC handle we created in the previous section. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (11 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
1. Go to frame 1 and turn on Auto Key. Without this setting, the process becomes cumbersome. 2. Keyframe the end effector, move to frame 10, and translate the end effector. You should have another keyframe automatically set. 3. In the Attribute Editor, turn off Solver Enable to locally turn off the ikSC solver for this handle. 4. Select the two joints in the IK chain and keyframe them. Go to frame 20 and rotate the joints. Go to frame 30 and repeat the action. 5. Select the ikSC handle again. In the Attribute Editor, turn on Solver Enable to turn on the ikSC solver. You will find that the end effector acquired the keyframes for frame 20 and 30 in the same positions where the joints were keyframed. In order for this switch to be possible, you need to have the end effector s Snap setting on and Stickiness off in the Attribute Editor. If Snap is off or Stickiness is on, then the end effector will not snap to the end joint when the joints are rotated. One more thing to be aware of in switching back and forth between inverse and forward kinetics is that the movements generated by the rotation of the joints and the corresponding keyframes of the end effector will not always match. They will roughly be the same, but you may need to tweak the end effector s animation.
Using the IK Spline Handle While the ikRP and ikSC handles are similar in their attributes, the IK Spline handle is quite different in the way that it functions. The IK Spline solver takes a NURBS curve as part of its handle and rotates the IK chain to follow the shape of the curve. The CVs of the NURBS curve, rather than the end effector of the handle, are animated. The IK Spline handle is ideal for animating curvy or twisty shapes, such as tails, spines, snakes, or tentacles. Let s try out this last type of IK handle. 1. In the side view, build a joint chain, as shown below. For IK Spline handles, the joints need not be built at an angle, but the bones should be short to ensure the chain will move smoothly.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (12 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
2. Select Skeleton Ø IK Spline Handle Tool Ø and check Number of Spans 4. Leave the other options set to their defaults and close the option box. 3. Click on the top joint, then click on the last joint, and you will see the IK Spline handle. 4. In the Outliner, select the joint chain or the IK handle and try moving the joints. The joints have become attached to the curve, and the IK handle doesn t show a manipulator. 5. Display the CVs and move them around, as shown below.
Note You can also create your own NURBS curve and have the IK Spline handle use that curve. Turn off the Auto Create Curve setting in the IK Spline Handle option box. Click on the root joint, the end joint, and then the curve to create the IK Spline handle. 6. Open the Attribute Editor for the IK handle. You ll see the regular attributes and some specifically for the IK Spline handle. Try typing in numbers for the Offset, Roll, and Twist settings. Offset translates the joint chain along the curve, with 0.0 as the start of the curve and 1.0 as its end. Roll rotates the whole joint chain. Twist gradually twists the chain from the second joint on. If the Root Twist Mode is turned on, then the twist begins from the root joint. The Root on Curve setting constrains the root joint to the start of the curve. Turn it off, and you can move the root joint off the curve, but note that it is still constrained to the curve. As we have seen, skeletons can be moved and rotated with Forward Kinematics or Inverse Kinematics to animate various parts of a character. In addition to the IK tools, Maya provides the Constrain menu in the Animation module. The functions in this menu are often used in conjunction with the IK tools to set up a character for animation.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307137614 (13 of 13) [11/27/2000 8:37:44 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 11 - Paths and Bones Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Constraints Objects in real life are constrained in many different ways. For example, if you are holding a baseball, when your hand moves and rotates, the ball moves and rotates with it, because the ball is constrained by your hand movements. As another example, consider a tennis player, whose eyes are always looking at the tennis ball. If you wanted to imitate these actions in Maya, it would be difficult and time-consuming to try to reproduce the motions of the baseball or the eyes by keyframing them. Instead, you can use constraints to automate such animation tasks. Let s briefly go over the constraints in Maya. Under the Constrain menu, Maya has the standard Point, Aim, Orient, and Scale constraints. In addition, it also has Geometry, Normal, Tangent, and Pole Vector constraints. All the constraints work in the same way. You select two or more objects, then select the constraints you want to apply. The first objects you select act as the targets that constrain, and the last one is the object being constrained. When you select more than one constraint target, the constrained object is shared between the targets according to their weights.
Point Constraint The Point constraint makes the center of the constrained object stick to the center of the target object. When there is more than one target, the Point constraint places the object being constrained at a point between the targets pivot points, with the placement determined by the average value of the weights of the targets.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=638431028 (1 of 4) [11/27/2000 8:37:55 PM]
Books24x7 Mastering MAYA Complete 2
Tip Maya also has a Point on Curve Locator constraint (Deform Ø Point on Curve Locator), which creates a locator at a selected point on curve or an edit point. This constraint makes the locator position constrain the curve at that point, without breaking the curve s tangency.
Aim, Orient, and Scale Constraints The difference between the Aim and the Orient constraints can be a bit confusing. The Aim constraint creates an Aim vector (the default setting is the X axis of the object), which points the object being constrained to the position of the Aim target, as shown below. In the example on the right, with two tori, notice the tilt toward the torus on the right. This is because that torus s weight input is 1, while the other torus s weight input is 0.7.
The Orient constraint causes the rotation values of the object being constrained to be the same as the rotation of the Orient target. In the example on the right below, the cone has the average rotation value of the tori.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=638431028 (2 of 4) [11/27/2000 8:37:55 PM]
Books24x7 Mastering MAYA Complete 2
Aim constraints are especially useful for quickly making a character look at, or focus on, different objects. Orient constraints are great for controlling joints. The Scale constraint functions the same way as the Orient constraint. The object being Scale constrained has the same scale values as the target object, or the average scale values of the target objects.
Geometry and Normal Constraints The Geometry constraint makes the center of the constrained object stay on the surface of the target object. It doesn t lock the attributes of the constrained object, allowing it to slide along the target surface. The Normal constraint acts much like the Aim constraint. The difference is that the aim vector of the object being constrained aligns itself with the normal vector of the surface that passes through the constrained object s center.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=638431028 (3 of 4) [11/27/2000 8:37:55 PM]
Books24x7 Mastering MAYA Complete 2
Tangent and Pole Vector Constraints The Tangent constraint aligns an object s aim vector to the tangency of the target curve, and works in much the same way as the Aim constraint and the Normal constraint. The Pole Vector constraint is a Point constraint specifically designed to constrain the Pole Vector of an ikRP handle (discussed earlier in this chapter).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=638431028 (4 of 4) [11/27/2000 8:37:55 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 11 - Paths and Bones Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-on Maya: Setting Up the Puppy for Animation Before we finish this chapter, let s build the skeleton for the dog that we created in Chapter 8. We ll also put some IK handles and constraints on it, and organize the hierarchy to get it ready for animation.
Creating the Skeleton We ll begin by using the Skeleton Ø Joint Tool to give the puppy bones and joints. 1. Bring in the file dog_final_model.mb, the final global stitched model of the dog. 2. In the side view, draw the backbone as shown below, starting from the hip area and finishing at the nose. Draw the tail. Draw the front leg and the back leg with Auto Joint Limits turned on. Note where the wrist is that is where the IK end effector will be placed.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=515371376 (1 of 4) [11/27/2000 8:38:02 PM]
Books24x7 Mastering MAYA Complete 2
3. To make the back leg the proper shape, increase the grid division and use X+click. This is important because we will be using IK with the three joints of the leg. If the bones are not built symmetrically as in the picture below, they will not bend the way we want them to.
4. Name the joints. The backbone chain should be hip, back, chest, neck, and head. The tailbone chain should be tail1 and tail2. The front leg chain should be named Larm, Lelbow, Lwrist, and Lpaw. Finally, the back leg chain should be Lleg, Lknee, Lhock, and Lpad.
Adding IK Handles Now we re ready to apply inverse kinetics to the puppy, using the Skeleton Ø IK Handle Tool. 1. In the perspective view, move the leg joints to the left side so that they are placed properly as shown below. Put ikSC handles on them to test how they bend. For the back leg, try to keep the three bones that will use IK coplanar. Think also of how the skin is going to stretch with the skeleton as the joints are moving.
2. Mirror the front and back legs on the YZ axis. The ikSC handles should copy as well. Check to make sure the joint limits are working (see Mirroring Joints, earlier in this chapter). 3. Group the front legs to chest. Group the back legs and the tail to hip. You should have the joints placed somewhat like below. Name the joints properly, such as Rarm and Relbow. Name the IK handles Lfront, Rfront, Lbackleg, and Rbackleg. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=515371376 (2 of 4) [11/27/2000 8:38:02 PM]
Books24x7 Mastering MAYA Complete 2
Constraining the Legs We have a problem with the puppy s front legs. We would like to have the paws planted on the ground when the dog walks, but because the IK chain is to the wrist, the rotation center is the wrist, not the paw. We ll solve this problem by using locators and the Orient constraint. The steps below can be a bit tricky, so follow the instructions carefully. 1. Select Create Ø Locator and scale it down to 0.5 uniformly. Select Lpaw, then select locator1, and select Constrain Ø Point. The locator should snap to the Lpaw joint. 2. Select Lwrist (make sure you select this joint and not the Lpaw joint), then locator1, and select Constrain Ø Orient. The locator should rotate to match the rotation values of Lwrist. Name the locator Lfrontleg. 3. Repeat step 2 for the right side of the leg. Name the locator Rfrontleg. You should see the locators positioned as shown next.
4. Open the Attribute Editor for the Lwrist joint. Click the X and Y Degrees of Freedom settings. They need to be activated before the joint can be constrained. Repeat this process for Rwrist.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=515371376 (3 of 4) [11/27/2000 8:38:02 PM]
Books24x7 Mastering MAYA Complete 2
5. In the Outliner, delete the constraint nodes under the locators. In the modeling window, select the Lfrontleg locator first, then Lwrist, and select Constrain Ø Orient. Do the same for Rfrontleg and Rwrist. The rotation attributes of the wrist joints are now constrained to the locators. 6. In the Outliner, group the Lfront ikSC handle to the Lfrontleg locator by MM dragging it to the locator node. Do the same for the Rfront ikSC handle and the Rfrontleg locator. Now if you try moving or rotating the locators Lfrontleg and Rfrontleg, the legs should follow pivoting around the paws. 7. Select the hip joint and group it to itself by selecting Edit Ø Group with the default setting. This produces a parent node. Name the node Puppy, and group the ikSC handles and the locators under it. The Puppy node is the top node, which will move the whole dog. In the Outliner, you should see a hierarchy like the one shown below. Save the scene as puppy_skeleton.
In your own work, it s important to remember that there is no one proper way to build skeletons or place constraints to set up a character for animation. In each case, you need to consider what the character will be doing, how the body should deform, how the limbs should rotate. Different situations call for different solutions. A properly prepared character will move well, have the necessary range of movements, and be easy to animate.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=515371376 (4 of 4) [11/27/2000 8:38:02 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 11 - Paths and Bones Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, you learned how to animate objects and cameras along paths, build skeletons properly, and create different kinds of IK handles on joints. You were also introduced to using constraints. Finally, you built a hierarchy of nodes involving joints, IK handles. and constraints to prepare the dog modeled in Chapter 8 for animation. In the next chapter, we will cover how to bind the dog to the skeleton, weight it properly, and test it for animation.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=697383517 [11/27/2000 8:38:07 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 12 - Deformers Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 12: Deformers Overview If the only way to model and animate were by pushing and pulling points, it would make life very difficult for modelers and be the bane of many animators existence. Thankfully, Maya provides deformers, which let you bypass most of the menial work. With Maya s deformers, you can quickly build and animate deformed surfaces with a high level of control. In this chapter, we will go through several deformers that are indispensable for modeling and animating in Maya. We will also focus on facial animation, including an in-depth discussion of advanced facial animation techniques at the end of the chapter.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=249155633 [11/27/2000 8:38:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 12 - Deformers Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating Deformers Maya provides many types of deformers, which work in different ways. All of the deformers can deform anything with control points, including CVs on curves and surfaces, vertices on polygons, and lattice points. Many deformers can also deform multiple surfaces, maintaining their tangency during the deformation process. All deformers also work as sets, called deformation sets. You can edit the points being influenced by a deformation by changing their membership in the set using the Relationship Editor, the Edit Membership tool, or the Paint Set Membership tool (discussed later in the chapter, in the Editing Deformations section). All the deformers and editing tools we will be covering in this chapter can be found on the Deform menu in the Animation module.
Using Lattice Deformation Lattice is one of the most frequently used deformers. When you apply Lattice to an object, Maya creates an influence lattice and a base lattice around the object. When you transform the influence lattice, or its points, the object inside the lattice transforms with it, or gets deformed by it, according to the degree of difference between the influence lattice and the base lattice. Lattice allows you to control the deformation of complicated objects with fewer control points than you would need if you were deforming the objects directly. Because of this, the deformation is easier to create and the results are smoother.
Creating Lattices You can apply Lattice to a group of objects, only some points of an object, or points of a group of objects. You can even apply Lattice to points of a lattice, as shown below on the right. In the examples below, the lattice on the left is made up of points from four objects. The shape in the middle is two tori, with the top torus latticed at the object level and the bottom torus latticed at its two top rows of CVs.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (1 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
To apply Lattice, simply select the points or object(s) you want deformed, then select Deform Ø Create Lattice. You see the influence lattice. The base lattice has also been created, but it is hidden. If you are animating the object being deformed, you want the lattice to translate with the object. For this type of translation, group the lattice and its base lattice under the deformed object. Grouping is available as an option setting when you are creating the lattice, or you can do it after you create the lattice. Lattice has its own local space, which parallels the XYZ coordinate system, called STU space. When you create or edit a lattice, you can adjust the STU divisions of the lattice, giving it more or fewer lattice points than the default setting. Note Lattice also can be used for skinning, which we will do with the puppy in the next chapter. Skinning an object indirectly with Lattice can be a great way to animate because Maya s lattice is so efficient, but sometimes you may run into a situation where an object is being transformed twice from the lattice and skinning. See the discussion of the Relationship Editor later in this chapter for an example of how to deal with double transformation problems. Another way to adjust a lattice is through the Local Divisions setting, which is activated with Local Mode. When Local Mode is turned on, each point exerts influence according to the Local Divisions setting, as shown below. The default is 2, 2, 2, which means each point exerts influence up to two points away in STU space. When Local Mode is turned off, each point in the lattice exerts influence on the whole area. You usually want to leave Local Mode turned on.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (2 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
The Freeze Geometry setting locks the object where it is being influenced. With this setting, when the object transforms, the deformed part of it stays fixed, as shown above. You can activate Freeze Geometry in the Attribute Editor after lattice creation. You can also move the deformed object partially first, then turn on Freeze Geometry, and the object will lock where it is.
Tweaking Lattices To tweak a lattice, pick-mask Lattice Point over it, and you can manipulate its points in the same way as regular CVs. You can also manipulate the lattice to fit around an object better by transforming both the influence lattice and the base lattice. You can select the hidden base lattice in the Outliner. As long as the two lattices are being transformed together, no deformation occurs. When you are doing this, make sure that all the control points of the object being deformed remain inside the lattice, or they will not deform with the lattice. Tip The lattice is created to fit an object s bounding box. If you find that some points are not deforming along with the lattice, try scaling up the lattice and the base lattice a bit to make sure no points will stray outside the deformation. If you ve been tweaking the lattice points and you decide to start over from the original shape or to add more STU subdivisions, select Edit Lattice Ø Remove Lattice Tweaks. If you want to undo the transformations you ve applied to the lattice at the object level as well, select Edit Lattice Ø Reset Lattice.
Cluster Deformation Unlike the other deformers, Cluster produces a weighted deformation. When you apply cluster to an object, it creates weighted points in the cluster set. This is probably the most useful thing about using clusters. The default weight of the clustered points is 1.0, but you can adjust their weights by using the Component Editor or the Paint Weights tool (Artisan). Let s try a simple exercise to see how to create clusters and adjust their weights: 1. Create a plane. Set it to span 10 patches in U and V.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (3 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
2. Drag to select 25 CVs at the center of the plane. Select Deform Ø Create Cluster and accept the default settings. 3. A cluster handle appears as the small letter c. Select the Move tool and pull the c up. You should see something like the picture shown on the left. 4. Select the surface, and start the Paint Weights tool (from the Deform menu). Apply a bit of smoothing with low settings around the edges of the clustered points. You should be able to get a more rounded shape, as in the picture on the right. (See Chapter 9 for more information about using Artisan.)
5. Select the clustered points and choose Window Ø General Editors Ø Component Editor. Click the Weighted Deformers tab. Here, you can type in lower weight values to round the cluster edges. In general, when you want to have precise control over the percentage of the weighted points and the points are easy to pick in groups, the Component Editor is a good tool to use. When you want a more organic look, or if the surface is very dense, the Paint Weights tool (Artisan) is more efficient. Tip When you are working with clusters, the cluster handle c has a default Select Priority Level of 2, which means that it is selected along with the surface it s deforming. You can open the General Preferences dialog box and change the Select Priority Level for the cluster handle, or you can open the Attribute Editor and check Display Handle in the Cluster Handle Display section. A handle with the highest Select Priority Level will appear, which will allow you to select only the cluster. When you move an object that is clustered, you would expect the cluster handle to move with the object, but it doesn t. If you want the cluster to stay on the surface as it moves, group it under the object. First, open the Attribute Editor, click the Cluster tab, and make sure the Relative setting is on for Cluster Attributes. Next, if the object is at the origin, you can simply group the cluster under the object in the Outliner or Hypergraph. If not, group the cluster to itself once to move the center to the origin, then group that node under the object. (Edit Ø Parent will produce the same result.)
Nonlinear Deformations http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (4 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
The six deformers in the Nonlinear submenu all deform in, yes, nonlinear fashion: Bend Bends an object along a circular arc. Flare Flares out and tapers off an object. Sine Curves an object into sine waves. Squash Stretches and squashes an object. Twist Twists an object. Wave Creates circular ripples on an object. These are all simple functions, but they are remarkably effective in creating their intended results, as illustrated below.
Each of the nonlinear functions can deform just the selected points of objects, just like lattices or clusters. They can also deform multiple objects and maintain tangency between patches. The deformations start and finish along an axis line, by default, the 1 and 1 of the local Y axis of the object being deformed. You can use the manipulator handles to interactively adjust the deformation attributes (select the deformer in the Channel box Input section to display the Show Manipulator option). You can combine any number of deformers. It s easy to create complex shapes by manipulating the deformer attributes of the different deformers. Note that when you use multiple deformers, their order of creation is important (see the Changing the Deformation Order section later in this chapter). You can animate the deformers, and you can also animate the deformed objects. Let s try some examples with the nonlinear deformers. First, we ll use Bend and Sine to twist an object. 1. Create a plane. Increase its subdivisions. 2. Apply Bend to it (select Deform Ø Nonlinear Ø Bend), with Curvature set to 3. Then rotate the plane about 15 degrees in the X axis. The plane twists.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (5 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
3. Add Sine to it (select Deform Ø Nonlinear Ø Sine), with Amplitude set to 0.5. Transform the plane back and forth in Z. The twisting now seems more random. 4. Group the deformers and the plane. Now you can transform the deformers and the plane together as well.
You can quickly create a rough jet engine by applying Wave to a sphere (as in the inset picture after the following exercise; notice the dots for manipulator handle settings). You can also try creating something as organic as a tree, as follows. 1. Create a cylinder. Increase its sections and spans, and scale it up in Y into a pillar shape. 2. Apply Flare to it. Flare out the bottom and taper the top. 3. Apply Sine to the object. Make the cylinder form about two waves. 4. Apply Sine again with a different wave length and rotate it to make the cylinder wave more randomly. 5. Apply Wave, setting the Amplitude and Wave Length to about 0.1. Rotate the wave until the cylinder becomes gnarled like a tree, as shown below. 6. Copy and scale the cylinder to make smaller branches.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (6 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
Sculpt Deformation Sculpt deformation uses a sphere as a sculpting tool to make round or flat ring-shaped deformations. It can deform objects in three different modes: Flip, Project, and Stretch. Note The Max Displacement and Dropoff Distance settings may seem similar, but they re not. The Max Displacement value determines the amount of strength with which the sphere can push or pull a deforming point. The Dropoff Distance setting determines the area of points that can be influenced.
Using Sculpt in Flip Mode When Sculpt is in Flip mode, the sphere acts as if it has a force field, pushing points away from its center in the direction of the sphere s normal vector. If the sphere s center crosses a point, there is a flip, because the point being pushed is suddenly pushed in the opposite direction.
Using Sculpt in Project Mode http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (7 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
The Project mode is the opposite of the Flip mode. In Project mode, the sphere acts as a magnet, causing the influenced points to snap to it. A Max Displacement value of 1 causes the points to snap to the sphere s surface; values between 0 and 1 cause the points to travel a percentage between their original position and the sphere s surface. Note that the deformation shapes produced by Flip and Project are quite different.
Using Sculpt in Stretch Mode In Stretch mode, the sphere calculates its position relative to a Sculpt stretch origin locator, which is created with the sphere and stretches the affected points away from the locator. With the Stretch mode, you can group the stretch origin locator and the sphere and animate them together, as in the example shown. You can also change the Inside Mode setting to Ring or Even, as shown on the top right.
As with the Nonlinear deformers, Sculpt can be used in many creative ways. Just by sculpting a NURBS plane, you can easily fashion plant leaves, as shown on the right. Once you ve stretched the plane, scale out the CVs at the top, tighten the CVs in the middle, and tweak the CVs a bit to make the leaves asymmetrical.
Wire Deformation Wire deformation works with an influence wire and a base wire, somewhat like Lattice deformation. The deformation occurs according to the relative distance between the two wires. Wire deformation is most useful for creating facial expressions, as you will soon see.
Applying Wire Deformation First, let s try out Wire deformation with a simple shape. 1. Create a NURBS plane. Scale it out to 3, and make its patches U and V 16. 2. Place a circle on the plane, and draw a curve with one span inside, as shown below on the left.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (8 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
3. Select Deform Ø Wire Tool and accept the default settings. Maya asks you to select shape(s) to deform. Select the plane and press Enter. Maya then asks you to select wire curve(s). Select the curve inside the circle and press Enter. If the deformer has successfully been created, the plane should turn pink. 4. The curve is now called a wire. Note that a hidden duplicate of the wire, called the base wire, has been created as well. Translate up the wire as shown below on the right. Then try moving up the base wire. As the distance between the two curves decreases, so does the intensity of the Wire deformation.
5. Place the wires to their original position, select the plane, and delete history. The Wire deformer node disappears, but the base wire remains.
Using Holders Let s repeat the process, but this time, we ll use the Holders option. Holders generally function to restrict Wire deformation by limiting the influence of the wires. 1. Select Deform Ø Wire Tool Ø and click Holders. As before, select the plane and press Enter. Then select the curve and press Enter. 2. Maya asks you to select a holder shape or clear selection. Select the circle and press Enter. Maya now asks you to either select another wire (for more influence wires) or clear the selection. Clear the selection by deselecting all objects and press Enter to complete the wire creation. Notice that another invisible base wire is created. 3. Try moving the wire again and note the difference. In the following example, on the left, the wire influence is overshooting the circle holder area. 4. In the Channel box, select wire1 under Outputs and decrease the Dropoff Distance setting to 0.3. The wire influence is now restricted inside the circle holder, as shown in the middle picture below. Try moving the circle up to see the difference between having a holder and not having one.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (9 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
Tip Group all the wires the influence wire, the base wire, and the holder wire under the object being deformed so that they will move with the object.
Using Dropoff Locators Wire deformers have an additional control tool called Dropoff Locators, which can give you very subtle localized control over the Wire deformation. Let s continue with our plane example to see how this tool works. 1. Move the wire down nearer to the plane surface. RM choose over the wire and pick-mask Curve Point. 2. Select a point near the second CV, then Shift+select another point near the third CV. 3. Select Deform Ø Wire Dropoff Locator with the default settings, and you should see something like the next top-left picture. 4. Open the wire s Attribute Editor. There is now a Locators section, where you ll find sliders to control the locators positions, their influence percentages, and their twist. The Twist setting simply twists the deformed points around the curve at the locator point. 5. Change the Locators settings as follows: Percent[1] to 2, Twist[1] to 163, Percent[2] to 2.5, and Twist[2] to 140. You should see something like the bottom-left picture in the following example.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (10 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
Controlling Deformer Effects with Envelopes For all the deformers, there is a general attribute channel called the Envelope. Some deformers such as Blend Shape and Cluster actually have it as part of their option box. On all deformers, it can be accessed through the Attribute Editor, under the Deformer Attributes tab, or through the Channel box Inputs section. The default value is always 1, but you can change it from 2 to 2. When the value is at 0, the deformer has no effect. At 1, the deformer produces the opposite effect. At 2, the deformer s effect is doubled. Such capacity is especially useful for Blend Shape, because its default sliders in the Attribute Editor or the Blend Shape Editor go from 0 to 1 only. When you increase the Envelope value to 2, the sliders range essentially increases from 0 to 2.
Forming Facial Expressions Now that we ve experimented with a basic shape, let s look at how Wire deformation works on a face. 1. Open the file Child_face.mb from the CD, or if you created one yourself in Chapter 6, open that file. Pick-mask over the mouth patch and select the edge isoparm, the isoparm at the nose tip, and the one around the lip area, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (11 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
2. In the Modeling module, select Edit Curves Ø Duplicate Surface Curves. With the curves still selected, choose Edit Curves Ø Rebuild Curve Ø, set the Number of Spans to 16, and click Rebuild. 3. The curve near the nose tip will be a holder, and the other two will be wires. Delete history from the curves. 4. Switch to the Animation module, and select Deform Ø Wire Tool Ø and click Holders. Select the four patches of the face and press Enter. Select the curve at the mouth patch edge for wire, and press Enter again. Select the curve near the nose as holder and press Enter. Clear the selection and press Enter again to complete the wire creation. 5. Repeat the process for the third curve, using the middle curve as a holder curve again. This time, you only need to select the mouth patch as the object to be deformed. 6. Try moving around a few wire CVs. You ll find that you probably need to lower the Dropoff Distance for the curves. Once the settings are done, it s quite easy to create subtle expressions by pulling the wire CVs. You can proceed to animate the CVs, as well as the curves. You would also want to add at least one more wire to control the eyebrows (as shown below), and group the wires (including the base wires) to the head.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (12 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
Blend Shape Deformation Blend Shape is different from other deformers. It is specifically designed to perform morphing tasks, and it has a separate slider editor. You can also access those sliders in the Attribute Editor, or through the channels in the Channel box. Blend Shape is especially useful for facial animation. In this type of animation, a group of set shapes such as certain phonemes or facial expressions need to be readily accessible, editable, and, as the name suggests, blendable.
Applying Blend Shape Deformation Blending works best when the target object and the base object have the same topology, meaning they have the same number of CVs and their order is the same. Although Maya allows you to blend objects with different topology, you may not always get the results you want. To see what we mean, let s go through some examples. 1. Create two spheres. Change the first sphere s shape by pulling points, as in (a) in the following example.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (13 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
2. Select the first sphere, which will be the target, then Shift+select the second, which will become the base. Then select Deform Ø Create Blend Shape and accept the default settings. 3. Select Window Ø Animation Editors Ø Blend Shape. An editor opens with a target slider. A blendShape node is created, and the target slider is an attribute of that node. Slide it to 1, and the second sphere should morph into an exact replica of the first sphere, as in (b). 4. You can also Blend Shape points. Select the first two rows of the first sphere (target) and the same for the second (base), then apply Blend Shape. You get something like (c). 5. Notice that there is now another slider in the editor. Repeat step 4, but set the Origin setting to World in the option box. The blending calculates not only the relative translation of the target points, but their world space coordinates as well, as in (d). The morphing points of the base object translate exactly to where the target points are, no matter how the base object is transformed. 6. Select the middle CVs of the second sphere and delete them, as in (e). The topology of the second sphere has changed; it now has eight fewer CVs than the first sphere. 7. Apply Blend Shape to the spheres again, Maya replies with the message, Error: No deformable objects selected. This is because the default Blend Shape setting checks to make sure the topology of the target object matches that of the base object s. Turn off the Check Topology setting in the option box. Maya proceeds to morph the base object the best it can. The result is as shown in (f).
Blend-Shaping Hierarchies and Adding Shapes When you are morphing a group of objects, you must make sure that the hierarchy of the target objects is the same as the base objects hierarchy, or the morphing will not work properly. In the picture shown below, the head on the left is the base, and the one on the right is the target. Notice that the hierarchies in the Outliner are all in the same order. Selecting the top Smile node, then the top Face node, and then applying the default Blend Shape produces a slider named Smile.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (14 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
To add more shapes, simply create more shapes, select them, select the base object, and apply Edit Blend Shape Ø Add. If you get an error message saying you must specify a blendShape node, click Add in the option box, check Specify Node, and enter the name of the existing blendShape node, which should be something like blendShape1. Some examples of shapes are shown below.
You also can edit the target values in the Channel box or in the Attribute Editor, where the targets appear as sliders under the Weight section of the blendShape tab. You can remove the targets from the blendShape the same way you added them. Select the target objects in order, select the base, then apply Edit Blend Shape Ø Remove. Tip Once you are satisfied with all the blendShape targets, you can delete the target objects to lighten the scene. The blending information remains with the base object, so you can always recreate a target geometry by copying it from the blended base object.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=576070828 (15 of 15) [11/27/2000 8:38:29 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 12 - Deformers Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Editing Deformations Deformations depend on the relationships among points and their groupings. The controls you can use for your deformations include the Relationship Editor, Edit Membership tool, Paint Set Membership tool, and the Prune Membership function. You can also edit the deformation order.
Editing Deformation Sets Whenever you create a deformer, Maya creates a deformer set of the same name. This set shows up in the Deformer Set Editing module of the Relationship Editor. You can use this editor to edit the membership of points in the deformer sets. The editor s Edit menu allows you to select any point in a set, add points to a set, and remove points from a set. It also lets you select or delete deformers. Let s go through a simple example. 1. Start a new scene. Create a cylinder. 2. Select the top two rows of its CVs and apply Lattice deformation with the default settings to the points. 3. Select both the cylinder and the lattice in the modeling window, and apply Cluster deformation with the default settings. 4. Try moving the cluster. You will see that you have a problem commonly known as double transformation, which is illustrated below. The points inside the lattice are being moved twice once by the lattice deformer, and again by the Cluster deformer. To solve this problem, the cluster should stop moving the points inside the lattice, because you want the lattice to still be able to affect the points on the cylinder.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=352851498 (1 of 4) [11/27/2000 8:38:40 PM]
Books24x7 Mastering MAYA Complete 2
5. Select Window Ø Relationship Editors Ø Deformer Sets. You should see the editor with two deformer sets on the left side: ffd1Set and cluster1Set. Click the plus signs to their left, and you see a list of all the points that are being deformed by the lattice and the cluster. 6. Highlight ffd1Set and select Edit Ø Select Set Members. You also can highlight the points inside the set and select Edit Ø Select Highlighted. In the modeling window, the points become selected. 7. Highlight cluster1Set, and either click the minus sign button at the top of the window or select Edit Ø Remove Selected Items. The selected points are no longer part of the cluster set, and they are not transformed twice. Tip When you are in the Relationship Editor, you can unclutter the right window by RM choosing over it and clicking Show DAG Objects Only. (DAG stands for Directed Acyclic Graph.)
Using Tools to Edit Membership Maya provides a quick way to do what we just did in the previous section without using the Relationship Editor. You can use the Edit Membership tools to solve the double transformation and other deformation problems. Let s try it. 1. Use Undo to create the double transformation situation again (or repeat steps 1 through 3 in the previous section to recreate it). 2. Select Deform Ø Edit Membership Tool. Maya asks you to select a set or a deformer. Our goal is to remove points from the cluster, so select it. All the points belonging to the cluster become selected. 3. Ctrl+click or marquee the points you want to remove. (If you want to add points to a deformer, you can Shift+click or marquee the points.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=352851498 (2 of 4) [11/27/2000 8:38:40 PM]
Books24x7 Mastering MAYA Complete 2
The Paint Set Membership tool works in the same way as the Edit Membership tool. To use it in our example, you would select the cylinder, select Deform Ø Paint Set Membership Tool Ø, select cluster1Set as the set to modify, and choose the Remove operation. The advantage of the Paint Set Membership tool is not readily seen in this instance. However, because it gives you a color feedback telling you which points belong to which deformer, it can be very useful when you are editing rigid skinned objects (see Chapter 13 for more information about skinning techniques).
Pruning Membership With Lattice, Cluster, Sculpt, and Wire deformers, Maya provides a quick pruning function. The Deform Ø Prune Membership function removes all the points of a deformer set that, at the time of the pruning, have not been moved from their undeformed positions. While pruning can lighten a scene by reducing deformer calculations, you may remove points that seem unnecessary from sets, but later find that they need to be deformed after all. In such cases, you can always add those points to the deformer set again, using the editing tools described in the previous sections.
Changing the Deformation Order Deformation order, or the deformation chain, refers to how multiple deformers affect a surface in order. Their order is usually determined by their order of creation, but you can use the advanced option settings to change their placement in the chain. You can also use the Complete List window for a selected object to edit the order. The best way to understand how deformation order works is to go through a simple example. 1. Create a NURBS cylinder. Scale it up to 5 in Y, and increase its spans to 4. 2. Copy the cylinder. Translate it out and deform it to look something like the one in (a) below. 3. Apply Blend Shape to the original cylinder, as in (b) below. Set the Blend value to 0, and delete or hide the copied cylinder. 4. Apply Sine to the original cylinder, with an Amplitude setting of 1. You should see something like (c) below. 5. Increase the cylinder s Blend value to 1. You no longer see (b) but rather something like (d). If you want to see the cylinder morph into a shape like (b) again, you need to change the deformation order assigned to Sine and Blend Shape.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=352851498 (3 of 4) [11/27/2000 8:38:40 PM]
Books24x7 Mastering MAYA Complete 2
6. With the cylinder still selected, click the List of Operations button (adjacent to the Make Live button) and choose Complete List. You can also RM choose over the cylinder and select Inputs Ø Complete List. 7. In the Complete List window, notice that history of the node chain starts from the bottom. MM drag the Non Linear node down to the Blend Shape node until you see a box appear around it, then release the mouse button. The nodes placements have switched. Now when you increase the cylinder s Blend value, it overrides the Sine shape, as shown below.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=352851498 (4 of 4) [11/27/2000 8:38:40 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 12 - Deformers Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Advanced Facial Animation Facial animation is a big field on its own. Here, we will deal with only several relevant points. At the simplest level, you can have a character talk with two shapes: open_mouth and close_mouth. Consider any muppet character and you will see what we mean. For facial expressions at the simplest level, you need only close_eyes, and open_eyes (and perhaps not even those). For a more realistic setup, however, the number of facial shapes, or targets, can quickly grow to dozens.
Creating the Teeth, Tongue, and Oral Cavity Before you can work on facial shapes, you need to create the teeth and gums, as shown in (a) below. The upper teeth do not move because they are fixed to the skull; the lower teeth should rotate with the jaw. You should use Set Driven Key to have the lower teeth driven by open mouth shapes such as ah and oh. Make sure the rotation pivot for the lower teeth is similar to the jaw bone s, around the ear area. (See Chapter 10 for details on the Set Driven Key feature.) You may also want a tongue, its tip clustered, to strike the back of the upper teeth for what the linguists, if not the dental experts, call the alveolars (s, z, t, d, n, l), or to the bottom of the upper teeth for the th sounds. An example is shown in (b) below. Another necessity is the oral cavity. A good way to proceed is to offset two or three curves from the boundary isoparms of the lips so you can maintain a procedural connection with the mouth shapes, create copies of those offset curves, translate them into the throat area, and loft (see Chapter 6 for more information about lofting). This is illustrated in (c) below. You may want to wait until you have finished building the face before creating the oral cavity. It should become a morphing part of all the mouth targets.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (1 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
Tip Creating the inner mouth parts can be tricky and time-consuming. If you are not going to have close-up shots of a character s mouth, it may not be worth the effort. As an alternative, you can create a textured plane, curve it, and position it inside the mouth.
Creating Mouth Shapes There is no fixed list of facial shapes you should create, nor is there a standard guide for how to set them up for facial animation. Specific projects call for specialized solutions, and animators will always experiment with different methods. But the idea of using Blend Shapes for lipsyncing makes a lot of sense. Setting up well-thought-out mouth targets may take longer, but it will save you much more time in the long run, especially if you will be using the character repeatedly. Using Blend Shape for lipsyncing and Wire deformation for fine tweaking and facial expressions probably will offer the best results. Below is a sample list of blend shapes for lipsyncing.
The ah and oo shapes are absolute necessities ah because it opens the mouth and lowers the jaw, and oo because it can also be the shape for sounds such as ch, sh, and w, not to mention kissing and whistling.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (2 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
You can get by using one shape for oo and oh, but they really are different shapes. The jaw drops for oh, creating a hollow space inside the mouth, whereas for oo, everything pushes up. The ee shape shown above is an extremely strong shape, which can double as an expression of anger or, combined with ah, screaming. For unaccented ee shapes, you may want to use the H(horizontal)_stretch instead. For H_stretch, Frown, and Face_lift, you could separate them further into Left and Right targets. If you do, then be careful not to disturb the few middle CVs of the face, or you will get the double-transformation effect (described earlier in the Editing Deformations section). For many of these shapes, if you build the targets carefully, you can also use their negatives. Below are the negatives of some of the shapes.
Note The sounds are not accurately-spelled phonetic sounds. They ve been spelled out like regular words here. For proper phonetic spelling, you should follow the IPA (International Phonetic Alphabet). Different dictionaries use slightly different spelling methods, but ah would generally be listed as [a:], oo as [u:], ee as [i:], and so on. Letters such as c are represented differently depending on how they are used. A soft c is [s], whereas a hard c is [k]. For more information about phonetic spelling, refer to a linguistics book.
Setting Up Multiple Blend Shapes When you are setting up your blending targets for the face, separating mouth shapes from facial expressions is more economical and efficient than throwing everything in together. For this technique, you create two groups of blendShapes. The mouth and the jaw patches can hold mouth shapes such as those described in the previous section. The eye patches can hold facial expressions such as eyes closing and showing emotions happy, sad, and angry. Setting things up this way is a bit more complex, however, and requires the use of the Set Driven Key feature. In the example shown below, Blend Shape was applied not to the top Face node, but to the Eye_area and Mouth_area nodes. There are also two blendShape groups: one for the mouth area and another for the eye area. The two targets, Ah and Eyeclose, are working well with the base object. The two shapes are independent of each other, so that when the eyes close, the mouth area is not affected, and vice versa. The third shape, smile, is actually a combination of two target shapes: the Sm_eyes and Sm_mouth shapes. In the bottom-right picture below, both shapes are at their maximum target value. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (3 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
However, there is a problem with the smile shapes in the example below. When the Sm_mouth slider is moved, creasing occurs as shown below. This is because the Sm_eyes slider did not move with the Sm_mouth slider. We can solve this problem by making the Sm_mouth slider a driver for the Sm_eyes slider.
RM choose over a numeric input field in the Blend Shape Editor to pop up a menu. Select Set Driven Key. You can select the blendShape node in the Blend Shape Editor by clicking the Select button. Specify Sm_mouth as the driver and Sm_eyes as the driven. Key them at 0 and 1. Sm_mouth should now drive Sm_eyes, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (4 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
Discerning Spoken Sounds When you are lipsyncing, one of the worst mistakes you can make is to try to figure out the mouth shapes by going through the alphabet, spelling out what is been spoken. It is better to reference a list of phonemes if you can, but better still to just follow the mouth shapes as the sounds are made. Here are a few rules that can help you to get started. "
Consonants are greatly affected by the sounds that surround them, which is a phonetic phenomenon called assimilation. For example, the consonant d in how do you do? and how did you do? forms two different mouth shapes, because the vowels that follow the d are different. A good rule to follow is to go through the vowels first, because they will often dictate how the neighboring consonants will be shaped. Once you figure out the vowels, the consonants will often naturally fall into place.
"
There is also a rule called vowel reduction or omission, which is a specific type of assimilation. For example, a phrase like how did you do? is often spoken how ju do? . In a case like this, it helps to unlearn your reading skills; instead of trying to find sounds from the words, just listen.
"
English is an intonational language. It s rhythmic, with regular beats of accented and unaccented syllables, and a few strong emphases punctuating different parts of sentences. You should listen to these emphases and figure out where the beats are falling. You can then skim through the unaccented segments and concentrate on nailing the accented syllables.
"
For animation, you should be concerned only with what will be seen. If a character s back is toward you, for goodness sake, don t animate her face! If that seems obvious, then in the same way, you don t need to animate what goes on inside the mouth. Consonants such as s, z, t, d, n, and j, among others, can often be shown as just a slight up and down movement of the mouth. Consonants such as k, g, ng, and h matter only in that they fill time between vowel shapes. The th sounds (as in thing and they ), too, are indistinguishable in terms of shapes, and should be treated as one sound. Tip For many animators, lipsynching is not such an important part of facial animation. Far more important is creating proper facial expressions, especially in the eye area.
Keyframing and Tweaking Mouth Shapes
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (5 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
There are various methods of keyframing mouth shapes. You can use the Channel box, the Attribute Editor, or the Blend Shape Editor. It is generally not a good idea to keyframe individual shapes, because the shapes that are not keyframed may end up floating between their keyframes. A much more efficient method is to keyframe all the shapes, then tweak them individually in the Graph Editor. Tip You can lock certain targets to exclude them from being keyframed if you know you won t be using them for a specific scene. For example, you might lock a smile target in a scene where you know the character isn t going to smile.
Keyframing with the Channel Box or Attribute Editor In many ways, the Channel box and Attribute Editor provide a better setup for facial animation than the Blend Shape Editor. Although the Blend Shape Editor offers more functions, it can get a bit awkward when there are a lot of targets to consider. In order to use the Channel box, you need to have the mouth selected. The Attribute Editor has the Copy Ø Tear Off Copy function, which creates a copy window that still remains when the object is deselected. Another advantage of the Attribute Editor s torn-off copy is that it has sliders. The Channel box s targets are restricted to a value range of 0 to 1 for the targets, but you can set the sliders to have a wider range of target values. Just type in numbers like 1 or 2 into the numeric input field, and the slider range will adjust accordingly. You can Key All in the Blend Shape Editor and in the Channel box, but not in the Attribute Editor. One way to get around this is to use the hotkey for setting keys. You may need to adjust the Set Key options to All Keyable Attributes in order to keyframe blended shapes.
Tweaking with the Graph Editor Once you ve roughly animated the mouth shapes, you can use the Graph Editor to tweak the animation curves. You can also tweak using the Channel box or the sliders (turning on the Auto Key function will help), but only the function curves can give you a sense of how the shapes are moving through time.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (6 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
You would usually want to select either one or just a few different targets inside the Graph Editor and focus on tweaking only those curves at one time. You may also want to turn off Curve in the Select menu if you are editing only keyframes.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=128033078 (7 of 7) [11/27/2000 8:38:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 12 - Deformers Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, you have learned how to apply various kinds of deformers to objects, or parts of objects. One of the wonderful things about deformers is that they can be combined in different orders to produce some remarkable effects. In particular, Wire and Blend Shape deformations allow you to produce high-level facial animation. Lattice can also be a very useful tool for both smooth and rigid skinning. In the next chapter, we will be covering skinning, as well as building and setting up a complete human character.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=206630106 [11/27/2000 8:38:55 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 13 - Skinning and Character Setup Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 13: Skinning and Character Setup Overview In this chapter we will learn how to attach surfaces to skeletons and make them deform appropriately for animation. In the attaching process, called binding, the bound geometry becomes the skeleton s skin; and the skin s deformation is affected by a process known as weighting. All of this terminology will soon become familiar as you go through the examples and exercises below. We will also go through setting up the puppy dog for animation, and then devote the remainder of the chapter to building the child model and setting him up for animation as well.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=440826158 [11/27/2000 8:38:59 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 13 - Skinning and Character Setup Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Skinning We ve already talked about how skeletons can bind objects and deform them properly as they move. The process through which skeletons do this is called skinning, and the objects that become bound to skeletons this way are called skins, or skin objects. Like other deformers, skeletons can skin anything that has control points, such as CVs, NURBS curves, surfaces, polygonal vertices and objects, and lattices. Although you will most often skin whole objects, it is worthwhile knowing that you can bind only a selection of points as well. There are two kinds of skinning: rigid and smooth. Rigid skinning creates a joint cluster for every joint binding the objects. These clusters can contain points of multiple objects, and you generally use flexors to smooth the bends. Smooth skinning creates a skin cluster for every object being bound; this cluster is shared by a set number of joints with different influence percentages. You can use influence objects, discussed later in this chapter, to manipulate the deformation of smooth skins. For both kinds of skinning, you can use the Artisan tools to edit set membership and weights of the skinned points. When you are working with dense organic models, the difference between using Artisan and using the regular tools can be quite noticeable.
Rigid Skinning Rigid skinning is called rigid because only one joint can influence a CV. There is no sharing of CVs as in smooth skinning, and the joint clusters that are created have a default influence value of 100%, which results in a rather rigid deformation when joints are bent. You can edit rigid skins by using flexors (a special type of deformer) or other deformers, or by changing skin point weights. All the tools we ll be using, unless stated otherwise, are available in the Skin menu in the Animation module.
Creating Rigid Skin Let s start out with a simple example. Create a cylinder and increase its sections to 10, its spans to 6, and its Height Ratio to 10. In the side view, create a skeleton chain as shown below. Select the cylinder and the skeleton the order of selection here doesn t matter and apply Animation Ø Skin Bind Skin Ø Rigid Bind with the default settings. The cylinder turns pink to show that is bound, or skinned, by the skeleton chain. Try rotating the second joint in Z 90 degrees; you ll see that all the points bound by it rotate fully, or rigidly as below. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (1 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Tip You can also skin selected joints in the same way you would complete skeletons, but you would do this with different geometries, such as skinning the hand, then the arm, and so forth. Trying to skin one object separately to two joints brings up some tricky partitioning problems, and fixing them is usually not worth the effort. Instead, if you have to do something like that, try creating lattices with the object s control points instead and skin them to the selected joints.
Rigid Skin Editors Open Window Ø Relationship Editors Ø Deformer Sets, and you will see two jointSets, one for each joint. The two sets contain all the points of the cylinder, and if you remove any of the points from the sets, those points will cease to be bound by the skeletons. Open Window Ø General Editors Ø Component Editor, and select the Joint Clusters tab. There are now two columns for the jointClusters. Select all the CVs of the cylinder and click Load Components in the Component Editor. You will see the points weighted under the joints they belong to. You can manipulate the weights here to make the bending smoother if you want to. For most situations, however, there are more elegant ways to make the bending smoother. Tip If you have trouble selecting CVs with a pick mask because the skeleton gets selected over the CVs, switch to component mode and select them. Skeletons are not selected in the component mode.
Flexors The easiest way to make joints bend smoothly is to use a flexor, a special type of deformer that works with rigid skinned joints. There are three types of flexors: lattice, sculpt, and cluster. You will usually want to use the lattice.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (2 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Joint Lattice Select the skeleton, and apply Go To Bind Pose. The cylinder is no longer deformed. Select the second joint and, from the Skin menu, apply Edit Rigid Skin Ø Create Flexor. Leave everything at the default setting and click Create. A joint lattice (or flexor) is created, with its orientation the same as the joint s local axes. Rotate the joint 90 degrees again, and you ll see that the bending is smoother the flexor deforms the cylinder around the joint. You can further change the way the flexor is deforming by selecting it and then editing its attributes in the Channel box. The next illustration shows how each attribute changes the way the flexor deforms the cylinder.
Bone Lattice You can also apply flexors to bones, but bone flexors are applied a bit differently. Their deformation is affected by the rotation of their child joint. Think of biceps and triceps bulging when you rotate your forearm. To try a bone flexor, select the first joint and apply Create Flexor. In the Create Flexor option box, turn off Joints and check At Selected Bones. Click Create, and a lattice is created around the first bone. Rotate the second joint 90 degrees, select the flexor, and, in the Channel box, change the values for the boneFlexor attributes. Notice that, instead of Creasing and Rounding, boneFlexor has Bicep and Tricep as the first two variables. You can easily get something like a) in the next illustration. You can move, rotate and scale the flexors to adjust the way they are affecting the skin. In the Outliner, select the lattice group, which selects both the flexor and its latticeBase, and transform it. You can see the way the skin deformation changes while you are transforming the lattice group: b) is the result of the lattice group being moved and rotated.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (3 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Sculpt Flexor You can also use a sculpt sphere as a flexor. It works just like a regular sculpt deformer, and there are no automated attribute controls as with lattice flexors. To have those controls, you need to use Set Driven Key. You can use the sculpt flexor as a bulging upper arm if you want, or as other parts of the body that regularly stretch with joint rotations, such as chest muscles. It can be applied as a joint flexor as well, although it is generally used as a bone flexor.
Cluster Flexor Cluster flexors have no options attached to them, and they exist only within joints. You can manipulate the smoothness of the joint s deformation, as well as the distribution of the parent and child joints deforming influences. Select the joint with the cluster flexor and press T to activate the manipulator handle. It shows two rings: one for the child joint, and another for the parent joint. The center of the rings slide up and down the bones, changing the joints Upper or Lower Bound values, and the radius of the rings changes the Upper or Lower Value values. Below are some of the ways you can change the bending with a cluster flexor.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (4 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Go To Bind Pose Do not confuse the Skin Ø Go to Bind Pose command with Skeleton Ø Assume Preferred Angle. The latter rotates the joints back to their creation positions, which can be changed with the Set Preferred Angle command. Bind Pose instead keeps track of not just the rotation but all the transformation values of the joints when the object was skinned. If you decide to detach and reattach skinned objects, you would want to reposition the skeletons to their Bind Pose again. In order for Go To Bind Pose to work properly, the joints must not be locked. Often, however, some of the joints will become locked, because of constraints, expressions, or keyed IK handles. In such case, you can temporarily disable these nodes by going to Modify Ø Disable Nodes and selecting the nodes causing the blockage. Copy Flexor Copy Flexor function allows you to copy flexors to other joints. This is useful for creating flexors on the mirrored joints, or creating flexors on finger joints. Simply select the flexor you want to copy, then select the joint you want it copied to, and apply Edit Rigid Skin Ø Copy Flexor. If you have many copies of the same flexors deforming something like finger joints, and you are comfortable using the Hypergraph, you can try setting up the connections so that one flexor node can drive all the lattice nodes. This would be especially helpful if you had to animate the attributes for all the flexors.
Edit Membership and the Artisan Tools We ve already been introduced to the Edit Membership, Paint Weights, and Paint Set Membership tools under the Deform menu. Rigid skin works with all of these tools. Note Smooth skin does not work with these tools, because it has only one cluster set. It uses the Paint Skin Weights tool instead for weighting points. We are back with the cylinder and the two joints. Delete all the flexors, go to Bind Pose, and apply Detach Skin. Select the skeleton and the cylinder, select Bind Skin Ø Rigid Bind Ø, turn on Color Joints, and click Bind. Note that the joints are now colored. Rotate the second joint 90 degrees as before. Select Deform Ø Edit Membership Tool, and the mouse arrow changes shape. Select the first joint, and all the points belonging to it are highlighted, as below. Shift + click on the points at the bend to include them to the first joint, until you see something like the picture on the right side below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (5 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Select the cylinder, and select Deform Ø Paint Set Membership Tool Ø. In the shaded mode, the cylinder shows two colors, representing the points that belong to the two joints. You can see here (and in the Color Gallery on the CD) that because the joints themselves are colored, you can easily identify which part of the surface is being bound by which joint. Select the second joint, and you can add points to it with the paintbrush.
With the cylinder still active, select Deform Ø Paint Weights Tool Ø. Set the Operation setting to Smooth, and select the second joint for the Clusters setting. Now the cylinder s color has changed again. The cylinder is black, except for the section bound by the second joint. (You can also see this image in the Color Gallery on the CD.) The smoothing operation actually reweights the points in the second joint. You should always keep the brush at low settings, and it may take some practice, but once you get used to smoothing the weights, you can very efficiently smooth out the bend. Using these Artisan tools (introduced in Chapter 9) is definitely faster than using the Component Editor.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (6 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
For fine control over deformations such as bending and bulging, you still need to use flexors and other deformers, but for simple smoothing tasks, or creating organic weighting around a surface, Artisan should be used. It creates a lighter scene, without the extra deformer nodes.
Smooth Skinning For each object being skinned, smooth skinning creates one cluster set of points, which can be influenced by more than one joint. You can set the number of joints that can actually influence the points in the Smooth Bind option box, but all the joints in the skeleton can potentially influence the smooth skin. The advantage of smooth skinning is that it creates a simpler and (computationally) lighter scene than rigid skinning. You do not need flexors or the Edit Membership tool to edit points in the cluster set. If you need that kind of deliberate control over the bends, you can always use deformers or influence objects, which are deformers specifically set up to work with smooth skinning. Artisan s Paint Skin Weights tool (Chapter 9) is especially useful with smooth skin. Because there are often many joints influencing a skin point, weighting dense smooth skins could be quite a challenge otherwise.
Creating Smooth Skin Let s get back to our cylinder. First use Go to Bind Pose, and then detach the skin. Select the cylinder and the skeleton, select Bind Skin Ø Smooth Bind Ø, click Reset, and then slide Max Influences down to 2. The default Max Influences is 5, but you d rarely need anything higher than 2 or 3. The default Bind Method is Closest Joint, meaning joint influence priority is based on joint hierarchy. If you choose Closest Distance, joint hierarchy is ignored and whatever joint is closest to the skin point will have the greatest influence. Unless you specifically want it to be this way, this is not how a hierarchically structured character deforms. You should generally leave this setting at default. Click Bind, and the cylinder is smooth-skinned. Rotate the second joint 90 degrees, and notice the difference in the way it bends as in the first cylinder below: the skin deforms a lot more smoothly. Too smoothly, in fact. We want a bit more rigidity around the bending area than the default setting, something like the second cylinder in the next picture.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (7 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Weighting Skin Points Before we address the lack of rigidity, however, let s see the differences in the smooth skinned cylinder from the rigid skinned one. Go to the Relationship Editor and choose the Deformer Set Editor, and notice that there is only one set. In the Component Editor, under the Skin Clusters tab, you will notice three columns of joints, including the very end one, and they all share in influencing the skin points. All the numbers in a row always add up to 1, meaning 100% influence. Select the cylinder, and select Edit Smooth Skin Ø Paint Skin Weights Tool. Set the brush values low, set Operation to Add, and select the second joint to work on. The cylinder is black except for the area that is being influenced by the second joint. You can easily make the bend more rigid on the second joint, as below (this image also appears in the Color Gallery on the CD). Repeat the process for the first joint. If you make a mistake, you can always undo it, and if you want to restart from the beginning, just select the object and apply Edit Smooth Skin Ø Reset Weights To Default. When you are in the Paint Skin Weights mode, you can also select different joints for weighting by RM choosing Paint Weights over the joint you want.
Influence Objects
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (8 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Let s say we want the biceps and triceps to bulge. We can use an influence object to accomplish this. Create a sphere and scale it to fit in side the upper arm. Select the cylinder skin, then the sphere, and apply Edit Smooth Skin Ø Add Influence with the default settings. The sphere becomes an influence object, like a lattice deformer, with a hidden sphereBase object also created. You will generally leave the Base object alone, although you can optionally pull points of the Base object to change the deformation effect of the sphere. You can use Set Driven Key to automate the bulging by scaling up the sphere when the second joint rotates, as below. The influence sphere and the sphereBase should be grouped under the first joint.
Warning Do not delete an influence object the regular way, as it will mess up the smooth skin weighting. Select first the skin and then the influence object, and apply Edit Smooth Skin Ø Remove Influences. We used a sphere, but we could have used any object with control points. The biceps and the triceps above look shapeless. Let s try the Influence object again, this time deforming a torus to get more definition for the biceps and triceps. Set up a torus as an Influence object with Minor Sweep at 180 and everything else at the default setting, as below. Select the skin and, in the Channel box, open the skinCluster and set Use Components to On. An easy way to do this is to enter 1 in the field. When this is turned on, component-level deformation of the influence object influences the skin as well. Sculpt the torus until the upper arm takes on the shapes for biceps and triceps as on the left below. Keyframe the CVs, and move to a different timeline. Rotate the second joint, and sculpt the torus again until you see bulging biceps and triceps as on the right below. Copy the bulging torus.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (9 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Move back to the frame where the torus CVs were keyframed. You can now delete the keyframe. Apply Blend Shape to the torus, making the copied torus its target. In the Channel box, open the blendShape channels, highlight the nurbsTorus target, and RM choose Set Driven Key. Make the blend shape driven by the joint rotation, as shown here:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (10 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Binding the Puppy Now let s return to the puppy from the last chapter. We are first going to create two lattices, one for the puppy s head, another for the body. Then we ll bind the two lattices plus the tail and the legs to the skeleton as smooth skin. The skeleton will deform the lattices, which will then deform the puppy s head and body. This method of indirectly moving the puppy using lattices is easier to weight, and it produces smoother deformation. We ll first have to solve a double-transformation situation (discussed under General Deformation Controls in Chapter 12), and then we can weight the skin objects as we test the dog s movements. 1. Open the file you saved as Puppy_skeleton. Create a skeleton layer to control the visibility of the skeleton, IKs, and constraints. Hide the layer for now. Select the head patches, eyes, ears, and nose; then go into component mode and select all the CVs, except the last two rows of the neck area, as shown below. Create a default lattice, and increase its STU divisions to (4, 5, 5).
2. Creating the body lattice is a bit more involved. You have to select rows of CVs from different patches, and it may help to create a temporary set in the Relationship Editor to contain all the points for selection purposes. Select all the CVs of the body patches. Select the two rows of CVs from the neck area. Select the top three rows of the front leg patches. Select the top two rows of the back leg patches. Finally, select the bottom three rows of CVs of the tail patches. The following pictures should help.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (11 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
3. Try moving the lattices to see that none of the points that should be included have been left out. Select the lattices, the leg patches, and the tail patches. Unhide the skeleton, and include it in the selection as well. Apply Skin Ø Bind Skin Ø Smooth Bind Ø, click Reset, reduce Max Influences to 2, and click Bind. Maya starts to create a skin cluster for each of the patches and the lattices. Open the Relationship Editor and go to the Deformer Set Editing module. You should see 24 sets altogether. There are two lattice sets and 22 skin cluster sets: 16 for the leg patches, 4 for the tail patches, and 2 for the lattices. Remember, they are smooth-skinned objects now as well. 4. We have a double transformation with the lattices. Grab the top skeleton and move it up some of the leg CVs and the tail CVs are translating further than they should. There is a simple way to fix this problem. Highlight the body lattice set, apply Edit Ø Select Set Members, and you should see the CVs for the body lattice get selected as shown next.
Highlight all the skin cluster sets (not the lattice sets) and click on the minus button at the top, or choose Edit Ø Remove to get rid of the selected items. The offending CVs are removed from the skin cluster set, and the dog should look normal again. Move the dog down to its original position.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (12 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
5. Start weighting from the head. With lattices, you have to use the Component Editor to weight the lattice points. Rotate the head joints and see how the integrity of the head shape holds up. The head area should mostly be fine with the default setting. You will probably want to set the lattice points around the face all to 1 in the Component Editor.
6. Create a cluster on the ears. Select the CVs as below, and apply Create Cluster with Relative mode on. Weight the points so that the bottom of each ear gets deformed the most. Group and parent it to the head joint. The ears should mostly deform well enough within the lattice, but in cases where they are going through the head geometry, you can use the cluster to adjust the ears.
7. As you are weighting the different parts of the body and rotating the joints, you can always use Go to Bind Pose. But if you move the IK handles or the constraints, the Bind Pose will not work. One way to handle this is to keyframe those nodes. After you ve tested them, you can return them to their original positions, after which the Bind Pose should work again.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (13 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
8. We can t go through all the lattice weight tweaking here, as it is a time-consuming process. To give you an idea of what s involved, let s go through a simple example of lattice tweaking at the chest area. The four points below are being influenced by Rarm, Relbow, Larm and Lelbow. The elbows, however, shouldn t be influencing the chest area, so punch in zero in the elbow columns. The arms are each assigned the value of 1 for two points. But the chest bone should be influencing the chest as well, so assign 0.5 in the chest joint. The value for the arm joints drops to 0.5 accordingly. As you can see, a lot of weighting actually consists of getting rid of unnecessary influences and thinking about which joints should be influencing the points, rather than punching in numbers.
9. You can use the Paint Skin Weights tool for the legs and the tail if you want, but apply them only if you see the need. In our case, the default skinning has done a fairly decent job of weighting. Once you are done with weight tweaking, save the file as Puppy_ready. You can try a four-legged walk cycle with it.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=805545150 (14 of 14) [11/27/2000 8:39:19 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 13 - Skinning and Character Setup Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Advanced Character Setup In Chapter 6 we built a human child s face, and in Chapter 7 we built his polygon hand. In this section, we will go through how the child s body is built the torso, the arms, the legs, and the shoes. We will then import the hand, build a skeleton for him, put IKs on the joints, put in set-driven keys and constraints, build a proper hierarchy suitable for animation, lattice his torso, rigid-skin the geometry, apply flexors, and weight the points. All this in half a chapter? Well, this is an advanced tutorial; we ll cover most of the steps in accelerated outline form. Check the illustrations carefully to infer the many little details we are necessarily leaving out.
Building the Body
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (1 of 13) [11/27/2000 8:39:44 PM]
Books24x7 Mastering MAYA Complete 2
In completing the child model, we will first create a sleeveless shirt in NURBS, which will then be converted to polygons. Arms will be created to connect smoothly with the shirt, and hands built in Chapter 7 will be connected to the arms; then we ll create the shorts, legs, and then the shoes.
Torso and Arms Open the file Child_head from the CD, or the one you ve built. We ll build the torso as a sleeveless shirt, because doing that conveniently bypasses the tricky problem of creating a seamless shoulder. We start out with a torus, with Minor Sweep set to 180. Sculpt it to resemble the image below, tucking it at the top and at the bottom, with a cylinder for the arm. You should pull the neck area down so that it seems to disappear into the shirt. Cut the torso in half, and intersect it with a plane. Position the plane so that it makes an acceptable shirt opening. The plane here is straight, but you can curve it as you see fit. Increase the span of the cylinder and roughly shape it like an arm.
Create curves on surface with the torso and the plane by using Intersect Surfaces and then Trim. Duplicate curves from the cylinder, and offset and duplicate curves from the trim edge of the torso, or a shirt, as in image a) below. Rebuild the curves into uniform 8-span curves and then loft them. Use the curves to sculpt the arm a bit more, and then you can delete them. Duplicate the geometries with scale 1, and you will see something like image b).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (2 of 13) [11/27/2000 8:39:44 PM]
Books24x7 Mastering MAYA Complete 2
Tip This has been emphasized already, but build models as simply as you can. You can always increase isoparms; it s hard to do the opposite. With the arms, you ll probably insert more isoparms later when we are at the skinning stage; but when you re modeling, one less isoparm is one less thing to worry about. The trimmed shirt is converted into polygons, its two halves combined, and separate edges merged (Note the soft edges in image a) next) except for the side opening. The lofted edge surfaces (b) are converted and combined, but not merged. The thickness comes with a cost, however; the shirt s geometry becomes heavier (c). If you wanted still a better-looking shirt, you would also add thickness to the neck opening as well. The shirt was touched up with Artisan at the end.
Pants and Legs (and Shoes) The pants are built from a cylinder. It becomes one side of the pants and is sculpted using Artisan and pulling CVs. Attach and sculpt a bit more, creasing the crotch area as shown next.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (3 of 13) [11/27/2000 8:39:44 PM]
Books24x7 Mastering MAYA Complete 2
Another cylinder is used for the leg, is mirrored for the other leg. Note the bunching of CVs at the knee area. The shoe is created from a sphere. Several sections are bunched up at the sides to make the bottom flat, and it is perhaps too simple a shoe, but it ll deform well enough.
Hands Open the file Child_hand from the CD or the one you ve built. It s a bit big and long for the child, so scale it down appropriately. There are different ways of attaching hands to arms. You can build them as seamless NURBS objects, or hide the seams by overlapping their surfaces as shown below. You can also give the character wristbands, or a watch, or gloves to wear. Finally, check to see that all the normals and UVs are going in the right direction. Checking this now will save a lot of hassle when texturing the surfaces later.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (4 of 13) [11/27/2000 8:39:44 PM]
Books24x7 Mastering MAYA Complete 2
IK Setup We ve already gone through much of the skeleton setup process in Chapter 11. Again, there are some general rules to follow: "
Choose the window where you will create the joints carefully the bending should always occur as Z rotations.
"
The local rotational X axis should be pointing directly into the child bone.
"
Limit degrees of freedom when they apply.
"
Test to make sure the mirrored joints are rotating properly.
Also, this is the last stage where you can readily make changes to your model. In particular, check for proportions and see whether you need to increase isoparm numbers. When you have the shoulder chain made, for example, skin just the arm and the hand and try bending them different ways. You may find that the arms are too short or that more isoparms need to be inserted.
Spine The spine joints will be moved by the IK Spline tool, which allows us to build it more like the human spine, as shown below. The joints must have no limitations otherwise, the spline won t work. Note the start joint is one above the root joint. The curve is four spans, which means it has seven CVs. Create three clusters the first one containing six CVs, the second containing four, and the third containing the top two and display their handles. They will serve as three spline control handles. Parent the clusters to the Root joint, and note that extra group nodes are created for them.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (5 of 13) [11/27/2000 8:39:44 PM]
Books24x7 Mastering MAYA Complete 2
Shoulder and Leg Chains We want the shoulder joint to primarily bend up and down, so create it in the Front view, as in a) next. Create the arm chain in the top view, because you want the chain to be bending forward, as in b). Take note of the extra joint at the end of the chain. Name the second-to-last joint wrist and the last joint hand. We ll be using the extra joint to set up a special orientation constraint. Group the arm chain under the shoulder joint, and then group the shoulder chain to the joint where the IK Spline ends, as in c). Note the difference in the local rotational Z axis for the joints. The hand joints should be created so that Z rotation bends the fingers down, whereas the thumb bends sideways at an angle, as in d).
The leg chain should be created from the Side view, since we want the legs to bend back and forth. Build the joints as in a) next. Once that s done, group the chain under the root joint, and mirror the leg chain and the shoulder chain. You should see something like b). If you have set limitations to any of the joints Degrees of Freedom setting, check to make sure they are active on the mirrored joints.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (6 of 13) [11/27/2000 8:39:44 PM]
Books24x7 Mastering MAYA Complete 2
IKs, Constraints, and Hierarchy Setup Once the joints are all built, we can put IK handles on the arms and the legs. The IK handles will then be constrained to the cubes. The cubes will give us better visual feedback in selecting and transforming the arms and the legs than using just the IK end effectors. Hand Cubes We ll use the ikRP Handles option setting, because you can get more rotational control with it. Start an IK handle at the left arm joint, and end at the wrist joint. Create a polygon cube, scale it as you see below, V+drag it to the wrist joint, and point-constrain the IK handle to the cube. What we will do now is a bit complicated. We want the hand to have an orientation constraint to the cube so that we ll only need to animate the cube for translating the arm and rotating the hand. This setup is especially useful when you need to have the character s hands stay planted not only positionally but also rotationally pushing against a wall while the body is moving, for example. But we also want to make the wrist joint rotate only in X and the hand joint rotate only in Y and Z. That way, we can make the wrist joint influence the forearm deformation, while restricting the hand joint s influence to the wrist area for bending in Y and Z. Select the cube and then the wrist joint, and select Constraints Ø Orient. If the wrist joint rotates or flips, go into its Attribute Editor, and adjust its Rotate Axis value for X (the other two don t matter) under the Transform Attributes section to offset the rotation and get it back to the initial position. Go into the dependency graph or the Connection Editor and disconnect the rotate Y and Z constraint from the wrist joint. Apply an orientation constraint again to the hand joint; but this time, disconnect the rotate X constraint from the hand joint. Check the Color Gallery on the CD to see how things should look afterwards; the joints that appear in pink there are the arm, the elbow, the wrist, the hand, and the fingers. You can proceed to lock all the channels for the wrist and hand joints, except for wrist X rotation and joint Y and Z rotations. Repeat the same steps for the right arm.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (7 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
Foot Cubes Setting up the legs for animation isn t as involved as the arms. The problem with the foot is that it has three pivotal spots: the ankle, the heel, and the ball of the foot. Trying to account for these pivot points can get very complicated, and for the sake of efficiency you may not want to bother. The simplest setup will only use one pivot point for the foot, generally the heel, and work around the other two pivots. We ll try for two here. First, create an ikRP handle from the leg joint to the ankle joint. Then create another handle from the ankle joint to the ball joint, as shown next. Snap a cube to the ankle joint, and slide it straight down to the ground level. The cube represents the heel. Press Insert, and snap the cube s pivot to the ball of the foot. Group the ankle IK handle under the cube, and the ball of the foot IK handle under the ankle IK handle. When you translate the cube, the whole leg moves, and when you rotate the cube, the leg rotates around the ball of the foot.
When you want to rotate just the foot, rotate the ankle end effector as shown below. When you want to rotate the leg around the ankle, use the ankle ikRP handle s Twist channel. Make the Z rotation of the ball of the foot joint driven by the X rotation channel of the end effector at the ball of the foot (also shown below). You should lock the translation channels for the IK handles and the Y and Z rotations for the ball of the foot IK handle as well. Pivoting around the heel would have to be simulated by rotating and translating the ankle IK handle.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (8 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
Hierarchy Setup Group the cubes together and name the top node Child. This will be the node you will use to translate the entire character, and its pivot should be placed somewhere around the child s belly area. Group the root skeleton under this node as well, and the skeleton setup is complete. If you want to, you can also set up set-driven keys for the finger Z rotations. The geometry should be organized as the following: Under the Face node, you should have all the face patches, hair, eyes, ears, and teeth (if you created them); and under the Body node, you should have the head, hands, arms, torso, pants, legs, and feet. The Face hierarchy will be grouped under the head joint, whereas the Body hierarchy will be skinned. Here you can see the finished skeleton, with IKs added and constrained, and the Outliner shows the hierarchy you will be using for animation.
Skinning and Weighting Our final steps in setting up the child for animation are to create a lattice for the torso, add a rigid skin, and apply flexors and weights. In the process, we ll see how the Preserve Skin Groups option enables us to correct skinning errors without extensive reworking.
Latticing the Torso We proceed in the same way that we skinned the dog. Create a set and add the polygon shirt, two bottom CV rows of the head, four edge rows of the arms, and top CVs of the pants, as shown next. Create a default lattice and increase the STU divisions to (4, 8, 3). If the shirt were denser and we wanted more detailed control, we could increase the STU divisions, but for what we have, it isn t necessary.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (9 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
Rigid Skinning and Membership Editing Select the Body node, which should contain all the geometry to be skinned, and the root joint; then apply rigid skinning with Coloring on. Move the Child node, and you will see points shooting out. Use the Edit Membership tool or the Paint Set Membership tool to go through all the joints that are double-transforming and remove the offending CVs, as shown below (and in the Color Gallery on the CD). Hide the surfaces and meshes, and reassign the lattice points to the spine chain in the following way. There are eight rows of lattice points, but the bottom row should be influenced by the legs, so leave them alone. Assign the second row to the spine joint, the third row to spine2, and so on. The chest joint gets the two middle CVs of the seventh row and the top two middle points at the front and the back. The forearm CVs are assigned to the wrist joint, so they will twist with the cube. When you are doing the legs, if there are many incorrectly assigned points, it may help to spread the legs out a bit. Go through other parts of the body roughly because you will find when you are weighting the surfaces that you ll need to reassign some points. Weighting points and editing their membership is necessarily an iterative process.
Preserve Skin Groups and Correcting Errors Oops! We ve made a horrible mistake, as so often happens in real life. We discover when we test the arms that they are too short, and that the hand joints should be placed closer to the hand. But we ve already skinned the geometry to the skeleton, and the skeleton has the cube constraints already in place. What do you do? Maya s Preserve Skin Groups to the rescue.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (10 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
Let s correct our terrifying mistake at once. Select the skeleton group and apply Skin Ø Edit Rigid Skin Ø Preserve Skin Groups Ø Detach Skeleton. Select the arm IK handles and in the Attribute Editor disable the IK Solver. If you ve locked the translation attributes for the joints, you also need to unlock them. You can now translate the elbow and the wrist joints to lengthen the arm. To place the hand joint closer to the hand, use the Insert key to move only the hand joint, as shown below. Move the wrist joint as well. Before you reactivate the IK Solver, you d also want to snap the cube to the new wrist joint position. Select the CVs of the arm and the hand and lengthen the arm, keeping the proportion of the CV positions. Make sure the fingers match the finger joint positions. Select the skeleton group and apply Reattach Skeleton.
Maya may warn you that the bind position has changed for a number of joints. Detaching and reattaching skinned objects may necessitate some reassignment of point membership. In our case, because the wrist and hand joints have moved closer to the hand, we need to update the previous set of membership of those joints and perhaps that of the thumb joint. Everything else should work just as before. This was an easy example of correcting a mistake in the setting up stage. In a production situation, one of the most frustrating things is to discover too late that there s a problem with the character you ve built. So right now would be a good time to check again what you have done so far for any potential problems. Once you ve gone through weighting a character, you will not want to weight it again.
Flexors and Point Weights Weighting is a major endeavor, and it can be quite frustrating. You can go bonkers trying to set up a character to move in all kinds of ways, but it is simply impossible (so far) to make a digital model move in all the ways a human being can. You should set specific limits to your character instead, like constraining the knees not to go above the waist, for example. By doing that, you ve simplified your weighting task a thousandfold. Once you have roughly gone through reassigning the points, you can create flexors to the fingers, wrist, elbow, and legs. It s a good idea to weight the points as you are creating the flexors. The finger, for example, has three joints, the second and the third of which take flexors; but the first joint, which connects the finger to the hand, is not an ideal flexor recipient. Apply the Artisan tool to the first finger joint, as shown next (and in the Color Gallery on the CD). It s more difficult to properly weight the palm than the back of the hand when the fingers curl. Fortunately, the palm is usually not visible when that happens! You would want also to use Artisan or the Component Editor to weight the forearm so it will twist smoothly. Also weight the shoulder area and the neck. For the shoulder, you need to test the shoulder joints as well as the arms. For the neck, make sure the head area is weighted at 100% so that it will stay with the face when the neck joint rotates.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (11 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
The crotch area is another difficult area to weight. You need to lift the leg up to the front and to the back to see how the pants stretch and fold, and also how it takes the ikRP handle twisting (shown below and in the Color Gallery on the CD). The joints at the ankle and the ball of the foot are other bending areas you should weight. As you go through these and other areas, it s crucial that you move the joints to get the character into different poses. What seems to be deforming smoothly in one pose may go berserk in another one.
Cleaning Up
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (12 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
Assuming that the model s been textured as well, which we ll get to soon enough (in Chapter 19), there are little things you can do to aid you in animating efficiently. Have the Child hierarchy set up in a Hypergraph window you can access while animating. Use layers to convert the geometry into reference objects now that you don t need to select them. You can hide the geometry if you d like and work only with the skeleton. Display selection handles for the root joint and the cubes so you can pick them in the window. The selection handles can easily be offset in the Attribute window. You can also create eye constraints if you want (so you won t have to rotate the eyes), by using Aim constraints. Delete anything that you no longer need, whether it s geometry, curves, history, or empty nodes. Save the file as Child_ready.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=671592859 (13 of 13) [11/27/2000 8:39:45 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 13 - Skinning and Character Setup Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter we ve covered rigid skinning and smooth skinning, using the puppy as an example of the latter. We learned how to edit point set membership and weight the points. The chapter also went through an advanced-level character setup, during which we tried to create a production-quality character and ready him for animation, covering a lot of important topics along the way. And that s it. No more tweaking CVs, applying IKs, or constraining. We are now ready to animate the child, and that is what we will do in the next chapter.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=696240731 [11/27/2000 8:39:50 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 14 - Character Animation-a Walk Cycle and More Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 14: Character Animation: a Walk Cycle and More Overview It s been a long time coming, but here we are, with a fully built model ready to be animated. In this chapter, we will be using the child model to go through a simple walk cycle step-by-step. Then we are going to use him for more interesting advanced animations, such as running, grabbing and throwing a ball, and, yes, somersaulting. Along the way, there will be selective presentations of a few of the more important classical animation principles. For a fuller treatment of classical animation and its mysterious ways, you should try perusing The Illusion of Life: Disney Animation by Frank Thomas and Ollie Johnston, which is still the most enlightening, entertaining, and inspiring reference book for aspiring animators. For studies in how people and animals actually move in real life, Eadweard Muybridge s photo books are still the definitive source for many artists.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=666219079 [11/27/2000 8:39:54 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 14 - Character Animation-a Walk Cycle and More Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating a Walk Cycle Walk cycles are used very often as animation lessons because there s probably nothing more familiar than walking; just about anyone can go through the motions (or watch others walk). At the same time, a walk cycle requires you to be aware of and properly apply many fundamental animation principles. If you already have an animation background, this chapter may help you to get some needed sleep, but if you are still fresh from having entered the animation world, this chapter may turn out to be quite educational. You should take time to read through the explanations and understand them fully. When creating a walk cycle, you should be aware that there are two different types. The first type is a stationary walk where the ground seems to be moving under the character; this is the simplest kind of walk cycle. The second type is a more realistic walk in that the character actually moves forward. This second type is a bit more complex than a stationary walk but involves the same principles. We will be doing the simpler stationary walk. (You can see an example in the Color Gallery on the accompanying CD.)
Setting Up the Character To begin setting up a character, create a ground plane and stretch it out. Select File Ø Import, and open the Child.mb file from the CD. Translate the Child node up or the ground plane down until you see his feet just on the ground. Select the child geometry and press the 1 key to get into the rough display mode, as you want to concentrate on quickly creating rough poses. You can work with only the skeleton if you wish (and some animators do). Working with cubes is very helpful in such a case as they give you better visual feedback on how the arms and feet are rotating.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (1 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
Animation is a very iterative procedure. You can try to animate everything at once, right from the beginning, and some people do work like this. But usually you end up working at a much slower pace, and then you can easily lose sight of the forest for the trees lose your perspective on how the character is animating overall because you are bogged down on translating and rotating so many control nodes. It s much better to key in rough poses one or two nodes at a time, working on different parts of the character in stages, much like painting or sculpting. For the walk cycle, the workflow will be as follows. Animate the left leg first; then transfer and offset the animation to the right leg. Then animate the root and the spine joints, including the head. Animate the arms last. Once the rough animation is done, you can tweak and refine the function curves and change subtle details of the walk to give it more personality. At every stage, you would want to do simple playblasts to see how the keyframes move in real time.
Animating the Left Leg This is how you would usually start the walk cycle and it sets the framework for all the rest of the walk in terms of time and distance covered. You need to decide how many frames the cycle should be. Bigger and heavier characters tend to walk slower, whereas lighter characters walk faster, but you can infer more than just that. For instance, a slow walk done well can convey seriousness, dignity, and grace in a character such as a king or a queen at a coronation, whereas a fast, bouncy walk can convey the lightheartedness of a clown or the intense energy of a soldier. Long steps can imply confidence or urgency, whereas small steps can imply shyness, or leisure. Different walks can reveal many things about a character. To begin animating the left leg, set the animation speed to 30 fps (frames per second) by going into Options Ø General Preferences Ø Units, and changing Time to NTSC (30 fps). We ll do a fairly brisk walk and make the cycle 24 frames. This is an easy number to deal with, as it gives us 12 frame halves and 6 frame quarters. In the modeling window, translate the LfootCube (left foot cube) in X to 1.5, and animate the LfootCube and the Lball_ikHandle (which rotates the toe area of the foot) together. Start out with an extreme pose, where the legs are widest apart at frame 1. The heel is just touching the ground, and the toes are curled as in the figure below. Copy the keyframe at frame 25 by MM dragging the current time indicator. Go to frame 13, and translate and rotate the cube and the toes to the back.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (2 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
At frame 16, the foot is actually farther back than at frame 13 because it takes time for the ball of the foot to press down to the ground and kick up. But it covers more distance between frame 16 and frame 20 as a result. This kind of delay and recovery in the foot s motion creates the appearance of weight. It also makes the movement snappy. If there was no keyframe 16, and you keyframed only 13 and 20, it wouldn t make a lot of difference, but that subtle extra kick would be missing. Try playblasting both, and see if you can notice the difference. If you were to ignore keyframe 20 as well, the leg might appear to be floating more than walking, a common mistake a lot of beginners make. Floating usually happens when a keyframe is missing from where it should be and the computer automatically calculates the in-betweens. It s important to achieve realistic motion here. When a client or audience criticizes an animation, lack of weight or snap is a common complaint; and the reaction that a character just floats is usually the death knell for the animation.
Copying the Animation Now we need to copy the animation from the left leg to the right. With the cube still active, select Edit Ø Keys Ø Copy Keys Ø, click on the Below setting, and then click Copy Keys. Select the RfootCube. Select Edit Ø Keys Ø Paste Keys Ø, type 12 in the Time Offset field, and click the Paste Keys button. Select both cubes, open the Graph Editor, and apply View Ø Infinity, then Curves Pre Infinity Ø Cycle, and then Post Infinity Ø Cycle. Select the Translate X curve for the RfootCube, and change its value from 1.5 to 1.5. You should also change the Rotate Y to its negative value as well. Now the legs walk together and cycle indefinitely, with the right leg s animation trailing the left leg s by 12 frames. You can also see this view of the Graph Editor in the Color Gallery on the CD.
Animating the Hips and the Upper Body http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (3 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
The next step in the walk cycle is animating the hips and the upper body of the child. The pelvic area, or the root joint, must be animated first, and then the upper body, because the upper body rotation values are dependent on the pelvic movements.
The Root Joint The pelvic area moves in many different ways in a walk cycle: you need to translate the root joint up and down, but it also has to rotate in X and Y. (For the root joint created in the side view, the X axis is going up the spine, Z rotation is bending forward and back, and Y rotation is rotating sideways.) You could rotate the joint in X just a bit and translate it in X as well, if you want. A female walk usually has greater X translation, making her hips sway, whereas a male walk generally doesn t have any. Rotate the root joint first; at frame 1, when the left leg is forward, the joint should be rotated in the direction of the right leg about 10 degrees in X. Repeat the keyframe at frame 25. At frame 13, it should be 10 degrees. (This is not a set rule; you can rotate the joint 20 or 30 degrees if that s the kind of walk cycle you re going for.) At frame 7, rotate the joint 5 degrees in Y, and at frame 19, rotate it 5 degrees. (Again, a female walk would generally have at least twice that amount of rotation in Y to make her hips sway more noticeably.) You also need to have the body rotated in Z about 5 degrees because the body needs to be leaning forward.
Tip Walking is often referred to as a continuous falling. When you walk, your body is pushed by the leg in the back position, and then the body leans and falls forward. If it weren t for the back leg speeding ahead of the body to break the fall, your body would actually fall to the ground. For the up-and-down movement, there are a couple of things you need to keep in mind. First, contrary to what you might think, frame 1 is not when the body is the lowest; that occurs around frames 3 or 4. At frame 1, the front foot touches the ground, preventing the body s fall, but the weight of the body still makes it sink before it can spring back up. The heavier the body, the longer this recoiling will take. Then, around frames 7 or 8, the body reaches its highest position. If the recoiling process takes longer, the steps become a heavy, serious walk. If the body hangs in its highest position a bit longer, then the steps become a light, bouncy walk. Try both styles, and playblast to see the difference.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (4 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
The Graph Editor here shows the root joint s Translate Y function curves for different walks. Just by looking at these curves, you should be able to tell that the first one is a fairly bouncy walk, the second is an extremely bouncy walk, and the third is a heavy walk. Notice how fast the body goes up in the extremely bouncy walk and how slowly the body goes up in the heavy walk.
Understanding Squash and Stretch, Rigidity, and Volume One of the corollaries of a character (or anything) having weight is a principle called squash and stretch. In classical animation, this is considered one of the cardinal principles. In our preceding example of the body sinking to its lowest recoil position around frames 3 or 4, the character is being squashed by the force of gravity and the resistance of the ground. When it bounces up, the body stretches to its highest point. What is a subtle movement in real life often becomes greatly exaggerated in animation. Especially in cartoonish animation, squash and stretch in characters can become extreme. In order to use the squash-and-stretch principle properly, you have to always apply it as a consequence of weight. Weight is force times mass (remember high school physics?), so something that has more mass will squash more; it will also squash more if more force is applied. This principle, however, needs to be balanced with another factor called rigidity.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (5 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
In real life, rigid bodies such as tables or chairs do not squash or stretch at all, or so little as to not be noticeable. In animation, especially in cartoonish animation, this physical reality is often overlooked, and you will see objects such as an anvil or a boulder being squashed and stretched as if they were made of rubber. But the fact is that the more rigid a thing is supposed to be, the less it should squash and stretch. Carelessly applying squash and stretch to what is supposed to be a rigid object (or character) can undermine its believability. A steel hammer, for example, even if it walks and talks, should stay mostly rigid if we are to believe that it is made up of steel, that it is a hard object. If it squashes and stretches like some soft, rubbery substance, then its characteristics as a hammer are undermined. When applying squash and stretch, another factor to keep in mind is consistency of volume. When a water-filled balloon is put on a hard surface, for instance, gravity causes the mass of the water to exert pressure on the rubber, meaning, of course, that the balloon squashes. But as it flattens, it also stretches out sideways because the volume of the water hasn t changed. Even cartoon characters need to have a sense of volume, and once a character s form becomes easily recognizable, that sense of volume must be maintained.
The IK Spline Handle, Clusters, and the Chest Animating the upper body is mostly a matter of counter-rotating and counter-counter-rotating. When the root joint is rotating one way, the shoulder rotates in the opposite direction, moving to counterbalance the upper body against hip rotation. You can use the IK spline handle s Roll and Twist attributes to twist the spine; animate them as illustrated in the following graphic. At frame 1, the Roll and Twist values are 10 degrees; at frame 13, they are 10 degrees; and at frame 25, they return to their original values. The twisting causes the body to lean sideways a bit, which you can fix by rotating the bottom cluster that controls the CVs of the spline curve. Note the cluster1Handle s Rotate Z curve in the graphic below (and in the Color Gallery on the CD). The body should stay upright all the time.
The face should always be facing forward as shown in the preceding graphic, which means that the neck bone should be rotated to counter the Roll and Twist of the Spline handle. Note the neck joint s Rotate X curve in the preceding graphic. You could change this later to add more personality to your character.
Animating the Arms
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (6 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
Arm movement follows the shoulder specifically the shoulder rotation transferring the translation motion like a wave starting from the shoulder and moving down to the fingers. First, you need to lower the shoulder joints about 10 degrees in Z. Because the shoulder-bind position is for outstretched arms, when they come down so should the shoulders. (Don t worry about the fingers for now.) Move and roughly rotate the LhandCube, as shown next.
The cube follows the shoulder rotation about four frames behind; it reaches its extreme position at frame 4. This is called follow-through or overlapping action in classical animation. Loose limbs such as the arms do not stop when the object they are attached to comes to a stop but rather continue to move for a few more frames, perhaps dangling a bit, before stopping. So when the shoulder rotation changes direction, the arms follow through and alter their movements a few frames later. This is also called overlapping action because the change in the direction of the shoulders overlaps with the change in direction of the arms. The following curves illustrate this animation principle (you ll find a better view in the Color Gallery on the CD):
Once you are satisfied with the way the arms are moving back and forth, rotate the hand to make it follow through the arm movement about three frames behind. It may help to get rid of the rough rotations you had keyframed and start over from frame 7. The hand rotation in real life is usually nonexistent or very subtle. In animation, however, you may want to exaggerate the rotation to make it more noticeable. Examine the following poses and the overlapping curves (you ll also find this in the Color Gallery on the CD).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (7 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
You may choose to animate the fingers as well, making them overlap the hand rotation by just a frame or two, but you ll probably want to just curl up the fingers a bit and keep them that way. Fingers generally do not move when you walk. Now we can transfer the animation we created on the left arm to the right arm by using the copy and paste functions in the Edit Ø Keys submenu. Copy the animation from LhandCube to RhandCube with an offset of 12 frames, change the X translation to its negative value, and cycle both cubes. The hands will now sway correctly, but the rotation values of the right hand are wrong. To correct this, keep the same X rotation values but mirror (scale to 1) the Y and Z rotations. Go to the Graph Editor, and select the Rotate Y and Rotate Z curves. Select Edit Ø Scale Ø, set the Value Scale to 1, and click Scale Keys. Now the hands should rotate correctly. Save this file as Walk_regular.
Creating More Interesting Walks The walk the way it is now has all the characteristics of walking, but it s boring. And boring in animation is synonymous with dead. But you can easily tweak the curves, now that you have them to play with, to create much more interesting walk cycles.
The Happy Walk The walk is already fast, so just increase the bounce to be a bit snappier, a bit higher, which is more characteristic of a happy walk. The front knee should be raised a bit more when the body is passing its highest point. Rotate the root joint forward, including the bottom cluster, and then rotate the second and third clusters back so the spine will arch back. Rotate the neck as well so the child s chin will be pointing up. Animate the shoulders to lift a bit when the attached arm is forward. Bend the arms and lift them up more when they are forward, and, by rotating the Twist attribute of the arms IK handles about 20 degrees, make the elbow come out to the side. You may also want to rotate the Roll and Twist of the IK spline handle more as well. Of course, putting a smile on his face isn t a bad idea either.
The Sad Walk
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (8 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
A sad or dejected walk is usually much slower, so RM choose Select All, select Edit Ø Keys Ø Scale Keys Ø, set Time Scale to 2, and click Scale Keys. Now the walk is half the original speed. You will want to adjust some keyframes for the feet so they won t seem to be moving in slow motion. All the rotations are scaled down the hip rotations, the shoulder rotations, and the arm rotations. The arms should generally be drooping at the front, and the spine should be hunching forward, head downcast. The bounce should disappear, and when the back leg is coming forward, the knee shouldn t go up as high. (The happy and sad walks are illustrated on the next page.)
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=543818012 (9 of 9) [11/27/2000 8:40:15 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 14 - Character Animation-a Walk Cycle and More Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Advancing Beyond Walk Cycles Clearly, it would be very difficult to present in this chapter all the techniques for animating a human character. Instead of attempting to undertake that nearly impossible task, we ll provide tidbits of information to help you develop your own sense of animating a bit more wisely and intuitively. We ll continue to use the child model for our examples.
Creating a Run Cycle Running differs from walking in that when the body is at its highest position both feet are actually off the ground. A runner is constantly leaping or bouncing forward. Except for this one difference, a slow jog is almost exactly the same as a very bouncy walk. Also, as the run becomes faster, the body will lean forward more. Since we haven t done a forward-moving walk cycle, quickly going through the run cycle will also help to illustrate that type of forward motion. Start out with the front foot just touching the ground, as frame 1 of the next image shows. The child here is in full pose, but if you are going through this yourself, remember the rule about working on one or two control nodes at a time; you should concentrate on the feet and the hips first and then move on to the rest of the upper body. The foot translation and rotation as well as the hip rotation generally have to be worked out together because the hip rotates more in a run, and it s hard to accurately extend the leg when the hip hasn t been properly rotated first. The arms are kept more bent, and the body generally rotates and leans forward more. At frame 1, the body is coming down for recoil (squash and stretch), but it s more efficient if we move on to frame 7 for the opposite pose first and then come back to deal with the recoil. Go to frame 7, select the hand cubes and the root joint, and then move them forward. The left leg should translate forward by a significant amount ahead of the left foot cube, as in frame 7 of the next image.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (1 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
Click to expand
Translate and rotate the foot cubes and the root joint until you have the same pose as in frame 1, except with the opposite leg, as shown in frame 7 below (and in the Color Gallery on the CD). You don t need to punch in exactly the same values for the cubes in frame 7 as for their counterparts in frame 1 because later on you will edit the function curves anyway, but also because you should get into the habit of trusting your eyes as well. You then need to select the root joint and open the Graph Editor. Select the Translate Z curve, and apply Cycle With Offset. We now have a fixed rate of distance being covered by the run. Go to frame 13 and the body should automatically move forward. Make the child get into the original pose he was in at frame 1 and keyframe the pose. Select the root joint again, and in the Graph Editor, select and cycle all the curves except the Translate Z curve (which is cycling with offset). If you see that some of the curves are not cycling properly, move the keyframes to make them cycle smoothly. You should see curves like the ones below. Repeat this cycling procedure for the other control nodes as well.
Go back to frame 3, where the body is at the lowest position and is being squashed. For a regular run, the front foot will be flat, as seen in Frame 3 of the next picture; for a sprint, the weight of the body should be on the ball of the foot. Frame 5 shows the stretch; the body is lunging forward and is at its highest point, with back arched, the back leg stretched, and the front knee raised and bent. You also should raise the shoulders a bit at this point.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (2 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
Repeat the squash and stretch for frames 9 and 11. When you are done with the footsteps and the arms, cycle all the joints except the Z translation. The Translate Z function curves are cycled with offset. Afterwards, select the LfootCube and the root joint, and look at their Translate Z function curves. If you see them branching out like those in the top two lines in the next picture, it means the Lfoot Cube translate node should be modified. The correct cycle should keep the Z translation values between them roughly parallel, like those in the lower two lines in the picture. Do the same for the hand cubes as well.
Looking at Arcs and Staging Arcing is another important classical animation principle; in order to imitate life, you need to show motion as arcs, or waves. Nothing in this world moves in a totally straight line. Nature is comprised of arcs and waves, including all motion that occurs within it, as Tai Chi practitioners like to point out. We are told that even something as apparently straight as a ray of light is not perfectly straight. A run cycle, such as the one we just covered, is all wave motions, as you can readily see in the Graph Editor. But it s one thing to create wavy function curves and quite another to show them as wavy motions. Consider the often-used example of head-turning. Although the motion itself is an arc, depending on the angle from which you are looking at the head, the head-turning can appear as a straight-line motion. In order to show it as an arc movement, you need to either change the view or dip the head as it turns and then bring it back up. When you have roughly animated your character, get into the habit of going to the camera view and checking the lines the character s motions are creating. If you see a lot of straight lines even though the motions themselves are arcs, perhaps the camera view needs to be changed.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (3 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
This brings up yet another important animation principle called staging. No matter how great the action in a scene is, it has to be seen clearly in the first place. Staging a character involves making sure the character s actions are being accurately transmitted to the viewers. The run steps above, for instance, were shown in the side view because it best staged the motions of the body. If the same steps were captured in the front view, you would have a much harder time grasping what is going on. Classical animators will often only look at the silhouette of a character to determine whether the character s actions are being staged properly. Staging also involves making sure that only one principal action is being presented at one time. If you want to show a character getting up from a chair and also flashing a smile, it would be poor staging to have her do both at the same time; it would be much better to have her stand up first and then flash a smile, or vice versa.
Performing a Somersault The way the hierarchy has been set up for the child model s joints, IK handles, and control cubes, you should only use the Child node for translating the whole character, the root joint for the body, and the four cubes for arms and legs. But there are situations where you may want to change the hierarchy of the set-up to fit your animation purpose. Let s say you want a character to somersault over a table. If you rotate the top hierarchy node, the legs rotate with the body, which is what you want, but the arms rotate with the body as well, which is not what you want. You want the hands to stay fixed on the table while the body is somersaulting. You can do this by restructuring the hierarchy. Remove the hand cubes from the Child node by dragging them in the Outliner or Hypergraph. (You could also create another group node to include all the other nodes under Child, but, for our purposes, taking out the hand cubes is simpler.) Place the hand cubes on the table (cube), as illustrated below. Move and rotate the Child node to move both the body and the foot cubes, and rotate the root joint to bend the body. When the arms are going over the shoulders as in this case, you need to rotate the shoulder joints up and forward. Also, use the IK handle s Twist attribute to prevent the arms from twisting, and rotate the cubes so the hand will be ready to hit the table with palms down.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (4 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
It s always a tricky business to have a character s arms do things over their head, especially if you have to keep their hands planted in a fixed position, because the joints tend to twist and cause unnatural deformations in the shoulder area. It s important, therefore, to rotate the shoulders and the IK handle s Twist attributes properly at the right moments. The elbows should be pointing outward during the somersault as well. Placing the hands on the table and making them stay there would be a difficult endeavor if they weren t orient-constrained to the cubes. When the wrists get rotated as extremely as in our case, it s easy for the hands to flip. Adjusting the IK handle s Twist values usually gets rid of the problem. If you find that the hands are still flipping even after you ve adjusted the IK handle s Twist value, try placing the palms in such a way that the fingers are pointing inward. When the child hits the table, there is a squash (see below), a bending of his arms for recoil, and then a push-off (stretch) about four frames later. His forward momentum (Z translation in this case) shouldn t be slowed down if you can help it. Because the foot cubes are under the Child node, when you move and rotate the Child node, the feet move and rotate with it. You should animate the Child node first to get a rough sense of the somersault, and then you can animate the feet separately for folding and stretching. You should also rotate the root joint and the IK Spline clusters to make the child bend his waist and arch his back. You can find a complete version of this animation on the accompanying CD.
Catching and Throwing a Ball Animating a character interacting with things or other characters is always more challenging than working with a solitary character. Fortunately, it is more rewarding as well because you can develop a character much more fully when it is acting and reacting in a more complex setting. But what may be an easy task in real life, such as two people shaking hands, can cause severe headaches for the person trying to animate such a scene. Also consider the perils of animating something as detailed as a battle between two sword fighters. How do you make them grasp their swords with both hands, clash blades, briefly stick the swords together, and then merrily continue in their deadly ways? It s not for this book to figure out such things; you can tackle that one at a later date. Instead, we will only put you through the simpler task of grabbing and throwing a ball by animating constraints, which is essentially the way you would solve the more complex problems just described as well.
Grabbing the Ball
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (5 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
Create a ball (sphere) scaled to 1.5 uniformly, and group it unto itself, creating a parent node. Apply Modify Ø Center Pivot to make sure the parent node s pivot point coincides with the ball s. Place the child s hand on a table (cube), as demonstrated below. Create a locator, scaled to 3 uniformly, group it under the RhandCube, and place it somewhere near the hand (see the left picture below). Position and Orient-constrain the ball s parent node to the locator, and the ball should snap to the locator positionally and orientationally, as in the middle picture below. Move the locator closer to the hand, and rotate the fingers to make it look as if the hand is holding the ball. Keyframe the finger joints and the cube at frame 15, as in the right picture below. This is how the hand will be seen as grabbing the ball.
Select the ball s parent node and you will see pointConstraint and orientConstraint attributes in the Channel box. Select the Node State, where it should say Normal for each attribute, and keyframe them at frame 15. In the Graph Editor, you can see that a value of 0 is created. Go to frame 14, in the Channel box click in the Node State field to open the submenu, and select Block; keyframe that for both attributes. You should then see a value of 2 created in the Graph Editor. (Note that the curve created is a stepped curve.) Try moving the cube and you will see at frame 14 that the ball is not constrained to the locator. Keyframe the ball where it is (at frame 15) just to make sure the ball will be at that spot when the hand grabs it. Now you can animate the cube and the finger joints, starting from a distance at frame 1 and then swooping in to scoop the ball at frame 15, as shown next. (You can find a complete version of this animation on the accompanying CD.)
Throwing the Ball
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (6 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
Throwing a ball is essentially the same thing as grabbing a ball except that you are working backward. Start out at frame 25 with the ball constrained to the hand. Swing the child s arm as if he were throwing the ball, and reach the point of release at frame 30. This means he should be flicking his wrist between frames 30 and 32. Finish the throw at frame 35. Once you are satisfied with the throwing motion, go back to frame 30 and keyframe the ball where it is. Go to frame 31, select the ball s parent node, and, in the Channel box, change the Node State setting to Block for the Position and Orient constraints. Then, at frame 35, translate the ball to the direction where the ball has been thrown, and keyframe. Now, when you move the time slider, the ball seems to be thrown from the hand at frame 31 and then shoots out from there, as shown below. (You can find a complete version of this animation on the accompanying CD.)
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=525202807 (7 of 7) [11/27/2000 8:42:29 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 14 - Character Animation-a Walk Cycle and More Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter on animation, we went through a simple walk cycle step-by-step, and then we examined a few advanced-level animations such as running, somersaulting, and grabbling and throwing a ball. We also discussed a few of the more important animation principles. In the next and later chapters, we ll be switching gears in a major way. So relax and take a break; we ll soon be getting physical.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=431538675 [11/27/2000 8:43:13 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 15: Working with Rigid Body Dynamics Overview In this chapter, you will learn what rigid bodies are, when they can be useful, and how to apply rigid bodies to solve several situations where keyframing would either take too long or would not look realistic enough. Before you begin this chapter, you should be familiar with Maya s basic interface (Chapter 2) and how to create and move objects around the scene (Chapters 1 4).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=181422768 [11/27/2000 8:43:18 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What Are Rigid Body Dynamics? If you ve done any animation (either computer or traditional), you re familiar with the concept of keyframes, introduced in Chapter 10. Rigid body animation, on the other hand, is essentially a physics simulator built into Maya that tries to mimic (or completely exaggerate, if you want) what happens to real-world objects as they move under the influence of forces (like gravity or wind) and collide with other objects. If you ve ever tried to keyframe even the simple motion of a ball bouncing on the ground, you know how difficult it is to make a keyframed animation work in this scenario. If you try something more difficult, like bouncing a cube off a wall, it can get really frustrating trying to make the collisions look realistic. Fortunately, Maya has the answer for you: rigid body dynamics, or simply rigid bodies. Using rigid bodies is pretty straightforward: you create one or more rigid bodies; create one or more fields that influence it, such as gravity (if you wish); give the rigid bodies an initial position, velocity, and impulse (if you wish); and play back the animation. Maya s dynamics engine does all the calculations to make the body behave realistically, based on your initial information; you don t need a degree in physics, just a bit of practice with the settings you have available. Note Maya also uses its dynamics engine to create particle effects. See Chapters 21 through 24 to find out how Maya works with particle dynamics. Rigid bodies come in two flavors: passive and active. Passive rigid bodies are not affected by fields, and cannot be moved by collisions though they can take part in collisions. Passive rigid bodies are keyframable (so you can move them around). Active rigid bodies are affected by fields, and will be moved by collisions. They are not keyframable (so you can t move them around on your own). Generally, a passive rigid body would make up a floor, wall, or other object that is fixed to the world, while an active rigid body would be any kind of falling, moving, or colliding object (a basketball or a coin, for example). Although it would seem a great disadvantage that active rigid bodies cannot be keyframed, you can convert rigid bodies from passive to active at any time in an animation, allowing a rigid body to be passive for a time, and then to become active (we ll get to an example of this in a moment). Let s begin with a simple example to see how rigid bodies work.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=440244254 (1 of 2) [11/27/2000 8:43:20 PM]
Books24x7 Mastering MAYA Complete 2
What s New with Rigid Bodies in Maya 2? Rigid bodies are not significantly different (to the user, at least) in version 2 than they were in version 1 with one exception: A new Rigid Solver menu allows you to create multiple rigid body solvers, assigning different rigid bodies to different solvers. Assigning different (non-interacting) objects to different solvers allows Maya to solve rigid body equations more quickly and efficiently than it could in version 1.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=440244254 (2 of 2) [11/27/2000 8:43:20 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating a Simple Rigid Body In this example, you ll create a simple rigid body a bouncing ball and experiment with a few settings that will affect the motion of the ball. Start by creating a new scene in Maya. Create a NURBS plane and scale it out to about the size of the Maya grid. Now make a NURBS sphere with a radius of 1 and move it above the plane.
Now select the plane and choose Bodies Ø Create Passive Rigid Body from the Dynamics menu. The plane is now a passive rigid body. Next, select the sphere, and choose Bodies Ø Create Active Rigid Body from the Dynamics menu. The sphere is now an active rigid body. To allow dynamics simulations to play back properly, the playback rate has to be set to Free, so that the physics engine can calculate what it needs to before going on to the next frame. Either select Options Ø General Preferences and choose the Animation tab, or click the Animation Preferences button at the lower right of the screen to bring up the same window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=456847029 (1 of 3) [11/27/2000 8:43:26 PM]
Books24x7 Mastering MAYA Complete 2
In the Animation Preferences window, choose Playback Speed: Free from the Playback area.
Close the window, rewind the animation, and play it back. Warning You must rewind any animation that contains dynamics otherwise, the animation will not play back properly! You also cannot scrub through an animation by sliding the time marker back and forth. All dynamics data is calculated frame by frame, so if any frame is skipped, the calculations break down and the animation goes berserk. If this happens, just rewind the animation and start over all will be well again. Tip To rewind, either click the Back button on the playback controller (located in the lower-right corner of the screen; it looks like a VCR control) or press Ctrl+Shift+V on the keyboard. To play the animation, either click the Play button on the playback controller or press Ctrl+V on the keyboard. Nothing very interesting happened, right? Even though you have made two rigid bodies, you have not created any animation yet because you have not added any fields or initial motion. Let s create a gravity field to make things a bit more interesting. From the Dynamics menu, choose Fields Ø Create Gravity. Now open the Dynamic Relationships window (Window Ø Animation Editors Ø Dynamic Relationships), choose the nurbsSphere name in the Outliner on the left side of the window, and make sure gravityField1 is highlighted in the selection window on the right if not, be sure to click gravityField1 to highlight it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=456847029 (2 of 3) [11/27/2000 8:43:26 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you select the sphere before creating gravity, the two will automatically be connected. (If there are other active rigid bodies that you haven t selected, they will be unaffected by this force.) Now rewind and play back the animation. You should see the ball fall toward the plane and bounce off it. If the animation is cut off too quickly to see this, increase the number of frames in the animation to 200 frames or more (type 200 in the text field under the time slider). Now let s examine the rigid body settings for our objects. In the Channel box, you ll see rigidBody1 (or 2, or whatever) listed under the shape node for the object you pick. For now, pick the plane and then click the rigidBody1 text. Several text fields will pop up, giving you more control over the rigid body than you probably want. For now, just look down to these items: mass, bounciness, damping, static friction, and dynamic friction. Change the bounciness to 0.9 and replay the animation (remember to rewind first!). On the first bounce, the ball should bounce nearly as high as the height from which it was dropped, and it should take longer to settle to rest as the animation plays on. Now try setting the bounciness to 1.5. What happens? The ball bounces further up each time, soon disappearing from view talk about a super ball! In our virtual world, not only do we get to simulate reality, we get to break the rules if we want. Try playing with some other settings, like friction and damping and remember to play with the settings for both the ball and the plane. You can also play with the mass settings, but a passive rigid body is defined to have an infinite mass (so the setting won t matter). Changing the mass of the ball won t make much difference at this point because gravity is a universal force, affecting all objects in the same way. Later, we ll see where mass can be used more effectively. Note Playing with the numbers is a great way to learn how rigid bodies work. Don t be afraid to try different settings for each of the channels of each rigid body try to guess what your changes will do before playing back the animation.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=456847029 (3 of 3) [11/27/2000 8:43:26 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Catapult! Converting a Body from Passive to Active Mode Now let s create a catapult and see how easy it is to turn the active key on and off for a rigid body. Again, start with a new scene. Create a NURBS plane scaled to about the grid size. Now create a cylinder, rotate it so it lies along the X axis, and squash it nearly flat.
Now move the insert point of the cylinder all the way to its right. Tip To move the insert point, select the Move tool, press the Insert key on your keyboard (which will change the Move tool s handle from one with arrows to one without), and move the new handle around. Don t forget to press the Insert key again when you re done, or you ll stay in insert mode! Once you have this set up correctly, add a sphere of radius 1 and place it on top of the left end of the cylinder:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=288746633 (1 of 3) [11/27/2000 8:43:30 PM]
Books24x7 Mastering MAYA Complete 2
Now select the plane and the sphere, and make them passive rigid bodies. In the Hypergraph or Outliner, MM drag the sphere onto the cylinder, making the sphere the child of the cylinder (so they will rotate together). Now set a keyframe at your first frame on the cylinder s rotation channels (select the rotation channel names and RM select Key Selected), move the time slider to about 15 frames, rotate the cylinder so it is close to upright, and keyframe this new setting.
Tip Setting the auto keyframe button to On will make Maya automatically set a new keyframe whenever some channel changes after you manually set the first keyframe for that channel. Play back the animation. You should see the cylinder (and its attendant ball) rotate up in a few frames, then stay still. Now let s shove this ball out of the nest and let it fly! Select the sphere and, in the Channel box, find the Active channel (or attribute), located toward the bottom of the rigid body attributes. It should currently have a value of Off. Select the name of the channel (Active), set the time slider to around 12 frames, and RM select Key Selected while pressing on the Active name. This will set a key (with a value of off, or false, or 0) on the Active channel. Now move forward one or two frames, click in the text next to the Active name, and type On in the Channel box. If the Autokey function is on, you ll automatically generate a keyframe; otherwise select and manually keyframe this channel. What you have done here is forced the sphere to become an active rigid body just as the sphere is being pitched up in the air by the cylinder. This timing allows us to take advantage of some clever programming by the Maya developers; the sphere will inherit speed and rotation from the movement of the cylinder, meaning it will fly away from the cylinder the moment it becomes an active rigid body.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=288746633 (2 of 3) [11/27/2000 8:43:30 PM]
Books24x7 Mastering MAYA Complete 2
To test this, rewind and play back the animation. The sphere should go flying off to infinity. Of course, to finish this simulation correctly, we need to add gravity once again. Select the sphere and then choose Fields Ø Create Gravity (it should automatically connect to the sphere). Now play back the animation. The ball should (depending on how fast your cylinder rotates) either shoot or plop off the cylinder. If the ball flies off the catapult too slowly, try rotating the cylinder further at its last keyframe, or shorten the number of frames over which it rotates up. If the ball flies off too quickly, rotate the cylinder less at the last keyframe, or lengthen the number of frames over which it rotates up. We ve already played with the numbers on the rigid bodies in the last example. This time, let s play with gravity itself. (Be careful that you don t get motion sick!) In the Outliner or Hypergraph, select the gravity node you just created. In the Channel box, you ll see several settings for gravity, including Direction and Magnitude. Direction defaults to 1 in Y, or down, as gravity in the real world pulls down a negative value on the Y, or vertical axis. Magnitude defaults to 9.8 (that s 9.8 meters or 32 feet per second squared, the force of earth s gravity). Let s make things a bit heavier. Try setting gravity to, say, 200 or so. Now, when the ball comes off the cylinder, it should drop like a very heavy stone. Or try a value of 2 now we re on the moon! Although the geometry in this scene is simple, the results are not: This same trick could be used as a character throws a ball at a can or bottle, creating a very nice mix of keyframed character animation and realistic physics.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=288746633 (3 of 3) [11/27/2000 8:43:30 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Fields to Add Effects to Rigid Bodies After you play with the gravity settings for a while, find a value for gravity that will give the ball a good long flight time, because now we re going to add some other fields to affect the ball s flight. First, let s add some wind. Select the sphere, then select Fields Ø Create Air Ø. The Options (Create) window opens, giving you several ways to adjust the air field.
You ll see three buttons at the top (Wind, Wake, and Fan) that are simply preset options you can use to create the effect of wind, wake (like leaves moving in the wake of a car), or a fan. You can click all three buttons to see what settings are changed with each one, but in the end, click the Wind button, and then the Create button, and close the window. A new field, called airField1, will appear in your Outliner or Hypergraph.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=968239259 (1 of 2) [11/27/2000 8:43:34 PM]
Books24x7 Mastering MAYA Complete 2
Now play back the animation again. You should see the sphere get shoved right off the end of the plane (as the wind, by default, pushes in the positive X direction). Try changing the X component of the wind to 0 and the Y component to 1. Now the ball should fall more gently (like a beach ball). Next, increase the magnitude from 5 to a large number like 200. The ball will now blow up into the air, as the wind force is stronger than gravity. Set wind back down to a reasonable number like 5 or 10. Note As another experiment with fields, try turning the wind on and off by keyframing its magnitude. Now let s add turbulence. Select the sphere and choose Fields Ø Create Turbulence. Play back the animation. With the default magnitude of 5, the effects on the motion of the sphere will be very subtle. If you set the turbulence field s magnitude to 50, you will see the sphere move about in random ways as the turbulence field affects its motion. Try different numbers for the channels of the turbulence field and see what results from making these changes. Note You can also add fields to objects using the Fields Ø Add Item menu options. All fields will travel with their parent object, and can therefore be used to create a wake or turbulence as the parent object passes rigid bodies or particles. Tip With rigid bodies, fields, and particle dynamics, it is a very good idea to take a simple animation and experiment with what each channel does by changing the numbers and watching the results in the animation. It is only by this kind of experience that you can see how Maya s physics engine really works. We ve seen how different fields can change a rather humdrum animation into something more interesting. Now let s make the simulation engine work a bit harder by creating more complex shapes.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=968239259 (2 of 2) [11/27/2000 8:43:34 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using the Rigid Body Solver When you work with more complex shapes you may find that Maya s default settings don t get you the speed or accuracy that you are looking for out of your rigid body simulation. For such occasions, Maya allows you to adjust how it calculates rigid body simulations through the Rigid Body Solver. With the Rigid Body Solver you can adjust how Maya calculates the simulation, giving you the ability to fine-tune your simulation for speed or accuracy. Let s look at the solver in action. Create another empty scene, add a plane and a sphere (at some height above the plane), and make the plane a passive rigid body and the sphere an active one. Add gravity and test the animation to be sure the ball bounces on the plane as it should. Now let s make the shape a bit more complex. First, increase the U and V isoparms to 16 or more each (on the makeNurbsSphere1 node). Then take the sphere and mold it into some bizarre, angular shape something like this:
You can create this shape quite easily using Maya s Artisan utility (Edit Surfaces Ø Sculpt Surfaces Tool Ø). If you are unfamiliar with Artisan, see Chapter 9, or just pull individual CVs out of the sphere.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=910564016 (1 of 4) [11/27/2000 8:43:41 PM]
Books24x7 Mastering MAYA Complete 2
When you play back the animation this time, Maya will probably go just a bit slower this time, it has to keep track of a lot more surfaces! If you play back the frames one at a time (and look under the plane), you ll probably also be able to see a few points when some of the sphere s surfaces poke through the plane. At full-speed playback, you probably won t notice these errors, but there are times when you might wish to correct these problems or perhaps speed up playback for a particularly complex simulation. In these situations, you can use the Rigid Body Solver menu to adjust how Maya calculates its rigid body simulations. Essentially, the Rigid Body Solver gives you some control over the way Maya s dynamics engine handles the mathematics involved in the movement and interaction of rigid bodies. As you ve just seen, complex shapes interact in complex ways, and adjusting calculation options via the solver is useful when the result of using Maya s default settings isn t accurate enough or fast enough to look realistic. You can get access to the Rigid Body Solver in one of two ways: either choose Solvers Ø Rigid Body Solvers, or select a rigid body and open the Attribute Editor (Ctrl+A) and select the Rigid Solver tab in the Attribute Editor window. Either way, you get a window that allows you to adjust the solver to meet your needs.
Notice the Rigid Solver States section of the window. Here you can turn most major functions on and off. For example, turn on the Display Velocity check box, and play back the animation. You will see an arrow that points in the direction of the sphere s velocity, with a length that represents the speed of the sphere. If you turn off the State check box, the animation will do nothing, because turning off this check box turns off the solver (this is a good way to quickly eliminate dynamics so you can concentrate on other elements of an animation). If you turn off the Dynamics check box, the sphere will fall, but it will no longer bounce, as dynamic interactions no longer work. Try turning off each of the check boxes in turn and see what effect this has on playback. When you re finished, reset the check boxes to their default state. You ll also see a section of the window called Rigid Solver Methods. There are three choices here, though normally you would use the default method, Runge Kutta Adaptive. If you have a very complex simulation, however, and either wish to view it more quickly in interactive playback or don t care about the accuracy of the simulation for your final rendering, you can (temporarily) set the method to either Runge Kutta or to Midpoint. Midpoint is the least accurate but fastest. Runge Kutta is a compromise between the two extremes. For your dented ball, you probably won t see much difference between the three methods.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=910564016 (2 of 4) [11/27/2000 8:43:41 PM]
Books24x7 Mastering MAYA Complete 2
Note The Runge Kutta and Runge Kutta Adaptive options are named for the Runge Kutta solution, a mathematical method of solving an interlocking system of differential equations using first-order derivatives. In Maya, time is broken down into discrete steps (referenced through the Step Size field), and the integral of the equations is approximated at each step. Though the technique is mathematically complex, it is fast and accurate enough for most applications. (If you are interested in the subject, a number of books and articles are available on the Runge Kutta solution methods.) The top and most useful section is called the Rigid Solver Attributes section. Using Step Size, Collision Tolerance, and Scale Velocity, you can alter the way in which the solver simulates rigid body dynamics. Let s look at each option: Scale Velocity is useful only if you have checked the Display Velocity check box in the section below the Scale Velocity slider lets you scale the arrow that sticks out from the rigid body, making it fit within your window. Step Size defines the chunk of time (measured in fractions of a second) the solver divides the timeline into. A smaller step size means more calculations per second of animation, but it can also mean a more accurate simulation. If you have troubles with rigid body interpenetration errors (meaning that two bodies have pierced each other, as in our example), reducing the step size is a good place to start. Collision Tolerance tells Maya how carefully to evaluate frames where collisions take place. A large collision tolerance will speed up playback but can become very inaccurate. Try making the collision tolerance 0.8 and playing back your animation. You will notice that the sphere doesn t bounce correctly on the plane. Now set the tolerance to 0.001 (the smallest possible value). If you saw frames at which the sphere s points stuck through the plane before, they should no longer appear. Experiment with different step sizes and collision tolerances, and see how the changes affect the simulation. Often you can get away with making either the step size or collision tolerance very large, as long as you keep the other element small. Finding a compromise between speed and accuracy for a complex simulation is often the key to using rigid body dynamics effectively.
Speeding Up Calculations with Additional Solvers Each additional object a rigid solver has to keep track of can geometrically increase the calculation time. To compensate for this, you can speed up calculations by isolating different parts of a simulation from one another and assigning additional solvers to each part. Let s see how this works by making some changes in the deformed sphere scene you created in the previous section. (If you no longer have that scene, just create a ball and a plane, make the ball an active rigid body and the plane a passive rigid body, and then create gravity. Play back the animation to be sure the ball bounces off the plane.) Now we re going to create a second Rigid Body Solver and assign the ball to it. Choose Solvers Ø Create Rigid Body Solver. This creates a new solver, which will be called rigidSolver1 (or 2 or 3, depending on how many others you have created). Set the new solver as the default (so that all new objects will be assigned to this solver): Solvers Ø Current Rigid Solver Ø SolverX, where SolverX is the solver you wish to establish as the default. Since we have already created both of our rigid bodies using the same solver, we need to assign one of the two bodies (the ball) to the new solver rigidSolver1. Unfortunately, there is no button to do this, but you can do it with a quick bit of MEL (Maya Embedded Language) scripting.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=910564016 (3 of 4) [11/27/2000 8:43:41 PM]
Books24x7 Mastering MAYA Complete 2
In the scene window, select the sphere, then in the command line (accessed by pressing the ~ key while you re in a scene window), type the following: rigidBody
edit
solver rigidSolver1;
This command tells Maya to edit the rigid solver for whatever objects are selected in the scene. Note For more on MEL scripting, see Chapters 16 and 17. Now play back the animation again. This time, the ball should pass right through the plane. Although the plane and ball are both still affected by gravity, they no longer interact with each other, as they live in different solver states. If you wish to edit the settings of your new rigid solver, be sure it is selected (in Solvers Ø Current Rigid Solver), then select Solvers Ø Rigid Body Solver. This will bring up the Attribute Editor with the rigidSolver1 selected. Finally, with rigidSolver1 selected, you can create a new plane (or other object), make it a passive rigid body, and play back the animation. As both the ball and the new plane share the same solver, they will collide properly.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=910564016 (4 of 4) [11/27/2000 8:43:41 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Impulse and a Newton Field to Simulate Orbital Dynamics Let s now see how rigid bodies can be used to create a realistic simulation of a rocket ship going into orbit. We ll use a small cone for the rocket and a big sphere for the planet, but you can model just about anything you wish and substitute those objects in their places. First, create a sphere with a radius of 25 units and name it planet scale your view out so you can see it clearly. Now, create a cone (named rocket) and scale it so it looks this size on the sphere:
It really doesn t matter how big the cone is, just so it looks good to you (I just left it at its default settings). Note Be sure you place the cone a little above the surface of the sphere, or you ll get rigid body interpenetration errors, like those we saw earlier. Now make the sphere a passive rigid body (Bodies Ø Create Passive Rigid Body) and make the cone an active rigid body (Bodies Ø Create Active Rigid Body). We could add a simple gravity field to these objects, but gravity pulls everything in the same direction. What we need here is a field that s centered on our planet; we ll use the Newton field (named after Sir Isaac). The Newton field creates a gravitational well in the planet that will attract all other rigid bodies to it, its force depending on how far from the planet the object is.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=300633415 (1 of 3) [11/27/2000 8:43:46 PM]
Books24x7 Mastering MAYA Complete 2
Select the planet and choose Fields Ø Add Newton. In your Outliner or Hypergraph you will now see a Newton field parented to the planet. Choose the cone and open the Dynamic Relationships Editor (Windows Ø Animation Editors Ø Dynamic Relationships). In this window, click on the Newton field to highlight it this connects the cone to the Newton field. Set the frame length to 1000 or more, and play back the animation. The rocket should fall and land on the surface of the planet, bounce a bit, and stay there. If not, try turning the magnitude of the Newton field down to 5 or 6 and see if that helps. Now we ve got gravity; what we re missing is the thrust (or impulse) every rocket uses to escape the bounds of gravity. With the rocket selected, click the rigidBody2 tab in the Channel box and set the rocket s impulse Y to around 5. Play back the animation. Most likely, the rocket will go flipping around out of control as it rises, just like those ill-fated rockets in the early V-2 tests. The reason is that the impulse (or thrust) is coming from the bottom of the cone, so any slight error in thrust spins the rocket. In reality, this is a serious and very difficult aspect of rocket science. But in our virtual world, we have a quick fix: set the ImpulsePositionY to around 4 or 5, making the thrust come from atop the cone, and thus making it much more stable in flight. When you now play back the animation, assuming the rocket has enough thrust, it will smoothly rise and disappear from the screen. At present, our rocket has infinite fuel, so it just keeps going. To make a more realistic flight, let s create a ballistic trajectory, allowing the rocket to rise for a time and then fall back to the planet. To do this, keyframe the thrust (impulse) on and off. Select the Y impulse name, set the time slider to the first frame, and RM select Key Selected. Now go out to about frame 15 and set the value of impulseY to 0 (the impulse will fall off from 5 to 0 over those 15 frames). When you play back the animation, the rocket should launch, rise, and then fall back to the planet. Note Getting this sequence to work right will take a bit of tweaking the numbers. It is very easy to get the rocket stuck on the ground, or flying off at an amazing speed. If you are completely stuck, try opening the premade project (15orbit.ma) on the CD that accompanies this book. We ve now gone suborbital; it s time to get into orbit! To do that, we need to add an in-flight correction, to make the rocket move sideways as well as up and down. Move the time indicator to frame 10, and key the impulseX (at 0) on this frame. Now move to frame 11 and key the impulseX to 2. Move the time to 39 and key impulseX back to 0 (again, you may need to change these numbers around to get good results). If all worked well, when you play back the animation, you will see the rocket orbit the planet (in a very scary-looking, squashed orbit, but an orbit nonetheless). If you didn t give the rocket enough thrust, it will crash back into the planet in a pretty spectacular manner. In order to get our orbit a bit cleaner, we need to add yet another in-flight correction. At around frame 90, set another key on impulseY (at 0). At about frame 95, set a key on impulseY to 1 (so it pushes down on the rocket). At about frame 115, set another key on impulseY, this time back to 0 again. If these numbers work for you, you should see the rocket following a much cleaner orbital path. Note As an exercise, how close can you get the orbit to circular? Can you keep the rocket from spinning around as it orbits the planet? With all the tweaking involved, you can see why they re called rocket scientists !
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=300633415 (2 of 3) [11/27/2000 8:43:46 PM]
Books24x7 Mastering MAYA Complete 2 Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=300633415 (3 of 3) [11/27/2000 8:43:46 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Converting (Baking) a Rigid Body Animation into Keyframes Once you ve got an orbital motion you like, you can bake the rigid body animation into keyframes so you can change the keyframes into other sorts of motion. Baking is the term Maya uses for creating a set of keyframes that mimic the dynamic motion of a rigid body simulation. As we will see below, baking an animation allows you to adjust motion paths and keyframes for what was once a dynamic simulation (and thus did not allow this kind of adjustment). Warning If you may eventually wish to return to your rigid body simulation, save a different copy of your project before you bake the simulation. You can t go back once the simulation has been baked! Select the rocket and choose Edit Ø Keys Ø Bake Simulation. The simulation will run, and when it s finished, you will have a baked animation (and a mess of keyframes in the time line!). Let s put this baked animation to good use, getting rid of that nasty rotation around the Z axis that the rocket developed. With the rocket still selected, open the Graph Editor (Window Ø Animation Editors Ø Graph Editor). On the left side, highlight the rotateZ channel, and then press F on the keyboard (to frame the selection). You ll see a curve with hundreds of keyframes on it a few more than we need for our animation!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=174315563 (1 of 2) [11/27/2000 8:43:52 PM]
Books24x7 Mastering MAYA Complete 2
To get rid of the cone s Z rotation problems, we could first attempt to simplify the curve. Choose Curves Ø Simplify Curves from the Graph Editor s menu (or RM select this). Maya will remove many keyframes it considers unimportant to the curve. Unfortunately, even if you run the Simplify Curves command several times, the curve is still very heavy and we don t want any of that motion, anyway! Let s just kill the whole curve. Select the entire curve and press the Delete key, and away it goes. Now when you play back the animation, the Z rotation is gone all of it. To get some form of rotation, you ll need to first delete the rigid body from the rocket (so it doesn t interfere with your setting keyframes). In the Outliner or Hypergraph, choose Display Ø Show Shape Nodes to reveal the rigid body nodes. Select the rigid body associated with the rocket and delete it. Now set a 0 keyframe on the Z rotation of the rocket at about frame 15 (just where it begins to tip over). Go to the end of the animation and set a keyframe of about 1080 for the Z rotation (this is about 3 revolutions, which matches how many times the rocket goes around in my 1500 frame animation). To get the rotateZ curve to look right, you ll have to adjust its shape in the Graph Editor. (See Chapter 10 for more information about the Graph Editor.) Note For a finished project, see 15orbitBaked.ma on the CD-ROM that accompanies this book.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=174315563 (2 of 2) [11/27/2000 8:43:52 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Throwing Dice: Working with the Dynamics Simulator On a quick trip to Vegas, you might play craps, a game in which you throw two dice into a horseshoe-shaped pit and watch them bounce around (hoping for lucky 7!). As you might guess, this is another great event to simulate in Maya using rigid bodies. Here, in a simplified version of the craps table, we will get to see how Maya s dynamics simulator handles a more complex, multiple-body collision. First, build a NURBS plane and stretch it to the size of the grid. Now build a second plane and place it near the end of the first, at right angles to it.
Now add a cube of about default size, or a little smaller, and name it something like die1. Tip A cube is actually six pieces, or faces, and it is easy to choose only one of these faces by accident. A way to avoid choosing only a face is to be sure to name the cube itself (the parent level) something that you can easily recognize (like die1, in this case). Add a second cube and name it die2. You can add a checker 2D texture to the dice to make them stand out better if you wish. (See Chapter 19 for information about basic texturing and other rendering techniques.) When the dice are textured and placed at the front of the table, it should look something like this:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=268708674 (1 of 2) [11/27/2000 8:43:56 PM]
Books24x7 Mastering MAYA Complete 2
Select both of the planes and choose Bodies Ø Create Passive Rigid Body. Next (in the Outliner or Hypergraph), choose the top level of each die (remember, this must be the top level, or you will get very strange results!) and choose Bodies Ø Create Active Rigid Bodies. Be sure both dice are still selected (or select them again) and choose Fields Ø Create Gravity. When you play back the animation, you should see both dice fall and bounce off the table. If the dice break apart, you have created the rigid bodies on the sub-faces of the cubes, not their top levels, so you ll need to go back and try again. If you get stuck, try opening the file 15dice.ma on the CD. To make life a bit more interesting, we need to give the dice some initial motion. Select one of the dice, click on the rigid body name in the Channel box, and set the initial velocity to, say, Z to 15 or so. Repeat with the other die, but give this one a slightly different velocity. When you play back the animation, both dice should travel down the table and bounce off the far wall (if they don t, increase their velocities). You will notice, however, that they stay perfectly upright (that is, they don t rotate), which is a bit odd looking. Give them an initial spin in X, Y, and Z, or anything you like, and tweak the numbers until you get a nice-looking simulation. If the dice now bounce off the table, you can either scale the plane bigger, or increase the plane s dynamic friction, which will make the dice stick to it more. Finally, add a positive X velocity (maybe 5) to the left die, and a negative X velocity to the right die, making them collide in mid-air before hitting the table. You will probably need to adjust their velocities in both X and Z to get them to collide. Because of the complexity of the collisions between the spinning dice, you will notice a slowdown when the two collide, making it a bit difficult to determine if the motion looks good. To get a better idea of how the scene really looks, you can playblast it, and watch it play back in real time (to playblast a scene, select Window Ø Playblast). The Playblast tool will record the animation one frame at a time, and when it is finished, you will get a window with the completed animation in it. Tip A fully rendered version of the dice throw is available as a QuickTime movie (15diceFinished.mov) on the CD that accompanies this book.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=268708674 (2 of 2) [11/27/2000 8:43:56 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Building a Chain: Adding Constraints to a Rigid Body As a final example of rigid bodies, let s build something a bit more complex: a link of chains like a child s swing would have. Along the way, we ll learn how to add constraints and how to adjust the rigid solver to speed up some very difficult calculations. Create a new scene, add a cylinder (named Bar), rotate it 90 degrees in X, and then scale it large on the Z axis.
Now create a torus (named EmbeddedLink) and stretch it into the shape of your basic chain link. Rotate the torus into position below the bar.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=184033555 (1 of 3) [11/27/2000 8:44:00 PM]
Books24x7 Mastering MAYA Complete 2
Once the first link is in place, duplicate it, rename it Link1, rotate it 90 degrees around Y, and move it into place. Do this three more times, until you get a link of chains that looks like this:
Warning Be sure there is a separation between each link (so they do not touch each other). Otherwise, when you create the rigid bodies, you will get an interpenetration error, and the simulation will break down. Tip After you make your first duplicate, move it, and rotate it, you can then use the Smart Transform option in the Duplicate options window to do the rest. Each duplicate will be rotated and moved into position automatically. Now select the bar and the first link, and choose Bodies Ø Create Passive Rigid Body. Next, choose all the other links and choose Bodies Ø Create Active Rigid Body. With all the links still selected, add gravity to the scene (Fields Ø Create Gravity). When you play back the animation, you should see all the links fall and then bounce off of one another, finally coming to rest after about 200 frames. This is a good first step toward our chain link, but there are a couple of problems. First, the chains aren t in a resting position at the start of the animation, and second, they bounce all over the place when playback starts. Let s deal with problem two first. Our chains really don t need to bounce very much (it s just slowing the simulation down), so we could either turn all the bounciness attributes down to 0, or take care of the whole thing in one fell swoop by turning off the bounce state attribute. Choose Solvers Ø Rigid Body Solvers, and in the attribute window, uncheck the Bounciness check box. This globally turns off all bounciness calculations, and makes the remaining calculations run more quickly and smoothly. With the bounciness calculations off, the links should just drop nicely into position when you play back the animation, coming to rest by frame 20 or so.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=184033555 (2 of 3) [11/27/2000 8:44:00 PM]
Books24x7 Mastering MAYA Complete 2
To finish our swing, we re going to add a weight to the bottom of the chain links. Create a sphere with a radius of about 3 (named weightBall), and position it just below the bottom link in the chain (remember not to allow the sphere to touch the link!). Looks a bit medieval, huh? First select the bottom link, and then Shift-select the sphere. Now choose Bodies Ø Create Constraint Ø. This brings up a window that allows you to create a constraint between the two selected objects. Choose the Pin type of constraint, and leave the other settings at their defaults. When you click Create, below, the sphere will be made into a rigid body, and a pin-type constraint will be added between it and the last link in the chain (as if the two were pinned together). With the sphere selected, go to Window Ø Animation Editors Ø Dynamic Relationships, and highlight the gravity field (connecting it to the sphere). When you playback the animation, all the links plus the sphere should drop down (as before). Now let s deal with the first problem noted above: getting our links and ball into a resting position at the start of the animation so they will not fall into place to start every animation. Play the animation forward until the chain comes to a complete rest. Stop the playback, but don t rewind the animation. Choose Solvers Ø Initial State Ø Set For All Dynamics. This programs the current state of all dynamic objects into Maya as the initial state. When you rewind the animation now, it should remain in its current, rest position. Great! We now have a completely lifeless simulation that does absolutely nothing! Let s make things a bit livelier. First, try adding an initial X velocity of around 10 to the weight. When you play back the animation, the ball (and the chain, following it) should swing out to the left, then pendulum back to the right, slowly settling back to stillness. You can try adding velocity in other directions, and even a rotation to the ball. When you have experimented a bit, reset all the initial velocities back to 0. Instead of an initial velocity, let s now add an impulse of 4 or 5 in the X direction. When you play the animation back, the ball and chain will appear to be blowing in a wind from the right of the screen (you could actually achieve the same effect by connecting an air field to the ball). To allow the ball and chain to fall again, keyframe the impulseX back to 0 after 30 or 40 frames. You may notice that the ball and chain get kinked up near the bar, and this slows the animation way down. To compensate for this, you might try adjusting the rigid solver settings. (I set step size to 0.1 and the solver to Runge Kutta not Adaptive and got acceptable results.) You might also get interpenetration errors, in which case you might wish to reduce the step size a bit. Finally, you might notice that the ball doesn t look very weighty in the way it is thrashed around by the chain. Try increasing the ball s mass to 50 or 100 (and set the impulse higher to compensate), and see how it looks now. Note The only real drawback to adding mass to objects is that it drastically increases calculation times. Tip A rendered movie of a chain and ball is available on the CD (15ballAndChain.mov).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=184033555 (3 of 3) [11/27/2000 8:44:00 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 15 - Working with Rigid Body Dynamics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we saw how easy it is (relatively speaking) to get Maya to do the work for us when simulating real-world events like falling and colliding objects. We also found that rigid bodies can be changed from passive (keyframable and not affected by fields) to active (nonkeyframable and affected by fields), and that, when a passive rigid body is made active, it inherits the motion it had before. This allows rigid bodies to work within a keyframed animation and with keyframed characters. Finally, we created more complex interactions, and we adjusted the rigid solver to give us realistic, but faster, simulations.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=940574566 [11/27/2000 8:44:03 PM]
Books24x7 Mastering MAYA Complete 2
Part IV - Working with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part IV: Working with Mel Chapter List Chapter 16:
MEL Basics
Chapter 17:
Programming with MEL
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=645069370 [11/27/2000 8:44:05 PM]
Books24x7 Mastering MAYA Complete 2
Part IV - Working with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part Overview MEL Basics Programming with MEL
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=482069321 [11/27/2000 8:44:08 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 16: MEL Basics Overview This chapter introduces Maya s embedded scripting language, MEL. You will learn how Maya uses MEL, and you ll see how you can increase your productivity by automating repetitive tasks and getting Maya to do exactly what you want it to the first time. Along the way you ll have an opportunity to try out what you ve learned in hands-on exercises that illustrate the power of MEL. While MEL does require a bit of programming savvy, you really don t need to be a rocket scientist to use it at least at the basic level. If you have had some programming background, MEL s basic syntax will seem pretty straightforward. If you know the C programming language, MEL s syntax will seem like second nature. If you have never looked at a computer program before, MEL will at first seem baffling, but don t worry. Even if you never intend to do any real programming with MEL, you will find in this chapter and the next one many nuggets of information that will allow you to use Maya far more effectively than you may have thought possible. Before reading this chapter, you should be familiar with basic Maya concepts, like interface conventions, how to create and animate objects, and how to move around Maya s windows and menus (see Chapter 2). If you have some knowledge of computer programming, that will also prove helpful, but it is not necessary.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=163458582 [11/27/2000 8:44:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
MEL is Fundamental MEL (Maya Embedded Language) is the foundation from which you interact with Maya. When you open Maya, the program first runs several scripts, which actually build all the windows you see that s right: Maya itself has no interface whatsoever. You can even run Maya from your operating system command prompt by typing in Maya prompt! Behind nearly everything you see in Maya is a MEL script. What does this mean to the average Maya user? Simple: whatever the original programmers did, you also can do. You can write windows that have sliders, text fields, and buttons in them; you can create attributes in the Channel box; you can even add menu items to the main menu bar. The fact that Maya is built on MEL is one of the program s most powerful features.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=821894096 [11/27/2000 8:44:12 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What is a Scripting Language? MEL is a scripting language, not a complete programming language (like Java or C++). A program written in a programming language is compiled and becomes an independent program (like the core program, Maya, which just runs off your computer s operating system). A scripting language, on the other hand, resides on top of another program (in this case, Maya) and is interpreted at every line rather than compiled. Because scripting languages are interpreted by the mother program, they are a bit slower than compiled programs; however, they require much less programming overhead than do compiled programs. If you are a real propeller head and like to get into the guts of a program, Maya has its own API (Application Programming Interface) appropriately enough named Maya API in which you can create plug-ins for the program itself using the C++ programming language. MEL does just fine for 95% of the things most people want to do, however, and it isn t too difficult to learn. Note Although the API is outside the scope of this book, you can contact Alias|Wavefront about developing plug-ins for Maya.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=760118868 [11/27/2000 8:44:14 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
The Script Editor One of the best features of Maya, as it relates to MEL, is the Script Editor. MEL is a huge language (with over 600 commands and about 75 functions), but the Script Editor will clue you in on how different commands are used, and allow you to cut and paste whole scripts together without the need to program a thing yourself. You don t even need to use the Command line to enter the MEL commands; operations you perform in the Maya interface are recorded as MEL commands in the Script Editor. Note The Command line, which we discussed in Chapter 2, is just one input line in the Script Editor. Type a command in the Command line and you can see it appear in the Script Editor s History window. You can bring up the Script Editor in two ways: either select Window ØGeneral Editors ØScript Editor, or click the button in the lower-right corner of the screen that looks like a square with lines in it.
When opened, the Script Editor will look as follows:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=247756583 (1 of 4) [11/27/2000 8:44:19 PM]
Books24x7 Mastering MAYA Complete 2
Notice that there are two windows in the editor. The top window is called the History window; the bottom, the Input window. With the Script Editor open, create a NURBS sphere (the easiest way to do this is to click the blue ball on the shelf tab at the top of the main window). Now look at the History window. The very last line of that window should read something like: sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -d 3
ut 0 -tol 0.01 -s 8
-nsp 4 -ch 1; What you see in the top window is the command you told Maya to perform when you clicked the ball on the shelf. Sphere is Maya s command to create a NURBS sphere; all the characters with dashes before them (-p, -ax, and so on) are flags that tell the Sphere command how to build the sphere. For example, -p stands for pivot, which is the pivot point of the sphere (since it s 0, 0, 0, the pivot of the sphere is at the origin); r stands for radius (the sphere s radius, in this case, is 1 unit); and ssw and esw are the start and end sweep (in degrees here). Finally, the semicolon at the end of the line tells Maya the command is finished. (Nearly every line of MEL code needs a semicolon at the end.) Note As you can see, more characters will fit into the Input window than we can squeeze into the printed page, so the semicolon is also your guide to where one command actually ends and the next begins. (As a further guide, we ve indented the wrapped portion of these longer lines by about six characters.) As you enter commands from this book into the Script Editor, you generally need to press the Enter key only after semicolons. Create a few more objects (like lights, cones, curves, etc.) and look at what appears in the History window of the Script Editor. You can see that every command you perform in the interface is relayed to Maya s core program via MEL commands. For ease of reading, you can clear the top window. Go to the Script Editor menu and select Edit ØClear History. The top window should now be cleared of all commands. Now try opening one of Maya s windows (for example, the Hypergraph window: Window Ø Hypergraph). What do you see in the History window? Probably nothing at all. To keep from cluttering the History window, Maya s programmers created a filter that blocks from view in the History Window many of the MEL commands programmers don t commonly need to see. Sometimes, however, it is very useful to see what s really going on in Maya. Close the Hypergraph, select Edit ØEcho All Commands, and reopen the Hypergraph. Now you should see something like this:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=247756583 (2 of 4) [11/27/2000 8:44:19 PM]
Books24x7 Mastering MAYA Complete 2
hotBox; tearOffPanel
Hypergraph
hyperGraphPanel
true;
addHyperGraphPanel hyperGraphPanel1; HyperGraphEdMenu hyperGraphPanel1HyperGraphEd; createModelPanelMenu modelPanel1; createModelPanelMenu modelPanel2; createModelPanelMenu modelPanel3; createModelPanelMenu modelPanel4; buildPanelPopupMenu hyperGraphPanel1; // Result: hyperGraphPanel1Window // All these strange words represent the steps by which Maya builds the Hypergraph window for you. (Actually, nearly all the words above, like buildPanelPopupMenu, are calls to other MEL scripts in the Maya2.5/Scripts/Others directory. You can look through them to see how the window is actually constructed.) So you see, even the windows in Maya are created through MEL. One other note worth mentioning about the lines above: the last line, //Result: hyperGraphPanel1Window// is called the result line. The two slashes at the beginning of the line are a comment marker that tells MEL to ignore the rest of that line (you ll see these comment lines in all well-made MEL scripts). MEL then prints out for you the result of the operation (in this case, that it created the window as you asked). If there had been a problem making the Hypergraph window, the result line would have contained an error message instead of a result message. Now let s take a look at the Input window (the window on the bottom half of the Script Editor window). First empty the scene of all objects and clear the History window; then place your cursor in the bottom window and type in the following: Sphere
radius 1
pivot 0 0 0
name myBall;
Press the Enter key on your numeric keypad (not the one on your main keyboard). You should see the text disappear from the Input window and appear in the History window (you will also see another result line, telling you that the command was successfully completed). At the same time, you should see a sphere appear at the origin of your scene, named myBall. Congratulations, you have just executed your first MEL command! Note If you re wondering why you have to use the numeric keypad s Enter key, it s because the alpha Enter key is reserved for in-line returns. In other words, pressing the alpha Enter key just creates a new line in the editor window. To force the contents of the editor window to be evaluated (executed), you must use the numeric pad s Enter key. Now try this: delete the sphere from your scene; then triple-click the line in the History window that you typed earlier (Sphere radius 1 pivot 0 0 0 name myBall). Once you have the entire line highlighted, copy that line into the Input window (in IRIX, simply MM click in the Input window; in NT, Ctrl+C (copy) the text, click in the Input window, and Ctrl+V (paste) the line there). Now hit the Enter key (on the numeric keypad, remember!). You should see the exact same sphere (called myBall) created at the origin of your scene, meaning that you have copied a command from the History window and made a mini-script (called a macro) out of it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=247756583 (3 of 4) [11/27/2000 8:44:19 PM]
Books24x7 Mastering MAYA Complete 2
This was a very simple example, but consider the power this little cut-and-paste trick gives you: you can record anything you like from the History window and turn it into a MEL macro (or even a full-blown script). By storing this little script, you can return to it any time and, at the click of a button, make all those actions happen. Note As Chapter 3 details, you can create buttons for MEL commands simply by highlighting those commands, and then MM dragging the command lines up to a shelf.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=247756583 (4 of 4) [11/27/2000 8:44:19 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-On MEL: Building Lights Automatically Let s put all this information to some use now. We re going to record several actions we perform to create a default lighting setup, copy those actions into a macro, and place that macro on a shelf. Once we ve done that, we can automatically set up our scene lights for any scene we wish, at the click of a mouse. 1. Open Maya or begin a new scene. 2. Create a new NURBS plane object (Create Ø Nurbs Primitives Ø Plane), scale it to about the size of the Maya grid, and turn on hardware lighting (press the 7 key on the main keyboard). This plane will help you see how your lights are affecting the scene. 3. Open the Script Editor and clear the History window. 4. Now create and place one or more lights in your scene. You can also set color, intensity, and name for each of these lights. Tip Refer to Chapter 20 for tips on best lighting setups. We tend to like a three-light setup: a key light, a fill light, and a back light (all spotlights). 5. Once you re happy with the lights positions, colors, and other attributes, simply select everything in the History window and MM drag the highlighted text up to the shelf of your choosing. A new button will appear that looks as follows:
Let s see if it worked. 6. Select all in your scene and hit Delete (or you can actually type in the Script Editor the following to do the same thing: select all; delete;).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=993096016 (1 of 3) [11/27/2000 8:44:23 PM]
Books24x7 Mastering MAYA Complete 2
7. Once your scene is empty, go up to the shelf and click your newly made button. After a couple of seconds, you should see your lights magically appear in the scene, just as you had set them up. Not bad for a couple minutes of work and no programming! If you like, you can create several more lighting setups, each of which creates a different lighting setup for your scene. One problem you might notice right away is that the shelf buttons all look alike. Fortunately, Maya can handle this quite easily. 1. From the main menu, select Options Ø Customize UI Ø Shelves. A window will appear that has three tabs. Let s take a quick look at all three.
2. First, select the Shelves tab. In the window, you ll see listed all the shelves you currently have, along with buttons to add, delete, or move shelves up and down in the order they appear onscreen. Click the New Shelf button, and a new shelf appears, titled shelfLayout1. You can either rename this to create a shelf for you (like myShelf) or click the Delete Shelf button to remove the new shelf. 3. Now select Shelf1 from the list and click the Shelf Contents tab. In the window, you ll see all the buttons on the selected shelf listed below. Click the first item in the list (Curves With CVs) and look at the area below the top window. Here, you ll see the Move Up, Move Down, and Delete Item buttons, as well as other buttons and fields: " The Label button contains the text you see in the window above (the internal label for the button). " The Overlay Label contains the text you see under the button in the shelf window. (For the Curves With CVs button, this is blank, so there is no text on the shelf button. Try adding text and see what happens!) " The Change Image button allows you to find or create the bitmapped image that appears on the shelf in the case of the Curves With CVs button, it s this image, stored in the Maya 2.5\Bitmaps folder.
You can also navigate to the Maya2.5\extras\icons directory and browse through many pre-built icons for your use in creating shelf buttons.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=993096016 (2 of 3) [11/27/2000 8:44:23 PM]
Books24x7 Mastering MAYA Complete 2
Tip You can also create your own icons. In Windows NT, the icons can be in BMP, JPG, or XPM formats (BMP and JPG are supported by nearly all NT graphics editing packages). In IRIX, you must save the image in .xpm format (using Xpaint or another program). The icons are 32 ∞ 32 pixels, and you should make your images that size. Note that if you wish to place text at the bottom of the image, you should leave a blank space to allow room for it. 4. Now go back to the Shelves tab and select the shelf that contains your new light button. 5. Return to the Shelf Contents tab. Add a label and an overlay label to your button. Now change the image of the button to one of the images in Maya2.0\extras\icons (if you want text on your button, a good choice of icons is the UserMenuIcon group in this directory they have room for text at the bottom of the button). The final tab, Edit Commands, is for more advanced users. This window actually allows you to rewrite the scripts for the menu buttons right inside the Customize Shelves window. The script for whatever item you had selected in the Shelf Contents tab will appear in the main window. You can then change any commands you wish, or add comments to the script. To make these changes stick, however, you must press the Enter key on your numeric keypad (not on your keyboard); otherwise, when you select another tab, all your changes will be lost! For practice, try adding a comment line like the following to your lights macro: //This is my macro to make several lights in a scene. Click another shelf button and then return to the Edit Commands tab. Did your changes hold? If not, try again, this time remembering to press the Enter key to make your changes stick. Before leaving the Customize Shelves window, it is always a good idea to click the Save All Shelves button at the bottom of any of the tabs (assuming you want your changes to stick!). This button writes all the changes you just made to your Maya\Prefs\Shelves directory, so that the next time you start up Maya, your shelves will look just as they do now. In this example of MEL, you have learned to quickly record your actions, save them as a macro, place them in your shelves, and finally, change the text and image of the button to customize its look. Next, we will create a small script that will execute when we press a keyboard key.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=993096016 (3 of 3) [11/27/2000 8:44:23 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Hands-On MEL: Creating, Moving, and Naming an Object with One Keystroke Let s say you often make a NURBS sphere, rename it to ball, and move it some distance from the origin (you can modify this to be a light, a plane, or whatever; but for now, we ll just do it with a sphere). Even though Maya has a very efficient workflow, it s a waste of your time to do the same things over and over, so let s make Maya do it for you at the press of a key. 1. Open the Customize Hotkey menu by selecting Options Ø CustomizeUI Ø Hotkeys. This brings up a pretty scary looking window like the following:
Fortunately, we really don t have to worry about the top window for now; we only care about the stuff at the bottom. Note The window at the top of the Customize Hotkeys window lists all commands Maya has and whether or not they are mapped to a keyboard command. This means that you could (should you wish) change, remove, or add hotkeys for any of Maya s commands. See Chapter 3 for further information about how to do this.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=957498317 (1 of 2) [11/27/2000 8:44:27 PM]
Books24x7 Mastering MAYA Complete 2
2. Let s query a key to see if it s free for us to use. In the Key Settings box, type N in the Key field, and check the Alt box in the Modifiers group below. Click the Query key. You should get the following message: Alt-n is not mapped to any command object. This means the key is available for your use (if it s not, try another key). Click OK to dismiss the dialog box. 3. Now, in the Command Object Settings box on the right, enter something like the following in the Annotation field (this is the text that will appear in the list above): Make and move a sphere. Then, in the Commands window, type the following (you could also paste commands from the Script Editor): Sphere Move
radius 4
name ball
pivot 0 0 0
ssw 0
esw 360;
relative 0 5 0;
4. Click the Create Command Object button. The list window at the top of the screen will now update, and you ll see your command text listed at the bottom of the window. On the left, next to your new command, you ll see the word (None), telling you that the command has not yet been mapped to a key. 5. Return to the Key Settings section, type N in the Key field, select Alt and Press, and click Apply New Settings. The list window above will update again, reflecting that your command has now been turned into a hotkey:
6. Click the Save button and close this window. 7. Now hold down the Alt key and press N. If you did everything right, you should see a sphere sitting in your window called ball and resting 5 units up from the grid on the Y axis. Congratulations! You have now written some MEL commands and made them work simply by pressing a key! As a further exercise, try to take the commands used in the create lights exercise we did above, and map them to a hotkey of your choosing. Note If you didn t get what you expected, check the Script Editor to see if there was an error. If so, go back to the Customize Hotkeys commands and edit the command to make it work. If the Script Editor doesn t show anything happening at all, check that you mapped the command to the Alt+N key combination. If you re still having trouble, try typing the sphere commands into the Script Editor and get them to work properly, then copy them into the Command window.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=957498317 (2 of 2) [11/27/2000 8:44:27 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Placing Objects Using a Marking Menu So far we have seen how to record MEL commands and make them into a button on a shelf, and we ve seen how to issue MEL commands in text form and turn them into a hotkey. Now we will learn just how easy it is to create a marking menu that performs any of several MEL commands. Let s say that you wish to move a selected object (or objects) around in different directions simply by selecting an item from a GUI (Graphical User Interface) list. This is the perfect situation in which to use a Maya marking menu. 1. First, create a new NURBS sphere (or cone or whatever) at the origin of the grid. Now, in the Script Editor, type in the following: Move
r 0 5 0;
2. When you execute this command, the ball (or other object) should move 5 units up the Y axis (remember, -r stands for relative in this case, meaning that the object will move relative to its current position along the Y axis). To move the ball back to 0, type this: Move
r 0
5 0;
The ball moves 5 units down, and goes back to 0. 3. Now open the Customize Marking Menus window by selecting Options Ø CustomizeUI Ø Marking Menus. The following window will appear:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=342841351 (1 of 4) [11/27/2000 8:44:32 PM]
Books24x7 Mastering MAYA Complete 2
Once again, the top list shows marking menus built into Maya (part of the hotbox that appears when you hold down the spacebar). But of course you can build your own as well. 4. Simply click Create Marking Menu to bring up a window that will let you build a menu of your own.
5. Under Menu Name, type in MoveObject. Now RM click the top center yellowish button in the internal window and select Edit Menu Item. Note In addition to the eight main marking menu positions (North, Northeast, East, and so on), there is a ninth position, at the bottom left of the window, called the overflow menu item. If you add a command to this item, another will be created just below it, allowing you to make the menu as large as you wish. Also, all menu items can have submenus, allowing you even greater flexibility in building a marking menu.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=342841351 (2 of 4) [11/27/2000 8:44:32 PM]
Books24x7 Mastering MAYA Complete 2
This brings up a window in which you add the commands for the button.
6. Under Label, type Move Up, and leave the Icon Filename field blank (you can specify a path for an image that will appear in this position when the marking menu is accessed). In the Commands field, type in Move
r 0 5 0;
7. Leave Optional Properties set at Neither, leave the Option Box blank, and click Save and Close.What you have just done is to create a marking menu item that will move a selected object up by 5 units. 8. To test how this action works, press the LM button in the Click Here To Test window (select an object in your scene first!). Whatever you selected should move up by 5 units when you select the command. 9. Now, edit the East, West, and South marking menu buttons to the following, respectively: Move
r 5 0 0;
Move
r
Move
r 0
5 0 0; 5 0;
10. Give them appropriate titles and test that they work as they should.
11. Once you re happy with how the menu buttons work, click the Save button and return to the Marking Menus window. 12. At the bottom of the list, you ll now see MoveObject listed. With this item selected, in the Settings window, select the Hotkey Editor option (this allows you to make a hotkey for the menu you just made). Click the Apply Settings button and close the window. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=342841351 (3 of 4) [11/27/2000 8:44:32 PM]
Books24x7 Mastering MAYA Complete 2
13. Now, in order to use our new marking menu, we have to go to Options Ø CustomizeUI Ø Hotkeys and make a hotkey for the menu. 14. Scroll to the bottom of the list window and you ll see two new items in the list: MoveObject (Press) and MoveObject (Release). By mapping these two items, we will create a hotkey that will bring up our new marking menu (the release key must be mapped for marking menus, or the menu will just stay up even after the hotkey has been released!). 15. First, let s find an unmapped key. Query the Alt+O key to see if it s mapped (if it is, try another one). 16. Now, select the MoveObject (Press) item in the list, type O in the Key field, check Alt, and be sure that the Press radio button is selected. Click Apply New Settings and the MoveObject item should be updated to show that Alt+O is its new hotkey. 17. Now let s map the Release item. Select MoveObject (Release) in the list, type O, and select Alt and the Release radio button, and click Apply New Settings. Once complete, the items should look as follows:
18. Click the Save button and close the Hotkey window. 19. Let s test our new marking menu: select an object in the scene window, press and hold the Alt and O keys, and press the mouse button down. You should now see your marking menu, ready for action!
20. Move the object(s) you have selected around the screen to see how the new menu works. You can take these simple steps and reuse them to create marking menus to do anything you like. For example, if you created several lighting setups in the work above, you could now create a marking menu to allow you to select any of these lighting setups very quickly and intuitively. We ve seen how we can record or type simple commands, and place them on the shelf, in a hotkey, or even a marking menu. Now let s take a closer look at how MEL can work with the attributes of any object in your scene.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=342841351 (4 of 4) [11/27/2000 8:44:32 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What s an Attribute? An attribute (Attr) is any item that lives on a Maya node (a Maya node is anything you can see in the Hypergraph). This sounds a bit obscure, but it s really fairly straightforward: anything like rotateX, transformZ, or scaleY is an attribute of an object (more specifically, an object s transform node). When you build, alter, or animate an object, you re changing one or more attributes on one or more nodes in the object and of course, all of these changes are just MEL commands, so you can make Maya do the work for you. Note In this chapter, we ll take a quick look at how MEL works with attributes; in the next chapter, we ll go into more detail about how to build complex scripts using attributes. You may have noticed when you created the lights in the exercise earlier in this chapter that the Script Editor was filled with many statements that started with setAttr. The setAttr statement tells MEL to set a certain attribute to a certain value. Likewise, the getAttr statement gets (reads) the value of an attribute on a certain object so you can use that value in another MEL statement. The addAttr statement tells MEL to add a custom attribute to a certain item. Essentially, the setAttr statement is the same as going into the Attribute Editor window and changing a value in one of its fields (try changing a value in the Attribute Editor, and note that the Script Editor History window shows that a setAttr statement has been issued). The syntax (the rules of what goes where) for an Attr statement are as follows: setAttr [flags] objectName value; Flags, as we ve seen, are any special requests for MEL to complete; the object name is the name of the item to set the attribute on (like nurbsSphere1); and the value is the value to set the attribute to. The getAttr and addAttr commands have similar syntax. For example, we could move a sphere called ball to 10 on the X axis by typing the following in the Script Editor: setAttr ball.translateX 10; Once you execute this command, your ball will move from where it is to 10 on the X axis. (Of course, if you have no object called ball, you will get an error message.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=551406255 (1 of 3) [11/27/2000 8:44:35 PM]
Books24x7 Mastering MAYA Complete 2
This is pretty much like giving the move command: move 10 0 0. Unlike the move command, however, setting the attribute of translateX will not affect the other two attributes (the Y and Z translate attributes). Also, the setAttr statement is far more flexible than the move command, which can only translate an object. As a quick example of how setAttr can work, let s make a ball and manually set several of its attributes. Type the following into the Script Editor s Input window: sphere -n ball; setAttr makeNurbSphere1.radius 4; setAttr makeNurbSphere1.ssw 20; setAttr makeNurbSphere1.esw 250; setAttr ball.rotateY 90; setAttr ball.translateX -5; setAttr ball.scaleY 0.7; Can you figure out what each command does on your own? Try highlighting each of these lines by itself and pressing the numeric Enter key to execute it. Tip Using the technique of highlighting one line at a time is a very useful way to figure out what s happening in a script and to see where things go wrong! The first line builds a sphere. The next six lines change many attributes, either on the shape node of the sphere (the makeNurbSphere node) or on the transform node (the ball node). The first three setAttr statements change the radius, the start sweep angle, and the end sweep angle, respectively. The last three change the position and scale of the sphere s transform node (named ball ). The finished product should look as follows:
If, for some unknown reason, you needed to create a flattened half-ball over and over again in different scenes, you could just MM drag these commands to your shelf and you d be able to make the object at the click of a button quite a time saver!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=551406255 (2 of 3) [11/27/2000 8:44:35 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=551406255 (3 of 3) [11/27/2000 8:44:35 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Expressions with MEL Expressions are a specialized subset of the MEL scripting language which are designed to execute through time, not just when the command or script is called. While MEL is only evaluated when the script or macro is run (except in special cases), expressions are evaluated at every frame, or after each interaction on screen (like moving an object). Expressions deal primarily with changing an object s attributes based on time, the current frame, or another attribute. Thus, expressions are well suited to calculating particle properties (see Chapter 23) or to creating relationships between scene objects in Maya. Unlike MEL, expressions do not need you to specifically make a setAttr or getAttr statement, allowing their syntax to be somewhat simpler, and making them very powerful aids to creating complex behaviors in your Maya animations. In this section you ll find three examples that give you an opportunity to try out the Expression Editor. In the first, you ll make a cone move up and down by moving a sphere back and forth. In the second you ll make a ball move back and forth in rhythm as time elapses. In the last example, you use an expression to devise a way to make a wheel stick to the pavement so it doesn t slip. The expressions we ll deal with here are fairly simple; however, if this kind of thing appeals to you, and especially if you like to work with particles and dynamics, there is a more advanced discussion on the use of expressions with dynamics in Chapter 23.
Transforming a Cone Let s begin with a simple example: we re going to make a cone move up and down by moving a sphere back and forth on the Z axis. 1. First, make a new scene and create a sphere and a cone (call the sphere ball and the cone cone ). Select the cone, and open the Expression Editor (Window Ø Expression Editor).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=517058895 (1 of 6) [11/27/2000 8:44:42 PM]
Books24x7 Mastering MAYA Complete 2
2. In the Expression Name field, type moveCone. 3. In the Expression field at the bottom, type the following: translateY = ball.translateZ; //to save time, you could also just type: //ty = ball.tz; Because the cone was selected, Maya knows to apply the transateY command to the cone (if the object is not selected, just type cone.ty = ball.tz;). Click the Create button. If you entered the information correctly, the feedback line (or the Script Editor s History window) will show Result: expression1 If not, you will get an error message. (Note that paired forward slashes are comment markers in expressions as well as in scripts.) 4. Once the expression is accepted, move the ball back and forth in the Z axis, and watch the cone move up and down. Though this is a very simple example, it should indicate how you could solve some very complex interactions between objects much more efficiently by using an expression than by keyframing.
Rock the Boat Now we re going to dust off those ancient memories of high school math class, and put them to practical use bet you thought you d never hear that one! Using the Sine function, we re going to get our famous sphere to move back and forth over time. 1. Make a new scene in Maya, and add a NURBS sphere (called
ball ).
2. Go to the Expression Editor and type in the following:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=517058895 (2 of 6) [11/27/2000 8:44:42 PM]
Books24x7 Mastering MAYA Complete 2
ball.tx = 5 * sin (time); 3. Set your time slider to about 400 frames and play the animation. You should see the ball moving back and forth in rhythm as time (frames divided by frames-per-second) goes by. The Sine function takes an input number (the time of the animation) and converts it into a wave that goes back and forth between 1 and 1. Multiplying the Sine function by 5 just makes it bigger (increases the amplitude). Starting from 0, the Sine function itself looks as shown on the next page.
The X component of the sphere s motion just moves up and down (or back and forth) from 5 to 5 as time increases. We can also make the ball go back and forth more quickly by typing in the following (and clicking Edit in the Expression Editor): ball.tx = 5 * sin (2 * time); Here, the ball will go back and forth twice as fast, since time is being multiplied by 2. In general, you can alter the Sine function s amplitude and frequency as follows: Amplitude x Sine (Frequency x Value) The frequency component adjusts how fast the ball goes back and forth, while the amplitude adjusts how big the motion is. You can also put the frame number into the expression as well as time: ball.tx = 5 * sin (frame); When you play back this expression, the ball will travel back and forth far more quickly than before, as the number of the current frame increases much more rapidly than does the time. Now let s make the ball do something a bit more interesting, like move in a circle. Once again, edit the expression on the ball, this time to the following: ball.tx = 5 * sin (time);
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=517058895 (3 of 6) [11/27/2000 8:44:42 PM]
Books24x7 Mastering MAYA Complete 2
ball.tz = 5 * cos (time); Here, the ball s X position is controlled by the Sine function, while the ball s Z position is controlled by the Cosine function. (Remember that the Cosine is perfectly out of phase with the Sine function. In other words, it begins at a value of 1 rather than 0.) When you play back the animation, the ball should move around in a perfect circle. How would you make the circle squashed (an ellipse)? Try changing one of the amplitude multipliers to 2 instead of 5. What happens when you increase the frequency of one of the positions? Try making ball.tz equal to 5 * cos (2 * time) and see what happens. What if the frequency number is 3 or 5? You can quickly see how you can make some very complex motion with relatively simple expressions. As a further exercise in using expressions, try making the ball move around a three-dimensional circle instead of just on the X-Z plane.
Wheels That Stick As a last example of simple expressions, let s make something that can really come in handy: a way to make a wheel (in this case, our famous ball) stick to the pavement so as not to slip. If you ve ever tried to keyframe a non-slipping wheel, you know what a pain it is to do; but with a simple expression, Maya will do it for you! 1. In an empty scene, create a sphere with a radius of 1 unit and name it tire. 2. Create a plane and scale it big. 3. Now move the ball up by 1 on the Y axis so that it just rests on the plane (if you think you re good, try making the plane and sphere, and then moving the sphere, all using MEL commands in the Script Editor). 4. Select the tire ball and open the Expression Editor. Name the expression stickyTires and then, in the Expression window, type the following: tire.rz = - (tire.tx * (360.0 / (2 * 3.1415))); This expression takes the translateX component of tire and turns it into an angle for the rotateZ component. The negative sign ensures that the tire actually rotates the proper direction when the wheel is moved. The parenthetical expression just converts degrees to radians so that the two numbers will match up properly. 5. In the scene window, move the ball back and forth in the X direction and watch how the ball always rolls just the right amount to keep up with how far it moves. In the next chapter, we ll briefly revisit this tire expression and make it more generally useful and readable! As a further exercise, can you make the ball roll properly as it s moved in the Z direction (be sure to set the X, Y and Z positions back to 0 before you do this)? Finally, let s use a nice little built-in MEL function called noise to make the tire move back and forth in the X direction, as it sticks to the ground. The noise function creates random, but connected, motion paths (as opposed to the rand function, which goes all over the place!). Compare the following two motion paths.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=517058895 (4 of 6) [11/27/2000 8:44:42 PM]
Books24x7 Mastering MAYA Complete 2
While the noise function, on the left, is a random motion, it moves from point to point in a smooth path. The rand function, on the right, however, is very chaotic. There are cases where each has an advantage; here, we need to use the noise function to make the tire move smoothly back and forth. In the Expression Editor, type in the following (to modify the expression you ve already been working on): tire.tx = 5 * noise (time); tire.rz = - (tire.tx * (360.0 / (2 * 3.1415))); As time increases, noise generates a new number for each new time, but each number is connected to the old one in such a way as to keep them relatively close together. When you play back the new tire animation, the wheel will move back and forth on the X axis, all the while sticking to the ground as it rolls. Considering how simple this expression is, it produces very complex motion that would be difficult to reproduce using keyframes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=517058895 (5 of 6) [11/27/2000 8:44:42 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=517058895 (6 of 6) [11/27/2000 8:44:42 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, you have learned what MEL is and how Maya is constructed on it, and you have gained hands-on experience with some basic (yet powerful) ways to take advantage of scripting. You also learned how to make your scripts quickly available as buttons, hotkeys, or marking menus. Finally, you learned the difference between MEL commands and expressions, and how to create some basic expressions that do neat things. (If you are interested in further exploring expressions and how they are used in dynamics, please see Chapter 23.) In the following chapter, we will go into more depth about how to use MEL to create flexible procedures and complex scripts that can even have their own user interface. If this chapter was as far as you want to go with MEL right now, don t bother with the next chapter. If you re ready to learn how to really program the pants off Maya, just turn the page!
Maya Color Insert
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=317133991 [11/27/2000 8:44:46 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 16 - MEL Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chinese Dragon Created by technical editor Mark Smith as a test animation for a video project called Organix, this piece was our first attempt at using Paint Effects in conjunction with the iterative replication of geometry. The gold rib-like appendages are Paint Effects brushstrokes joined to volume-textured geometry. The animation sequence is quite hypnotic, as the dragon curls and convulses upon itself.
© 1999 Mark J. Smith
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (1 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Image of BINGO, Chris Landreth, courtesy of Alias|Wavefront, a division of Silicon Graphics Limited. © Silicon Graphics Limited. Used by permission. All rights reserved.
Image of BINGO, Chris Landreth, courtesy of Alias|Wavefront, a division of Silicon Graphics Limited. © Silicon Graphics Limited. Used by permission. All rights reserved.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (2 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Image of BINGO, Chris Landreth, courtesy of Alias|Wavefront, a division of Silicon Graphics Limited. © Silicon Graphics Limited. Used by permission. All rights reserved.
Bingo Created at Alias|Wavefront, a division of Silicon Graphics Limited, by Chris Landreth in conjunction with the development of Maya® software. The award-winning animated short BINGO was presented as the grand finale of the Electronic Theater at SIGGRAPH 98. As explained by Duncan Brinsmead in his conversation with Perry Harovas, included in the Appendix, the challenges involved in creating the hair for the Balloon Girl helped inspire Mr. Brinsmead to create Maya software s new Paint Effects" tool. Although BINGO was developed partly to test and demonstrate Maya software s capabilities, BINGO is more than just a dazzling technical achievement; you can see from these stills that it is an artistic achievement as well.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (3 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Image of BINGO, Chris Landreth, courtesy of Alias|Wavefront, a division of Silicon Graphics Limited.
Stingray This image was created in Maya 2 by Michael Leone at Viewpoint Studios. The stingray was generated from a primitive NURBS sphere with the help of nonlinear deformers and by manually pushing and pulling the CVs. Nonlinear deformers were also used to create the lifelike motion of the stingray as it glides through the water. Complex layers of procedural shaders were used to generate the stingray s skin.
© Silicon Graphics Limited. Used by permission. All rights reserved.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (4 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Copyright © 1999 Michael D. Leone
Negative Balance This piece, also by Michael Leone, was created entirely in Maya 2. The artist s intention was to create an image that evoked concentration, frustration, and defeat and we think you ll agree that he succeeded, at least with the first two. The resulting dynamic compositing was achieved by the careful placement of objects, detailed modeling, particle systems, and raytracing (to provide realistic reflection).
Copyright © 1999 Michael D. Leone
Hamlet These four images, created by author Peter Lee, are from To Be or Not to Be, an animation short shown at the Animation Festival, SIGGRAPH 99. The character recites Hamlet s famous soliloquy in his own unique style. A short segment is included in the accompanying CD-ROM.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (5 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Copyright © 1999 Peter Lee
Copyright © 1999 Peter Lee
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (6 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Copyright © 1999 Peter Lee
Copyright © 1999 Peter Lee
The Child Created by author Peter Lee, this is a finished rendering of the boy built in stages beginning in Chapter 6. The head was built in several NURBS patches, the hands were created using polygon modeling, and the body was bound using Rigid Bind. The constrained and weighted model is included in the CD-ROM.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (7 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Copyright © 1999 Peter Lee
The Dog Created by author Peter Lee, this is a finished version of the dog begun in Chapter 8 and completed in Chapter 13. This simple dog was built in NURBS patches, using the Stitch tool, and bound using the Smooth Bind. The constrained and weighted model is included in the CD-ROM.
Copyright © 1999 Peter Lee
The Living Room http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (8 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Created by author Peter Lee, this is the complete living room scene built in stages beginning in Chapter 5 and completed in Chapter 19. It includes the furniture, the lamp, the letter M, and the dog. An Env Sky was used as the environment texture, and the glow was applied to selected shaders.
Copyright © 1998 Peter Lee
The Woman Created by author Peter Lee in 1998 for Alias|Wavefront s Maya contest. All the textures, with the exception of the eyebrows, were created in Maya 1.
Copyright © 1998 Peter Lee
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (9 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Eden Created for a direct-to-video film, by author Perry Harovas. This was our first test of Paint Effects for film, used to give a storybook feel crossed with realism. Every blade of grass casts shadows. Running a Paint Effects pass at 1800x1350 resolution took only 5 minutes.
© 1999 Perry Harovas
Go Play Outside Created by author Perry Harovas for the cover of this book, with heavy use of Paint Effects. The tree is casting shadows on the house, and in the animation on the CD-ROM, it gives the impression of a nice breezy day.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (10 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
© 1999 Perry Harovas
Blinding Created by author Perry Harovas for a direct-to-video film, this image makes heavy use of light fog, shader glow, and depth-of-field. You ll find the complete animation on the accompanying CD-ROM.
© 1999 Perry Harovas
Underwater Dance Created by author Perry Harovas for a direct-to-video film. The caustic effect was created as a 2D animation, and then applied to a point light located underneath the water. The light was exclusively linked to the rocks, so that it wouldn t affect the water surface, which was displaced with the same 2D animation, to tie the effects together. You ll find the complete animation on the accompanying CD-ROM.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (11 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
© 1999 Perry Harovas
Murk Created by author Perry Harovas for a direct-to-video film. The cave was generated from a heavily subdivided cylinder, which was deformed with Artisan. The ground plane that makes up the water intersects a flattened side of the cylinder, which makes up the floor of the cave. Spotlights with Intensity Falloff were used to good effect for a realistic feel.
© 1999 Perry Harovas
Childhood Memories
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (12 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Created by author Perry Harovas, this stark room tries to evoke the weird memories that seep into our adult minds from childhood. The ball has a very plastic feel, easily achieved with a specularity map to break up the highlight.
© 1999 Perry Harovas
Yiayia s Created by author Perry Harovas to bring back memories of your grandmother s house. The walls are reflected in the table, but the ceiling was excluded because it created too many reflections, and was a distraction. The bleeding light on the walls mimics radiosity through the use of some point lights with intensity falloff.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (13 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
© 1999 Perry Harovas
Muffled Scream Created by author Perry Harovas for a direct-to-video film; this image was used on the cover box. The beast was created with minimal geometry, evoking fear with the use of motion blur and letting the viewer s imagination fill in the missing details.
© 1999 Perry Harovas
Water head In this image created by author John Kundert-Gibbs, the pseudopod and head are an example of several concepts from this book, from facial modeling to blendshape animation to soft bodies and texturing. This is an enlarged still from the animation available on the accompanying CD-ROM.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (14 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
©1999 John L. Kundert-Gibbs (head model by Peter Lee)
Fountain The fountain, created by author John Kundert-Gibbs, is a marriage of modeling, dynamics, texturing, raytracing, Paint Effects, and a bit of tricky compositing. Because of the level of complexity in the scene, the three passes required to create this still image took over two hours of rendering on a dual 550MHz Pentium III machine. An animated version of this scene is available on the accompanying CD-ROM.
©1999 John L. Kundert-Gibbs
Fizzing Tablet http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (15 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Created by author John Kundert-Gibbs, these are two views of the antacid tablet developed in Chapters 22 and 23. The tablet is a particle emitter, and the bubbles are spherical particles. An animated version of this scene is available on the accompanying CD-ROM.
©1999 John L. Kundert-Gibbs
©1999 John L. Kundert-Gibbs
Composited Fountain Created by author John Kundert-Gibbs, this is a still from the fountain animation developed in Chapters 22 and 23, also available on the CD-ROM. In this composited image, you can see the beginnings of a production-ready image.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (16 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
© 2000 John Kundert-Gibbs
Fire Man This image, created by author John Kundert-Gibbs, is a still frame from a low-resolution proof of concept animation for an upcoming made-for-TV movie. In it, John used Paint Effects to paint fire onto geometry that was matched to the person in the background plate (originally, he had used particles, but these proved more difficult to control than Paint Effects brushes). The rest of the shot was done in a compositing package, where different layers of fire, geometry, and the background plate were combined, and colors were altered in the background plate to indicate the effects of the fire on the surroundings.
© 2000 John Kundert-Gibbs
Mary The mood is meant to be quiet and introspective, like an unspoken prayer. Created from memories of the priests room to the side of the altar, where the vestments were kept
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (17 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
© 1999 Perry Harovas
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=954246500 (18 of 18) [11/27/2000 8:45:09 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 17: Programming with MEL Overview The previous chapter introduced the Maya Embedded Language (MEL). You learned how to work with the Script Editor, create your own marking menus, and use expressions. This chapter takes you further into the language; it focuses on using MEL to maximize productivity, to create graphical user interfaces (GUIs, pronounced gooeys ), and to create full-blown MEL scripts suitable for framing. Although you can benefit from this chapter without any prior programming experience, it will be a big help if you already have some understanding of a programming or scripting language. If you d like to try some programming first, you can avail yourself of a wealth of books, classes, and references for a dizzying array of programming languages. Otherwise, let s dig into the meat of MEL! Tip As Maya s syntax is very similar to that of the C programming language, a good primer on C is your best preparation for MEL. The publisher of this book offers numerous titles on C and C++, including C++: No experience required, by Paulo Franco (Sybex, 1998), and Mastering Visual C++ 6, by Michael J. Young (Sybex, 1998).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=634054294 [11/27/2000 8:47:27 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
How To Get Help with MEL Before we delve too far into the more complex aspects of MEL, let s take a moment to examine the powerful Help tools Maya has available and how easy they are to use. First, you have Maya s internal Help function. Because there are so many MEL commands and functions (about 700), the Help function is a very quick and useful feature (you can even type in help help to get a look at how the help command works). Here s an example of the type of information available with Help. Open the Script Editor and type the name of the command you want help with into the Input window (or just type it into the Command line below the main window): help setAttr; Execute the command, and in the Script Editor s History window, you ll see the following result lines: // Result: Synopsis: setAttr [flags] Name[...] Flags: -e -edit -q -query -av -alteredValue -k -keyable
on|off
-l -lock
on|off
-s -size
Index
-typ -type
String
// These result lines give you a quick look at the setAttr command: a synopsis of its syntax (or how to use it) and a list of flags that you can use with the command.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=952982157 (1 of 3) [11/27/2000 8:47:37 PM]
Books24x7 Mastering MAYA Complete 2
If you re an experienced programmer, this information may be all you need in order to use the command. If you re just starting out, however, you ll probably want more guidance. In that case, try typing the following into the Input window: help
doc setAttr;
When you execute this command, Maya will automatically bring up your browser of choice (usually Netscape Communicator or Microsoft Internet Explorer) and find the right HTML page in your online documents (contained on your hard drive) that contains the command you want help with. In the case of the setAttr statement, you get the following display: Name setAttr Synopsis setAttr [flags] object.attribute value [value..] ReturnValue None. Description Sets the value of a dependency node attribute. No value for the attribute is needed when the -l/-k/-s flags are used. The -type flag is only required when setting a non-numeric attribute. There is also a table of flags and what they do (notice that this table is far more complete than the smaller help text you get inside the Script Editor history window). Finally, you get what we consider the most useful aspect of the help files several examples of how to use the command: Examples // Set a simple numeric value setAttr transform1.translateX 5; // Lock an attribute to prevent further modification setAttr -lock on curve1.translateX; // Make an attribute unkeyable setAttr -keyable off curve1.translateZ; // Set an entire list of multi-attribute values in one command setAttr -size 6
curveShape1.knots[1:6]
0 0 0 1 1 1;
// Set an attribute with a compound numeric type setAttr
revolve3.axis
-type
double3
0 0 1;
// Set a multi-attribute with a compound numeric type setAttr
madeUpNode.multiAxis[0:2]
-type
double3
0 0 1 1 0 0 0 1 0;
As you can see, a few examples can do a lot to clarify how a command is used. Between the internal Help files and the online help on your hard drive, you can access excellent reference material very rapidly.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=952982157 (2 of 3) [11/27/2000 8:47:37 PM]
Books24x7 Mastering MAYA Complete 2
Tip Examining other users scripts as guides for what you wish to do is another great way to learn more about MEL you can even copy and paste portions of scripts for your own use (just be sure that you have the author s permission).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=952982157 (3 of 3) [11/27/2000 8:47:37 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Debugging MEL Scripts If you were careful entering the commands in the last chapter, you may have gotten away without seeing a MEL error; in the work ahead, however (and certainly as you begin building MEL scripts of your own), you will encounter errors, the most common of which is the syntax error. Every command has a particular structure or form that needs to be followed in order to execute successfully. Otherwise, the script interpreter won t know what to do with your command and will most often return a syntax error. While debugging a script is a bit of an art form, there are a couple of ways you can help yourself. First, check the History window when you execute a script: If the last line of your script is the last line of the History window, the commands executed without an error. If, however, you get a comment line like the following: setAttr tire 5; //Error:
line 1:
No attribute was specified. //
you know that there has been at least one error in parsing the script. Note Parsing is the programming term for the search the script interpreter does through the script to make sure all the commands are correct. The Feedback line (at the bottom-right of the screen) will also turn orange-red to indicate that the MEL interpreter has discovered an error in your code. One way to help you quickly identify where these errors might lie is by turning on the Edit Ø Show Line Numbers option in the Script Editor menu. Generally, it s a good idea to keep this option on at all times, as it does not slow Maya down in any way, and it provides useful information about where errors are occurring. As you begin scripting, one error that will probably creep in is forgetting the final semicolon at the end of each line. This can be difficult to spot if you re not aware of the problem. If you are getting errors in your script that don t make sense, try looking at each line of code to be sure it finishes with a semicolon. Finally, since MEL is an interpreted scripting language, you can execute a script one line at a time, rather than as a whole. This can be a very useful way to figure out where a problem is occurring in your program. A brief exercise will illustrate:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=832161621 (1 of 2) [11/27/2000 8:47:43 PM]
Books24x7 Mastering MAYA Complete 2
1. Type in the following, but don t execute it yet: print
hello, world! ;
print hello, world; 2. Now highlight the first line and execute it (by pressing the Enter key on your numeric keypad). You should see hello, world! printed out in the History window. 3. Now highlight and execute the second line. You should see something like the following: // Error: print hello, world; // // Error: Line 1.12: Syntax error // The first line executed properly, but the second had an error in it the print command needs a string to work with, and you need to include quote marks to identify the string. In a two-line script, spotting the error would be simple; in a longer script, this method of going through the script one line at a time can be a great way of uncovering problem spots. Great. We know how to get help and debug a script now let s get down to business!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=832161621 (2 of 2) [11/27/2000 8:47:43 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Placeholders, Circles, and Trees (Variables, Loops, and Branching) If you ve done any programming at all, you ve probably been waiting for this point: the main reasons to program are to (1) create flexibility and to (2) do repetitive tasks. Flexibility comes through variables (or placeholders), while repetition is made possible through looping and branching.
Variables It s actually much easier to see what a variable is than to talk about it. Type the following in the Script Editor: string $myVariable; $myVariable =
hi there ;
print $myVariable; When you execute these commands, you ll see that hi there is printed in the last line of the History window, indicating that when you told Maya to print $myVariable, it printed hi there. The first line of the script, above, is called a declaration of the variable: string is the variable s type (a string is just text contained in quotes), and $myVariable is its name. Types of MEL Variables The other types of variables we ll be dealing with are int An integer number used to represent a whole number, like 3 or float A decimal number used to represent a
real
number, like
45. 35.4725.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516000590 (1 of 6) [11/27/2000 8:47:53 PM]
Books24x7 Mastering MAYA Complete 2
vector Three decimal numbers that make a vector number used to represent a point on a three-dimensional grid, like (26, 31.67, 5.724). A vector number is very useful for three-dimensional quantities like position (X, Y, Z coordinates) or color (red, green, blue colors). array A list of numbers used to store lists of either integers or floats. Arrays are useful for storing data about many similar items, like the color of each of a group of particles. We ll examine vectors and arrays more closely as they come up. Every MEL variable needs to start with the $ symbol, so MEL knows it s a variable. (This is easy to forget, and it causes strange errors so remember your $ symbol!) The second line is called the assignment line: the text string hi there is placed into the variable (or placeholder) for future use. The last line is simply a print statement, telling Maya to print out what s inside the variable, $myVariable (which, in this case, is hi there ). If we wished, on the following line we could type in $myVariable =
goodbye ;
which would change the data in the variable $myVariable to the word goodbye. As you can see, variables can be extremely useful because they can store different data at different times in a program. MEL has a convenience feature built into it: you can declare and assign a variable in the same line. In other words, the script above could be written as follows: string $myVariable =
hi there ;
print $myVariable; There is no real difference between the two scripts, except for less typing and a bit easier readability you are free to use whichever method appeals to you (though most seasoned programmers opt to save keystrokes!).
Looping Next, let s examine looping. Say you wish to create five spheres in your scene using MEL commands. You could either do this by typing in sphere r 1 n ball five times, or have MEL do it for you using the for loop. To build our spheres, type in the following: int $i = 0; for ($i = 1; $i<= 5; $i++) { sphere
r 1
n ball;
} Voilà, five spheres named ball 1 through 5. (However, you ll need to move them away from each other in order to see them as separate objects. We ll do that in a moment.) Note MEL supports implicit variable declaration, so the int $i = 0 line is not necessary. However, in most cases, it is preferable to declare all variables explicitly to avoid possible complications in the script.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516000590 (2 of 6) [11/27/2000 8:47:53 PM]
Books24x7 Mastering MAYA Complete 2
Note that there is no semicolon after the for statement: MEL expects there to be one or more commands (contained within the {} brackets) after the for statement, so it doesn t need a semicolon. Additionally, the closing bracket, }, functions as a semicolon, so there is no need for a semicolon on the last line either. The syntax for the for loop is as follows: for (initial value; test value; increment); The initial value is what the counting variable is set to at the beginning. The test value is how high (or low) the number can go before it tests negative and thus how many loops the counter goes through. The increment is how quickly the counter increases in value ($i++ is a simple way of saying increase the value of $i by 1 each loop ). To make this loop do a bit more for us, let s have it move the spheres on top of each other on the Y axis as it creates them: for ($i = 1; $i<= 5; $i++) { sphere move
r 1
n ball;
r 0 (2 * $i) 0;
} Now as the spheres are created, each one is moved up by twice the value of $i, placing them just atop one another.
Branching The last basic program structure we ll look at is branching, a slightly more complex type of loop that allows MEL to ask a question and decide whether to do some further action given the answer (the for statement actually contains a branch in its test value statement). Let s use the same script as above, only this time let s put a conditional statement inside it: for ($i = 1; $i<= 5; $i++) { sphere
r 1
n ball;
if ($i<=3) { move
r 0 (2 * $i) 0;
} else { move
r (2 * $i) 0 0;
} }
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516000590 (3 of 6) [11/27/2000 8:47:53 PM]
Books24x7 Mastering MAYA Complete 2
What happens when you execute these commands? The first three balls are stacked up on the Y axis (when $i is less than or equal to 3), and the last two are stacked along the X axis (when $i is 4 and 5, and therefore greater than 3). In abstract terms, the syntax for the if statement is as follows: if (test) { commands;
else if (test) { commands; } else{commands;} The elseif and else statements do not have to exist for the if statement to work. The else if statement, listed above, allows you to make as many tests as you like (there can be as many else if statements as you wish in your conditional statement), allowing you to test for multiple possibilities within one large conditional statement. The else statement must always be last in such examples and is the default answer if no other conditions are met. Note that all the commands for an if, else if, or else statement must be enclosed in {} brackets. If we wish, we could increase the complexity of our create-and-move-ball code with an else if statement: for ($i = 1; $i<= 10; $i++) { sphere
r 1
n ball;
if ($i<=3) { move
r 0 (2 * $i) 0;
} else if ($i>3 && $i<=6) { move -r 0 0 (2 * $i); } else { move
r (2 * $i) 0 0;
} } Here, the balls will stack along the Y axis if $i is less than or equal to 3, along the Z axis if $i is between 4 and 6, and along the X axis if $i is greater than 6.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516000590 (4 of 6) [11/27/2000 8:47:53 PM]
Books24x7 Mastering MAYA Complete 2
Tip If there is only one line of commands below the if statement, you do not need the brackets however, it s a good idea for readability to always include them anyway. Now that we have all these time-saving functions at our fingertips, let s revisit a project from last chapter and make it a bit more useful.
Using Variables, Statements, and Loops in Expressions Not only can you use variables, conditional statements, and loops in MEL scripts; they can also be used in expressions. Let s take a quick visit back to that sticking tire expression we worked on in the last chapter. If you don t have the scene saved, open a new scene, create a sphere and name it tire, and make a plane under it (scaled to about the size of the default grid). We re going to take the expression we had before, add variables to it, and add a conditional statement to do different things if the ball is being moved up the Y axis.
One thing we haven t yet discussed, yet is very important to our work, is the reverse apostrophe the apostrophe that s above the Tab key on the keyboard and looks like this: `. Enclosing a statement in these apostrophes tells Maya to evaluate the statement inside them and pass the result on to the variable on the other side of the equation. The statement float $myVariable = `getAttr tire.radius`; returns the decimal (or floating point) number representing the radius of the sphere called tire. As you can probably tell, this ability to get the value of any attribute and read it into a variable is quite powerful. Just remember that this isn t the normal apostrophe that lives on the key with the double quote type in that apostrophe and you ll get an error! Now let s redo that expression: float $radius = `getAttr makeNurbSphere1.radius`; float $pi = 3.1415926; float $deg = 360; float $howHi = `getAttr tire.ty`; if ($howHi != $radius) {
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516000590 (5 of 6) [11/27/2000 8:47:53 PM]
Books24x7 Mastering MAYA Complete 2
tire.translateY = $radius; } tire.rotateZ = - ( tire.translateX * ($deg / (2 * $pi * $radius))); The first four statements declare and assign values to variables. $pi is the value of ð. $deg is the number of degrees in a circle. Having these variables in the expression just makes reading the equation below easier. The two variables $radius and $howHi are assigned values by using reverse apostrophes to enclose getAttr statements. The reverse apostrophes evaluate the getAttr statements and then read the sphere s radius and Y position into the variables. (Note that the attribute for radius belongs to the makeNurbSphere node, not the transform node, which has been renamed tire.) The conditional statement asks whether the Y position is different than the sphere s radius (!= is MEL s not equal operator). If so, it places the sphere directly on top of the plane (1 radius above 0). Also notice that the equation for Z rotation has been modified to take the sphere s radius into account now (the rotation angle being equal to 2ðr, you ll recall from high school math classes). With this equation, no matter how big or small the sphere is, it will always sit right on the plane and will roll without slipping! Using variables and a conditional statement, we have reworked the simple one-line expression into a flexible tool that can be used in varying situations. We ll return to variables, looping, and branching as this chapter continues, but now let s turn to creating a GUI in Maya.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=516000590 (6 of 6) [11/27/2000 8:47:53 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating a GUI While typing commands into the Command line or Input window of the Script Editor is very useful for simple tasks, it is often much more elegant (not to mention user-friendly) to create a graphical user interface window in your script to give users access to all the script s commands in a familiar point-and-click environment. While creating these windows can be somewhat challenging, nearly all high-quality scripts use them, so it is good to learn at least the basics of GUI creation using MEL. Windows in Maya can be very complex (just look at the Attribute Editor window for an example), but the basic way to create a window is fairly simple. At a minimum, you need three commands to make a window: window
title
title
wh 400 200 myWindow;
some kind of layout; showWindow; Executing the window command creates a window with a certain title that appears at its top (the title flag), optionally a predefined width and height (the widthHeight or wh flag), and an optional name (the last item in the window command). The showWindow command makes the window appear onscreen (it will never appear if you forget this line) this command usually resides at the end of a make window series of commands. The layout commands specify what sort of layout the window will have. Some common types are columnLayout, scrollLayout, rowColumnLayout, and formLayout. The column layout creates a column, the scroll layout makes the window a scrollable window, the row-and-column layout makes a grid of rows and columns (like a table), and the form layout creates a flexible space that can be laid out in many ways. These layouts can also contain other layouts nested within them, creating the ability to make very complex windows relatively easily (the form layout is often the parent layout, with many other layouts inside it). Let s create a simple window with one button and one slider in it. Type the following into the Script Editor: window -t
The Big Window!
-wh 400 200 myWindow;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=535196047 (1 of 5) [11/27/2000 8:47:57 PM]
Books24x7 Mastering MAYA Complete 2
columnLayout -cw 200; button -l text
Click this button
myButton;
;
attrFieldSliderGrp -l
Slide this around
-min 0 -max 10 theSliderGroup;
showWindow myWindow; These commands create a window (which Maya knows as myWindow, but which is titled The Big Window! ) with a width of 400 and a height of 200 pixels. A column layout is then set with a width of 200 pixels. Next, a button (labeled Click this button and known to Maya as myButton) is created; then a field-and-slider group is created (labeled Slide this around and known as theSliderGroup) with a minimum value of 0 and a maximum value of 10. The text command just puts a space in between the button and the slider group. Finally, we display the window via the showWindow command. Obviously it s not too difficult to create windows with buttons, sliders, or other objects in them.
Tip If you make some errors typing in the MEL script, and then go back and try to run the script again, when you try to recreate the window, you may run into the following error: Error: Object s name is not unique: myWindow. If you get this message, you need to delete the window myWindow: even though it doesn t appear onscreen, MEL has created a UI object named myWindow (Note that the showWindow command is last, so an object can be created and not shown). Thus, while myWindow doesn t appear, it can exist in your scene, and it needs to be deleted. To do this, type deleteUI myWindow. This is a very useful command to remember as you create GUI windows, so commit it to memory. Now let s make our buttons do something. Clear all objects in your scene and create a sphere called ball. Edit your script to include the command and attribute flags, as follows: window -t
The Big Window!
-wh 400 200 myWindow;
columnLayout -cw 200; button -l text
Press this button
-c
setAttr ball.ty
5
myButton;
;
attrFieldSliderGrp -l
Slide this around
-min 0 -max 10 -at ( ball.tx )
theSliderGroup; showWindow myWindow;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=535196047 (2 of 5) [11/27/2000 8:47:57 PM]
Books24x7 Mastering MAYA Complete 2
The c flag tells Maya to perform the quoted instruction each time the button is pressed. Thus, when this button is pressed, Maya sets the ball s Y position to 5 units. The at flag in the slider group tells Maya to connect the slider and text field to the quoted attribute (in this case, the X position of the ball). When you click the button, the ball jumps up to 5 on the Y axis. When you slide the slider (or enter numbers in the text field), the ball moves back and forth between 0 and 10 on the X axis. Tip You can set the slider and text field to have different minimum and maximum values. The fmn and fmx flags give the field s min and max values. The smn and smx flags give the slider s min and max values. This allows the user to enter numbers outside the slider s bounds, which can be useful. You can also create radio buttons and check boxes that perform functions when pressed (see the MEL documentation for more information on these). Note As an exercise, what command could you place on the button to make the ball move up 5 units every time the button is pressed? Now that you ve seen how quickly you can create a basic window as an interface to your scripts, let s make a script that automatically creates a useful window for you. Make a new scene, and then create several lights and aim them at an object in the scene (you could use the create lights shelf button you made in the last chapter to do this for you automatically or you could open a scene you have already created that includes several lights in it). Now enter the following in your Script Editor window: string $sel[] = `ls -lights`; string $current; string $winName =
lightWindow ;
if (`window -exists $winName`) { deleteUI $winName; } window -title
Lights
-wh 400 300 $winName;
scrollLayout; rowColumnLayout -nc 2 -cw 1 150 -cw 2 400; for ($current in $sel) { text -l $current; attrFieldSliderGrp -min (-1) -max 10 -at ($current +
.intensity );
} showWindow $winName; When you execute this script, Maya will automatically create a light board to control the intensity of all lights in the scene from one floating window.
for you, allowing you
The most interesting thing about this script is the first line: string $sel[] = `ls -lights`;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=535196047 (3 of 5) [11/27/2000 8:47:57 PM]
Books24x7 Mastering MAYA Complete 2
This line assigns to the variable string array $sel[] the name of every light in the scene. The [] after the variable name tells Maya this variable is an array, or list of variables, starting with the number 0. If there were three elements in the list, they would be $sel[0], $sel[1], and $sel[2]. By declaring one array, then, you get three (or four, or however many you want) variables for the price of one! The ls command tells Maya to list the items that come after (in this case, -lights means list all lights in the scene ); then the reverse apostrophes tell Maya to evaluate this command (which returns the name of each light) and read the result into the array, $sel[]. Next, other variables are declared to store the current item ($current) and the window name ($winName), and the script checks to see if the window already exists if it does, the script kills the old window (using the deleteUI command) so it can write a new one. This little piece of code is good to include in all your GUI scripts, to ensure that you don t accidentally generate any errors if a window by that name already exists. Then a window is created with a scroll layout (so the window can scroll if it s too small) and a row/column layout (a table). Then the script performs a variation of the for loop, called the for&in loop. The for&in loop looks through an array (in this case, $sel[]) and does one loop for each item it finds, placing the value of $sel[number] in the variable $current. Note The type of $current must therefore match the type of $sel[] (in this case, they re both strings). The loop then prints out the name of the light (in column 1) and makes a field slider group that s attached to the light s intensity setting (in column 2).
Tip If you only wanted the lights you had previously selected in the scene to be in the window, you could add the flag -selected to the ls command on the first line. This little script should indicate how powerful a workflow enhancer MEL can be: in just a few lines of script, you have created a way to control potentially dozens of lights in a complex scene in a completely simple, intuitive manner. If you needed to create just the right light levels on twenty lights in a scene, it could take hours navigating to each light and adjusting it individually. This script could make the job a 10-minute effort instead!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=535196047 (4 of 5) [11/27/2000 8:47:57 PM]
Books24x7 Mastering MAYA Complete 2
Note As an exercise, try creating sliders that let you adjust the light s colors as well as its intensity (hint: there are three attributes, colorR, colorG, and colorB, which control the red, green, and blue intensities). If you really want to get crazy, try placing each group of controls for each light in its own subwindow (so intensity, colorR, colorG, and colorB are all inside a window). You ll need to know about the setParent command, as well as how to make a frame layout with the flag cll (collapsible) set to true (to make each window close by clicking its triangle). You could also add check boxes to turn off each light s visibility, so that you can see the effects of each light separately. You can find help for these commands in Maya s online reference documents, and if you get stuck, there is a finished MEL script listed at the end of this chapter and included on the CD.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=535196047 (5 of 5) [11/27/2000 8:47:57 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Procedures and Scripts In the past two chapters, we ve touched on most of the basic elements of MEL. However, all the work we ve done so far won t be very valuable if we try to give them to someone else or save them to our scripts directory. We haven t done anything to save the commands we ve written in a format that Maya can read as a whole. Now we need to learn how to make these bits of code into full-fledged ( standalone ) scripts that you can port from one place to another and trade with friends and relatives. In this section, we ll look at procedures and scripts. A procedure is the basic building block of a MEL script. At its most fundamental level, it s simply another declaration line that tells Maya that all the contained lines form one named function. A script is just a collection of one or more procedures.
Procedures In abstract, a procedure would look like this: proc myProcedure () { commands } Maya will execute all the commands contained in the curly braces every time you type myProcedure into the Command line or the Script Editor s Input window. MyProcedure is the name of the procedure, and the parentheses can contain any number of declared variables that can either be called from another procedure or entered by the user when executing the procedure. As a simple example, let s make a procedure that will create a user-defined number of you guessed it spheres. global proc makeBall (int $num) { int $num; for ($i=1; $i<=$num; $i++) http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111910020 (1 of 4) [11/27/2000 8:48:01 PM]
Books24x7 Mastering MAYA Complete 2
{ sphere -r 1 -name ( ball
+ $i);
} } Enter ( source ) this text into the Script Editor. Then, whenever you type makeBall into the Command line or Input window, followed by an integer number, you ll get that many spheres (called ball1, ball2, etc.) in your scene. Typing makeBall 5, for example, would make five spheres named ball1 through ball5 in your scene. We ve made this procedure global so that Maya can reference the procedure from within your \scripts directory (more on this in a moment). You know that a procedure is just a bunch of MEL commands contained in braces and given a name; so how would you turn our series of light board commands into a procedure? If you need a hint, it would look something like this: global proc lightBoard () { string $sel[] = `ls -lights`; string $current; string $winName =
lightWindow ;
if (`window -exists $winName`) { deleteUI $winName; } window -title
Lights
-wh 400 300 $winName;
scrollLayout; rowColumnLayout -nc 2 -cw 1 150 -cw 2 400; for ($current in $sel) { text -l $current; attrFieldSliderGrp -min (-1) -max 10 -at ($current +
.intensity );
} showWindow $winName; } Once you source (enter) this procedure, each time you type lightBoard in the Command line, the procedure will run and you will get a light board for all your lights.
Scripts
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111910020 (2 of 4) [11/27/2000 8:48:01 PM]
Books24x7 Mastering MAYA Complete 2
What is the difference between a procedure and a script? A script is just a collection of one or more procedures. Thus, the lightBoard procedure we just wrote is actually a script as well. A true script is also saved as an external text file, and given a name, which must end in .mel, and the name of the script must be the same as the name of the last (global) procedure in the script (plus the .mel extension). For our lightboard example, we would save the script as lightBoard.mel, and store it in our AW\user name\Maya\scripts directory (when you choose Save Selected from the Script Editor s menu, this is the default directory that shows up, so just save it there). Now let s make a simple script that contains two procedures, to see how that s done. //Source this script, and then type
makeBall
//in the Command line or Script Editor.
The
//procedure will make the number of spheres you //specify, and call them //Created by:
ball1, ball2, etc. .
John Kundert-Gibbs.
//Last Modified:
May 31, 1999.
//Use at your own risk. //makeIt creates the spheres and gives them names. //This procedure is passed the number of balls //you specify from the main procedure. proc makeIt (int $theNum) { //$theNum must be redeclared internal to the //procedure. int $theNum; for ($i=1; $i<=$theNum; $i++) { sphere -r 1 -name ( ball
+ $i);
} } //end, makeIt. //makeBall is the main procedure you call.
It just
//calls the procedure makeIt with the number of //spheres you specify. global proc makeBall (int $num) { int $num; makeIt ($num); }
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111910020 (3 of 4) [11/27/2000 8:48:01 PM]
Books24x7 Mastering MAYA Complete 2
//end, makeBall. All we ve done with this script is to create a subprocedure that will actually make the spheres. The main (or global) procedure merely calls the subprocedure (this is often the case with very complex scripts just look at the end of a script, and you ll often find a very small procedure that simply calls all the other ones in the script). Note that the last procedure is the one that you call by typing makeBall 5 in the Command line. This is (and should be) the only global procedure in the script the makeIt procedure being a local procedure (and therefore not visible outside the script).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111910020 (4 of 4) [11/27/2000 8:48:01 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
A Comment on Commenting Notice that we have commented the script in the previous section extensively (with all the // lines). At the very least, you should put in lines at the top of the script about what the script does, what arguments (inputs) it needs, who wrote (or modified) it, and when it was last modified. We also put in the use at your own risk line to indicate that some unforeseen problem could arise while using the script, and that we are not responsible for any mishaps because of the script s usage. It is also a very good idea to comment the beginning and end of every procedure (so it s easy to read where they start and stop), and to comment any particularly tricky portions of the script. You may think these comments are of use only to others and not yourself, and you d rather not bother with them if you don t plan to distribute the script. But remember that two months after you create the script, you may need to modify it, and if you can t figure out what you did or why, you ll waste a great deal of time hunting through the script instead of getting right to your modifications. Tip Don t get lazy! Always comment your scripts well (even the simplest ones). It s a habit (and for once, a good one), so get into it!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=885393134 [11/27/2000 8:48:05 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Studying the Masters No matter how much you learn in these chapters, space and time simply aren t sufficient here to learn everything MEL has to offer. One of the best ways to continue learning MEL is, quite simply, to look at (and copy from) other people s scripts. If you can go through each line of a script and figure out what it does, you will learn a great deal. Better yet, if you can grab some code someone else wrote and modify it to do what you want it to, you can really start to put together some neat and useful scripts to solve your everyday work bottlenecks. To begin your journey of discovery, let s take a quick peek at three scripts (they are all contained on the CD that comes with this book, so you don t have to type them in). So that you get used to reading commented scripts, we have made our comments about the scripts inside the scripts, rather than here. First is a reworking of the lightBoard script into a fairly robust tool for the user. //Source this script; create and position one or more //lights in your scene. Then type
lightBoard
in the
//Command line. //The script will generate a set of collapsible //windows (one for each light) that control each //light s //intensity, RGB colors, and visibility. //Created by John Kundert-Gibbs //[email protected] //Last Modified:
May 31, 1999.
//Use this script at your own risk. //The check procedure just checks to see if the window //already exists.
If so, it kills the old window.
proc check (string $theName) {
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (1 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
string $theName; if (`window -exists $theName`) { deleteUI $theName; } } //end, check. //beginning, lightBoard. This is the script s main (global) procedure. global proc lightBoard () { string $sel[] = `ls -lights`; string $current; string $winName = string $main =
lightWindow ;
mainWindow ;
int $count = 0; check ($winName); window -title
Light Board
-wh 600 300 $winName;
scrollLayout; rowColumnLayout -nc 1 -cw 1 500 ($main); for ($current in $sel) { $count++; //the -cll flag in the frameLayout command means //that the window will collapse when the user //clicks the triangle next to the window. frameLayout -cll true -w 400 ($current); rowColumnLayout -nc 1 -cw 1 400; attrFieldSliderGrp -min (-1) -max 10 -at ($current + text
;
attrFieldSliderGrp -min 0 -max 1 -at ($current + text
.colorR );
;
attrFieldSliderGrp -min 0 -max 1 -at ($current + text
.intensity );
.colorG );
;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (2 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
attrFieldSliderGrp -min 0 -max 1 -at ($current + text
.colorB );
;
//The visibility slider group was intended to be a //check box for visibility. //However, the checkbox group does not properly //connect to attributes when //it s created in a for loop, so a slider group was //created instead. //The -s flag set the step value to 1 (meaning an //integer jump) so the //group is either 1 or 0. attrFieldSliderGrp -min 0 -max 1 -vis on -at ($current +
.visibility
) -s 1; //the setParent command sets the focus of the //window back to the rowColumnLayout //above. Thus, the windows are stacked below each //other instead of inside each other. setParent $main; } showWindow $winName; } //end, lightBoard. The next script is a way to adjust all keyable attributes of a selected set of objects (for example, joints in an IK body), key each one individually, key all, record a default pose, and go back to that pose. Like the light-board script, this window can be a real time saver when it comes to keying complex motion. //Source this script; select several objects, or //joints in a character; type in
setPose
in the
//Command line. //You will get a window that allows you to manipulate //all keyable attributes //on the selected objects. //record a
default
Additionally, you can
pose
//and go back to that pose.
You can also keyframe any
//or all attributes. //Created by John Kundert-Gibbs
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (3 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
//[email protected] //Last Modified, June 1, 1999. //Procedure to perform a loop, keying all attributes //in the window. proc keyAll () { global string $list[]; string $current; string $Attr; for ($current in $list) { string $attrLST[] = `listAttr -k $current`; for ($Attr in $attrLST) { setKeyframe ($current +
.
+ $Attr);
} } }//end, keyAll //procedure to record the current value of all //attributes in the window. //This creates a
default
pose one can return to.
proc recDefault () { global float $gDefault2[]; global string $list[]; string $current; string $Attr; int $j = 0; for ($current in $list) { string $attrLST[] = `listAttr -k $current`; for ($Attr in $attrLST) { $gDefault2[$j] = `getAttr ($current + print ($current +
.
.
+ $Attr)`;
+ $Attr + \n );
$j++;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (4 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
} } } //end recDefault //Procedure to return all attributes in the window to //their default values, //as recorded in the procedure above. proc gotoDefault () { global float $gDefault2[]; global string $list[]; string $current; string $Attr; int $j = 0; for ($current in $list) { string $attrLST[] = `listAttr -k $current`; for ($Attr in $attrLST) { setAttr ($current +
.
+ $Attr) $gDefault2[$j];
$j++; } } } //end gotoDefault //main procedure. global proc setPose () { global string $list[]; $list = `ls -sl`; string $current; string $Attr; string $main = window -t
mainWindow ;
Set Pose ;
scrollLayout; columnLayout ($main); text -l
Keyable Attributes ;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (5 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
text -l
;
button -l
Record Default Pose
button -l
Go To Default Pose
-w 200 -c
button -l
Key All
keyAll ;
text -l
;
text
-w 200 -c
recDefault ; gotoDefault ;
; -w 100 -c
for ($current in $list) { frameLayout -cll true
-h 380 -w 600 ($current);
scrollLayout; gridLayout -nc 2 -cw 400; string $attrLST[] = `listAttr -k $current`; for ($Attr in $attrLST) { attrFieldSliderGrp -smn -100 -smx 100 -fmn -1000 -fmx 1000 -at ($current + button -l
.
+ $Attr);
Keyframe
-w 100 -c ( setKeyframe
+ $current +
.
+
$Attr); } setParent $main; text
;
} showWindow; } //end setPose The final script revisits the chain of rigid body links we made in Chapter 15. Here, instead of creating the links by coding MEL directly, we copied chunks of MEL output from the History window and reworked it into a flexible script that builds the links for you (with a heavy ball at the bottom). With all that goes on in this script, it appears pretty complex, but remember that we built this script up in pieces, mostly by modifying MEL output as we performed each command. //Source this script; and then type //links>
makeChain
in the Command line.
//The script will generate a series of linked loops //(like a swing chain) that are all connected and have //gravity attached to them. //It also creates a ball called weight, at the bottom
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (6 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
//of the chain, and makes the ball (and chain) swing. //There may be some rigid body interpenetration //warnings, depending on how many links you have. //Created by John Kundert-Gibbs //[email protected] //Last Modified:
May 31, 1999.
//Use this script at your own risk. //Procedure that actually builds the chains proc makeEm (int $num) { string $linkName =
linkNum ;
float $moveNum = -5.160681; float $offSetNum = 1.741263; gravity -pos 0 0 0 -m 9.8 -dx 0 -dy -1 -dz 0 ; cylinder -n mainBar -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -hr 2 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 1 -ch 1; objectMoveCommand; setAttr
mainBar.rotateX
90;
scale -r 1 5.995727 1 ; scale -r 1 1.530854 1 ; torus -n embeddedLink -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -msw 360 -r 1 -hr 0.2 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1; objectMoveCommand; setAttr
embeddedLink.rotateX
90;
scale -r 1 1 2.188674 ; move -r 0 -1.910194 0 ; select -cl; select -r mainBar embeddedLink; rigidBody -passive -m 1 -dp 0 -sf 0.2 -df 0.2 -b 0.6 -l 0 -tf 200 -iv 0 0 0 -iav 0 0 0 -c 0 -pc 0 -i 0 0 0 -imp 0 0 0 -si 0 0 0 -sio none ; for ($i=1; $i <= $num; $i++) { select -cl; torus -n ($linkName + $i) -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -msw 360 -r 1 -hr 0.2 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1; objectMoveCommand; setAttr ($linkName + $i +
.rotateX ) 90;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (7 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
setAttr ($linkName + $i +
.rotateY ) (90 * $i);
scale -r 1 1 2.210896 ; if ($i == 1) move -r 0 $moveNum 0 ; else move -r 0 ((($moveNum + $offSetNum) * $i) - $offSetNum) 0 ; rigidBody -active -m 1 -dp 0 -sf 0.2 -df 0.2 -b 0.6 -l 0 -tf 200 -iv 0 0 0 -iav 0 0 0 -c 0 -pc 0 -i 0 0 0 -imp 0 0 0 -si 0 0 0 -sio none ; connectDynamic -f gravityField1 ($linkName + $i); } }
//end makeEm
//procedure to add the ball to the bottom of the //chain. proc addBall (int $num) { float $moveNum = -5.160681; float $offSetNum = 1.741263; string $linkName =
linkNum ;
select -cl; sphere -n weight -r 2; move -r 0 ((($moveNum + $offSetNum) * $num - $offSetNum - 5)) 0 ; select -cl
;
//now select the last link and the
weight
ball, and
//make a pin constraint. select -r ($linkName + $num) ; select -tgl weight ; constrain -pin -i 0 ; select -cl
;
//make the sphere s weight 50, connect gravity to it, //and create an //expression to drive the weight back and forth in X //(impulseX). select -r weight ; setAttr ( rigidBody
+ ($num + 3) +
.mass ) 50;
connectDynamic -f gravityField1 weight; //The next line actually adds an expression to the //weight ball, driving it back and forth.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (8 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
//How cool is that?! expression -s 3))
impulseX = 5 * sin (2 * time);
-o ( rigidBody
+ ($num +
-ae 1 -uc all ; } //end, makeBall //Main procedure. global proc makeChain (int $numLinks) { makeEm ($numLinks); //comment out the following line if you don t want the //ball at the bottom of the chain. addBall ($numLinks); select -cl; select -all; displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4; //Change some elements of the rigid solver so Maya //doesn t choke on the data! showEditor rigidSolver; setAttr
rigidSolver.collisionTolerance
setAttr
rigidSolver.bounciness
}
0.0001;
0;
//end makeChain
If you got through these last three scripts, and have a good idea what s going on in them, you are ready to start making scripts of your own! Use the online reference documents, build on other people s work, and make something really useful for yourself. Even better, share it with others via a Web site (like www.highend3d.com) or an e-mail listserv.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=251332307 (9 of 9) [11/27/2000 8:48:13 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 17 - Programming with MEL Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we moved beyond the basics to discover just how powerful and complex MEL scripting can be. We worked with variables, loops, and conditional branches. We learned how to make custom GUIs for any purpose we wish. Finally, we created and examined full-blown MEL scripts. Although big scripts look complex, the secret to writing them is to build them up from small pieces, and grab chunks of code (either from the Script Editor s History window or from other Maya users scripts) and modify them for your own use. Advanced MEL scripting is not for everyone, but if you like this sort of work, and get good at MEL, chances are you can land yourself a full-time job just scripting for Maya.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=272724826 [11/27/2000 8:48:18 PM]
Books24x7 Mastering MAYA Complete 2
Part V - Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part V: Rendering Chapter List Chapter 18:
Rendering Basics
Chapter 19:
Shading and Texturing Surfaces
Chapter 20:
Lighting
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=212051828 [11/27/2000 8:48:24 PM]
Books24x7 Mastering MAYA Complete 2
Part V - Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part Overview Use the Render Globals dialog box, Render View window, and other basic rendering tools Use the Hypershade and work with Maya s texturing tools Work with Maya s lighting tools and techniques
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=663006703 [11/27/2000 8:48:27 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 18 - Rendering Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 18: Rendering Basics Overview Rendering is a many-faceted process. First, you need a proper camera through which objects can be seen and captured into 2D images. You also need to decide on the quality and resolution of the image output. Then you can select how you want the surfaces to be lit your choices include four different lights or incandescence. Next, you need to create materials and textures for the surfaces. You may also want to create an appropriate background, such as a stage set, an image plane with live footage, or an environmental texture. Alternatively, you could render the surfaces in layers with alpha channels and put them together with compositing software. This chapter deals mainly with cameras, render settings, and using Maya s IPR (Interactive Photorealistic Rendering) tool. Shading and lighting will be covered more thoroughly in the following chapters.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=307609999 [11/27/2000 8:48:30 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 18 - Rendering Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Rendering an Object As we ve done in previous chapters, we will explore the process by plowing through an example from beginning to end. To demonstrate the rendering process, we will use a beveled text letter. We will light it, texture it, and animate it appearing and disappearing against a textured background. Then we will render the animation as a video-quality picture sequence.
Setting the Camera and the Resolution First, we need to set the camera. As you ve learned in earlier chapters, cameras are windows through which you look at things in Maya s world space. The default four views that you see when you start a new scene are actually four nondeletable cameras: one camera with a perspective view and three cameras with orthographic views, which we know as the front, side, and top views. Generally, the orthographic views are used for modeling, texturing, and animation purposes, and rendering is done only through the perspective views. 1. Create a beveled text letter M (using the Surface Ø Bevel function), as we did in Chapter 6. 2. Create another perspective view by selecting Panels Ø Perspective Ø New. Persp1 camera is created. 3. In the Outliner, rename the view to Cam_1. Open its Attribute Editor and set Film Back Ø Overscan to 1.1. Open Display Options and check Display Resolution. (You can also turn on Display Resolution by selecting View Ø Camera Settings Ø Resolution Gate.) The box shows you the exact area that will be rendered. Check the Display Film Gate setting (just above Display Resolution). Note If you see another box overlapping the resolution gate, this means there is an imperfect match between the width ∞ height ratio of the pictures to be rendered and the ratio of the medium in which the pictures will be presented. 4. Go to the Film Gate setting in the Film Back section and select different mediums, such as 70mm projection, to see how the resolution ratio changes. Change the preset to 35mm TV Projection, as shown below. This setting has the proper 1.33 width x height ratio for television. The Film Gate and the Resolution Gate settings should match perfectly.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (1 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
Note You may want to render at a smaller size as a test render, but still maintain the correct (larger) aspect ratio, similar to the lock-aspect ratio feature available in Photoshop and other graphics software. Maya provides a setting for this in the Render Globals dialog box, discussed in the next section.
5. The default resolution setting is at 320x240, which you can see at the top of the resolution gate, but you probably will want to render the pictures at a higher resolution. Select Window Ø Render Globals and open the Resolution section. For our example, set the Render Resolution to 640x480. 6. Adjust the Cam_1 view, dragging and rotating the camera until you have the proper composition for the letter M. Then keyframe the Cam_1 attributes. Now you will be able to switch back to the regular Perspective window and test render the Cam_1 view as you make changes to the lighting and textures. As you saw in step 5, Maya provides many Render Resolution presets. If you are working with television and video productions, the most common resolution setting is CCIR 601, which is 720x486, Device Aspect Ratio 1.333, and Pixel Aspect Ratio 0.9. This means that the image will be 720 pixels wide and 486 pixels high, but it will be shown with a 4:3 width ∞ height ratio because the pixel aspect ratio is not square. The 640x480 resolution that we are using has Device Aspect Ratio 1.333 and Pixel Aspect Ratio 1, and it is considered the minimum broadcast-quality resolution. Broadcast Standards There are different broadcast standards in existence in different parts of the world. The PAL (Phase Alternating Line) and SECAM (Sequential Color And Memory) systems are used in Britain and in Europe. The NTSC (National Television System Committee) system is used in North and South America and many Asian countries. Unfortunately, these systems are incompatible in a number of ways. NTSC broadcasts 525 horizontal lines in a picture; PAL and SECAM broadcast 625 lines. NTSC transmits 30 fps (frames per second); the others transmit 25 fps. They also have different broadcast channel widths and types of signals. However, all of these standards broadcast pictures at a 4:3 image aspect ratio.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (2 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
We render pictures at 640x480 resolution with square pixels, or 720x486 resolution with a pixel ratio of 0.9, in order to make them fit the 4:3 aspect ratio. Device Aspect Ratio of 1.333 is another way of stating that images are being displayed at a 4:3 width ∞ height ratio. With the coming of HDTV (high-definition TV), these standards are changing. Although there still isn t a universal standard for DTV (digital TV), the accepted image ratio for HDTV is 16:9, which is the same ratio as the wide-screen format used for films. This ratio translates to 1.777 Device Aspect Ratio. The minimum resolution for the HDTV is 1280x720. For film, 2:1 and 16:9 are currently the most commonly used image ratios.
Render Globals Settings There are a few other things we need to set in the Render Globals dialog box. This dialog box offers many settings, but for now, we will set the quality, the output filename and format, and some frame rendering details. 1. Select Window Ø Render Globals and open the Anti-aliasing Quality section. Set the Presets option to Intermediate Quality. You can change this setting to Production Quality when you are ready to render, but for test renders, the Preview or Intermediate Quality settings are usually good enough. Tip For production quality or higher quality anti-aliasing presets, Maya automatically turns on the Multipixel Filtering setting. Multipixel Filtering is good for situations where you see thin surface edges. If there are no thin edges to anti-alias, it s best to have this option turned off, because it can slow down the rendering process significantly. 2. Open the Image File Output section and type in a name for the picture sequence you will be rendering in the File Name Prefix field. If you don t enter a name, the rendered pictures will automatically be assigned the scene filename. 3. Set Frame/Animation Ext to name.#.ext. The animation settings become activated. If you leave the setting at name.ext, then only the current time frame will be rendered. 4. Set End Frame to 60, because we will be rendering two seconds of animation. 5. The default Image Format is Maya IFF (iff) picture format. Change it to something more widely acceptable, like the Targa (tga) format. 6. Set the Camera to Cam_1 to make it the renderable camera. Before closing the Render Globals dialog box, check to make sure you have the settings shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (3 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
Formats such as JPEG or GIF are usually not used as image formats, because they do not carry alpha channel (mask) information, which is often needed for compositing purposes, and they compress the pixel information of the output, which may lower the picture quality. Note Regular color pictures have 24 bits of color information for each pixel, stored in three RGB (red, green, blue) channels. A picture with an alpha channel has an extra 8-bit channel, which contains the masking information for each pixel of the picture. The information is stored in the form of a grayscale picture, which often turns out to be the outline of the objects being rendered. By default, Maya renders the RGB channels and the alpha channel. You can also render the depth channel (Z-depth) by checking the Channels box. Z-depth is similar to the alpha channel in that it is represented as an 8-bit grayscale picture. As its name indicates, it stores the depth information of pixels to be rendered. As with the alpha channel, it is mainly used for compositing purposes. If the image format is the default .iff, then the Z-depth information is stored inside the image file being rendered, like other alpha channel information. If you are rendering in a format like .tga, Maya creates a separate Z-depth file for every image it renders. The Renderable Objects setting is set to Render All by default, but you can switch it to Render Active if you want, which will only render what you ve selected. Using the Render Active option is useful if you are rendering in layers. Tip In the Render Globals dialog box, you see Cam_1 as the camera available for rendering. If you want to render multiple cameras, Cam_1 and persp, for example, open the persp camera s Attribute Editor, go to the Output Settings section, and turn on Renderable. Now if you go to the Render Globals dialog box s Image File Output section and look at the Camera menu, you will see that both Cam_1 and persp are identified as Renderable.
Working in the Render View Now we will set up some spotlights and take a look at our letter in the Render View window. 1. Create a default spotlight. Select Panels Ø Look Through Selected, and move the spotLight1 view to something like (a) below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (4 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
2. Create another spotlight, and repeat the procedure to look something like (b) below. This is a very convenient and intuitive way to set lights. You do not need to fine-tune anything at this point we will be doing that with the IPR tool soon.
3. Select Window Ø Rendering Editors Ø Render View. You can open any image in the Render View window, but you can only save an image in .iff file format. Here are some of the things you can do in the Render View window: "
Keep multiple images by selecting File Ø Keep Image in Render View for each picture you want to keep.
"
Take wireframe snapshots of different cameras available for rendering, or select a region to render only that area.
"
Zoom in and out and drag the image in the Render View window by using hotkeys and mouse buttons, just as you can in a modeling view.
"
Use the options on the View menu to change the view. Frame Image shows an entire image, Frame Region focuses on just the selected region, and Real Size shows an image without any zooming. You can also see a rendered image as separate color planes, luminance, or its alpha channel (Mask Plane). Note The toolbar in the Render View window includes buttons for the most-often used functions. You can see what their functions are by placing the mouse arrow over the icons.
Using IPR (Interactive Photorealistic Rendering) The IPR tool allows you to edit colors, materials, textures, lights, and shadows interactively. When you invoke IPR, Maya creates an IPR image file that stores both the shading and the visibility information of surfaces. The file size is considerably larger than a regular image file of the same resolution because it stores the extra visibility information. Then, when a tuning region is selected, Maya loads all the IPR information for the pixels in the region into memory. You can change the tuning region at any time, and the IPR will continue to load the pixel information for the new region.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (5 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
Now we will use IPR on our letter M, but first we will get a snapshot. It s always a good idea to take snapshots before you do any rendering, because it provides a quick view of what you are about to render. Taking a snapshot also sets the camera you ve chosen as the active camera, and you can later use the Redo Previous Render and Redo Previous IPR Render icons to render the same camera view. 1. From the Options menu, turn off Auto Resize and turn on Auto Render Region. 2. Select Render Ø Snapshot Ø Cam_1. 3. Click the IPR button to start the IPR process. Once the letter M has been rendered, select a region to start IPR tuning, as shown below.
If the image is real size, the marquee box stays green. As soon as the image is zoomed in or out, the box turns red. Note that the IPR icon in the top-right corner has turned red as well, indicating that IPR is active. The indicator to the left of the icon shows how big the IPR file is. Now any change you make to the lighting or texture information relating to the letter M will be updated within the tuning region automatically. There are some neat things you can do within the selected IPR tuning region. You can Shift+click over any pixels within the region to find out which shades and lights are affecting them, and select those nodes. You also can drag materials and textures onto the objects within the region, and they will update accordingly. Any modification in the shading information is updated in the region with speeds comparable to that of a Hypershade swatch update, because the visibility calculations have already been made. (We will use the Hypershade window in the next section and examine it in detail in Chapter 19.) Having the visibility information already stored in the IPR file means that once the file is there, you can change the camera view and make changes in the surfaces without disturbing the IPR tuning region. Those changes are not recalculated until you start another IPR. While this allows you to get more mileage out of a single IPR file as you are editing lighting and shading, keep in mind that if the changes in the surfaces visibility are significant enough, the IPR updates can go out of sync with how the surfaces actually look. If this happens, you should create another IPR file.
Shading the Object
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (6 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
Next, we ll use the Hypershade window to shade the letter M. As in the Render View window, you can zoom in and out and move around in Hypershade using the hotkeys and the mouse buttons. You can also zoom in and out of the Visor panel, a render-centric file browser. This may seem a bit weird at first, but it allows you to clearly see the swatches and the labels, which is a must when working with shaders. We will go through the steps to shade and texture our current example, without much explanation of the settings. You will get a proper introduction to Hypershade in the next chapter. 1. Keep the Render View window open, and adjust the spotlights until you are fairly satisfied with the way the letter M is being lit in the tuning region. After you ve shaded the letter properly, you can come back to this view and fine tune the lighting. 2. Select Window Ø Hypershade. Zoom in to the Visor panel that appears on the left side of Hypershade. Go to the Create directory, then the Materials folder under it (open the folder if it s closed), and MM drag the blinn# material onto the Hypershade, as shown below.
3. Go down to the Texture folder in the Visor panel and MM drag the brownian# texture into the layout and over the blinn material. A list of possible input connections pops up. Connect to color, and you will see the brownian texture come up on the blinn material swatch. 4. Drag the same brownian texture over the blinn material to see the list pop up again. This time, connect to bump, as shown below. You ll see the bump effect of the brownian texture on the blinn material, along with the creation of a bump node.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (7 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
5. In Hypershade, RM choose Graph Ø Rearrange Graph to sort the nodes, then click the icon in the top-left corner to hide the Visor panel. 6. With the Hypergraph and the Render View windows close to each other, drag the blinn material onto the letter M inside the tuning region of the IPR window. Since there are two surfaces comprising the letter M, you ll need to apply the material twice. The material, along with the brownian color and bump, should update on the letter M almost immediately, as shown on the next page. Tip There are many other ways to apply the blinn material to the letter M. One way is to drag the swatch onto the object inside the modeling window. Another way is to select the object, then move the mouse over the blinn swatch and RM choose Assign Material to Selection.
7. The default bump value is too high for our purposes. RM choose over the brownian texture to open its Attribute Editor, open Color Balance, and move the Alpha Gain slider down. You should see the bump on the letter M start to lessen in the IPR tuning region. Adjust the Alpha Gain value until you like what you see. To adjust the bumpiness in a different way, you can also try playing with the increment value slider in the Brownian Attributes section.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (8 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
8. Work in the same way with brownian s Color Gain and Color Offset values to adjust the color of the texture. 9. Go to the blinn material and adjust Specular Shading by moving the Eccentricity, Specular Roll Off, and Color sliders. (Specular Shading has to do with how the light is reflected from an object.) 10. Return to the spotlights and fine tune the lighting, this time adjusting not only the angles, but also the Color, Intensity, and Dropoff values. You may also want to change the tuning region to different areas to make sure there are no hidden surprises. The updates we ve made appear as shown here. (You can also see this image in the Color Gallery.)
If you have been experimenting with the other sliders and fields, you ve seen that some of them do not affect the letter M at all and that some others should be left alone. It s very easy to play with the texture, material, and the light attributes and get immediate feedback from the IPR tuning region. One of the best things about IPR is that it frees you to experiment with the attributes and think of other possibilities there is less reason for number crunching and more room for artistic impressions. If a single image were the goal in this exercise, once you were satisfied with the way everything looks, you might increase the Anti-aliasing to Production Quality setting, then click the top-left corner icon, Redo Previous Render, to render a final image. You could then save the letter M image and convert it to another format using the Fcheck utility. But our example is for a sequence of images, which requires us to do a bit more work.
Making an Object Disappear We would like the letter M to appear and disappear against a textured background. First, we will work on the letter s appearance and disappearance. We can accomplish this by using the Transparency, Specular Color, and Set Key attributes. 1. In the blinn material Attribute Editor, slide up the Transparency value all the way to white. In the IPR region, the letter s surface disappears, but the specular highlights still remain. Notice that the alpha channel for the letter also becomes black, which you can check by clicking the Display Mask button.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (9 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
2. To make the letter M become completely invisible, you need to turn down the Specular Color slider all the way to black. At frame 5, RM choose Set Key for Transparency and Specular Color. 3. Go to frame 15, turn down the Transparency value, raise the Specular Color value, and Set Key those attributes. The letter M now appears over a ten-frame time interval. 4. Repeat the process in the opposite direction between frames 50 and 60 to make the letter disappear. Notice that as you move the current time indicator in the time slider, the IPR tuning region updates the changing transparency and the specularity. 5. Select Window Ø Animation Editors Ø Graph Editor. Here, you can see the blinn material s keyframed attributes, as shown below. (See the Color Gallery on the CD for the Graph Editor s color coding.)
6. Select all the curves and apply Tangents Ø Flat to make sure the Tranparency and Specularity attributes stay constant between frames 15 to 50. The ease-in/ease-out shape of the keyframes also ensures the smooth appearance and disappearance of the letter M.
Adding a Textured Background Our work on the letter M is done. Now let s add a background for the letter. In the Environment section of the camera s Attribute Editor, the Create button lets you create an image plane. You can set the display to show the image only through the camera or have it displayed in all views. When you are modeling, you want to be able to see the image in different views. You can hide the image temporarily by setting the Display Mode to None. You can also load any image to use as the background by clicking the browser button beside Image Name, and place it anywhere in the modeling window using the Placement and Placement Extras attributes. For our example, we will create a texture to use as the background. 1. Select Cam_1 and open its Attribute Editor. Open the Environment section and click the Create button to create an image plane. 2. Click the Create button beside the Texture field to open Create Render Node and select a solid fractal texture. 3. Since background textures do not show up in the IPR, you need to render the region to test how the solid fractal matches up with the letter M. Adjust its Color Gain, Offset, and placement attributes to get it to look the way you want something like the image shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (10 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
Tip You can select the image plane in several different ways. One way is to first select the camera, then click the arrow beside the Image Plane Create button to get to it. Another way is to go into the component mode and click the question mark icon, which enables image plane selection. A third alternative is to open the Outliner, RM choose to toggle off Show DAG Objects Only, then scroll down to select the Image Plane node.
Batch Rendering We are now ready to render. Before you save the scene, however, let s see where the rendered pictures will be placed. 1. Select File Ø Project Ø Edit Current. The Edit Project dialog box tells you the location of the current project. Go to Render File Locations section and look at the field beside Images. If this field s entry says Images, there is a default subdirectory in the current project called Images, and the rendered pictures will be placed into that directory by default. If nothing is in the field, the rendered images will be placed into the current project directory. 2. Save the scene as letter_M. You can exit Maya. 3. Open an MS-DOS Command Prompt window (if you are using SGI, open a Unix shell window). Go to the directory where you ve saved your letter M, and you will see the file listed as letter_M.mb. 4. Type Render and press Enter. All the options that you can use with the Render command are listed. 5. For our example, enter the following command: Render s 1 letter_M.mb
e 60
b 1
rd D:\Sybex\Chapter18\Renders\
n 2
The Maya Rendering program will take the file letter_M.mb, render frames 1 to 60 using two available processors, and put the rendered pictures into the directory listed in the path.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (11 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
In this example, we used the most common Render command options: -s for start frame, -e for end frame, -b for by frame or step, -rd for the directory path in which to store rendered images, and n for number of processors to use. You also could leave out the rd option, render the pictures into the default render directory, and move the pictures out of that directory later. Other options, such as mb for motion blur and sa for shutter angle, can also be handy in certain situations. For example, let s say you ve rendered a run cycle, and while checking the rendered pictures, you notice that frame 12 is looking very weird because of the motion blur. Rather than opening the file and fixing this, you can either render just that frame without the motion blur (-mb off) or reduce the motion blur by typing in a lower shutter angle value (-sa 70, for example). Once the rendering is done, you can view the rendered pictures using the Fcheck utility. Fcheck allows you to view a single image or a sequence of images, check their alpha channels, view the different color planes, and see the Z-depth information. You can also save the images into many different picture formats. (If you are working with SGI machines, you can use the imgcvt command to convert images into different formats.) Note You can reduce the time it takes to render your scenes by using some optimizing techniques. See Chapter 20 for some render optimization tips.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=151283647 (12 of 12) [11/27/2000 8:48:48 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 18 - Rendering Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Other Rendering Techniques So far, we ve gone through the process of lighting, shading, and rendering a sequence of images for a simple beveled letter M. We ve tried to keep the options as simple as we could, but rendering, by nature, is a rather complex endeavor. For the rest of this chapter, we will cover some other areas of rendering that you may find useful for your own projects.
Layer Rendering, Compositing, and Editing What we ve done with the letter M rendering is actually pretty dumb. The 60 frames of rendering were not necessary; only the first 10 frames were. In studio environments where meeting deadlines and work efficiency are always paramount, this kind of rendering redundancy would have been frowned upon, to say the least. With any editing software, or with some renaming and renumbering script commands, you can extend frame 1 forward to frame 5, reverse the animation from frames 5 to 15 to make them frames 50 to 60, and hold frame 15 until frame 49. We also should have rendered the letter M separately from the fractal textured background. Since the background remains constant, only a single frame is necessary. Using compositing software, the letter M could have been composited onto the background. In a production, the rendering pipeline is often set up to layer render anything that can be layered. Below is a partial example of how the letter M can be rendered as multiple-layered render passes. The floor has been added to illustrate the shadow passes. (You can also see this image in the Color Gallery on the CD.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=453426635 (1 of 4) [11/27/2000 8:48:54 PM]
Books24x7 Mastering MAYA Complete 2
Although not included in the sample pictures, there also should be a separate render for the floor, with the accompanying alpha channel. To create just the shadows on the floor, select the letter M surfaces, go to the Attribute Editor s Render Stats section, and turn off Primary Visibility. To create the shadow mask, color the floor black, make the lights black as well, and turn their shadow color to white. Separating these elements may seem like extra work, but it allows you more control at the compositing stage, and can ultimately save you time in terms of making changes or corrections. You can increase or decrease only the specularity or change the colors on the letter M. You can darken or lighten just the shadows, or sharpen them or blur them. If you have the proper compositing software, you can even transform and animate the different layer elements. If the render was being done in one pass, you would need to re-render the whole scene each time you wanted to make changes to any of these things. However, if you had rendered these items as separate elements, you would only need to re-render the elements you wanted to change. Whether these refinements are worth the extra effort depends on your specific production situation, but having more control at the compositing stage is usually the better way to go.
Adding Depth of Field Maya cameras also have the ability to imitate the depth-of-field functionality of real-world cameras. To be able to use it in any practical way, however, requires a bit of a setup. Open the letter_M file, select Cam_1, and open its Attribute Editor. Go to the Depth of Field section and check Depth of Field. Its attributes become active. The Focus Distance attribute does what it says it sets the distance for the camera focus. It would be useful to have a way of interactively controlling that distance in the modeling window, instead of punching in numbers. An easy way to do this is to open the Connection Editor with the Camera Shape loaded on both windows, and connect the Center of Interest output to the Focus Distance input. This constrains the focus distance to the camera s center of interest, which shows up as part of the Show Manipulator handle.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=453426635 (2 of 4) [11/27/2000 8:48:54 PM]
Books24x7 Mastering MAYA Complete 2
In the picture below (also available in the Color Gallery on the CD), the F Stop value may be a bit too low. Also, the blurring, a post effect, is expensive (meaning it takes longer to render). However, because it is a 3D blur, it adds much more realism to the rendered image than any post-effect 2D blur can. If you want more control, or just need to have the camera s center of interest and the focus distance to be separate entities, you can connect the focus distance to a locator instead.
Importing Live Footage If you want to match an animation with live footage, you need to animate the image plane. Let s assume we have ten frames of footage properly numbered and with proper extensions. In order to bring in the sequence of images, in the image plane s Attribute Editor, turn on the Use Frame Extension under the Image Plane Attributes section. Click the browse button beside the Image Name field to load the first frame of the footage. The result should look something like below.
Go to frame 1, enter 1 in the Frame Extension field, and RM choose Set Key to keyframe it. At frame 10, enter 10 into the field and keyframe that. Now when you move the time slider, the frames update. If you open the Graph Editor for the image plane, you can see a linear curve for the Frame Extension, as shown on the next page. Loading picture sequences is easy. Camera tracking the live footage, however, is a tedious and time-consuming affair usually frame-by-frame matching work. Once the tracking is done, matching up lighting and shading to the live footage is yet another grim task. But as we will see in the next chapter, using IPR can make even that an enjoyable process. Tip Maya Live, which comes bundled with Maya Unlimited (the other Maya package that Alias sells), is tracking software. That program works wonderfully and can save you days of work. If you re interested, you can search the Alias Web page for more information.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=453426635 (3 of 4) [11/27/2000 8:48:54 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=453426635 (4 of 4) [11/27/2000 8:48:54 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 18 - Rendering Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary This chapter introduced you to the many varied parts of rendering. You learned how to create and set up a camera and how to set the resolution and the format of the output in the Render Globals dialog box. We also covered the Render View window and IPR function, one of the more delightful new inclusions in Maya 2. Then we took a brief look at other topics, such as working with image planes and batch rendering. Hypershade and lighting were also introduced. These topics are covered in depth in the next two chapters.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=682508266 [11/27/2000 8:48:57 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 19 - Shading and Texturing Surfaces Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 19: Shading and Texturing Surfaces Overview Objects look different because they are made up of different materials. We can distinguish materials generally by the way that they reflect light. A metal object shines more than a wooden object. The brightest spot where the light is reflecting from an object is called the object s specular highlight. In Maya, materials are generally classified according to the way that specular light is calculated to represent them. We also identify objects by their color and texture. Maya has many default textures, such as wood, rock, leather, and so on. These allow you to quickly create easily identifiable everyday objects. In this chapter, you will learn how to use these default materials and textures to create great-looking objects. For examples, we will use the dog, living room, and child models from the previous chapters. But first, you need to learn how to use Hypershade.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=424051215 [11/27/2000 8:48:59 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 19 - Shading and Texturing Surfaces Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Hypershade Just as you can view and edit nodes and node network connections using dependency graphs in Hypergraph, you can also work with them the same way in Hypershade. Hypershade differs from Hypergraph in that it uses swatches, which give a level of visual feedback that Hypergraph lacks. For viewing and editing render nodes such as textures and materials, Hypershade is indispensable.
Working in the Hypershade Window When you select Window Ø Hypershade, you see a render-centric file browser, called the Visor panel, on the left side of the window. As you learned in Chapter 18, from the Visor panel, you can zoom in and out and MM drag the various nodes (or folders in the Rendering directory) onto the layout area on the right side of the window. The top-leftmost button in the Hypershade window opens and closes the Visor panel. The next button opens and closes the Hypershade layout area. The button with the eraser clears the view. Let s briefly go over some of the menu functions available in the Hypershade window. Then we will see how the nodes and networks work in Hypershade.
The Edit Menu On the Edit menu, the Delete Unused Nodes function deletes all the nodes that are not assigned to geometry or particles. This is a great cleanup command that you will want to invoke at the end of your session. The Duplicate command has three options. The blinn1 material with the checker texture in the picture below forms a simple network. "
Duplicate Ø Shading Network produces the blinn2 node network.
"
Duplicate Ø Without Network produces just the blinn3 node, which copies all the properties of the blinn1 material, but not the network.
"
Duplicate Ø With Connections to Network produces blinn4, which inherits the same upstream node network connections as the original blinn1 node.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=302152453 (1 of 5) [11/27/2000 8:49:03 PM]
Books24x7 Mastering MAYA Complete 2
The Convert Material to File Texture function converts a material or texture into an image file, which then replaces the original as a File Texture with UV coordinates. You can adjust the image size and turn on Anti-aliasing in the option box. The image will be placed into your current project directory. You can select material nodes, 2D or 3D textures, or projections for the conversion. If you select the Shading Group node, the light information will be baked into the image as well.
The Create Menu and Create Directory Under the Create directory in the Visor panel, you will find the following folders: "
The Camera folder contains the camera and image plane nodes.
"
The Lights folder contains the four standard light types.
"
The Materials folder contains nine material types. When you drag one of them into the layout area, a Shading Group is automatically created and linked to it.
"
The Post Process folder holds the opticalFX, which creates light effects such as glow, halo, and lens flare.
"
The Textures folder contains the 2D and 3D textures, in alphabetical order.
"
The Utilities folder contains the Color, General, Particle, and Switch subfolders.
On the Create menu, the Create Render Node command opens a window with tabs. For volumetric materials such as Env Fog, you need to use the Create menu or the Create Render Node window, because these materials are not listed in the Materials folder. Also, if you want to apply a texture as a projection or a stencil, you should use the Create Render Node window to change the setting from Normal to As Projection or As Stencil. For Users of Previous Versions of Maya The Create menu is organized the way it was in previous versions of Maya. The Create Render Node command opens the tabbed window, which, for most users of earlier Maya versions, was the primary venue for creating render nodes. The Visor panel s organization is a bit different, but the render nodes are all the same nodes. Under the Create directory, the camera and the image plane nodes are now in the Camera folder, not in the Utilities section. The opticalFX has also been moved from the Utilities section to its own Post Process folder. The material types can now be changed in the Attribute Editor, but their settings may get lost during the change.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=302152453 (2 of 5) [11/27/2000 8:49:03 PM]
Books24x7 Mastering MAYA Complete 2
The Graph Menu The Graph menu has several useful functions. The Graph Materials on Selected Objects command allows you to work with a select group of render nodes according to the surfaces you select. By moving the materials, textures, and networks that have been applied to the selected objects into the layout area, this command provides an efficient way to isolate the render nodes you want to work with in complicated scenes. The Graph Materials on Selected Objects command also is available through the Hypershade window button next to the eraser button. The Up and Downstream Connection command performs the same function as it does in Hypergraph, listing the nodes connected to the selected nodes in the layout area. The Upstream Connection and Downstream Connection commands can be useful when you know which stream you want to view and edit. They also reduce the clutter in the work area when you are working with a complex scene. The Rearrange Graph command cleans up the layout area and reorganizes the nodes for better viewing.
Other Menus The Window menu gives you access to the Attribute Editor, Attribute Spread Sheet, and Connection Editor. The Options menu s Swatches Ø Keep Fixed Size command keeps the swatch resolution to a fixed size, so that when you zoom in, the resolution doesn t update. This makes the swatches less accurate when closely zoomed in but increases their interactive speed. The Layout menu enables you to switch the layout area to viewing only Shading Groups, Materials, Textures, Utilities, Cameras, or Lights. It also creates a new layer when you bring a new node into the layout area. Subsequent nodes that are brought in stay in the same layout area so you can view their input/output relationships. Tip If you want to create a separate layer for any node, select Graph Ø Clear View and drag the node into the work area. A layer is created with the node s name. Subsequent nodes that are brought in will stay in that layer.
Working with Nodes and Networks To see how you can work with nodes, MM grab a blinn node in the Materials folder and drag it into Hypershade, then try the following: "
RM choose over the left-bottom corner. You see a list of the attributes that can be connected with incoming information, as shown in (a) below.
"
RM choose over the right-bottom corner. You see a list of the attributes that can go out to the other nodes, as in (b) below.
"
MM drag a checker texture over the blinn material. The default connection box pops up. In the example below, labeled (c), this is the triple-channel connection. If the incoming information were a single-channel connection, a different box would pop up. Also, different nodes have different channels listed for their input/output connections.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=302152453 (3 of 5) [11/27/2000 8:49:03 PM]
Books24x7 Mastering MAYA Complete 2
"
RM choose over the material node. A box pops up with a list of operations you can perform on the material node, as in (d) below. The Graph Shader Network function lists nodes that are connected to the material node. Assign Material to Selection assigns the material node to selected surfaces. Select Objects with Material selects all the surfaces that have the material node assigned to them. Frame Objects with Material selects and frames the surfaces with the material in the modeling window. You can also open the Attribute Editor for the material node or rename it.
Note You can assign different shading groups to different faces of a polygon object. For NURBS surfaces, only one shading group can be assigned to a surface. Below is an example of a fairly simple network, which includes different swatches you will soon become very familiar with. (It s also in the Color Gallery on the CD.) Working backwards, the blinn1SG (Shading Group) is getting its shading information from the blinn1 material swatch and nurbsSphere node. The blinn node is getting its color information from the checker1 node, which is also outputting its alpha channel information to a reverse node. The reverse node, true to its name, is reversing the information it s getting and is passing it on to the 2D bump node, which is connecting to the blinn s bump channel input. The leather and brownian textures connect to the checker texture s color attributes, and there are placement nodes for each of the textures: a 2D placement node for the checker texture and 3D placement nodes for the leather and brownian textures.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=302152453 (4 of 5) [11/27/2000 8:49:03 PM]
Books24x7 Mastering MAYA Complete 2
Note that everything is arranged exactly the same way as in the Hypergraph node network. Like Hypergraph, Hypershade lets you move the mouse over the lines connecting the nodes to find out exactly what attributes are being connected: "
The green lines are triple attributes, such as the RGB color information or the world space (X, Y, Z) coordinates.
"
The light-blue lines are double attributes, such as the UV coordinates of a geometry surface.
"
The dark-blue lines are single attributes, such as the 8-bit grayscale masking values of the alpha information.
To check or change these and other color designations, select Options Ø Customize UI Ø Colors and open the Hypergraph/Hypershade section. Tip MM dragging a node over another node opens the appropriate connection list. Ctrl+MM dragging a node over another one lets Maya choose the default connection automatically. If you want to use the Connection Editor to connect the two nodes, Shift+MM drag the node. You can also drag a node into another node s Attribute Editor. The nodes and networks can also be imported or exported. To bring in a scene, use the File Ø Import function or open your current project directory in the Visor panel and drag in the Maya scene you want. You can save specific nodes or node networks by selecting them and applying File Ø Export Selection. The nodes will be saved as a Maya scene.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=302152453 (5 of 5) [11/27/2000 8:49:03 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 19 - Shading and Texturing Surfaces Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Shading and Texturing Attributes Shading in Maya can be divided into the categories of color, shininess, bumpiness, transparency, and self-illumination. We will go through these global material properties first, and then proceed to cover some general texture properties.
Coloring Surfaces When you create a material and open its Attribute Editor, you can find its default Color attribute in the Common Material Attributes section. The default is set as a gray color with zero saturation and 0.5 value in HSV, or 0.5 RGB. Maya provides many ways to adjust the color of the material: "
Use the Color Chooser. To access the Color Chooser, click the color box beside the Color attribute.
"
Connect textures or file textures to the Color attribute, typically by dragging them to the Color attribute in the Attribute Editor. The Diffuse attribute acts as a scale factor to the color values, with 0.0 being black and 1.0 being the original color values. The default Diffuse setting is 0.8.
"
Map 2D textures to a surface as normal UV textures or as one of many types of projections: planar, spherical, cylindrical, ball, cubic, triplanar, concentric, or perspective.
"
Apply 2D textures as stencils image files are more often used as stencils).
"
Map 3D textures as if they were solid objects occupying space in and around the surface.
"
UV map images as file textures or project them on a surface. They can be single pictures or sequences of pictures (as you saw in the previous chapter).
"
Use Surface Shader for coloring a material node. Although it is stored in the Materials folder, a Surface Shader has the information for only the color, transparency, glow, and matte opacity of a material. When you want to use the same color for many different materials or textures, Surface Shader enables you to have one node control the color information of many nodes.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (1 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
"
Use Shading Map to color a surface. Shading Map is typically used for non-photorealistic, or cartoonish, shading effects. It takes the colors sampled by a regular shader and replaces those colors with a simpler color scheme using the brightness and hue of the original colors.
Controlling Shininess Different materials reflect light differently on their surfaces. Lambert material does not have any specular highlight. Blinn, phong, and phongE materials have different variables for calculating specular highlight. Blinn has the softest specular highlights among the three and is usually the material recommended for surfaces with bumps or displacements, because it tends to rope or flicker less than the phong materials. Blinn and phong are called isotropic materials, which means that they reflect specular light identically in all directions. New in Maya 2 is the anisotropic material, which reflects specular light differently in different directions according to its Specular Shading settings. It more faithfully adheres to the way materials such as hair, satin cloth, feathers, or CDs reflect light unevenly. Shading Map also calculates specular highlight, but in a non-photorealistic way, as mentioned in the previous section. The Use Background material s Specular and Reflectivity variables only work with raytracing. The layered shader does not have specular variables because it creates layered materials. See the Applying Textures section later in this chapter for more information about layered shaders.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (2 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
All the materials with specular highlight have Specular Color, Reflectivity, and Reflected Color attributes. You can use the Color Chooser to tint the specular color,or map textures or image files in the same way that you can with material color. In the picture labeled (a) below (also in the Chapter 19 Color Gallery on the CD), the Specular Color attribute in the sphere with the anisotropic shader has been tinted blue to match the blue color of the material. In (b), the sphere has a checker texture mapped to Specular Color. You can also do the same thing with Reflected Color, and fake reflection in this way, although true reflection only occurs with raytracing. In (c), the sphere has an Env Sky shader with the floor texture mapped to its Reflected Color. The sphere in (d) is raytraced; notice the reflection on the floor in that picture.
Raytracing Raytracing lets you create refractions and shadows through transparent objects. Although raytracing may be desirable and necessary when you want to create photorealistic images, it is also more expensive than the regular rendering. When the settings are set high, the render time can increase very dramatically.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (3 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
To raytrace, you need to turn on Raytracing under Raytracing Quality in the Render Globals dialog box. For refractions, you need to open the material Attribute Editor of the selected surface and turn on the Refractions setting in the Raytrace Options section. To have raytraced shadows, you also need to open the shadow casting light s Attribute Editor and check the Use Ray Trace Shadows setting in the Raytrace Shadow Attributes section. You also can control a surface s visibility in other surfaces reflections by turning on or off its Visible in Reflections setting, which is in the Render Stats section of its Attribute Editor.
Creating Bumpiness There are two ways to create bumpiness on a surface: "
Apply a bump map to a surface, which fools the camera into believing that there are bumps on a smooth surface.
"
Apply a displacement map, which actually moves the geometry to create the bumps.
There are advantages and disadvantages to both methods. Bump mapping is much more efficient in terms of rendering, but it fails at the edges of a surface and cannot create the appearance of extreme bumpiness. Displacement mapping does a better job of creating bumpiness because it actually displaces the geometry of the surface, but it takes longer to render. Also, often the geometry s UV spans or its tessellation count must increase significantly before you see proper displacement, as shown below.
When you drag a texture over a material node and connect to its bump map, or drag to its Bump Mapping field in the Attribute Editor, a bump map node is created. If the texture is 2D, a bump2D node is created. If the texture is 3D, a bump3D node is created. Projection bumps also will create a bump3D node. The texture s alpha value, which is a single-channel attribute, connects to the bump node s Bump Value attribute. The bump node then outputs a triple-channel outNormal to the material s normalCamera attribute, which creates the appearance of bumpiness on the material surface. When you connect a texture to a material s Displacement attribute, two nodes are created: a regular bump node that connects to the material s normalCamera and a displacement node that connects not to the material, but directly to the material s Shader Group node. Even though a displacement map actually transforms the geometry it is applied to, you still need a bump map to be applied with it to give the surface the correct bumpy look. Try deleting the bump node from a material with a displacement mapping to see the difference.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (4 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
You can also bump a bump map to add more detail to a bump mapped or displacement mapped surface. In the example below, we displacement-mapped a bulge texture to a blinn material, which we assigned to a sphere. We then created a leather texture and connected it to a 3D bump node (because leather is a 3D texture). Finally, we connected that bump node s outNormal value to the normalCamera attribute of the bulge s bump node, essentially bumping the bump node. The result is the picture of the sphere below. (It s also in the Color Gallery on the CD.)
Adding Transparency Transparency is a triple-channel color attribute, with black making the material opaque, and white making it transparent. As with color and specular attributes, you can map textures or image files for transparency, as shown below. Once a material becomes transparent, you can also turn on refraction for raytracing. The Refractive Index in the Raytrace Options section of the material s Attribute Editor controls how much the light bends as it passes through the transparent material. For the refraction to have any effect, there must be more than one layer of surface that the camera can see through. You can set up a simple example with two concentric spheres with a textured floor to test how they raytrace with different Refractive Index settings, as shown below (and in the Color Gallery on the CD).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (5 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
For true refraction to happen to even a simple thing, such as a glass cup, you need to set the Refraction Limit to at least 9. The light must go through at least four surfaces just to get to the other side, bounce back, then travel through the cup to the camera for us to see the other side of the glass cup. The Refraction Limit setting is in the Raytrace Options section of the material s Attribute Editor, and it s also listed simply as the Refractions setting in the Raytracing Quality section of the Render Globals dialog box. Both settings need to be adjusted; the lower of the two values will act as the maximum refraction limit for the material. You can also use transparency to layer different materials and textures on top of one another with a layered shader. For more information about using layered shaders, see the Face Textures section later in this chapter. A related material attribute that needs brief mentioning here is Translucence. A translucent object isn t necessarily transparent, but it does transmit light through its surface. Objects such as sheets of paper, leaves, clouds, ice, and hair are examples of translucent materials, as shown next. (This image is also in the Color Gallery on the CD.)
Adding Self-Illumination You can add self-illumination attributes to materials through Incandescence, Glow Intensity, and Ambient Color settings.
Incandescence Many materials have Incandescence under their Common Material Attributes. This attribute makes the surface with the material appear to give off light on its own. Red-hot metal and neon signs have a noticeable incandescence. Incandescence can also be used more subtly in many other surfaces. With an almost unnoticeable amount of incandescence, a person s eyes seem much brighter, and flower petals and tree leaves look much more like living things. You also can map textures or image files to Incandescence, as shown below (and in the Color Gallery on the CD).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (6 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
Glow Intensity Materials can glow as well. Incandescence usually works better when it is combined with a bit of glow. Many materials have a Glow Intensity attribute under the Special Effects section in their Attribute Editor. When Glow Intensity is at zero, no glow is calculated; when the value is nonzero, materials start to glow (as shown next and in the Color Gallery on the CD). The Hide Source setting in the same section allows you to hide the surface with the material and show just the glow. Glow can be very effective in creating certain atmospheric effects with the surfaces, like a hazy moon, a warm sunset, or candlelight, as shown below. Halo Intensity works with Glow Intensity in the shaderGlow shader Attribute Editor to control the way the surfaces will glow in a scene.
You need to be careful when using glow effects because they can get tricky. Unlike the Incandescence attribute, glow is a post process. It bases its calculations on the amount of light the surface is receiving from the light sources, including other objects that are glowing. In extreme circumstances, an object s glow intensity will visibly change when other glowing objects enter the scene. In such a situation, you need to go to the Post Process folder in the Visor panel, open shaderGlow shader s Attribute Editor, and turn off its Auto Exposure. You then need to readjust the Glow Intensity and the Halo Intensity in the Attribute Editor to get the proper glow look for the surfaces in the scene.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (7 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
Another thing to watch out for with glow effects is that their intensity can change with changes in the render resolution. This means when you are test rendering with glow effects, you need to test them with the same resolution as the final output.
Ambient Color Materials also have Ambient Color. Ambient Color is similar to Incandescence in the way it actually lights the surface, but whereas Incandescence illuminates the material, Ambient Color illuminates the material s color, or its texture. Ambient Color is also different from Diffuse in that Diffuse brightens the material color in areas where the light is hitting the surface, whereas Ambient Color lights the whole surface. You could render a surface only with Ambient Color if you wished.
Applying Textures Maya s Visor panel offers 26 textures: 9 2D textures, 11 3D textures, 5 environment textures, and a layered shader. The layered shader is included in the Textures folder because it creates layered textures as well as materials, and it can be used as a texture. With the exception of the layered shader, all the textures get a placement node when they are created. Most textures also have a Color Balance section and an Effects section.
Texture Placement 3D textures or 2D projections are placed much like real objects. You transform them in the world space, and you can shear them as well. They are more expensive to deal with in that rendering them will generally take longer than rendering 2D textures. You can convert 3D textures or projections to 2D file textures using the Edit Ø Convert Material to File Texture command in the Hypershade window, but you may lose some quality in the process. Because of the nature of 3D texture placements, when the surface with the texture deforms, the surface will seem to swim through the texture, as shown below. New in Maya 2 is a function called Reference Object, which enables the 3D textures or 2D projections to deform with the surface. After you have assigned a 3D texture to a surface, select the surface and select Shading Ø Create Texture Reference Object in the Rendering module. Maya creates a reference object, translated 5 units in the X axis by default. If you want the same 3D texture placement, either translate the reference object back to zero in the X axis or translate the 3D texture placement node 5 units in the X axis. Notice that the texture in the third plane in the graphic below is squashed and stretched with the surface.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (8 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
Note Reference objects must be created before any deformation or animation is applied to the original surfaces. A texture s placement is determined by its relationship to the reference object, not to the original surface. A place2dTexture node covers whatever surface it is assigned to exactly 100 percent. The Coverage determines the percentage of the surface area the texture covers, and Translate Frame and Rotate Frame transform the texture over the surface in UV. These attributes should not be confused with the UV Repeat, Offset, and Rotate attributes, which determine the way the texture is mapped within the coverage area. The examples below show how the various attributes affect the texture placement.
Color Balance and Effects The Color Gain and Color Offset attributes of a texture are typically used to control the color and brightness of the texture. The Default Color attribute is the color of the surface area that is not covered by the texture. Usually, you wouldn t need to change this setting. However, if you are using the texture as a mask and the texture coverage is partial, you may need to turn the Default Color attribute to black or white. The Alpha Gain attribute scales the alpha channel and is used for bump or displacement effects. The default value is at 1.0, which is usually a bit too much for most situations. Below is an example of the fractal texture, first with the default settings of gray for Default Color and 1.0 for Alpha Gain, then with Default Color turned to white and Alpha Gain turned down to 0.3 to tone down the extreme bumping. The fractal texture s Threshold value was also pushed up to 0.7.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (9 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
In the Effects section, many textures have Filter, Filter Offset, and Invert attributes. The Invert setting inverts the texture s colors and hue, changing white to black and vice versa. It also inverts the alpha channel, changing bumps into dents and vice versa. The Filter and Filter Offset attributes blur textures, and they are useful for when the textures are too sharp or are aliasing. When a texture is too sharp, you may have shimmer or noise problems with the surface when the textured surface or the camera is animated. By blurring the texture, or smoothing it, you can usually make those problems disappear. Filter s default value is 1.0, but you can lower it to something close to zero. Filter Offset basically adds a constant value to the Filter attribute, and usually a tiny fractional value is sufficient to correct any excessive sharpness. Below is the same example of the fractal texture as shown above, but with Invert turned on, Default Color set to neutral gray, and Alpha Gain moved back to the default value of 1.0. The first half-sphere has Filter set to 0.01, and it is a bit too sharp and may shimmer with a moving camera. The second half-sphere has Filter Offset set to 0.005, and the bumps have been noticeably blurred, perhaps even a bit too much. But that much blurring has made the second surface safe from any problematic shimmering.
For 3D textures, the Effects section has three extra attributes: Wrap, Local, and Blend (illustrated below and in the Color Gallery on the CD). Because a 3D texture is placed as a solid cube around an object, if the object is partially moved outside the cube, that area is colored by the Default Color attribute, as shown below. Wrap, which is on by default, enables the texture to extend to cover the whole surface. The Blend attribute mixes the Default Color to the texture color. It only works when Wrap is turned off. 3D textures are also applied globally, meaning when a texture is assigned to three surfaces, those surfaces get different parts of the texture. When Local is turned on, the textures are applied locally, so that the three surfaces get the same texture placement.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (10 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=690608486 (11 of 11) [11/27/2000 8:49:20 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 19 - Shading and Texturing Surfaces Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Shading and Texturing Techniques Now we re ready to apply some of the shading and texturing techniques discussed in this chapter. We will work with the puppy, living room, and child models that we ve developed in previous chapters.
Texturing the Puppy In Chapter 8, we constructed a dog model using many small patches. If we had to texture each piece one by one, it would be an extremely complicated (and tedious) task. One way to get around this is to apply a 3D texture and create a reference object for the dog. Here are the general steps: 1. Select all the patches of the dog, except for the eyes and the nose, and assign a blinn shader. (You could also assign a lambert or an anisotropic shader, depending on the way you want the dog s fur to shine or not shine.) Adjust the specular settings until you are satisfied with the way the material looks. 2. Assign a leather texture as the color. You need to use a 3D texture because a 2D texture will map differently to the different patches. Adjust the settings and the placement node until your dog looks something like the one shown below (and in the Color Gallery on the CD). Connect a solid fractal to blinn s Bump attribute, and make it bump very subtly, as in the picture below. The Attribute Editor values on the left are only a rough guide. You will want to use the IPR tool to fine tune the texturing.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (1 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
Tip Leather is a remarkably useful texture. It can serve as basis for a great variety of surfaces, such as spots on dog fur, human skin, grunge, plant leaves, or a field of stars, just to name a few examples. 3. When you are satisfied with the colors and the placements of the spots and their sizes, select the patches and choose Shading Ø Create Texture Reference Object. The reference duplicate of the dog is created five units away from the original dog. Translate them back to the origin, and the texture placement on the dog should be the same as before. When you re finished, test the dog s legs or head to make sure the spots move and deform with the surface.
Adding Textures to the Living Room We created the living room model in Chapter 5 and added a lamp to it in Chapter 6. Now we will add some texturing to make the floor and wall appear old, then refine the lamp with some texture and glow attributes.
The Floor and Wall Textures Let s create a worn-out floor. It takes only a few more steps to go from a clean floor with a single texture to a more complicated dirty floor, but often the results (improvements?) can be startling. 1. Start with a blinn material for the floor, and assign a marble texture to it as its color. Turn down the specular quite a bit. 2. Create a fractal texture and a brownian texture. Connect them to the Vein Color and Filler Color of the marble texture, respectively, as shown on the next page (and in the Color Gallery on the CD). You can adjust the texture settings as you see fit. You may want to also connect the same fractal texture to marble as a bump map, and turn down the Alpha Gain setting to a very subtle level. 3. For an old wall, first we need an acceptable wall pattern. Start with a blinn material and apply a checker texture as color. The placement node for the first picture shown in the next graphic has a Repeat UV of 32 and 1. Connect a cloth texture to Color1 of the checker attribute, and make its Repeat UV, 64 and 32. You should see something like the top-right picture in the next illustration, and we have our wall pattern.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (2 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
4. To create a worn-out look, you can use a handy technique called smearing. Take a brownian texture and connect its alpha channel to the Offset U and Offset V attributes of the placement node for the checker texture, as in the bottom-right picture (and in the Color Gallery on the CD). Reduce the Alpha Gain value to keep the smear effect from being too drastic. The bottom-left picture is a good example of a subtle smear.
At this point, the colors themselves are still pretty clean, but there are many ways you can make the colors dirtier. You can map the Ambient Color attribute of the blinn material, Color2 of the Checker attribute, tint the lights shining on the wall, or map their Color attributes. If you want to be able to dirty localized sections of the wall with total control, you can reassign a layer shader to the wall, make the blinn material part of the layer shader, and start adding more layers, or dirt.
The Lamp Textures
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (3 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
A simple deformed sphere has been added to the floor lamp for the lightbulb. The lamp stand, lamp shade, and lightbulb need shading and texturing. We will use a ramp texture for the lamp stand, but first we need to briefly go over what a ramp texture is. Ramp is basically layers of colors, and it is probably one of the most often used textures. By default, the ramp texture has three layers of RGB colors, which are called color entries. You can create additional color entries by LM clicking in the ramp. The circles that appear at the left side of the ramp allow you to drag the color entries, or you can type in a precise position value in the Selected Position field. The square boxes at the right side delete the color entries. As you can see in the examples below (and in the Color Gallery on the CD), you can apply the ramp along the V isoparms, U isoparms, diagonally, radially, circularly, and so on. The color entries mix according to a set Interpolation type; if you set Interpolation to None, the color entries will not mix. You also can distort the ramp with waves and noise, and you can map other textures into any of the color entries.
Now let s add texturing to the lamp. 1. Assign a blinn to the lamp stand. Add a ramp to its color. Delete one of the color entries in the ramp texture, and set Interpolation to None. Make the first color entry white and the second entry blue. Adjust the position of the blue entry until you see the white is covering only the lamp base and the blue is covering the lamp pole, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (4 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
2. Apply a fractal texture to the ramp s white color entry, and apply a wood texture to the blue color entry. You could, for added effect, apply a subtle fractal bump on the blinn material. You can use the same fractal texture for the bump mapping, because you can control its Alpha Gain value without affecting its color values. Adjust the settings until you see something like the lamp stand in (a) below. (This image is also in the Color Gallery on the CD.) A little glow was also added to the blinn. 3. We want the lamp cover to be thin and a bit transparent. Assign a blinn, then a checker texture as Color. The checker texture for this example has a Repeat UV of 16 and 32. In the blinn Attribute Editor, increase the Transparency setting a bit, as well as the Ambient Color attribute; add a tiny bit of Translucence. Glow Intensity should be fairly strong, but not so strong as to wash out the texture. Play with the values in IPR until you see something like the lamp cover in (b) below. 4. For the lightbulb, assign a blinn to the bulb, make the color dark orange, and choose a darker orange for the Incandescence setting. Raise the Glow Intensity setting and turn on Hide Source. Start an IPR process and adjust the settings until you see something like the lamp shown in (c) below.
Tip The glow on the materials will change slightly each time you introduce a new element into the scene, so don t spend too much time fine-tuning the glow until you have all the elements you want in the final render in the scene.
Texturing the Child Model Now we can turn to the varied textures needed for the child model we ve been working with throughout this book. We will apply texturing to the hair, shoes, face (mouth and eyes), and clothes.
The Hair Texture Let s start with the easiest part of the model to texture the hair. 1. Assign an anisotropic shader to hair, and connect a fractal as the color and bump. 2. Start IPR and set the fractal texture s Repeat UV to something like 32 and 0.8. Reduce its Amplitude and Alpha Gain, and darken Color Gain, until you see something like the middle picture shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (5 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
3. Go to the settings for the anisotropic material, and adjust the specular variables until you are satisfied with the way the hair is shining.
Tip If you want more photorealistic hair, try scanning real hair and using it as an image file, and instead of having one surface, put layers of strips as hair. Using this technique allows you to animate strands of hair independently of the surrounding patches.
Shoe Textures The shoes are made from simple spheres. We will need to do some fancy texturing work to make them look acceptable. 1. Assign a blinn to the shoes, and connect a ramp to the color and bump. Get rid of one of the color entries, and set Interpolation to None. 2. Start IPR and play with the position of the second color entry until it looks like (a) on the next page (and in the Color Gallery on the CD). Connect a checker texture to the bottom color entry. Set its Repeat UV to 32 and 4. Change the colors to look like the shoe in (b). 3. Add more color entries to create a lighter section in the middle of the shoe. Again, adjust the color entry positions until you see something like the shoe in (b). 4. Map another ramp to the lighter color entry in the middle, set the Type to U ramp, and set Interpolation to None. Insert color entries and set their positions to be like the shoe in (c) below. 5. Create a leather texture, change Cell Size to 5, and change the colors to something like the shoe shown in (d) below. Map the texture to the blue and yellow color entries on both the V ramp and the U ramp. You may want to perform a Convert Material to File Texture operation with the leather texture if you are concerned about the texture swimming, but that probably will not be necessary. Test to see how the texture looks as the shoe deforms.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (6 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
Face Textures For our example, we will work on the mouth and eyes. However, before we get started on the mouth, it s a good idea to create a skin shader, which we can apply to all parts of the body. Leather usually makes a decent skin. 1. Start with a blinn material, increase Eccentricity to 0.4 and decrease Specular Roll Off to 0.15. Apply a leather texture as the color. For our example, a simple leather texture is being used as skin, but you may want to map other textures into the leather Cell and Crease. (Another common technique is to map an image file specifically for specularity.) In the next graphic (and in the Color Gallery on the CD) are the settings for the leather texture used, but you should experiment with the IPR to get the exact look and feel of the skin you want.
2. Assign a layered shader to the mouth. Layered shaders function essentially to allow multiple layers of materials or textures on surfaces. A green and half-transparent layer is there by default. Change the Compositing Flag to Layer Texture. Note The default mode, the Layer Shaders mode, composites a bit differently from the Layer Texture mode, and it is usually less efficient in the way it calculates the layers being composited. The Layer Texture mode is the recommended setting for most situations. 3. Drag the skin material to the Layered Shader Attributes box, and MM drag it to the default layer s right side. The skin shader has now become a layer under the default layer.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (7 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
4. Select the default layer and assign a blinn material to it by either dragging a new blinn material to its Color attribute or by clicking the Create button beside the Color attribute to open the Create Render Node window. 5. Decrease the Eccentricity value of the blinn to about 0.15 and its Specular Roll Off setting to about 0.4. Then assign a ramp to its color and bump. Set the Type to U Ramp, and create color entries to demarcate the lip area and a subtle light-pinkish area gradually starting just below the nose and ending before the edge. The lips should be a dark-reddish color, and the areas around the mouth and the edge should be white, as in the next graphic (and in the Color Gallery on the CD). The ramp will be used as a mask as well.
6. Connect a fractal texture to the color entry for the lips. Set its Repeat UV to 1 and 64 and change its Color Gain and Color Offset values to make the fractal look like vertical strips of dark and darker magenta. The lips should look textured, as shown below. 7. Select the layered shader, select the top blinn layer, and drag the ramp to the blinn layer s Transparency attribute. The lighter parts of the ramp becomes a mask, masking out those sections of the ramp texture and revealing the skin material underneath. The lip color becomes lighter as well because it is doubling as a mask. You may want to readjust the fractal Color Gain. (This image is also in the Color Gallery on the CD.)
Note This kind of layered shader and ramp work we did for the mouth is pretty much what we would need to do to place the eye brows, which are typically image files.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (8 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
8. You can create good-looking eyes made of simple spheres and textures. In our example, however, the eyes are made of two spheres: an inner sphere for the pupil and the iris textures and an outer sphere for specularity. Start with a layered shader, create a blinn shader layer, and assign it to the inner sphere. 9. Start an IPR process, make the blinn color light gray, decrease Eccentricity to about 0.1, and set Specular Roll Off to about 0.4. 10. Create another blinn material to be the pupil layer over the first one. Make it black, decrease its Eccentricity to 0.05, and increase Specular Roll Off to 1. Then push up the Specular Color s HSV value to 2.0. This will make the pupil shine with a tight and bright highlight. Put a ramp into the transparency and softly mask the area around the pupil, as shown in (a) below (and in the Color Gallery on the CD).
11. Create two more layers for texturing the iris area. Create another blinn material over the pupil layer, and map a fractal to its color and bump. Make the fractal s Repeat UV 0.1 and 1, and increase its Alpha Gain to 2.0 to intensify the bump. Put a ramp into the layer s Transparency attribute and position the color entries so the ramp won t cover the pupil or too much of the eyeball area. It should look something like (b) above. 12. Create yet another blinn layer over the third layer. But this time, turn down its specular to zero, map a fractal just to its color, and make the fractal a bit darker. Put a ramp into its Transparency attribute so it will show up only at the edge of the iris, blending with the first fractal texture. You should see something like (c). 13. Assign a blinn to the outer sphere and make it totally transparent. Decrease Eccentricity to 0.1, increase Specular Roll Off to 1.0, and push the Specular Color value to 2.0. The outer sphere basically serves to make the eyes brighter with softer specularity, as shown in (d) above, and shows the convex shape of the eye lens.
Clothes Texturing Let s design a shirt for the child model.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (9 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
1. Assign a layer shader to the shirt and the shorts, create a blinn layer, and assign cloth to its color. Below (and in the Color Gallery on the CD) are the cloth settings and the resulting pattern. Start the IPR process and experiment to see how the patterns change as you slide the cloth attributes back and forth.
2. Create another layer on top of the cloth layer, and assign a ramp texture to the Color and Transparency attributes. Materials and textures can mix on layered shaders. Set the ramp s Type to Box Ramp and Interpolation to None. Get rid of one of the color entries. The top color entry should be white, acting as a mask, and the bottom color doesn t matter for now, because we will be mapping to it soon. Experiment with the placement node s Offset until you get a box placed on the shirt and the shorts, as shown below. (This image is also in the Color Gallery on the CD.)
3. If we assign a checker to the ramp s bottom color, we get something like the second picture in graphic above, which is fine. But let s say we want to have a different checker color for the shorts. We can use a switch utility. Instead of assigning a checker texture to the ramp s bottom color entry, open the Switch folder inside the Utilities folder in the Visor panel, drag the Triple Shading Switch node into Hypershade, and assign it to the ramp s bottom color entry.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (10 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
4. Open the Attribute Editor for the Triple Shading Switch node. You see two empty columns. The InShape column lists the surfaces being affected by the switch utility, and the InTriple column lists the triple-channel information connecting to the surfaces through the utility. Click Add Surfaces, and the shirt and short geometry names appear in the first column. Assign a checker texture to the shirt, either by dragging the checker texture from Hypershade into the appropriate row in the second column or by RM choosing over the row and opening the Create Render Node window. 5. Assign a different checker texture to the shorts, and change the color of the checker texture. The shirt and the shorts now share the same layered shader, the same ramp, but have different checker textures (as shown in the previous graphic).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=383392390 (11 of 11) [11/27/2000 8:49:38 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 19 - Shading and Texturing Surfaces Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, you learned how to use the Hypershade and work with render nodes. We also covered materials and textures, their various properties and attributes, and how to work with them in shading a dog, parts of the living room scene, and parts of the child. Shading and texturing, as we have seen working with our examples, can take the simplest objects and make them look good. But in creating these sample pictures, one essential part has been intentionally omitted from the discussion. In the next chapter, we will learn all about this other half of the equation in creating great-looking pictures. This aspect is lighting.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=781744580 [11/27/2000 8:49:41 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20 - Lighting Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 20: Lighting Overview Although this chapter follows the discussion of modeling, animation, and shading, lighting is really a circular process, and it s difficult to confine it to any one stage in the production cycle. Before you can test-render anything, whether it s a model you are building or the textures of one you ve already built, you need to set up proper lights. At the same time, if you want to control precisely how the lights shine on the objects, you would want to reserve fine-tuning your lights until all the animation is finished. We will discuss proper lighting techniques later in this chapter, and conclude with some tips on optimizing the renderer once lighting is set up, but first, let s go over the four Maya lights and their attributes.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=956341691 [11/27/2000 8:49:44 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20 - Lighting Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Types of Lights You can light surfaces using ambient light, point light, directional light, or spot light. Usually you will use a combination of different lights to get the effects you want. You can create any type of light from the menu by selecting it in the Lights menu in the Rendering module, or by dragging it from the Visor panel in the Hypershade. Below are each type s icons in the Hypershade and in the modeling window.
Ambient Light Ambient light can shine, as its name suggests, everywhere uniformly bathing all the objects in the scene from all directions. You can get similar effects from a material shader by controlling its ambient color. But ambient light can also behave as a simple point light, which shines from a specific point to different directions. These two contrasting properties of ambient light, omnidirectional and directional, can be mixed using the Ambient Shade in the Attribute Editor. When the Ambient Shade is set to 1, the Ambient light behaves exactly like a point light. Ambient light also casts shadows like point light, but only when raytraced. Below (and in the Color Gallery on the CD) you can see examples of different Ambient Shade values. The third picture is raytraced with Use Ray Trace Shadows turned on.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=932932478 (1 of 6) [11/27/2000 8:49:51 PM]
Books24x7 Mastering MAYA Complete 2
Directional, Point, and Spot Lights Directional light shines in the direction the icon arrows are pointing. It imitates light coming from a distant source, such as the sun. Point light, in contrast, shines from a specific point to all directions evenly; it is ideal for imitating a light bulb or a candle. Spot light behaves exactly like a real-world spotlight, its direction defined by a beam of light that gradually widens. Spot lights are also good for imitating headlights or lamps. Below are examples of these lights.
Ambient and directional lights do not have Decay Rate attributes, whereas Point and Spot lights do. Spot light also has Cone Angle, Penumbra Angle, and Dropoff attributes as well. We will look at these and other light properties next. Tip You can change a light from one type to another in the Attribute Editor. When you do that, however, only the attributes common to both types will be retained. Other attribute settings will be lost.
Light Properties For all types of light, you can control the basic properties of color and intensity. You can also control the linkage between lights and the objects in a scene. For point and spot lights, you can vary the intensity over distance by controlling the decay rate. Spot lights have additional properties and attributes you can control. All these controls can be accessed in the light s Attribute Editor.
Color and Intensity As with shading, you can use the Color Chooser to tint a light (usually you will want to do that subtly), or map textures, which will be projected onto the surface. When textures mask or filter certain areas of light in such a way as the second and third example pictures below, the light is called a gobo light. You can also change the intensity, or brightness of a light. Negative intensity values will actually take away light, which can be useful for creating shadow masks, as illustrated below (and in the Color Gallery on the CD). (You also need to change the floor to plain white color.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=932932478 (2 of 6) [11/27/2000 8:49:51 PM]
Books24x7 Mastering MAYA Complete 2
Tip A shadow mask is used in compositing to put shadows into a scene when objects in the scene are rendered separately. It is especially useful when computer graphic elements are being added to live footage. The shadow mask allows the compositor to blur the shadows if necessary, and adjust the HSV (hue, saturation, and value) settings of the shadow to match the shadows in the live footage. Intensity values usually stay below 1 or 2 when the Decay Rate is set to None, but they can go up much higher when Decay Rate is turned on, as you can see here (and in the Color Gallery on the CD).
You can also control the intensity value of any light by mapping textures to it, which produces results similar to mapping texture to color. Below (and in the Color Gallery on the CD) are examples of a default grid texture mapped to the Intensity attribute of different lights with default settings. Note how the grids are translated to intensity values differently for each of the four lights.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=932932478 (3 of 6) [11/27/2000 8:49:51 PM]
Books24x7 Mastering MAYA Complete 2
Note For spot light only, you can also create Intensity and Color curves to control their values with respect to distance from the light source. To create the curves, click on the Create buttons under the Light Effects section of the Attribute Editor. You can then edit the curves in the Graph Editor.
Decay Rate You can make the intensity of Point and Spot lights decay over a distance by turning on Decay Rate. There are three decay rates to choose from: Linear, where intensity decreases proportionally to distance; Quadratic, where intensity decreases proportionally to the square of distance (distance ∞ distance), which is how light intensity decays in the real world; and Cubic, where intensity decreases proportionally to the cube of distance (distance ∞ distance ∞ distance). Below (and in the Color Gallery on the CD) you can see examples of each Decay Rate. Note how the intensity value shoots up accordingly to light the sphere. You can hardly tell the differences in the sphere itself, but the differences are noticeable on the floor.
Tip The Decay Rate begins to affect a light s intensity only at distances greater than one unit from the light source. Inside the one-unit radius, no decrease of light intensity is possible.
Linking Lights and Objects When a light shines on a surface, they are said to be linked. All the lights have a setting called Illuminates by Default, which is turned on by default and makes the light shine on all objects, which means the light is linked to all the objects in the scene. If the setting is off, the light will not shine on any object unless you manually link it to that object. You can also do the opposite and cut the link between individual objects and a light, in which case the light will not shine on those individual objects. If you are working on simple scenes, you will usually leave things at default settings and let all lights shine on all objects. As soon as the scene gets fairly complex, however, you would want to start linking lights only to the objects they need to light, as linking affects rendering time significantly. Tip The default light, with the Illuminates by Default setting turned on, is also called inclusive light. When the setting is off, the light is said to be exclusive. You can link lights and objects, or sever the links, from the Lights menu in the Rendering module. Select the object(s) and light(s) in question. Select Lights Ø Make Light Links to link them, and Lights Ø Break Light Links to sever them. Another method is to use the Relationship Editor. You can either use what Maya calls a light-centric mode and link objects to a light, or use an object-centric mode and link lights to an object. Below is an example of using a light-centric Relationship Editor to link objects to lights. Of the three spheres in the first picture, the second and third spheres have been severed from pointLight1. In the second picture, the second sphere has also been severed from pointLight2.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=932932478 (4 of 6) [11/27/2000 8:49:51 PM]
Books24x7 Mastering MAYA Complete 2
Note The Lights menu also offers the Select Objects Illuminated By Light and Select Lights Illuminating Object commands. When you select a light and apply the first command all objects linked to that light are selected. When you select an object and apply the second command, all lights linked to that specific object are selected.
Spot Light Properties Unique to spot light are the Cone Angle, Penumbra Angle, and Dropoff attributes. Cone Angle controls how much the beam will spread. It is usually sufficient to leave it at the default 40 degrees. Penumbra Angle, when given a positive value, blurs the area outside the cone to make the edge soft, and when given a negative value, blurs the area inside the edge to make it soft. Here are examples of different Cone Angle and Penumbra Angle settings.
Dropoff is similar to Linear Decay Rate, but instead of decaying over a distance from the light source, it makes the intensity drop off from the center of the cone to its edge. Its results are often similar to the Penumbra Angle with a negative value. Below (and in the Color Gallery on the CD) are examples of different Dropoff values and their effects on the spot light.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=932932478 (5 of 6) [11/27/2000 8:49:51 PM]
Books24x7 Mastering MAYA Complete 2
Spot Light Effects Under the Light Effects section of the Attribute Editor two more attributes, specific to spot lights, are worth mentioning: Barn Doors and Decay Regions. They are both turned off by default. Barn Doors act just like masks, or shutters, to cover the edges of the cone from four corners. The values set the angles between the spot light s center and the barn doors. The Decay Regions option, when turned on, enables you to create three regions inside the spot light beam where the light illuminates, as well as regions where the light does not illuminate. The example of Decay Regions below (and in the Color Gallery on the CD) has light fog applied to it. (The effect is similar to a smoky nightclub. You ll learn more about fog effects later in the chapter.)
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=932932478 (6 of 6) [11/27/2000 8:49:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20 - Lighting Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Shadows The default light setting in Maya produces no shadows. This is because shadows can be very computationally expensive and, in general, you want only one or two main lights to be casting shadows. All lights can be set to produce either Depth Map Shadows or Ray Trace Shadows, with the exception of Ambient light, which can only produce Ray Trace shadows. To activate shadows, go to the Shadows section of a light s Attribute Editor, where you can check Use Depth Map Shadows in the Depth Map Shadow Attributes section, or check Use Ray Trace Shadows in the Raytrace Shadow Attributes section.
Depth Map Shadows Usually you will want to use depth map shadows, because they are much more efficient to use than ray trace shadows. When a depth map shadow is turned on, during rendering Maya creates a depth map, which stores the distance from the shadow casting light to the surfaces that the light is illuminating and uses this information to calculate shadows. The depth map, as you can see below, is a Z-depth (see Render Globals Settings in Chapter 18) image file created from the light s point of view, and it enables Maya to calculate whether one surface is behind another surface with respect to the light. In this case, areas of the floor are found to be behind the sphere and the cone, and are thus rendered as shadow. A small area of the cone is also found to be behind the sphere, and it becomes shadow.
Color
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=571322245 (1 of 5) [11/27/2000 8:49:57 PM]
Books24x7 Mastering MAYA Complete 2
The default Shadow Color setting is black, but you may want to lighten it or tint it with other colors, or even map textures to it, depending on the look you want. Mapping into color can also be a good way to fake transparency. Depth Map shadows do not recognize transparent objects; only raytraced shadows do. But for simple situations, you can often get away with clever use of Shadow Color, as in the examples below (and in the Color Gallery on the CD). In the first example, a darkened version of the marble texture was connected to the Shadow Color; in the second example, a ramp was used to create the more transparent upper area of the shadow.
Fog Shadow Intensity and Fog Shadow Samples When light fog is applied to the light, you can control the intensity and the graininess of the fog shadow as well. The darkness of the shadow is controlled by the Fog Shadow Intensity setting, and the graininess is controlled by Fog Shadow Samples. Increasing the value in the latter increases the rendering time, so keep its values as low as is acceptable.
Dmap Resolution, Filter Size, and Bias Dmap Resolution sets the size of the depth map that Maya creates. The default value is 512, which creates a square depth map file 512 pixels in width and height. If you need sharper shadows, you may need to increase the resolution, but for softer shadows, you can get good results with resolutions as low as 128, or even 64. The Dmap Filter Size blurs, or softens, the shadow edges. As with any filter, the higher the number the more expensive it gets, so keep the filter size as low as is acceptable. Below (and in the Color Gallery on the CD) are examples of various resolution and filter size settings and their effects. http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=571322245 (2 of 5) [11/27/2000 8:49:57 PM]
Books24x7 Mastering MAYA Complete 2
Dmap Bias controls how much the shadow is offset from its source. It should generally be left at its default value, except for situations where the shadow placement seems off, as in the left image below.
Disk Based Dmaps The Disk Based Dmaps feature can make rendering go much faster when used properly. The default setting is Off, which means every time Maya renders, it creates depth maps for shadow calculations. But since a depth map stores as data the distance between the light and the surfaces it illuminates, as long as those relative distances in a scene do not change, you can reuse the depth map. Even if the camera and any other element in the scene are be animated, you can still reuse the depth map. Switch the setting to Reuse Existing Dmap(s), and the extra settings become active. The default Dmap Name is depthmap, and the Dmap Light Name is checked, which means that when the depth map is saved to disk, it will be assigned the name depthmap plus the name of the light generating the depth map. For example, for a spotlight named Spot, a depth map file named depthmap_SpotShape1.SM.iff is created. The first time around, Maya looks for a depth map in the current project directories; and when it doesn t find one, it creates the depth map and places it in the current project directory, under the \depth directory. The next time Maya renders, it uses the depth map to shadow the surfaces, thus reducing rendering time. In cases where the distances between the light and its linked surfaces do change over time, if you will be rendering them more than once (as often happens with test renders) you can still create a sequence of depth maps and reuse them by checking Dmap Frame Ext.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=571322245 (3 of 5) [11/27/2000 8:49:57 PM]
Books24x7 Mastering MAYA Complete 2
The other Disk Based Dmaps setting, Overwrite Existing Dmap(s), overwrites any existing depth maps. If you have made positional changes to a light or any of its linked surfaces, you would want to overwrite the existing depth maps. Once you ve rendered and created new depth maps, change the setting to Reuse Existing Dmap(s) again.
Raytraced Shadows For many situations, you would not want to use raytraced shadows because you can get almost exactly the same quality with depth map shadows but with much more efficient render times. But when you are creating shadows for transparent objects, for example, with reflections and refractions, and photorealistic accuracy is needed, raytraced shadows are the only way to go. To use raytraced shadows, you need to turn on Use Ray Trace Shadows in the individual light s Attribute Editor, and also Raytracing in the Render Globals. When Use Ray Trace Shadows is turned on, Shadow Radius becomes active for ambient light, Light Angle for directional light, and Light Radius for point and spot lights. These different attributes all affect the softness of the shadow edges. Zero, which is the default setting, gives you sharp, hard shadow edges, and as the values go up, the edges become softer. The value range is different for different lights. As the shadow becomes softer, the edges at the default setting become grainier, as in the first picture below. The Shadow Rays setting blurs the graininess of the edges. Shadow Rays is render-intensive, so it is best to keep the values as low as you can. Tip Soft edge shadows can be much more efficiently created with depth map shadows. Raytraced shadows are more useful for creating sharp, crisp shadows. Ray Depth Limit sets the maximum number of times, minus one, that a ray of light can be reflected or refracted and still create a shadow. If the value of the Shadows attribute in the Raytracing Quality section of the Render Globals is lower than the Ray Depth Limit value, that lower value becomes the maximum limit. In the illustration shown next (and in the Color Gallery on the CD), a Ray Depth Limit of 1 isn t showing the shadow behind the transparent sphere. By contrast, a Ray Depth Limit of 3 shows it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=571322245 (4 of 5) [11/27/2000 8:49:57 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=571322245 (5 of 5) [11/27/2000 8:49:57 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20 - Lighting Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Light Effects In addition to the properties we ve looked at so far, Maya offers various special effects you can apply to lights. These include fog and various optical effects such as glow, halo, and lens flare. You can access these effects from the Light Effects section of a light s Attribute Editor.
Light Fog Light Fog can be applied to Point and Spot lights. Point light fog is spherical, whereas the spot light fog is cone shaped. When light fog is applied, a separate fog icon appears along with the light icon, which you can transform to create the size and shape of the fog you want. On the next page (top), you ll see examples of point light fog and spot light fog with different scales. The Fog Type and Fog Radius attributes are only available for point light fog. Under Fog Type, the Normal setting lets the fog intensity remain constant regardless of the distance from the light source. The Linear setting decreases the fog intensity as the distance from the light source increases, and the Exponential setting decreases the fog intensity as the distance increases exponentially. Fog Radius determines the size of the spherical volume of the fog. On the next page (bottom) are examples of point light s fog types, and different fog radius settings.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=250030408 (1 of 6) [11/27/2000 8:50:05 PM]
Books24x7 Mastering MAYA Complete 2
Fog Spread is an attribute available only for spot light fog. It functions very much like spot light s Dropoff attribute. It determines the decrease in fog intensity as distance from the center of the cone increases, as in the examples below. The decrease in intensity as the distance increases from the light source is determined by the spot light s Decay Rate setting.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=250030408 (2 of 6) [11/27/2000 8:50:05 PM]
Books24x7 Mastering MAYA Complete 2
You can go to the lightFog node and adjust the Color and Density attributes of the light fog, or combine light fog with light glow (discussed next) to produce a combination effect. When using light fog, you will often also want to map textures into the light s Color attribute to imitate smoke or bigger dust particles. The example below (and in the Color Gallery on the CD) has a solid fractal texture mapped to the color attribute of spot light and point light.
OptiF/X Maya has an optical light effects node (called OptiF/X), which can produce glow, halo, and/or lens flare effects for point light and spot light. The light effects are useful in imitating different camera filters, stars, candles, flames, or explosions. The light sources have to be inside the camera view for the light effects to show, and the effects are all post processes, meaning they are applied after all the regular rendering is done. In the Light Effects section of a spot light s Attribute Editor, click on the box next to the Light Glow section, and an opticalFX node is created. The effects turn on when the Active box is checked, and Glow Type and Halo Type are set to something other than None. For Lens Flare, you also need to check the Lens Flare box separately. Below are examples of these three light effects.
Glow and Halo Both Glow and Halo have the same list of types: Linear, Exponential, Ball, Lens Flare (which shouldn t be confused with the OpticalF/X Lens Flare effect), and Rim Halo. Below (and in the Color Gallery on the CD) are examples of the various types for glow and halo. For the glow examples, the halo type was set to None, and vice versa, but you would usually combine their effects.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=250030408 (3 of 6) [11/27/2000 8:50:05 PM]
Books24x7 Mastering MAYA Complete 2
Glow and Halo have the same color and intensity attributes as regular lights, and you can change their sizes through the Spread attribute. Halo Attributes are limited to those illustrated. Glow, however, has the additional Stars and Noise attributes. Working with glow effects can get a bit confusing because these additional attributes are scattered in different sections of the Attribute Editor, with three of them in the Optical FX Attributes section, and some of the others in the Noise Attributes section. The pictures below (and in the Color Gallery on the CD) have glow beam effects with various settings. Starting from the top left, the Star Points setting determines how many regular beams will come out of the light source. Their sharpness, or width, is determined by the Glow Star Level setting, and randomness in the beams is introduced by Glow Radial Noise. Once the Radial Noise setting becomes nonzero, you can adjust the frequency of the random beams, and their width, by using the Radial Frequency attribute. The beams can be rotated with the Rotation attribute. The two last pictures show more combinations of different possible glow settings.
Noise attributes produce a fractalized look you can use to imitate a variety of effects such as fog or explosions, as you can see next. Glow Noise produces the fractalized glow, which should always be adjusted together with Glow Intensity and Glow Spread (among other settings) to achieve the desired look. The Noise section enables you to adjust the noise threshold, its vertical and horizontal scale and placement, as illustrated below (and in the Color Gallery on the CD).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=250030408 (4 of 6) [11/27/2000 8:50:05 PM]
Books24x7 Mastering MAYA Complete 2
Lens Flare Lens Flare re-creates the effect of physical imperfections in an optical lens, which become particularly apparent as the lens is trained toward a light source. Color in Lens Flare works a bit differently from the regular color attribute in that lens flare color is a spectrum of colors, the range of which is determined by the Flare Col Spread attribute. Flare Num Circles determines how many circles (hexagons if Hexagon Flare is turned on) will show in the lens flare beam, and Flare Length determines the length of that beam. The Flare Min and Max Size attributes limit the sizes of the smallest and largest circles, and Flare Focus can blur or sharpen the flare circles. Lens Flare beam doesn t rotate but is placed in different positions with Flare Vertical and Horizontal controls. Shown next (and in the Color Gallery on the CD) are examples of lens flares with different attribute settings.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=250030408 (5 of 6) [11/27/2000 8:50:05 PM]
Books24x7 Mastering MAYA Complete 2
Tip As you ve seen, lights in Maya can have many different properties and effects to manage, and a complex scene may have numerous lights. Chapter 17 shows how to build a MEL script that creates a graphical interface window for controlling all the lights in a scene.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=250030408 (6 of 6) [11/27/2000 8:50:05 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20 - Lighting Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Lighting Techniques The art of lighting is another whole world unto itself, and studies in painting or photography will certainly be of great help. We will be able to cover only the basics in the remainder of this chapter.
The Basic Rules One of the first things to realize about digital lighting is that there must always be a proper mixture of the real and artificial. On the one hand, lighting has to be believable. If a character is in a room, for example, you need to think about what and where the light sources are. Is there a window? Sunlight or moonlight? Are there lightbulbs or fluorescent lights? You also need to create additional lights to imitate bounce lights, or reflected lights. In the pictures below (and in the Color Gallery on the CD), the light in the first one has problems because the character s face in the shadows is totally dark, even though the room is lit. The second picture is better, as it accounts for the bounce lights in a similar brightness level as the rest of the room.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=454402041 (1 of 5) [11/27/2000 8:50:09 PM]
Books24x7 Mastering MAYA Complete 2
On the other hand, lighting is always an artificial endeavor. Stages and movie sets use many artificial lights to create the best possible lighting environment, setting the proper atmosphere and making sure the characters will be lit well. This often involves cheating reality, such as flooding characters with bright blue light for a night scene when in reality the light would be much darker, or creating a strong rim light (see the picture in the next section) on a character for a close-up, when the setting doesn t have any such strong light source coming from the character s backside. Good lighting often means that the dramatic needs of storytelling will override reality. But computer lighting also has the additional burden of making the overall result look the same as if real lights had been placed in the same spots, such as making sure the shadows look proper, that bounce lights exist, or that colors don t get washed out. You also have to worry about issues like rendering time, lighting transparent objects, linking lights only to specific objects that need the lights, and so on.
Three-Point Lighting When it comes to lighting a person, there are no hard and fast rules to good lighting different light setups can serve different purposes, and experimentation is often the only sure rule. Generally speaking, however, Rembrandt lighting is considered a good starting point. It is basically light hitting a subject from an angle so as to bring out the contours of the subject, as in the first picture below (and in the Color Gallery on the CD), creating a triangle of lit area on the dark side, as can be seen in many of Rembrandt s paintings. This light is usually called a key light. In our example, Spot lights are being used; but Point lights will work just as well. Another light is then placed to shine on the dark side of the subject, as in the second picture below, usually from the side and lower in intensity. This light is called fill light, because it fills the dark shadowy parts of the surface with light. The general rule is that if the key light color is warm, the fill light color should be cool, and vice versa. The third light is usually placed at the back and shining down on the subject, creating an outline of the head and shoulders. Its intensity can vary from soft to very intense, the latter creating a glow. This light is called back light, and it s good for separating the foreground character from the background. Some people use the term rim light to describe this light as well. These three lights make up what is known as three-point lighting, a standard lighting setup in photography. As Maya does not automatically generate the bounce lights from these three lights, you may want a fourth light to act as a low intensity, second fill light shining from the front to soften the dark areas between the key light and the first fill light, as in the fourth picture below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=454402041 (2 of 5) [11/27/2000 8:50:09 PM]
Books24x7 Mastering MAYA Complete 2
Tip A good technique for placing lights is to select the light and then, in the modeling window, select Panels Ø Look Through Selected. This lets you view the scene from the light s point of view. Then, as you move and rotate in the modeling window, the light position adjusts accordingly. While three-point lighting will always give you a satisfactory setup to work with, don t fall into the trap of making it the rule for all situations. Especially with lighting, the best examples are the ones that break the rules (of course, the same can be said of the worst examples). Below are some examples of extreme lighting setups. As a general rule, you do not want the key light to be shining directly from the front, as it makes the subject look flat, but it can produce a good live video camera effect if the intensity fall off is carefully handled, as in the first picture. Hard light shining down as key light, or having two back lights as key lights, can also produce good dramatic effects, as in the second and third pictures. And there s always the I-am-the-spawn-of-hell lighting, the key light shining almost vertically up from under the subject, as in the fourth picture.
Render Optimization Tips You ve read through the rendering information in this book, and you ve set up your scene carefully. You ve put in only the lights you really need, and you ve set shadow casting for most of the lights. But your render times per frame are still through the roof! What s going on? Most likely, the problem is that the render settings have not been optimized. There are many ways to do this, and modelers have their own ideas on where to compromise quality and to what extent. However, it s possible to optimize rendering without reducing the quality of your work. Here, we present some production-tested ideas to help make your scenes renderable in your lifetime. First, and most important, you should link lights to the surfaces they will be illuminating. Linking lights causes the renderer to calculate only the rays necessary to illuminate the linked object and any shadows that are being cast by that linked object. The other objects in the scene are ignored.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=454402041 (3 of 5) [11/27/2000 8:50:09 PM]
Books24x7 Mastering MAYA Complete 2
For example, this technique might be helpful when you have a directional light illuminating your objects. If this light is also raytraced, the light will cast shadows from everything, which could take a while (to say the least). An alternative would be to create a duplicate of the directional light, exclusively link it to the objects that will not be casting shadows (don t link it to the floor, either), and make this copied light non-shadow casting. Now link the original raytraced light only to the objects that will be casting shadows (plus the floor). The result will be a faster render, with raytraced shadows for only those objects that need it. Another way to optimize this scene would be to eliminate shadow casting for the floor itself, since we will never see the shadows it casts (which fall below the floor itself). Also, lowering the tessellation of far objects will help conserve memory. Remember that a floor (unless curved) does not need to be highly tessellated! Maya has the ability to selectively raytrace objects and surfaces (parts of objects), which you should use. One of the best ways to reduce render times and give yourself more flexibility is to render in layers with alpha and depth channels. Then, if you need to make adjustments later, you only need to re-render the particular objects on a specific layer, not everything else, too. The real power comes later, during compositing, because you can tweak colors, lighting (to an extent), contrast balance, layer order, and so on. These things would take far too long to adjust and test in a full-scene render, but this isn t the case with a few intelligently rendered layers. You could render separate passes for the shadow, highlights, ambient color, reflection, and so on. Then later, in the composite, you can interactively tune these parameters to your specific needs. This takes some time to set up and initially results in longer render times. However, huge time savings can be earned when you are tuning a scene in real-time, changing the amount of reflection, highlight size, shadow color, and opacity all in a compositor, not in the renderer. An excellent example of this can be found at Jeremy Birn s Web site, http://www.3drender.com/jbirn/ea/Ant.html. (Although this rendering was done in a program other than Maya, the principle applies to any 3D application.) Here are some other render-optimization tips: " Reduce bump maps, especially on objects far enough from the camera to not be noticed. An intelligently created color map, added to the base color map of your object s texture, can suffice to simulate the bump map from a distance, and it will greatly reduce render times. " Only model what viewers will see. This is especially important if you are going to be raytracing too much geometry to raytrace (in reflections and shadows on floors) will grind your render to a halt. The other reason to do this is to reduce the time you spend modeling, so that you can have more time for rendering! Don t spend time doing amazing things backstage where the audience can t see it. " Limit your shadow map light s field of view to encompass only the objects casting shadows. This reduces the amount of computations Maya must perform and allows that savings to be applied to a larger shadow map. " Check that only your surfaces that are supposed to be reflecting are set to have some amount of reflectivity. If the shading group was created as a phong, phongE, blinn, or anisotropic shader, these surfaces might be set to the default of 50 percent reflectivity. " Selectively tune the render attributes of each object. Turn off Shadow Casting if you won t be seeing the object s shadow. Turn off Visible in Reflections or Refractions if that visibility isn t needed for the object. Turn off Motion Blur if the object doesn t move too fast (and if the camera doesn t fly past it too fast). Turn off Double Sided for enclosed objects that have no transparency.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=454402041 (4 of 5) [11/27/2000 8:50:09 PM]
Books24x7 Mastering MAYA Complete 2
" Test your render with the render diagnostics script. In the Render View window (Render Ø Render into New Window), select File Ø Render Diagnostics. This will alert you to any problems immediately, and it s always better to know about problems sooner than later. " Use environment reflection maps whenever possible. They should be a size that is divisible by 2, such as 256∞256. These maps also don t need to be very high resolution, if the pixels that are reflecting don t take up much screen space. You can create animated environment maps if those are needed, since the render times wouldn t be that long for each frame at the small resolution. You also can simulate blurred reflections, by running the frames through a blur filter in a compositing program first. " Use texture maps whenever possible, because they aren t as render-intensive as procedurals are. Procedurals don t take up as much memory as image files do, but this shouldn t make a huge difference if you keep a close eye on your texture map file sizes. Don t apply texture maps bigger than you need. This is especially true for output to television, because the color space and ultimate resolution are limited to begin with. " Render frames with motion blur and not fields whenever possible. The hit you take with motion blur will rarely exceed the hit you take with rendering another whole field (or frame if you are going to interlace them later in a compositor). " Use 2D motion blur whenever and wherever you can. It is smoother than 3D motion blur, almost as accurate (as far as the human eye can tell), and the render times are a fraction of those of 3D motion blur at the same quality level. " Last but not least, read the release notes. They can warn you of problems or slow areas of the renderer before you start pulling out your hair!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=454402041 (5 of 5) [11/27/2000 8:50:09 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 20 - Lighting Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter we have gone through the four lights available in Maya and their properties, the two ways of creating shadows, and the fog, glow, halo, and lens flare effects available for point and spot lights. We have also discussed, though briefly, how to light characters in a scene using the standard three-point lighting setup. And we ve discussed how to optimize rendering in relation to lighting and similar issues. This chapter completes the coverage of all the basic stages of producing character animation in Maya, starting from the interface in Part I, and continuing through the discussions of modeling techniques (Part II), animation (Part III), the MEL scripting language (Part IV), and rendering (Part V), of which this is the last chapter. In Part VI, we will move into advanced effects in Maya, namely particles and dynamics.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=195144764 [11/27/2000 8:50:13 PM]
Books24x7 Mastering MAYA Complete 2
Part VI - Advanced Maya Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part VI: Advanced Maya Effects Chapter List Chapter 21:
Particle Basics
Chapter 22:
Particle Rendering
Chapter 23:
Using Particle Expressions and Ramps
Chapter 24:
Dynamics of Soft Bodies
Chapter 25:
Paint Effects
Appendix:
Interviews
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=849342421 [11/27/2000 8:50:17 PM]
Books24x7 Mastering MAYA Complete 2
Part VI - Advanced Maya Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Part Overview Understand the Basics of Particle Dynamics Use the Particle Rendering Tools Use Particle Expressions and Ramps Understand the Dynamics of Soft Bodies Use the Paint Effects Tool
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=372717976 [11/27/2000 8:50:20 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 21: Particle Basics Overview This chapter introduces Maya s built-in particle dynamics engine. We will begin with elementary particle systems and work our way up to more complex simulations, including particle interaction with rigid bodies. If you have not read the chapter on rigid body dynamics (Chapter 15), you might want to do that first. Particles and rigid bodies share many underlying features, so understanding one can help with understanding the other. Although we will show you how to use particles using relatively simple examples, particles are a difficult area for most animators to grasp. Be prepared to spend some time working through the examples in this chapter and experimenting on your own.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=373667231 [11/27/2000 8:50:22 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What Are Particles? Essentially, particles are little points (like dust, or particles in the air) that you can place in your illustrations manually or have emitted by a particle emitter. Particles, like rigid bodies, are physics simulations, not animation in the traditional sense, so you cannot manipulate them directly. To control particles, you must adjust their attributes (or the attributes of their emitters) in the Channel box or Attribute Editor. Particles can be affected by collisions and fields, and they can have their attributes altered by expressions. You can render particles in many ways, including simply as points, and they can even make up collective bodies (called soft bodies). Note We will cover using collisions and fields with particles in this chapter. Expressions, render types, and soft bodies are discussed in the next chapters. Like (active) rigid bodies, particles themselves cannot be keyframed (although their parent emitter object can). If particles are not keyframable, and you need to use numbers to alter their behavior, why bother? As you will see, particles are a great way to create random or very large-scale behavior that would be nearly impossible to produce the traditional way. Items ranging from rocket exhaust, to dust, to human hair can be simulated using particles. If you need a plasma cannon or a fountain (our first two projects), particles come to the rescue. Because particles (like rigid bodies) depend solely on their attributes, you need to bring along a sense of adventure to your work with particles. The best way to get to know how to do things with particles is to play (and play and play) with the numbers in the Channel box or Attribute Editor. Oddly enough, although particle simulation is based on science, it is really an art to get the particles to do what you want.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=472156325 [11/27/2000 8:50:24 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating Particles Before we begin making things with particles, let s figure out how to create the particles themselves. There are a couple of basic ways to make particles: You can simply draw them into the scene using the Particle tool, or you can create an emitter to shoot them onto the scene. In the brief examples in the following sections, you ll try both methods.
Drawing Particles in a Scene To draw a particle into a scene, create a new scene in Maya and choose Particles Ø Particle Tool Ø from the Dynamics menu set. This brings up the Particle Options window, as shown next.
In this option box, there are settings for creating single particles, multiple particles, random particles, and particles in grids. Let s see how they work.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=351534095 (1 of 4) [11/27/2000 8:50:28 PM]
Books24x7 Mastering MAYA Complete 2
1. Leave the Particle tool s default settings and click anywhere in the scene. You should see a red cross indicating where you have just created a particle. Click a few more times to create several particles in the scene (you can rotate your view to get the particles in different places), then press the Enter key to turn this bunch of particles into a group. Particles in a group all live on the same node and will share the same fields, collisions, and render types. 2. Let s create clumps of particles instead of individual ones when we click. Delete all the particles you just created. In the Particle tool option box, set the number of particles to 10, and set the maximum radius to 5. Click in the scene. You see clumps of 10 particles created in an imaginary sphere 5 units in radius. If you continue to click, the new clumps will be part of your current particle node. If you press Enter between clicks (and then Y to return to the Particle tool), you will create a new particle node each time. Tip The easiest way to delete particles is to drag over them using the Select tool (Q on the keyboard or the arrow in the menu) and then press Delete. You can also RM choose Select All and delete them, but the particles must be unselected first.
3. Now try sketching particles in a line. Delete your particles once again. Click the Reset Tool button to return to the default Particle tool settings. Then check the Sketch Particles box. In your scene window, drag to create a line of particles. Then open the Particle tool option box and reset the Number of Particles to 10 and Max Radius to 5. Sketch in the window again. You see a kind of tube of particles, created with a radius of 5.
4. Finally, let s have Maya create a grid of particles for us. Delete the old particles and reset the Particle tool. Check Create Particle Grid (you can adjust the spacing between particles here as well, if you wish). Click once in the scene window, where the lower-left corner of the imaginary box around this grid would be, and then click again in the upper-right corner. You get a two-dimensional grid that looks something like the one shown below (and in the Color Gallery on the CD). If you would rather have a 3D box of particles, click the With Textfields radio button in Particle Options and enter the XYZ coordinates of the corners.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=351534095 (2 of 4) [11/27/2000 8:50:28 PM]
Books24x7 Mastering MAYA Complete 2
You now know how to create groups of particles by placing them with the Particle tool. The other technique for dispersing particles is through an emitter, as described in the next section. Tip To see the difference between one particle of many parts and several smaller particle groups, try selecting one particle only. If you have created one giant particle node, all the particles in the scene will be highlighted. If you created several smaller particle nodes, only those in that particle s group will be highlighted.
Emitting Particles Now let s see what a particle emitter does. 1. Clear your scene again and choose Particles Ø Create Emitter Ø.
2. In the Emitter option box, select Directional for Emitter Type. In the Emission Direction section, change DirectionX (the direction the particles will be emitted) to 1. In the Emission Speed section, increase the Speed setting to 5. Then click Create and close the option box. 3. You see a small ball in the scene window and attribute options listed in the Channel box. Play back the animation. You should see a line of dots extending out from the particle emitter, as shown below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=351534095 (3 of 4) [11/27/2000 8:50:28 PM]
Books24x7 Mastering MAYA Complete 2
Warning To play back an animation, use the VCR-like controls at the bottom-right of the screen, or use Alt+V to play (and stop) the animation. But remember that you must always rewind your animation before playing it when dynamics are involved. Because all dynamics simulations are calculated based on information from the last frame, failing to rewind (or also scrubbing through the animation) will result in bizarre playback behavior. To fix this, simply rewind and play the animation from the beginning. Use the Rewind button on the Playback bar or Alt+Shift+V to rewind the animation. 4. To see the individual particles a bit more clearly, try turning down the Rate attribute in the Channel box from its default 100 to about 10 or so. Now you should see little peas shooting off into the distance. Now that you ve tried both methods for creating particles, let s see how to use them in your projects.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=351534095 (4 of 4) [11/27/2000 8:50:28 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Working with Particles As we ve done throughout this book, we ll introduce you to the basics of particles by going through a couple of examples. In the following sections, we will build a plasma cannon and a fountain.
Making a Plasma Cannon Every good science-fiction battle game needs at least one plasma cannon. This weapon of mass destruction shoots a blast of plasma according to Webster s, a collection of charged particles & containing about equal numbers of positive ions and electrons and exhibiting some properties of a gas but differing from a gas in being a good conductor of electricity. This is not something you want to have pointed at you, but it s a good workout for Maya s particle dynamics engine. 1. If you don t have an emitter from the previous example, create one with emission DirectionX set at 1, Rate at 10, and Speed at 5. 2. To make our cannon, we re going to keyframe the emitter on and off, making the particle stream pulse, rather than emit particles continuously. With the emitter selected, set Rate to 0 in the Channel box (or Attribute Editor), and be sure you are at the first frame in the timeline. 3. With the word rate (to the left of the number field) selected in the Channel box, RM choose Key Selected to set the first key for the rate (at a rate of 0, which means emit nothing ). Move to about frame 10, and key another frame at rate 0. Tip If you set the Auto Key function on (click the button at the lower-right corner of your screen, so it turns red), Maya will automatically create the keys for you as you go after you manually create the first keyframe. 4. At frame 11, set a keyframe for the rate at 50 (or more, if you want a thicker stream). At frame 18, set another keyframe at 50. At frame 19, set a keyframe at 0 again (turning off the emitter again). 5. Rewind and play back the animation. You should see a pulse of particles move away from the emitter.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (1 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
6. To make the cannon pulse on and off, select all the keyframes you have made and copy them down the timeline several times. You should see a pulsed stream of particles, as shown below. (If you don t see the particles playing back properly, remember to set your playback speed to Free in the Animation Preferences dialog box.)
Tip To copy keyframes, Shift+select the keyframes in the time slider, then RM choose Copy. Move the time marker to another frame (like 25 in this case), and RM choose Paste. 7. Let s give these pulses a bit of spread, so they re not all lined up perfectly. With the emitter still selected, set the spread attribute to 0.05 (a spread of 0 is a straight line; a spread of 1 is everywhere in a sphere around the emitter). You may also wish to increase the rate of particle emission for your keyframes to make a thicker cloud. Now when you play back the animation, the particles should look more spread out.
8. You will notice (if your window is large enough and if your frames are set high enough) that the particles appear to go on forever. As any true science fiction fan knows, a plasma cannon creates blasts with limited lifetimes (in other words, the particles must die off after a time). To make this happen, you must select the particle shape node itself (not the emitter). Play back your animation for a few seconds, until you see particles. Now select the particles themselves.
9. With the particle shape selected, open the Attribute Editor. In the Add Dynamic Attributes section, click the Lifespan button, check Per Object, and click Add Attribute. In the Render Attributes section, you see a new lifespan attribute. Set this to 2, and play back the animation. Now the particles should die off 2 seconds after they are emitted from the emitter. 10. Although we have created a fully functional plasma cannon, let s improve it by having it emit streaks of light rather than just particle specks. Select the particles (not the emitter) and open the Attribute Editor. Near the center of the window, there is a Render Type pop-up menu that allows you to select how you want your particles rendered. Choose MultiStreak, which makes each particle into a clump of streaks instead of a single point.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (2 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
11. In the Current Render Attributes section of the Attribute Editor, click the Current Render Type button. This adds controls for new attributes associated with the MultiStreak particle type. Adjust these numbers to get a satisfactory looking streak of particles. In the example below, the settings are Line Width = 2, Multi-Count = 12, Multi-Radius = 0.165, Tail Fade = 0.5, and Tail Size = 10.5. (We also colored the particles orange, so they would stand out better, as you can see in the Color Gallery on the CD).
12. Save this project (name it plasmaCannon1.ma if you can t think of anything more original). We will use it again in the next chapter. As you saw in step 10, there are many choices for particle styles. We will use some other types in the next examples. For a full discussion of the various types, see Chapter 22, which addresses the topic of rendering particles.
Adding Motion to Particles with Fields In Chapter 15, you learned how to use fields with rigid bodies. Fields can also be used with particles; they simulate forces affecting the motion of particles. To demonstrate how this works, we will build a fountain using particles and fields. 1. Create a new scene in Maya. Create an emitter. In the Channel box or Attribute Editor, set the emitter s Rate to 500, DirectionX to 0, DirectionY to 1, Spread to 0.3, and Speed to 10. When you play back the animation, you should see something like the image on the next page.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (3 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
2. You will notice that this image lacks an important element to make it look even remotely like a fountain: gravity. To add this element, choose Fields Ø Create Gravity. Then select Window Ø Animation Editors Ø Dynamic Relationships. In the Dynamic Relationships Editor, select the emitter on the left and be sure Gravity is highlighted on the right. Now when you play back the animation, the particles will fall, as in a fountain.
Tip If you select the particles (not the emitter) before creating gravity, the two will be connected automatically. In this case, you do not need to go through the extra step of connecting them through the Dynamic Relationships Editor. 3. Add a plane across the grid. You see something like a fountain in a pool of water. To get a slightly better look for the water, change the render type of the particles to spheres (select the particles, open the Attribute Editor, and choose Spheres from the pop-up menu in the Render Attributes section of the window). Make their radii about 0.5 (so the spheres are smaller). 4. This is looking better, but everything is too smooth. To fix this, let s add a turbulence field to the fountain. Select the particles (spheres) just grab any of the particles, and all of them will be selected. Then choose Fields Ø Create Turbulence. 5. In the Channel box or Attribute Editor, set Magnitude to 10, Attenuation to 0.5, and Frequency to 60. Now when you play back the animation, the spheres should move in a more random pattern.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (4 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
In this example, we set three of the attributes for the turbulence field: "
Magnitude sets how powerful the field is.
"
Attenuation sets the falloff of the turbulence field as particles get farther from its point of origin.
"
Frequency sets how often the irregularities change.
You should experiment with the settings for these attributes and discover how changing each one affects playback.
Using Collisions to Make a Splash In the example we just finished, you probably noticed that the spheres pass right through the plane, which makes the fountain seem a bit unreal. We could use some splashing as our fountain operates. Fortunately, Maya comes to the rescue again, by providing particle collisions. Let s see how to make particles collide. 1. Move the emitter (not the particle shape node) just a bit above the surface of the plane (otherwise, the spheres will be trapped in the plane and not emit properly). 2. Now select the particles (not the emitter) and Shift+select the plane. Choose Particles Ø Make Collide. This creates a collision connection between the particles and the plane (in the Dynamic Relationships Editor, you can see and break if you wanted to this connection under the Collisions radio button). Play back the animation. The spheres should bounce off the plane now. 3. We have a collision, but we need something more interesting for our splashes. We need to create a bunch of smaller splash particles. Choose Particles Ø Particle Collision Event. As shown below, set All Collisions on, Type to Emit, Random # Particles on, Num Particles to 5, Spread to 0.5, Target Particle to particleShape2, Inherit Velocity to 0.5, and Particle Dies on. Then click the Create Event button.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (5 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
4. We now have a second group of particles, called particles2, which will emit when the first particles hit the plane (between 1 and 5 will be created for each collision). Set the second particle group s render type to sphere, and set its scale to 0.25 or so (so these particles are smaller than the spheres in group 1). Connect the gravity and turbulence fields to the second group of particles (see step 2 in the previous section). 5. When you play back the animation, you will see the second group of particles created, but they will simply fall through the plane. We need to create a collision event between these particles and the plane as well. Open the Dynamic Relationships Editor, select the second group of particles on the left, click the Collisions radio button, and highlight the plane in the right window. 6. Once you have connected the collision, go back to the Particle Collision Events dialog box and set the particle2 event (be sure particle2 is highlighted) as shown below. Most options are set as they were for the first particle group, but the number of particles will only be 3 and the Target Particles will be particle3 this time.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (6 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
7. Return to the Dynamic Relationships Editor and connect the new particles you ve just created (the particle3 group) to gravity, turbulence, and the collision with the plane. Note that here we can leave the render type as Point these are the little splashes. 8. You could continue adding collisions and new particles, but you ve probably noticed by now that playback is getting very slow because of all the calculations Maya needs to do for so many particles. Let s just make one more collision event to kill all the particles in group 3 when they collide with the plane. In the Particle Collision Events dialog box, select particle3 and check the Original Particle Dies box in the Event Actions section at the bottom. At the top of the Event Type section, turn off both Emit and Split (this makes sure no more particles are created). When you play back the animation, it should look something like the picture shown below.
9. Save this project (as fountain1.ma, or something like that). In the next chapter, we ll make the particles look a lot more like water. This example should give you a basic idea of how to create effects with particle collisions. Just keep in mind that we used multiple collisions and did the following for each collision: "
Connected the particles to the collision surface (the plane)
"
Connected the particles to our fields (gravity and turbulence)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (7 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
"
Created a collision event that either created new particles or killed the old ones
As long as you take these steps one at a time, it s really amazingly simple to create incredibly complex simulations with particles. As usual, you should play with the settings in the Particle Collision Events dialog box and watch what happens in your scene. Tips on Speeding Up Playback As became annoyingly apparent in our fountain example, playback can get really bogged down as you add elements, especially those that require calculations. You may want to increase playback speed, even if it sacrifices some degree of accuracy. The most obvious way to speed the playback of our fountain example is to change all the render types to simple points (you can change it back to whatever shape you wish just before you do a render). This will save a great deal of time, because Maya doesn t need to calculate the shapes of the particles. Short of changing particle render type, there are a few other things you can do to speed up playback. If you would like your fountain to be going full force at the beginning of the animation, play it back until it is going at full volume, stop it, and type in that frame number in the Animation Start Time text field in the far-left corner of the screen (below the time slider). When you rewind and play now, you do not need to wait to see the fountain run-up to its full-volume state. However, you do need to start your animation at that frame. To set the state of the objects at the current frame so you can rewind to the beginning of the animation and have them retain their current condition, select Solvers Ø Set for Selected (or All Dynamic). This will set the current state of the selected objects (or all dynamics objects) to be their initial values when you rewind the animation to frame 1. The one problem with this method is that you can t undo it. A better solution especially for scrubbing is to enable scene caching (Solvers Ø Scene Caching Ø Enable). It may take a while to cache the frames, but once they are cached, you can scrub back and forth in the timeline and play back the animation at much faster speeds. This solution is especially useful if there are other elements in the animation. For example, if the fountain is a background element in a character animation, not having Maya calculating the fountain s state at every frame can be a real time saver. You can also (temporarily) disable all dynamics calculations in a scene, thereby speeding up playback of other scene elements. Simply select the particle object you wish to disable and turn isDynamic off in either the Channel box or Attribute Editor. If you wish to see your spheres flowing, but don t want to wait for the slow speed of Maya s playback, you can try to adjust the tessellation factor to speed up playback. Select any particle shape, then select the GeoConnector tab in the Attribute Editor. Change the tessellation factor from its default of 200 to something low, like 10 or so, and see if it makes any difference in your playback speed.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=403022360 (8 of 8) [11/27/2000 8:50:39 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Adding Particles to Objects: Plop, Plop, Fizz, Fizz So far, we ve painted particles into the scene and used emitters to make our particles for us. Another technique is to add particle emitters to objects. When you create a stand-alone emitter, it is just a point that sprays out particles; when you add a particle emitter to an object, you can tell the emitter to emit the particles from the actual surface of the object. To examine how to do this, let s recreate an image from a famous ad for a fizzy antacid: a tablet dropping in water and then bubbling.
Creating the Objects and Bubbles We won t worry too much about our shapes right now we just want to get the feel here. 1. Create a new scene in Maya. Create a large cylinder (the water glass) and a smaller, squashed one (the tablet). For the glass and tablet cylinders, choose Create Ø Nurbs Primitives Ø Cylinder Ø. To cap the ends of the cylinder for the tablet, choose the Cap Both radio button. For the glass, select the Cap Bottom button. 2. You can make the glass bluish and the tablet white if you wish. At the least, set X-ray mode on by selecting Shading Ø Shade Options Ø Xray. (For information about texturing objects, see Chapter 19.) Your two objects should look like those shown below (and in the Color Gallery on the CD). 3. Before we add our bubbles, let s animate the tablet falling into the water. Place the tablet a distance above the glass and keyframe all translate and rotate channels. At frame 15 or so, place the tablet just where the water starts (or at the top of the glass) and keyframe all values again. At about frame 55, place the tablet near the bottom of the glass and rotate it about. Feel free to tweak this animation as much as you wish, but at least get this basic motion. (For information about how to create a keyframed animation, see Chapter 10.) Tip If you don t want to bother with this animation, you can get an already animated file (glassAnimate1.ma) on the CD that accompanies this book.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=980513326 (1 of 4) [11/27/2000 8:50:45 PM]
Books24x7 Mastering MAYA Complete 2
4. Now we ll add (instead of create) a particle emitter to the top surface of the tablet. In the Hypergraph or Outliner, be sure Show Shapes is enabled, then, from the shape nodes below the tablet shape, select the revolveTopCap2 node and choose Particles Ø Add Emitter Ø. In the option box, change the settings to a Rate of 100, a Speed of 1, a Normal Speed of 1, and a Tangent Speed of 1.3, as shown below. Then create the emitter and close the window.
5. By adding a surface emitter to the top of the cylinder, the entire surface of the top of the tablet will act as an emitter. When you make the tangent speed of the surface emitter greater than 0 (1.3 in this case), the surface will emit particles parallel to the tablet s surface, rather than just straight out from it. (Try playing with the settings in the Channel box, and watch the results.) 6. Select Spheres as the particle render type, with a scale of about 0.25 (for small bubbles).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=980513326 (2 of 4) [11/27/2000 8:50:45 PM]
Books24x7 Mastering MAYA Complete 2
Note You can add emitters to the side and bottom of the tablet as well. However, for this example, emitting from only the top surface will suffice. To add emitters to all surfaces at once, you can drag-select all the tablet s surfaces and add particle emitters to them using Particles Ø Add Emitter. 7. If you have already played back the animation, you probably noticed that the particles emit very slowly and mostly just hang around. To make them rise a bit faster (as if they were air bubbles escaping from water), we ll create a weak gravity field that actually pulls the particles up instead of down. Choose Fields Ø Create Gravity. Assign the gravity field to the bubble particles in the Dynamic Relationships Editor, and set the gravity s strength to 1 or 2 (from 9.8). Make its direction in Y +1 instead of 1 (so it pulls the particles upward).
Adjusting the Particles
Lifespan
There are a few other problems with our particles: They start emitting immediately, and they don t die! Both of these problems can be handled by keyframing either the rate or the lifespan of the particles. 1. Select the particles, go to the Attribute Editor, and choose Lifespan from the Add Dynamic Attributes section. Choose Per Object and create the new attribute. 2. Before we adjust the particles lifespan, let s make sure that we start emitting the particles after the tablet has fallen into the water. Select the emitter (not the particles), and set a keyframe on its rate to 0 at the start frame. Create another keyframe a little after the tablet enters the water and set it to 0 as well (don t have the particle begin emitting just at the frame where it enters the water the tablet needs time to begin dissolving). Then, at frame 35 or 40, set the rate to about 100, so the tablet is bubbling at full strength by then. 3. If you play back the animation now, you will see the particles begin emitting at the right time. However, they come shooting out of and around the glass! First, let s take care of those pesky bubbles that are escaping from the sides of the glass by making a collision between the glass and bubbles. Create the collision link between the particles and the glass, as described in the Using Collisions to Make a Splash section earlier in this chapter. 4. By creating a collision connection, we keep the bubbles inside the sides of the glass. However, they bubble right out of the top of the glass talk about a head on your root beer! To keep the bubbles from popping out of the glass, we need to keyframe the lifespan of the particles. Because the lifespan of the particle controls how long it lives, adjusting the lifespan will change how far the particles can rise before they disappear. Getting the lifespan keyframed just right will take a bit of doing. Try the following keyframes as a starting point: " At 19 frames, lifespan = 0 " At 20 frames, lifespan = 0.1 " At 35 frames, lifespan = 0.2 " At 50 frames, lifespan = 0.5 " At 85 frames, lifespan = 2.5
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=980513326 (3 of 4) [11/27/2000 8:50:45 PM]
Books24x7 Mastering MAYA Complete 2
Note Unless you copied everything exactly, your mileage will vary, and you ll need to adjust your keyframes to get a good result. If you get stuck, a finished version of this particle animation is available on the CD-ROM that accompanies this book, (glassFizz1.ma). 5. Save this animation (as glassfiz.ma) for use in the next two chapters. After you finish adjusting the lifespan of the bubble particles, you should have a fairly nice animation, although it s by no means perfect yet. Fear not, however; over the course of the next two chapters, we ll turn our fizzing antacid tablet into a really nice-looking sequence. For example, in Chapter 23, you will learn how to create a much more accurate individual lifespan.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=980513326 (4 of 4) [11/27/2000 8:50:45 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Colliding with Rigid Bodies You might wonder whether rigid bodies can interact with particles. Because all these objects are dynamic objects, they can interact to produce interesting and useful behavior. To examine how particles and rigid bodies interact, let s create a simple plane rigid body and turn a fire hose of particles loose on it. 1. In a new scene, make a plane, scale it out to about grid size, and rotate it 90° in the Z axis (so it stands upright). 2. Create an emitter that is directional, with a speed of about 10 and a spread of about 0.2. When you play back the animation, it should look something like the next picture. It doesn t look a lot like a hose, but it s good enough for our purposes.
Note If you just used Add Particle Emitter Ø to create the tablet particles, you probably need to go back to that option box to create the new emitter; otherwise, you ll get an error that a surface emitter cannot be created without geometry.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=261851143 (1 of 2) [11/27/2000 8:50:50 PM]
Books24x7 Mastering MAYA Complete 2
3. Make the plane a rigid body (select it and choose Bodies Ø Create Active Rigid Body). When you play back the animation, it still won t show any interaction between the plane and the particles. That s because you must also create a collision event (just as in the fountain example) before the two will interact. 4. Select both the plane and the particles (not the emitter), and choose Particles Ø Make Collide. During playback, you now see the particles ricochet off of the rigid body. This would be great, except that the rigid body isn t moving. 5. There is one last switch we need to throw before the rigid body will react to the particles. In the Channel box (with the plane selected), open the Rigid Body section and set Particle Collision on. When you play back the animation now, the plane goes shooting off with the first particle. 6. In order to reduce the motion of the plane, we need to do a few things: reduce the number of particles emitted, reduce the emitter s speed, and increase the mass of the rigid body. In the Channel box for the emitter, set the speed down to 1 or 2, and reduce the rate to 40. With the plane selected, change the mass to 1000 to make it heavier. Play back the animation, and you will see that the plane rotates but does not move away as quickly. Tip Because playback of these animations can be slow, try using playblast to see your work in real time (select Windows Ø Playblast).
As you can imagine, in addition to creating something like a fire hose, particle/rigid body collisions also can be useful for many other simulations for example, space ships reacting to fire or meteors striking buildings (the buildings being made up of many smaller rigid bodies). We will use particle collisions again in Chapter 24. Note As an exercise, try to balance a ball on a fountain of water (remember to include gravity). It s no easy task! To make things easier, try setting the initial state of the fountain after it s running at full volume.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=261851143 (2 of 2) [11/27/2000 8:50:50 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Attaching Fields to Objects As a final example of basic particles (if there is such a thing), let s take a look at attaching a field to a scene object and then have that object affect particles in the scene. Specifically, we ll make a UFO kick up some dust on the desert floor. Tip If you don t wish to build and animate this scene, just load ufoAnimate1.ma from the CD-ROM that accompanies this book. 1. In a new scene, create a cone, flip it on its side, and squash it a bit (or use any UFO model you have handy). Next, place a plane a little way beneath the UFO.
2. Animate the UFO to make a flight path across the plane. For good measure, throw in a loop and a few up-and-down moves. 3. Create a grid of particles that will be blown around by the UFO s speedy rush through the desert. Open the Particle tool option box (select Particles Ø FR Particle Tool Ø), check the Create Grid box, and set the particle spacing to 10 (adding any more particles really slows down playback later). 4. Choose the top scene view and scale out so you can see the whole plane. Click the lower-left and upper-right corners of the plane and press Enter. You should get a grid of particle points across the plane. 5. Click the Current Render Type button and set the point size to 10 (so the particles are easily visible), then move the particle grid up on the Y axis until the particles are above the plane.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=635338708 (1 of 3) [11/27/2000 8:50:54 PM]
Books24x7 Mastering MAYA Complete 2
Note If you have a very fast computer, you can increase the density of particles in your grid. Be aware, however, that very dense grids can choke Maya, so save a backup copy of the program. 6. Now we have our UFO and particles. All we need to do is make a field to help the two interact. Select the UFO, then choose Fields Ø Add Air Ø. 7. In the Add Air option box, click the Wake button, then try the settings shown below. Setting Direction X, Y, and Z to 1 enables the UFO to interact with the particles in all directions. Setting Inherit Rotation on allows the curving motion of the UFO to suck up particles. Increasing Magnitude to 10 allows the field to influence the particles, and increasing Max Distance to 10 allows the field to displace particles farther away from it. As always, try playing with these numbers to see what happens.
8. To connect the field to the particles, use the Dynamic Relationships Editor. Then play back the animation, and the dust particles should move around after the UFO. 9. To make this simulation look a bit more realistic (or at least appear as realistic as giant blocks moving around can), we need to add a gravity field and allow collisions between the particles and the plane, so they don t just fall through the plane. Select the particles, then choose Fields Ø Create Gravity. You will need to drastically reduce the effect of gravity here, so the particles float back to earth as if they were light. Try setting gravity to 2 and see what happens. 10. Select the particles, and then Shift+select the plane. Choose Particles Ø Make Collide Ø, and set resilience (or bounciness) to 0.2 and friction to 0.5. The frictional force will make the particles stop moving when they collide with the ground. If all worked well, you should see the dust whirl after the UFO as it passes by. (Also see this image in the Color Gallery on the CD.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=635338708 (2 of 3) [11/27/2000 8:50:54 PM]
Books24x7 Mastering MAYA Complete 2
Note Finding the proper settings for gravity and the collision friction and resilience took quite a bit of tweaking. Try experimenting with the numbers and see what happens (remember to save a clean version of the project first). 11. Save your project (as UFO1.ma) for more work in the next chapter. If you notice that the particles initially bounce off the desert floor and then settle, you may wish to set the initial condition for the particles to be after they have come to rest on the plane. First, turn off the air field (set its magnitude to 0), then run the animation until the particles have settled onto the plane. Then choose Solvers Ø Initial State Ø Set For All Selected. If you want to get a better look for the dust, try setting the render type to MultiStreak, increasing the number of particles (the Multi Count), and increasing the Multi Radius. The neat thing about streaks is that they only exist when they are in motion, which means that they disappear back into the desert when they collide with the floor. This can make for a much nicer animation, although it s a bit hard to see (this effect is too subtle to be seen as reproduced in print; to see the flying dust in action, check out 22UFO.mov on the accompanying CD-ROM). Note As an exercise, try making a jet trail of particles for your UFO. Will it be affected by wind and gravity? How fast will it go? Will it be constant or pulsing? With particles, it is often very useful initially to create sparsely packed particles that are big and blocky. This saves a great deal of time in setting up an animation. When you are ready to render the particles, simply increase the particle density and make them look more presentable.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=635338708 (3 of 3) [11/27/2000 8:50:54 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 21 - Particle Basics Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we worked with particle dynamics, getting to know how to create and emit particles. You learned how to change the look and lifespan of particles, how to get them to interact with fields, how to get them to collide with objects either standard objects or rigid bodies and finally, how to attach fields to objects that then affect particles. At this point, you know most of the basic elements of creating and using particles in your work. Over the next two chapters, we will take the work we started here (plus some other examples) and learn the intricacies of rendering them, as well as how to add expressions to them. So save your work and get ready to go it just gets better from here!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=614591705 [11/27/2000 8:50:57 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 22 - Particle Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 22: Particle Rendering Overview This chapter will continue work we started in the previous chapter. We will examine different particle types and how they render; specifically, we will look at how hardware rendering and software rendering differ. We will also discuss situations in which different rendering types are appropriate. Because of the special nature of hardware-rendered particles, this chapter will also touch on compositing techniques, although that discussion will be limited. If you have not read the previous chapter on particle basics, you should be familiar with creating and using particles in a variety of situations before proceeding with this chapter. If you are not familiar with basic rendering techniques using Maya, you should first read Chapter 18. One thing to keep in mind throughout this chapter is that rendering is truly in the eye of the beholder. You should always tweak your materials until you get a rendering you are satisfied with even if it is quite different than our suggested material. What pleases our collective eye may not please yours, and vice versa. When you work in Maya s workspace, you use your computer s built-in graphics card, which supports flat shading in real time. But when you tell Maya to render into a new window (Render Ø Render into New Window) or to batch render (Render Ø Batch Render), you are launching a separate module of the program that will render shadows, reflections, and refractions, and will generally produce a smoother, more realistic image all at the cost of often-lengthy rendering times. In general terms, unless you are a game producer, you work in Maya s workspace (hardware rendering) and then produce your final images in the rendering module of the program (software rendering). In the preceding chapter, we examined how to create particles; this chapter will take particles to the next step of creating images that are suitable as final products.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=824563776 (1 of 2) [11/27/2000 8:51:00 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 22 - Particle Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
And in This Corner: Hardware vs. Software Rendering If you have not previously used Maya or Power Animator particles, you will discover that one of the most confusing aspects of Maya s implementation of particles is the issue of hardware rendering versus software rendering. You may have previously noticed that in the Attribute Editor for a particle shape, in the Render Attributes section, you can set Particle Render Type to Blobby Surface (s/w), Cloud (s/w), or Tube (s/w). The s/w indicates that the corresponding particles are software rendered, while the other particle types (like Point and MultiStreak) are hardware rendered. But what does it mean that some particles are hardware rendered and some are software rendered? Isn t all rendering part hardware and part software? While these questions may indeed seem confusing, take comfort because there is a reasonably simple explanation. Software rendering is the type of final rendering you are already familiar with (i.e., rendering with the full power of Maya s rendering module); hardware rendering may be less familiar: it uses the power of your computer s graphics card to create flat-shaded images of your particles quickly. The main problem with understanding hardware rendering is its name, because you don t use only hardware to render the particles; you use a combination of Maya s (and the graphics card s) software and the processing power of your graphics card to create the images. Perhaps it s easier to think of this type of rendering as hybrid rendering. It s a bit of a cross between the default shading you see in your workspace and the images Maya s batch-rendering module produces. To hardware render, Maya first creates a flat, shaded image of your particles (taking into account your preferences for rendering), and then it actually performs a screen capture to grab the image it just created. Because of this nifty trick, hardware-rendered particles can often be rendered in near-real time, whereas software-rendered particles can take a very long time to render. Warning Because hardware rendering uses a type of screen capture to create its images, you must not allow anything to come in front of the render window (including a screen saver). Be sure not to move any windows in front of the render window, and also be sure to turn off your screen saver if you are about to start a potentially long rendering.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (1 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
The primary difficulty with hardware rendering is that you need to know and use a compositing program (like Alias|Wavefront s own Composer for IRIX, or Fusion or AfterEffects for Windows NT) to combine software and hardware renderings. This, however, can be a big advantage once you understand the technique, because you can control how your particles look independently from the way the rest of the scene looks. Compositing is such an effective and time-saving way of working with 3D animation that we often also render our software particles separately from our scenes. We will discuss some basic compositing techniques later in this chapter (see Hardware Rendering and Compositing ) to give you some insight into how powerful this technique can be.
Hardware Rendering Let s now take a closer look at hardware rendering, using as an example the handy plasma cannon that you created in the last chapter. Tip If you don t have a finished copy of this project from the last chapter, you can use the one on the CD-ROM that accompanies this book instead: plasma1.ma. Open your saved project (or the one included on the CD-ROM), and play the animation until reaching a frame where you can see some of the particles. Now open the hardware rendering window by going to Window Ø Rendering Editors Ø Hardware Render Buffer. The Hardware Render Buffer window, showing the current frame from the workspace, will load, and you will have several menu options to choose from. The Render menu has options for test and final renderings; the Cameras menu lets you render from any camera in the scene (including an orthographic camera); and the Flipbooks menu allows you to choose or clear any flipbooks you create. Note A flipbook is just Maya s term for a hardware-rendered sequence of images that are created in the projectName\images directory by default. Remember to set your project directory before you begin rendering images or you won t know where your images are going. Give the hardware renderer a whirl: select Render Ø Test Render, and you should see your particles (probably in default gray) against a black background. Now let s adjust the render attributes for the hardware render buffer. Select Render Ø Attributes; the Attribute Editor will open, and you will have several options for modifying your rendering. For now, we will only look at the first section of the Attribute Editor: Image Output Files. Here, just as in the Render Globals window for software rendering, you can set filename, extension numbering (including the number of zeros in the name), start and end frame, image file type, and resolution. You can also set your alpha channel information here; you can choose None (for no alpha channel), Hardware Alpha, Luminance, or any of the RGB channels. For now, you can leave Alpha Source set to Off (the default), but be sure to turn it on (that is, use one of the other settings such as Hardware Alpha or Luminance) for final renderings that you wish to composite later.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (2 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Alpha Channels An alpha channel (also known as a mask or matte channel or layer) is an outline of the rendered elements of your scene. Everything inside the outline is visible in the final image, whereas everything outside the outline is invisible (there are also semi-transparent parts at the edges of the outline, which partially show those pixels). You can think of an alpha channel as a cookie cutter that slices out the rendered pixels of an image, allowing you to place the cut image on top of another image in a compositing program. You can learn more about alpha channels in your compositing program s documentation. If you can, use Hardware Alpha for your renderings. In the Hardware Render Buffer window (Window Ø Rendering Editors Ø Hardware Render Buffer), select Render Ø Attributes and set Alpha Source to Hardware Alpha. If your graphics card doesn t support Hardware Alpha, you will see an error message in the feedback line when you try to select this option. In these cases, you will generally want to set Alpha Source to Luminance to create your alpha channel. Note You can also write the Z depth (or distance from camera) into your images. You can use this information to help you composite images, but the method is complex and beyond the scope of this book. See your compositing program s user manual for information about whether it supports Z depth compositing and how this technique works. Be sure to set your start and end frames to the start and end frames of your animation, give your rendering a filename, and then choose Render Ø Render Sequence from the Hardware Render Buffer window. In the window, you will see your particle animation run, and when the sequence is finished rendering, you can play back your animation in a separate (Fcheck) window by choosing Flipbooks from the Hardware Render Buffer window and then selecting your animation name. (See Chapter 18 for a quick look at the Fcheck utility.) Tip If you wish to stop the hardware rendering before it is complete, simply press the Esc key on your keyboard. Upon watching the animation, you might discover that the particles are the wrong color or that they are moving too slowly or too quickly. To remedy these problems, tweak your animation for speed, tail size, and color. When the particles are moving too slowly, select the emitter, and change the speed to something like 20 instead of 5. To compensate for the resulting longer tails, change the particle s tail size to a bit shorter length by selecting the particles, changing to the Attribute Editor, and setting the tail length to 2 or so. So far, so good; the particles should now have a bit more zip to them. You can try re-rendering in the hardware buffer for verification, and, of course, tweak it some more if you are not happy with the results. With speed and tail size under control, you can now modify the color. Make sure the particles are still selected. In the Add Dynamic Attributes section of the Attribute Editor for the particle shape, click the Color button and add a per-object color. Once you have added particle color attributes, they will be listed in the Render Attributes section. For this example, you will see Color Red, Color Green, and Color Blue listed along with the other attributes that pertain to the currently selected Particle Render Type. Try changing the color boxes (Red/Green/Blue) to suit your tastes. (For example, we liked a fiery orange, with values of 0.9, 0.2, 0.1, respectively. You can find this image in the Color Gallery on the CD.) Then you can re-render the sequence to see if you like what you have done.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (3 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you keep your image sequence name the same, Maya will write over your last sequence for you, saving disk space. If you wish to keep a sequence for later use, rename your rendering something else in the Attribute Editor. You may have noticed that you did not need a light in the scene. If you do not have any lights, Maya provides a default light for you to light the particles. Of course, you may prefer to use your own. From the Hardware Render Buffer window, select Render Ø Attributes. In the Attribute Editor s Render Modes section, you can set Lighting Mode to Default Light, All Lights, or Selected Lights. Feel free to play with some lighting setups and see how or whether they affect the plasma cannon s appearance. (You may find that it makes no difference what lights are used with a particular particle or streak rendering type.) Save this project for use in the next chapter.
Hardware Rendering and Compositing Now that you have a good feeling for the basics of hardware rendering, let s create an example where we can composite the particles on top of a software-rendered scene. Open your UFO project from the previous chapter, and add a few lights to light the scene (if you didn t do this before). Tip If you didn t complete or save the UFO project in the preceding chapter, use UFOParticles.ma on the CD-ROM. You then need to open the hardware render buffer by going to Window Ø Rendering Editors Ø Hardware Render Buffer. Specify a filename for the image sequence in the Attribute Editor, set your beginning and ending frames, and run a test sequence. You will get an image sequence that essentially looks like a cleaner playblast rendering. (If your geometry is not included in the rendering, the Geometry Mask box is probably checked.) In this situation, however, it is best to have a software rendering of the geometry (the plane and UFO) rather than a hardware rendering of the entire scene. In order to do this, you will have to render out two individual sequences for the animation a hardware rendering of the particles and a software rendering of the rest of the scene and then composite them.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (4 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you do not have a compositing software package, you can still follow along until the last step. With the Attribute Editor still open and set to the default hardware render globals, go to the Image Output Files section. Set your alpha channel (Alpha Source) to either Hardware Alpha (if your graphics card supports this) or Luminance. In order to mask out the geometry (so you can use a software rendering for it), in the Render Modes section, check the Geometry Mask box. When you now render the sequence in the render buffer, the geometry will no longer appear; only the particles will appear. Note Although it is not obvious in this sequence, the geometry will still mask the particles, even though it does not appear in the rendering. If, for example, the particles pass behind an object in the scene, they will be blocked out and not rendered. This feature is very useful for later compositing. One thing you may have noticed previously in testing particle and streak rendering types is that the particles and streaks are very sharply defined. For our desert dust being blown around by the UFO, it would be better to have a slightly more diffuse look to the particles. Fortunately, Maya has two features that can help here: multi-pass rendering and motion blur. When Maya does multi-pass rendering, it renders out a number of frames in between the frames of the animation, based on the number you select. If, for example, you select 3, the render buffer will render three in-between images for each frame and then average them together. This makes for a much smoother and subtler particle rendering, but it also takes much longer to render (three times as long for three rendering passes, five times as long for five, and so on). Motion blur simulates the period of time a camera shutter is open during a picture s exposure, producing a blurring in quickly moving objects. The larger the Motion Blur number (between 0 and 1), the more blur there will be. It is often useful to keep this number small when rendering and then add a bit more blur when compositing. To try out these options, go to the Multi-Pass Render Options section of the Attribute Editor, and check the Multi-Pass Rendering checkbox. Below it, a pop-up menu with a number (3, by default) will be enabled, allowing you to select how many Render Passes to make for each frame. Choose a fairly low number here (like 5) and also add a bit of motion blur (like 0.1 or 0.2). Now when you do a test render, you may find the dust to be too subtle an effect (i.e., it is very difficult to see). You can adjust the number of passes, the color of the dust, the transparency of the dust, or the motion blur to make the dust stand out more, or you can make the particles highly visible and make the final adjustments in your compositing package a much faster and more versatile method of tweaking your rendering. We often find we have to rework our renderings to make them a bit bolder in their rendered look to provide more choices when it comes time to composite, as one can easily reduce the visibility of a layer in a compositing package, but it is extremely difficult to make a layer more visible. When your test renders look good, select Render Ø Render Sequence to render out an image sequence to your images folder. You can then import these images into your compositing package and combine them with your software-rendered sequence (see below). Once your hardware render sequence is finished, you need to render your geometry out in a separate, software rendered image sequence. Open the Render Globals window (for software renderings), set your start/end frames, set your Image Format [Maya IFF (iff) is the default] to be the same as your particle rendered sequence, and then batch render the sequence. Warning Do not give your geometry render sequence the same name as your particle render sequence (e.g., UFORender), or else your geometry render will erase the particle render image sequence.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (5 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Note If you are not comfortable with software rendering, see Chapter 18, or read further in this chapter for more on software rendering. Once you have your hardware and software render sequences, import them into your compositing package, but be sure to place the particle layer (with its alpha channel) as the top layer of your composition. Then, with the compositing package, you can adjust the brightness, opacity, or transform mode of the particles (and geometry) to get a high-quality final product. Save this project (as UFOParticles, perhaps) for use in the next chapter. Note For a finished example of this UFO sequence, see 22UFO.mov on the CD-ROM. (For visibility s sake, the dust has been somewhat exaggerated.)
Hardware Rendering and Compositing, Take Two Before we leave hardware rendering and compositing, let s quickly revisit our antacid tablet project from the last chapter; the techniques we ve just discussed will allow us to create much more subtle, realistic bubbles for our tablet. Open your saved file from that project, or, if you don t have a saved version of this project, use the glassFizz1.ma file on the accompanying CD-ROM. If you recall, we used the sphere rendering type for our bubble particles. The sphere type, because it s hardware rendered, doesn t support transparency, but we can make the bubbles transparent in the compositing package since they are being rendered separately. We will render all three elements (glass, tablet, and bubbles) separately and then composite the bubbles with a still shot of the glass (a nifty, time-saving trick) plus the animated tablet. Tip Instead of the sphere rendering type, you can also use the cloud (software) rendering type. If you wish, you can experiment with this rendering type to see how it compares with the sphere type. Rendering the glass, tablet, and bubbles is a bit more complex than the UFO project because the glass is supposed to be semi-transparent; thus, using the geometry mask will not work. Fortunately, there is only one extra step to this process to make it work properly: hiding geometry selectively. Before doing that, let s first perform a little trick to save some time in the rendering process. Rewind to the first frame of the animation, select the tablet, and choose Display Ø Hide Ø Hide Selection (this hides the tablet). You should next change your render globals to whatever you intend to use for your tablet rendering. For example, in the Resolution section, set Render Resolution to 320 ∞ 240 (the default), in the Anti-aliasing Quality section set Edge Anti-aliasing to Medium Quality, and in the Motion Blur section, turn Motion Blur on. Then set your start and end render frames to 1. Now batch render the sequence (actually just one frame), naming it something like glass. By rendering only one frame with the glass (which doesn t move during the animation, and which takes quite a while to render), we can save a great deal of time and disk space when we need to composite the elements of the tablet sequence. Note If you are unfamiliar with the method for creating software renderings, see Chapter 18, or study the software rendering section later in this chapter.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (6 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Now we can take up the process of hiding geometry selectively. Reopen the Render Globals window, and leave everything the same except for the end frame, which you should set to the final frame in your animation. Close this window, select Display Ø Show Ø Show Last Hidden to make your tablet visible again, and then highlight and hide the glass by selecting the glass and choosing Display Ø Hide Ø Hide Selection. With only the tablet now showing, batch render the complete animation, calling it something like tablet. You now have your software-rendered sequences, and it s time for the bubbles. From the Hardware Render Buffer window, select Render Ø Attributes. In the Image Output Files section, set Alpha Source to Hardware Alpha (if your computer supports it) or Luminance, and name the sequence something like bubbles. In the Multi-Pass Render Options section, turn Multi-Pass Rendering on (creating a multi-pass rendering will smooth out the bubbles just a bit),be sure Geometry Mash is on, and render the sequence. Once the rendering is finished, import all three pieces of your project (glass, bubbles, and tablet) into your compositing package. Here, you have many options for combining your pieces. We chose to place two copies of the glass into our composition one on top (set to low opacity and with some color adjustments) and one on the bottom (the more visible version of the glass). We then sandwiched the bubbles and the tablet between the glasses, with the bubbles above the tablet to allow them to be visible. The bubbles opacity (or visibility) can be reduced to make them less solid looking. You can also create an opacity ramp for the bubbles so that they fade out as they rise through the water. A finished version of the animation is available as the 22glass.mov file on the CD-ROM, and you can see a still image from it in the color section of this book. In combining Maya with your compositing package, you will surely encounter a number of problems both artistic and technical. While it is very difficult in the context of this book to be specific about compositing Maya renderings (as there are a number of different software packages out there that perform this function, and all of them work a little differently), there are a few rules of thumb we can lay out here: "
Test single frames of your animation in your compositing package early. This way, you only have to render one frame for each composition layer to test whether the composition will work, saving you time in renderings.
"
Always use alpha channels, even for those layers you don t expect to need them for. It s better to be prepared than to have to re-render.
"
Render particles to be highly visible in Maya rather than going for the subtler look you intend to get in the end. Having more data (visibility) to work with can only help in the end, and it s very easy to blur or reduce the opacity of particles in your compositing package as a last step.
"
Never alter your render camera once you ve started final renders! If you move the camera between renderings, your particles and geometry will not match up and things will look very bad. It is often a good idea to create a separate camera (not the default perspective camera) to use for renderings. Using a separate camera reduces the chance of accidentally moving the camera as you work.
"
Be sure to test-render some images in the resolution of your final project. Often things will look great at 320 ∞ 240 pixels, only to look terrible when you do your final compositing at 640 ∞ 480.
"
Don t be afraid to try new ways of combining layers in your compositing package. Just as in Maya, you may discover a much more interesting look by doing a bit of experimentation.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (7 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Although multiple renderings and compositing may at first seem a confusing pain in the neck, once you begin to see how creatively (and often easily) you can alter the look of a particle-rendered sequence, using Maya in conjunction with a compositing package for particle sequences (and in general) will likely become your preferred method of working. Tip Save this project (as glassFizz2, perhaps) for use in the next chapter.
Software Rendering Now that we ve covered hardware rendering, let s take a look at the types of particles that Maya software-renders, and where they might be useful. In general, Maya uses hardware rendering for speed when rendering simple points and shapes; however, when it comes to complex render types like clouds, water, or fire effects, Maya sacrifices speed for the power of the software renderer to produce photorealistic images. Tip Software rendering can be very slow. While doing the work for this section, you may wish to reduce the quality and size of your renderings in order to keep times reasonable. It can also be very useful to temporarily reduce the number of particles emitted while adjusting particle properties, as a few particles will give a good idea of what the final product will look like without overlong rendering times. Note Remember that IPR renders (discussed in Chapter 18) do not at present work with particles, even software particles. You must re-render each image (or section thereof) manually while adjusting the look of software-rendered particles. The three software render types are clouds, blobby surfaces, and tubes. Tubes, of course, are tubes they can have differing beginning and ending radii and can be rendered with several special effects added to them. Tubes can be useful for everything from laser beams to hair (see the Color Gallery on the CD for a better look at this image):
Blobby surfaces are known as metaballs, spheres that blob together like drops of mercury. Blobbies can be used for water, lava, or a range of other liquid materials (again, see the Color Gallery for a better look):
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (8 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Clouds are blobby surfaces that are blurred or semi-transparent. They are very useful for airy effects such as clouds, fire, and smoke (again, see the Color Gallery for a better look):
As an exercise, let s see how blobby surfaces can be used to create the effect of water. First, either open your fountain project from the previous chapter or use the fountain1.ma project on the CD. You may wish to reduce the number of particles (currently spheres) being emitted by the fountain emitter, as blobby surfaces render slowly enough with even a few particles. We found a rate of about 200 to be sufficient for the purposes of experimentation, although using more particles allows for a smaller radius for each particle and increases the watery look. Whatever you find is a good compromise between speed and final quality is just fine. After adjusting the particle emitter, select the particles emitted (the particle1 group, which the emitter directly emits), and change its render type to blobby surface in the Attribute Editor or Channel box. In the Attribute Editor for the particle shape (particleShape1), in the Render Attributes section, set Particle Render Type to Blobby Surface (s/w). Next, click the Current Render Type button to add blobby surface attributes to this section. The two controls you have over blobby surfaces are the Radius attribute (the size of each individual surface) and the Threshold attribute (which controls how the spheres blob together). The two controls work complementarily: as you increase the threshold from 0 (no interaction the spheres just act like spheres) to 1 (complete meshing spheres that are not connected will disappear), you will need to increase the radius, as the apparent size of the particles will decrease. Tip Setting the threshold of blobby surfaces to 0 is a good way to produce software rendered spheres, allowing you to adjust materials and transparency much more carefully than hardware-rendered spheres. Slower rendering times are the price you pay for software-rendered spheres. Like almost all other areas of Maya dynamics, a good deal of experimentation is required to get the right effect for blobby surfaces. After some tweaking, we were satisfied with a radius setting of 0.6 and a threshold of 0.9 for the particles; your tastes may vary, so try out some different settings. Another element of blobby surfaces (like any geometry) that greatly affects the quality of the rendering is the surface type. To get something approaching a watery appearance, we used a phongE shading group, made it a very unsaturated blue and transparent, and gave it a small but very bright specular highlight. A version of the project that includes this texture is on the CD-ROM (fountain2.ma). For the second set of particles the fountain produces (the particles that appear after the first particle group s collision event), open the Attribute Editor with the particles selected, click the Current Render Type button, and set the render type to Blobby Surface (s/w), then try a radius of 0.3 and a threshold of 0.8 for these particles for starters. You can then use the same material you created for the first set of particles for the second one or make up a new one if you prefer.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (9 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
You may remember that we set the third group of particles (those emitted when the second group collides with the plane) to be points. You can either leave them like this and then composite them in later (or leave them out entirely), or also change their type to blobby surface and then render them all together. We found the small-looking splashes created by a multi-point particle to be a nice contrast to the blobbies of the other two-particle types, so we composited them into the final rendering, producing the 22fountain.mov movie on the CD-ROM. (A still from this animation also appears in the color section of this book.) Note As an exercise, try redoing your plasma cannon project using a Particle Render Type setting of Tube (s/w). Adjust the radii (that is, the Radius0 and Radius1 attributes, which are added after you click the Current Render Type button) to make the blasts grow in size as they move away from the emitter. As with hardware rendering, there are countless ways to tweak and perfect software rendering. Although you can quickly achieve decent results with software-rendered particles, getting just the right look with them can be a very tricky and time-consuming affair, especially if you are not experienced at creating them. As you probably already know from attempting the fountain example, even minor changes to a particle s attributes or an emitter s rate often result in very different-looking renderings. Additionally, the interaction of textures, particle types, emitter rates, and so forth create a complex chain of interrelated variables that can prove frustrating to even an experienced user. Apply two rules to get your software particles to do what you want: "
Be a perfectionist;
close enough
is usually not.
"
Be patient with yourself. While you want the best results, give yourself the time and freedom to make mistakes.
With a critical eye and a bit of experience, you can get excellent results out of Maya s software particles. Feel free to experiment with the Clouds and Tubes render types now that you have an understanding of what software particle rendering can do. Try creating a fuzzy beam of light with tubes, or a dissipating puff of smoke with clouds. If you have difficulty understanding one of the settings, don t forget that Maya s electronic documentation (under Dynamics) is an excellent source of information. Save this project (as fountain3.ma, perhaps) for use in the next chapter. Tip Don t forget: it s often very useful to render software particles in a separate pass, just as is recommended for hardware particles. This way, you have a great deal of control about how the particles interact with the rest of the scene when you composite.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629941941 (10 of 10) [11/27/2000 8:51:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 22 - Particle Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Pictures from Outside: Using Sprite Particles A final particle render type that falls somewhere between hardware and software rendering is the sprite. Sprites are simply placeholders for an image you create somewhere else either another 3D rendering, a computer-based image, or a scanned photograph. The image is mapped onto a two-dimensional rectangle (the sprite), and, for each particle, an instance of the image is created in the hardware renderer. Although sprites are 2D images, they are always oriented toward the camera, so they appear to have depth. You can also choose to use either one image or several images in a sequence (or animation) to map onto your sprites. Note We will discuss how to map image sequences to sprites in the next chapter. As an example of how to use sprites, we ll revisit the UFO project this time changing our streak particles to sprite images of leaves that the UFO can blow around. To begin, open your UFO project or UFOParticles.ma from the CD-ROM. In the Hypergraph, select the particle group, and then, in the Render Attributes section of the Attribute Editor, change the Particle Render Type to Sprites. There are several attributes for the sprite render type, which are accessed by clicking the Current Render Type button in the Attribute Editor. For our purposes, check the Use Lighting box, and then set the Sprite Twist (or rotation about the Z axis) to 90. This will lay the leaves on their sides. If you desire, you can also change the Sprite Scale X and Sprite Scale Y values, altering the size of the sprites in the scene. Once we have created the sprites, which appear as little black boxes right now, we need to create a texture for them. First, create a lambert shader group. (Lambert shaders have no specularity (or shine) to them, so they work well for sprites.) Note To create a lambert shader in the Hypershade, open the Hypershade window (Window Ø Hypershade), and then, from the menu bar (or RM select), choose Create Ø Materials Ø lambert. Click anywhere on the right-hand side of the window to place the new material group.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111298526 (1 of 3) [11/27/2000 8:51:17 PM]
Books24x7 Mastering MAYA Complete 2
Select the lambert materials group, and open the Attribute Editor (Ctrl+A). In the Common Material Attributes section, click the button that looks like a checkerboard to the right of the Color swatch and slider, and then in the Create Render Node window, under the Textures tab (the default), click the File button in the 2D Textures section. This creates a texture that places an image you specify on whatever object the material is applied to. Once you close this window, the Attribute Editor will be focused on the file1 texture, with an Image Name text field and a browse folder icon button under the File Attributes section of the Attribute Editor. Click this button, find the 22leaf.tif file from the CD, and choose it for your file texture. You should see the following in your Attribute Editor.
Tip You can also create your own image(s) for the file texture. Just be sure you include an alpha channel in your image in order to cut it out from the background. If you don t, you will be able to see the edges of the sprite rectangle when you apply the lambert shader to the sprite. Now that we have a shader and a sprite, we need to connect the two. In the scene window (or Hypergraph), select the particle group; then, in the Hypershade, highlight the new lambert shader you just made. Click just below the image of the material, and RM select Assign Material to Selection, as shown here (and in the Color Gallery on the CD).
If all went well, you should now see a bunch of leaves spread across your desert floor (also check out this image in the Color Gallery on the CD):
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111298526 (2 of 3) [11/27/2000 8:51:17 PM]
Books24x7 Mastering MAYA Complete 2
If you now play back the animation (or, depending on how high you have placed your particles, by just looking at the first frame), you will see that the leaves fall halfway through the plane before they stop. This is because the sprites detect a collision with the plane only when their center points hit the plane (i.e., when they are halfway through the plane). To get around this problem, we just need a bit of trickery. Select the plane that is the current floor, and duplicate it (Edit Ø Duplicate). Now move the duplicate plane up just until it covers the top edges of the leaves. With the duplicate plane selected, shift-select the particle shape (using the Hypergraph or Outliner is easiest, as the duplicate plane covers the leaves in the scene window). Now make these two objects collide (Particles Ø Make Collide). The last step is to deselect the plane so that only the leaves are now selected, and move the leaves up until their middles are just above the new plane. Finally, select the duplicate plane, and hide it by going to Display Ø Hide Ø Hide Selection. The leaves will now collide with the new (invisible) plane and will, therefore, stay above the visible plane. Tip You may have noticed this same problem when rendering the sphere particle type for the tablet-and-glass animation. The same solution will work for that situation as well. When you now run your animation back, the leaves should blow around in the wake of the passing UFO. You can either render this project out in hardware or just create a hardware rendering of the leaves blowing. (In the Rendering Editors Ø Hardware Render Buffer window, select Render Attributes. In the Image Output Files section, be sure Alpha Source is set to Hardware Alpha or Luminance, not to Off. In the Render Modes section, be sure Geometry Mask is on.) You can use this new image sequence with your old UFO software rendering to make a new animation, saving the time and disk space of another rendering. A final composite movie is available on the CD-ROM as UFOSpriteSpin.mov. Save this project for use in the next chapter. Note As an exercise, can you use sprites for the antacid tablet project? Try to create an image of a bubble (with alpha channel), and map this to your particles. Does this method work better for this animation?
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=111298526 (3 of 3) [11/27/2000 8:51:17 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 22 - Particle Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Fine-Tuning Particle Rendering While rendering the preceding UFO leaf animation, you may have noticed that the leaves had an unrealistic lack of twirling motion as they were blown around by the UFO. This is because the sprites are always pointed at the camera. To get around this problem, you can use a nice little MEL script called particleReplacer.mel, which will replace selected particles with any geometry that you choose. You can then create a box or rectangle, map an image of a leaf on it, and use the script to replace the particles with that geometry and shading group, allowing the leaves to blow around more naturally. See the documentation of the script for more on how to use it. We ll use an expression in the next chapter to force the sprites to spin as they blow around. Note The particleReplacer.mel script is available from Alias|Wavefront s Web site (http://www.aliaswavefront.com) or from one of the other Web sites (like www.highend3D.com) you ll find links to on the companion CD. Note If you are not familiar with using MEL scripts, refer to Chapters 16 and 17 for more on using and creating scripts. You probably ran into a problem when you tried to composite your particles on top of your software-rendered sequence, especially if you used the Luminance alpha channel: the particles were probably close to invisible in your composition. The reason for this is that Luminance alpha takes as its alpha value the brightness (or luminance) of each particle. This is fine when the particles are very bright, but when they are darker, the alpha channel will be mostly dark too, making the particles very dim. Although it s a bit of a pain, there is an old and very effective trick to solving this problem. First, make a new copy of your scene so you won t mess up your good version. Next, create a new (lambert) shading group, and assign it to all your hardware-rendered particle groups. In the Attribute Editor, change the lambert group s color to pure white, and increase its incandescence to full. The sample should show all white. Tip If you are using sprites, create a file texture for the sprites with the alpha channel copied into the RGB channels of the image. (Call this something like spriteImageWhite.tif.) This step, combined with the complete incandescence of the shading group, will produce a good alpha channel for a sprite group.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=430676653 (1 of 2) [11/27/2000 8:51:23 PM]
Books24x7 Mastering MAYA Complete 2
The particles assigned to the new shading group should now all be pure white. When you render out a new hardware rendering, using luminance to create the alpha channel, you will get a rendering with white particles in exactly the same places as your colored particles from before. (Be sure to name the two sequences with different names!) Finally, in your compositing package, use the newly rendered sequence as an alpha matte for your other, colored particle layer. (See your compositing software s manuals for more on how to do this.) You will now have a much more visible set of particles to work with! Note The UFO sprite animation and still shot shown previously, as well as most of the other compositions shown in this chapter, use the white render trick to do their magic.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=430676653 (2 of 2) [11/27/2000 8:51:23 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 22 - Particle Rendering Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, you took the first steps toward creating finished animations using particles. Using either hardware or software particles and employing many different techniques (and a few tricks), we were able to produce high-quality renderings. We also used multiple renders for hardware and software particles to separate out different elements of an animation, so that we could then combine them in a composting package. Although it s certainly not exhaustive, this chapter should give you a good start into the difficult-but-rewarding area of particle renderings. In the next chapter, you will learn how to use expressions and ramp generators to create complex per-particle (rather than group-level) effects. So save your work from this chapter, and let s move on!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=946922953 [11/27/2000 8:51:26 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 23: Using Particle Expressions and Ramps Overview In the past two chapters, we have created, tweaked, and rendered Maya s dynamics particles. Thus far, however, we have only dealt with these particles as entire groups now it s time to dig a little deeper into the power of Maya s dynamics and learn how to control Maya particles in very specific ways, both as entire groups and as individuals. The tools for doing this are expressions and ramps. We ve worked briefly with both of these in earlier chapters. As we explored MEL in Chapter 16, we saw how the Expression Editor allows us to define mathematical formulae that control the way objects behave. Ramps, introduced in Chapter 19, are akin to the gradients you may have created in a program like Adobe Photoshop. While these tools often overlap in functionality (and thus you can often choose your favorite method for dealing with particles), each has its strengths, as you will see during the course of this chapter. After a general introduction to particle expressions and ramps, we ll try out various modifications of these basic techniques, though the sample of their uses presented here isn t exhaustive. While the complexity of particle expressions and ramps can at times be daunting, the power and control they bring to particle systems makes them truly worth the effort to learn.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=937472726 [11/27/2000 8:51:28 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
A Simple Expression and a Simple Ramp To explore how expressions and ramps work in Maya s particle dynamics, let s begin with a very simple example of each. Create a default emitter that shoots point particles straight up, give it a bit of spread (like 0.3), and set a fairly slow speed. Note To create an emitter, select Particles Ø Create Emitter Ø. In the Emitter Options (Create) window, set Emitter Type to Directional. In the Emitter Attributes section, set Spread to 0.3. In the Emission Direction section, set directionY to 1, and set directionX and directionZ to 0. This ensures that the particles will shoot straight up along the workspace s Y axis. In the Emission Speed section, set Speed to 1 or 2 for a fairly slow speed. If you aren t comfortable yet with these steps for particle creation, please go back and work through Chapter 21 before you continue with this chapter, as we will move rather briskly. To make our emitter a little more interesting, we will vary the particles lifespan by using an expression, and we ll vary their velocity in an unusual manner by using a ramp.
Particle Expressions: Controlling Lifespan The Lifespan attribute defines when particles disappear once they are emitted. We first worked with it in two examples in Chapter 21. In the simplest one, we created a lifespan for our plasma cannon, causing the entire plasma burst to disappear at once. Then, with our fizzing antacid tablet, we wanted bubbles to disappear as they reached the surface, so we keyframed their lifespan to the tablet s descent through the glass; bubbles emitted when it first hit the water had a shorter lifespan than those emitted when it reached the bottom. In both cases, however, every particle (emitted at a given point) had the same lifespan. Now, we will create a range of lifespans (controlling when each particle disappears) so that all particles will not die at the same time.
Per-Object and Per-Particle Lifespans
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (1 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
To see the difference between a per-object lifespan and a per-particle one, let s first create a per-object lifespan for our particles. Run the animation forward until particles come out of the emitter, then select the particles (not the emitter). In the Attribute Editor (Ctrl+A), go to the Add Dynamic Attributes section and click the Lifespan button. In the Particle Lifespan window that pops up, choose Add Per Object Attribute, click Add Attribute, and close the window. Back in the Attribute Editor, under Render Attributes, a new Lifespan field will appear, so you can control all the particles lifespans. Enter a time of 2 (seconds) or so in the Lifespan field, and then rewind and play back the animation. All particles should die after the same amount of time, as if they are disappearing behind some invisible wall.
For some effects, this can be a good thing, but for a more random look we need& well, something more random. Return to the Attribute Editor s Add Dynamic Attributes section, and click the Lifespan button again. In the Particle Lifespan window that opens, this time choose Add Per Particle Attribute and click the Add Attribute button.
In the Render Attributes section of the Attribute Editor, the Per Object lifespan field will now be grayed out, and below, in the Per Particle (Array) Attributes section, there will now be a new field, labeled lifespanPP. If you play back the animation at this point, however, the particles still die at 2 seconds. Why? Because we have not yet defined an expression or ramp to control how long the particles live, so Maya just uses the per-object lifespan instead. Tip As you experiment with particle lifespans, you might decide at some point to override the per-particle lifespan calculations and use the per-object value again. To get back to the per-object lifespan calculation, simply uncheck the Use Lifespan PP checkbox in the Render Attributes section.
Defining a Particle Expression Let s now define an expression to create randomized per-particle lifespans. But what kind of expression?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (2 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
In the text field next to lifespanPP, there are two types of expressions we can choose to build: a creation expression and a runtime expression. What s the difference? A creation expression runs once for each particle (on its birth frame); a runtime expression runs for every frame (except the birth frame) for each particle. When a particle is first created (when its age is 0 frames or its creation frame), you can have an expression that will execute once for each particle, but only for that frame. In other words, if a particle is created at frame 21 (its frame 0 or birth frame) and you have a creation expression for it, the creation expression will run for that one frame, and then the particle will go on its merry way. If you make a runtime expression, it will execute for that particle for each frame except the birth frame (it will execute starting at frame 1 for the particle, or frame 22 in our example). In some cases, as in lifespan, it is better to just run the expression once at the particle s birth (so it just has one lifespan value). In other cases, it is better to use a runtime expression. In yet others, you must use both a creation and runtime expression. We will see more of how these two types of expression work together as we proceed. Enough theory let s get down to business. RM choose Creation Expression from the lifespanPP drop-down list.
The Expression Editor will open up, ready for you to create an expression to control the lifespan of each particle. (This context-sensitivity is a convenient feature you may not have noticed when we worked with the Expression Editor in Chapter 16. Because we re launching the Expression Editor from the particle array section of the Attribute Editor, it automatically loads the proper object (particleShape1) in the Objects window.) Tip Also notice that the Expression Editor has two radio buttons for Particle that allow you to select either creation or runtime expressions. You therefore don t need to close and reopen the Expression Editor to create each type of expression.
In the bottom (Expression entry) section of the Expression Editor window, type in the equation
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (3 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
lifespanPP = rand(1,3); and then click the Create button at the bottom of the Expression Editor. If you entered the expression correctly, you will see the following message in the feedback line (or Script Editor): Result: particleShape1. If you see an error message instead, examine your expression for errors. The rand (or random) function just tells Maya to assign a random value between 1 and 3 to the particle s individual lifespan attribute. Thus, instead of each particle dying at the same time, they will all die some time between 1 and 3 seconds after their birth, creating a much more random or real look to the simulation. The rand function takes either one or two arguments. If you just use one number like rand(3) the function assumes you mean rand(0,3), and produces a decimal number between 0 and 3. For more on the rand (and other mathematical) functions, see Maya s online help under the MEL Command Reference: By Function.
Note Each time you rewind and play the animation, the sequence of random numbers will be different. However, you can also generate a sequence of random numbers that is the same whenever you rewind and play by using the Seed function. You might want to do this so that the animation looks the same every time you play it. By giving the Seed function a single value (like 15), you can force Maya to calculate the same sequence of random numbers each time you play back the animation. For more information, see Using Maya: Expressions in the Maya documentation set. If you reopen the Expression Editor after creating your expression, you will see that Maya has updated the expression to read particleShape1.lifespanPP = rand(1, 3); Because you had previously selected the particleShape1 node before opening the Expression Editor, Maya knew that this was the node to apply the lifespanPP expression to. If you had not selected the particleShape1 node first, you could still create the expression, but you would have to use the full name of the attribute (such as particleShape1.lifespanPP).
Controlling the Velocity: Creating a Particle Ramp Pretty neat stuff: we ve quickly and (mostly) painlessly made our particles die off in a random fashion. Now let s create a ramp to control the velocity of the particles, making them move around in a circle. (Velocity is just position per unit time, so controlling particle velocity will control where in space a particle is at any given time.) First, we need to get rid of the expression that s currently controlling the lifespan, so that the lifespan per object will control how long the particles live. Reopen the Expression Editor, select the expression, and click the Delete button. (You might also wish to set the spread for the emitter to 0 for this project.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (4 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you don t see the expression text in the Expression subwindow, choose Select Filter Ø By Expression Name and click the name of the expression in the Expressions subwindow. Now return to the Attribute Editor, and, in the rampVelocity text field, RM select Create Ramp Ø.
The options window that pops up allows you to control how and where the ramp is applied.
We ll use the default options (Input U set to None, Input V set to Particle s Age, and Map To set to New Ramp), but you should be familiar with the options available here, in case you wished to map the ramp to a different set of attributes. After checking through the various settings, close the window by pressing OK. Return to the Attribute Editor and RM select ArrayMapper1.outColorPP Ø ArrayMapper1.outColorPP Ø Edit Ramp. This will focus the Attribute Editor to the ramp you have just created.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (5 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
Note If you used the Ramp Editor in version 1 of Maya, you will see that the editor is now contained within the Attribute Editor, instead of in a floating window. In the top section of the Ramp Editor is the name of the ramp (currently ramp1), along with a texture swatch that updates as you change the options in the section below. The swatch should be set to a ramp between red, green, and blue. For velocity, position, and acceleration values, don t think of red, green and blue as colors, but as values on a given axis: red is the X direction/velocity/acceleration, green is the Y value, and blue is the Z value. (The scene window uses these colors to represent the X, Y, and Z axes.) As the particles age, their lifespan values move up the ramp, going from red (out the X axis) to green (up the Y axis) to blue (out the Z axis). If you play back the animation right now, the particles will move to the right, then up, and finally toward you, and then die. To change how quickly all this happens, set the lifespan value to a greater or lesser value. Note If there is no lifespan per object attribute set, you will not get correct behavior out of your ramp. You must have a per-object or per-particle lifespan set in order for them to age properly, and thus move up the ramp. To make the particles travel in a circle, we ll need to change the default ramp, but first we must remap the array, because currently no particle can travel less than velocity 0 (no negative values). In order for our particles to travel in a circle, they must be able to go in a negative as well as a positive direction on the X and Y axes. From the menu at the top of the Attribute Editor, choose Focus Ø ArrayMapper1. This focuses the Attribute Editor on the mapper the part of the ramp group that tells Maya how to interpret the gradient. The Min Value field tells Maya what the minimum value for the ramp will be. For our purposes, let s make this value 1, so the particles will travel at a velocity of 1 when a certain ramp color value is 0. Leave the Max Value set to 1, so the particles will travel at a velocity of 1 when a color value is 1. Because of this remapping, a value of 0.5 for any color will translate into a velocity of 0 (halfway between 1 and 1). This remapping may be a bit confusing, but stay with us here; things should be a bit clearer when we edit the ramp.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (6 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
Now that the ramp has been remapped, it s time to edit the ramp. From the Attribute Editor s menu, choose Focus Ø ramp1, to return to the ramp. Set the first color swatch to RGB values of 0.5, 1, 0.5, by first clicking the green dot at the bottom left of the gradient, then changing to RGB (instead of HSV) mode in the color chooser, and finally entering the above values in the R, G, and B channels. The particles will now start life moving straight up the Y axis (remember that 0.5 on the color ramp equates to a 0 velocity, so there will be no motion in the X or Z directions). To make a circle, we need five points on our ramp, so, somewhere between the bottom and middle points, click in the ramp to create a new point. With the new point selected, change the Selected Position to 0.25 (one fourth of the way up the ramp), and then change the R, G, and B values of this point to 0, 0.5, and 0.5, respectively. At this point (one fourth of the way through the particle s life) the particle will be travelling in the negative X direction. Now click the middle point, be sure its Selected Position is set at 0.5, and set its RGB colors to 0.5, 0, and 0.5 (travelling straight down). Next, click above the middle point in the ramp to create a new point, set its Selected Position to 0.75, and set its RGB values to 1, 0.5, 0.5. Finally, pick the top point and set its RGB values to 0.5, 1, 0.5. When finished, your ramp should look as follows (see the Chapter 23 Color Gallery on the CD for a better look).
When you now play back the animation, the particles will travel around in a circle a pretty neat effect! You can, of course, play with the ramp values to get different effects. Also try randomizing the lifespanPP values so that all particles do not have the same age. As you can see, the ramp mapper allows you to create some very interesting effects in a graphical (rather than mathematical) manner.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (7 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
Tip You can also move points on the ramp by dragging the circle (on the left side) up and down. To delete a point, uncheck its box on the right side of the ramp. With this introduction to particle expressions and ramps under our belts, we ll devote the rest of the chapter to trying out various modifications of these basic techniques. Sometimes we ll use one technique or the other, but often we ll use both together. The common thread in all of these exercises is that we ll be using the power of Maya to achieve more realistic or at least more interesting animation. The sample of uses of ramps and expressions this chapter contains is meant more to introduce you to the range of effects these two controls can produce than to be exhaustive. While you work through these examples, consider what other effects you might be able to produce with ramps and expressions, and then using what s in this chapter as a guide try to create what you envision.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=629996817 (8 of 8) [11/27/2000 8:51:33 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Changing Color and Lifespan per Particle To make our plasma cannon s blasts more realistic (or at least visually appealing), we will use expressions and ramps to modify the lifespan and the color of the plasma, respectively. Open your saved plasma cannon project from the last chapter, or use the original plasma1.ma project from the CD-ROM. If you prefer, feel free to use the emitter we created above. Let s first use the same basic expression we created above to give each particle a random lifespan from 2 to 4 seconds. Note As an exercise, try to make the expression to make the lifespanPP of the plasma cannon range from 2 to 4 seconds on your own. If you get stuck, the steps are the same as described in the section above. Once you have particles that die off randomly, the plasma cannon should be getting close to production-ready. Only one thing is still missing: as the energy of the blast lessens, the color of the particles should fade from a bright blue-white to a duller orange. A ramp is a great way to accomplish this. With the particles selected, click the Color button in the Attribute Editor, check the Per Particle checkbox, and add the attribute. Next, create a ramp for the newly created rgbPP attribute, and edit the resulting default ramp (follow the steps above if you get lost). Let s change the colors, starting at the bottom. First, click the round button to the left of the gradient (the orange one); then click the orange color swatch below it to bring up the color picker. Choose a nearly white blue color (or whatever you wish) for your first color. Choose the next point up, and make it a yellowish color, then make the top color a darker red. One point is still missing add a point between the yellow and red points (by clicking in the gradient), and make it orange. When you are finished, you should have something resembling the following (see the Color Gallery on the CD for a better view).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=592462985 (1 of 3) [11/27/2000 8:51:37 PM]
Books24x7 Mastering MAYA Complete 2
Play back your animation. You should see the particles change color as they shoot across the screen (also see this image in the Color Gallery on the CD).
Forcing a Complete Ramp Cycle Advanced users may note that, because particle lifespans are random, many of the particles will not cycle through the complete color ramp. To force all particles, regardless of their lifespan, to go through a complete color range, you can use the following expression for both the creation and runtime expression for rgbPP instead of a color ramp (copy this expression into both the creation and runtime expressions): $howOld = smoothstep (0, particleShape1.lifespanPP, particleShape1.age);particleShape1.rgbPP = <<1.5 - $howOld, $howOld/1.2, $howOld/1.5>>; The smoothstep function creates a smooth ramp from 0 (at time 0) to 1 (at time lifespan) for each particle. The rgbPP components (red, green, blue) are then assigned values between 1 (1.5 actually) and 0, based on how old the particle is compared to its full life expectancy. The numbers (1.5, 1.2, and 1.5) are just ways of adjusting the colors to make for a nice transition. (You can also find this image in the Color Gallery on the CD.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=592462985 (2 of 3) [11/27/2000 8:51:37 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=592462985 (3 of 3) [11/27/2000 8:51:37 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Changing Radius by Position Now let s see how we can change particle shape as well as lifespan by using expressions. Create a basic emitter that shoots particles up in the air, and then assign the particles a sphere render type. Next, keyframe the emitter to move up from 0 to about 10 on the Y axis over about 200 frames we ll use this motion to make the particles radii change. We are now going to create an expression that ties the position of the emitter to the radius of a particle. First, we need to create a lifespanPP attribute and a radiusPP attribute for the particles. To create both attributes, click the General button in the Add Dynamic Attributes section of the Attribute Editor.
In the window that pops up, select radiusPP, click Add, and close the window. Now open the Expression Editor window by RM choosing Creation Expression from either the radiusPP or lifespanPP fields. In the creation expression, type in the following. particleShape1.lifespanPP = rand(4,10); particleShape1.radiusPP = emitter1.ty/10;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=230161494 (1 of 2) [11/27/2000 8:51:40 PM]
Books24x7 Mastering MAYA Complete 2
These two lines do two completely separate functions. One creates a random lifespan for each particle; the other gives each particle a radius based on where the emitter is at the moment of creation (the radius equals the Y position of the emitter, divided by 10). When you play back the animation, you should get something like the following image (which also appears in the Color Gallery on the CD).
To see the difference between creation and runtime expressions, cut the second line (Ctrl+X) from the creation expression, and then click the radio button to select Runtime instead of Creation. Next just paste the line you cut from the other expression into this new one and click the Create button. When you now play back the animation, you will see the radii of all particles increase as the emitter moves up the Y axis. (You ll get a better view of this image in the Color Gallery on the CD.) Because the runtime expression is evaluated at every frame (except the first one), the particles radii will constantly increase in sync, no less as the emitter rises.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=230161494 (2 of 2) [11/27/2000 8:51:40 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Moving Particles Around If you happened to have looked at Using Maya: Expressions in the Maya 2 manual, you might have seen a picture of a spiral of particles rising from the ground. If you looked for an explanation of how to do this, however, you wouldn t find an explanation well, here is one way to do it. We re going to create a runtime expression that uses the Sine function to place particles into a loop and push them up at the same time, so they form a spiral. Note If you are unfamiliar with the Sine function, see Chapter 16 (or a trigonometry book) for more information on what it is and how it works. (The Maya 2 manual also contains an explanation and several examples of using the Sine function see Using Maya: Expressions, Chapter 7.) First, create an emitter that emits roughly five particles per second (about one for each five frames), make the render type Spheres, and set the velocity to 0. Using an expression, we re going to place the spheres in a position based on their age, and, by virtue of the properties of the Sine function, the position of the particles will form a moving spiral. In the Attribute Editor (with the particle shape selected), RM choose Runtime Expression in the Position field. Copy the following expression into the Expression subwindow. $pX = 15 * sin(particleShape1.age); $pZ = 15 * cos(particleShape1.age); particleShape1.position = <<$pX, particleShape1.age, $pZ>>; This expression first declares the variables $pX ad $pZ (for position X and Z), and then assigns them a value based on the Sine of their age (which starts at 0 when they are born, increasing from there). Note For more on variables, see Chapter 17. Because Sine function values range only between 1 and 1, we multiplied the function by 15 to get a bigger number range (from 15 to 15). You will note that $pZ uses the Cosine function instead of the Sine function. This is because the Cosine is perfectly out of phase with the Sine function (that is, it is 0 when the Sine is 1, and vice versa), and, when the two are combined this way, they will make the particle travel in a circle on the X-Z plane.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=720295844 (1 of 3) [11/27/2000 8:51:43 PM]
Books24x7 Mastering MAYA Complete 2
The final statement of the expression does all the real work: it assigns to the X, Y, and Z positions the value of $pX, the age of the particle (forcing the spheres up in the Y direction as they age), and $pZ. As all these values change on every frame, so the particles move in a nice spiral.
You may notice that there is a flickering at the origin as you play your animation. This is the sphere being created (at 0, 0, 0) on its first frame of life because the runtime expression does not work for a particle s birth frame. To get rid of this annoying problem, simply cut and paste the runtime expression into the Creation Expression window (switch over using the Creation/Runtime radio buttons in the Expression Editor). As a last step, see if you can figure out how to make the spheres colors change as they spiral up. (This is shown below and in the Chapter 23 Color Gallery on the CD.) You can use the same Sine (and Cosine) function to do this as well.
If you get stuck, try looking at this code to help you out: $pX = 15 * sin(particleShape1.age); $pZ = 15 * cos(particleShape1.age); $cX = ($pX + 1) / 2.0; $cZ = ($pZ + 1) / 2.0; particleShape1.position = <<$pX, particleShape1.age, $pZ>>; particleShape1.rgbPP = <<$cX, 0.5, $cZ>>;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=720295844 (2 of 3) [11/27/2000 8:51:43 PM]
Books24x7 Mastering MAYA Complete 2
The new variables ($cX and $cZ) reset (more properly, they renormalize) the $pX and $pZ variables to between 0 and 1 (they originally ranged from 1 to 1). The rgbPP statement just assigns these variables (plus 0.5 for green) to the spheres red and blue color channels. Here, with just a few commands, you can create an animation that would be next to impossible to make using traditional keyframe methods.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=720295844 (3 of 3) [11/27/2000 8:51:43 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Collision Events and Expressions For particles, not only does Maya keep track of color, age, and other attributes; it also keeps track of events like how many times a particle has collided. Create a new scene with a fountain shooting spheres up in the air, add gravity, create a plane, and create a collision plane (if you don t want to go to the trouble of setting this up, just open the 23collide.ma project on the CD-ROM). Now let s create a runtime expression that will change each particle s color based on how many times it has collided with the plane. We will use the event attribute (which is a per-particle attribute, even though it doesn t end in PP) to test how many collisions each particle has been through; then we ll use an if else if else statement to assign a different color to the particle, depending on how many collisions it has been through. To add the event attribute, you have to create a particle collision event (select the particles not the emitter then choose Particles Ø Particle Collision Events, and click the Create Event button). The event attribute itself will not be listed in the Channel box or the Attribute Editor, but it will be listed in the Expression Editor s Attributes box. Note If you are not familiar with if statements, please see Chapter 17 (or a basic programming text) for more information. Note In the Maya documentation, see Using Maya: Dynamics for more information about creating particle collision events (Chapter 4, Particle Collisions ) and the event attribute (Chapter 13, Advanced Particle Topics ). RM select a runtime expression for the rgbPP of the particles, type the following expression into the Expression Editor, and then click the Create button when you are finished. if (event == 0) rgbPP = <<0,1,0>>; else if (event == 1) rgbPP = <<1,0,0>>; else if (event == 2) rgbPP = <<0,0,1>>; else rgbPP = <<1,1,1>>;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=749716002 (1 of 2) [11/27/2000 8:51:47 PM]
Books24x7 Mastering MAYA Complete 2
This expression executes on every frame (except the birth frame) to see how many collisions each particle has had. If the number is 0 (no collisions), it assigns a green color to the sphere. If the number of collisions is 1 (after the first bounce), it assigns the color red to the sphere. If the number is 2 (after the second bounce), it assigns the color blue to the spheres. In all other cases (i.e., the particle has bounced more than twice), it assigns a white color (all 1s) to the sphere. Note Note that the test condition is specified by a double equal sign (event == 0), not a single equal sign. A single equal sign tells Maya to assign a value to the left-hand side of an equation (like rgbPP = X); a double equal sign tells Maya to test whether the two sides of the equation are equivalent. Note You can also use a switch command for cases like the expression above. A switch and an if-else statement perform the same function, but in a slightly different way. For more information about the switch command, see Using Maya: Expressions in Maya s online documentation.) Play back the animation and watch each sphere; you will see that the individual particles change color each time they bounce, ending with a white color after it has bouncing more than twice. (The Chapter 23 Color Gallery shows the image below to better effect.) You may also notice that the spheres are emitted as completely black objects this is (again) because a runtime expression is not evaluated on the birth frame of the particles. To solve this problem, simply copy and paste the expression into a creation expression for the rgbPP of the spheres.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=749716002 (2 of 2) [11/27/2000 8:51:47 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Disappearing Bubbles: Radius Ramps One problem with our antacid tablet from the previous two chapters is that the bubbles rising from the tablet have a constant radius. Let s make them shrink as they rise using a radius ramp and particles with blobby surfaces. First, open your project from the last chapter (or, if you don t have that project, open the glassFizz.ma file on the CD-ROM). For a little different look, let s change the bubbles to software rendered ones. In the Attribute Editor, set the particle type to blobby surfaces, and set the threshold to 0. (Remember that setting the threshold of a blobby surface to 0 makes the spheres noninteractive and, thus, just spheres. For bubbles, this is exactly what we re after.) With particles selected, add a per-particle radius attribute to the bubbles, then create and edit the ramp of radiusPP to look something like this.
You ll probably find the bubbles created with this ramp ranging in size too much, overall, so remap their sizes using the Array Mapper (RM choose radiusPP Ø arrayMapper1.outvaluePP Ø arrayMapper1.outvaluePP Ø Edit Array Mapper). A min value of 0.1 and a max of about 0.3 give a much subtler effect.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=898140687 (1 of 2) [11/27/2000 8:51:50 PM]
Books24x7 Mastering MAYA Complete 2
Note The bubbles in this image have a material attached to them a phongE material with high specularity and low opacity. This, of course, improves the look of the bubbles tremendously.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=898140687 (2 of 2) [11/27/2000 8:51:50 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Emitter Expressions We have created several ramps and expressions for particles, but it is also possible to create expressions for particle emitters. You can either create a default emitter for this example, or open your fountain project from the last chapter. It s easier to see the effects of the expression in a simpler project, so it might be advisable to first create a simple emitter and then, after you see how the expression works, copy it into the fountain project. Tip If you don t have the fountain project from the last chapter, use the file fountain3.ma on the CD-ROM. Although emitters are random in their particle output, they tend to produce a constant randomness (a kind of even spread) over time. To get the emitter to create a varying number of particles and a varying amount of spread, we could keyframe these values or we could simply create a two-line expression using the noise function. Note We could also use the rand function, but noise produces a more connected randomness (as opposed to the rand function s jumping from value to value), which looks more like the varying water pressure we might see in a fountain. For more on the noise function, see Chapter 16. With the emitter (not the particles) selected, open the Expression Editor and type in the following expression. emitter1.rate = ((noise (time) + 1) * 200) + 20; emitter1.spread = ((noise (time) + 1)/4) + 0.1;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=980604576 (1 of 2) [11/27/2000 8:51:52 PM]
Books24x7 Mastering MAYA Complete 2
In essence, each line of this little expression tells the emitter to vary its rate (or spread amount) according to a random amount as defined by the noise function, which uses time as its input to create its numbers. The rest of the numbers are just a way to get the value output by noise into a good range for each attribute. Because noise varies between 1 and 1, we added 1 to both lines so the result would vary between 0 and 2. For the rate, we wanted the value to range between 20 and 420, so we multiplied the results of noise by 200 (giving a range of 0 to 400) and added 20. For the spread, a good range seemed to be between about 0.1 and 0.6, so we divided by 4 (giving a range of 0 to 0.5) and added 0.1. As your results should show, the noise function is a very powerful way to create a more live look to your particles. The result of this expression applied to the fountain project is on your CD-ROM (23fountain.mov). If you compare this to the previous fountain movie (22fountain.mov), you can see the dramatic way the fountain looks more real (like one of those shooting fountains) in our new movie. Note As an exercise, try varying the speed of the particles in the fountain as well. What range looks best to you? Hint: to speed up the process of experimentation, try using playblast to test your motion (instead of test renders, which will be long with blobby surfaces). Also, 23fountain.mov uses variable speed, so look at it for hints as to how the final product might look.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=980604576 (2 of 2) [11/27/2000 8:51:52 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Changing Opacity with Motion We re now going to create a nice trick: we re going to increase the opacity of a particle based on its motion in other words, the more it moves, the more opaque it is. To test this out, open your UFO project from the last chapter (or use UFOParticles.ma on the CD-ROM). With the particles selected, create a per-particle opacity attribute; then open the Expression Editor and type in the following simple runtime expression. if (particleShape1.velocity != 0) particleShape1.opacityPP = (particleShape1.velocity / 2.0); else particleShape1.opacityPP = 0; All we do here is test whether the velocity is not 0 (the ! sign in front of a comparison operator means not ). If the particle is moving, then its opacity is based on its speed (we divided by 2 to get a more gradual opacity fadeup you can try other numbers if you like). If the particle is at rest (the else statement), its opacity is defined as 0, or invisible. Thus, when the dust is resting on our desert floor, it is invisible. As the UFO picks it up and moves it around, it becomes visible; then, as it crashes back into the ground, it becomes invisible again. A movie of this new UFO sequence is on the CD-ROM: 23UFOFade.mov.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914168712 (1 of 2) [11/27/2000 8:51:56 PM]
Books24x7 Mastering MAYA Complete 2 Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=914168712 (2 of 2) [11/27/2000 8:51:56 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Changing Rotation with Motion Now that we have dust blowing up, it seems only natural to visit the UFO project we did in the last chapter with sprites of leaves. This time, instead of fading the sprites up, we ll make them rotate based on their motion (so they aren t just sliding across the desert floor). Either open your UFO sprite project, or use the one on the CD-ROM (UFOSprite.ma). With the particles selected, make a spriteTwistPP attribute (click the General button in the Attribute Editor, scroll down to spriteTwistPP, highlight it, and click the Add button). In the text field next to the new spriteTwistPP attribute, RM choose New Expression and in the Expression Editor, type in the following expression (don t press Enter after the plus sign): float $speed = particleShape1.velocity; if (particleShape1.velocity != 0) particleShape1.spriteTwistPP = particleShape1.spriteTwistPP + ($speed * noise(time) * 2); The essence of this expression is the same as the last one: if the velocity isn t zero, rotate the leaves. Some of the details have changed, however. First, we created a variable (Note that it is a float) called $speed, which receives the magnitude of the particle s velocity. Note The velocity variable is a vector quantity (with X,Y,Z values), but $speed is a scalar (just one number). When Maya sees an assignment operator (a single equal sign), it always forces the value on the right to fit that on the left if it can. In the case of a vector being converted to a float, Maya takes the magnitude of the vector (the square root of each element squared and added together), which is a single number, and assigns that number to $speed. Whew enough math lessons for one day! The next line checks whether the sprite s velocity is not 0; then, if that s the case, it changes the spriteTwistPP of the particle by the value of $speed. The multipliers (noise and 2) are there to make the motion of each leaf different from the others essentially, the value of $speed is multiplied by a randomly changing number between 2 and 2, making the leaves spin in both directions by varying amounts. You will notice that there is no else statement here: if the leaf isn t moving, its rotation should just stay where it is, not suddenly jump back to some other number (like 90 degrees). A movie of the leaves is available on the CD (23UFOSpriteSpin.mov).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=755586640 (1 of 2) [11/27/2000 8:52:00 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=755586640 (2 of 2) [11/27/2000 8:52:00 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Animated Sprites: the UFO Again As one last example of using expressions, let s create a more interesting, animated array of plant life for our UFO to pass over. You may have noticed how boringly static all the leaves in our desert were now we ll remedy that situation. Open the UFOSprite.ma project (or your saved one or the one we just worked on, though the results will be a bit harder to see with all the spinning). Select the lambert shader that controls the sprite shape (the one with the leaf on it) and, in the Attribute Editor, click the focus button next to color (the triangle in a square) to bring up the file1 attributes. From the CD (or the directory on your hard disk where you ve saved the Working_Files directories), open the LeafSequence subdirectory (you will see about 50 files in the sequence), and be sure to check the Use Frame Extension box below. This will assign the first leaf in the sequence to the shader. Tip For faster response time (and just to be a better user), you can copy the leaf files into your project s sourceImages folder and select them there for your shader. Now, in the Hardware Texture Cycling Options, set the Start Cycle Extension to 1, the End Cycle Extension to 50 (for leaf1 and leaf50, respectively), and the By Cycle Increment to 1. The By Cycle Increment controls how many images are skipped before the next one is shown. For an animation (of, say, a bird flying or a rendered animation sequence you had previously made), you would set the increment to 1; for a choppier look (skipping some of the images, thus producing a more stop motion look as the sequence plays), an increment of 2 or 3 would work. Tip You might realize at this point how useful sprite sequences can be: you could play back a movie (saved out as an image sequence) in sprites, creating a dazzling array of moving images in your final scene. If you play back the animation now, you won t see anything different. That s because we have to write an expression to alter the look of each sprite. First, add a new attribute: spriteNumPP (click the General button in the Attribute Editor and add it). Then RM choose a new runtime expression and type in the following: particleShape1.spriteNumPP = (frame % 50) + 1;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=683881096 (1 of 2) [11/27/2000 8:52:03 PM]
Books24x7 Mastering MAYA Complete 2
The % sign is the modulus (or remainder) function whatever number remains from dividing the frame number by 50 is returned (plus 1 so that the number is never 0, for which no sprite is defined). For example, on frame 1, 1 % 50 returns 1 (the remainder of 1 / 50). The second frame returns 2, and so on. At each frame, a different spriteNumPP is defined. We could also write a noise function to get each sprite to randomly change colors, instead of all of them doing it in synch. In either case, we get all the changes of fall colors in very short order!
Note As an exercise, try creating a new emitter that produces different colored leaves that then stay the same the rest of their lives. You ll need to use a creation expression this time, instead of a runtime expression. If you get stuck, see the file differentLeaves.ma for a clue.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=683881096 (2 of 2) [11/27/2000 8:52:03 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 23 - Using Particle Expressions and Ramps Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this chapter, we have discovered how to unlock the power of particle dynamics by using ramps and expressions. Using ramps, we can produce large-scale effects be it radius, color, or even velocity that occur over the lifetime of each particle. We learned that expressions, on the other hand, are best at breaking down groups of particles into their constituents, and allowing us to control each particle in a different but related manner. While none of the expressions were more than a couple of lines long, they produced very impressive results, ranging from positioning particles based on the Sine curve to varying their opacity based on how fast they were moving. If you have a fairly good grasp of the past three chapters, you are now ready to create very difficult-looking effects in (most importantly!) a relatively short time. The next chapter, on soft bodies, is the final chapter on particle dynamics. You ll see that the term soft bodies is a slight misnomer, as they are actually collections of particles that act as bodies. While soft bodies are one of Maya s most complex and difficult features, the past three chapters have given you a very good primer for these powerful objects. When you re ready, turn the page to begin exploring soft bodies!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=794843195 [11/27/2000 8:52:06 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 24: Dynamics of Soft Bodies Overview In this chapter, you ll learn what soft bodies are, how to use them, and when you can use them to create amazing special effects. Along the way, we ll revisit the fountain example from the past several chapters, this time concentrating on the plane below the fountain. We ll also delve into an advanced use of soft bodies to create an effect similar to the famous water head scene in the film The Abyss. You will see both how soft bodies are the culmination of Maya s particle dynamics and how they allow you, the animator, to create a whole new realm of animation.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=973800807 [11/27/2000 8:52:08 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
What Are Soft Bodies? At heart, soft bodies are not particularly astounding; they are simply a collection of particles. There are a few differences, however, between standard particles and soft body particles. For one thing, soft body particles are connected to hold a shape. For another thing, they appear on the screen (and in the final render) as a solid shape rather than as a collection of points. Because of these two properties, soft bodies are special: they can appear to be a solid piece of geometry but react like a bunch of particles when forces and motions are applied to them. Creating soft bodies in Maya is easy: you simply select your model and tell Maya to make a soft body out of it. If you have not used soft bodies, you might wonder if the trouble of learning how to use them is worth it. Our advice is to do just one of the example exercises in this chapter. You ll discover that the animation effects you have steered clear of in the past because of their apparent difficulty will now be within easy grasp. The ability to use soft bodies to create flexible, fluid objects is indeed one of Maya s most powerful features. What s New in Maya 2 Maya 2 brings with it numerous changes to soft bodies, from their creation options, to how springs are applied to them, to many under the hood changes in how their dynamics are calculated. If you have used soft bodies before, you will find the new interface and workflow a huge improvement over the old. Options are now more clearly available and labeled, and springs, especially, are a far more powerful and predictable tool than in the previous version.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=767472005 [11/27/2000 8:52:10 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Creating a Basic Soft Body Create your basic Nurbs sphere in a new scene. Now, select Bodies Ø Create Soft Body Ø from the Dynamics menu set. The Soft Options window will appear with your soft body options. In this window, be sure that the Make Soft option (the default option) is selected from the Creation Options pull-down menu. Now click Create, and then click Close.
Note If you used Maya 1, you will notice that this options window has changed significantly (and for the better) in Maya 2. That s about it! You have just converted your original geometry (the sphere) into a soft body. You will see what looks like your original sphere, surrounded by a cloud of points (or particles) that actually define the shape. The number of particle points is determined by the number of isoparms (or polygon faces) in your original geometry. If you want more points (higher resolution effects), create your original shape with more isoparms. To see how this works, select the makeNurbSphere1 node and change the number of spans (or sections) to 8. You will see the number of soft body particles change to match.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=818498822 (1 of 4) [11/27/2000 8:52:16 PM]
Books24x7 Mastering MAYA Complete 2
Understanding the Structure of the Soft Body Before we actually use our first soft body, let s take a quick look at its structure in the Hypergraph. Open the Hypergraph, and choose Options Ø Display Ø Shape Nodes. Your Hypergraph window should show something like the following.
The highlighted nodes (nurbsSphere1Particle and nurbsSphere1ParticleShape) are your new soft body transform and shape nodes that have been attached to (and replace) your old sphere. If you highlight the nurbsSphere1ParticleShape node and look in the Channel box (as shown on the next page) or the Attribute Editor, you will see that the attributes listed there exactly match the attributes you d find if you created a standard particle shape. When you finish examining the structure of your soft body, close the Hypergraph.
Using a Soft Body Now that we have created a soft body, what can we do with it? First, let s create a gravity field by which it can be affected. Select the sphere, and then choose Fields Ø Create Gravity. Notice the gravity field now displayed in the center of the workspace. When you play back the animation, the ball drops under the influence of gravity (just as a rigid body would). Now, rewind the animation, move the ball up, and add a plane to the scene (be sure to scale it large enough so that the ball will fall on it).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=818498822 (2 of 4) [11/27/2000 8:52:16 PM]
Books24x7 Mastering MAYA Complete 2
Warning Remember that you always have to rewind a particle animation before playing it back. If you do not, the results will look bizarre . Select the sphere, Shift-select the plane, and then choose Particles Ø Make Collide. Now, as gravity forces the soft body to fall, the particles that make up the soft body will collide with the plane. When you play back the animation, you should see something like the following.
Note You will notice that the soft body collision is different from a rigid body collision. First, rigid bodies (the ones using the same rigid solver) will automatically collide with one another; for a soft body as with standard particle groups you have to define the collision. Second, each particle not the solid surface as a whole collides with the plane at a different time, giving rise to the sphere s distortion. As when you created standard particle collisions (in Chapter 21), you have control over how the soft body collides with the plane. Both the soft body shape and the plane (in its geoConnector node) have controls for resilience (bounciness) and friction (how much the objects stick when they collide at an angle) for the collision. You cannot directly animate the soft body s resilience and friction; they are constrained to be the same values as that of the plane s geoConnector. To see how resilience works, try changing the plane s resilience attribute to a number larger than 1 (such as 1.2). When you play back the animation, the particles will bounce higher and higher (as, on each bounce, they rise 120 percent of their last height impossible in our world, but not Maya s). If you decrease resilience to 0, the particles will simply stick to the plane when they strike it. Tip Maya 2 supports negative resilience. With a negative value, your soft body will move through the plane and then bounce back toward it from underneath. If you use this feature with gravity, however, the particle will continue to fall (as gravity continues to pull on the object). To counteract this problem, you can keyframe gravity to change directions. Now move resilience back to 0.8 or so and be sure that the friction value is 0.6 or so. If there is no sideways movement to the particle (no movement tangent to the plane), you will see no difference. Try, however, adding a bit of shear to your gravity; make the directionX value of gravity 0.2 or so (select the gravity node at the center of the Maya grid or in the Hypergraph, and set directionX to about 0.2). When you play back the animation, you will see the ball move sideways under gravity ; then, as it collides with the plane, it will slow on each collision. If the ball slides off the plane, just make the plane bigger (or enjoy the spill!). If you set friction to a large value, such as 4, the ball particles will actually bounce backward when you play back the animation because friction is greater than 100% (which is also impossible in the real world). If you make friction negative, the ball particles will surge forward on each collision. Tip If you try to keyframe the ball s motion, you may run into a nasty little problem called double transforms. You will see the particles jump out ahead of the ball shape. To counteract this problem, simply group the soft body to itself (select the shape, and then press Ctrl+G), and keyframe the position of the ball using this new node (called group1 by default).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=818498822 (3 of 4) [11/27/2000 8:52:16 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=818498822 (4 of 4) [11/27/2000 8:52:16 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Adjusting Goal Weights Now that we ve created a soft body, let s make one that isn t so squishy. Make a new scene, and create a scene like the last one a sphere above a plane (be sure to turn collisions on again by choosing Particles Ø Make Collide). Now open the Make Soft Body options window (choose Bodies Ø Create Soft Body Ø). Choose Duplicate, Make Copy Soft from the pull-down menu, check Make Non-Soft a Goal, and create the object (Note that there is a slider for an attribute, goal weight, that is now enabled). Highlight the sphere, and create gravity. If you look in the Hypergraph now, you will see the original geometry (nurbsSphere1) and the duplicate soft body (copyOfnubsSphere1 plus the particle node). Tip Generally, you want to hide the original geometry (by selecting that check box in the Create Soft Body options window). Here, we re leaving it visible so that we can see how the soft body and original geometry interact. Play back the animation. You should see the sphere sag, and then bounce back into nearly spherical shape. What s happening here is that soft body particles are being pulled down by gravity, but they have a goal to stay as close as possible to their original shape the original sphere. Thus, they sag a bit and then try to bounce back to their original shape. We can alter how strongly attracted to its original shape a particle is simply by adjusting its goal weight. Select the particle node (you may need to do this in the Outliner or Hypergraph), and find the goalWeight[0] and goalActive[0] attributes listed there. They should be set to their default 0.5 (or 50%) and on settings, respectively. If you turn the goalActive attribute to off (by typing that in the text field), the soft body will fall away from the sphere when you play the animation, just as in our first example. Why? Because turning that attribute off tells Maya to pay no further attention to the goal weight. Now turn goalActive[0] back on. Tip GoalActive[0] can be keyframed, meaning that you can animate whether or not the soft body will attempt to match its original shape or simply follow the forces applied to it. The [0] for goalActive and goalWeight is a note that these attributes are for the first element in the particle array (they thus apply to the whole group). You can also alter goal weights on a per particle basis.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=300914015 (1 of 3) [11/27/2000 8:52:19 PM]
Books24x7 Mastering MAYA Complete 2
For more subtle control of goal weights, you can adjust the goalWeight[0] from its default 0.5. If you turn the goal weight up to 1, the soft body will no longer sag; it will now perfectly match the original shape. If you turn the goal weight down to 0, the soft body will fall away from the sphere; this is the same as turning off the goalActive attribute. Low numbers will make the soft body react strongly to gravity; high numbers will make it hold its original shape well. Try changing goalWeight s numbers, and then see how this changes playback.
Changing the Shape of a Soft Body Now let s try changing the original shape and see how the soft body reacts. First, be sure your goal weight is about 0.3. Next, be sure you select the original shape (nurbsSphere1 not nurbsSphere1Copy!), and scale this shape out in the X axis. When you play back the animation, you will see the soft body stretch to fit the new shape of the sphere; it will overextend, however (as its goal weight isn t 1), and will jiggle back and forth until it finally nears the sphere s new shape. (You ll find a color version of the following image in the Color Gallery on the CD.)
Change the scale of the original shape back to 1, and then keyframe a Z rotation to the original sphere (try rotating it about 500 degrees in 40 frames). Now, as the animation plays back, the soft body shape will balloon out because each particle is being forced away from the original shape by centrifugal force. When the original sphere stops rotating, the soft body shape will oscillate until it adjusts back to the goal shape. (You ll find a color version of the following image in the Color Gallery on the CD.)
By now, you should start to see how powerful a tool soft bodies can be, so let s kick things up a notch. Not only can you adjust the soft body s goal weight as a whole, you can do it on a per particle basis. First, set your object goal weight (goalWeight[0]) to 1. With the particle node selected, in the Attribute Editor s Per Particle (Array) Attributes section, you will see a new per particle attribute called goalPP. This attribute controls the goal weight of each particle individually, just as the other per particle attributes do. Tip Because goal weights are now treated like other per particle attributes, you can use the methods you learned in the previous chapter to create goal weight ramps and expressions to control goal weights. You need to set your object goal weight to 1 because the object goal weight is multiplied by the particle goal weight (if a particle goal weight is 0.5 and the object goal weight is 0.6, the final goal weight of the particle will be 0.3). If the object goal weight is not 1, there will be some play in the entire object, and you will not see the results pictured in the next graphic.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=300914015 (2 of 3) [11/27/2000 8:52:19 PM]
Books24x7 Mastering MAYA Complete 2
Adjusting Goal Weights Using the Component Editor Let s explore how to adjust goal weights using the Component Editor with our spherical soft body. In the text field next to the goalPP attribute, RM choose Component Editor. A window pops up that lets you control the value of a selected attribute. With the Component Editor around, move back into the scene window, and then switch to Select by Component mode and turn off all components but points. Note To change to Select by Component Type, select the Component Type button on the top toolbar (a cube with an arrow pointing at it). To turn off all types except points, choose All Components Off in the pop-up menu next to the button, and then click the Points button next to the menu (the black square). Your sphere should have a cloud of blue-purple points around it. Select half the points on the sphere (the top, say), and, under the Particles tab, select all the goalPP column, and change them all to a value such as 0.2. When you play your animation, the top half should spin away from the original sphere while the bottom half stays put. (You ll find a color version of the following image in the Color Gallery on the CD.)
As an exercise, can you use your knowledge gained from the previous chapter to create an expression that randomizes the goal weight? If you can t figure it out, see the next section.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=300914015 (3 of 3) [11/27/2000 8:52:19 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Using Goal Weights to Create Fluid Motion Let s put aside our sphere test project for a moment, and create a new one. Save the sphere project for use later in the chapter. In a new scene, create a nice, long, skinny cylinder (our tentacle), be sure that it has about 20 spans, and animate it to move back and forth on the X axis (try to make the motions happen at different speeds, including some very rapid motions). Then make the cylinder a soft body, this time hiding the original object and setting the goal weight to 1. (Note that, for space reasons, this and other images of the cylinder have been rotated sideways.)
When you play the animation, the (invisible) cylinder will move, forcing the soft body to follow. Because the soft body s goal weight is currently 1, it will move in perfect synch with the original shape not very exciting yet. Now let s create an expression to alter the goal weights based on where each particle is. RM choose Creation Expression in the text field next to the particle s goalPP attribute. In the expression window, type the following: float $scaling = 0.9; float $offset = 0.1; vector $pos = copyOfnurbsCylinder1ParticleShape.position; float $posY = $pos.y; copyOfnurbsCylinder1ParticleShape.goalPP = $scaling) + $offset;
((($posY + 1) / 2) *
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=194656476 (1 of 2) [11/27/2000 8:52:23 PM]
Books24x7 Mastering MAYA Complete 2
Most of the components of this expression are simply variable definitions. The one line that actually does something (the last line) tells Maya to assign each particle its goal weight based on how high up it is on the cylinder. The first two lines define a scaling and an offset constant. These variables adjust the range of values that the bottom equation will produce (in this case, 0.9 adjusts the range of goal weights to 0 to 0.9 instead of 0 to 1), and the offset of the values (in this case, the range will go from 0.1 to 1.0 instead of from 0 to 0.9). The next two lines read the (vector) particle position into a variable, $pos. This variable s Y component is then read into another variable, $posY. Tip You cannot directly read a single element (such as the Y component) of a vector attribute such as position into a scalar (float) variable. Thus, you have to first read the value into a vector variable and then take that variable s Y component and read it into another, scalar, variable. The final line of the equation grabs the relative position of each particle (which is always between 1 and 1) and renormalizes it to a range of 0 to 1. The scaling and offset values are then used to further refine the range of goal weight values. When you run the animation, on the first frame, each particle is assigned a goal weight between 0.1 and 0.9, and then, depending on your cylinder s animation characteristics, the tail will waggle more the farther down the cylinder you go.
Tip You can also paint goal weights directly onto objects like this tail using Artisan s Paint Attribute Tool. For more information on this tool, see Chapter 9, Working with Artisan. If your Component Editor is still open, you can look at the value of each particle by highlighting it (in component mode) and then clicking the Get Attribute button to see its value. We could, of course, have manually adjusted all the goal weights using the Component Editor, but it s sometimes nice to have Maya do the math for us. In this case, it would probably be just as fast to use the Component Editor to change the goal weights, but our expression gives us the ability (via the $scaling and $offset variables) to quickly play with the numbers to get the characteristics we want. Additionally, given a more complex shape with more points that are closer together, the above expression would be far faster than adjusting goal weights by hand. In short, use whichever way will prove faster and more flexible for your situation. Note For more on expressions and particles, see Chapter 23.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=194656476 (2 of 2) [11/27/2000 8:52:23 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Adding Springs to Soft Bodies If you created violent motion on your cylinder in the last section, you probably noticed that, when you played back the animation, the bottom of your tail looked more like a flimsy piece of clay than a tail, because it stretched all over the place. In other words, the soft body did not maintain its length; it didn t have a kind of bone structure inside it, helping it to maintain its length and volume. Even more obvious, each part of the tail looked separate; what was going on at the bottom of the tail had no effect on the middle or top not a good simulation of a tail! This is where Maya springs come in. They act (for the most part) just like little springs between each particle, helping them to maintain their shape better under the stress of violent motion and allowing the motion of one particle to affect the motion of others. Use your project from the last section (or, if you re not happy with that project, open the 24tail.ma file on your CD-ROM). Select your soft body shape in the scene window, and then choose Bodies Ø Create Springs Ø to open the Spring Options dialog box.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=843331408 (1 of 3) [11/27/2000 8:52:27 PM]
Books24x7 Mastering MAYA Complete 2
In the Spring Methods section, set Creation Method to All (all particles are connected). You can leave all the other areas of this dialog box in their default state. Click the Create button, and then close the window. Tip You can create per spring (PS) attributes for stiffness, damping, rest length, and end weights. If you don t create per spring attributes, Maya uses per object attributes, just as with particles. Though we won t discuss modifying springs on a per spring basis, the method is the same as for per particle attributes, and the results can be extremely subtle and beautiful. Note The new wire walk length setting controls how much structure there is to your object. A walk length of 1 sets springs to each particle s closest neighbors on all sides. A walk length of 2 sets springs between the 2 closest neighbors on all sides. At higher settings the object will have more structure, but there will be an added calculation cost, as a result of the higher number of springs. You will see a huge mess of dark dots (springs) covering your cylinder. As you play the animation, you will see the springs stretching and contracting to keep the cylinder moving in a more natural, connected motion. Once you get a look at the springs, you may want to hide them to prevent screen clutter.
Note Spring calculation times have been dramatically reduced in Maya 2. Though they can still be slow in complex objects, they are now far more usable than they were in version 1. With springs selected, you can (in the Channel box or Attribute Editor) adjust the stiffness of the springs (how resistant to bending they are) and their damping (how quickly they come back to rest after they ve been moved). Although very low stiffness and damping values make the tail play back as if no springs are attached, increasing stiffness and damping can often create the rigidity that makes an object like ours appear to have a constant length. Try moving the damping up to about 0.4, and set the stiffness to 1 or a bit higher to get the tail to bend a bit more stiffly and not stretch as much. If you re lucky, you ll see your animation play back as it should. If not, you ll see the simulation go out of control.
This bizarre behavior happens because Maya can t calculate the solution given its sampling rate (1 time per frame is default). The solution is to increase the sampling rate to allow Maya to better calculate the motion of the springs. From the Dynamics menu set, choose Solvers Ø Edit Oversampling. The Attribute Editor opens with one option: Oversampling Rate (which should currently be set to 1). Try setting this number to 2 and see if that fixes the simulation. If not, move up to 3, and so on.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=843331408 (2 of 3) [11/27/2000 8:52:27 PM]
Books24x7 Mastering MAYA Complete 2
Warning Increase the oversampling rate slowly it will severely affect your playback times! The number you put in the field is how many times longer the simulation will take to play than if the rate were set to 1, so increase by 1, and see if the simulation works; if not, increase by 1 again, and so on. Generally, very high values for stiffness and damping are not desirable anyway, so alter these numbers slowly as well. As you can see, springs can really contribute to more realistic motion for soft bodies, so keep them in mind when your soft bodies look a bit too much like stretched taffy!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=843331408 (3 of 3) [11/27/2000 8:52:27 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Faking a Bounce Because of the new structure of dynamics in Maya 2, you can now create a soft body that has a rigid body as a goal a nice new feature that was missing in Maya 1. However, there are times when, for control and accuracy (not to mention playback speed!), creating a bit of dynamics on your own can be advantageous. Tip The method for creating a soft body with a rigid body goal is the same as the one outlined earlier, except that you have to check the Duplicate Upstream Graph check box in the Create Soft Body Options dialog box. If you don t do this, the soft body will just go along for the ride, as if it had a goal weight of 1. Create a new scene with a ball and a plane, and then type the following expression for motion into the Expression Editor (or just use the 24bouncerAnimated.ma file on the CD). NurbsSphere1.translateY = 1 + (10 * (1 - linstep(0, 300, frame)) * abs (cos(time))); This equation makes the ball bounce (using the cos, or Cosine, function) lower and lower, until the ball comes to rest (using the linstep function). Tip The linstep function is useful. You give it a starting and ending value (frames here) and the unit it will be using (frames again), and then the function moves between 0 and 1 over that range. In this example, the value output by linstep increases from 0 to 1 over the range of 0 to 300 frames. (The smoothstep function performs the same function as the linstep function, except that it produces a smoothly varying curve instead of a straight line.) Now we have a bouncing-ball motion. Let s add a soft body, adjust its goal weights, add some springs, and see what happens. First, add a soft body and set its goal weight to 1. Next, using the Component Editor (or the expression for goal weights given earlier), set the top points of the sphere to have a goal weight near 0.5, and set the bottom points to have a goal weight near 0. Keep playing with the values until you get a look something like this. (You ll find a color version of this image in the Color Gallery on the CD.)
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=919776084 (1 of 2) [11/27/2000 9:31:39 PM]
Books24x7 Mastering MAYA Complete 2
In playing back the animation, you should see the ball (the bottom especially) jiggle quite a bit. Although this could be a useful effect by itself, let s add some springs to it to give the whole ball a more connected look. Select the soft body sphere and add springs to it (you might try increasing the walk length to 2 here to give the ball more structure). When the ball bounces now, it reacts more connectedly, its sides moving in as the ball bounces away from the plane (thus imitating real life by preserving volume). Additionally, the ball now wiggles much less, because the spring dampens the extra motion of course, this is adjustable via the damping and stiffness controls. (You ll find a color version of the following image in the Color Gallery on the CD.)
One last thing to check out with these springs is using the rest length setting (available in the Channel box or Attribute Editor). First, be sure the restLengthPS setting is off, and then try adjusting the rest length. If you set the number to 0, the ball will shrink dramatically; whereas if you set the value to 5 or 6, the ball will expand. The rest length tells the springs how far apart they should be when resting (in other words, when they re not being moved by forces or collisions), so the larger the number in the field, the bigger the distance between springs (and thus points), and thus the larger the sphere. Tip One great new feature is the ability to place springs between standard particles (not just soft bodies). You can connect a stream of emitter particles to form an interacting group, enabling you to produce anything from a simulation of molecules in a room to a blob that can shoot across the screen. For more information on adding springs to standard particles, see the Springs topic in the Maya 2 online reference. Also see 23cloud-srping.mov in the CD for an example of particles using springs.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=919776084 (2 of 2) [11/27/2000 9:31:39 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Denting Soft Bodies To see how we can use soft bodies for modeling as well as animation, we re going to take a look at two ways to create an asteroid: "
By using a turbulence field to distort a sphere
"
By using an emitter to bombard the sphere with particles
Open a new scene and create a sphere with about 32 spans and sections (so that the soft body will have lots of points on it). If you wish, you can stretch the sphere up a bit, since no one ever heard of a perfectly round asteroid!
Save this project now as a separate file, because we ll use the sphere again when we create an asteroid using a particle emitter. With the sphere selected, choose Bodies Ø Create Soft Body Ø. In the Soft Options dialog box, set the Creation Options to Make Soft. Note Choosing Make Soft tells Maya to convert the object to a soft body (there will no longer be any original geometry). Because there is no goal object, there is no goal weighting for this type of soft body.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=463587021 (1 of 4) [11/27/2000 9:32:04 PM]
Books24x7 Mastering MAYA Complete 2
Now, with the new soft body selected, choose Fields Ø Create Turbulence Ø, set the magnitude (force of the turbulence) to about 5 and the frequency (the number of waves of turbulence) to about 20, and create the field. As you play the animation, you will see the sphere distort under the influence of the turbulence field. Since there is no goal weight to bring the sphere back, the sphere will distort too much if the animation plays back too long. Try a few settings for magnitude and frequency, and stop the animation at a frame where you like the look of your new asteroid. (You ll find a color version of the following image in the Color Gallery on the CD.)
Now that you have the shape, getting it to be a permanent model is as easy as duplicating the shape. With the soft body selected, choose Edit Ø Duplicate Ø. In the options window, be sure Duplicate Upstream Graph is off, and then duplicate the object by clicking the Duplicate button. Voilà, one ready-built asteroid! Note If you were to duplicate the upstream graph (the input connections), Maya would create another soft body that would then change with the turbulence field. By turning this option off, the model will be a standard node with no history. Tip If you see a group of points when you move your duplicate copy (the duplicate soft body points), you can simply delete them. You can now either delete the original shape or alter its shape and the magnitude and frequency of the turbulence field to make a few more asteroids. Note You can also turn lattices into soft bodies. As an exercise, try adding a lattice shape to your original sphere, turning the lattice into a soft body and then adding a turbulence field to the lattice. How does this alter the way the distorted sphere looks? You might like the results better. Now that we ve used a field to convert a sphere into an asteroid, let s try using an emitter plus a field (emulating lots of little meteorite collisions) to do the same thing. Open your original sphere, and make it a soft body, using the Duplicate, Make Copy Soft option, checking the Make Non-Soft a Goal box, and setting the goal weight to 0. Next, create an emitter that shoots particles at a rate of about 50 toward the sphere.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=463587021 (2 of 4) [11/27/2000 9:32:04 PM]
Books24x7 Mastering MAYA Complete 2
Select the particles (not the emitter), and choose Fields ØAdd Air Ø (be sure you choose Add, not Create). In the options window, click the Wind button, and then set the Magnitude to 20, the Directions X, Y, and Z to 1, 0.1, 0.1, respectively. Be sure Use Max Distance is on, and set it to 1; then click Add and close the window. You will now have a wind field that is owned by each particle (the air icon will move along with the particles if you play the animation). Because the Use Max Distance setting is on and because the distance is only 1 unit, each particle will create a little ball of wind around it that will affect any object connected to it. What we need to do now is simply attach the sphere s particles (not the emitter s) to the wind field, and the field will distort the surface of the sphere. Select the soft body sphere, and then open the Dynamic Relationships Editor (choose Window Ø Relationship Editors Ø Dynamic Relationships). On the right side, highlight the airField1 text, and then close the window. Because the particles now strike the sphere, it will distort probably more than you want it to! Never fear we re going to use a little trick from earlier in this chapter to fix that problem. With the soft body again selected, open the Expression Editor and type in the following expression: goalPP = rand (0.3, 0.6); This expression simply sets the goal weights of the soft body s particles to a random number between 0.3 and 0.6. Now, as the particles (plus their air field) pass through the sphere, different parts of the sphere will react in differing amounts to the air field, creating a more interesting look to the distortion.Try adjusting the numbers for different effects. Note You will need to be sure that the per-object goal weight is set to 1 for this effect to work properly. Also, you will need to increase the magnitude of the wind field to about 500 to see results. To get an even spread of dents, try rotating the sphere around its Y axis twice (720 degrees) over about 200 frames (select the sphere, and then key its Y rotation value between 0 and 720). One last adjustment we can make is to force the particles to collide with the sphere. You may have noticed that, now, the particles pass through the sphere and dent it outward on the far side of the object not what a meteorite collision would do! Select the emitted particles first, Shift-select the sphere, and then choose Particles Ø Make Collide. Now, when the particles strike the sphere, they bounce off, creating only dents, not stretches in the sphere. Tip You can make a couple of adjustments to fine-tune your collisions: (1) try increasing the magnitude of the wind force to about 1000; (2) change the value of the resilience for the collision, and see what different values produce. A low resilience will keep the particles around the sphere longer, creating deeper pits.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=463587021 (3 of 4) [11/27/2000 9:32:04 PM]
Books24x7 Mastering MAYA Complete 2
Although playback can be a bit slow with fields and collisions turned on, you can do millions of years of damage to your asteroid in just minutes! You ll find a color version of the following image in the Color Gallery on the CD.
To create a permanent model from your new asteroid, simply stop on a frame you like and duplicate the object, as we did earlier. As you can see, soft bodies can be a fast way to create organic, or beat-up, shapes.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=463587021 (4 of 4) [11/27/2000 9:32:04 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Advanced Hands-On Maya: Adding Ripples to the Fountain Project If you thought we were finished with the fountain project after the previous three chapters, guess again. We have been leaving out an important part of our animation: the plane that the water drops strike. In real life, of course, the water in a fountain is agitated from the water that constantly falls on it not like our flat and unassuming plane at all. To correct this, we ll make the plane a soft body and let the particles collide with it by having them carry an air field with them, just as we did earlier with the asteroid. Warning Creating the large number of particle collisions in this project can be time-consuming. If you don t have a fast computer, you might want to just read through this section or just attach an air field to the first group of particles. Open your fountain project from the previous chapter (or use fountain3.ma on the CD-ROM). Select the plane, go to makeNurbsPlane1, and then increase the U and V spans to about 50 so there will be more points for the soft body you will create. For a more accurate simulation, you can increase this number, but remember that Maya will slow to a crawl on all but the fastest computers, even at this setting. It s going to have to do a ton of calculations for each point on the grid! Once your plane is subdivided, make a soft body out of it, using the Duplicate, Make Copy Soft option and setting the goal weight to 0.4. Once the plane is a soft body, you need to add an air field to particles 1 and 2 (and 3, if you want even longer render times!). Select each particle group, and then add (not create) an air field, just as we did in the previous section. Set the magnitude to about 500, the X and Z directions to 0.5, and the Y direction to 1. Be sure the Use Max Distance check box is on, and set the max distance for particle1 to about 1; set the max distance for particle2 (the smaller ones) to about 0.5 so that they will make smaller splashes. Once the air fields are created, link them to the soft body plane (choose Windows Ø Relationship Editors Ø Dynamic Relationships; then highlight the air fields).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=175006270 (1 of 2) [11/27/2000 9:32:24 PM]
Books24x7 Mastering MAYA Complete 2
You can now (attempt to) play back your animation. You will probably find, however, that the playback speed is so slow that it is difficult to see the motion of the particles and waves. To compensate for this, either playblast (choose Windows ØPlayblast) or hardware render the scene. When you can view the motion of the plane, you should see reasonably good results. Each collision dent, however, simply exists on its own; the waves don t connect and move. To solve this, we need you guessed it springs (as if playback weren t slow enough already). Here is where the real compromises begin. It would be ideal to create springs between all particles, using a large walk length (such as 3 or 4); however, unless you have a beastly computer with lots of RAM, this will not be possible, because the process of creating springs will generate a memory error (there is not enough memory to create all the springs needed). Instead, try creating springs with a wireframe setting and a walk length of 1 (so that each particle is connected only to its nearest neighbor). Tip If you have a fast computer with lots of RAM (512MB or so), try using a Min/Max setting, with a minimum spacing of about 0.1 (or just 0) and a max of about 2. This will produce better results, because more particles are connected, but it will be slower than the wireframe choice. The waves will not propagate outward fully now, but the effect will still be better than it was. Set the damping value of the springs very low (at 0.05 or lower) so that the waves continue moving after the collision, and set the stiffness to a middle value such as 0.6. When you look at your playblast or hardware render of the scene, notice how the waves interact with one another and with the particles. If they don t look good enough to you, try adjusting spring stiffness and damping, as well as air field magnitude and max distance. With some patience (for the renders!) and experimentation, it is possible to get good-looking results. A final render of this scene is available on the CD-ROM (24fountain.mov). When creating complex dynamics simulations involving soft bodies and especially springs the art of a successful project is often a compromise between the best settings and those that aren t quite as accurate, but will get the job done on deadline. If, for example, this fountain was a background element of your scene, it would make no sense to create such a time-consuming, accurate simulation. Simply make the plane a soft body, and add a turbulence field to simulate ripples. If, on the other hand, the fountain will be the center of attention, it is probably worth the effort to create this effect, because the inaccuracy of a simple turbulence field will call attention to itself. You, the artist, must decide where perfection and efficiency meet in these situations.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=175006270 (2 of 2) [11/27/2000 9:32:24 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Advanced Hands-On Maya: Creating a Watery Body and Face For the second advanced tutorial, we re going to build a long neck with a face attached to the end of it. We ll make this figure a soft body and then animate the face and goal weights, creating an effect similar to the ground-breaking effect in the film The Abyss. Open the file 24abyssDeformed.ma on the CD-ROM. If you play back this scene, you will see the pseudopod move in a bending path toward you, the face finally ending up looking at you. Let s now use some blend shapes to alter the face s expressions (two blend shapes are built into the CD-ROM file). As the face moves through the tube, shut its eyes, and give it a neutral expression. When it stops (after about frame 160), have it go through two or three more expressions, and then return it to neutral by the end of the animation (about 400 frames). Tip If you want your file complete with blendshapes and lighting, use the 24abyssBlended.ma file on the CD-ROM. Now for the soft body stuff. We re going to turn the whole pseudopod into a soft body, adjust the goal weights on it, add a turbulence field to it, and then animate the goal weights to make the face pop out of the pseudopod. First, drag a selection marquee around the entire body; then make it a soft body with Duplicate, Make Copy Soft, and a goal weight of 1 (we ll adjust individual goal weights later). Test the soft body to be sure it animates properly (if not, go back to the saved version and try again). Because the goal weight is currently set to 1, the animation should look pretty much the same as before. This is where things get tricky (it s an advanced tutorial, after all). Because the head is constructed of several (eight, to be exact) objects and because we need to vary the goal weight, we need to control all of them via an expression that we ll cut and paste into each particle shape s goalPP attribute. First, however, find the two long cylinder pieces, and change their global goal weights to 0.5. They will be at this goal weight constantly, so we don t need to do anything further with them. Now, type the following into the Expression Editor, and copy it so that you can paste it into all eight goalPP runtime expressions. float $goalStart = 0.6; float $goalUp = (0.6 * smoothstep (181, 190, frame)) + 0.25; float $goalDown = (0.6 * (1 - smoothstep (361, 385, frame))) + 0.25;
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=324825204 (1 of 2) [11/27/2000 9:32:34 PM]
Books24x7 Mastering MAYA Complete 2
if (frame <=180) { goalPP = $goalStart; } else if ((frame >180) && (frame <=360)) { goalPP = $goalUp; } else goalPP = $goalDown; This expression sets the goal weight of each particle based on which frame it is in the animation. Early on (during the pseudopod s motion), the goal weight is lower. In the middle, during the facial expressions, the weight is higher, rising using a smoothstep function. At the end, again, the weight is lowered back down using a smoothstep function. Tip You could also control the goal weight for each segment of the face by keying the per object goal weight. This technique is more intuitive, but requires keyframing eight objects. Use the method that seems easier to you. Now that the goal weights are animated, let s add a bit of turbulence. Drag-select all the soft bodies, and then choose Fields Ø Create Turbulence Ø. Set Magnitude to about 60, Attenuation to 0, Frequency to a high number such as 100 or so (this will make for smaller waves), leave Phase as-is (at 0), and set Use Max Distance to off. As a final touch, we parented the air field to one of the head soft bodies so that the turbulence would travel along with the form. You might like the turbulence to stay in one place while the figure moves through it; try both ways and see which you prefer. If you like your animation, all that s really left is to create and apply a water texture. Try creating a phongE shader with a pale blue color (almost white), slightly roughened, but tight and bright specular colors, and a good deal of transparency (only the highlights of water really show well). You might also add a background image or geometry and set the shader to have a refraction and reflection so that it looks more like water. A finished movie is available on the CD-ROM as 24waterHead.mov, and you can see a rendered still in the color insert. Note For more on how to create materials, see Chapter 18,
Rendering Basics.
This animation (and the fountain we developed earlier) should take you a good deal of time to get right. Work like this is the culmination of your understanding of the entire Maya dynamics package, so, when you do finish, congratulate yourself on a job well done!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=324825204 (2 of 2) [11/27/2000 9:32:34 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 24 - Dynamics of Soft Bodies Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary In this, the final chapter on Maya dynamics, you learned what soft bodies are, how to create them, and how to use them for everything from simple animation effects, to modeling, to adding the final touch to complex projects. As a group of particles that act as a whole, soft bodies are a unique blend of form and motion, allowing us to create effects that would otherwise be so difficult to do correctly that we probably wouldn t. Although this chapter indeed all the chapters in this section only begin to reveal the power of Maya dynamics, we hope that you now have enough knowledge and the confidence to continue experimenting and working on your own. Think of something you always wanted to animate that has clouds of dust or jiggling, organic figures in it. Now go on and create that animation! In the final chapter, we will look at Maya 2.5 s new Paint Effects module, which provides a different way of creating organic, variable effects. Although it is not directly related to particles, Paint Effects use of tubes, expressions, and random variability should be much easier to grasp now that you have a solid understanding of how Maya s particle system works.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=943095533 [11/27/2000 9:32:42 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Chapter 25: Paint Effects Overview Have you ever walked through a forest or a field on a beautiful fall day, and thought to yourself, Wouldn t it be great if someday I could render a scene even half as complex and beautiful as what I m seeing right now? If you re a CG artist, we re sure you have many times. However, up until the release of Maya 2.5, with its new Paint Effects module, the dream of rendering a fully 3D natural environment or other organic object (like hair, plants, or food) has been an onerous task involving proprietary software and loads of difficult modeling and animation. It s little wonder that, until recently, most CG work has involved lots of spaceships and desert planets! The complexity of the problem facing the computer artist in recreating nature s many wondrous sights has been daunting, to say the least; not only are there thousands of details to recreate, they must all look natural (e.g., no straight lines or simple repetitive textures) and, ultimately, they all need to move about in a realistic fashion. This bewildering array of technical and artistic problems has kept all but the bravest CG pioneers firmly in the land of artificial objects or simple backdrops. With Paint Effects, however, the rules have changed. Paint Effects is a brush-based paint program that lets you paint textures onto 2D objects (like the default canvas) or a texture map for a 3D object. (Its interface will feel similar to the Artisan brushes you used in Chapter 9.) More uniquely, you can paint 3D objects into your scene, fully textured and animated all at the drag of your mouse or graphics tablet! You can paint hair, trees, grass, cornstalks, pasta, or many other default Paint Effects brushes into your scene, or you can get really creative and start making your own brushes, either using the included brushes as templates or designing them from scratch. If you paint a 3D object into your scene and wish to change its parameters (its texturing or how much it blows in the wind, for example), you simply select the node in your scene (Paint Effects brushes are node-based, just like the rest of Maya) and change whatever attributes you wish! It s hardly an exaggeration to say Paint Effects will change the way you work and even the way you think about CG work; more importantly, it will give you a huge edge over your competition, who will have to pick up their jaws off the floor when they see your work!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=578708619 (1 of 2) [11/27/2000 9:32:49 PM]
Books24x7 Mastering MAYA Complete 2
We introduce Paint Effects tools in a gradual, logical manner in this chapter, building your knowledge of this new feature step by step. This method will give you an excellent basic knowledge of Paint Effects, but you may wish instead to read the chapter out of order, skipping ahead to sections you are most interested in first. Feel free to read the chapter sections in any order you wish, and, most of all, play with Paint Effects as much as you can while you read this chapter. You will discover that a bit of guided interaction with a particular brush is your best instructor.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=578708619 (2 of 2) [11/27/2000 9:32:49 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Paint Effects Theory Paint Effects uses a splat -based (or tube-based) rather than geometry-based model for painting in both 2D and 3D. Thus, Paint Effects brushes can be rendered very quickly (compared to geometry) while still maintaining a high-quality look, plus texturing capabilities. Because the brushes are tubes (actually just curves) that can be rendered into three dimensions, you can work very interactively with the brushes (especially in wireframe mode) while producing astoundingly realistic effects. Also, because the rendering is done on the fly, you can freely move a camera (or the Paint Effects objects) in the scene, and the brushes will render properly from any angle. The combination of interactive modeling (though painting is closer to one s actual interaction with Paint Effects), fully 3D renders, and high-quality texturing and shadowing make Paint Effects an eminently usable feature, right out of the box! Additionally, being able to add forces like turbulence, wind, and gravity to any Paint Effects brush means that you can animate your scene in a quick, intuitive manner that looks great. Note The forces you apply to Paint Effects brushes are not actually calculated by Maya s dynamics engine, but are in fact expressions applied to the brush tubes. This means you can animate several trees, or the hairs on someone s head, with very little penalty in interactivity or rendering. Paint Effects takes advantage of the depth buffer to do its rendering magic. The Paint Effects renderer uses the depth (or Z) buffer, in addition to six other buffers, to figure out where paint strokes should be placed in the 3D scene, then it splats the objects there, fully anti-aliased and rendered. The Paint Effects renderer is not a scan line based rendering pass, it is actually a post process, meaning that all geometry is rendered first, and then the Paint Effects elements are added into the render. While Paint Effects is a post process, however, it allows things like transparency (which is traditionally not possible in depth buffer effects), out-of-order draw, glowing paint strokes, depth of field, and motion blur (both 2D and 3D). The strokes are tubes that can be fully drawn along their length and separated by gaps, and nearly all Paint Effects elements (or attributes) can be keyframed or animated or both. If Paint Effects sounds groundbreakingly, earth-shatteringly fantastic, just wait until you see how easy it is to use. After reading just a few pages here, you should be up and running with this feature, which is worth the price of admission to Maya 2.5 Complete all by itself. But enough superlatives, let s get painting!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=356381012 (1 of 2) [11/27/2000 9:32:55 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=356381012 (2 of 2) [11/27/2000 9:32:55 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Strokes and Brushes Artists always begin by selecting their tools. To use Paint Effects, you first have to decide what line and effect you re going to produce or, in this case, what your stroke and your brush should look like. Once you have a clear vision of the look you re after, you can create or modify the tools (strokes and brushes) to match what you want. Working with Paint Effects is a great deal like choosing a traditional paint brush and paint (the brush), and then setting down the appropriate line (or stroke) for the effect you re after.
Strokes Strokes are the basic element that underlies all that Paint Effects does. They are, in essence, curves drawn in real time by your mouse or graphics tablet, and they can take the form of curves on a canvas, on a 3D surface, between surfaces, or even on the Maya grid plane. Wherever they are placed (or painted on ), strokes are the curves that either define the shape of a brush directly (as in a stroke of air-brushed paint) or emit brush tubes from them (as in grass blades or entire trees). While brush strokes are not particles, if they are set to emit tubes from their base curve, they can grow these tubes as you paint, the blades of grass, hair, or branches of a tree sprouting up from the stroke curve. In the case of trees, for instance, the strokes can emit a base branch, then sprout further branches and sub-branches, then sprout leaves, buds, or flowers. Alternatively, if you have already created a curve, you can convert it into a Paint Effects stroke, and your selected brush will be applied to the curve. If the stroke uses only the base curve you draw, paint will be applied to the curve itself. If the stroke emits tubes, the original curve will render invisible, and the paint will be applied to the tubes emitted from the curve. Tip Because tubes are emitted and grow (over time) from a Paint Effects brush, their growth can actually be animated, along with their other features. Thus you can create a field of flowers that grow up from the ground, or make a model s hair grow longer while the animation plays. You ll learn more about how to create this effect later in this chapter.
Brushes
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=115990485 (1 of 3) [11/27/2000 9:33:04 PM]
Books24x7 Mastering MAYA Complete 2
Brushes are a set of growth and render options (or attributes) you set for a given curve; more simply, they are the paint you choose to paint with. Thus, while strokes define the shape of the curve you paint (as in a painter s brush strokes), brushes define the look of the paint. There are nearly four hundred built-in brushes, including tube-shaped animals (snakes), animal elements (flesh, hair), natural phenomena (clouds, lightning, stars), traditional brushes (oil, felt pens, air brushes), metals and glass, plants of all varieties, and food (pastas, hamburger, corn). As you would expect from Maya, all these preset brushes are infinitely adjustable and animatible, allowing you to modify the built-in brushes to your fancy and save these new brushes for later use. Brushes are stored in Maya2.5\brushes (on NT, the path would likely be C:\AW\Maya2.5\brushes) and are accessible in Maya in the Visor window (Window Ø Visor) or in the Visor subwindow of Hypershade (Window Ø Hypershade). On opening the Visor (or Hypershade), scroll down to the bottom of the window, and click to twirl down the spin arrow next to the Maya2.5\brushes text. This allows you quick access to Paint Effects thirty-plus folders of brush presets.
Open any folder, and inside will be brushes you can select simply by clicking on an icon. If you roll the mouse over an icon, the name of the brush will appear. Select a brush (say, Delphinium from the Flowers folder) and note that your mode is now set to the Paint Effects tool in the toolbar and that your cursor has changed to a pencil icon with a red circle under it (again, similar to the Artisan cursor).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=115990485 (2 of 3) [11/27/2000 9:33:04 PM]
Books24x7 Mastering MAYA Complete 2
Click inside your Scene window and paint a stroke or two. You will see the outline of several flowers appear. As soon as you release the mouse button, the flowers will reduce to a rudimentary outline, and you will see the base curve (the actual curve you drew) highlighted on the scene grid. You may also notice that the flowers are painted on the Maya scene grid; this is because the Paint Effects tool defaults to painting on the scene grid (or the X-Z plane) if no other objects are selected and set to be paintable.
Note In order to keep the scene responsive to your input, Maya automatically reduces the complexity of the curves and tubes it draws with the Paint Effects tool. You can adjust this reduction to your liking (see Animating Brush Strokes later in the chapter). You may wonder why your brush strokes, while interesting, look nothing like a fully rendered flower. The answer is that, in order to see what your brush strokes will look like, you must paint in a special Paint Effects window, rather than in the default Scene windows. You can define this window to be either a 2D canvas or to mimic the perspective (or other) camera in your scene. We will begin with painting on a 2D canvas in the next section, and then move on to painting in a 3D environment later in this chapter.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=115990485 (3 of 3) [11/27/2000 9:33:04 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting on a 2D Canvas At its simplest level, Paint Effects looks a lot like traditional paint programs (MetaCreations Painter, for example). You simply paint on colors or alter colors already present and create a painterly image in two dimensions. Start with a new Scene window (or erase the strokes you painted previously choose Edit Ø Delete All by Type Ø Strokes), and then choose Window Ø Paint Effects to open the Paint Effects window. You will probably see what appears to be your perspective view with a new set of icons at the top of the window. This is, in fact, the 3D environment for painting in Paint Effects. For now, we wish to paint on a canvas, so choose (from the panel menu bar, or RM choose) Paint Ø Paint Canvas. You will now see a large white canvas on which to paint, with a set of new icons at the top of the window.
Tip To switch from your Scene view to the Paint Effects window and back, just press the 8 key on your keyboard (not on the number pad). As you will likely switch back and forth from the Paint Effects window to the Scene window(s) many times in a project, it is a good idea to memorize this shortcut. When you are in the Paint Effects window, you can momentarily access the Scene window (to pick an object, say) by holding down the Ctrl key and clicking in the window. First, try painting on a few brush strokes. If you ve been painting and have a brush still selected, you will see that brush painted on the canvas. If you have just opened a new session of Maya, you will see a black brush stroke (the default brush) painted on the window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=828858463 (1 of 3) [11/27/2000 9:33:13 PM]
Books24x7 Mastering MAYA Complete 2
Note In the 2D view, you have just one level of Undo, and it can only be accessed via the panel menu (Canvas Ø Canvas Undo) not by the usual Z key. You can assign this function to a hot key (like Ctrl+Z) via the Hotkey Editor (see Chapter 2 or 16 for more on assigning hotkeys). Once you have painted a few brush strokes, you may wish to clear the canvas, so you can paint on new strokes. To do so, choose Canvas Ø Clear, and the Canvas will be reset to its initial color (probably white). To change the background color of the canvas, choose Canvas Ø Clear Ø, and choose a new color for the canvas from the Clear Color color chip. Clear your canvas, choose a new brush from the Visor, and paint something interesting! You may find that on a traditional canvas like this, the more traditional brush types (oil paint, pens, air brushes, and such) look better than the organic brushes, but it s your canvas, so you get to decide. If you have a graphics tablet, you will find that many brushes have a built-in dependence on pressure, changing everything from color to size as you press harder with your stylus. You will also notice that as you move your cursor faster, many brushes will segment, not following your strokes in a continuous manner; this is because the brush strokes are merely a collection of stamps that the program places as you drag your mouse or stylus over the canvas. Thus, if you paint fast enough, you can outrun the spacing of the stamps and produce blank spaces in between. Sometimes this effect might be useful and sometimes not, so remember that Paint Effects is actually responding to the speed you draw your curves. After you experiment a bit, clear your canvas once again (Canvas Ø Clear) and turn on horizontal and vertical Wrap. You can choose Paint Effects Ø Paint Effects Globals Ø Canvas and toggle on Wrap H and Wrap V, but it s simpler just to click the Wrap icons in the Paint Effects window toolbar. Now that you have Wrap on, try painting a brush stroke that goes beyond the edges of the canvas. You should see the stroke continue on the other side of the canvas, as if the canvas were wrapped into a ball where all sides meet together, like the canvas shown on the following page. This effect is, of course, extremely valuable for creating seamless tiles you could use as repeating textures in your Maya scene.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=828858463 (2 of 3) [11/27/2000 9:33:13 PM]
Books24x7 Mastering MAYA Complete 2
If you wish to see how the edges of your canvas look for this, or any set of brush strokes, you can roll the canvas in any direction using the Canvas Ø Roll Ø - commands. You can, for example, roll the canvas halfway horizontally (by selecting Canvas Ø Roll Ø 50% Horizontal) in order to see the vertical seam in the middle of the canvas. Another roll of 50% Horizontal and your image is back to where you started. If you have a texture that is not currently seamless (or just for other effects), you can change the brush mode from Paint to Erase, Smear, or Blur, and alter the paint that is currently on the canvas. Choose Paint Effects Ø Template Brush Settings (from the Rendering menu set), or click the paintbrush icon in the toolbar to bring up the Paint Effects Brush Settings window, which allows you access to all of the brush s settings. For now, just change the Brush Type pop-up to Erase (or whatever you prefer) and paint over your image. You will see that the brush stamp is now painting on an erase (or smear or blur) effect, which can make for very intricate effects, as illustrated on the next page. To save your image (if you wanted to use the image as a texture file, for example), you can either click on the Camera (Save Snapshot) icon, or choose Paint Ø Save Snapshot, and name the file. You can further modify the image in another program (like Adobe Photoshop) or use the file as a file texture on a scene object (see Chapter 19 for more information on using file textures).
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=828858463 (3 of 3) [11/27/2000 9:33:13 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Modifying and Saving Brushes In addition to simply using the presets Paint Effects gives you, you can alter just about every parameter for a brush, and then save this modified brush setting for later use. There are several ways to modify the look of a brush; we ll go from the simplest method to the one that offers the most control.
Using the Toolbar Sliders To make basic adjustments to color and transparency, you can simply change the color chips or sliders that reside on the top-right side of the Paint Effects toolbar. Clear your canvas, and then choose the Putty brush from the Oils folder. Draw a few strokes onto the canvas to see what the default brush looks like. Tip You may wish to scale your brush up to see the strokes better. To do so, just use the same hotkey as the outer brush radius for Artisan: the B key. By holding down the B key and dragging your mouse left and right, the brush stamp size will interactively change on the canvas, allowing you to see how large your brush will be.
For the Putty brush, you will only see two color chips and sliders in the toolbar (one pinkish, which sets color, the other a dull gray, which sets transparency). Change the pinkish color to something else by clicking on the color chip; then paint a few strokes to see your new brush in action. Next, increase the transparency (the gray color) by moving the slider to the right and paint some more. Your new strokes should look less solid (or more transparent) than before. Note You may have noticed that changing a brush setting will not affect your old brush strokes. Paint Effects strokes are each stored on a separate node (or, in the case of 2D work, they are just painted pixels), and thus will not automatically update when the brush profile is altered. In 3D scene painting, you can select and change old strokes, as we will see below.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (1 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
If you like the brush you have created and wish to use it again in future work, you ll want to save the profile so you don t have to make the same changes over again. You can either save the brush to a shelf or in the Visor. To save the template, choose Paint Effects Ø Save Brush Preset. In the Label field, name your brush (Blueputty, perhaps); in the Overlay Label field, type in any letters you would like to have printed on the icon overlay (this will only be visible if the brush is saved to a shelf). Choose either To Shelf or To Visor in the Save Preset box and, if you wish to save the brush to the Visor, type in the path to the directory where the brush will be saved. Finally, you can capture an image of the brush as an icon by clicking the Grab Icon button and then drawing a marquee around some strokes your brush made.
Note Although Paint Effects is still a young program, most users already seem to prefer saving brush presets to a new shelf tab rather than to the Visor. This way, you can have ready access to different brushes in a convenient shelf. Of course, the choice of where to save brushes is completely up to you! For more information on creating shelves, see Chapter 2.
Blending Brushes For broader brush control than is available through the color and transparency sliders, you can easily combine two or more brushes into a third brush that shares the qualities of both parents. Reload your basic Putty brush by selecting it again in the Visor. Now let s combine this brush with something natural, like the fernOrnament brush in the Plants folder. Be sure the Putty brush is selected first, then roll your mouse over the fernOrnament brush and RM choose Blend Brush 50% (you will see several other blend modes, which you can play with as well). Now when you paint strokes onto the canvas, you will see that your brush has become a sort of hybrid between the putty and fern brushes. If you continue to RM choose Blend Brush 50% from the fern brush, you will continue blending the brush toward the fern look, and your strokes will look more and more like the basic fern preset.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (2 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
For even more control over the blending of shapes and shading between two brushes, choose Paint Effects Ø Preset Blending, and adjust the two sliders for shape and shading. If you then choose another brush preset, it will be blended in with the other brushes according to the percentages you set. This way in just a few minutes of experimentation, you can create completely new, unique, and fun brushes for your own use. Try some blend of ferns, grass, and hair, and see what you come up with! To remove the blending effect, simply close the Brush Preset Blend window, and the next brush you pick will be loaded at 100%.
Using Brush Settings The final way to adjust brushes is to use the Paint Effects Brush Settings window (Paint Effects Ø Template Brush Settings). Here you have access to the guts of any Paint Effects brush, with control over everything from brush profile to lighting and shadowing effects to animation and forces. There are literally hundreds of settings you can adjust here (try twirling down some of the arrows to see how many nested menus there are!), so there is simply no way to cover all of them here. Tip If you need information about a specific setting, look in Using Maya: Paint Effects, which was included with the manuals that shipped with Maya Complete. You may also find that simply altering the setting and examining the resulting look of the brush will give you enough feedback about the purpose of this setting that you need look no further.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (3 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Instead, let s take a look at a few settings, and you can experiment with others as you go. It is no understatement to say that getting to know the Brush Settings window is paramount to becoming a skilled Paint Effects user. This window is where all the action is, and you need to understand enough to make intelligent changes to the settings in this window to control how your brushes will look. Let s start with a simple brush. Choose the markerRed brush (in the Markers folder). Paint a few strokes to see what the marker looks like in its default setting, then clear the canvas. Open the Brush Settings window (either click the paintbrush icon in the toolbar or choose Paint Effects Ø Template Brush Settings) and twirl down the Brush Profile settings. From this group of controls, you can set, for example, the Brush Width, Softness, and Stamp Density of the brush (how frequently the brush creates a new stamp of its image as you drag your mouse). Try setting the Brush Width bigger, the Softness very small, and the Stamp Density to a large number (like 10). You should end up with something that looks like a bunch of interconnected circles a very different-looking brush from the default marker! The Stamp Density placed the circles very close together, the Brush Width (obviously) increased the size of the stamp, and reducing Softness created sharply defined circles instead of a blurred stroke.
Under Shading, you can adjust the color, incandescence, and transparency of the marker brush. Illumination allows you to light the strokes (when Illumination On is checked), choose the light s direction (the Real Lights setting will not function in Canvas mode), and add effects like specular highlights to the brush. By setting Fake Shadow to On under Shadow Effects, you can add either a 2D offset shadow (a drop shadow) or a 3D cast shadow (the 3D cast often works best in scene painting mode). Under the Glow tab, you can set several Glow attributes. You can set Gaps in your brush, so it appears more like a dotted line than a continuous curve, via the Gaps sub-menu. Finally, under Flow Animation, you can actually animate your brush strokes (more on this under 3D painting). Experiment with any or all settings and see what your brush ends up looking like. The next illustration shows a sample of a modified brush with gaps, and you can see a color version of this in the Color Gallery on the companion CD.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (4 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you have a graphics tablet and want to map brush properties to stylus pressure, go to the Paint Effects Tool Settings window (Paint Effects Ø Paint Effects Tool Ø). In this window, you have control over any three attributes you wish to map to pressure. Simply pull down the mapping pop-up, choose an attribute to map, and set the min/max values. Now let s try a tube-based brush, to see how we can actually alter the attributes of the tubes that grow from a brush like this. Select the fernOrnament brush from the Plants folder, draw a few test strokes, and then open the Brush Settings window. You can, of course, alter any of the color, lighting, shadow, and other settings we discussed above, but here let s look at the Tubes attributes. Twirl down the Tubes settings, and then twirl down the Creation sub-menu. If you set the Tubes per Step very high (like 7 or 8), you will no longer get individual fern fronds, but a mass of fern-looking things.
While interesting, this density is calculation-intensive, so reset the Tubes per Step to a low value (like 0.2). Just a sample of the controls you have in the Creation section includes making your ferns very long by adjusting the Length Max setting, changing the tube start and end widths by adjusting the Tube Width1 and 2 settings, altering the number of Segments for each tube (more segments means more of a flowing curve) and, of course, randomizing several of the settings, so each fern doesn t look identical to its neighbor.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (5 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Creation is just the start, however; under the Growth settings, you can turn any of the following on or off, and adjust settings for them as well: Branches, Twigs, Leaves, Flowers, and Buds. The default fern only has leaves and buds turned on, so try turning on branches, twigs, and flowers, and see what happens. Without even changing the default settings, just turning on these options creates a rather interesting shrub-like brush, shown in the following illustration (there s a color version of this image in the Color Gallery on the CD).
Inside each of these Growth sections, you have control over how many items will be created, at what angles they split off from their parent tubes, whether all tubes will have children (the Dropout rate), whether the new tubes will twist (and how much), how large they will be compared to their parent tubes, and several specialized settings for each element. As an experiment, let s create something that looks like a flowering wild rose tree. Our leaves and flowers are obviously too large for a tree, so we ll have to modify our Growth settings. The settings we chose for different aspects of the brush were done mostly by trial and error; we made adjustments and painted strokes until we were happy with the look of the tree. Table 25.1 lists a collection of settings that produces the rose you ll see below. Tip Be sure to experiment with all these settings as you go, and draw on the canvas to see how your changed settings are affecting the brush. Table 25.1 Settings for a Wild Rose Tree Aspect
Setting
Value
Branches
Num Branches
4
Branch Dropout
0.15
Middle Branch
on
Twigs
Twigs in Cluster
4
Twigs
Num Twig Clusters
2
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (6 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Leaves
Flowers
Buds
Twig Dropout
0.3
Twig Length
0.25
Twig Base
0.9
Tip Width
0.7
Twig Start
0.4
Twig Angle 1
107
Twig Angle 2
45
Twig Twist
0.3
Leaves in Cluster
4
Num Leaf Clusters
4
Leaf Dropout
0.25
Leaf Length
0.1
Leaf Base
0.05
Tip Width
0.001
Leaf Start
0.7
Leaf Angle 1
105
Leaf Twist
0.5
Leaf Flatness
1
Leaf Size Decay
0.48
Petals in Flower
10
Num Flowers
5
Petal Dropout
0.14
Petal Length
0.03
Petal Base
0.03
Tip Width
0.01
Petal Twist
0.1
Bud Size
0.02
Bud Color
a muted red
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (7 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Of course there are a multitude of possibilities here; we can t cover the effect of all of these options. To choose two examples, Twig Start sets how high up the tree the twigs will begin appearing; and Leaf Start determines how high up a tree its trunk and branches are bare. Experiment with all of the settings, and refer to Using Maya: Paint Effects if you want to read about a specific setting. For the buds, choose a color that stands out from the branch color. You can also change the two base leaf colors and how the two colors are randomized try setting the randomization values very high and see what happens. When you are finished, you should have a shrub-like tree with large reddish flowers on it. The color version of the following illustration can be found in the Color Gallery on the CD. Note Because tubes are drawn using recursive, fractal algorithms, where each layer of tubes depends on the settings for the previous layer, all tube sizes, lengths, and such are relative measures, not absolute ones.
Note In addition to color, you can actually map texture files onto flowers, leaves, and the main object tube itself. To map the main tube, go to Shading Ø Texturing, set Texture Type to File, and choose an image to map in the Image Name text field (to browse textures, click the folder icon to the right of the field). For Leaves and Flowers, first uncheck the Leaf (or Flower) Use Branch Tex(ture) check box, then choose an image under Image Name. See the birchBlowingLight texture in the Trees collection for a demonstration of texture mapping colors on a brush.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=648114600 (8 of 8) [11/27/2000 9:33:28 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting a 2D Texture onto a 3D Object If you would like to create a texture map for a scene object using Paint Effects, the process is fairly straightforward. First, create a side-by-side layout (Panels Ø Layouts Ø 2 Side by Side), make the right side the Perspective view, and the left side the Paint Effects window (still set to Paint on Canvas mode). In the Scene window, create an object you d like to paint a texture on for this example, a simple sphere will suffice.
Next, open the Hypershade (or Multilister), create a new material, and assign a file texture to it. (For more on how to create textures, see Chapter 19.) From the Hypershade, first MM drag the material onto your scene object (to assign the material to it), then MM drag the file texture onto the Paint Effects canvas. A dialog box will appear, allowing you to assign the name and size (in pixels) of your texture.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=906469299 (1 of 2) [11/27/2000 9:33:37 PM]
Books24x7 Mastering MAYA Complete 2
Click Apply Texture to File, choose Yes to save the file, and save it in your sourceImages directory. Before painting on the canvas, choose Canvas Ø Auto Save and turn on Save After Each Stroke. When you release the mouse button each time, you will see your texture updated on the scene object(s) to which the material is being applied. Try painting with several brushes onto the canvas and see how your texture map updates. Remember, you may wish to turn on Wrap Horizontal and Vertical to allow your map to be seamless as it wraps around the object(s) in your scene. The next illustration shows how Wrap appears on your canvas, and can be found in the Color Gallery on the CD.
Note The current version of Paint Effects has a feature in it that can cause a few headaches if you re not aware of it: if you choose Canvas Ø Clear while painting a texture map, the canvas will become disconnected from the material, and you will have to assign the texture to the canvas again. To erase a canvas, then, you need to use the Erase feature of Paint Effects (under the Template Brush Settings) to erase unwanted strokes. (The reason for this feature is to keep people from accidentally erasing their file textures: with Save After Each Stroke on, clearing the canvas automatically erases the file texture, which apparently upset some Paint Effects beta testers.)
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=906469299 (2 of 2) [11/27/2000 9:33:37 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Painting in a 3D Scene Now that we understand strokes and brushes, and how to use them in 2D, let s get on to the really interesting aspect of Paint Effects: painting in three dimensions. As all Paint Effects brushes are 3D curves that can (optionally) create tubes, you can paint in a scene as easily as on the canvas. If you open a new scene, choose a Paint Effects brush, and start painting, you will automatically paint on the scene grid (as we noted at the start of this chapter). This can work very well if you wish to paint trees, grass, or other elements on the ground. If you wish to paint on an actual scene object, however, you need to select that object (or objects) and then tell Paint Effects that the object(s) is/are paintable. In a new scene, create a NURBS Cylinder (be sure to cap the cylinder). In the Scene window, select the object and choose Paint Effects Ø Make Paintable (remember, holding down the Ctrl key in the Paint Effects window momentarily enables the Scene window so you can select objects). If you are still in Canvas mode, choose Paint Ø Paint Scene, to toggle on display of your scene. We could choose to paint some hair on this object, but we ll wait on this until the tutorial later in this chapter. Instead, let s paint some other brushes on, like one of the grasses, an oil paint, and a waterfall (under the Liquid folder). Remember that you can alter the scale of the brush by pressing B and dragging the mouse. Tip Many of the Paint Effects brushes require real lighting to appear, so you may need to add one or more lights to your scene to see your brushes in all their splendor. Note Because painting on an object simply creates curves on the object s surface, you can select, move, modify (alter individual CVs), or offset these curves from the surface, giving you a great deal of control over the look of each curve.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (1 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
If you tumble the Paint Effects window, you will notice that the brushes revert to an outline of their fully rendered selves in order to speed up redraw, so you don t have to wait for the full effect of the brushes to render each time. To change how Paint Effects simplifies the display of your strokes (not the actual strokes themselves), go to Template Brush Editor Ø Tubes Ø Creation Ø Simplify. If you choose Tubes per Step, the redraw will remove many of the initial tubes from display (this is good for elements like hair). Choosing Segments removes portions of each tube object, but retains the initial tube for each one (this is good for trees, flowers, and the like). Choosing Tubes and Segments will (of course) reduce display of both. You can also force Paint Effects to redraw the entire window each time you move in the scene (Stroke Refresh Ø Rendered), but this will slow your interaction with Paint Effects down a great deal. To force a redraw of the window after you have painted many strokes, click the Redraw Paint Effects View icon in the toolbar.
After some painting, your cylinder will probably look a great deal more interesting than it did in the first place! A color version of the following illustration can be found in the Color Gallery on the CD.
While painting in the Paint Effects window is great for getting the look of brushes down, it is often far more interactive to paint in the Scene view for large-scale jobs. When you switch over to the Scene window, you will be limited to painting in wireframe, but the painting will go much faster. One workflow example might be to create an interesting look for a tree brush or two in the Paint Effects window, then switch to the Scene window and paint a forest of these trees. When you create the forest, you already know what the trees look like you just wish to paint them into the scene quickly and interactively, and the Scene window is better suited to this than the Paint Effects window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (2 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
Tip If you wish to delete the last stroke you made in 3D paint mode, the normal Undo feature works fine. To delete selected strokes, simply select them (in the scene or the Hypergraph) and press the Backspace or Delete key. To delete all strokes in one fell swoop, simply choose Edit Ø Delete All by Type Ø Strokes, and all your brush strokes will magically disappear! Take some time now to play with different brushes (altering them as you wish, or just using different defaults) and get a feel for how various brushes act in a 3D scene as opposed to a 2D canvas. Tip If you wish to create a curve first, and then attach a brush to the curve, select the curve in your Scene window and then choose Paint Effects Ø Curve Utilities Ø Attach Brush to Curve. In this manner, you can multi-purpose curves for brushes and other functions within your scene.
Editing Previous Brush Strokes As you experiment with brushes, you may find yourself wishing you could go back and alter strokes you ve already laid down (remember that each new stroke is a new node, so changing a brush will normally not affect older strokes). As Paint Effects strokes are just curve nodes in a 3D scene, you can choose these curves and alter any attributes you wish via the Attribute Editor. As an example, let s choose one of the strokes you created on your scene object and modify it. You can try to select a curve via the Select tool, but you will likely choose many curves at the same time; the Hypergraph is a better way to choose an individual curve (you can also zoom in very close to a stroke and select it that way). When you open the Hypergraph, you will see dozens of nodes named stroke- , where
- is the name of the brush and is the number of that brush s stroke.
Choose one of the Grass strokes, then open the Attribute Editor (Ctrl+A). Under the grass tab (the furthest right), you will have access to all the settings that were available via the Template Brush Settings window, only this time the changes will be made to the existing stroke. Try adding some flowers to the grass (under Tubes Ø Growth), and change the color of the grass to something other than green (Shading Ø Tube Shading). As you can see (this illustration can also be found in the Color Gallery on the CD), you have complete control over your brushes, even after you create them!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (3 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
If you have several strokes that you wish to vary all at once, you can elect to group them so that they share one brush setting. This way, as you make adjustments to one brush, all the strokes will update simultaneously a real time-saver. To accomplish this, select all the strokes you want to have share one brush. These strokes can have any brush attached to them, but be sure to select the one with the brush shape you want last, as the last stroke selected supplies the shared brush. Next, choose Paint Effects Ø Share One Brush to make them all share the same brush settings. If you now open the Attribute Editor and change the attributes of the current brush, all the strokes you had selected will update together. If you had chosen, for example, to share the vineLeafy2 brush (in the Plants collection), you could change the default brush settings to include twigs, and all your strokes would come out looking something like the following (a color copy of which can be found in the Color Gallery on the CD).
Tip To remove sharing between strokes, simply select the strokes, and then choose Paint Effects Ø Remove Brush Sharing.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (4 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
Adding Forces to Paint Effects Brushes If creating still lifes isn t enough for you, don t worry; you can add dynamics to your Paint Effects brushes (at least the tube ones) and animate the brushes over time. Note Paint Effects brushes actually don t use dynamics (as do particles and rigid bodies) but use recursive expressions on the tubes nodes. While expressions aren t quite as wide-ranging as Maya s dynamics engine, using them was a very clever trade-off between speed and natural motion. Using Maya s built-in dynamics engine, even a single tree could take minutes per frame to update, whereas the expression solution allows for very fast updates, and even allows you to scrub the animation back and forth, which dynamics simulations cannot handle. To see how to add dynamics, let s create some grass that blows in the wind. In the Visor, select the grassClump brush (in the Grasses folder), and, using the Paint Effects Template Brush Settings window, change the grass s Length Max (under Tubes Ø Creation) to about 4, so there s a lot of grass to blow around. (There are, of course, preset grasses that include wind, but by starting with a grass that has no forces applied to it, you can build your own.) If you play back the animation now, you will see that the grass stays perfectly still as the animation plays. While you could adjust your brush settings in the Brush Settings window, and then paint a new stroke each time, it is easier to simply select the current stroke and go into the Attribute Editor and make changes. Your sample stroke will then update as you make changes, allowing you to see the effects of what you are doing. With a stroke selected, click on the grassClump1 tab in the Attribute Editor, and open the Tubes Ø Behavior subwindow. There are several menus under this: Displacement, Forces, Turbulence, Spiral, and Twist (Paint Effects is a deep program with lots of controls!). Feel free to play with any of these behavior modifiers, but we will concentrate on just a couple as examples. First, twirl down Forces and adjust the Gravity setting. You will notice that the blades of grass bend over as if they re growing heavier and heavier as you adjust this setting. Due to the relatively few segments on the grass blade, the grass will bend at sharp angles when gravity is applied (of course you can change this by altering Tubes Ø Creation Ø Segments to a higher number, like 20). You can also make the grass stretch under gravity by setting the Length Flex to a number greater than 0. While a heavy, stretchy look might be great for some items, it s not particularly appropriate for grass, so set the Length Flex back to 0. Still, we can make the grass a bit heavier by setting gravity to about 0.12). As all Paint Effects brush behaviors are based on expressions, you can either type a value for most attributes, or create an expression or a Set Driven Key to control that attribute. To create an expression or to set keys, RM choose Create New Expression (or Set Key) for an attribute; in the case of an expression, you would then write an equation that alters the value of said attribute. Try this simple equation to make the grass do the wave. RM choose Create New Expression, then, in the expression window, type in the following: Gravity = sin (time); When you play back the animation, your grass should wave up and down. Note Several of the other controls in this block (like Path Follow and Attract) will be discussed in the tutorial section at the end of the chapter.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (5 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
Now let s add some wind to our grass. First, delete the gravity expression from the expression editor, or RM choose Delete Expression over Gravity. Twirl down Turbulence, and choose Grass Wind from the Turbulence Type pop-up menu. Leave the Turbulence Interpolation set to Smooth over Time and Space (or feel free to experiment with the other settings), and try adjusting the Turbulence, Frequency, and Speed settings while your animation plays back. At their default settings, the grass will wave back and forth a bit, fairly quickly. To make it wave more slowly, set the Turbulence Speed to a small number. To make the grass blow more strongly, change the Turbulence slider to a large number. Turbulence Frequency controls how much space the turbulence field will vary across. In other words, setting the Turbulence Frequency to 0 will make every blade of grass blow just the same, while setting Turbulence Frequency to 1 will make them all blow independently. If you now go back and adjust the Forces Ø Length Flex to 1, you ll get grass that stretches as it blows an interesting, if unrealistic, effect. Tip If your playback speed is set to Free, you may find your animation runs too quickly, giving the illusion that your objects are moving around much faster than they will in the final render. To compensate for this, you might try setting the playback rate to Normal (Options Ø General Preferences Ø Animation tab) or, if your scene is complex (slowing down playback) or depends on Free playback for dynamics, just playblast the animation (Window Ø Playblast) to get a better idea of its output speed. Finally, once you get just the brush you were looking for, you will probably want to save it for later use. With your brush stroke still selected, choose Paint Effects Ø Get Settings from Selected Stroke, and then save the brush to your shelf or the Visor. Note The barn image included on the book cover, as well as the animation 25barn.mov on the accompanying CD-ROM, depends heavily on Paint Effects. The center color insert and CD also contain a still and an animation, respectively, of a more production-ready version of the fountain we created in the last several chapters; this fountain includes Paint Effects trees, grasses, moss, and other modified brushes (25fountain.mov). These animations (and the stills from them in the color insert) show off just a small portion of the possibilities Paint Effects opens to your modeling and animation endeavors.
Animating Brush Strokes In addition to animating the tubes on your brush strokes, you can also animate the appearance of your strokes over time, enabling you to grow hair on a head, or flowers in a field. Let s do the latter, using the brush flowerTallRed (in the Flowers folder). First, make a nice long stroke in your Paint Effects or Scene window, so you have a nice bunch of flowers to work with.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (6 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
To begin with, we need to change the simplification mode of the flowers (so we can see them better as we animate their growth). With the stroke selected, click the flowerTallRed1 tab in the Attribute Editor and, under Tubes Ø Creation, set the Simplify method to Segments. Now twirl down Flow Animation to get at the settings for animating brush growth. Set the Flow Speed to a number greater than 0 (drag the slider, or, if you wish, you can set a value greater than 1 by typing in the number field). Next, check the Time Clip box, set the start time to 0 and the end time to a large number (the default is 1,000), and play back the animation. You should see all your flowers rise out of the ground at the same time, growing to full height over 40 or 50 frames.
Note Setting the start time to a number greater (or less) than 0 allows the objects to begin growing after (or before) the animation starts. Setting the end time to a small number (like 1 or 2 seconds) will make the objects decay after that much time: they will disappear, starting at the roots. While this effect isn t quite right for flowers, it could be used in other instances (as in water drying up at its source of fireworks) to good effect. Having all the flowers appear at once may not be what you re after. If, instead, you would like the growth pattern to follow your brush stroke, simply click the Stroke Time check box to enable the brush to remember the direction of your strokes. With both Time Clip and Stroke Time enabled for various brush strokes, you can create a field of grass and trees, or grow hair on a model s head, just as easily as drawing the curves! These flowers are growing at different rates:
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (7 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2 Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=730043675 (8 of 8) [11/27/2000 9:33:51 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Rendering While Paint Effects is a very deep program with a great many controls, rendering is a relatively transparent process. To render a scene with Paint Effects brushes in it, all you need do is batch render (or test render into the Render View Window) as you would normally. When a render including Paint Effects brushes is launched, Maya first renders all the geometry in the scene, and then, in a post-render process, adds the brushes, fully rendered. Though Paint Effects rendering is a post-render process (after all geometry), the renderer is intelligent enough to place Paint Effects brushes properly in 3D space. In other words, a brush that is partially behind some geometry (like a cube, for instance) will render with that portion hidden from view. This way, though Paint Effects rendering is done after geometry rendering, you don t normally have to deal with the difficulties of masking and compositing the two elements together; Maya does this for you. The tutorial below covers the issue of partially occluded Paint Effects brushes in more detail. Note There is an exception to the rule that Maya precomposites Paint Effects brushes with geometry renders: refractions (for semi-transparent objects) and reflections. If you render a raytraced scene with refractions or reflections, you will not see the Paint Effects brushes in the objects that are refracting or reflecting. In order to circumvent this problem, you must render out your geometry and the Paint Effects brushes in separate passes and composite them together in a compositing package (such as Maya Composer, Maya Fusion, or AfterEffects). The fountain animation for this chapter (on the accompanying CD-ROM), as well as the still from this animation in the center color insert, use compositing to get the appropriate reflections and refractions in the water. While most of the controls in a Paint Effects brush that have to do with rendering are fairly self-explanatory (color, textures, illumination, and so forth), two items are worth noting here. First, there is a Translucence setting for brushes (high translucence allows diffuse light to pass through an object), which can be very useful for plants, tree leaves, and hair. Second, you have two choices for shadowing: a 2D offset shadow (the drop shadow we discussed earlier in the chapter) and a 3D cast shadow. The 3D cast shadow is a fake shadow and thus might need some adjustment to produce proper size and density in your scene. The following tutorial discusses this issue further. A few exceptions notwithstanding, rendering Paint Effects brushes is a very painless (and quick!) experience. With your understanding of the principles of rendering in Maya, you will find yourself producing great-looking images right from the start.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=735823779 (1 of 2) [11/27/2000 9:34:22 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=735823779 (2 of 2) [11/27/2000 9:34:22 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Tutorial: Painting Hair on a Head Up until now, the boy you have created earlier in the book has been stuck with somewhat plastic hair. While you could explain it away as an overzealous use of hairspray, a better option would be to just give him some real hair. That s exactly what we are going to do now. Start by opening one of your head models, or the included scene file hair.mb. The included project defaults to a close-up of the child s bald head. You ll notice that the rest of the child s body and IK system is hidden. We will make them visible later, but for now they would just cause unnecessary screen clutter. Bring up the Side window fullscreen. You should be in shaded, textured mode. The hair is not very graphics-intensive, so we will be able to run at a fairly high window-display setting. This is good, because we will need the fine details to decide how and where to paint the hair. Select the head object and press the 3 key to increase the display quality. In the Visor, go to /AW/Maya2.5/brushes/ and open the Hair folder. Select the hairBlondeNoShape brush. Now, since the boy actually has black hair, we will blend the shading of the eyeBrowBlack brush at 100%. With your mouse over the eyeBrowBlack icon, RM choose Blend Shading 100%.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (1 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
With the head still selected, choose Paint Effects Ø Make Paintable. Now let s try a few strokes; click and hold down the mouse while drawing a line on the head. You will instantly see hair sprouting from the head, although it will probably not be long enough to give the impression that this child has much of a hairstyle. We need to change the brush size. Interactively resize the brush with the B key (as shown previously in this chapter). You may have to experiment to get a size that works for you. Try painting different brush sizes, and once you get the hair size you want, delete all the strokes to start fresh (Edit Ø Delete All by Type Ø Strokes). You now have a clean head and a properly sized hair brush. The next step is to decide how the hair will be added to the child s head. There are quite a few ways to actually accomplish this. As is true with most of this book and Maya in general, the way that you should do something isn t limited to what we tell you. In fact, we encourage you to try many different ways and let us know if you find a better way. For this tutorial, many options were explored for getting hair on the head. It turns out that the most obvious, in this case, seemed to work the best for us: just paint the hair following the topology of the head model from front to back. So, with that in mind, let s start giving this poor boy something to comb. You will notice that the included scene file contains two additional Orthographic cameras: Back and LeftSide. These are to make it easier to paint those areas of the head, since at press time Paint Effects did not have a mirror brush option as in Artisan. Select the Side camera. We will start here, on the right side of the boy s head. Start your first stroke from the sideburn area and paint up and around the ear, to where the hair would naturally stop growing. The reason for starting here is that the more hair we add, the harder it will become to see the strokes as we make them. The area around the ear is the most critical (as it has to match the boy s sideburn and ear line), so we begin here.
Tip If you are painting a huge model, or one with very intricate curves, you can select your brush and, before you paint, select Paint Effects Ø Paint Effects Tool, and change the Display Quality to 0. You will still see the hairs as you paint them, but when you lift your finger from the mouse button to get another stroke ready, they will disappear. You will be left only with the curves on surface visible, showing you where you painted without slowing your work down. Remember, this setting only affects the display, not the rendering of the strokes. Now draw one stroke from the front to the back, but no more. Why? Because we are now going to set things up so that from this point on the hair will be shaped to the head as we paint.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (2 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
Note The brush actually isn t shaping itself to the head, as much as following the direction of the curve that we are painting. With the hair brushstroke still selected, open the Inputs for this brush in the Channel box or Attribute Editor, and scroll down until you find the attribute named Path Follow. Path Follow defaults to 0 for this brush because hairBlondeNoShape is controlling our hair s shape, while eyeBrowBlack is in control of the shading, but we need something a little different, so change the value to 0.7. Now you will notice that the hairs that are already on the model s head have nicely aligned themselves to the shape of the head. Feel free to play with values in this field to get different results.
After you have a shape you like for your hair stroke, select Paint Effects Ø Get Settings from Selected Stroke. This will ensure that as you paint each new stroke, the settings you have changed on the stroke you already have painted will be used for each subsequent stroke. Give it a try. It makes painting the hair and designing the shape of the hair style much more intuitive. Note If you also change the value of Path Attract to a non-zero number, the hairs will tend to lean towards the curve as well as follow its direction. This can be particularly useful when you paint braided hair and you want the hairs to be more compressed to the head in evident rows. You can also enter a negative number, to repel the hair and get an Einstein look. Now start working your way up the head, drawing slow, even strokes from the front of the head towards the back. You should end up with somewhere between 10 and 15 brush strokes, which can be seen as curves on surface and show up in the Hypergraph as strokeeyeBrowBlackShape1, strokeeyeBrowBlackShape2, etc.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (3 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
Now switch to the Orthogonal camera LeftSide and repeat the process for this side of the head. Our boy now looks as though he has a premature case of male pattern baldness, because we weren t able to paint the hair exactly on top of the head from the either of the side views. (The lines on the inside of the head model are the hairs slightly piercing the inner surface of the head. They won t be seen when the face is visible, so ignore them.)
Switch to the Top camera and start at the forehead, painting towards the back of the head. Show caution here that your strokes don t touch the skin on the boy s back, as the brush will jump to that section, continuing the stroke but giving him some unwanted body hair! Finally, switch to the Back camera and finish the job.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (4 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
Now, do a test render. Notice anything wrong? More than likely, the specular highlights on the hair strands are very blown out. This can be controlled for the entire head by selecting Edit Ø Select All by Type Ø Strokes. With all the strokes selected, go to the Channel Box and open up the Inputs for the brushes. Change the following settings, to affect the specularity: Specular to 0.085 (this sets the brightness of the specular highlight, based upon the specular color settings) and Power to 10 (this is the size of the specular highlight, where a larger number means a tighter highlight). Do another test render. Much better! However, the hair is looking a little gray, so change the Color 1 and Color 2 settings to the following: color1 R, G, and B to 0.01 each; color2 R, G, and B to 0.02 each. Now with another test render, you should notice more natural-looking hair color and specularity. You will find that different lighting conditions may warrant changing these settings, so feel free to experiment with them. There still seems to be something missing here, though; the boy looks like he received a fairly cheap hair-transplant. This is because the default settings for density on the original brush weren t high enough.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (5 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
To change this, select all the strokes and, in the Channel box under Shapes, change the Density value to 5. This will give you a thicker head of hair, as the brush stroke is more densely populated by hairs along its path. Now make everything visible on the boy model and do a test render. Tip For even more control of the hair shape, change the number of segments for the tube (under Inputs for the stroke) to a higher number. The hair shape will not only look more realistic, but act more predictably as you paint.
If you look closely at the render, you will notice that the hair is also casting nice fine shadows onto the boy s head. These are fake shadows, caused by Maya placing additional black strokes on the surface of the head to simulate shadows. It guesses where the surface is in 3D space, and draws a shadow paint stroke where it thinks the surface lies. This method isn t perfect, but it allows nice fine shadow details when it works. To prevent the hair from casting shadows onto other objects, or to give yourself another type of shadow option when the fake shadows aren t working, set Fake Shadow to None in the Paint Effects Brush Settings window.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (6 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
Note Alternatively, you can also change the shadow setting to 2D offset, but this is for creating a drop-shadow effect. While it works well for ferns that are painted on the side of a brick building, it isn t very good for hair on a curvy surface like a head. With Fake Shadow set to None, scroll up to the top of the Inputs section and check Cast Shadows to On. Make sure your light is set to cast Depth Map Shadows. The Cast Shadows setting only works with Depth Map Shadows, as none of the Paint Effects elements can be raytraced. Compare the various shadow types shown next.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (7 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
On the other hand, all Paint Effects brushes can be motion-blurred, both in 2D and 3D. Most people will opt to use 2D motion blur, as it s usually faster and smoother than 3D. Also note that there will probably be some visibly chunky lines near where the stroke (hair or otherwise) is occluded by the geometry. This is because the hair is rendered into place using the Depth Buffer, and therefore there can be no anti-aliasing of the edge where they meet; depth is either true or false for a given depth. As Duncan Brinsmead (co-creator of Paint Effects) stated, We don t have the notion of an anti-alias for the depth. It s an on or off thing. It s either at that depth or it s at a different depth for that whole pixel in the Depth Map. You must therefore take steps to compensate for this problem if it is apparent in your renders. To alleviate this edge, we suggest you render your geometry first without the Paint Effects elements, then render the Paint Effects elements without the geometry. Using various compositing tricks, such as blurring and shrinking the elements slightly, you should be able to eliminate these chunky lines. They are really only a problem in very close shots, or when there is little to no motion. Another quick way around aliasing problems is to use 2D motion blur, which we found almost totally hid these areas. Tip A quick way to create your two renders is to first render only the Paint Effects elements, by choosing Windows Ø Render Globals Ø Renderable Objects Ø Render Active while nothing is selected. As Paint Effects is a post-render process, it will still render, while no geometry will. Then, to render the Geometry without the Paint Effects strokes, in the Render Globals Ø Paint Effects Rendering Options turn off Enable Stroke Rendering. Now that you have given your model a full head of hair with shadows, take away some of his dignity and have some fun with your brush. Select all the strokes and, in the Visor, RM choose the Daisy brush, then choose Apply Brush to Selected Stroke. Do a test render. O.K., you can stop laughing now. Have fun with these experiments, and try applying several different brushes to you strokes to see what they look like.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (8 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=361976017 (9 of 9) [11/27/2000 9:34:47 PM]
Books24x7 Mastering MAYA Complete 2
Chapter 25 - Paint Effects Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Summary While there is no way to fully explore the depths of Paint Effects in just one chapter (that could be the subject of another book!), this introduction should enable you to grasp the underlying elements of the Paint Effects tool set, and you should now be comfortable enough with this feature of Maya that you can experiment intelligently, using the built-in presets, or creating your own unique brushes. You have learned how to paint in both two dimensions (on a canvas) and three (in a scene), how to interactively create texture maps, how to animate your strokes, and what many of the Paint Effects options do. Furthermore, you went through a real-world example of using Paint Effects to create hair on a head a process you might repeat often in a production environment. You should also have an appreciation of both the depth of Paint Effects and how it can help you accomplish tasks that were heretofore too difficult or time-consuming to attempt. Paint Effects is a great deal like Artisan: you will likely need to experiment with it creatively for a while before you will feel comfortable. However, you should now have enough knowledge to use simple Paint Effects elements in your scenes right away, and to understand how to experiment with the package to create even more complex and interesting effects in the future. With Paint Effects and Maya as a whole you should have fun recreating reality, or creating anything you can imagine. You now have the power to let your ideas take shape in the virtual world of illusion: Maya.
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=420755224 [11/27/2000 9:34:53 PM]
Books24x7 Mastering MAYA Complete 2
Appendix - Interviews Mastering MAYA Complete 2 Perry Harovas, John Kundert-Gibbs and Peter Lee Copyright © 2000 SYBEX, Inc.
Appendix: Interviews Overview This appendix features four interviews with luminaries from the digital graphics world. Authors Perry Harovas and John Kundert-Gibbs spoke with Mark Sylvester, Ambassador, Alias|Wavefront; Duncan Brinsmead, Principal Scientist Alias|Wavefront; Russell Owen, member of the Alias|Wavefront User Interface Team for Maya 1.0; and Habib Zargarpour, artist for Industrial Light and Magic.
Mark Sylvester: Ambassador, Alias|Wavefront Mark Sylvester was one of the original founders of Wavefront Technologies, one of the first animation software developers, in 1984. He initially helped to develop The Advanced Visualizer, a 3D computer animation system first used at Universal Pictures. In helping to create Wavefront, Mark took a leadership role in establishing global customer support activities, which included educational relationships and user groups. In 1995 Wavefront merged with Silicon Graphics and Alias Research, and Mark now serves as Ambassador for the new organization, Alias|Wavefront. In this role, he works closely with the development organization and the product marketing teams as a liaison between customers and the company, ensuring a close relationship between artists and developers. Before founding Wavefront, Mark was a private chef and helped to build several restaurants in the Santa Barbara area, where he lives with his family. Mark gave us an incredible amount of his time to try to give readers a deeper understanding of Alias|Wavefront, and the tools that make up Maya. Perry Harovas What was the reason for creating Maya, and what were your most important goals for its first release?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (1 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Mark Sylvester Maya is the result of an effort that was undertaken immediately upon the merger of Alias and Wavefront. At the end of 1994, Alias Research was in the midst of a next-generation, very secret product development. Wavefront, in conjunction with TDI, because we had merged with TDI three years earlier, were in the midst of a next-generation product development ourselves. The code bases at that time were about ten years old and in dramatic need of complete ground-up rewrites. Things that we did in the very beginning were a result of only being able to run on 64MB, not even that, 16MB systems with limited graphics capabilities. The operating environment of Unix at the time and the graphics library environments caused us to do a lot of different tricks that we didn t really need anymore, so we were suffering from the inefficiencies at an architectural level. That is why we had started those rewriting efforts. Because of the merger, we were faced with a couple of issues. One was a business problem which was, can we continue to effectively support and put research and development dollars into the Advanced Visualizer, which was Wavefront s product line; Explore, which was the TDI product line; and PowerAnimator, which was the Alias product line? Management at the time said, You know that really doesn t make sense because not only would we have those three lines, we have a next-generation effort at Wavefront and a next-generation effort at Alias. So that s really several teams that are working, and that s painfully expensive. Let s figure it out. The president at the time challenged the technical team to come up with a unified product agenda that would unify the requirements of the Wavefront users, the Alias users, and the TDI users into one next-generation product that we could deliver in a year. Absolutely overly ambitious, but I believe our heart was in the right place. So you had this really interesting challenge because the Alias developers really knew how to think along the lines that they had been accustomed to thinking for 10 years as was the same with Wavefront developers and the Parisian developers. The first year was really spent understanding the requirements of the various installed bases because they were all very, very different. We also spent a great deal of time learning how to work together, across continents and language barriers. It is somewhat interesting that three graphic systems were all started within three months of one another in 1984. They all had modeling, animation, rendering and display capabilities. They all attracted a certain kind of user. There was the Californian approach; there was the Canadian approach; and there was the Parisian approach. They had their own zealots who felt that their given approach was the right way to do it. Yet, at the end of the day, we all made pictures and got pixels up on the screen. Perry Harovas How did you get to be known as
The Ambassador ?
Mark Sylvester My role at the company has always been interesting. At the merger, the management was predominantly Alias management and they did not believe in titles for people. So, at the merger, we found out that there would be no titles; no one would have a title. I was going to Japan two weeks later to head up a delegation that was going to assure all of our customers in the Pacific rim that everything was going to be fine and the merger was going to be good for them; just to kind of calm them down. I said, Listen, I cannot go to Japan without a title. It s not acceptable. They will not know how to deal with me. It s a culturally significant issue. They said, OK, that s fine. So they called me one day and said, We think we have got a title. How does Ambassador sound? And instantly, it hit me chemically. I said, That s it. That s absolutely it. And while we were on the phone I jumped on the Net and looked up the definition of ambassador and in reading it, I thought that s a perfect job description for me because it would allow me to exercise the kind of mission that I ve always had, which focuses more on back channel kind of relationships. A role that is clearly focused on customers. My favorite line was when I was meeting with a vice president at NBC. He likes to walk me through [the facility] and as he introduces me, he loves to give my title and he says that I am the only guy he knows that outranks an entire room of vice presidents. Perry Harovas What area of Maya do you think doesn t get enough attention?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (2 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Mark Sylvester Wow, that s a great question! Boy, that s a hard one. My first thought is the dynamics. I think that that s the most unexplored territory. I think people naturally gravitate toward particle system work and they re starting to understand the soft body dynamics more. But I think the whole area of dynamics gives a look to modeling that there s no other way to achieve; and it gives a feel to standard key frame animation that s exquisite and can produce effects in the renderer that are impossible any other way, yet none of it is readily apparent. It does take experimentation and so I m very sensitive to the fact that most users don t have a lot of time to experiment they re busy! They re busy getting work done and it s hard enough to learn what the software does as it s designed to do, much less to say, what would happen if I did this; if I hooked up this emitter to the transparency feature in a shader? You know, that kind of thing. What would happen; what if? That s the part of the software where I spend most of my time; I like to get in and play with the dynamics almost exclusively. I just think you can get to unusual-looking images quicker than any other way. I see myself artistically as a surrealist, not a photorealist. Perry Harovas Are there tangible results from relationships with places like ILM, Pixar, and Santa Barbara Studios? Mark Sylvester Oh, absolutely. The relationship that we have with these customers is what we call Design Partnerships. It goes beyond beta testing and it precedes beta testing by at least a year. We work with customers, not just in film but video, game development, and industrial design, to help us understand what the new requirements are that they re starting to see from their customers. Remember, we re tool builders, and the best tool builders are the ones that have forged strong relationships with the people who use the tools. They re the ones that are sitting in the meetings with the visionaries and the directors and the avant-garde designers and the game developers saying, Wouldn t it be cool if we could do this? And then they look at the software to determine whether they can do that or not. It takes a long time to develop software, and places like ILM are going to want to be able to respond to their own customers requirements as quickly as possible. Now, they can come back to us and say, We need to be able to do this, whatever it is and we will take that under advisement, as we do with all requests, and we can produce those requests at a given speed a given rate of innovation. That s where open architecture comes in and that s where an API that s extremely robust and touches all aspects of the code becomes probably the single most important feature for those customers. Because it allows the customers to add these features themselves, especially if they do not have time to wait for us. I think it s the most important aspect of Maya for the high end of the market. It s certainly not the most important part to the low end of the marketplace. The high end of the market wants to be able to open the hood and fine-tune the engine. The lower end of the market just wants to get in the car and go to the store. They don t want to understand the ignition system, they just want to turn the key and go. Perry Harovas And they want to do it fast! Mark Sylvester Exactly! I would say we probably have an order of magnitude of work to do in the ease-of-use, ease-of-learning piece of Maya in the next couple of years. Perry Harovas What do you see as the single most important thing next to tackle?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (3 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Mark Sylvester I m going to say ease of learning. I think that continuing education in a software package is extremely underrated as to its importance. Software is not static, and so once or twice a year you get a major update of software and you have a challenge in front of you, which is to be able to assimilate that technology into your pipeline, your workflow, into the way that you produce images. We don t produce gratuitous features. We produce features that are specific to solving problems, and yet we ll find that once someone gets a version update, they tend to load the CD into the computer, the software gets loaded, the manual goes onto the bookshelf and sometimes doesn t even get opened. Maybe the release notes will get read. But to be able to assimilate that newly installed software takes an investment of time in what I call continuing education. You constantly have to be thinking about improving your skills and learning more about the software that you already have. So, given that condition, I think that s the next major area that has to be resolved. I d like to also say that the other area that I think is ready and it s one of our goals is to create Synthespians. Jeff Kleiser coined that term 10 years ago. We have created photorealistic humans and creatures; we ve created surrealistic humans and creatures, aliens and the like, and they move realistically and they look realistic, but they re dumb as rocks! I think there is a real opportunity to build intelligence into these characters that would absolutely help our ability to tell stories if we didn t have to worry about hand-animating walk cycles. Yet, you want to have the individuality that every organic creature has. Nothing walks the same or flies the same. So you can t really solve this problem with motion capture and you can t really solve the problem with procedurally generated motion, and I don t really know how to solve the problem. I think that s one of the great things about audacious goals is that you don t really know how you re going to solve it, but I would love to have directable characters. I would love to be able to feed a script into the system and be able to direct the system by voice much as a director would and not have to be concerned as much with hand animating walk cycles. Perry Harovas Yet one of the difficult things for artists is changing the way they work, especially when it comes to doing the same thing they have always done, but approaching it in a vastly different way. Mark Sylvester Yes. That is very hard. It takes openness and willingness, and people are very resistant to change. That is a core human condition. No matter how high-tech we envision ourselves, no matter how advanced and cutting edge we think we are, we don t like to change. This whole ability to just have your eyes opened to the idea that there might be another way of doing it. And again, I don t know how to do that yet. I m looking at it. I m trying to figure out how can I help capture the little stolen moments in a day and use those for education. While you re waiting for a render to happen or you re waiting for a file to load, could you get a little 3-minute lesson on lighting or could you listen to someone during lunch? Could you download a ten-minute brown bag lesson by some lighting director? I think it s an area that we haven t spent as much time as I think we need to, and I know for sure that Alias|Wavefront is devoting a tremendous amount of time now into this whole area of continuing education. It s clear that we re not completely meeting the needs of the broader professional market until we have a level of ease that will show users how to learn online, quickly and easily. Perry Harovas It s very interesting that applications like 3D Studio MAX and Lightwave, which are obviously very complex programs in their own right although compared to Maya, a percentage of Maya s complexity have all this education out there to explain them! Then you have all these users of Maya that are scratching their heads saying, I don t know what I m going to do next; I guess I m out here on my own trying to figure this out. A main sour point with Alias|Wavefront has always been the Web site and the amount of information that s on the Web site to help people. Recently the LISTSERV has been probably the most fertile ground for some of this stuff, but I think there needs to be something else.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (4 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Mark Sylvester The importance of continuing education; the importance of ease of use and ease of learning is one of the number one priorities for the Maya team. We will not have the success that we need in a broader professional market and with casual users and with this coming tidal wave of new users unless we address this specific issue. These users, they know all the features are there but like you said, it s access to help, access to information, access to tips and tricks, that kind of stuff. We know that historically we ve not been as successful in this area, so I expect that to change, probably not dramatically at first, but with real strong incremental steps along the way. Perry Harovas Well that s good to hear. Who do you see as your primary competition in the 3D world? Mark Sylvester Oh, Studio MAX, without a doubt! Perry Harovas So, was that what you had up on your bulletin board when you were developing Maya? Mark Sylvester No, at the beginning it was SoftImage. I think neither Alias nor Wavefront had strong character animation tools. SoftImage did, and as the trend toward character animation grew, so did their business. So that was one of the principle areas that we wanted to focus on in 1.0, which we did the whole character building-character modeling, IK, puppetry, the digital puppets, all of that stuff. All of it was to be able to respond to the needs that our customers had, which was for strong character animation tools. We wanted to break the paradigm of model in Alias, animate in Soft, render in Renderman. That had to go away. So now many shops are strictly Maya. We want to be able to have the entire workflow be within Maya. So that was one goal. I think after 1.0 we absolutely hit that target dead on. And consequently Softimage is not the main competitor anymore. Now we have a challenge that there are thousands of MAX users out there and they, for a long time, really gave Maya a hard time saying, Well, I can do 80% of it for 20% of the cost. Well, now with Maya Complete being $7500, less than the cost of comparable Studio MAX with the plug-ins to bring it up to the functionality of Maya, it s easy for them to switch; very easy for them to switch. So now it s a matter of getting out there and appealing to the Max users who would really love to have Maya and felt it was out of reach and I don t think we did a very good job with letting people know we were not $50,000, but that we re $7500. Perry Harovas Because that was a huge change, and you re right, there was not a lot of press about that. Mark Sylvester Huge! So that s another thing that we re going to work on changing is that whole perception. Perry Harovas I think everybody was really angry for a long time that they were paying a lot for what could be considered in MAX, a plug-in. But now with the price drop, people started saying, I can t believe they finally did that. It looks like they ve taken what we ve said seriously. Mark Sylvester We have, we have. We were doing a lot of things that weren t effective. We read the LISTSERV, we get the mail, we know. We re out there talking to customers all the time. Perry Harovas In terms of specific tools, what would you like to see Maya do better, as a user?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (5 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Mark Sylvester My personal weakness is in modeling and so anything that we can do in the area of making it easier to do will be appreciated. I think that one of the goals as a visual artist is to create very complex worlds, with scenes and environments that tend to require lots of detail. Look what Paint Effects has done. I mean, try modeling a palm tree and try modeling it within a year. It s a lot of work to make it look real. Yet, we can do a palm tree in what amount of time with Paint Effects? Two seconds, three seconds with dynamics on it even! So tools that help us model complexity are very important because to make things visually interesting, they ve got to have a lot of detail in them and that can be very, very time-consuming, especially for someone who is not real gifted as a modeler, and that s certainly me! Perry Harovas I ve always said, I don t know if it s the Moore s law of 3D graphics I haven t come up with a name for it yet but this is the core idea: once you get a new tool that lets you do something that you ve never been able to do before, all of sudden you re excited and then you re interested in doing things which you never would have attempted, and it becomes voracious and you start to attempt things that slow down your system again and you work towards the point where you can actually get back up to functionality. The systems come up to speed again and then another tool is introduced which bogs you down again. And I don t think with the complexity of what we re trying to do as artists, we re ever going to have the computing horsepower to achieve everything we can see in our heads. Mark Sylvester Right. Absolutely! It s the same with disk space; you never have enough. I had thought that one of the things that we could invent that would be really helpful would be a, I don t know what you would call it, but it would be a Complexity Meter that you could have turned on, and as you are doing things the Complexity Meter starts to rise so that you know that that thing you just did just added 33% more to the render time, for instance. You put the shadow button on in a shader and this meter goes up another 50% or whatever. This is something that I ve talked with our broadcast clients about. They would like to be able to say, I need to get something done in an hour&just bam, bam, bam get it done! Now I want to turn up the quality knob by another 50%. What does that mean? Now I can use this level of shaders; I can add this much more geometry and this many more lights and now&because it doesn t have to be ready until the 6 o clock news, I can turn the quality meter up again. It s going to be something that s going to go on a weekly event that s going to happen and I ve three or four more days so I can turn that quality knob up even more. How many times have you just start working, you re doing this, doing that, and all of sudden you ve got a one-hour render and you re like, Oh-h-h! As I was working had this, whatever that meter was, had it shown me as I was glibly adding more and more complexity, that s where I think we can help users. That isn t on the planning boards anywhere. But it is a great idea and would really be helpful. Especially to help us in the case where you are bidding a job to be able to say that I can complete this job and keep my quality meter on at 2 and be able to deliver it at so many dollars a second. And if the budget goes up I can crank, crank, crank it up and now I know I can add volumetric clouds or hundreds of lights and still make my budget. Perry Harovas Well, it becomes very easy to do things like paint in complexity with Paint Effects where it s casual. It s kind of going back to the other statement I made where you would never even think that you could paint a field of grass, yet I ve done at least six animations of fields of grass, with trees and every blade of grass casting shadows. I mean& Mark Sylvester You never would have done it.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (6 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Perry Harovas I would have laughed in your face if you would have even suggested it to me and now you just casually do it, so you keep adding complexity to it and now all of a sudden you re surprised when you see an hour-long render! Look at things like radiosity. People want to have radiosity or global illumination and don t care how long it s going to take if it s a choice between a long render time or not having it at all. Of course they d rather have less render time and the feature, but they don t want to be limited at all. That must be very difficult for you when you decide what features to put in there; when you have to balance it against how much time and money it s going to take to develop this and how much return on our investment you are going to get. Mark Sylvester Correct. That s absolutely correct. When we look at any given release there s three big audiences that have to be appeased. One of them is our own developers. There are things that need to be done in any given release that are architectural or are things that are done under the hood that never show up on a list of new features added. And there are things that you didn t get done in a prior release or things that you know that you need to do to get ready for the next release. Or it s just under-the-hood kind of stuff that if you ignore, it will come back and bite you bad in a release or two down the road. Because you will have no flexibility. That s very important, to listen to those engineers when they say, We ve got to do this. The second group is the marketing group. They re out there talking to new customers about things that need to be in the software that aren t there. They re looking at the competition; seeing what the competition is doing; what they re working on; what their future stuff is going to be; to make sure that we re competitive on a check list basis and that we don t lose business because we don t have the key features for given markets that we re trying to grow into. If you don t grow your business, you go out of business and then no one is happy. The third group is customers. And customers are just users me and you. Our needs and our focus are all on what we re doing right now, today, our current projects and the projects in our immediate future. That s really what our whole field of view is, really focused on the job that we re doing day to day. We re the ones that are going to report bugs because we re the ones that are using the software most aggressively. We re the ones who probably use competitive packages as well and can say, Well, I really like the way this package handles this particular problem. So, you ve got that group s advice and suggestions as well, but you can t listen to any one of those groups exclusively or to the exclusion of the others. The trick is to come up with a balance and a good balance so that you add new features, fix bugs, put things in to remain competitive, and also work on your architectural underpinnings. This becomes a real balancing act because you have to add a business wrapper on that whole topic and say, OK, that looks good. Now how much of that can we do in a short enough time to continue our momentum, and not so long that we get out of phase? So, that s one of the hardest things to do as a software company is to figure out what do you do now, what do you do later. What do you put on the list for later? How do you make your dates? Making your dates or not being late is something that we ve intermittently been very good at and very poor at. I think we are much better at time commitments now than we ve ever have been in the past. I think it s due to maturity in the team and a commitment to keep our commitments. So, it will be the case that not everything gets in but releases get out on a regular basis. Perry Harovas I think you as a company need to let the users, the people on the LISTSERV who are very vocal and maybe are or are not coming from an informed view, know your struggles and why certain things are in there and why certain things aren t. Why you re making these engineering leaps and they re under the hood, as you say, and nobody even knows about them. I think people s assumptions are that the majority or all of your work is spent on new tools. So naturally they start to say Why isn t tool X in this new release of Maya? I think there is a lack of that knowledge for the casual users. ILM certainly is aware of it, but Joe Animator doesn t know what your challenges are as Alias|Wavefront and what you have to do day in and day out, so that might be an area to work on.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (7 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Mark Sylvester Maybe you can help by getting a little bit of that flavor in the book. Perry Harovas I would love to. Just to give them an idea, and not to shut them up, certainly, but just to get them more informed so that& Mark Sylvester Yes, exactly. Don t shut them up at all. That s where we get our best ideas! But we get our ideas lots of different ways. That s what is important. If I just listened to one guy, then what do I do about my guys at NASA? What do I do about my guys at NBC? What do I do about my guys at Pixar, or the ones that are just a few guys in a garage working on feature films? That s the deal. And how do we keep it up? Even though we ve gotten to be a pretty good size company, I don t want to lose that kind of interaction. We re actively listening to customers. We re paying attention to these kinds of things. I hope that we never get too big where we don t have that personal touch. We can t get out and get to every customer, but I know that we are extremely proactive in going out on customer visits in all areas of the company. And that once we do have a chance to have these kinds of conversations, people will come away with a strong appreciation for the challenges we have and a respect for the way that we go about running our business. At least, I hope so.
Duncan Brinsmead: Principal Scientist, Alias|Wavefront Duncan Brinsmead is a principal scientist at Alias|Wavefront headquarters in Toronto. His inspired experiments are things that make our lives as 3D artists more fun, easier, and give us more realistic results in the final render. He has written some of the most popular and widely used parts of PowerAnimator (Maya s precursor), and has now created what will probably be regarded as a significant advancement in 3D graphics, Paint Effects. We spoke with Duncan at length about Paint Effects, and what he sees as some of the possibilities still left to be conquered in CGI. It was a wonderful conversation you could just hear the excitement in his voice. It was unmistakable: this man loves what he does for a living. Perry Harovas Where did the impetus come from for you to start down this path which resulted in Paint Effects? Duncan Brinsmead Well, actually, I got into doing Paint Effects when I was working on the Balloon Girl s hair in Bingo. I had an old paint system I d written long ago that did 2D where you could brush trees and other objects, but it was in 2D. I had an anisotropic shader that I wrote for Maya, and with that shader, I wanted to have texture maps of hair that gave not only Alpha and brightness but also direction to the hair. I rewrote some routines in my paint system to produce some images that had 3 dimensions they kind of encoded the twist and the direction of the hairs, right? So I kind of coded and colored it all in one image, which looked kind of nutty, but then I could take that texture and use it to control the anisotropic direction on the surface so that it matched the hairs and all the different parts worked together.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (8 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Then I started to realize that while I can paint these hair streaks, I wanted to get a little more elaborate I wanted it to be 3D and coming out at you so that I could encode not just the 2D direction of the hair but the 3D, and use that for texture maps. You could have hairs curling around or twisting under each other and get the correct highlights on them. I wrote a little stand-alone to help me do that, and then as I was writing the stand-alone, I thought, Well, gee, you know, to actually draw the hairs, I could use the line renderer I used for the PowerAnimator toon shader, which essentially could paint anti-aliased lines in three dimensions so that foreground fat lines will occlude lines behind them and have a nice anti-alias on the edge. I just modified that so then it would work properly with the perspective camera, and I then realized, well, Gee, I can draw the lines now I don t just have to draw them in kind of a 2D sense, I can really draw them coming off an object. And so it kind of started from that and kept snowballing and I kept adding more and more. Which is usually actually how most ideas kind of go with me, I ll start something and then just keep adding on bits incrementally. Perry Harovas Do you try to do as much animating as possible to try to figure out what the problems that need solving are? Duncan Brinsmead Yeah. I think that s one of the reasons that people seem to like the stuff I do as much as they do. Since I tend to use it, not quite the same as in a production environment, but it provides more flexibility and gives me more time than a production environment would. I tend to be after a particular effect, and I ll create some new parameter. When it doesn t do what I want it to, I ll change the parameter, or change the way it works. Where most people in software development tend to write up UVR, or User View Requirement, documents that plan everything out on paper and then have people go over and review it multiple times, I tend to work more in just a continuous stream. I just code and I try things out, I add parameters on the fly and I reconfigure the user interface if I don t like it. I find I can t go from a User View document because it changes so much for me as I m developing it. What I end up with might be a completely different product than what I started out with in the first place. I think of it as being Opportunistic Programming, where you see some neat effect or something that you re doing work on, and then you exploit that. If you re bound doing a particular requirement that s been set down for you, then you don t have the ability to take advantage of those kinds of opportunities. Perry Harovas Well, I know that all of us in production have said for years They don t understand they meaning any software company they don t understand what our real needs are, or the fact that we don t know what our needs are, sometimes, until we actually need them. So, it s interesting that you and the people on Chris Landreth s team are some of the only people in software development, in 3D anyway, that seem to be doing any kind of production-worthy stuff. And I think that s what your advantage is. Duncan Brinsmead Well, yeah. A lot of the programmers I ve met over the years don t necessarily have the art background to appreciate a lot of the problems, and I think also that if you ve done any animation work, you know how frustrating it can be. You know when the software doesn t behave the way you think or you can t get the effect you want. People will get it so that it looks good on paper sometimes, but if it can t take you all the way to the final effect that you re after, with all the little subtleties and nuances that you have to do for that effect to work properly, then it s not as useful.At the same time, I do like to explore doing and creating things that are not necessarily something I definitely know users are going to need. With Paint Effects I saw some useful things that can be done as I was starting out on it, but you know there was a lot of time where I didn t know what people were going to do with it because I d never seen anything quite like it before. You know, some people might prefer some more traditional kinds of paradigms. Maya Fur is a more traditional way of doing hair where you use attribute maps. Some people may prefer that for certain kinds of jobs, so there s a certain amount of experimenting and risk-taking to see if it will yield something that s useful. Sometimes you have to look at things, things that nobody has done before, and that s very hard if I have to present something to a manager and get it approved as a project and nobody s ever done it before! It s very hard to get anyone to agree on that, but those kinds of things, I find I tend to just pursue them on my own, and then when they re ready I http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (9 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
show them to people. Perry Harovas Exactly how does Paint Effects work in Maya? Duncan Brinsmead Okay, let s see. If I m describing it, I d say that basically in Maya, most of the modeling you ll do would be in terms of NURBS surfaces or polygons. The normal way of rendering that we use is a scan-line rendering for the finished rendering. Paint Effects kind of occupies an interim area where we re rendering to a Depth Buffer, but it s actually a complicated set of buffers where we can handle transparencies and stuff, which normal Depth Buffering can t handle. We also handle anti-aliasing of fine lines. If people are thinking in terms of particles, they could think of being sort of halfway in-between the software particle render and the hardware particle render that we have in Maya. I personally find this ground, this sort of halfway between, very fertile for a lot of effects that you can t traditionally achieve in particular, things where you have enormous complexity and millions of hairs, grass, a forest full of trees, these kinds of things that are normally beyond the range of a scan line based rendering of triangles. Where the memory requirements would be too great traditionally, Paint Effects allows you to creatively get around that because we throw everything away as we render so that the memory costs are fixed. The memory requirement is for the buffer or the set of buffers we use; we have about six or seven buffers, and if you re on a really giant image, that might take up a fair bit of memory. I know a guy who s doing an image, something unwieldy like 13000 pixels by 2000 or something, and he just went into swap at that point on the image size. The great thing about it is that you can render the Paint Effects if you want without any object memory. You can pre-render your scene without the Paint Effects saving a Depth Buffer, and then you just load the Depth Buffer and the image buffer in the Paint Effects. Then you can render Paint Effects on that and the Paint Effects during that render will integrate with those objects as naturally as if you d done them together. At any rate, it happens at the end of the render and some of the memory space is freed up by the time we get to the Paint Effects phase. Then, even if you ve got a fairly big scene with a lot of objects, it might not conflict too much with the memory in Paint Effects (normally the memory isn t that bad anyway). The memory needed to do one blade of grass or a million blades of grass is the same, because it s dealing with the buffer memory and not so much the memory per tube. Perry Harovas You see, that s beautiful because I mean, as an animator, I ve said for years as I walk through a forest that this world is much more complex than we ever have time or memory to handle. I mean, if you just look at the falling leaves in the forest, you couldn t possibly count how many leaves there are just in your field of view! Never mind if you did a pan. I noticed in some of the hair renders, that the shadow of the hair is bigger than the actual tube. Is this because&? Duncan Brinsmead Well, I can tell you that. The Depth Map that s used by the light for the shadow map: let s say it s at a low resolution, and a hair covers a pixel even though the hair is only 1/10th of a pixel in width; it sets the Depth in the Depth Map for that pixel. We don t have the notion of an anti-alias for the depth. It s an on or off thing. It s either at that depth or it s at a different depth for that whole pixel in the Depth Map. So, what this means is that if you have stuff like very fine fur or hair, the width of the hair is grossly exaggerated in the Depth Buffer. One way around that is to make your Depth Buffer resolution very high (I mean your Depth Map on the light really large, which is kind of heavy on memory).
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (10 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Another thing you can do that helps is to focus in the range of the Depth Map using the placement parameters of the Depth Map. Another trick that I sometimes use is to make the shadow color on the light not black so that the shadows aren t quite so heavy. If you want you can try fake shadowing on the tubes. This will give you very, very fine shadows. So if you ve got bangs or something and you want to see the very fine shadows of the individual hairs on the forehead, you can do that a bit with fake shadows (although this trick is not perfect because it tries to guess where the surface is). And it s not a true cast shadow, it s basically another paint stroke that s painted in 3D into the scene. It s just a black stroke. In some cases that can work pretty well. If you have a tree and you want to give it a sharp base and have all the branches really sharp on the ground, that can work for those kinds of things as well. Perry Harovas One of the things that really shocked me, in a good way, was that you could 2D and 3D motion blur with Paint Effects, and I think a lot of the people in the field were really surprised and really happy that you decided, Well, we re not going to limit you to one kind of motion blur. Duncan Brinsmead Yeah, we realized that it was important to do both, especially when it comes to hair. We initially did 3D, which was difficult, and once we had all that in place, it was pretty easy to add the 2D. I think the 2D is actually the one a lot of people might end up using more because it s faster and in some cases, it s also smoother. Perry Harovas I prefer it almost 80 to 20%. Duncan Brinsmead Yeah. There are just a few cases where some people might want 3D just for their objects, not necessarily the Paint Effects elements. Again, you can render the different elements separately if you want. But, yeah, I thought just having motion blur in general was pretty important for Paint Effects, because if you want to do hair or these kinds of things and moving objects, they need to blur, and motion blur has become really important. Perry Harovas Do you get excited about images to the point where you can t wait to show somebody, or are you more low-key about it, like, animators hate what they do because it s never perfect? Duncan Brinsmead I guess I m more the show-off type. I always like having people into my office and, in fact, I get some of the managers around here pacing around my office checking to see if I have anyone demo ing and showing off stuff to them. I m pretty bad that way. [laughs] I like to create images and then bring people in and ask them what they think. Perry Harovas What did you not get to do with this release of Paint Effects that, just because of trying to get it out the door, you think you d like to implement in the future? Duncan Brinsmead There are a few little clunky odds and ends here and there in the interface that we didn t get time to do or implement. But you know, all in all, I m really happy with this release. We got a lot more in than I d originally planned on, and we extended a lot of stuff. I wanted to have the time after SIGGRAPH to put in some presets and the way it worked out, I ended up putting in 400 presets! Perry Harovas The presets are even more extensive than they were at SIGGRAPH. I was really surprised to see things like waterfalls and, quite frankly, hands! Which I still haven t found a use for, but I m dying to find a use for that one. [laughs]
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (11 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Duncan Brinsmead Yeah. I did a waterfall awhile back that we showed at SIGGRAPH using the PowerAnimator particles, and people liked that at the time, but it was difficult to set up and to create. There were a lot of things that I wanted to do that I just couldn t do in the PowerAnimator particles, so I tried to make sure I put the kind of elements I wanted into the Paint Effects particles. The volumetric self-shadowing in Paint Effects isn t as good yet as it is in the PowerAnimator software particles, although with the Depth Map shadowing you can do half-decent stuff that way. The nice thing in the Paint Effects particles is the way you can texture down the flow of the particles (I shouldn t call them particles I guess, they re tubes that you define in Paint Effects). Using the gaps (of the tubes) you can simulate a kind of particle motion through them, and you can simulate at very slow speed. If you wanted a waterfall that had connected tubes, a really big flow coming out through it, each tube has to move very slowly. If you re using particles in PowerAnimator, because of the way that the streaks have to fit the motion to make tubes, you d have to have so many particles to move slowly, like the more slowly you move, the more particles you d have to have because of their speed. You know they connect to their last position, so you d end up raytracing billions of particles if you wanted to do a really slow big waterfall. You can do that kind of thing in Paint Effects. I haven t really experimented enough with it to get a good waterfall, but I think you should be able to get a pretty decent effect. It doesn t do the collisions with objects but you can sort of paint that in, I think. Waterfalls are rather static anyway. Something I did as an experiment recently, that I think works out really well, is to take a cylinder take a simple 1 degree curve 2 points on the cylinder curve-on-surface, and make it so that the U on one of the points is like 1000. Essentially what you get is a spiral going down the cylinder. It s like scan lines going down the cylinder, and then you assign a Paint Effects stroke to that, and this essentially gives you a surface that s a Paint Effects surface so you can make it fuzzy. It s like a surface where you set the stamp densities to get an even grid of stamps bound to the surface. If you want to be fancy about it, you can turn on a tube and just have one tube that exactly follows the stroke with the Path Follow of 1 and a Length Flex of 1 and a large number of points on it. I did this and then added a little turbulence to it and then moved this around so that you have your cylinder, but you re going to apply a turbulent wind to deform it. There are all kinds of neat things you can do with that, and one of the nice things about the Paint Effects is that it s not a flat surface. Doing it this way you create a kind of volumetric surface that, as objects are penetrated, it will kind of softly emerge out of it. Perry Harovas What type of things, kind of along those lines, do you wish people would do with Paint Effects beyond just landscapes and hair and things like that? Duncan Brinsmead I think when people get it out of the box, they will just use it for grass, probably. [laughs] Perry Harovas Yeah, because it s so much fun!
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (12 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Duncan Brinsmead I ve seen a lot of people using it for hair and stuff too. I d like to see somebody try and tackle some really long hair, like using the control curves and maybe soft-body dynamics or maybe just keyframing. Try doing something like a woman with long flowing hair that kind of blows around. It might not be easy, but it would be interesting to see because I don t think anyone s really done anything like that,& that looks half-decent. Something else I think might be a neat way of using it is in areas where you might previously have thought of using a post-effect. For instance, when you just want to blur a part of a scene for example, you know you can essentially paint a brush on the object that ll blur that object or smear it a bit. There are these kinds of uses for it. It s not like a canned effect. I think these possibilities are really great. Let s say you have a seam on an object, and I don t say this is the best way of doing it right now, but you ve got very crude triangulation. So you see this gap along the joint and you want to get rid of that gap. You can up the triangulations really high, but your renders get really slow. Or you can create a Paint Effects stroke that has tubes on with Randomize at 0 and you have these little tiny, tiny short tubes that are very even and go sideways to the direction of the stroke. Then you paint them right along the edge of one surface and they essentially kind of smear the edge of the triangles onto the next surface so that it closes up the gap. There might be problems when you get an object going in front of it it might pull in a little of that into the smear something and not look quite right but if it s really subtle stuff, it might help make certain renders faster. I d certainly consider using Paint Effects. Let s take the flow of gas over a car hood for example (I ve seen people struggle with that). It s not too hard now with Maya. You can have curves, the particles can flow along the curve, so that s not too hard to do anymore. Still, with the particles in Maya, trying to get a good-looking, coherent flow of a stroke where you re using a texture that flows nicely along it, that might still be difficult whereas with Paint Effects you can select one of these brushes, Jet Trail for example. You can take a brush like that and you can either stroke it along the surface and then just do a little surface offset to position the stroke up, or you could just take a curve and attach it to the curve and then just animate the path follow. I think there are a lot of cases where you can use a simple kind of flow along the curve instead of the dynamic behavior particles, and it s much easier to control that kind of animation than it would be a particle animation. Perry Harovas Are there any plans to incorporate it into IPR? Duncan Brinsmead It s sort of its own IPR in a way because it s a post-process. If you want, one way of visualizing in an IPR-like setting is to take your IPR image, load it in as an image plane, and then just modify the Paint Effects window. If you pre-render your scene, and then you save up the scene in the Depth Buffer, there s a mode of rendering where you can load that Depth Buffer and then the image as an image plane. You can render the Paint Effects onto that so it renders onto that Depth Buffer. So if you do that and then you tweak something and then you update the Paint Effects window, that s about as fast an update as you ll get. Since it s not scan line based the way IPR is, we can t just render one scan line of Paint Effects. We can render one object in Paint Effects, but you can t render just that one object and then have all the other objects in the scene. You do get kind of a fast feedback if you go into Render Shaded stroke and then turn Active on, so it s only rendering the active stroke. Then when you go in to modify it in the Attribute Editor, it will redraw the Paint Effects for you fairly quickly. So, in a way, the Paint Effects panel is sort of an IPR window of its own, but it s a different kind of IPR. Perry Harovas What are the areas in CGI that you still see as needing a lot of work? Things that you would love to tackle, or things you would love somebody else to tackle because you just don t have the time?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (13 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Duncan Brinsmead There are a lot of great things that people here are currently working on. One thing I think that needs work is rendering Global Illumination; a lot of good effort went into that, and a lot of people putting that into renderers, etc. I think it s more important than some people think for certain aspects of animation, like for facial rendering. I ve looked a lot at different shading models for doing facial rendering, and you know, of course if you take a scan of a face, you can make it look pretty realistic, but it doesn t hold up well under different lighting conditions, right? One of the key aspects, I think, of white skin is the global illumination effects of light scattering in multiple bounces, say between the lower eyelids and the cheek, because it s white and the skin is very transparent and it scatters the light a lot. It s a very directional type of scattering, and there are certain cases where you need to show the way light bounces around or it doesn t look quite right. People fake it a lot with clever use of ambient lights and they kind of paint the radiosity effects into their textures, but it would be nice to have something that automatically did that. You get some interesting packages, some of the ones for simulating dirt. One of the neat effects is that it actually simulates the way light is hidden by certain areas. So as you get closer to a crevice or something, it gets darker and darker because less light can get into that region. And then more dirt tends to get into that region as well, and I think a lot of times the reasons images look good when you apply these dirt algorithms isn t because it s adding the dirt, but because it s adding the effect of Global Illumination. It just jumps out it is so much more real than the typical plastic kind of graphics rendering that you see. To me, the key difference between reality and most computer graphics renderings is Global Illumination effects. When a novice sits down at a machine and their first renders come out, usually the ambient light is all wrong, the shadows are blown out, it s flat, and it is all due basically to the lack of Global Illumination. If you re using a program that uses radiosity or something, it doesn t let you make those kinds of mistakes. You might make it look like an over-exposed picture, if the software works well, but you shouldn t be able to make it look unrealistic. The real problem is that Global Illumination is incredibly expensive computationally. So it s just a very difficult problem to make it fast and easy to use. You have to do a lot of work just to set it up to make it optimal so you can use it. I think it will be a long time before it just becomes something that s automatically on in a scene. Perry Harovas And people thought the same thing about raytracing. To a degree it is almost fast enough where you can use it all the time because of the machines. It s not really because of the algorithm, but it d be nice, because it s still such a huge problem if people figured it out on the algorithm side first, and then we could use it now instead of waiting five years for machines to catch up to it. Duncan Brinsmead One of the nice things about Paint Effects is that everything is on one node, which is kind of one of the bad things too, I suppose, depending on how you look at it. I sort of wanted it where the animation, the modeling, and the rendering are all there together and you can get at it very quickly. If it were a network of nodes all linked together, it would be a lot more complicated to do (brush) blending and to make iterative changes on it. An L systems approach would ve required that I go to some kind of multi-nodal thing and it would ve made it more flexible, I think, on defining the shapes, but it would ve made it more difficult to use and I wanted something that was very simple. Perry Harovas Well, it seems like you have a type of L system in there kind of already, at least with the trees and branching. Duncan Brinsmead Yeah. It s not really the same, it s a different method. It s a parametric definition of an object just with a very large parameter space. I suppose you can look at L systems as being that way, and there are rules involved so they re not totally different, but they re certainly different. Perry Harovas Did you have any Beta testers out there that were using it in production?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (14 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Duncan Brinsmead Yes, quite a few. I don t know if I want to mention who or what they re working on though. We had lots of people using Beta, including companies using it in movies. Some people were working in very high resolution; for example, one shop was working on an enormous project for some kind of theme park where they had multiple screens set up. Perry Harovas I mean, you d never ever think of doing something that large in a traditional way. Even the particle render for hair in PowerAnimator was incredibly memory-intensive. Duncan Brinsmead I know! I wrote that, and it really wasn t initially designed to do hair; we kind of tricked it into doing hair and as a result there were a few things I meant to change later [but] just never got around to doing. But even that alone doing millions of hairs is incredibly memory-inefficient if you want to raytrace them. Just trying to raytrace millions of anything gets to be very difficult. With Paint Effects, if you want to do 10 million hairs, you can just let your renderer run that much longer. Whereas in PowerAnimator it s more like an exponential curve, and there s a point where you hit the slope, where the curve just suddenly shoots off into swap space, and then forget it. Perry Harovas Besides you, how many people actually went into the Paint Effects effort? Duncan Brinsmead It was really a team effort where myself and Andrew Pearce did most of the programming. We had help from others on the team on UI development (including parameter wording, porting to NT, and then some miscellaneous bug fixing near the end.) We had product specialists testing Paint Effects, and they also offered suggestions on parameter names. We did quite a bit of work initially getting down the set of parameters on the brushes after usability testing. This usability testing profiled the fact that we needed to change our layouts in windows. Honestly, putting the toolbar in the Paint Effects window is an effort to try and help people distinguish between the Paint Effects panel and the modeling window, because initially these people were thinking, Oh, it s just another display model in my modeling window, and then they got confused when they tried to tumble or pick objects. I think the toolbar helped a bit with that, because it makes it look more like an IPR sort of window, which is closer to what it is in fact. That was a difficult part of Paint Effects, because we had no precedent in the interface for this kind of interaction mode. Perry Harovas Thank you for all you have done to help further the tools we use everyday, and thank you for taking so much time to give us a behind-the-scenes look at Paint Effects. Duncan Brinsmead Sure! You re welcome.
Russell Owen:Alias|Wavefront User Interface Team Member for Maya 1.0 Russell Owen earned his B.A. from the University of Toronto, majoring in Computer Science and Cultural Anthropology. His research projects there included using computers to teach reading. Russell joined Alias (soon to be Alias|Wavefront) in 1994, initially to work in coding; he was later switched to interface design and development for the nascent Maya, and worked specifically on right-mouse-button context menus and the device control interface for the program. As the interview took place, he was working with Duncan Brinsmead on Maya s new Paint Effects tool. John Kundert-Gibbs What were your early, guiding goals when the interface team first talked of creating the Maya GUI?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (15 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Russell Owen First, we wanted to allow users to work as much as possible in perspective mode. We placed the axis reminder directly in the view, then we made sure all the manipulators (for moving, scaling, and rotating) were also in the scene window, rather than in their own windows. As the manipulators can be accessed by pressing the QWERTY menu keys, the user doesn t even have to move the mouse outside the scene window to change tools. The goal was to keep users from having to look all over the interface to find the most basic tools especially the manipulator tools, the time line, and keyframing. We also wanted to give over as much screen as possible to the scene window, so we built in the ability to remove any or all of the menus, toolbars, and even the Channel box. An experienced user will often work in just one big scene window with nothing else showing. To allow this space savings to happen, we created the hotbox and other contextual menus (usually accessed via the right mouse button), which give users the information and control they need when they need it but don t clutter up the screen the rest of the time. John Kundert-Gibbs Was building the interface entirely out of MEL (Maya Embedded Language) scripts a technical issue, or one driven by user interface concerns? Russell Owen The decision was actually a combination of technical and interface needs. We wanted to give our interface engineers the ability to tear down and rebuild the interface without needing to go into the C++ (base) code. Building the interface on MEL also allows users with little technical experience to rebuild the interface themselves without having to either hire a techie to rework the interface or wait for the next release of the software. John Kundert-Gibbs Above, you alluded to creating a better workflow as a guiding principle for the Maya interface. How does the Maya interface optimize workflow for the expert user? Russell Owen Around here [A|W headquarters], we like to joke that the out of the box Maya user interface hardly resembles an expert s interface. This is because the interface is very open to optimization, allowing the expert user to do away with screen clutter in favor of a more streamlined interface and workflow. We spent some time working with human computer interaction experts, determining the cognitive load limits of a typical user; then we tried to reduce the complexity of the interface to fit within these parameters. In addition to the cognitive grouping of manipulator tools we discussed above, we tried to reduce the user s need to pay attention to modes (a common hurdle in other programs). For example, you re almost always in select mode, meaning that, whatever tool is selected, you can still click or drag an object to select it. Not having to switch back and forth between select and manipulation modes may seem like a simple idea, but it has reduced the difficulty of learning Maya a great deal. Another way we tried to increase the information that is obvious to the user (thereby reducing the cognitive load) was to make the last selected object green, while all other selected objects are white. Because many of Maya s functions (like Stitch, Blend, and Make Collide) depend on the order you select objects, having a visual reminder of which object was selected last can really help in using some of these complex tools.
Habib Zargarpour: Associate Visual Effects Supervisor, Industrial Light and Magic
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (16 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Habib Zargarpour of George Lucas s visual effects firm Industrial Light & Magic (ILM) has been instrumental in helping to create some of the most stunning visual effects ever seen on film. His credits include The Mask, Twister, Spawn, and Star Wars: Episode I The Phantom Menace, and he is currently working on The Perfect Storm. He has been a frequent Maya enthusiast, giving speeches two years in a row at the Alias|Wavefront Global Users Association meetings during the SIGGRAPH convention. He is also one of the nicest and most knowledgeable people working in visual effects today. We spoke with him at length about the way Maya was used in Star Wars, and how it integrated into the ILM production pipeline. Perry Harovas The things you ve done with Maya are amazing! How long have you been using Maya? Habib Zargarpour I m actually coming onto two years with Maya. Perry Harovas And did you start from nothing? Were you going through the tutorials and all that, or did you just dive in? Habib Zargarpour I kind of dove in and tried to figure things out. I m more like a self-hacker rather than reading manuals. So, unfortunately that means that sometimes there are a lot of features that I don t find out about until other people tell me, but I do look at online documentation a lot. I like doing searches through the documentation, the global index, and especially the MEL commands. So, that stuff is really helpful. Perry Harovas What version of Maya did you run on Star Wars? Habib Zargarpour We started with Maya 1.0 and then we were able to get additions like the emit command, which we use heavily in animation, and the curve emitter, so then it was called version 1.1 Alpha 3, which is pretty much like the 1.5 release. Perry Harovas Did you have any trepidation about upgrading the software in the middle of production? Habib Zargarpour We had a concern, but it went very painlessly. We got the new version and basically switched over lunch. It was fine. Perry Harovas How did Maya get implemented into your pipeline at ILM, with all the other applications that you use all having to talk to each other? Habib Zargarpour When we started out, we wanted to look at rigid body dynamics to use on the show and also to replace any particle effects we had to do instead of using Dynamation. But the particular application for me was to use it for crashing the pods and as we were doing R&D for that, we tripped into doing the pod flying with it, which is simulating how they fly and animate. So, we ended up making a really nice setup where all the pod animations were, for the most part, done as rigid body simulations in Maya, and in the same scene we were able to set up the animation for dust for the pods and exhaust animations for the pods. Sometimes pods affecting each other, or hitting each other. Animators were trained to use the package and to use the dynamic controls that they needed. If they wanted to keyframe they could go ahead and keyframe shots. And then we created a Maya pipeline that would take the Maya scene through our in-house software so that we can render it in Renderman. So, it was actually a pretty smooth setup, and the replacing of the geometry to higher resolution was done in our in-house pipeline. Perry Harovas Did you have any problems converting Maya s scene files, animations, and things like trims that are specific to Maya, over to Renderman to render?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (17 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Habib Zargarpour We did have a problem initially, through the in-house pipeline, dealing with NURBS because we were previously just dealing with B-Spline surfaces from Softimage. Other than that, I believe trims made their way through okay and all the other kinds of geometry made their way okay. We wrote our own converter so that so we could add things that were missing or we could decide what would happen to certain types of nodes that weren t recognized. But I think as far as the use we had for it, it kind of started growing from when we were doing the pods to doing things like bubbles in the underwater sequence or suspended algae, doing the effect in the underwater city when Quigon and Obi Wan walked through the membrane. We used it for doing some flock animation of different places and then, of course, eventually it got used for doing the people animation in the stadium people sitting on the seats and also in the end battle sequence where the Gungans and Droids are battling. That whole choreography of running and simulating the crowds all used Maya. So as we started out, we didn t think we would end up with such a large usage of the software, but because of the expandability and the way we could put our own plug-ins into it, we could make it fast and efficient. We were able to take advantage of it for a lot of uses. And I have to say, it s thanks to our supervisor John Knoll, who s open to new ideas and new methodologies and not afraid to dive into doing that. Perry Harovas Was there extensive testing going on to decide what you were going to do in what specific application and what you were actually going to shoot on-set as a real element to comp in? Habib Zargarpour Yeah. Each Visual Effects Supervisor was using their own experience to decide what elements should be filmed and what should be CG. But sometimes George would have an opinion about that and he would want it one way or the other. But the scope of the project and all the different shots that had to be accomplished was really vast, so a lot of times approaching it wouldn t be as obvious as you would think because you would say, Well this might make sense normally to shoot an element, but then we d need hundreds of them from different angles. The Rotunda is an example, with all the people sitting in the boxes, trying to get that kind of footage. Perry Harovas I know that muticolored Q-tips were photographed in the models of the stadium to simulate thousands of people in the stands. Were all those shots eventually replaced with CG? Habib Zargarpour No. There were shots where the Q-tips were left in. Mostly shots where you were not within the stadium or from a distance. The shots where you can see people waving their arms, those pretty much were replaced with CG crowd or footage with a compositing technique. Perry Harovas I believe I remember you saying at the Alias|Wavefront Users Group that you can make them do the wave if you wanted to! Did you do any shots where you just had fun with them? Habib Zargarpour We actually had blooper takes of them doing very funny stuff. But we had some people running blooper shots on their own. What I wanted to do was have a Battle Droid riding one of the pod engines. Perry Harovas How did the MelBots get started? Habib Zargarpour We were doing all kinds of work with dynamics and expressions, and a couple of in-house people were experimenting with them. I started using them for the pods, and that year I think the real robot wars got canceled. So in the back of my mind I was always saying, It s really sad because John Knoll also participates in that, in the robot world, you know, the robot he built in the lightweight category. So the real stuff was always in our minds, so it was only a matter of time to connect the virtual stuff to say, I think Mike Ludlum had run some preliminary tests of rigid bodies that moved around.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (18 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
So I took that idea and took the real robot world idea and I thought, hey if you could build robots actually with rigid bodies, then they ll have expressions so they can fight each other. Then we actually made a sample case with it. We were having a riot with how fun it was to watch these things go at it. I had some really preliminary tests where they would just attack a cube or something. It grew from there to build more intelligence in them. Like the first arena I had didn t have a border so they kept falling off the edge. So I had them build in that experience so that they avoided the edges. Perry Harovas Does it ever threaten to be addictive? Habib Zargarpour Oh yeah, definitely! Each time we run it, people start piling up and looking and cheering for one side or the other. If you had a new robot, you d want to run some test battles first and fine tune your expressions first and then you ll be ready. It s kind of like an evolution thing, it grows. With more experience you can improve your robot. It would pretty unfair if you didn t have battle experience and you just put it in there. You d probably get run over pretty quickly the first time! Perry Harovas I like the rules: you can t delete your opponent, you can t change your robot s size on the fly, and things like that. Habib Zargarpour Right. I still have people coming up to me saying, Hey, you know you can do this& and then you think, Well, that s cheating. The rules are getting longer and longer. Perry Harovas Have you put up a Web site devoted to this yet? Habib Zargarpour I m just in the process of sending that to Alias|Wavefront. We re going to co-host a Web site, I guess, and have a sample scene, probably very preliminary basic rules and a digital scale, a rigid body scale that you put your robot on it, and measure how much it weighs. Perry Harovas Have you ever just said, You know what, I m going to stay here late, I m going to work on something just for fun because it s what I want to do and nobody else has to have a say on how it looks or how it moves ? It doesn t have to be anything big or anything anybody ever sees, but just something that make you happy as an artist. Habib Zargarpour I find myself thinking constantly about things that are possible to do or things I want to be able to do and it becomes like a little test pilot. Kind of like if you re in a restaurant and you have a napkin and you find yourself sketching on it, but as ideas come you think to yourself, I wonder if I can make something like this and hook it up to that? To me the interesting part of the package is when you have these different modular features in it, then you can combine them. You can combine rigid bodies with particles; you can combine relational modeling with animation. All these different things can talk to each other, so then you start thinking in your head about tinkering with different inventions, basically, building them in Maya, and that s the curiosity factor for me. You build things to see if you can make it work a certain way. Or someone else can throw you a challenge, saying, I bet you can t make a locomotive drive chain with an IK skeleton, or something like that, you know? I have lots of scenes that are just little proof of concepts of different effects or inventions. Perry Harovas And I m sure all of those end up getting funneled back into production when you need an idea, and you remember you did something 6 months ago for fun? Habib Zargarpour Yeah, absolutely. And that s where good naming conventions come in. You want to name something exactly what you think it should be called when you want to look for it again.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (19 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Perry Harovas What do you see as the most difficult part of using a commercial application like Maya in production? Habib Zargarpour That s a heavy question. [Pause] Learning it, I guess. Perry Harovas Having the time to learn it or just learning it in the first place? Habib Zargarpour Both. I think there s so much there that you want to be able to continuously learn. That s true with any package, but specifically, to really harness the power you need good training on a package like Maya to be aware of all the different possibilities. And also to take advantage of the expressions. I think it is a voyage of discovery. You cannot be afraid of going into different places or menus. I think that anyone who has fear of what s new is going to have trouble in general in the land of computer graphics. Things change so fast that you have to accept that change is going to happen. I went through this when I had learned Alias and then Softimage came around and I had to [learn that]. Initially I was really angry and bitter that here s a whole new thing I have to learn after becoming good with Alias. I think at that point I decided to accept change and decided that if there s something new, I m going to dive into it. You just have to change your attitude around. Perry Harovas When you open yourself up to things like that, sometimes there s the danger of being into everything new and it affects what you re trying to do if you re excited about the new thing and get lost in it. I imagine you have to scale yourself back sometimes so that you can meet your schedules? Habib Zargarpour Yeah. You don t jump into everything that s new; you have to use your judgment to say, This particular thing looks very promising, so it seems like it s worth checking out. As you check it out, you find pretty quickly if you made a good decision or not. You know, at some points it was more fun to make the [MEL] scripts than to do the work. I think that s the danger with Maya it s really fun to make those buttons and make the icons for them and make them do stuff! I thought that was just extremely fun. We have over 200 of them, some of which I ve made and some of which the rest of the crew did. I think we ve been very successful in integrating it into our pipeline, customizing it for what we do. Perry Harovas There is only so far you can go with MEL and at some point you have to do a plug-in either for speed or just to get it done at all. Did your R&D department write a lot of plug-ins as well? Habib Zargarpour Yes. Actually, our R&D TD s (Technical Directors) would write plug-ins; the software department would handle things like stand-alone tools. Perry Harovas Are you able to write at that level of programming or are you happier and most confident in things like expressions and MEL? Habib Zargarpour I have a software background in mechanical engineering. I learned it there and I have been writing code on various platforms, as well as some custom code on Twister and some of the programs we use in-house. I wouldn t say I m totally confident with it. I m much better at editing than writing it from scratch, and I m certainly much more comfortable with the scripting language, having done a lot of Dynamation work before. Thanks to the speed [Maya] has, there are very few times you need to go to the plug-in level. The cases where you have to go to the plug-in level are if you want to create a primitive and have it deform and have it all be part of the Hypergraph pipeline, the live relational things. I m most likely to hand that stuff out to people that are more capable than me and much faster than me in the actual programming language.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (20 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Perry Harovas Maya Fur and Maya Cloth are part of the package and they re really well integrated, but I imagine that there was some reason that you made a decision not to use those, and to instead use your own in-house tools for those things? Habib Zargarpour Those weren t decisions I had to make, as I wasn t working on that creature portion of the show. The people that were doing the creatures were developing in-house cloth and were open to using any other packages cloth that was available to test, but it just so happened that we finished our cloth and made it very robust before the Maya cloth was ready. At that point, when the Maya cloth was ready and we saw it, I think our dynamics were still ahead in terms of robustness and realism. They still had improvements to make, which they did by SIGGRAPH last year. The people who were deciding which methodology to use were happy with what we already had. In terms of Fur, we ve had a long history of doing fur kind of projects here, and they ve been going through different evolutions with every show. The first use, I think, was in The Flintstones, believe it or not. Then we used it on the monkeys in Jumanji, and on the lion. Then the latest resurrection of it is in Mighty Joe Young with the gorilla fur, where we added dynamics to it. Perry Harovas Is it the same in-house renderer as your particle renderer? Habib Zargarpour It used to be separate, but now both are integrated into the same. I don t know if the people responsible for doing that work had a chance to look at Maya Fur or not. Certainly, what they saw with the Paint Effects, they were very impressed with this year at SIGGRAPH. Perry Harovas Did you get a chance to see Paint Effects after your speech at the Alias|Wavefront User s Group? Habib Zargarpour Unfortunately not. I d seen it last year, but it was an independent unit; it wasn t integrated into the package and I don t think he [Duncan Brinsmead] had all the animation features. But I heard people talk about it. It sounded really promising. Perry Harovas At SIGGRAPH, ILM presented a technical paper that described how you were able to keyframe the dynamics, which is a fascinating concept. Have you tried to implement any of that in Maya? Habib Zargarpour We implemented that concept. In the Rigid Bodies, we were using impulses to add our own guidance into what we wanted to do. In some ways, the way pod rigs were set up was pretty much that you have human input into a dynamics system to guide it, to tell it where to go. But basically, the bottom line would be that the simulation is going to decide where it s going based on its own characteristics of mass, momentum all these different things. So, in a way, that setup is entirely an input into a dynamic system, as opposed to letting it run purely based on fields, like we do on particles. With particles, there are so many of them that you have to come up with global controls. Perry Harovas So the cage you set up, with the different springs attached to the engines of the pods, that was your input device, by keyframing that, then letting the dynamics of the springs on top of it take over under that? Habib Zargarpour Exactly. Perry Harovas How, if you can tell me this without killing me, did you implement denting in the pieces of the engine that hit the ground?
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (21 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Habib Zargarpour [Laughs] We had several different R&D projects at the same time looking into that, and one of the methodologies was to take expressions and use lattices to deform them based on impact. To deform the object, you have to do all kinds of tricky things to the rigid bodies for them to recognize that they got deformed, but I won t go into that! It was a combination of what s in the package and some expressions and plug-ins that we managed to get the airframe technique working so it would automatically dent as it hit and deform to whatever object it was impacting. It was very exciting for us, for example, to get the front ring of the engine hitting the ground. If that was a solid piece, it would just hit the ground and fly out, whereas if it s an airframe, the bottom starts to take the impact and warp backwards and causes a distortion to go through it. It behaves more like a piece of sheet metal would, that could deform, as opposed to a hard piece that would just fly off. The last technique was something we had developed as a plug-in, which was a deformation node. We could hand-place and animate them as a live relational node in the Hypergraph. We would just dial in how much deformation we wanted. That technique was used when the wrench goes into the Marpod engine, for example. You see dents coming out of the different spots on the engine. That way, it was real easy for us to just place them in different spots, and if George wanted more or less of them or different timing on them, [we could do that]. So it was very simple for us to place the deformers manually and just hand-animate them coming on. Because they were relational it was animatable, so it wasn t like we were permanently deforming it. Perry Harovas Were there any instances where the dynamics were not working, or taking much too long to calculate? Habib Zargarpour There were a few shots where the animators were trying to get the pod rigs to move a certain way, and there would be maybe some really fast turn that they couldn t do, or a specific action. So for the most part, they would make the simulation so that most of the pieces were moving physically correctly, and then they could go in and hand-edit some of the keyframes. Like, if an engine went a little too high in a certain frame, they could bring it down and basically post-edit it as if it was motion capture. But that didn t happen very often. Perry Harovas How long did it take you to develop the cages that surrounded the pods and engines? Habib Zargarpour That s a good question. That process took about three to four months. And the reason being that it was basically an engineering project trying to make an airplane and fly it. You need test pilots and you need mechanical configurations. We ran into all kinds of interesting discoveries, like dealing with moving rigid body hierarchies. It was not only a matter of building it, but also making tools that could handle it. In Maya 1.0 you couldn t do rigid body hierarchies, so we had to come up with a way to do the hierarchies and then a way to move them and rotate them. But it wasn t four months of full-time work for me. As I was doing the pod crashes, I was also doing this research. As an example, if you weren t real precise with your Pod rope configuration, let s say like where the pins would go, you would end up with some high-frequency problems at high speed causing the cockpit to break off or something. That s why I keep saying it s like dealing with a real craft it physically has to function that way. A lot of the time was spent trying to get the right configuration. What is the best way to grab an engine? Do you grab it from the front, which is the first thing we tried, or do you grab it from all four corners? Each decision has its own repercussions and efficiency. One of the difficulties in doing the pod race was we weren t able to tell them any details about what we were doing with the rigid bodies. We just had to say, Look, we re trying to go really fast and it s misbehaving or doing this or that. Not having the luxury of sending [Alias|Wavefront] a scene and ask Why doesn t this work? that s always a frustrating thing not to be able to do that.
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (22 of 23) [11/27/2000 9:35:16 PM]
Books24x7 Mastering MAYA Complete 2
Perry Harovas I think it s maybe everybody s misperception that ILM has a really, really fast machine on everybody s desk. Habib Zargarpour Right, that s what I thought before I came here! I thought everyone would be doing real-time renders on big machines. Perry Harovas Were you given something that could do the calculations in our lifetime so that you wouldn t have to be there all day and all night to wait for the simulation? Habib Zargarpour I just used my [SGI] O2. What you had to do is use the tools in the package to make efficiencies happen. If two objects are really heavy, you put them on different layers. Those kinds of things you have to constantly watch for and take advantage of. But yeah, it would be really nice if they multi-threaded the package as far as dynamics go, not just rendering, so that you could run the simulation on an Origin or do massive parallel processing on fast machines. Nowadays, even desktops are coming with four processors! Perry Harovas Is there a concern about using commercial packages, which change often, and sometimes go away? Habib Zargarpour Yeah, that s always a concern. I feel like we need to take full advantage as much as we can from vendor software because there are so many developers involved with it. There s only so much manpower you have in-house, and we do have amazing programmers here. But I find that if we are able to harness some or both of those rather than making it exclusive, there are huge benefits in that kind of relationship. As users, we end up benefiting from developers and dedicated companies who make tools for you. And more and more, I guess, packages are opening up with APIs and plug-ins, and it s creating this interesting gray area where code is code, and it s almost like it doesn t make any difference what it s called or where it s running. Put one package into another or vice versa. But then what s important is the user interface and the design, right? Perry Harovas Do the other users of Maya out there ever benefit from things that you ve developed in ILM, or do they just not let anything go to Alias|Wavefront? Habib Zargarpour That s a good question. We have a lot of suggestions for them on improving the package, and most of those changes get put into the official package. Perry Harovas Thank you for a such a wonderful conversation, and for all your thoughts and ideas and excitement. Habib Zargarpour You re welcome!
Books24x7.com, Inc. © 2000 – Feedback
http://www.books24x7.com/viewer_r.asp?bkid=607&chnkid=971921736 (23 of 23) [11/27/2000 9:35:16 PM]
USING MAYA: ESSENTIALS VERSION 4
USING MAYA: ESSENTIALS 2001,
Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A. All rights reserved. Maya 4 Documentation Team: Steven Brooks, Susan-Belle Ferguson, Lisa Ford, Claude Macri, Susan Park, Diane Ramey, and Linda Rose. The images in this book were created by: Daniel Siriste, Ben Radcliffe, and Kevin Mannens. Alias is a registered trademark and Alias|Wavefront, the Alias|Wavefront logo, Conductors, Dispatcher, Trax, Wavefront IPR, VizPaint2D, and ZaP!iT are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Maya is a registered trademark and Maya Artisan, Maya Builder, Maya Cloth, Maya Complete, Maya Fur, Maya F/X, Maya Invigorator, Maya Invigorator Lite Edition, Maya Live, Maya Paint Effects, Maya Real Time SDK,and Maya Unlimited are trademarks of Silicon Graphics, Inc., used exclusively by Alias|Wavefront, a division of Silicon Graphics Limited. IRIX and Silicon Graphics are registered trademarks and SGI is a trademark of Silicon Graphics, Inc. Wacom is a trademark of Wacom Co., Ltd. NVidia is a registered trademark and Gforce is a trademark of NVidia Corporation. Inferno and Flame are registered trademarks of Discreet Logic Inc. Linux is a registered trademark of Linus Torvalds. Red Hat is a registered trademark of Red Hat, Inc. Microsoft, Windows NT, and Windows 2000 are trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark, licensed exclusively through X/Open Company, Ltd. All other product names mentioned are trademarks or registered trademarks of their respective owners. Graph Layout Toolkit, 1992-1996 Tom Sawyer Software, Berkeley, California. All Rights Reserved. This document contains proprietary and confidential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, its affiliates, nor their directors, officers, employees, or agents are responsible for punitive or multiple damages or lost profits or other special, direct, indirect, incidental, or consequential damages including any damages resulting from loss of business arising out of or resulting from the use of this material, or for technical or editorial omissions made in this document.
ALIAS|WAVEFRONT ■ 210 KING STREET EAST ■ TORONTO, CANADA M5A 1J7
CONTENTS Part 1 Basic Features 1
WORKING IN MAYA
17
Starting Maya
17
Command line options
17
Running prior versions of Maya Environment variables Main window
18
18
19
Main window and floating windows Maya workspace
23
24
Streamlining the interface
26
Working with objects
26
Object display
27
Object attributes
28
Attributes and nodes
29
Working with tools and actions Using actions
30
30
Using tools
30
Manipulators and handles Working with editors MEL commands
31
32 32
Using the Hotbox
33
Displaying recent selections
34
Changing the appearance and contents of the Hotbox Disabling the Hotbox Using marking menus
2
35 36
Scene management Getting help
34
38
39
VIEWING YOUR SCENE
41
Orienting the XYZ system
41
Changing the orientation/up axis World coordinates
42
Local coordinates
43
Working with cameras
42
43
Creating a new camera
44 USING MAYA: ESSENTIALS 3
CONTENTS
Setting Camera options Moving the camera Camera tools
45 48
49
Looking through a camera
52
Changing camera settings
53
Camera Attribute Editor
54
Setting a perspective view
58
Creating new perspective views Setting an orthographic view
59
59
Creating new orthographic views Lighting your scene Arranging views
59
60 61
Displaying the workspace only Laying out the views Marking a view
64
64
66
Creating a bookmark
66
Selecting custom bookmarks Renaming a bookmark
67 67
Adding a bookmark to a shelf Enabling and disabling nodes
3
EDITING OBJECTS Selecting objects
67 68
69 69
Selecting objects individually
69
Selecting multiple objects in a scene Inverting a selection
70
70
Selecting all objects in a scene Selecting objects by type
70 71
Selecting objects by name
72
Selecting all objects in a set
72
Selecting all objects in a display layer Deleting objects
72
Deleting a single object
72
Deleting object components by type Deleting all objects by type Duplicating and instancing objects Duplicating objects
USING MAYA: ESSENTIALS 4
72
74
74 74
73
CONTENTS
Creating instances of objects Working with groups
76
78
Grouping objects
78
Ungrouping objects
79
Creating an empty group
80
Creating object hierarchies (parenting) Parenting objects
80
80
Unparenting objects
81
Undoing and redoing actions
82
Undoing your last action
82
Redoing and repeating actions Editing object attributes
4
TRANSFORMING OBJECTS
82
82 83
Selecting Transformation Tools Using manipulators
83
83
About manipulator handles Using axes and pivot points
84 84
What are pivot points? What is an axis? Moving objects
84
87 88
Choosing a coordinate system for the Move Tool Using the Move Normal Tool
91
Moving curves on surfaces
91
Moving a path animation marker Rotating objects
92
92
Changing the rotation order Choosing a rotate mode
92 93
Animating rotation channels Scaling objects
90
94
94
Using the Show Manipulator Tool
95
Selecting an item’s history node Changing a curve’s parameter range
96 97
Displaying manipulators for lights and cameras Using the Default Object manipulator Entering numeric values
97
98
98
USING MAYA: ESSENTIALS 5
CONTENTS
Using the Numeric Input field
98
Using the Command Line
100
Combining transformations
100
Using proportional modification
101
Specifying proportional modification falloff Using the PropMod script Creating locators
105
106
Using Measure Tools
107
Using distance measures
107
Displaying parameter values Measuring arc lengths
5
DISPLAYING OBJECTS
110
112
115
Displaying items in Maya Using a grid
102
115
115
Setting grid options Displaying View tools
116 118
Changing Wireframe Color
119
Specifying how objects display
120
Hiding and showing objects Hiding geometry
122 123
Hiding kinematics
123
Hiding deformers
124
Isolating selected objects or components Displaying object components
125
126
Displaying geometry components
127
Displaying camera and light manipulators
128
Displaying camera manipulator controls Displaying light manipulator controls Working with templates Using layers
130
130
Using the Layer Editor
131
Creating and naming layers Assigning objects to layers Removing objects from layers USING MAYA: ESSENTIALS 6
132 132 133
128 129
CONTENTS
Deleting layers Editing layers
6
MODELING AIDS Snapping
133 134
139 139
Snapping icons
139
Snapping hotkeys
140
Snapping along a constraint axis
141
Snapping to a curve on surface or isoparm curve Snapping aligning objects Limiting selections
142
146
Limiting selection by object type
146
Limiting selection by component type
147
Limiting selection to hierarchy items
151
Limiting selection to template objects Limiting selection by task
151
152
Moving selection limitations to the shelf Freezing and resetting transformations Locking transform tools and manipulators Using construction history
153
153 154
154
Making objects live
156
Creating levels of detail
157
Changing the Threshold distances Re-ordering the levels
159
159
Adding and editing levels
159
Previewing more than one object at the same time Notes about orthographic cameras and level of detail
7
MANAGING FILES AND PROJECTS Creating a new scene Opening a scene
160 160
161 161
161
Setting Open options Saving files
141
162
165
Setting save options
166
Tips for reducing file size Optimizing scene size Managing projects
168
168 169 USING MAYA: ESSENTIALS 7
CONTENTS
Where Maya stores scene information
170
Using absolute and relative paths
170
Multiple project directory paths Creating projects
171
171
Specifying the current project
172
Editing the current project
172
Mapping missing directories
173
Mapping from UNIX to Windows
173
Mapping from UNIX to UNIX Supported file formats Importing files
173
174
175
Using default nodes
175
Importing files by copying Importing move files
176 177
Importing Adobe Illustrator® and EPS files Importing animation curves
179
Importing files by reference
180
Exporting files
185
Setting export options
185
Exporting scene elements Exporting move files
186 187
Using plug-ins for exporting
188
Exporting to Wavefront (OBJ)
188
Exporting to IGES, DXF, and Alias Wire Exporting to RenderMan
191
SETTING ENVIRONMENT VARIABLES
195
About environment variables Creating the Maya.env file Rules for Maya.env
195 195 196
Where Maya looks for Maya.env Modifying standard paths Other path settings
8
197
198 198
Standard Maya environment variables
USING MAYA: ESSENTIALS
189
190
Exporting animation curves
8
178
199
CONTENTS
Part 2 Editors 9
USING MAYA EDITORS
207
Using General Editors
208
Using the Component Editor
209
Using the Attribute Spread Sheet Using the Relationship Editor
212
217
Setting view options
218
Displaying relationships and objects Creating relationships
218
220
Selecting relationships, relationship members, and objects Adding and removing relationship members Using the Attribute Editor
221
221
222
Displaying the Attribute Editor
222
Loading object attributes into the Attribute Editor
225
Viewing attributes for different objects at the same time Adding a custom attribute
227
Editing custom attributes
229
Deleting custom attributes
230
Changing node behavior
230
Setting keys for attributes in the Attribute Editor Linking attributes
232
Locking attribute values
232
Launching the Expression Editor
232
Mapping a texture to an attribute value
Using the Channel Box
231
232
Breaking connections
Using the Color Chooser
226
233
233 236
Displaying the Channel Box
236
Displaying object attributes
237
Adding attributes to the Channel Box Displaying component attributes
238 238
Changing the display format
239
Entering values for attributes
240
Setting keys for attributes from the Channel Box
244
Setting breakdown keys for attributes from the Channel Box Breaking connections from the Channel Box Locking attribute values from the Channel Box
245
246 246
Launching the Expression Editor from the Channel Box
247 USING MAYA: ESSENTIALS 9
CONTENTS
Linking attributes from the Channel Box
247
Modifying an object’s history (inputs) Using the Outliner
247
249
Understanding scene hierarchy terminology Navigating the Outliner
251
Displaying shape nodes
252
Displaying attributes
252
Displaying specific types of nodes Parenting objects
250
254
254
Selecting and renaming objects Reordering nodes
256
257
Limiting the information shown in editors Limiting the display
258
259
Showing all items not currently displayed
260
Showing all items (removing restrictions) Storing your restrictions
260
260
Deleting stored restrictions
261
Controlling display of auxiliary nodes
10
USING THE HYPERGRAPH
262
263
Opening the Hypergraph
263
Understanding scene hierarchy terminology Using the scene hierarchy
265
266
Expanding scene hierarchy nodes
266
Displaying special nodes and connections Parenting objects
268
270
Rearranging scene hierarchy nodes
272
Displaying a background image with a scene hierarchy Understanding the dependency graph Using a dependency graph
276
276
Displaying render node connections
277
Displaying upstream and downstream connections Dragging nodes into a dependency graph Disconnecting nodes in a dependency graph Connecting nodes in a dependency graph Updating the layout of a dependency graph Clearing the contents of a dependency graph Returning to the scene hierarchy
USING MAYA: ESSENTIALS 10
274
286
278
280 281 282 286 286
CONTENTS
Editing objects
286
Selecting objects
286
Adding and selecting an IK handle Renaming an object
287
287
Hiding an object in the workspace Editing an object’s attributes Creating a render node
288 288
289
Altering the view of a graph
289
Tracking the view
289
Dollying the view
289
Dollying a region
290
Fitting an entire graph in the window
291
Centering selected nodes in the window Centering a hierarchy in the window
291 292
Centering a hierarchy branch in the window Adjusting view transition speed Setting graph update options
292 292
Undoing a view of a scene hierarchy Using bookmarks for graph views
293 293
Displaying a graph vertically or horizontally Rebuilding the graphs
11
SETS AND PARTITIONS
292
295
295
297
How you can use sets Understanding sets
297 298
Sets you create
299
Sets created by Maya
300
Creating, selecting, and removing sets Creating sets
303
Selecting sets
304
Removing sets
303
304
Creating sets for quick selection Editing set membership Altering the display of sets Understanding partitions Partitions you create
304
305 305 306 306
Partitions created by Maya
307
Creating, displaying, and removing partitions
308 USING MAYA: ESSENTIALS 11
CONTENTS
Adding sets to partitions
309
Part 3 Preferences 12
SETTING PREFERENCES
313
Settings/Preferences menu
313
Where Maya stores preferences
314
Saving preferences using userSetup.mel Preferences window Interface
316 316
UI Elements Misc
317
317
Display
318
Kinematics
319
Animation
319
Manipulators NURBS
319
321
Polygons
321
Settings
322
Dynamics
323
Files/Projects Keys
324
325
Modeling
325
Selection
326
Snapping
327
Sound Timeline Undo Modules
327 328 329 329
Changing color settings
330
Changing default colors Specifying tool settings
13
330
332
Specifying performance settings
333
Loading and unloading plug-ins
334
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS Creating and editing shelves
USING MAYA: ESSENTIALS 12
315
339
339
CONTENTS
Creating and deleting shelves Adding shelf items
341
342
Removing shelf items
344
Moving and copying shelf items Renaming shelves
344
345
Reordering the shelves
345
Changing shelf icons
345
Changing icon labels
347
Setting Shelf options
348
Adding icon names
349
Changing MEL command(s) associated with an icon Creating and editing marking menus Creating marking menus
351
352
Assigning marking menus to hotkeys
355
Modifying existing marking menus
355
Adding submenus to menu items
358
Associating a MEL script with a menu item Deleting marking menus Assigning hotkeys
362
Viewing hotkey lists
364
Changing or deleting a hotkey
365
Adding commands for hotkey assignment
WORKING WITH PANELS AND LAYOUTS Using the Panel Editor
365
367
367 368
Renaming existing panels
368
Creating and deleting panels Defining layouts
363
364
Searching for commands
Managing panels
359
360
Assigning hotkeys to standard commands
14
349
368
370
Selecting panel layouts Adding a layout to a shelf Creating layouts
371
Deleting layouts
373
Maintaining layout history
370 371
374
USING MAYA: ESSENTIALS 13
CONTENTS
USING MAYA: ESSENTIALS 14
Image by Daniel Siriste
PART 1
BASIC FEATURES
1
WORKING IN MAYA Throughout Maya you’ll find a consistent interface and a style of working that is both fast and easily customizable. This chapter presents these methods of working so you can quickly launch into your projects.
STARTING MAYA You can start Maya by either double-clicking the Maya desktop icon or by typing maya at a command prompt. On Windows, you can also select Start > Programs > Maya (Complete or Unlimited) 4.0 > Maya.
Command line options If you start Maya from the command line, there are various startup options you can specify. For example, you can open a file at startup using the -file flag: maya -file filename
To see the available startup flags, type the following: maya -help
To execute Maya commands without the interface, use either -prompt or -batch. The prompt flag issues a MEL prompt for you to type commands. Type quit to exit the prompt mode. Use the -batch flag to run commands without user input, such as in shell or batch scripts. The -batch flag starts Maya, executes any commands you specify, and then closes Maya. For example, you could create a script to open a file from a prior version of Maya in order to update it to the current version: maya -batch -file someMayaFile.mb -command "file -save"
Note The -batch command is not used for batch rendering. Instead, use the Render command. However, -batch does check out a render-only license instead of a full Maya license. On Windows, type mayabatch when using the -batch flag. The mayabatch command runs within the command prompt window, whereas the maya command starts a separate window.
USING MAYA: ESSENTIALS 17
WORKING IN MAYA | 1 Starting Maya
Running prior versions of Maya In some cases, you may want to run a prior version of Maya. On Windows, simply choose the prior version from the Start menu. On UNIX, you need to use a symbolic link pointing to the installation directory of the prior version. To add a symbolic link, log in as root and type the following commands: cd /usr/sbin ln -s /usr/aw/mayaX.X/bin/maya mayaXX
where XX is the version number. From then on, in any shell windows you open, you can type mayaXX to run the prior version.
Environment variables At startup, Maya uses a number of environment variables to set the environment. Many of the variables are included in the Maya program and are set automatically when you start Maya. To configure Maya further, you can set additional environment variables. For more information, see Chapter 8, “Setting Environment Variables”.
USING MAYA: ESSENTIALS 18
WORKING IN MAYA | 1 Main window
MAIN WINDOW Read this section for a brief summary of the main interface elements. As you read, keep in mind the following: •
You can show or hide any of the UI elements in the main window using the Display > UI Elements menu.
•
You can also hide a UI element by clicking the hide button to the left of or above the UI element. To show a UI element, right-click another hide button and select the desired UI element from the pop-up menu.
•
The critical part of the interface is in the workspace panel; see the next topic, "Maya workspace" on page 24 for details.
•
You can hide all the interface elements and instead use Maya’s quick command features: the Hotbox, Marking Menus, and hotkeys. For an introduction to this topic, see "Streamlining the interface" on page 26.
•
A menu icon appears to the right of the mouse pointer when a right mouse button pop-up menu is available for the control over which the mouse is hovering.
Title bar Main Menu bar Status Line Shelf Scene Menu bar
Tool Box
Workspace
Time Slider Range Slider Command Line Help Line Channel Box Layer Editor
USING MAYA: ESSENTIALS 19
WORKING IN MAYA | 1 Main window
Main Menu Bar The menus in Maya are grouped into menu sets. Each menu set corresponds to a module of the software: Animation, Modeling, Dynamics, and Rendering. Maya Unlimited has additional modules: Cloth and Live. As you switch between menu sets, the right-hand menus change, but the left-hand menus remain the same; these are the common menus. To switch between menu sets, use the Status Line pull-down menu or hotkeys. The hotkeys are: F2 (Animation), F3 (Modeling), F4 (Dynamics), and F5 (Rendering).
Select the menu set you want to work with ... and see these menus change
... while the common menus stay the same
Status Line
ck hi butt gh o lig n ht se sn le ct ap io n m od m e ak e lis live to co f o ns pe ra tr re ucti tion nd on s er h fra ist re nd m ory e er g nu lob al m s er ic in sh pu ed ow t ito /hi rs de
lo
as m n io ct le se
m
en u
se le ne ct w or op sc en en sa sc e ve en sc e en e se le ct io n m od
e
ks
The Status Line has a variety of commands, mostly used for modeling. For example, the central group of buttons are used to select objects and components. See "Working with objects" on page 26 for an introduction to this topic. Also see Chapter 6, “Modeling Aids,” which describes most of the options on the Status Line. The last three buttons are used to show or hide editors, including the Attribute Editor, Channel Box, Layer Editor, and Tool Settings. See Chapter 9, “Using Maya Editors.”
For better organization, the buttons are broken into groups that you can expand and collapse, as shown in the following illustration.
Click the arrow bar to expand
Click the expanded bar to collapse
USING MAYA: ESSENTIALS 20
WORKING IN MAYA | 1 Main window
Shelf The Shelf is a collection of tools and other commands that you can customize for your specific needs. By creating custom shelves, you can organize commonly used actions and tools into groups. For example, you can create modeling, animating, and rendering shelves with appropriate tools and actions for each option. You can also store the same tool more than once, but with different settings. For information on creating, editing, and deleting shelves, see "Creating and editing shelves" on page 339. To switch between shelves, click the tab icon, as shown in the following illustration. Click to switch between shelves
Pull down menu for shelf-related options
Tool Box The Tool Box contains common tools as well as the last selected tool and icons for changing views and layouts. Select Tool Lasso Tool
New Tool
Move Tool Rotate Tool Scale Tool Show Manipulator Tool last selected tool Single Perspective View Four View Persp/Outliner Persp/Graph
New Quick Layout buttons
Hypershade/Persp Persp/Graph/Hypergraph Panel/Layout
USING MAYA: ESSENTIALS 21
WORKING IN MAYA | 1 Main window The space on the Tool Box that is allocated to the “last selected tool” displays the icon of the last tool you selected from a menu or shelf. Tools that already have an icon on the Tool Box, such as the Move Tool, won’t appear in this space. (This is also referred to as the non-sacred tool.) See Chapter 3, “Editing Objects,” for information on using the Select Tool and Lasso Tool. See Chapter 4, “Transforming Objects,” for information on using the transformation tools. See Chapter 2, “Viewing Your Scene,” for information on using the Quick Layout buttons.
Workspace The main purpose of the workspace is to view your scene. You can also display various editors and arrange the workspace panels in different layouts. For further discussion, see the next topic "Maya workspace" on page 24.
Layer Editor Layering is a method of grouping objects so you can easily hide them from view, use them as a template, or render them in a separate pass. The Layer Editor provides the main controls for creating layers, adding objects to layers, and making layers visible or invisible. See "Using layers" on page 130 for more information.
Channel Box Most of Maya’s interface elements are common to 3D software packages, but the Channel Box is a unique and powerful feature. It gives direct access to the building blocks of Maya: attributes and nodes. Specifically, it shows the keyable attributes, also known as channels. (A keyable attribute means you can set animation keyframes for it.) For further discussion, see "Object attributes" on page 28.
Time Slider and Range Slider The two sliders are for controlling the frames in your animation. The Time Slider includes the playback buttons (also called transport controls) and the current time indicator. The Range Slider includes start and end times, playback start and end times, the Range Slider bar, the Auto Key button, and the Animation preferences button. For information on using the animation controls, see Using Maya: Animation. Time Slider
Playback buttons
Current time
Start time
Range Slider
Playback start time Range Slider
Playback end time
End time
Current character Auto Key button Animation preferences button
Command Line Another powerful feature of Maya is the MEL command language, and the Command Line is your pipeline to it. Notice that it has two halves.
USING MAYA: ESSENTIALS 22
WORKING IN MAYA | 1 Main window Enter MEL command with required arguments
Command response
Script Editor button
The left side is where you can type MEL commands. For example, you can type a command to quickly create a sphere with a specific name and radius. For a longer series of commands, use the Script Editor, which you can launch from the button on the far right. The right half displays system responses, error messages, and warnings. It can also show echoes of all commands if you turn on Script > Echo All Commands from the Script Editor. You can resize the width of the input and the output sections of the Command Line.
Position the mouse between the input and output section. Drag the resizing tool to the left or the right to resize the sections.
You can use the up and down arrow keys in the Command Line to scroll through the list of commands that have been previously executed in the Command Line.
Help Line Like several other applications, you can look at the help line for descriptions, instructions, and other useful information. For full details, see "Help Line" on page 39.
Main window and floating windows Maya has several editors that launch as floating windows separate from the main window. To manage these windows, note the following tips. On UNIX, use Window > Raise Application Windows to display open windows hidden by the main window. On Windows, floating windows stay on top of the main Maya window by default. In order to bring the main window on top, you can detach each floating window from the main window. Click the icon in the upper-left corner of the floating window and turn off Attach to Main Window. Tear-off menus You can display menus as separate windows. This is helpful when you use a menu repeatedly. Pull down the menu and click the tear-off line at the top. Tear-off menus always display on top.
USING MAYA: ESSENTIALS 23
WORKING IN MAYA | 1 Maya workspace Drag the window by the title bar to move it a new location
Click the tear-off line to tear off the menu
Click the Close button (x) to close the tear-off menu
MAYA WORKSPACE The main purpose of the workspace is to view your scene. You can also display various editors and arrange the workspace panels in different layouts. Most of the commands for using the workspace are on the menu bar at the top of the workspace panel. In particular, the Panels menu contains commands for changing views, displaying editors, and arranging panel layouts.
Viewing your scene The view panel is really the view seen through a virtual camera. There are four default views: perspective, front, side, and top. Select a view from the Panels menu. To look around the scene, you move the camera. The main commands are shown in the following table:
Hold Alt
Drag
To... Tumble
L
(Tumbling does not work in orthographic windows.)
USING MAYA: ESSENTIALS 24
WORKING IN MAYA | 1 Maya workspace
Hold
Drag
To... Track
Alt
M
Dolly
Alt L M
Ctrl
Bounding Box Dolly
+ Alt L
Drag right to dolly in and left to dolly out. This navigation is available in several editors too, like the Graph Editor and Hypergraph. Additional view commands are available under the View menu. For more information, see Chapter 2, “Viewing Your Scene.” Layout options You can split the workspace into a multi-panel layout. For example, press and release the Spacebar to switch to the default, four-panel layout. Press and release the Spacebar again to expand the active panel to full screen.
In addition, you can display various editors in any panel, giving you the capability of arranging layouts to suit a specific workflow. Default layouts are listed under the Panels > Saved Layouts submenu. You can also use the Panels editor (Panels > Panel Editor) to create your own.
USING MAYA: ESSENTIALS 25
WORKING IN MAYA | 1 Streamlining the interface
STREAMLINING THE INTERFACE You can easily customize the Maya interface to suit your work style. One of the recommended ways of streamlining the interface is to hide the interface elements like menus and tools and devote more space to your scene window. To hide or display elements, use the Display > UI Elements submenu. You can quickly hide all UI elements except the workspace panels by choosing Display > UI Elements > Hide UI Elements. For example, you can maximize the scene view while working on detailed models. In place of menus and toolbars, use hotkeys, the Hotbox, Marking Menus, and popup menus. The following are descriptions of each. Hotkeys
Hotkeys are also known as keyboard shortcuts. There are several default hotkeys, and they appear on the menu label next to the corresponding menu command. You can change these hotkeys and assign new ones using the Hotkey Editor (Window > Settings/Preferences > Hotkeys). For information on assigning hotkeys, see "Assigning hotkeys" on page 362.
Hotbox
The Hotbox is a way to quickly navigate the Maya menus without using the menu bar. It pops up when you press and hold Spacebar. It puts all of the Maya menus in quick reach, instead of at the top of the screen. Unlike the main menu bar, you can control which menu sets display in the Hotbox. For details, see "Using the Hotbox" on page 33.
Marking Menus
Like the Hotbox, Marking Menus are a pop-up menu that puts commands in quick reach, including commands not on menus. For example, with nothing selected, you can right-click in the workspace and choose Select All. You can also modify Marking Menus to suit your workflow. For details, see "Using marking menus" on page 36.
Pop up menus
Several Maya editors display popup menus when you right click in them. Typically, they include commands from that editor’s menu. For example, the popup menu in the Outliner gives you controls for what types of information display.
WORKING WITH OBJECTS The scenes you create in Maya consist of objects, and objects consist of components, such as control vertices (CVs), edit points, patches, polygonal faces, and so forth. In Maya, you work with objects in either object or component selection mode. Object mode is the default and is for manipulating objects as a whole. Component mode displays and lets you edit the object’s components. You switch between object and component mode from the Status Line. You can also switch between modes with the hotkey F8. The following illustration shows a torus in object mode and the same torus modified by moving CVs in component mode.
USING MAYA: ESSENTIALS 26
WORKING IN MAYA | 1 Working with objects
Object mode
Component mode
Selection masks To select just the object or component types you want to edit, you use selection masks, also called pick masks. Pick masks are available on the Status Line and also as Marking Menus when you right click on an object. For example, right click on a NURBS sphere, choose Control Vertex from the Marking Menu, and the CVs display for you to edit.
For more information, see "Limiting selections" on page 146.
Object display By default, objects appear in wireframe display. To view objects with shaded surfaces, choose a shade mode from the Shading menu on the view panel. The hotkeys for these options are shown in the following table:
4
Wireframe
5
Smooth Shade
6
Smooth Shade with Hardware Texturing
USING MAYA: ESSENTIALS 27
WORKING IN MAYA | 1 Working with objects For NURBS objects (objects created from NURBS curves), you can also control how smooth the surface appears using the commands under Display > NURBS Smoothness. This affects display only, not how the object renders. The hotkeys are in the following table:
1
Rough
2
Medium
3
Fine
For more information on object display, see Chapter 5, “Displaying Objects.”
Object attributes All object and component characteristics are stored as attributes. When you model, animate, assign materials, and do any kind of manipulation on objects, you are changing attribute values. You can see and edit attributes directly in the Channel Box or the Attribute Editor. The Channel box contains the keyable attributes for one or more objects. The Attribute Editor contains all attributes for any single object. Entering values A simple example of working with object attributes is to change its translation. In the Channel box, the Translate X, Y, Z attributes appear at the top. To quickly position an object at the coordinates 1, 1, 1, select all three attributes, type 1, and press Enter. (In general, typed values do not go into effect until you press Enter or exit the field.) Using the Channel box to change translate attributes
Note When you change values, Maya inserts characters by default. On Windows, you can also overtype (replace existing characters) as you type. Press the Insert key for overtype mode. Numeric Input field An alternative way to enter values for moving, scaling, or rotating is to use the Numeric Input field in the Status Line. Enter the numbers in the order of X-axis, Yaxis, and Z-axis, with a space between each number. (Do not use any punctuation between the numbers.) You can enter positive and negative real numbers.
USING MAYA: ESSENTIALS 28
WORKING IN MAYA | 1 Working with objects
Numeric Input field on Status Line
For more information on using the Numeric Input field with the transformation tools, see "Entering numeric values" on page 98. Also see "Selecting objects by name" on page 72 for information on using the Numeric Input field to select objects.
Attributes and nodes As you work with attributes, you need to be aware of Maya’s node architecture. Unlike other software packages, Maya lays bare its underlying programming structure. The building blocks are nodes, which are groups of related attributes. For example, the attributes describing an object’s transformation are in a transform node. Why should you care about nodes? At a minimum, simply be aware that attributes are grouped together in this way. In general, nodes fall into one of these types: transform (object position), shape (component positions), input (object construction), and shading (object materials). Transform node
Shape node
Input node
Shading node
Attribute Editor Channel Box
With more experience, you can take advantage of nodes to make your own connections. For example, you could link the animation of two orbiting spheres by connecting the rotation attributes of those objects’ nodes. For more information, see Chapter 10, “Using the Hypergraph.” (The Hypergraph graphically depicts the objects and nodes in your scene so you can easily examine and modify connections.)
USING MAYA: ESSENTIALS 29
WORKING IN MAYA | 1 Working with tools and actions
WORKING WITH TOOLS AND ACTIONS We’ve described how you can edit object attributes by typing values, but you’ll do most of your object manipulation using tools and actions. An example tool is the Move tool, which translates objects. An example action is Edit > Duplicate. The distinction is not crucial, but you should know how each works.
Using actions An action refers to the standard software operation of picking an object, and selecting a menu item to perform an action. For example, if you want to create a revolved surface, first select the profile curve you want to use, then select Revolve from the Surfaces menu. In Maya, many of the actions you perform have associated options. For example, you may want to set the pivot point before you revolve the curve. To set options, first open the option box (if available). Option boxes appear as a square to the right of the menu label (❐). When you have completed the option box, click the action button or Apply button at the bottom. Most of the settings in option boxes correspond to object attributes, so you can edit them later as well.
Tip You can return to the factory option settings by choosing Edit > Reset Settings in the option box menu.
Using tools Working with tools in Maya is like working with a real artist’s tool. You pick the tool and manipulate items with it until you complete the operation. There are visual cues to let you know that you have picked a tool: •
the word Tool appears on the menu label
•
the tool is highlighted on the Tool Box
•
in most cases, the cursor changes or a manipulator appears around the object
•
instructions appear on the Help Line to guide you through the operation
CV Curve Tool help
USING MAYA: ESSENTIALS 30
WORKING IN MAYA | 1 Working with tools and actions Tools have options you can set to control their behavior. Like actions, there is an option box to right of the menu label that opens a window with all the options. You can also double-click icons on the Maya window’s Tool Box to display a Tool Settings window for the tool represented by that icon. For instance, if you doubleclick the following icon in the Tool Box, Maya displays a settings window for the Rotate Tool. See Chapter 4, “Transforming Objects,” for information on using transformation tools.
Double-click here to display a Tool Settings window for the Rotate tool
Manipulators and handles Many tools have manipulators for modifying objects. All of the transform tools, for example, have manipulators with three handles—one for each axis. Manipulator handles are typically used to control the direction of transformation. For example, you can click on just one handle of the Move Tool to constrain movement to that axis. This is the active handle and it is colored yellow. For more information on transform manipulators, see "Using manipulators" on page 83. Y handle
Z handle
Center handle X handle
Some objects have manipulators associated with them. For example, cameras and lights have manipulators to control their center of interest and other settings. These manipulators also have a Cycling Index. You can click the Cycling Index to cycle through the available manipulator controls.
USING MAYA: ESSENTIALS 31
WORKING IN MAYA | 1 Working with editors
Pivot Clipping Panes
Center of Interest
Clipping Panes
Cycling Index
For more information on displaying camera and light manipulators, see "Displaying camera and light manipulators" on page 128. For information on using manipulators to modify an object’s construction history, see "Using the Show Manipulator Tool" on page 95.
WORKING WITH EDITORS Another important part of Maya are it's editors. We've already seen the Attribute Editor, which is a general purpose editor. Other general editors include the Channel Box, Outliner, and Relationship Editor. See Chapter 9, “Using Maya Editors,” for more information about general editors. There are task-specific editors such as the Render View, Hypershade (Rendering), Trax Editor (Animation), and Script Editor (MEL). See the appropriate guide for more information.
MEL COMMANDS MEL is Maya's scripting language. Here are some examples of things you can do with MEL: •
Use MEL commands to bypass Maya's user interface, quickly create shortcuts, and access advanced features.
•
Enter exact values for attributes, bypassing any restrictions to precision imposed by the interface.
•
Customize the interface for specific scenes, changing default settings to settings you prefer for a particular project.
•
Create MEL procedures and scripts that carry out custom modeling, animation, dynamics, and rendering tasks. There are several ways to enter MEL commands; using the Script Editor or Command Line are the most common. You can also execute commands in script files, .ma files, shelf icons, hotkeys, and expressions. See Using Maya: MEL for an introduction to using MEL commands and scripts.
USING MAYA: ESSENTIALS 32
WORKING IN MAYA | 1 Using the Hotbox
USING THE HOTBOX The Hotbox is a customizable collection of menu sets that you can make appear by holding down the Spacebar on the keyboard. Once you customize the Hotbox, it provides quick access to the menus you use, hiding menus that are irrelevant to your work. You can customize the Hotbox at any time to accommodate changing needs. The Hotbox has five zones: North, South, East, West, and Center. They are defined by diagonal lines. North zone
East zone
West zone Center zone
South zone
Each zone contains marking menus. Use these menus to change selection masks, control panel visibility, and panel types. For information on marking menus, see "Using marking menus" on page 36. To display the Hotbox: Press and hold the Spacebar. The Hotbox appears at the location of the pointer. The default Hotbox looks like the following (if you customized it, it will look different):
Common menus Panel menus (depends on the active panel) Recent main menu selections Functional menu set(s) Used to customize Hotbox appearance
Note If you press the Spacebar briefly but do not hold it down, Maya changes the number of views displayed. For example, if you are in a perspective view, then press the Spacebar, Maya displays the four basic views.
USING MAYA: ESSENTIALS 33
WORKING IN MAYA | 1 Using the Hotbox
Displaying recent selections The Hotbox lets you display up to 16 previously selected menu items (also available from Edit > Recent Commands). This saves working through hierarchial or cascading menus and lets you quickly repeat a selection. (To display more than 16 menu selections, use a MEL script. For more information, see Using Maya: MEL.) Click here
Select recent command here
Changing the appearance and contents of the Hotbox You can change the appearance and the contents of the Hotbox while you are working. While pressing the Spacebar, click Hotbox Controls and drag to select an option.
Customizing which menus show in the Hotbox The top portion of the Hotbox Controls lets you choose which menu sets you want to appear. For example, choose Show Animation > Show/Hide Animation to turn on or off the Animation menu set display. You can also hide all menu sets except the one you want displayed; for example, choose Animation Only.
The display controls for other menus are in the bottom portion of the Hotbox Controls, including menus for Maya Cloth and Live.
USING MAYA: ESSENTIALS 34
WORKING IN MAYA | 1 Using the Hotbox Changing the transparency You can make the Hotbox more or less transparent. Select Hotbox Controls > Set Transparency and choose a new percentage.
Changing the style of the Hotbox Use the Hotbox Style option to change the display of the Hotbox. Select Hotbox Controls > Hotbox Style and drag to select one of the following styles: Zones and Menu Rows
Make all of the menu rows visible. Display just the five marking menu zones. Menu sets are not available.
Zones Only Center Zone Only
Make only the center zone (A|W) active everywhere. North, South, East, and West Zones and menu sets will not be available.
Center Zone RMB Popups
Turn this option on to display menus for the selected menu set when you right-click on the workspace. The menu set appears as a pop-up instead of a row. Note that the functional menu sets do not display when this option is on, even if you have selected to show them. Setting window options from the Hotbox To increase your screen space, you can hide the main and view menu bars and use the Hotbox menus instead. Select the Hotbox Controls > Window Options submenu and turn off Show Main Menubar or Show Pain Menubars.
Disabling the Hotbox You can disable the Hotbox so it does not appear when you press the Spacebar. To disable the Hotbox: 1
Select Window > Settings/Preferences > Hotkeys. The Hotkey Editor window opens.
2
Scroll down and select Hotbox in the list of Categories (near the bottom of the list).
3
Select ShowHotbox from the list of Commands, select Space from Current Hotkeys, and then click the Remove button. Maya removes the Space hotkey. This turns off the hotkey functionality.
4
Click the Save button, then the Close button. Now when you press the Spacebar, the Hotbox does not display.
USING MAYA: ESSENTIALS 35
WORKING IN MAYA | 1 Using marking menus
Note Use the Restore Defaults button in the Hotkey Editor to restore a hotkey assignment you removed.
USING MARKING MENUS Marking menus are customizable menus that let you quickly access various tools and actions. You can use them from any part of the Maya workspace. You can display marking menus by doing any of the following: •
Clicking in each zone in the Hotbox. (See "To use a marking menu in the Hotbox:" on page 36.)
•
Pressing hotkeys and the left mouse button. (See "To use a marking menu with a hotkey:" on page 37.)
•
Clicking in the workspace with the right mouse button. (See "To use a marking menu with the right mouse button:" on page 38.) You can customize marking menus to run scripts you have written. For information, see "Creating and editing marking menus" on page 351. To use a marking menu in the Hotbox:
1
Press and hold the Spacebar. Maya displays the Hotbox. The Hotbox has five zones: North, South, East, West, and Center. They are defined by diagonal lines. (For an illustration, see "Using the Hotbox" on page 33.)
2
Still holding down the Spacebar, left click in a zone then drag to select a menu item and release the Spacebar. In each of the five zones, the Hotbox supports a different marking menu for each mouse button. This lets you create three menus per zone, for a total of fifteen marking menus and approximately 120 selections. You can customize a marking menu using the Marking Menu editor. For more information, see "Creating and editing marking menus" on page 351. Default marking menus The following marking menus are the default settings for each of the five zones.
North zone
Changes to a new window layout.
USING MAYA: ESSENTIALS 36
WORKING IN MAYA | 1 Using marking menus South zone
Changes a view in the current panel.
East zone
Turns elements of the interface display on and off.
West zone
Switches between preset selection masks.
Center zone
Switches between views.
To use a marking menu with a hotkey: Many hotkeys have a marking menu associated with them. For example, the default hotkey “w” is associated with the Move tool. 1
Select an object.
2
Press and hold the hotkey on the keyboard, then click the left mouse button. For example, when you press the w key, the following menu appears.
3
Drag to make your selection then release the hotkey. If you choose the Translate XYZ option, the move tool’s center handle is selected. You can then move the object anywhere within the view plane. If you choose the Translate X, Translate Y, or Translate Z option, the move tool’s appropriate handle (either X, Y, or Z) is selected. USING MAYA: ESSENTIALS 37
WORKING IN MAYA | 1 Scene management For more information on using marking menus with hotkeys, see "Assigning marking menus to hotkeys" on page 355. To use a marking menu with the right mouse button: 1
If you have not selected an object, press the right mouse button to display a pop-up menu.
2
Choose Select All. or If you have selected an object, press the right mouse button anywhere in the view. The type of object you are working with determines which marking menu appears. For example, in the following illustration, a polygonal cylinder is selected.
SCENE MANAGEMENT Throughout Maya, there are various features for organizing the elements in your scene and for optimizing the scene file size. The following list summarizes some of the main scene management features. Groups Sets and Partitions
Layers
Scene optimization
You can group objects for quick selection and manipulate them as a whole. See "Working with groups" on page 78. Sets are like groups, but they have the advantage of working with components as well. A partition is a collection of sets. It is used primarily to prevent two sets from having overlapping members. See Chapter 11, “Sets and Partitions.” Note that other Maya features, such as the Character > Create commands, utilize sets as a way of grouping objects. Layering is a method of grouping objects so you can easily hide them from view, use them as a template, or render them in a separate pass. The Layer Editor provides the main controls for creating layers, adding objects to layers, and making layers visible or invisible. See "Using layers" on page 130 for more information. Before you save, we recommend that you optimize scene size for improved performance, memory use, and reduced use of disk space (File > Optimize > Scene Size ❐). For details, see "Optimizing scene size" on page 168.
USING MAYA: ESSENTIALS 38
WORKING IN MAYA | 1 Getting help Deleting construction history (if you have it enabled) is recommended when you finish modeling and are ready to animate. (Construction history, as the name implies, is a record of the information used in constructing an object.) To delete it, select the object and choose Edit > Delete by Type > History. You may want to avoid construction history altogether to optimize performance. To do this, click the Construction History On/Off button in the Status Line to turn it off.
GETTING HELP There are various types of online help provided with Maya. Popup Help
When you pass your mouse over an icon or button, a description of it appears. This feature is on by default, but you can disable it (Help > Popup Help).
Help Line
The Help Line at the bottom of Maya’s window shows information about tools, menus, and objects. Like the pop-up help, it displays descriptions when you pass the mouse over icons, as well as menu items. It also displays instructions when you select a tool; for example:
When you transform objects, the Help Line displays the object coordinates; for example:
X axis
Y axis
Z axis
When you open or save a file, a progress bar control will appear in the lower lefthand corner of the main Maya window to show you how much of the file has been read or written.
Progress indicator Product Information
Action indicator
Choose Help > Product Information to see Maya’s version and release date.
A|W Web Site
Choose Help > A|W Web Site to automatically launch your default web browser and view the A|W web site.
Online Library
Also under the Help menu are selections for the online documentation library. This help requires version 4 or higher of either Netscape Communicator or Internet Explorer. Several of these documents are available in printable PDF format, readable from the Maya CD-ROM. The Global Index and Search menu items can be used to find information in the online library of documents. USING MAYA: ESSENTIALS 39
WORKING IN MAYA | 1 Getting help Help on...
For some Maya windows and dialog boxes, you can open help about the editor directly by choosing Help > Help on windowname.
Find Menu
To find the location of a main menu item, choose Help > Find Menu and type the menu item name. The search is not case-sensitive. It accepts wildcard characters (*), but if the menu was renamed or removed, type the name in full. The search is limited to the main menu selections.
USING MAYA: ESSENTIALS 40
2
VIEWING YOUR SCENE This chapter describes Maya’s XYZ coordinate system. It also includes information on the various tasks you can perform using Maya viewing tools. Additionally, it explains how to hide nodes to improve Maya’s playback speed.
ORIENTING THE XYZ SYSTEM Maya’s 3D coordinate system lets you create characters and scenes with dimensionally accurate values. In the XYZ coordinate system, the origin is the center with coordinates 0,0,0. All points are defined by one coordinate along the X-axis, the Y-axis, and the Z-axis. You can orient the XYZ coordinate system in either Y-up or Zup.
Y-up A Y-up world has X set up as the horizontal and Z as the depth of the scene. This orientation is often used by animators (and games developers) who have evolved from the 2D world of vertical (Y) and horizontal (X) to include movement toward or away from the camera (Z).
Y-up character model
Y-axis
Z-axis
X-axis
USING MAYA: ESSENTIALS 41
VIEWING YOUR SCENE | 2 Orienting the XYZ system
Z-up A Z-up world begins with a ground plane that represents the X and Y directions, with Z representing the up direction. This orientation is used by designers, whose main concern is the ground plane where their plans are placed.
Z-up character model
Z-axis
Y-axis
X-axis
Changing the orientation/up axis You can change the scene orientation in the preferences or with a MEL command. Note that, along with changing the up axis, every menu action or tool has an equivalent line command. To specify the scene orientation in the preferences: 1
Select Window > Settings/Preferences > Preferences, Settings category.
2
Under World Coordinate System, select Y or Z. To specify the scene orientation with a MEL command:
1
To change the orientation to Z-up, enter the following in the Command line: upAxis -ax z
2
To change the orientation to Y-up, enter the following in the Command line: upAxis -ax y
For more information on using MEL commands, see Using Maya: MEL.
World coordinates World coordinates represent space in the view. For example, when you move a camera you move it in terms of world coordinates. The center of the world coordinate system is located at the Origin. World space is a coordinate system used to represent an object in terms you define. For example, a model car might be defined in terms of millimeters. World coordinates are also known as “modeling coordinates.”
USING MAYA: ESSENTIALS 42
VIEWING YOUR SCENE | 2 Working with cameras
Local coordinates Local coordinates represent the space around an entity. The origin of a local coordinate system is the center of that entity. One way to understand local coordinates is to imagine an object sitting within a box. All of the points on the object’s surface are then given with respect to one corner of the box. If you pick up the entire box and move it around the room, the coordinates of the object—with respect to the box—do not change: the coordinates of the box with respect to the room are changing. Focus on the two different descriptions: the object with respect to the box (the object’s local coordinates), and the box with respect to the room (the position of the object’s coordinate system with respect to the world coordinate system).
WORKING WITH CAMERAS In Maya, you are always looking through a camera for either perspective or orthographic views. Think of it as being a director on a movie set and looking through a camera lens. Your field of view is restricted to what you can see through that lens. If you wanted to view the scene from another angle, you could move the camera you are looking through, but then you would have to move it back again. Instead, you could create, orient, and look through a second camera. It’s the same in Maya. Whatever part of a scene you see depends on the camera you are looking through. You can also use the Look Through Selected option to look through a light or object. For example, if you look through a light you can display its exact area of illumination. You could also select an object such as a character’s eyes and animate a scene through their view. When setting up output resolution, aspect ratio, and image planes, you should be aware of what each setting on the camera represents and how it relates to the real world. Focal length The focal length of a lens is defined as the distance from the lens to the film plane. The shorter the focal length, the closer the focal plane is to the back of the lens. Lenses are identified by their focal length. Focal length is expressed in millimeters or, on occasion, in inches (1 inch is approximately 25mm). For every shot, you must decide how big an object is in the frame. For example, should a shot include an entire character or just its head and shoulders? There are two ways to make an object larger in the frame. You can either move the camera closer to the object or adjust the lens to a longer focal length. Focal length is directly proportional to the object’s size in the frame. If you double the focal length (keeping the distance from the camera to the object constant), the subject appears twice as large in the frame. The size of the object in the frame is inversely proportional to the object’s distance from the camera. If you double the distance, you reduce the size of the object by half in the frame.
USING MAYA: ESSENTIALS 43
VIEWING YOUR SCENE | 2 Working with cameras Angle of view As you adjust the camera’s focal length, the angle of view narrows and expands. This is what causes objects to get larger or smaller in the frame. As you extend the focal length, the angle of view gets narrower. As you shorten the focal length, the angle of view gets larger. Perspective Since there are two ways to change the size of objects in the frame, what is the difference between moving the camera and changing the focal length? Why choose one over the other? The answer is that by moving the camera, you change the perspective. Objects far from the camera change in relative size at a slower rate than objects which are close to the camera. When you change the focal length, or zoom, perspective does not change. All objects in the frame change size at the same rate. Perspective could be thought of as the rate that objects change in size in the frame as their distance from the camera changes. Camera aperture In a real camera, aperture is the film back’s width and height in millimeters. The camera aperture relates to the focal length in that different film backs have different “normal” lenses. A normal lens has a focal length that is not telephoto or wide angle. It closely approximates normal vision. As the size of the camera aperture increases, a longer focal length is required to achieve “normal” perspective. For example, a 35mm camera uses a 50mm lens as a normal lens. On a 16mm camera, the same 50mm lens appears telephoto in nature. A 25mm lens is required to achieve “normal” perspective on a 16mm camera. This can be demonstrated in Maya by changing to different film backs without changing the focal length. The camera appears to zoom in and out with different film backs even though you are not changing focal length. For more information on camera tools and settings, see Using Maya: Rendering.
Creating a new camera By default, a new scene has four cameras: a perspective camera (persp), and three orthographic cameras (top, front, side). If you change a view by either tumbling, tracking, dollying, or zooming in and out, you are still looking at the scene or object through the same camera. To look at the scene or object through a second camera, first change the view, then create the camera (Panels > Perspective > New). For more information on saving camera views, see "Marking a view" on page 66. To create a new camera: Select Create > Cameras and select a camera. Camera Camera and Aim Camera, Aim, and Up
Creates a a one-node camera, which is a basic camera. Creates a two-node camera, which is a basic camera plus an aim-vector control for aiming the camera at a specified “look at” point. Creates a three-node camera, which is a basic camera with the aim-vector control plus an up-vector control for rotating the camera.
USING MAYA: ESSENTIALS 44
VIEWING YOUR SCENE | 2 Working with cameras You can use the Attributes Editor to change the camera type after it has been created. For details, see "Camera Attribute Editor" on page 54.
Setting Camera options Before you create a camera, you can set its properties in the Create Camera options window. To set camera options: Select Create > Cameras > Camera Type ❐, where Type is the type of camera. The options for the various cameras are described below. The camera viewing tools (tumble, track, and dolly) use this value to determine the look at point when the camera is a one-node camera. Camera Properties The camera viewing tools (tumble, track, and dolly) use this value to determine the look at point when the camera is a one-node camera. Center of Interest
The distance from the camera to the center of interest, measured in the scene’s linear working unit. Lens Properties
Focal Length
Also available in the camera’s Attribute Editor. The focal length of the camera, measured in millimeters. Increasing the Focal Length zooms the camera in and increases the size of objects in the camera’s view. Decreasing the Focal Length zooms the camera out and decreases the size of objects in the camera’s view. The valid range is 2.5 to 3500. The default value is 35.
Lens Squeeze Ratio
Camera Scale
The amount the camera’s lens compresses the image horizontally. Most cameras do not compress the image they record, and their Lens Squeeze Ratio is 1. Some cameras (for example, anamorphic cameras), however, compress the image horizontally to record a large aspect ratio (wide) image onto a square area on film. The default value is 1. Scales the size of the camera relative to the scene. For example, if Camera Scale is 0.5, the camera’s view covers an area half as large, but objects in the camera’s view are twice as large. If the Focal Length is 35, the effective focal length for the camera would be 70. Film Back Properties
Horizontal Film Aperture, Vertical Film Aperture
The height and width of the camera’s aperture or film back, measured in inches. The Camera Aperture determines the relationship between Focal Length and Angle of View. The default values are 1.417 and 0.945.
USING MAYA: ESSENTIALS 45
VIEWING YOUR SCENE | 2 Working with cameras Horizontal Film Offset, Vertical Film Offset
Film Fit
Vertically and horizontally offsets the resolution gate and the film gate relative to the scene. Changing the Film Offset produces a two-dimensional track. Film Offset is measured in inches. The default setting is 0. Controls the size of the resolution gate relative to the film gate. If the resolution gate and the film gate has the same aspect ratio, then the Film Fit setting has no effect. The default setting is Fill. See the following table.
Fill
Fits the resolution gate within the film gate.
Horizontal
Fits the resolution gate horizontally within the film gate.
Vertical
Fits the resolution gate vertically within the film gate.
Overscan
Fits the film gate within the resolution gate.
You can also set Film Fit in the camera view’s View > Camera Settings sub-menu. Film Fit Offset
Offsets the resolution gate relative to the film gate either vertically (if Film Fit is Horizontal) or horizontally (if Film Fit is Vertical). Film Fit Offset has no effect if Film Fit is Fill or Overscan. Film Fit Offset is measured in inches. The default setting is 0.
Overscan
Scales the size of the scene in the camera’s view only, not in the rendered image. Adjust the Overscan value to see more or less of the scene than will actually render. If you have view guides displayed, changing the Overscan value will change the amount of space surrounding the view guides, making them easier to see. The default value is 1.
1
The view guide fills the view. The edges of the view guide may be exactly aligned with the edges of the view, in which case the view guide will not be visible.
>1
The higher the value, the more space is outside the view guide.
Clipping Planes Near Clip Plane, Far Clip Plane
Represents the distance of the near and far clipping planes from either the perspective or orthographic cameras. Near and far clipping planes are imaginary planes located at two particular distances from the camera along the camera’s sight line. Only objects between a camera’s two clipping planes are visible in that camera’s view. Any objects in the scene closer to the camera than the near clipping plane, or farther from the camera than the far clipping plane, are not visible.
USING MAYA: ESSENTIALS 46
VIEWING YOUR SCENE | 2 Working with cameras
Notes • If part of an object is in front of the near clipping plane, then only the part of the object beyond the near clipping plane will be visible. If part of an object is beyond the far clipping plane, the entire object will be visible, including the part beyond the far clipping plane. • If the distance between the near and far clipping planes is much larger than is required to contain all the objects in the scene, the image quality of some objects may be poor. Set the Near Clip Plane and Far Clip Plane attributes to the lowest value that produces the desired result. The objects you want to render are usually within a certain range from the camera. Setting the near and far clipping planes just slightly beyond the limits of the objects in the scene can help reduce rendering times. By default, Auto Render Clip Plane is on, and the Near Clip Plane and Far Clip Plane values do not determine the position of the clipping planes for software rendering. The default setting for Near Clip Plane is 0.1 and for Far Clip Plane is 1000.
Important Note Setting Near Clip Plane to 0.1 (a float) and Far Clip Plane to 100000 (a large integer) may result in quality problems. Motion Blur Shutter Angle
Motion Blur must be set on in the Render Globals window and in at least one object’s Attribute Editor for the Shutter Angle to have any effect. Shutter Angle is measured in degrees. The valid range is 1 to 360. The default value is 144. The Shutter Angle controls the blurriness of motion blurred objects. In a real-world camera, the shutter is actually a metal disk that is missing a pie-shaped section. This disk sits between the lens and the film, and rotates at a constant rate. When the missing section is in front of the film, it allows light from the lens to pass through and expose the film. The larger the angle of the pie-shaped section, the longer the exposure time, and more blurry moving objects appear. Orthographic Views By default, when you create a camera from the Create menu, the view is perspective. If you want an orthographic camera view, click the Orthographic check box and change the Orthographic Width if necessary. The Orthographic Views attributes control whether a camera is perspective or orthographic (top, front, or side), and also lets you control the field of view for orthographic cameras. See also Orthographic Views.
Orthographic
If on, the camera is an orthographic camera. If off, the camera is a perspective camera. Orthographic is off by default.
USING MAYA: ESSENTIALS 47
VIEWING YOUR SCENE | 2 Working with cameras
Tip The default cameras are aligned to the major axis. You can create an offaxis orthographic camera by rotating the orthographic camera or changing the default tumble options and using the tumble tool. Orthographic Width
The width (in inches) of the orthographic camera. The width of an orthographic camera controls how much of a scene the camera can see. Changing the width of an orthographic camera has the same effect as zooming a perspective camera.
Tip If you want to create a new perspective camera and get out of orthographic view mode, select Edit > Reset Settings and click the Apply button.
Moving the camera You can move a camera to get a different view of the object without creating a new camera. To move the current view camera, you can use the View > Camera Tools menu or the mouse with the Alt key. You can also display the camera as an object in your workspace and use the camera manipulators to move it. For more information on camera manipulators, see "Displaying camera manipulator controls" on page 128. To display the current camera as an object, select Display > Show > Cameras. It may be easier to work with the camera as an object when you are moving through a scene and you want to see the camera’s path. To use a camera tool: •
Press the Alt key and drag the appropriate mouse button(s). See "Camera tools" on page 49. or
•
Select the tool you want to use from the View > Camera Tools menu and drag the left (or middle) mouse button. See "Camera tools" on page 49. or
•
Select the tool’s option box (❐) from the View > Camera Tools menu, set the options and drag the left (or middle) mouse button. For details on camera tool options, see "Camera tools" on page 49.
Note To select the Roll, Zoom, Azimuth Elevation, and Yaw-Pitch tools, use the View > Camera Tools menu. You cannot select these tools with the mouse and the Alt key.
USING MAYA: ESSENTIALS 48
VIEWING YOUR SCENE | 2 Working with cameras
Tips • If you change the default settings in the camera tool options windows, remember to press the Reset Tool button to reset the tool defaults for the next operation. • If you want to keep the settings for a particular camera operation, MMBdrag the camera tool setting icon from the mini bar into the Shelf and click this icon for specific operations. • Select View > Default Home if you zoom and tumble the view repeatedly and then need to see the default camera’s view.
Camera tools Tumble Tool Revolves the camera by varying the azimuth and elevation angles in the perspective window. You can also press Alt and the left mouse button. Press the Shift key to constrain the camera movement. The Tumble Tool options are as follows: Tumble scale Tumble camera about
Scales the speed of the camera movement. The slider range is 0.01 to 10. The default value is 1. Center of Interest Tumble Pivot
The camera tumbles about its center of interest. Tumble camera about is set to Center of interest by default. The camera tumbles about its pivot point. This tumble pivot can also be set in the camera’s Attribute Editor (see Tumble Pivot for details).These values are stored in world space coordinates.
View operations such as Frame Selection, Frame All, Look at Selection, Default Home, and Bookmarks all set the tumble pivot. Orthographic views
Locked
If on, you cannot tumble an orthographic camera. If off, you can tumble an orthographic camera. Locked is on by default.
Stepped
If on, you can tumble an orthographic camera in discrete steps. The Stepped operation lets you easily return to the Default Home positions. If off, you can tumble an orthographic camera smoothly. Stepped is only available if Locked is off. Stepped is on by default.
Ortho step
The angle of steps (in degrees) that you can tumble an orthographic camera when Locked is off and Stepped is on. The valid range is 0.01 to 180. The default value is 5.
Track Tool When tracking across the display, it slides the view either horizontally or vertically. You can also press Alt and the middle mouse button. Press the Shift key to constrain movement in horizontal or vertical directions. The Track Tool options are as follows:
USING MAYA: ESSENTIALS 49
VIEWING YOUR SCENE | 2 Working with cameras Track Geometry
If off, as the camera moves an object moves at a speed that may be different than the speed of the cursor. This problem occurs with objects far from the camera. Track Geometry is off by default. If on, as the camera moves, an object moves at the same speed as the cursor. The object selected at the beginning of the Track operation remains under the cursor.Tracking will be slower (especially if there are many objects in the scene) if Track Geometry is on.
Track Scale
Scales the speed of the camera movement. The slider range is 0 to 100. The default value is 1.
Dolly Tool Moves into or away from the view. You can also press Alt and the left and middle mouse buttons together. You can use the Dolly tool in both a perspective or orthographic view. Use Ctrl-Alt-LMB to drag a marquee in the area in which you want to dolly. The Dolly Tool options are as follows: Scale
Scales the speed of the camera movement. The slider range is 0.01 to 10. The default value is 1.
Dolly
Local
Center of Interest
If on, drag in the camera’s view to move the camera toward or away from its center of interest. If off, drag in the camera’s view to move both the camera and its center of interest along the camera’s sight line. Local is on by default. If Center of Interest is on, MMB-drag in the camera’s view to move the camera’s center of interest toward or away from the camera. If off, drag in the camera’s view to move the camera toward or away from its center of interest. LMB-marquee a region and snap the center of interest to the center of those objects.Center of Interest is off by default. If Center of Interest (and/or Local) and Bounding box are on, when you drag in the views, a red line with a small x at the end points to indicate the Center of Interest.
Snap box dolly to
A box dolly moves the center of interest to the marquee region when you use the Ctrl-Alt-drag method to dolly the camera. Surface
If on, when you perform a box dolly (Ctrl-drag) on an object, the center of interest moves onto the surface of the object.Calculating the surface point will be slower if Smooth Shade mode is off (and especially if there are many visible objects in the scene).
Bounding box
If on, when you perform a box dolly (Ctrl-drag) on an object, the center of interest moves to the center of the object’s bounding box. Bounding Box is on by default.
USING MAYA: ESSENTIALS 50
VIEWING YOUR SCENE | 2 Working with cameras
Zoom Tool Changes the focal length on a camera. Zooming in is like using a telephoto lens. Zooming out is like using a wide angle lens. You can use zoom in both a perspective or orthographic view. To move in or out without changing the viewing angle, use the Dolly tool. The Zoom Tool’s options are as follows: Zoom Scale
Scales the speed of the camera movement. The slider range is 0.01 to 3. The default value is 1.
Roll Tool Rotates the display around its horizontal axis. The Roll Tool’s options are as follows: Roll Scale
Scales the speed of the camera movement. The slider range is 0.01 to 10. The default value is 1.
Azimuth Elevation Tool Revolves the camera about the center of interest in the perspective view. (The angle of a camera’s sight line relative to the ground plane is also referred to as its elevation; the angle of a camera’s sight line relative to a plane perpendicular to the ground plane is also referred to as its azimuth.) The Azimuth Elevation Tool’s options are as follows: Scale
Scales the speed of the camera movement. The slider range is 0.01 to 10. The default value is 1.
Rotation type
Controls whether the camera movement is an Azimuth Elevation movement or a Yaw Pitch movement.
Tip Press Shift to constrain the camera’s movement.
Yaw Pitch Tool Changes from an orthographic view to a perspective view. Tilting a camera means rotating the camera up or down; panning a camera means rotating the camera left or right. The scene in the camera’s view moves in the opposite direction. (The angle of rotation up or down is also referred to as pitch; the angle of rotation left or right is also referred to as yaw.) The Yaw Pitch Tool’s options are as follows: Scale
Scales the speed of the camera movement. The slider range is 0.01 to 10. The default value is 1.
Rotation type
Controls whether the camera movement is a Yaw Pitch movement or an Azimuth Elevation movement.
Tip Press Shift to constrain the camera’s movement.
USING MAYA: ESSENTIALS 51
VIEWING YOUR SCENE | 2 Working with cameras
Fly Tool The Fly Tool lets you navigate your scene as if you were playing a 3D first-person perspective game. The camera flies through your scene without being constrained by any geometry. To use the Fly Tool, press-and-hold the Ctrl key, then drag with the left mouse button. Drag up to fly forward and down to fly backward. To change the camera direction, release the Ctrl key and drag the left mouse button.
Note The tumble, track, and dolly commands are available while the Fly Tool is active.
Looking through a camera If you have more than one camera, you can switch which camera you view your scene through. To look through a camera: 1
Select Panels > Perspective.
2
Select a camera.
3
Select Panels > Look Through Selected.
Note You can also use the Look Through Selected command to view your scene from the point of view of a selected light or object.
Tip You can also use the Hypergraph to select a view. In the Hypergraph window, select the name of a view, then select Panel > Look Through Selected. For more information, see "Using the Hypergraph" on page 263. To look at selected objects: Select View > Look At Selection. The camera tilts and pans until selected objects are in the center of the camera’s view. To look at and fill the view with selected objects: Select View > Frame Selection (or press the hotkey f). The camera tracks and dollies until selected objects fill the camera’s view. To look at and fill the view with all objects in a scene: Select View > Frame All (or press the hotkey a). The camera tracks and dollies until all objects in the scene (including lights and cameras, if their icons are displayed in the view) fill the camera’s view.
USING MAYA: ESSENTIALS 52
VIEWING YOUR SCENE | 2 Working with cameras To look at and fill the view with a region of a scene: Ctrl-Alt-drag over the region. The camera tracks and dollies and the selected region fills the camera’s view.
Changing camera settings To change camera settings, select View > Camera Settings and select one of the following settings: Perspective
Turn Perspective on so that the camera uses a perspective view. This means that the lines converge at infinity. If turned off, the camera uses an orthographic view.
Journal
Turn Journal on to copy camera view actions, such as tumble, track, and zoom, to the MEL journal making the commands undoable. Normally, the camera command view actions are not copied to the MEL journal and they are not undoable. For more information on the MEL journal, see Using Maya: MEL.
No Gate
Displays no frustrum. This is the default.
Film Gate
Displays the viewable frustum according to the film back size. The aspect ratio of the window (or rendering resolution) determines what you actually see. Also sets the camera Overscan attribute to 1.5. The following illustration shows the film gate representing the maximum viewable (or renderable) area.
Film Back Gate
Resolution Gate
Displays the renderable frustum for the current resolution specified in Render Globals. This often specifies a more exact rendered image than the Film Gate option. Also sets the camera Overscan attribute to 2.0.
Note If the aspect ratio between the film back and the resolution is the same, then the two resulting rendered images match. Field Chart
Turn Field Chart on to display a grid that represents the twelve standard cell animation field sizes. The largest field size (number 12) is identical to the rendering resolution (the resolution gate). Render Resolution must be set to NTSC dimensions for this option to have meaning.
USING MAYA: ESSENTIALS 53
VIEWING YOUR SCENE | 2 Working with cameras Safe Action
Turn this option on to display a box defining the region that you should keep all of your scene’s action within if you plan to display the rendered images on a television screen. The safe action view guide represents 90% of the rendered resolution (the resolution gate). Render Resolution must be set to NTSC dimensions for this option to have meaning.
Safe Title
Turn this option on to display a box defining region that you should keep titles (text) within if you plan to display the rendered images on a television screen. The safe title region represents 80% of the rendered resolution (the resolution gate). Render Resolution must be set to NTSC dimensions for this option to have meaning.
Fill
Automatically selects a horizontal or vertical fit so that the selected image fills the render frame.
Horizontal
Selects a horizontal fit for the selected image in the render frame.
Vertical
Selects a vertical fit for the selected image in the render frame.
Overscan
Selects a slightly larger fit for the selected image in the render frame.
Camera Attribute Editor After you create a camera, you can adjust its settings by changing attributes in the Attribute Editor. Select the camera you want to change then open the Attribute Editor (Window > Attribute Editor). Depending on the camera you select, you can also open its Attribute Editor by selecting View > Camera Attribute Editor from any panel’s View menu.
Tip If you click the boxes at the right of some of the attributes in this editor, the Create Render Node window displays which means you can map certain render nodes to the camera attributes. The following camera attributes are described in Setting Camera options. See: •
Focal Length
•
Camera Scale
•
Near Clip Plane, Far Clip Plane
Auto Render Clip Plane If on, Maya automatically sets the near and far clipping planes so they enclose all objects within the camera’s view. All objects render and depth precision problems are eliminated. Clipping planes are only available to the software renderer (not visible in the views). If off, the near and far clipping planes are set to the Near Clip Plane and Far Clip Plane values. Auto Render Clip Plane is on by default. In some cases you should turn off Auto Render Clip Plane: •
to ensure frames rendered from Maya 3.0 exactly match frames rendered from Maya 4.0
•
to limit which objects will render based on their distance from the camera
USING MAYA: ESSENTIALS 54
VIEWING YOUR SCENE | 2 Working with cameras
Film Back The Film Back attributes control the basic properties of a camera (for example, the camera’s film format: 16mm, 35mm, 70mm). The following Film Back attributes are described in Setting Camera options. See:
Film Gate
Camera Aperture
Film Aspect Ratio
Film Offset
•
Lens Squeeze Ratio
•
Film Fit
•
Film Fit Offset
•
Overscan Lets you select a preset camera type. Maya automatically sets the Camera Aperture, Film Aspect Ratio, and Lens Squeeze Ratio. To set these attributes individually, set Film Gate to User. The default setting is User. The height and width of the camera’s aperture or film back, measured in inches. The Camera Aperture determines the relationship between Focal Length and Angle of View. The default values are 1.417 and 0.945. The ratio of the camera aperture’s width to its height. Maya automatically updates the Film Aspect Ratio (and vice versa). The valid range is 0.01 to 10. The default value is 1.5. Vertically and horizontally offsets the resolution gate and the film gate relative to the scene. Changing the Film Offset produces a two-dimensional track. Film Offset is measured in inches. The default setting is 0.
1
The view guide fills the view. The edges of the view guide may be exactly aligned with the edges of the view, in which case the view guide will not be visible.
>1
The higher the value, the more space is outside the view guide.
Depth of Field These attributes provide control over the camera’s focus.
Tip The more out of focus an image is, the longer it takes to generate the final rendered image (that is, the post-render blur will take longer.) Depth Of Field
If on, some objects in the scene are sharply focused and others are blurred or out of focus, based on their distance from the camera. If off, all objects in the scene are sharply focused. Depth Of Field is off by default.
Focus Distance
The distance from the camera at which objects appear in sharp focus, measured in the scene’s linear working unit. Decreasing the Focus Distance also decreases the depth of field. The valid range is 0 to ∞. The default value is 5.
USING MAYA: ESSENTIALS 55
VIEWING YOUR SCENE | 2 Working with cameras F Stop
Focus Region Scale
The range of distances from the camera within which objects appear in sharp focus (the depth of field). The range of distances is centered on the Focus Distance. The range is smaller toward the camera and larger away from the camera. The valid range is 1 (small depth of field) to 64 (large depth of field). The default value is 5.6. Scales the Focus Distance value. The valid range is 0 to ∞. The default value is 1.
Output Settings Control whether a camera generates an image during rendering, and what types of images the camera renders. Renderable
If on, the camera can create an image file, mask file, and/or depth file during rendering. By default, Renderable is on for the default perspective camera, and off for all other cameras.
Note Changing the Camera attribute in the Image File Output section of the Render Globals window can change the Renderable setting in a camera’s Attribute Editor. Image
If on (and Renderable is on), the camera creates an image file during rendering. The default setting is on.
Mask
If on (and Renderable is on), the camera creates a mask during rendering. A mask is an 8-bit channel (the alpha channel) in the image file that represents objects in shades of gray. Black areas represent areas where there are no objects (or fully transparent objects), and white areas represent areas where there are (solid) objects. Masks are used primarily for compositing.
Note If the Image Format in the Render Globals window is not set to Maya IFF, Maya16 IFF, RLA, SGI, Tiff, or Tiff16, the camera does not include the mask information in the alpha channel of the image file. Instead, it creates a separate mask file. See also the Render Globals chapter in the Using Maya: Rendering book. Depth
If on (and Renderable is on), the camera creates a depth file during rendering. A depth file is a type of image file that represents the distance of objects from the camera by shades of gray. Depth files are used primarily for compositing. When on, the Depth Type attributes (next) are enabled.
Depth Type
Determines which objects Maya uses to create the Depth file. Closest Visible Depth
Furthest Visible Depth
USING MAYA: ESSENTIALS 56
Uses the closest object to the camera. When transparent objects are located in front of other objects, turn on Transparency Based Depth to ignore the transparent object. Most often used when a Particle Effect is occluded by an opaque object. Maya uses the Furthest Visible Depth to create a Depth file.
VIEWING YOUR SCENE | 2 Working with cameras Transparency Based Depth
Turns on Threshold, which determines which object is closest to the camera, based on transparency. Transparency Based Depth is only enabled when you select Closest Visible Depth.
Tip When transparent objects are located in front of other objects, you can turn on Transparency Based Depth to ignore the transparent object. Threshold
Used when compositing multiple layers of transparency (which varies from 0 to 1). For example, if Threshold is 0.9 (the default), when transparent surfaces add up to 0.9 or larger, the surface becomes opaque.
Environment Control the appearance of the scene’s background as seen from the camera. Different cameras can use different backgrounds. Background Color Image Plane
The color of the scene’s background. The default color is black. Creates an image plane and attaches it to the camera. Clicking the Create button automatically changes the focus of the Attribute Editor to include attributes for an image plane. See the Using Maya: Rendering book for details about Image Plane attributes.
Special Effects Shutter Angle
Controls the blurriness of motion blurred objects. In a real-world camera, the shutter is actually a metal disk that is missing a pieshaped section. This disk sits between the lens and the film, and rotates at a constant rate. When the missing section is in front of the film, it allows light from the lens to pass through and expose the film. The larger the angle of the pie-shaped section, the longer the exposure time, and moving objects are more blurred. Shutter Angle is measured in degrees. The valid range is 1 to 360. The default value is 144.
Important Note Motion Blur must be on in the Render Globals window and in at least one object’s Attribute Editor for the Shutter Angle to have any effect.
Display Options Controls the display of view guides in the camera’s view, and provides options for moving the camera. You can also access most of these attributes in any panel’s View > Camera Settings pull-out menu. Display Film Gate
Displays a rectangle that indicates the area of the camera’s view that a real-world camera would record on film. The dimensions of the film gate represent the dimensions of the camera aperture. The film gate view guide indicates the area of the camera’s view that will render only if the aspect ratios of the camera aperture and rendering resolution are the same. See also Film Gate.
USING MAYA: ESSENTIALS 57
VIEWING YOUR SCENE | 2 Setting a perspective view Display Resolution
Display Field Chart
Display Safe Action
Display Safe Title
Journal Command
Displays a rectangle that indicates the area of the camera’s view that will render. The dimensions of the resolution gate represent the rendering resolution. The rendering resolution values are displayed above the resolution gate. See also the Using Maya: Rendering book. Displays a grid that represents the twelve standard cel animation field sizes. The largest field size (number 12) is identical to the rendering resolution (the resolution gate). See also the Using Maya: Rendering book. Displays a rectangle indicating the region in which all of the scene’s action takes place if you plan to display the rendered images on a television screen. The safe action view guide represents 90% of the rendering resolution (the resolution gate). See also the Using Maya: Rendering book. Displays a rectangle indicating the region in which to keep titles (text) if you plan to display the rendered images on a television screen. The safe title view guide represents 80% of the rendering resolution (the resolution gate). See also the Using Maya: Rendering book. If on, all camera movements are written to the Script Editor and become part of the undo queue which lets you undo or redo them. This also lets you copy camera movements and use them for other cameras or scenes. If off, you cannot undo or redo camera movements. Use Previous View or Next View instead. Journal Command is off by default.
Center of Interest Tumble Pivot
The distance from the camera to the center of interest, measured in the scene’s linear working unit. The point the Tumble tool pivots the camera about when Tumble Camera About is set to Tumble Pivot in the Tumble Tool settings window.
Orthographic Views When you create a camera from the Create menu, the default view is perspective. If you want an orthographic camera view, click the Orthographic check box and change the Orthographic Width if necessary. The Orthographic Views attributes also let you control the field of view for orthographic cameras. See Orthographic and Orthographic Width for attribute descriptions.
SETTING A PERSPECTIVE VIEW Each workspace view is linked to a camera that “looks” at your scene. The camera’s position, orientation, and attributes determine what you see through that particular camera. This is a perspective view. Unlike an orthographic view, a perspective view shows depth. You can switch to a perspective view and you can create new perspective views.
USING MAYA: ESSENTIALS 58
VIEWING YOUR SCENE | 2 Setting an orthographic view To switch to a perspective view: Select Panels > Perspective and select the appropriate camera view.
Creating new perspective views When building an object or scene, it is often useful to view the object from several different perspectives. Use the Panels > Perspective > New option to create a new perspective camera. To create a new perspective camera view: 1
Change the view of the object. For example, if you want to tumble the display, press the Alt key and use the left mouse button to drag the view.
2
Select Panels > Perspective > New. Maya creates a new camera in the default home perspective position.
•
To view through the original perspective camera, select View > Previous View or View > Default Home.
•
To view through the new perspective camera, select Panels > Perspective and select the new perspective view.
Name of the new perspective view
SETTING AN ORTHOGRAPHIC VIEW An orthographic camera shows the 3D workspace from the top, front, and side views. These views offer the most analytical view of the world space. However, they do not show depth. You can switch to an orthographic view and you can create new orthographic views. To switch to an orthographic view: Select Panels > Orthographic and select front, side, or top as the active camera view.
Creating new orthographic views When building an object or scene, it is often useful to view the object from the top, front, or sides. Use the Panels > Orthographic > New option to create a new orthographic camera view. For example, you may want a zoomed in top view.
USING MAYA: ESSENTIALS 59
VIEWING YOUR SCENE | 2 Lighting your scene To create a new orthographic view: 1
Select Panels > Orthographic > New and select a new view: Front, Side, or Top. Maya creates the view.
2
Select Panels > Orthographic. The view you just created appears in the Orthographic menu.
New orthographic view
LIGHTING YOUR SCENE Use commands on the Lighting menu to select which lights or groups of lights to use in your scene. These options include: Use Default Lighting
Lights the scene using only a single point light situated at the camera. Use All Lights
Uses all lights in the scene, to a maximum of eight lights. This option gives you a representation of what the lights will look like when the image is rendered.
Note This option does not include the default light. If there are no lights in the scene, the scene renders as an all black image. Use Selected Lights
Uses only selected lights. If you change the light selection, the lighting also changes respectively.
Use Previously Specified Lights
Select this option to use the lights selected with the Specify Selected Lights option. This option is grayed until you choose Specify Selected Lights. If you select a different set of lights when this option is selected, the scene will still use the previously selected lights.
Note This menu item can be turned off by picking any of the items above it. Two Sided Lighting
Turn this option on to illuminate both sides of an object. Note that Maya’s performance may decrease on some systems.
USING MAYA: ESSENTIALS 60
VIEWING YOUR SCENE | 2 Arranging views Specify Selected Lights
Lets you use a preset selection of lights. Select the lights you want to use then select Specify Selected Lights. Once specified, turn on Lighting > Use Previously Specified Lights to use this light selection. Unlike Use Selected Lights, if you change the light selection, the scene will still use the previously selected lights. For additional information on lighting, see Using Maya: Rendering.
ARRANGING VIEWS You can use the Quick Layout buttons in the Tool Box to select a different view or to switch to another layout. See "Using the Quick Layout buttons" on page 63. You can also use the Panels menu to change a camera view or to view a scene or object through a selected camera. .
Perspective
Lets you change to a perspective view or create a new perspective view. For details, see "Creating new perspective views" on page 59.
Orthographic
Lets you change to an orthographic view or create a new orthographic view. For details, see "Creating new orthographic views" on page 59.
Look Through Selected
Lets you look through a selected camera, object, or light. For details, see "Looking through a camera" on page 52. Panel
Displays a menu with the following commands. Outliner
Opens the Outliner, where you can view objects and their attributes hierarchically. For more information, see "Using the Outliner" on page 249.
Graph Editor
Opens the Graph Editor where you can edit visual representations of keys and animation curves (keysets). For more information, see Using Maya: Animation.
Dope Sheet
Opens the Dope Sheet, where you can edit event and sound synchronization and timing. For more information, see Using Maya: Animation.
Trax Editor
Opens the Trax Editor, where you can create and edit timeindependent clips of character animation. For more information, see Using Maya: Animation.
Hypergraph
Opens the Hypergraph, which gives you an overview of your entire scene, all objects it contains, and the relationships between those objects. For more information, see "Using the Hypergraph" on page 263. USING MAYA: ESSENTIALS 61
VIEWING YOUR SCENE | 2 Arranging views Hypershade
Opens the Hypershade, which you can use to create and edit rendering nodes, and to view and edit rendering (or shading) networks. For more information, see Using Maya: Rendering.
Visor
Opens the Visor, which you can use to show images of shading nodes you can create, those already in your scene, and those in online libraries, in a visual outline form. For more information, see Using Maya: Rendering.
UV Texture Editor
Opens the UV Texture Editor window, which you use to map textures to a polygonal model. For more information, see Using Maya: Polygonal Modeling.
Render View
Opens the Render View window, where you can test render single frames and interactively tune rendering attributes. For more information, see Using Maya: Rendering.
Blend Shape
Lets you create character deformations. For more information, see Using Maya: Character Setup.
Dynamic Relationships
Devices Relationship Editor
Reference Editor
Component Editor
Paint Effects
Lets you view or edit connections between dynamics elements such as particle emitters, collisions, etc. For more information, see Using Maya: Dynamics. Lets you use external tools and plug-ins for special devices, such as Motion Capture. Opens the Relationship Editor, which you can use to group and manipulate objects as sets and assign shading groups to geometry. For more information, see "Using the Relationship Editor" on page 217. Opens the Reference Editor, which you can use to specify settings for importing files by reference. For more information, see "Using the Reference Editor" on page 181. Opens the Component Editor, which you can use to specify settings for importing files by reference. For more information, see "Using the Component Editor" on page 209. Opens the Paint Effects Panel, where you can interactively render strokes without rendering the rest of the scene. New strokes render as you paint them in this view. For more information, see Using Maya: Painting.
Layouts
Lets you specify how different camera views are arranged spatially in the Maya window.
Saved Layouts
Lets you select a panel layout. For more information, see "Selecting panel layouts" on page 370.
Tear Off
Moves the current camera view into a separate window. The current view is replaced with the next view in the Panels list (to see this list, select Panels > Panel Editor).
Tear Off Copy
Copies the current camera view into a separate window.
USING MAYA: ESSENTIALS 62
VIEWING YOUR SCENE | 2 Arranging views Opens the Panel window, where you can create new panels, re-label existing panels, rename layouts, and change layout configurations. For more information, see "Using the Panel Editor" on page 367.
Panel Editor
Using the Quick Layout buttons You can use the Quick Layout buttons, located in the Tool Box, to select a different panel or to switch to another layout. Single Perspective View Four View Persp/Outliner Persp/Graph Hypershade/Persp Persp/Graph/Hypergraph Panel/Layout
To change the view or layout: Click one of the Quick Layout buttons in the Tool Box. The Panel/Layout button changes based on the layout and view configuration you select from the Tool Box as well as from submenus in the Panels and Window menus. For example, if you select Four View, four arrow buttons appear, one for each panel. Click one of these arrow buttons to change a specific panel. Four View of the Panel/Layout button
Use the Panel/Layout button to change a specific panel or to change the view arrangement. To change a specific panel: 1
Click the Panel/Layout arrow button that corresponds to the panel.
2
Select an option from the pop-up menu to change that panel. To change the view arrangement:
1
Right-click the Panel/Layout button.
2
Select a view arrangement from the pop-up menu.
Note You can right-click any of the first six Quick Layout buttons to open the Saved Layouts pop-up menu and select a different layout, such as Four View or Hypershade/Outliner/Persp. The icon changes to represent the selection.
USING MAYA: ESSENTIALS 63
VIEWING YOUR SCENE | 2 Arranging views
Note You can change the icon image of any of the first six Quick Layout buttons. This is especially useful for custom layouts. You can select one of Maya’s default images or a customized image file. For information, see “To change the icon image of a Quick Layout button:” To change the icon image of a Quick Layout button: 1
Right-click the Panel/Layout button.
2
Select Change Image from the pop-up menu. The Quick Layout Image Editor dialog box appears.
3
Select an icon image from the scroll list. or Click Browse to look for and select an icon image.
4
Click Save when done. The icon image is saved with the layout.
Displaying the workspace only Select the following options on the Display > UI Elements submenu to quickly display only the workspace. Hide UI Elements Restore UI Elements
Temporarily hides all UI elements except the workspace panels. For example, you can maximize the scene view while working on detailed models. Displays the UI elements that were hidden.
Laying out the views Because much of your 3D work takes place in a modeling view window, you want to be able to view an object from the top, front, side, and in perspective. In 3D, it is sometimes difficult to see exactly where an object lies. The four views enable you to confirm the positioning of objects from more than one camera angle. Use the Window > View Arrangement option to control how Maya displays the four basic views. The top, front, and side views are 2D orthographic views that allow you to view your work analytically. The fourth view is perspective and allows you to view the scene in 3D. You can also access the same view arrangement settings from the Panels > Layouts option and by right-clicking the Panel/Layout button in the Tool Box.
USING MAYA: ESSENTIALS 64
VIEWING YOUR SCENE | 2 Arranging views You can place any tool in a view. For more information, see "Creating layouts" on page 371. In the following example, the display is changed to a 3 Left Split layout. To set the views: •
Select Panels > Layouts or select Window > View Arrangement and select the view layout you want. or
•
Right-click the Panel/Layout button in the Tool Box and select the view layout you want. For example, if you select 3 Left Split, you get the following view layout.
Note If you want one view to occupy the entire Maya window, select the view, then press the space bar quickly. (If you press the space bar for too long, Maya displays the HotBox.) To rename and delete a camera, use the Outliner. See "Using the Outliner" on page 249.
USING MAYA: ESSENTIALS 65
VIEWING YOUR SCENE | 2 Marking a view
MARKING A VIEW You can use bookmarks to mark a view for future use. This lets you maintain a variety of camera views for any scene. Maya has four predefined bookmarks: Perspective, Front, Top, and Side. You can change your view to any of these predefined bookmarks, or you can create your own bookmarks.
Note Bookmarks are defined for specific views, such as Persp, Top, Side, or Front. Therefore the bookmark is unique to and is only available when you’re in that view.
Note You cannot change positions for the predefined bookmarks. Changing the view to a predefined bookmark: Select View > Predefined Bookmarks and select the default view you want to change to.
Creating a bookmark You can create your own bookmarks to mark views other than Perspective, Front, Top, and Side. To create a new bookmark: 1
Select an object and change the view.
2
Select View > Bookmarks > Edit Bookmarks. The Bookmark Editor opens.
Type new bookmark name here
3
In the Name box, type the new bookmark name and then press Enter.
4
Type a description of the view in the Description box.
5
Close the Bookmark Editor.
USING MAYA: ESSENTIALS 66
VIEWING YOUR SCENE | 2 Marking a view
Tip To create a bookmark with a system-assigned name, select View > Bookmarks > Edit Bookmarks and click New Bookmark. Maya assigns the view to the first bookmark under the name cameraView1. To delete a bookmark: 1
Select View > Bookmarks > Edit Bookmarks. The Bookmark Editor opens.
2
Select the bookmark you want to delete and click the Delete button.
Selecting custom bookmarks If you have created view bookmarks, you can select them as follows. To view bookmarks: Select View > Bookmarks and select the bookmark you want to view the object through.
Renaming a bookmark You can rename bookmarks at any time. To rename a bookmark: 1
Select View > Bookmarks > Edit Bookmarks. The Bookmark Editor opens.
2
Select the bookmark you want to change.
3
In the Name box, change the bookmark name then press Enter. The modified bookmark appears in the Bookmarks menu.
Adding a bookmark to a shelf You can add any bookmark to a shelf for easy access. To add a bookmark to a shelf: 1
Select the shelf you want to add the bookmark to.
2
Select View > Bookmarks > Edit Bookmarks. The Bookmark Editor opens.
3
Select the bookmark you want to add to the shelf and click the Add To Shelf button. The bookmark is added to the shelf. It appears as a MEL command.
Note The bookmark button will only work if you are in the view in which the bookmark view can operate.
USING MAYA: ESSENTIALS 67
VIEWING YOUR SCENE | 2 Enabling and disabling nodes
ENABLING AND DISABLING NODES You can disable animation nodes in your scene to improve playback speed while you view animations. For example, suppose you create a scene that includes a keyframed bouncing ball in addition to several particle emitters. Because particle emission requires much processing time, your animation playback may be slow. You can disable particle nodes to temporarily disable the emitted particles. This makes the animation of the bouncing ball play faster, so the ball’s motion more closely resembles the final rendered motion. To enable or disable nodes, select Modify > Enable Nodes and then select any of the following options: Enable All
Turns on all the nodes in the list.
Disable All
Turns off all the nodes in the list.
IK Solvers
Turns IK Solvers on or off. See Using Maya: Character Setup for more information on inverse kinematic tools.
Constraints
Turns Constraints on or off. See Using Maya: Character Setup for more information on basic constraints.
Expressions
Turns Expressions on or off. See Using Maya: Expressions for more information.
Global Stitch
Turns Global Stitch on or off. See Using Maya: NURBS Modeling for more information.
Particles
Turns Particles on or off. See Using Maya: Dynamics for more information.
Rigid Bodies
Turns Rigid Bodies on or off. See Using Maya: Dynamics for more information.
Snapshots
Turns Snapshots on or off. See Using Maya: NURBS Modeling for more information on Animation Snapshots.
USING MAYA: ESSENTIALS 68
3
EDITING OBJECTS Use the Edit menu to delete, select, duplicate, group, and parent objects. This chapter describes how you edit objects in Maya. It also describes Maya’s undo, redo, and repeat functions.
Note The following Edit menu option is not described in this chapter: Keys – Displays the available keys. For more information, see Using Maya:
Animation.
SELECTING OBJECTS There are several ways to select objects in Maya. You can: •
select objects individually
•
select all objects in the scene
•
select objects of a specified type
•
select objects of a specified name
•
select all objects in a set
•
select all objects in a display layer When you select objects, they become highlighted. Note that you can change the highlight color. For details, see "Changing default colors" on page 330.
Selecting objects individually You can select objects individually from the scene, the Outliner, the Hypergraph, and the Relationship Editor. To select an object: •
Click on the object, or click-drag a box around it. or
•
In the Outliner or Hypergraph, click on the object name. For information about the Outliner, see "Using the Outliner" on page 249. For information about the Hypergraph, see "Using the Hypergraph" on page 263.
USING MAYA: ESSENTIALS 69
EDITING OBJECTS | 3 Selecting objects or •
In the Relationship Editor, highlight the object in the left panel and on the Edit menu, click Select Highlighted. For more information about the Relationship Editor, see "Using the Relationship Editor" on page 217.
Selecting multiple objects in a scene Use the Lasso Tool or the Shift key to select multiple objects. To select more than one object in a scene: •
Shift-click on each object. The last selected object is highlighted with a different color than the other objects (default, green). or
1
Click the Lasso Tool in the Tool Box. The mouse pointer becomes a lasso.
2
Drag the lasso around the desired objects.
Inverting a selection Use Invert Selection to select all objects in the scene that are not selected. For example, if you select two of five objects in a scene, and then select Edit > Invert Selection, the other three objects are selected instead. Note this only works on objects, not components.
Selecting all objects in a scene Use Select All on the Edit menu to select root objects and all visible dependency nodes in a scene. You can then treat them as a virtual group without actually having grouped them. To select all displayed objects: Select Edit > Select All. Maya selects all objects.
When you select a transformation tool, the manipulator for that tool displays on the last selected object (the one highlighted in a different color, default, green). When you transform the selection, the selected objects move as a group. To deselect all objects, click anywhere on the view.
USING MAYA: ESSENTIALS 70
EDITING OBJECTS | 3 Selecting objects
Selecting objects by type Use Select All By Type to select all objects of a specific type. In the following example, we select all joints associated with the giraffe. To select all objects by type: 1
Select the object.
2
Select Edit > Select All by Type > Joints. Maya selects the joints on the object.
USING MAYA: ESSENTIALS 71
EDITING OBJECTS | 3 Deleting objects
Selecting objects by name You can select objects and nodes by typing their name or a portion of the name. In the Numeric input field on the Status Line, choose Quick Selection from the pulldown menu and type the name. Using wildcard characters (* and ?), you can select several items with the same string in their names. Numeric Input field on Status Line
Choose Quick Selection
Selecting all objects in a set Edit > Quick Select Set is a fast way to select all objects in a particular set without having to open the Relationship Editor. For more information, see "Creating sets for quick selection" on page 304.
Selecting all objects in a display layer To select all objects in a display layer, in the Layer Editor, select the desired layer and then select Layers > Select Objects in Selected Layer(s). For information about layers, see "Using layers" on page 130.
DELETING OBJECTS Use the Delete, Delete by Type, and Delete All by Type options on the Edit menu to: •
delete single objects
•
delete object components by type
•
delete all objects by type
Deleting a single object Use Edit > Delete to delete a selected object or component. In the following example, we delete a cylinder from the scene. To delete an object: 1
Select the object(s) you want to delete. To delete more than one object or component, Shift-click each object you want to delete, or click-drag a box around the object(s).
2
Select Edit > Delete. Maya removes the object and the associated Channel Box or Attribute Editor from the display.
Tip You can also delete selected objects with the Backspace or Delete keys on the keyboard.
USING MAYA: ESSENTIALS 72
EDITING OBJECTS | 3 Deleting objects
Deleting object components by type Delete by Type lets you delete objects of a particular type or characteristic (for example, channels). If many objects are selected and you select Delete by Type > Channels, only the Channels attached to the selected objects are deleted. Similarly, if you select Delete by Type > History, any history nodes attached to the selected objects are deleted. You can delete the following component types: •
History
•
Channels (channels that describe how the object’s animation parameter changes values over time)
•
Static Channels (channels that are not animated)
•
Motion Paths
•
Non-particle Expressions
•
Constraints
•
Sounds
•
Rigid Bodies To delete an object’s components:
1
Select the object with the component you want to delete.
2
Select Edit > Delete by Type > componentType. For Channels, Static Channels and Expressions, the components are deleted according to the selected delete channel options. To specify delete options:
1
Select Edit > Delete by Type > Channels ❐, Static Channels ❐, or Non-particle Expressions ❐. The Delete Options window opens.
2
Set the following options and click Save.
Hierarchy
To delete the component from the selected object only, choose Selected. To delete the component from the selected object and all objects below it in the DAG hierarchy, choose Below.
Channels
To delete all channels attached to all the selected object’s keyable attributes, select All Keyable. To delete channels attached to those attributes selected in the Channel Box, select From Channel Box. (Instead of Channels, this same option affects Expressions for Non-particle Expressions.)
Driven Channels
Turn this option on to delete driven channels attached to the selected object’s set driven key attributes.
Control Points
Turn this option on to delete channels attached to lattice, polygon, and NURBS curves and surface CVs. If you select All Keyable, this is automatically turned on. The default is off.
Shapes
Removes the object's geometry channels. If you select All Keyable, this is automatically turned on. The default is off.
USING MAYA: ESSENTIALS 73
EDITING OBJECTS | 3 Duplicating and instancing objects
Deleting all objects by type Use Delete All Objects by Type to delete all occurrences of a type of object or component in the scene (for example, joints). To delete all objects by type: Select Edit > Delete All By Type > type. This deletes all of the selected type of components or objects in the scene.
DUPLICATING AND INSTANCING OBJECTS There are two ways to copy objects: •
With the Duplicate option—Maya actually copies the geometry or lights in a scene.
•
With instances—Maya just redisplays the geometry being instanced. Copies of the selected geometry are not created. Since instances are not actual copies of the original geometry, they take up less system memory than actual copies.
Duplicating objects Use the Duplicate command to create copies of geometry or lights in a scene. You can duplicate more than one object at a time. You can duplicate objects as many times as you like. This means that you do not have to build a new object every time you need a copy.
Note To create more than one copy of the object at the same time, select Duplicate ❐. For more information, see "Setting duplicating options" on page 74. To duplicate an object: 1
Select the object you want to duplicate. If you want to duplicate more than one object, click-drag a box around the objects or Shift-click the desired objects.
2
Select Edit > Duplicate. Maya positions the copy of the object behind the original object. You cannot see it until you move it.
3
To move the duplicate object from behind the original, click the Move Tool on the Tool Box. The object displays four manipulators.
4
Drag the object to move it from behind the original object. Maya deselects the original object. If you specified more than one copy (see "Setting duplicating options" on page 74), click on the original with the Move tool and drag the manipulators. Repeat until all copies appear in the view.
Setting duplicating options Use the Duplicate Options window to position, scale, and rotate objects as you make copies. You can also specify how may copies are made.
USING MAYA: ESSENTIALS 74
EDITING OBJECTS | 3 Duplicating and instancing objects Setting a duplicate option: 1
Select Edit > Duplicate ❐. The Duplicate Options window opens.
2
Set the following options and click Save.
Translate, Rotate, Scale
Specify the offset values for X, Y, and Z. Maya applies these values to the copied geometry. You can position, scale, or rotate objects as Maya duplicates them.
Note The default for Translate and Rotate is 0.0000. The default for Scale is 1.0000. With the default values, Maya places the copy on top of the original geometry. You can specify offset values (positive or negative floating point) for translation, rotation, and scaling that are then applied to the copied geometry. Number of Copies
Specify the number of copies to create. The range is from 1 to 1000.
Geometry Type
Select how you want the selected object(s) duplicated. Copy – Make a copy of the geometry being duplicated. Instance – Create an instance of the geometry being duplicated. When you create an
instance, you do not create actual copies of the selected geometry. Instead, Maya redisplays the geometry being instanced. For more information, see "Creating instances of objects" on page 76. Group under
Group objects under one of the following: Parent – Groups the selected objects under their lowest common parent in the
hierarchy. World – Groups the selected objects under the world (at the top level of the
hierarchy). NewGroup – Create a new group node for the duplicates. Smart Transform
Turn Smart Transform on so that when you duplicate and transform a single copy or instance of the object (without changing the selection), Maya applies the same transformations to all subsequent duplicates of the selected duplicate.
Tip As a shortcut for duplicating with Smart Transform on, use Edit > Duplicate with Transform. Duplicate Upstream Graph
Turn this option on to force the duplication of all upstream nodes leading up to the selected object. Upstream nodes are defined as all nodes with connections feeding into selected nodes. For example, if A, B, and C are the upstream nodes connecting to D... A > B > C > D
USING MAYA: ESSENTIALS 75
EDITING OBJECTS | 3 Duplicating and instancing objects ...and you select D and use the Duplicate Upstream Graph option, the resultant graph will be as follows: A1 > B1 > C1 > D1 (where A1, B1, C1, and D1 are duplicates of A, B, C, and D respectively). Duplicate Input Connections
Turn this option on so that in addition to duplicating the selected node, the connections feeding into the selected node are also duplicated. For example, if A, B, and C are connections feeding into C... A > B > C ...and you select C and use the Duplicate Input Connections option, then the resultant graph will be as follows: A > B > C and A > B > C1 (where C1 is a duplicate of C).
Creating instances of objects When you create an instance, you do not create actual copies of the selected geometry. Maya redisplays the geometry being instanced on the screen. An instance is always identical to the original geometry, although each object can have a unique translation, scaling, and rotation factor applied to it. Therefore, individual instances can be picked as objects independent of one another.
Note If you move a CV on the original geometry, it affects the shape of all instances of that object. Instanced geometry does not display CVs or hull structure. The form of an instance can only be altered from the original geometry. You can create several instanced copies of the original object, rather than just copying it. If you then make a change to the original object, all instanced copies automatically reflect the same change. Since instances are not actual copies of the original geometry, they take up less system memory than actual copies. In large or complex model scenes, instancing can speed up refresh time, reduce the size of data files, and improve rendering times. Limitations There are a few limitations when using instancing: •
Instanced lights have no effect.
•
Instances share the same shader as the original geometry and cannot be assigned independent shaders.
•
Some functions, such as extrude and insert, cannot be used on instanced items. In these cases, you must make a true copy of the instanced geometry that you want to manipulate, then continue with the function.
USING MAYA: ESSENTIALS 76
EDITING OBJECTS | 3 Duplicating and instancing objects •
You can only apply clusters and deformation frames to the original geometry—you cannot assign them independently to instances. To use clusters and deformations on copies, you must make a true copy of the geometry.
•
There is always at least one non-instanced transformation node between the instance nodes and the actual geometry nodes.
•
When you create an instance of an already instanced node, Maya does not create a new level. DAG nodes and instancing When Maya creates an instance, the top-level DAG node is the transformation node for the instance and the lower-level DAG node is the geometry node. The transformation node is independent of the original object that was instanced, but the geometry node is shared with the original object.
Sphere2, an instance of Sphere1, has two nodes: the transform node (independent) and the geometry node (shared with Sphere1)
USING MAYA: ESSENTIALS 77
EDITING OBJECTS | 3 Working with groups
WORKING WITH GROUPS Grouping makes it easier for you to apply an action to multiple objects. Use the Group, Ungroup, and Create Empty Group options to: •
group objects
•
ungroup objects
•
create empty groups (groups with null objects)
Grouping objects Group a number of objects into a more complex object so that transformations can be applied to all of them at once—in effect, treating many objects as a single object for transformation purposes. To group objects together: 1
Select the objects you want to group together.
2
Select Edit > Group. The objects are now part of a group, according to the defined grouping options.
Setting grouping options Use the Group Options window to specify options for grouping objects. You can specify how the objects, as well as their pivot points, are grouped. Setting grouping options:
Group Under
1
Select Edit > Group ❐. The Group Options window opens.
2
Set the following options and click Group. Group objects under one of the following: Parent – Groups the selected objects under their lowest common parent in the
hierarchy. For example, selecting a single object and grouping puts the group node immediately above the selected object in the hierarchy. Selecting objects that are in different hierarchies puts the group under the world since they don’t share a common parent. Selecting objects in different parts of the same hierarchy puts the objects under their lowest common parent. If you go from each selected object, the new group will be placed under the first node containing all the selected objects. World – Puts the new group under the world (at the top level of the hierarchy). Group Pivot
Select where you want the pivot point for the group to be. Center – Puts the new group’s pivot point at the center of the bounding box of the
grouped objects. Origin – Puts the new group’s pivot point at the origin of the new group’s coordinate
system. Preserve Position
Turn this option on to modify the selected object’s matrix so that Maya preserves the overall world-space position of the object. If turned off, the matrix of grouped objects are changed and the object’s world-space position changes when grouped.
USING MAYA: ESSENTIALS 78
EDITING OBJECTS | 3 Working with groups
Ungrouping objects Ungroup lets you separate parts of a group and remove nodes from a hierarchy. You can then work with each object on an individual basis. To ungroup objects: 1
Select a group.
Tip If your scene is comprised of many groups, use the Hypergraph to help you select a group. See "Using the Hypergraph" on page 263. 2
Select Edit > Ungroup. Maya puts all objects at world level.
3
Click anywhere in the display to deselect the objects.
USING MAYA: ESSENTIALS 79
EDITING OBJECTS | 3 Creating object hierarchies (parenting)
Setting Ungrouping options Use the Ungroup Options window to specify options for ungrouping objects. Setting ungrouping options:
Group Under
1
Select Edit > Ungroup ❐. The Ungroup Options window opens.
2
Set the following options and click Ungroup. Ungroup objects under one of the following: Parent – Puts all objects under their lowest common parent in the hierarchy. If there
is none, then it puts the objects as the world level. World – Puts all objects at world level (at the top-level of the hierarchy). Preserve Position
Turn this option on so that Maya preserves the transformation information of the group. If turned off, the ungrouped objects lose their grouped transformation attributes, therefore changing their position when ungrouped.
Creating an empty group Select Create > Empty Group to create a new group (transform node) without children. These empty or null objects are useful because they can be used to control other objects through expressions. Moving the unrendered, empty object triggers expressions that move other parts of the model. In other words, they can act as constraint nodes.
Tip You can also create an empty group by selecting Edit > Group with no objects selected.
CREATING OBJECT HIERARCHIES (PARENTING) You use parenting to establish a hierarchy in your scenes. The Edit menu provides these parenting options: Parent
Moves objects from one hierarchy to another and creates instances.
Unparent
Returns a parented hierarchy to its original state. Use Parent to move objects between hierarchies and create instances.
Note In the Outliner and Hypergraph, you can drag and drop one object on top of another to parent it.
Parenting objects When you parent an object, you make it part of a hierarchy.
USING MAYA: ESSENTIALS 80
EDITING OBJECTS | 3 Creating object hierarchies (parenting) To create a parent: 1
Select the objects you want to make up the parent/child relationship. Select the children first, and the parent last.
2
Select Edit > Parent ❐. The Parent Options window opens.
3
Set the following options and click Parent. Select what you want done with the selected object:
Parent Method
Move Objects – Move the object from its current parent to the new parent (the last
selected object). Add Instance – Create an instance under the new group instead of moving the object. Preserve Position
Turn Preserve Position on to preserve the overall world-space position by changing the parented objects’ transformation matrix.
Note If two objects are selected, the first object goes under the one selected last.
Unparenting objects When unparenting an object from a group, you can remove it from the hierarchy and put it into world space. If it is an instance, you can delete it altogether. To unparent an object:
Unparent Method
1
Select the child object.
2
Select Edit > Unparent ❐. The Unparent Options window opens.
3
Set the following options and click Unparent. Select how you want to unparent the selected object: Parent to World – Remove the object from its current parent and place it under the
world. Remove Instance – Remove a particular instance instead of moving the object. Preserve Position
Turn Preserve Position on to preserve overall world-space position by modifying the parented objects’ transformation matrix.
USING MAYA: ESSENTIALS 81
EDITING OBJECTS | 3 Undoing and redoing actions
UNDOING AND REDOING ACTIONS You can undo the last action you performed and redo if you change your mind. You can also repeat your last actions.
Undoing your last action Undo reverses the last action you performed on a selected object. It also reverses any action you performed from the Edit menu. For example, you can transform an object to a new position, then return it to its original position using the Undo command. To reverse an action: Select Edit > Undo.
Note To set how many levels of Undo you want, select Window > Settings/ Preferences > Preferences, Undo category, and set the Queue Size. Note that a large Queue Size slows Maya’s performance.
Redoing and repeating actions Select Edit > Redo to perform the last action that you reversed. For example, if you delete an object and then use Undo to display it, Redo deletes the object again. Select Edit > Repeat to echo the last menu item you selected. You can only repeat selections from menus on the Maya main menu bar. You cannot repeat selections from the shelf, channel box, or any of the secondary window menus.
EDITING OBJECT ATTRIBUTES An attribute is a characteristic of an object in a scene. There are many ways to set attributes in Maya—with the Attribute Editor, Channel Box, Attribute Spreadsheet, menu selections, and expressions. You can set attributes to control virtually anything in your models and animation. For information on editing attributes, see: •
"Using the Attribute Editor" on page 222
•
"Using the Channel Box" on page 236
•
"Using the Attribute Spread Sheet" on page 212
•
Using Maya: Expressions
•
Using Maya: Painting
USING MAYA: ESSENTIALS 82
4
TRANSFORMING OBJECTS After you build your curves, surfaces, and objects, you are ready to position them in 3D space. This chapter describes how you scale, rotate, and move your objects.
SELECTING TRANSFORMATION TOOLS The Tool Box provides six basic tools: Select, Lasso, Move, Rotate, Scale, and Show Manipulator. The last tool you used occupies the last position in the Tool Box, except for tools that already have an icon in the Tool Box, such as the Move Tool. Equivalent keys Select Tool
q
Lasso Tool Move Tool
w
Rotate Tool
e
Scale Tool
r
Show Manipulator Tool
t
space for the last tool used (non-sacred tool)
y
The q, w, e, r, t, and y hotkeys correspond to the Tool Box icons, as shown above. When you press the w key and drag with the left mouse button, a marking menu appears for the Move manipulator. Similarly, you can display marking menus for using the e key (for Rotate) and r key (for Scale). The marking menu options are another way to select manipulator handles.
USING MANIPULATORS Manipulators provide a visual and interactive way to change an object’s parameters. You use manipulators to directly position and scale objects in the workspace. Many tools have manipulators. Usually, a tool creates a manipulator when you open the tool and deletes the manipulator when you exit it. (However, there are some exceptions to this.)
USING MAYA: ESSENTIALS 83
TRANSFORMING OBJECTS | 4 Using axes and pivot points When you use a manipulator to change parameter values, the Help Line displays the values as they change. You can also change parameter values by entering them in the Numeric Input field (at the top right of the window). For details, see "Entering numeric values" on page 98. Y handle
Z handle
Center handle X handle
About manipulator handles Each manipulator has several handles. You move these handles to change parameters. For example, the Move manipulator has a center handle, plus handles you use to move it in X, Y, and Z. If you want, you can make these handles larger or smaller using the manipulator display preferences in Window > Settings/Preferences > Preferences. For the transform manipulators, you can also use the + and - keys on the keyboard to change handle size.
The active (current) handle When you click-drag a manipulator handle, it becomes active. This means you can now use the middle mouse button to move the handle without having to reselect it. If you click away from the handle and drag, it still moves the manipulator. The default color of the active handle is yellow. You can keyframe the attribute that corresponds to this active handle by setting keys on the current manipulator handle (Animation menu set, Animate > Set Key ❐). For more information, see Using Maya: Animation.
USING AXES AND PIVOT POINTS There are various ways you can define from where your objects are transformed. Use the location of the pivot point or axes to transform in a specific direction from a specific point in local or world space.
What are pivot points? Objects are transformed based on a specific point in 3D space known as a pivot. When you rotate a primitive, for example, the pivot point represents the center of the rotation axis; when you scale, the pivot point represents the fixed point around which scaling occurs. By default, the pivot point is set so that the rotational and scale pivots are located at the point of origin for an object (0, 0, 0). The point of origin is the center of the object. You can change an object's pivot and you can also pin it to a fixed location.
USING MAYA: ESSENTIALS 84
TRANSFORMING OBJECTS | 4 Using axes and pivot points To quickly display an object’s pivot point using edit mode: 1
Select the object, then select the transformation tool.
2
Press the Insert key on the keyboard to turn to and from an edit mode. Edit mode displays a manipulator for moving the pivot.
Manipulator for moving pivot
To display an object’s pivot point using the Attribute Editor: 1
Select the object.
2
Open the Attribute Editor (Window > Attribute Editor) and click the object’s transform tab.
3
Expand Pivots, and turn on Display Rotate Pivot or Display Scale Pivot.
transform tab
Pivots options
Moving pivot points You can move a pivot point to set the point you want to move, scale, or rotate the object from. Use the Insert key on the keyboard to display the pivot point, then use any of the transformation tools. In the following example the Rotate transformation tool is selected. To move a pivot point manually: 1
Select an object, select a transformation tool, and then press the Insert key. The pivot point manipulator appears.
rotate manipulator
2
pivot point manipulator
Drag the pivot point manipulator to move the pivot point.
USING MAYA: ESSENTIALS 85
TRANSFORMING OBJECTS | 4 Using axes and pivot points
pivot point
3
Press the Insert key again to display the transform manipulator and drag to transform the object.
rotate manipulator
To move a pivot point using the Attribute Editor: 1
Select the object, open the Attribute Editor and in the Pivots section, turn Display Rotate Pivot or Display Scale Pivot on, depending on which pivot point you want to move.
2
In the Local or World Space sections, enter X, Y and Z values for Rotate Pivot or Scale Pivot and press Enter. In the following example, the rotate pivot is moved 5.0 units in the Z direction in absolute local space. You can now rotate the object from that pivot point location.
Rotate pivot point moved 5.0 in Z
Pinning component pivot points Maya creates a temporary pivot point for object components you select while in Component selection mode. The pivot point is centered with respect to the selected components. If you select additional components after moving a temporary pivot, the pivot automatically moves back to the original position. To prevent it from moving, you can “pin” the temporary pivot to a location you define in edit mode. To pin a pivot point: 1
In component selection mode, select the components.
USING MAYA: ESSENTIALS 86
TRANSFORMING OBJECTS | 4 Using axes and pivot points
example of CVs selected in Component Selection mode
2
Press the Insert key to enter edit mode.
3
Drag the pivot point to move it to a new location.
4
Still in edit mode, click the pivot target. The pivot locks to the current position.
Unpinned pivot point
Pinned pivot point
Note The component pivot remains pinned in its position until you return to edit mode (using the Insert key) and unpin it. To “unpin” (or unlock) a pivot and return it to default auto-centering mode, click the pinned pivot manipulator.
What is an axis? An axis is a straight line that indicates the origin and direction. For example, by using two axes, a plane is defined: the XY plane is defined by placing X and Y axes so they intersect at the origin. Three dimensions are defined by using three axes: X, Y, and Z.
Displaying the axis indicators There are two types of axes: the global axes, and the local axes. The global axes display in the view. You can display the global axes at the origin in the perspective view (Display > Heads Up Display > Origin Axis) and you can display the global axes at the bottom left of each view (Display > Heads Up Display > View Axis). The local axes displays at the origin of the active object in all views. To display the local axis, open the Attribute Editor. Click the transform tab for the object, and in the Display section, turn on Display Local Axis.
USING MAYA: ESSENTIALS 87
TRANSFORMING OBJECTS | 4 Moving objects
Axes and rotation When you rotate an object, the outcome is partially dependent on the rotation order of the object’s axis. The default rotation order is xyz, but you can change it as needed. For more information, see "Changing the rotation order and axis orientation" on page 94.
Changing the axes origin from the Command Line You can also type the following commands in the Command Line to turn the global axis display on and off in the 3D views.
Command
Action
turnAxis -o true;
displays the axis at the origin
toggleAxis -o false;
hides the axis at the origin
toggleAxis -v true;
displays the axis at the bottom left of each view
toggleAxis -v false;
hides the axis at the bottom left of each view
MOVING OBJECTS The following procedure describes how you use manipulators to move an object: To move an object using the Move Tool: 1
Click the Move Tool icon in the Tool Box.
2
Select the object you want to move. Maya displays a manipulator with four handles—one to move along each axis and one to move anywhere within the plane. The colors of the handles correspond to the XYZ axes.
USING MAYA: ESSENTIALS 88
TRANSFORMING OBJECTS | 4 Moving objects Drag this handle to move in Y direction
Drag the center handle to move in any direction
Drag this handle to move in Z direction
Drag this handle to move in X direction
3
Click-drag one of the handles, as indicated above. The selected handle changes color when active. The default color is yellow.
•
To move the object along a single axis, select and drag the handle for that axis.
•
To move the object freely along all axes, select and drag the center handle of the manipulator.
Tip Another way to restrict movement to one axis is to press the Shift key and drag using the middle mouse button. This is faster than clicking on the manipulator to switch between specific handles.
Tip For all manipulators, the middle mouse button controls the active manipulator handle. By default, the Move manipulator moves along the plane of the view. In the perspective view, you also use it to move in the XY, YZ, or XZ planes. •
To move in the XZ plane, Ctrl-click the Y handle. The “current plane” for the center handle becomes the XZ plane. The center handle now moves the object in the XZ plane (keeping the Y translation value constant).
•
To move in the YZ plane, Ctrl-click the X handle.
•
To move in the XY plane, Ctrl-click the Z handle.
•
If the current plane is the XZ plane (or YZ or XY) and you want to move in the view plane, Ctrl-click the center handle. When a snap mode is turned on, the manipulator center changes to a circle. This indicates that the manipulator snaps instead of moving freely in the current plane. Moving tips Here are a few tips to help you move an object:
•
The Selection Mask options window controls what types of items you can move. For example, if CVs are turned on and all other components are turned off, only CVs can be selected and moved.
•
To change an object’s shape, you can move CVs independently of the objects they are in. USING MAYA: ESSENTIALS 89
TRANSFORMING OBJECTS | 4 Moving objects •
When you transform an object, the center of the manipulator is the center of the current selection’s bounding box. It acts as a temporary pivot. To move the pivot point, see "Moving pivot points" on page 85.
Choosing a coordinate system for the Move Tool Use the Tool Settings options window to specify the coordinate system for the Move Tool. To specify an option: 1
Double-click the Move Tool icon in the Tool Box. or Select Modify > Transformation Tools > Move Tool ❐. The Tool Settings window opens.
2
Select one of the following options and click Close.
Object
Moves an object in object space coordinate system. Axis orientation includes rotations on the object itself. If several objects are selected, each object moves the same amount relative to its own object space coordinate system.
Local
Aligns the object to the rotation of the parent object. Movement is constrained to those axes in the local space coordinate system. The object is aligned to the rotation of the parent object and does not include the rotations on the object itself. If several objects are selected, each object moves the same amount relative to its own object space coordinate system.
World
Moves in the world space coordinate system. The object is aligned to the world space axis. This is the default.
Normal
Moves selected CVs on a NURBS surface in the U or V direction of the surface. Typically you would use this option for small sets of CVs. The manipulator indicates the surface Normal, U, and V directions.
USING MAYA: ESSENTIALS 90
TRANSFORMING OBJECTS | 4 Moving objects When you select Normal, the Update [UVN] Triad checkbox appears. Turned on, this option causes the manipulator orientation to reflect the moved surface rather than the original surface. This is the default. Turned off, the manipulator retains the orientation for the original surface.
Using the Move Normal Tool Use the Move Normal Tool (Modify > Transformation Tools > Move Normal Tool) to move selected CVs on a NURBS surface in the U or V direction of the surface. This is the same as selecting the Normal option for the Move Tool. The Update [UVN] Triad checkbox is turned on by default. For more information about this Update [UVN] Triad option, see “Normal” above.
Moving curves on surfaces Curves on surface (along with their edit points) have a special Move manipulator. When you move a curve on surface, the manipulator constrains the curve on surface to the surface and allows for movement in the UV direction separately.
Move curve on surface manipulator
You can also move a curve on surface entirely off the surface. Since it is mapped only to the UV parameter space of a surface, once the curve or any portion of the curve is moved off the surface, it is no longer displayed. Similarly, if you move an edit point on a curve on surface element off the surface, the edit point and curve spans affected by that edit point are no longer displayed.
USING MAYA: ESSENTIALS 91
TRANSFORMING OBJECTS | 4 Rotating objects
Moving a path animation marker Motion path markers also have a special manipulator. You can add a marker to a path animation to change the animation timing. If you have a position marker along a path animation, you can use the Move Tool to motion the position marker to another point along the motion path. For more information, see Using Maya: Animation.
ROTATING OBJECTS Use the Rotate Tool to rotate objects about any or all three axes. To rotate an object: 1
Click the Rotate Tool icon in the Tool Box.
2
Select the object you want to rotate. Maya displays a rotate manipulator consisting of four rings (handles), plus a “virtual sphere” enclosed by the rings. The colors of the handles correspond to the XYZ axes.
Drag the outer ring to rotate about view axis Drag to rotate in the X direction
Drag to rotate in the Z direction Drag the virtual sphere area to rotate in X, Y and Z Drag to rotate in the Y direction
3
Click-drag one of the handles, as indicated above. The selected handle changes color when active. The default color is yellow. Use the X, Y, and Z rings to perform constrained rotations. Use the outer ring to rotate relative to the view. For example, in the front view, the view ring rotates the object in the XY plane. The virtual sphere is used to rotate in X, Y, and Z. When you rotate a component, Maya rotates it about a temporary pivot which is initially set to the center of the component’s bounding box. For information on moving the pivot, see "Moving pivot points" on page 85.
Changing the rotation order The Rotate manipulator respects the key object’s rotation order, that is, the order in which X, Y, and Z rotations are applied. To change the rotation order of an object, open the Attribute Editor. The rotation order option is under the scale/rotate/translate attributes. This is most useful with the Gimbal manipulator. See "Animating rotation channels" on page 94.
USING MAYA: ESSENTIALS 92
TRANSFORMING OBJECTS | 4 Rotating objects
Choosing a rotate mode You use the Tool Settings window to specify the behavior for the Rotate Tool. To specify an option: 1
Double-click the Rotate Tool icon in the Tool Box. The Tool Settings window opens.
2
Select a Rotate Mode option, and if desired, turn on Snapping and specify a Snap to Value, and then click Close.
Local
Rotates the object about the object space axes.
Global
Rotates the object about the world space XYZ axes. Notice that in this mode the rings never change.
Gimbal
Changes only the X, Y, or Z rotation value. In the local and global modes, the XYZ constraint rings may change more than one of the rotation XYZ channels.
Snapping
When Snapping is turned on and you rotate an object using one of the Rotate Tool handles, the object snaps to increments of the Snap to Value. For example, if you specify the Snap to Value as 5.0 and the current rotateX value is 2.25, dragging the rotateX handle of the manipulator will snap the current rotation value to 0.0 and then subsequent dragging of the rotateX handle will jump in units of 5.0. While snapping works in Local, Global, and Gimbal modes, only Gimbal is guaranteed to modify just the Channel Box attribute associated with the current handle. (In the other two modes, you could see all three values changing as you rotate a given handle. In these cases, snapping 5.0 degrees may not always result in nice round numbers in the Channel Box, even though the object will appear to snap by 5.0 degrees.) To rotate without snapping, turn Snapping off. Snapping is turned off by default.
Note To momentarily turn Snapping on or off you can use the j key. Press the j key and then rotate the object. If Snapping is turned on in the Rotate Tool Settings window, then pressing j will turn it off while rotating the object. If Snapping is turned off, then pressing j will turn it on while rotating the object. When you release the j key, Snapping is restored to what it was in the Rotate Tool Settings window. The snapping increment used is the value that was last specified for the Snap to Value option in the Rotate Tool Settings window.
USING MAYA: ESSENTIALS 93
TRANSFORMING OBJECTS | 4 Scaling objects
Changing the rotation order and axis orientation In the Transform Attributes section of the Attribute Editor, you can change the rotation order of the axes for an object by selecting an order from the Rotate Order pop-up menu. You can also enter values in the Rotate Axis X, Y, or Z boxes to rotate the axes in a specific direction, and to rotate the object around a different axis.
Keep in mind that these attributes have a combined effect with the Rotate Mode settings in the rotate Tool Settings.
Animating rotation channels With the world and object space rotation manipulator, you can change multiple rotation channels at one time, even when using one of the X, Y, or Z rings. For animation, rotations are interpolated on a per channel basis and the rotation channels are not independent. The rotation channels are applied in a specific order. This ordering impacts the animation of these channels. (To change the rotation order, use the Attribute Editor.) For this reason, interpolating all three rotation channels on a single object usually does not result in a smoothly animated rotation. Instead, use the Gimbal option of the rotation manipulator. It lets you change and control individual rotation channels without affecting the other rotation channels. It also gives more predictable results. For modeling purposes, or with animations that don't include rotation channels, use any of the rotate manipulators. When you animate components such as CVs, you are actually animating their position. Rotating some CVs and setting keys do not produce an arc because the CV positions are what are interpolated. In this case, it does not matter which rotate manipulator is used.
SCALING OBJECTS Use the Scale Tool to change the size of objects by scaling proportionally in all three dimensions. You can also scale non-proportionally in one dimension at a time. To scale an object: 1
Click the Scale Tool icon in the Tool Box.
2
Select the object you want to scale. Maya displays a scaling manipulator that consists of four handles. The colors of the handles correspond to the XYZ axes.
USING MAYA: ESSENTIALS 94
TRANSFORMING OBJECTS | 4 Using the Show Manipulator Tool Drag to scale in the Y direction Drag to scale proportionally
Drag to scale in the X direction
Drag to scale in the Z direction
3
Click-drag a handle to scale the object, as indicated above.
Tip A useful shortcut for non-proportional scaling in X, Y, or Z is to use the Shift key. Hold the Shift key down, then, using the middle mouse button, drag along the direction of the axis you would like to scale in. This is faster because you don't need to click directly on the specific handle to switch between scaling in X, Y, or Z. By default, all geometry is assigned an initial scale factor of 1. When you scale a component, Maya scales it about a temporary pivot, which is initially set to the center of the active component’s bounding box. Note that for components, it is the component position that is being changed. For information on moving the pivot, see "Moving pivot points" on page 85.
USING THE SHOW MANIPULATOR TOOL Some functions display special manipulators that let you tailor a surface or curve after a surface has been created. The Show Manipulator Tool (Modify > Transformation Tools > Show Manipulator Tool) lets you edit the construction history of an operation or the attributes of an object itself. In other words, this tool lets you access the input node of an object. A manipulator is a good way to access the history of a surface created with construction history (such as a beveled or revolved surface). Several manipulators can be active at one time. When the object is deselected, the manipulators disappear. Reselect the object, and the manipulators reappear. There are several ways to access and display manipulators using the Show Manipulator Tool. Before you start, make sure construction history is on (click the Construction History icon on the Status Line).
USING MAYA: ESSENTIALS 95
TRANSFORMING OBJECTS | 4 Using the Show Manipulator Tool
Selecting an item’s history node The Show Manipulator Tool displays a manipulator for the operation’s history node. To access the manipulator, you must select the history node. After you revolve an object, the revolve history node is active and the Show Manipulator Tool displays the Revolve manipulator. If you perform several other operations and then want to edit the revolved surface, the manipulators are no longer displayed. You have to select them using one of the following methods. To select the history node: Select the surface then do one of the following: •
Press the a key and the left mouse button. Drag to Select All History on the marking menu that appears.
or •
From the History list menu in the Status Line, select the history node.
or •
From the Channel Box, select the history node. In the following example, the history nodes for a revolved surface and the curve used to construct it are selected. Click revolve1 to select the history node for the revolved surface.
USING MAYA: ESSENTIALS 96
TRANSFORMING OBJECTS | 4 Using the Show Manipulator Tool
Changing a curve’s parameter range You can use the Show Manipulator Tool to change the parameter range (minimum and maximum value) on a subCurve. A subCurve is created when you select the Partial option as the Curve Range in some options windows (for example, Revolve Options, Loft Options, Extrude Options, Boundary Options, Bevel Options, Project Curve Options). This option lets you select a minimum and maximum parameter value on the curve; only the part of the curve between those points is used to create the surface. Most surface operations that use a curve as input include this option. A subCurve can also be the construction curve, or input curve, you use to create surfaces, such as revolved or extruded surfaces.
Once you select the history nodes and the Show Manipulator Tool, manipulators display on the surface or the construction curve. To interactively edit these nodes, click-drag the manipulator handles, or change the values in the Channel Box or the Attribute Editor.
Note Some options windows include a Keep Original checkbox (for example, Edit Curves > Detach Curves). Turn this on to access the manipulators.
Displaying manipulators for lights and cameras Use the Show Manipulator Tool to display manipulators for editing lights and cameras. The appropriate manipulator displays for the camera or light you select. For example, if you select a light or a camera and then click the Show Manipulator Tool in the Tool Box, Maya displays the following manipulators:
USING MAYA: ESSENTIALS 97
TRANSFORMING OBJECTS | 4 Entering numeric values
Spotlight manipulators
Camera manipulators
For details, see "Displaying camera and light manipulators" on page 128.
Using the Default Object manipulator The Default Object manipulator is the transform tool set to be used with the Show Manipulator Tool for an object. It can be the Move, Rotate, or Scale Tool. Even if the object has its own manipulator (for example, a light), the transform manipulator is shown instead. To set the default manipulator for the Show Manipulator Tool: Select Modify > Transformation Tools > Default Object Manipulator > transformTool. Set Default Object Manipulator to None to use the object’s own manipulator, rather than a transform manipulator. This is the default. This information is saved with the scene. It is also shown in the Attribute Editor under the transform Display section.
ENTERING NUMERIC VALUES You can move, rotate, or scale an object by entering values in the Numeric Input field or the Command Line.
Using the Numeric Input field The Numeric Input field appears on the Status Line. You can enter absolute values or relative values in the Numeric Input field. When typing values, do not include commas to separate XYZ coordinates—use spaces. For example, type: 1 3 5
...not 1,3,5
You can use decimal values. Entering absolute values Click the pulldown menu next to the Numeric Input field and select Numeric Input: Absolute. The button changes to abs, to indicate that Maya will interpret the values you enter as relative. When you enter an absolute value, Maya moves or rotates the object to the absolute world-space coordinates that you type in, or scales the object to the absolute size value specified for each of the three axes.
USING MAYA: ESSENTIALS 98
TRANSFORMING OBJECTS | 4 Entering numeric values For example, if an object is positioned at XYZ coordinates (4, 2, 2) and you move the object by entering an absolute value of: 6 3 1
...in the numeric input field, the new position of the object is (6, 3, 1). You can omit trailing zero values. For example, you can type: 2 3 0
or 2 3
...to move an object to (2, 3, 0). To move or scale an object on only one or two of the axes without affecting the other axis, you must re-enter the current values you don’t want to affect. For example, to move an object from its location at (2,3,1) to (4,4,1), enter the absolute move values: 4 4 1
Similarly, if an object is scaled by a factor of 5 on all three axes and you want to change the scale on the x-axis to a factor of 6, enter the scale factors: 6 5 5
Entering relative values Click the pulldown menu next to the Numeric Input field and select Numeric Input: Relative. The button changes to rel, to indicate that Maya will interpret the values you enter as relative. When you enter a relative value, Maya moves, rotates, or scales the object by the specified amount on each axis, relative to the object’s current position or scale factor. For example, to move an object from (2,3,1) to a position two grid positions in the positive X direction and one grid position in the positive Y direction, enter the relative values: 2 1 0
...and press Enter. The zero value for the z-axis results in no positional adjustment on this axis. The object moves to (4,4,1). You can omit trailing zero values. For example, you can type: 2 3 0
...or 2 3
...to move an object from (1,1,1) to (3,4,1). To transform an object using the Numeric Input field: 1
Click the Move, Rotate, or Scale Tool in the Tool Box.
2
Select the object you want to transform.
USING MAYA: ESSENTIALS 99
TRANSFORMING OBJECTS | 4 Combining transformations
Note If you select more than one object, Maya displays the manipulator on only one object. However, each object moves, scales, or rotates relative to its own pivot point. 3
To transform the object by an absolute amount (the default), type the XYZ coordinates in the Numeric Input field and press Enter, or type -a before the value and press Enter, for example: -a 1 7 4
To transform an object by a relative amount, select Relative from the Numeric Input field’s drop-down list to switch to rel, then enter the value, or type -r before the value and press Enter, for example: -r 2 6 3
Using the Command Line The command line appears at the bottom of the Maya main window. To transform an object with the Command Line: To transform objects from the Command Line, you use the move, rotate, and scale commands. If you type -r before the numerical values on the Command Line, geometry is translated relative to its current location. (-a, for absolute world space coordinates, is the default.) Type transform values and press Enter
COMBINING TRANSFORMATIONS You can use the combined Move/Rotate/Scale manipulator to switch between moving, rotating, and scaling. When you first select this Tool, only part of each manipulator is displayed. To see the complete manipulator, click one of its handles. To transform the object, click-drag the appropriate handle. For more information, see "Moving objects" on page 88, "Rotating objects" on page 92, or "Scaling objects" on page 94.
Note When you use the combined transformation tool, the transformations occur with respect to object space only.
USING MAYA: ESSENTIALS 100
TRANSFORMING OBJECTS | 4 Using proportional modification
USING PROPORTIONAL MODIFICATION You can use the Proportional Modification (propmod) Tool to transform a number of items proportionally, based on the distance from the manipulator handle. Typically, you use this tool to transform CVs. The propmod effect is usually based on the distance of the CV, or other component, from the manipulator. The closest object exactly matches the manipulator’s movement. Objects further away do not. This effect is controlled by the Distance Cutoff setting. The manipulator for Proportional Modification is a combination of the move, rotate, and scale manipulators. Click the appropriate part of the manipulator, depending on what type of transformation you want to perform.
You can reposition the manipulator in another part of the scene to achieve different effects on the selected objects. Example of translating CVs: 1
Click the Select by component type icon on the Status Line and select the curves to see the CVs.
Click this icon and select the curves to see the CVs
2
Shift-drag to select all the CVs in the center of the curves.
3
Select Modify > Transformation Tools > Proportional Modification Tool. Maya displays a manipulator.
USING MAYA: ESSENTIALS 101
TRANSFORMING OBJECTS | 4 Using proportional modification
4
Click-drag to position the manipulator, then drag the green handle to move the CVs on the curves.
CVs move proportionally
Specifying proportional modification falloff To set proportional modification options, either double-click the icon, or select Modify > Transformation Tools > Proportional Modification Tool ❐. The Tool Settings window opens.
Linear modification falloff This is the default modification falloff. Maya performs the modification in a linear fashion and displays the Distance Cutoff option.
Distance Cutoff Distance Based On
Objects further away than this value are ignored. The distance is measured in 3D from the manipulator handle. The distance from the manipulator handle to the object directly influences the modification factor. The distance will be computed along the selected axes only. If any of these is turned off, the distance used in the computation of the propmod effect from the handle to the point will ignore that component.
USING MAYA: ESSENTIALS 102
TRANSFORMING OBJECTS | 4 Using proportional modification
Power modification falloff Using the Proportional Modification Tool, you can set the degree to any value between +5 and -5 and the falloff is non-linear (it forms a logistic curve). However, if you set the degree to 1 the falloff is linear again.
Distance Cutoff
Objects further away than this value are ignored. The distance is measured in 3D from the manipulator handle.
Degree
Specifies the degree of effect in the U and V directions. A value of 0 applies the transformation equally over the entire region. A positive value decreases the effect of the transformation for objects further away from the manipulator handle; the greater the degree, the greater this dampening effect. If Degree is negative, the effect of the transformation is increased for objects further away from the manipulator handle.
Distance Based On
The distance from the manipulator handle to the object directly influences the modification factor. The distance is computed along the selected axes only.
Script modification falloff This method uses a MEL script to determine the falloff. With the appropriate parameters set, you can choose the Script option and type a command for the settings in the User defined script box to save the current parameter settings without actually invoking the function. If you want to use these settings again later, you can retrieve the tool’s script from the Reference Editor.
USING MAYA: ESSENTIALS 103
TRANSFORMING OBJECTS | 4 Using proportional modification User defined script
The script should return a modification factor. The inputs to the script are “float” numbers. The first three represent the position of the manipulator handle. The second three represent the position of the point manipulated. For example, the points for which this script returns 1 will move with the manipulator handle. The points for which this script returns 0.5 will move half as fast as the manipulator handle. For more information, see "Using the PropMod script" on page 105.
Curve modification falloff This option uses an animation curve to create the falloff. An animation curve profile can be used to produce a modification factor.
Anim Curve
Enter the name of an existing animation curve. Its vertical direction will map into the modification factor. The distance maps to the anim curve time axis (in seconds). You can use the pull-down menu to the right of the box to list and choose all the anim curves with names starting with propModAnimCurve. You can also create one of those by choosing Create New from the same pull-down menu.
Distance Based On
The distance from the manipulator handle to the object directly influences the modification factor. The distance is computed along the selected axes only.
USING MAYA: ESSENTIALS 104
TRANSFORMING OBJECTS | 4 Using proportional modification
NURBS Curve This option uses an NURBS curve to create the falloff. A NURBS curve profile can be used to produce a modification factor.
NURBS Curve
Enter the name of an existing NURBS curve. Its vertical direction will map into the modification factor. The distance maps to the NURBS curve. You can use the pull-down menu to the right of the box to list and choose from all the NURBS curves.
Using the PropMod script The PropMod script is similar to the Move script except that it has additional settings for the move distance. Using the Script option, you can compute each object’s factor individually. The user-defined script command considers both the position of the manipulator and the object. The value returned by the script is used as a multiplying factor for a specific object. Example Create myPropMove.mel file as: global proc float myPropMove(float $mx, float $my, float $mz, float $px, float $py, float $pz) } return rand (1.0) }
...which produces a random value between 0 and 1. If you select myPropMove as the script name, you get a random modification factor for all selected points.
USING MAYA: ESSENTIALS 105
TRANSFORMING OBJECTS | 4 Creating locators
CREATING LOCATORS A locator marks a position in world space. A locator is displayed as a small gnomon; its lines extend in each direction along the X, Y and Z axes (like the directional rods of a sundial). You can use point snapping to snap to a locator position. Use Create > Locator to create a space or curve locator. To create and move a locator: 1
Select Create > Locator. A locator is created at the origin.
2
Move the locator in one of the following ways:
•
Use the transformation tools.
•
Change the transformation values in the Channel Box.
•
Click the locator# tab in the Attribute Editor and change the Transform Attributes values.
Repositioning the locator in local space You can reposition the locator in local space from the Attribute Editor (Window > Attribute Editor). Click the locatorShape# tab and enter X, Y, or Z values in the Local Position boxes.
USING MAYA: ESSENTIALS 106
TRANSFORMING OBJECTS | 4 Using Measure Tools
Locator positioned at origin
Locator positioned at (0, 3, 0)
USING MEASURE TOOLS The Create > Measure Tools menu includes the Distance Tool, Parameter Tool, and Arc Length Tool.
Using distance measures Use the Create > Measure Tools > Distance Tool to measure and display distances between two specified points. To display a distance measure: 1
Select Create > Measure Tools > Distance Tool.
2
Click to select two points in space, or click a curve or surface to display the distance measure locator. The following example shows the distance locator when two points are placed on a surface.
The following example shows the distance locator when one point is placed in world space and the other is placed on the surface.
USING MAYA: ESSENTIALS 107
TRANSFORMING OBJECTS | 4 Using Measure Tools
The following example shows the distance locator when two points are placed on a curve.
To snap a distance measure point: To snap a locator to a curve or surface, use the Snap to curves icon and click the curve or surface. When you move the item, the distance measure updates. This can be especially helpful if you want to measure the distance between two curves. 1
Click the Snap to curves icon from the Status Line.
2
Place a point on one curve and another point on the other curve.
3
Move one of the curves and the distance measure updates.
To move the distance locator: Click the Move Tool icon, then select a locator and drag to the point from where you want to measure the distance. The distance measure updates automatically.
USING MAYA: ESSENTIALS 108
TRANSFORMING OBJECTS | 4 Using Measure Tools
Editing the distance locators using the Attribute Editor You can move distance locators by editing the Translate values (X, Y and Z) in the Attribute Editor (Window > Attribute Editor). To specify the Translate values of a distance locator: Select a locator, then click the locator# tab of Attribute Editor (Window > Attribute Editor) and enter Translate values for the locator. The distance measure updates automatically. When you edit the Translate values of the distance locators, the Start Point and End Point in the distanceDimensionShape# tab are also updated automatically.
To reposition the distance locator in local space: Click the locatorShape# tab to open that section of the editor. Enter values in the Local Position boxes to reposition the distance measure in X, Y, or Z.
USING MAYA: ESSENTIALS 109
TRANSFORMING OBJECTS | 4 Using Measure Tools
Displaying parameter values Use the Create > Measure Tool > Parameter Tool to display parameter values on curves and surfaces at a specified point. This locator also displays the direction of the curve or surface and the normal to the curve or surface at a specified point.
Normal Normal Curve direction Surface direction
To display parameter values on a surface or curve: 1
Select Create > Measure Tool > Parameter Tool.
2
Click-drag on a curve or surface to display the parameter values at a specified point. For curves, the parameter value displays the U value at the specified point on the curve.
For surfaces, the parameter value displays the U and V values at the specified point.
USING MAYA: ESSENTIALS 110
TRANSFORMING OBJECTS | 4 Using Measure Tools
To move the parameter locator: Click the Move Tool icon, then click-drag a locator over the curve or surface. The parameter values update as you drag.
If you create another locator, the previous locator is dimmed. This means that you can move it later if you need to.
Editing the parameter locators in the Attribute Editor You can specify the U and V parameter values from the Attribute Editor (Window > Attribute Editor). Click the arrow beside the Nurbs Geometry box to access the curve or surface whose locator you want to edit. To specify the U and V parameter values: Click the paramDimensionShape# tab to open that section of the editor. Enter new U and V Param Values.
USING MAYA: ESSENTIALS 111
TRANSFORMING OBJECTS | 4 Using Measure Tools
In the following example, the first figure shows the parameter locator on a surface at the position where it was created. The second figure shows how the locator is modified when you change the U and V Param Values.
Measuring arc lengths Use the Create > Measure Tool > Arc Length Tool to measure and display arc lengths on curves and surfaces at a specified point. It also displays the direction of the curve or surface and the normal to the curve or surface at a specified point.
Normal
Surface direction
Normal
Curve direction
To display arc length values on a surface or curve: 1
Select Create > Measure Tool > Arc Length Tool.
2
Click-drag over a curve or surface to display the parameter values at a specified point.
USING MAYA: ESSENTIALS 112
TRANSFORMING OBJECTS | 4 Using Measure Tools For curves, the distance of the specified point from the start point of the curve is measured.
For surfaces, the specified point from the start point in both the U and V direction is measured.
To move the arc length locator: Click the Move Tool icon, then click-drag over the curve or surface. The parameter values update as you drag.
If you create another locator, the previous locator dims, meaning you can select to move it later if you want.
Editing the arc length locators in the Attribute Editor If you want, you can specify the U and V parameters values from the Attribute Editor (Window > Attribute Editor). Click the arrow beside the Nurbs Geometry box to access the curve or surface for which you want to edit the locator. To specify the U and V parameter values: Click the arcLengthDimensionShape# tab to open that section of the editor and enter new U and V Param values. USING MAYA: ESSENTIALS 113
TRANSFORMING OBJECTS | 4 Using Measure Tools
In the following example, the first figure shows the arc length locator on a surface at the position where it was created. The second figure shows how the locator is modified when the U and V Param Values are changed.
USING MAYA: ESSENTIALS 114
5
DISPLAYING OBJECTS This chapter describes the tools and actions you use to display or hide objects and attributes. You can use these tools to customize your working environment and reduce workspace complexity.
DISPLAYING ITEMS IN MAYA You use the Display menu to show or hide NURBS, polygons, tools, components, and attributes. When you hide or show items, it affects the workspace globally. If you want to hide or show these elements for just one view, use the view’s Show menu. You can also use the Show menu to display specific types of objects (joints, lights, meshes, surfaces, and so on) in a 3D view. For information on Show menu options, see "Hiding and showing objects" on page 122.
Tip You can also control the display of many items from the Attribute Editor. See "Using the Attribute Editor" on page 222.
USING A GRID A grid is a 2D plane that represents 3D dimensions in the view. You can use grids to help animate relative to a solid surface. For example, you could use a grid to help plan the foot positions of a person walking on the ground. You can also use a grid to construct skeletons, because you can snap grid coordinates on and off to precisely position joints. You can hide the grid when you need to reduce visual clutter. For example, if you have animated a character walking across a floor and want to view the surface texture, you can turn off the grid when you’re ready to fine-tune the placement of the character’s feet.
USING MAYA: ESSENTIALS 115
DISPLAYING OBJECTS | 5 Using a grid
To turn the grid off and on: Select Display > Grid. To turn the grid back on, select Grid again.
Note The default grid is a 24 x 24 unit grid displayed in the XZ plane.
Setting grid options Use the Grid Options window to specify how the grid looks on the screen. When you change grid options, Maya changes the display immediately.
Tip Have at least one modeling window open when changing the Grid option. This lets you view the changes interactively. To set grid options: 1
Select Display > Grid ❐. The Grid Options window opens.
2
Set the following options and click Apply. Size We’ve changed the Size options to clarify their function. You can change the size and length of the grid, set the number of subdivision lines, and the increment for the grid lines.
Length and Width
Sets the number of units for the length and width of the grid. The default is 12 units.
Grid Lines Every
Displays every nth grid line. The default is 5 units.
Subdivisions
Specifies the number of divisions between major grid lines. Setting the Subdivisions option to a value greater than 1 specifies that each main grid interval will be subdivided by the amount specified. The default is 5. Color You can change the color of the axes, grid lines and labels, and subdivision lines.
Axes
Specifies a color for the X and Z axes on the grid. The default is dark grey.
Grid Lines & Numbers
Specifies a color for the grid lines and the grid line numbers. The default is light grey. USING MAYA: ESSENTIALS 116
DISPLAYING OBJECTS | 5 Using a grid Subdivision Lines
Specifies a color for the subdivision lines. The default is light grey.
Note You can also change the color of the axes, grid lines and numbers, and subdivision lines in the Colors window (Window > Settings/Preferences > Colors). Go to the Inactive tab and then the Modeling category to find these color options. Here you can also change the color of the X-, Y-, and Z-axis that appear in the Origin and View axes. Display You can turn on and off the display of grid elements, including axes, thicker lines for axes, grid lines, subdivision lines, and grid line numbers. Axes
Turns on or off the display of the axes. The default is on.
Thicker Line for Axes
Turns on or off the display of thicker lines for the axes. The default is on. Grid Lines
Turns on or off the display of the grid lines. The default is on.
Subdivision Lines
Turns on or off the display of the subdivision lines. The default is on.
Perspective Grid Numbers
In the Perspective view, you can set the grid line numbers to display on the axes, along the edge of the grid, or just hide them. Orthographic Grid Numbers
In the Orthographic views (top, side, front), you can set the grid line numbers to display on the axes, along the edge of the grid, or just hide them. Hide
Hides the grid line numbers. This is the default for both Perspective and Orthographic Grid Numbers.
On Axes
Displays the grid line numbers along the axes.
Along Edge
Displays the grid line numbers along the edge of the grid.
Note To restore the default grid option settings, select Edit, Reset Settings in the Grid Options window. However, this does not restore the default grid color settings. To restore the default colors, go to the Colors window (Window > Settings/Preferences > Colors) and select Edit, Reset to Defaults. Please note that this restores all color defaults, including the grid colors.
USING MAYA: ESSENTIALS 117
DISPLAYING OBJECTS | 5 Displaying View tools
DISPLAYING VIEW TOOLS Maya includes useful tools that you can turn on or off in the Display > Heads Up Display submenu. Object Details
Displays a list of object details that includes: Backfaces, Smoothness, Instance, Display Layer, and Distance From Camera. The details are displayed in the top-right corner of the panel. The default is off.
Poly Count
Displays polygon statistics for the visible objects displayed in the view panel. This feature is useful for games development. The default is off. The first column on the left lists the total components of all the polygons in the scene. The second column lists the total components of the selected polygon(s). The third column lists the total selected components.
Animation Details
Turns on or off the display of a list of animation details, which include: Playback Speed, Current Character, and IK Solver Enable. The details are displayed above the Frame Rate in the bottom-right corner of the panel. The default is off.
Camera Names
Displays the camera name (persp, top, side, front) in the bottom-center of camera views. The default is on.
Frame Rate
Displays the frame rate in Hertz (fps) for the current port in the bottom-right corner. The default is off.
View Axis
Displays the global axis in the bottom-left corner of all views. The default is on.
Origin Axis
Displays the global axis at the origin (0, 0, 0) within the perspective view. The default is on.
Poly Count
Object Details
Origin Axis View Axis Camera Names Animation Details
Tips You can also change the color of the labels and values for the Heads Up Display options. See "Changing color settings" on page 330. You can also customize the Heads Up Display by adding your own information. For more information, see Using Maya: MEL.
USING MAYA: ESSENTIALS 118
DISPLAYING OBJECTS | 5 Changing Wireframe Color
CHANGING WIREFRAME COLOR You can now apply a different color to an object’s wireframe. We’ve added a Wireframe Color dialog box that has eight colors to choose from (Display > Wireframe Color). You can also customize the palette of eight colors.
To change the color of an object’s wireframe: 1
Select Display > Wireframe Color. The Wireframe Color dialog box opens.
2
Select the object(s) in the scene, then select a color and click Apply. To see the new wireframe color, deselect the object(s). To change the color of an object’s wireframe back to the default:
1
Select Display > Wireframe Color. The Wireframe Color dialog box opens.
2
Select the object(s) in the scene and then click Default. To change a color in the Wireframe Color dialog box:
1
Select Display > Wireframe Color. The Wireframe Color dialog box opens.
2
Double-click a color swatch. The Color Chooser window opens.
3
Select a color from the Color Chooser and then click Accept. The selected color replaces the former color on the palette of the Wireframe Color dialog box.
4
Close the Color Chooser window and then close the Wireframe Color dialog box.
Note To change the colors in the Wireframe Color dialog box you can also use the Colors window (Window > Settings/Preferences > Colors). Go to the General tab and expand the User Defined category to view and change the eight color swatches. To reset the colors in the Wireframe Color dialog box to the default: 1
Select Window > Settings/Preferences > Colors. The Colors window opens.
2
Select Edit > Reset to Defaults and then close the Colors window.
Warning If you reset the Colors window to the defaults, this affects all color changes in the Colors window.
USING MAYA: ESSENTIALS 119
DISPLAYING OBJECTS | 5 Specifying how objects display
SPECIFYING HOW OBJECTS DISPLAY The Shading menu provides a number of ways to look at your scene. The quality can range from a simple wireframe display to a smooth- shaded view. Wireframe Smooth Shade All
Draws edges for polygon meshes and isoparametric curves for surfaces. This is the default shading quality. Displays all surfaces, meshes, and particles as smooth-shaded objects.
Smooth Shade Selected Items
Displays selected items as smooth-shaded objects. Flat Shade All
Displays all surfaces and meshes as flat-shaded objects.
Flat Shade Selected Items
Displays selected items as flat-shaded objects. Bounding Box
Shows objects as boxes that represent their bounding volumes. Bounding boxes speed up Maya operations and can make a significant difference for complex models. The bounding box encompasses the hulls as well as the actual geometry. As a result, the bounding box may have dimensions larger than those of the geometry.
Note To see bounding box coordinates, open the Attribute Editor, click on the shape node tab, and open the Object Display section. It shows the readonly minimum and maximum world space boundary coordinates of a surface along the X, Y, and Z axes. Points
Shows objects as groupings of individual points.
Shade Options
There are two display options for shaded objects. Wireframe on Shaded – Superimposes a wireframe display on all shaded objects in a
view.
Wireframe isoparms appear over the shaded objects
X-Ray – Displays all shaded objects as semi-transparent. This can be useful for seeing
hidden parts of a model.
USING MAYA: ESSENTIALS 120
DISPLAYING OBJECTS | 5 Specifying how objects display Interactive Shading
Color Index Mode
Controls the display of objects during interactive modes (such as transformations, camera navigation, and playbacks). At the same time the normal display can be in some sort of shaded mode. For example, the normal display can be smooth-shaded while the interactive display is bounding box. There are four interactive shading options: Normal
Keeps the interactive mode the same as regular display mode.
Wireframe
Displays objects in wireframe mode during the interactive mode.
Bounding Box
Displays objects as bounding boxes during the interactive mode.
Points
Displays objects as points during the interactive mode.
On UNIX only, lets you manipulate a wireframe object in a complex scene more quickly (for example, if you are using a full-color image plane while working in wireframe mode).
Dense Wireframe Acceleration
On Windows only, lets you manipulate a wireframe object in a complex scene more quickly. For example, suppose you have created a saloon scene with many objects. When you use the Move tool to move a bottle in the scene, it moves slowly as you drag the mouse. You can improve the interactive manipulation of the bottle with this menu option.
Tip When you use the Dense Wireframe Acceleration option, be aware of the following:
Backface Culling Hardware Texturing Hardware Fog
Apply Current to All
•
Results vary with the graphics card installed in your workstation.
•
Manipulation of wireframe objects in simple scenes is slower.
•
Camera tumbling is unaffected.
For objects displayed in smooth shade or flat shade mode, makes the object’s back face transparent which helps speed the display or manipulation of objects. Displays Maya's hardware textured rendered results as if they were being displayed in an external viewer. Simulates hardware fog effects achievable in programs outside of Maya. Displays how a spotlight's fog is distributed before you render. Used for preview purposes, Hardware Fog only displays in the perspective view. Applies the current 3D view's shading style to all objects in the scene.
USING MAYA: ESSENTIALS 121
DISPLAYING OBJECTS | 5 Hiding and showing objects
HIDING AND SHOWING OBJECTS Use Display > Hide to hide items you aren’t working on and reduce visual clutter. This is handy if you want to remove an object from the view, but do not want to delete it or move it. To redisplay items, use the Display > Show submenu, which includes the same selections as Display > Hide. The Hide menu items are: Hide Selection
Hides selected object(s).
Hide Unselected Objects
Hides all unselected objects. Hide Unselected CVs
To control the display of CVs, select the CVs that you want to remain visible, and then use Display > Hide > Hide Unselected CVs to hide all the other CVs on that surface. This will affect the display of CVs in component selection mode, as well as CVs displayed in object selection mode by the use of Display > NURBS Components > CVs.
Tip It is possible to use selective CV display on more than one surface at a time. The selective CV display function operates exclusively from other Maya Hide and Show commands, and therefore menu selections such as Display > Show > All and others do not effect CVs whose display has been set using selective CV display. All
Hides all objects, whether they are selected or not.
Hide Geometry
Displays a menu that lets you select the type of geometry you want to hide.
Hide Kinematics
Displays a menu that lets you select the type of kinematics you want to hide.
Hide Deformers
Displays a menu that lets you select the type of deformers you want to hide.
Hide Cloth
Available only if you have Maya Unlimited and are using Maya Cloth. Hides cloth objects. For details, see Using Maya: Cloth.
Lights
Hides lights.
Cameras
Hides cameras.
Texture Placements
Hides texture placements.
Planes
Hides planes.
Animation Markers
Hides animation markers.
Light Manipulators
Hides light manipulators.
Camera Manipulators
Hides camera manipulators.
USING MAYA: ESSENTIALS 122
DISPLAYING OBJECTS | 5 Hiding and showing objects
Hiding geometry Geometry represents the properties and relations of points, lines, surfaces, and objects. You can hide a variety of geometry components. To hide geometry: 1
Select an object.
2
Select Display > Hide > Hide Geometry and select the geometry components you want to hide. You can hide NURBS Surfaces, NURBS Curves, Polygon Surfaces, Deforming Geometry, Subdiv Surfaces, Strokes, Stroke Path Curves, and Stroke Control Curves. If you select All, all geometry is hidden, whether it is selected or not. Maya displays the object with the specified component hidden. In the following illustration, the NURBS surfaces associated with a sample object are hidden.
NURBS surfaces shown
NURBS surfaces hidden
Hiding kinematics Kinematics is the study of motion without consideration to the cause of that motion. You can hide and show kinematic components. For information on kinematics, see Using Maya: Character Setup. To hide a kinematic component: 1
Select an object.
2
Select Display > Hide > Hide Kinematics and select the components you want to hide. You can hide Joints, and IK handles. If you select All, all kinematic components are hidden, whether they are selected or not. Maya displays the object with the specified component hidden. In the following illustration, an object’s joints are hidden.
USING MAYA: ESSENTIALS 123
DISPLAYING OBJECTS | 5 Hiding and showing objects
Joints shown
Joints hidden
Hiding deformers Deformers are operations you apply to one or more geometry objects to change their shape. You use the Hide and Show Deformers menus to control the display of the “influence objects” for some deformation types. This helps reduce clutter when you're not actively editing those parts of your scene. For information on deformers, see Using Maya: Character Setup. To hide a deformer: 1
Select an object.
2
Select Display > Hide > Hide Deformers and select the components you want to hide. You can hide Lattices, Sculpt Objects, Clusters, Nonlinears, Wrap Influences, and Smooth Skin Influences. If you select All, all deformers are hidden, whether they are selected or not. Maya displays the object with the specified deformer hidden. In the following illustration, the object’s clusters are hidden.
Clusters shown
Clusters hidden
USING MAYA: ESSENTIALS 124
DISPLAYING OBJECTS | 5 Isolating selected objects or components
ISOLATING SELECTED OBJECTS OR COMPONENTS Use the Isolate Select feature (Show > Isolate Select > View Selected) to quickly isolate objects or components in a view panel. You simply select the items, choose Show > Isolate Select > View Selected, and all other objects and components in your scene become hidden. Unlike the Display > Hide commands, which hide mostly objects, the Isolate Select feature can also isolate components. For example, by selecting polygonal faces, you could isolate the head of a model. Another difference is Isolate Select affects screen display only, while Display > Hide commands also affect rendering.
Isolate Select works on a per-panel basis for any view panel (perspective or orthographic). The components you can select for isolation are: •
CVs of NURBS surfaces
•
faces of a polygon mesh
•
faces of a subdivision surface mesh Other components cannot be selected for isolation, such as NURBS patches, curve segments, particles, or lattice points. However, you can still see and manipulate other component types within the items you have isolated. Use the Show > Isolate Select menu to control the isolate select feature. The menu options are described below.
Tip Keep open at least one other workspace panel with isolate select turned off so you can select other items. Also, tearing off the Isolate Select submenu gives you quick access to these commands. View Selected
Activates or deactivates the isolate select feature. When activated, the word “Isolate” appears at the bottom of the panel and the current selection becomes isolated.
USING MAYA: ESSENTIALS 125
DISPLAYING OBJECTS | 5 Displaying object components Auto Load New Objects Auto Load Selected Objects
Turn on to automatically update the isolate select panel when you add new objects or change your selection. If turned off, you must use the Load, Add, or Remove Selected Objects options to update the panel. Load Selected Objects Add Selected Objects Remove Selected Objects
If you don’t have auto load on, you can use these options to control the isolate select display. Select items from the isolate panel or another panel and then load, add, or remove them as needed. Note that Load Selected Objects replaces the display with the current selection, while Add Selected Objects adds the current selection to the selections already displaying. Enables you to bookmark an isolated selection. To create a bookmark, choose Show > Isolate Select > Bookmarks > Bookmark Current Objects. Choose the option box if you want to name the bookmark; otherwise, a default name is used.
Bookmarks
To view bookmarked items, choose Show > Isolate Select > Bookmarks > BookmarkName. Choose it again to turn it off and return to the previous view. You can view multiple bookmarks at the same time. Bookmarks are saved with the scene as a set. You can edit or delete these sets using the Relationship Editor. For more information on sets, see Chapter 11, “Sets and Partitions.”
DISPLAYING OBJECT COMPONENTS To help control screen clutter and display performance, you can turn on or off the display of specific object components, on an object-by-object basis. To display an object’s components:
Backfaces
1
Select an object.
2
Select Display > Component Display and select one of the following options: If you selected a polygonal object, turns on or off the display of the object’s backfaces.
Backfaces Lattice Points
If you selected a lattice deformer (an L icon represents a lattice deformer handle), turns on or off the display of the lattice points. For information on lattices, see Using Maya: Character Setup.
USING MAYA: ESSENTIALS 126
No backfaces
DISPLAYING OBJECTS | 5 Displaying geometry components Lattice Shape
Local Rotation Axes
If you selected a lattice deformer, turns on or off the display of the object’s lattice shape. The lattice deformer switches between displaying its lattices and the L icon. For information on lattices, see Using Maya: Character Setup. Turns on or off the display of the object’s local rotation axes. For information on axes, see "Using axes and pivot points" on page 84.
Rotate Pivots
Turns on or off the display of the object’s rotate pivots. For information on pivot points, see "Using axes and pivot points" on page 84.
Scale Pivots
Turns on or off the display of the object’s scale pivots. For information on pivot points, see "Using axes and pivot points" on page 84.
Selection Handles
Turns on or off the display of selection handles on manipulators. For information on manipulator selection handles, see "About manipulator handles" on page 84.
DISPLAYING GEOMETRY COMPONENTS You can turn on or off the display of components specific to object type, including NURBS, polygons, and subdivision surfaces. You can also control the display smoothness of specific types of objects.
Use these submenus to turn on or off the display of components or to control the smoothness of specific types of objects
For details on using these submenus, see the appropriate modeling book: Using Maya: NURBS Modeling, Using Maya: Polygonal Modeling, or Using Maya: Subdivision Surfaces Modeling.
USING MAYA: ESSENTIALS 127
DISPLAYING OBJECTS | 5 Displaying camera and light manipulators
DISPLAYING CAMERA AND LIGHT MANIPULATORS If a camera or light is selected, you can turn its manipulators on or off. For more information on manipulators, see "Using manipulators" on page 83.
Displaying camera manipulator controls Use the options on the Display > Camera/Light Manipulator menu to display manipulator components for the selected camera.
Clipping Panes Pivot
Center of Interest
Cycling Index
Clipping Panes
Center of Interest
Turns on or off the display of the camera’s center of interest manipulator.
Pivot
Turns on or off the display of the camera’s pivot.
Clipping Planes
Turns on or off the display of the camera’s clipping planes.
Cycling Index
Turns on or off the display of the camera’s cycling index. By clicking on this control, you can cycle through the available manipulator controls one at a time for the selected camera.
USING MAYA: ESSENTIALS 128
DISPLAYING OBJECTS | 5 Displaying camera and light manipulators
Displaying light manipulator controls Use the options on the Display > Camera/Light Manipulator menu to display manipulator components for the selected light.
Decay regions (numbered rings)
Pivot Cone Angle Center of Interest Penumbra
Cycling Index
Center of Interest
Turns on or off the display of a light’s center of interest manipulator.
Pivot
Turns on or off the display of a light’s pivot.
Cone Angle
Turns on or off the display of a light’s cone angle.
Penumbra
Turns on or off the display of a light’s Penumbra.
Look through Barn Doors
Barn doors are doors or shutters fitted on the spotlight, which let you create a square spot effect. Shows the view through the spotlight’s barn doors. These manipulators appear when you are in Render View or are looking through the selected light (Panels > Look Through Selected). Decay Regions
Turns on or off the display of a light’s decay regions.
Cycling Index
Turns on or off the display of the light’s cycling index. By clicking on this control, you can cycle through the available manipulator controls for the selected light one at a time. For more information about creating lights and editing light attributes, see Using Maya: Rendering.
USING MAYA: ESSENTIALS 129
DISPLAYING OBJECTS | 5 Working with templates
WORKING WITH TEMPLATES Templates are objects that you can see but cannot select. If you make an object into a template, you cannot accidentally select it or modify it. You could make a background object into a template and use it as a modeling reference (the way a grid is used). To make an object into a template: 1
Select the object.
2
Select Display > Object Display > Template. The object appears as a lighter colored wireframe to indicate it is a template. Any shading is turned off. To return a template to its standard display:
1
Select the object in the Outliner.
2
On the Maya main menu bar, select Display > Object Display > Untemplate.
USING LAYERS There are two types of layers: display layers and render layers. A display layer is a collection of objects that you can quickly select, hide, or template separate from other, distracting objects in the scene. For example, you can add a group of trees to a display layer and hide them so they don’t distract you from viewing another part of the scene. Or you could create a template layer for the house of some creatures you’re modeling so the house is visible as a size reference, but is not selectable. Display layers apply specifically to how objects display in the scene view. For more information, see "Editing display layers" on page 134. A render layer is a collection of objects that you can quickly render in separate passes, giving you more flexibility when the shot is composited. Once you have render layers set up, you can take advantage of the Render Layer/Pass Control settings in the Render Globals. For more information on these settings, see Using Maya: Rendering.Render layers apply specifically to rendering. For more information, see "Editing render layers" on page 137. You can use the Layer Editor to create and manage display and render layers.
USING MAYA: ESSENTIALS 130
DISPLAYING OBJECTS | 5 Using layers
Using the Layer Editor Use the Layer Editor to create, edit, and manage layers and their objects. If the Layer Editor is not displayed, click the Show or hide the Channel Box/Layer Editor button on the Status Line.
Select layer type
Create a new layer button Right-click a layer to open the pop-up menu
Increase or decrease width of the Layer Editor
To open the Layer menu: •
Select a layer in the Layer Editor and then select the Layer menu. or
•
Right-click a layer in the Layer Editor. The pop-up menu appears, which is an abbreviated version of the Layer menu.
Note To edit or work with multiple layers, select them and then select the Layer menu. Please note that if you right-click a layer, your pop-up menu selection will only affect the layer beneath the mouse pointer. Create Layer
Creates a new display layer or render layer, depending on the selection in the pulldown menu, with a default name, for example layer1.
Delete
Deletes the selected layer(s), but not the objects in the layer.
Edit Layer
Opens the Edit Layer window for the selected layer(s) so you can edit layer attributes.
Select Objects
Selects the objects contained in the selected layer(s).
Add Selected Objects
Adds the selected objects to the selected layer. Remove Objects
Removes all objects from the selected layer(s) and assigns them to the default layer. The selected layer(s) becomes empty so you can assign other objects.
Attributes
Opens the Attribute Editor for the selected layer(s). There are some attributes in the Attribute Editor not available through the Edit Layer window. See "Editing display layers" on page 134 and "Editing render layers" on page 137.
Membership
Opens the Relationship Editor for removing or adding objects to layers.
USING MAYA: ESSENTIALS 131
DISPLAYING OBJECTS | 5 Using layers Select All Unused Layers
Selects all layers in the Layer Editor that do not have objects assigned to them. This option is only available from the Layer menu and not the right mouse button pop-up menu. Remove Selected Object(s) from Layers
Removes the selected object(s) from the assigned layer(s). This option is only available from the Layer menu and not the right-mouse button pop-up menu.
Creating and naming layers Follow these instructions to create and optionally name a layer. To create a new layer: 1
Select the desired type of layer from the pull-down menu and then click the Create a new layer button. A new layer is added to the Layer Editor with a default name, for example, layer1.
2
Assign objects to the layer; see the next topic “Assigning objects to layers.”
Note You can turn on or off Make New Layers Current in the Layer Editor’s Options menu. When this setting is on, you can create a new layer and Maya changes it to be the current layer. When this setting is off, the default layer remains the current layer, unless you select a different current layer in the layer attributes. To name a layer: 1
In the Layer Editor, double-click the layer you want to name. The Edit Layer window appears.
2
Type a new name in the Name text box and click Save.
Assigning objects to layers You can add selected objects to a layer, and you can move an object from one layer to another. An object can belong to only one layer at a time. To assign selected objects to a layer: 1
Select the objects you want to assign to the layer.
USING MAYA: ESSENTIALS 132
DISPLAYING OBJECTS | 5 Using layers 2
In the Layer Editor, select the target layer and then select Layers > Add Selected Objects to Current Layer. or Right-click the target layer and select Add Selected Objects from the pop-up menu.
Note If the selected object already belongs to a layer, the object is transferred from its layer to the newly assigned layer.
Assigning objects at creation time If you want objects you create to be automatically assigned to the current layer, turn on the Use Current Layer option. (The current layer is the one shown highlighted in the Layer Editor.) Select Options > Use Current Layer in the Layer Editor.
Removing objects from layers When you remove an object from a layer, it automatically becomes part of the default layer. You cannot remove objects from the default layer. Alternatively you can manage objects in layers using the Relationship Editor (Layers > Membership). For more information, see "Using the Relationship Editor" on page 217. To remove a specific object from a layer: 1
In the workspace or Outliner, select the object(s) you want to remove.
2
In the Layer Editor, select the layer you want to remove the object(s) from.
3
Select Layers > Remove Selected Object(s) from Layers. To remove all objects from a layer:
•
Select the layer(s) from which you want to remove the objects and then select Layers > Remove Objects from Selected Layer(s). or
•
Right-click the desired layer and select Remove Objects.
Deleting layers You can delete a layer that has objects assigned to it or you can delete an unused layer. To delete a layer: 1
Select the layer(s) in the Layer Editor.
2
Select Layer > Delete Selected Layer(s). The layer is removed from the Layer Editor. If the layer had objects assigned to it, they are now assigned to the default layer.
USING MAYA: ESSENTIALS 133
DISPLAYING OBJECTS | 5 Using layers
Note To delete unused layers, select Layer > Select Unused Layers and then select Layer > Delete Selected Layer(s).
Editing layers You can change layer attributes directly in the Layer Editor by clicking on the layer swatches or you can use Edit Layer window. Display layers and render layers have unique attributes. For details on editing display layers, see "Editing display layers" on page 134. For details on editing render layers, see "Editing render layers" on page 137.
Editing display layers There are attributes unique to display layers, including the Display Type and the Visibility. You can change some of the attributes directly in the Layer Editor using the layer’s indicators or you can use the Edit Layer window. There are additional display layer attributes that you can change using only the Attribute Editor. See "To modify display layer attributes using the Attribute Editor:" on page 136.
Note To rename a display layer, see "To name a layer:" on page 132. To edit a display layer directly in the Layer Editor: Click the attribute’s indicator until it displays the desired value. Template Type Invisible Visible Normal Type Reference Type
Click the first indicator to turn visibility on (V) or off (blank). Click the second indicator to change the display type to Template (T), Reference (R), or Normal (blank). Double-click the third indicator to view and select from the Color palette.
Color indicator
To edit a display layer using the Edit Layer window: 1
Select a display layer and select Layers > Edit Selected Layer(s). or Right-click a display layer and select Edit Layer from the pop-up menu. The Edit Layer window appears.
USING MAYA: ESSENTIALS 134
DISPLAYING OBJECTS | 5 Using layers
2
Modify the display layer attributes as desired and click Save.
Name
Optionally, specify a name for the display layer.
Display Type
Specify a type of display layer. Normal
When you create a new layer, it is Normal, meaning objects display normally. This is the default state that allows you to select and snap to objects.
Template
Objects in a template layer are visible, but you cannot select, modify, or snap to them. Objects in a template layer appear in a different color. For details, see "Working with templates" on page 130.
Reference
Like template layers, objects in a reference layer are visible, but you cannot select them or modify them. However you can snap to them.
Note Each scene has a default layer that consists of all objects that have not been assigned to any other layer. When you remove an object from a layer, it becomes a member of the default layer. Visible
Turn on or off the visibility of objects in the layer.
Color
Select a color to assign to all objects in the currently selected layer.
Note If you change the color of objects in a display layer, the objects’ color change appears in the scene only if these objects are part of a Normal layer. Color changes do not affect objects in the default layer, in a Template layer, or in a Reference layer.
USING MAYA: ESSENTIALS 135
DISPLAYING OBJECTS | 5 Using layers
Normal objects
Template objects
To modify display layer attributes using the Attribute Editor: 1
Select a layer in the Layer Editor and then select Layers > Layer Attributes. or Right-click a layer in the Layer Editor and select Attributes from the pop-up menu. The Attribute Editor opens.
2 Display Layer Enable Overrides Display Type
Level of Detail
Modify the layer attributes as desired and click Close. Type the name of the layer. Turn this option off to disable the effects of the layer. Objects in the layer will appear and behave as though they do not belong to the layer. Select how the layer will display. Normal
Objects in the layer display normally, according to the settings for the layer. You can select objects in the layer and snap to them.
Template
Objects in the layer become templates. You can see template objects in the workspace, but you cannot select them, nor can you snap them.
Reference
You can snap to objects in the layer, but you cannot select them or modify them.
Select the level of display detail for layer objects: Full
Displays full detail for layer objects.
Bounding Box
Shows objects as boxes that represent their bounding volumes. Bounding boxes speed up Maya operations making a significant difference for complex models.
Shading
Turn on to make layer objects appear shaded when in shaded display.
Texturing
Turn on to show textures on layer objects when in shaded display.
Playback
Turn on to animate layer objects during playback. If you have several characters in a scene and want to look at each character’s animation separately, you can place each character in its own layer and play back the animation of each character as desired.
Visible
Turn on to make the objects in the layer visible.
USING MAYA: ESSENTIALS 136
DISPLAYING OBJECTS | 5 Using layers Color
Select the color of all objects belonging to the layer.
Number
This is the number assigned to the layer.
Merging display layers when importing files To facilitate the merging of layers when you read in files, select Window > Settings/ Preferences > Preferences, click the Files/Projects category, and in the Display Layer section select one of the following options for File Import Merge: None
All layers read in will be put in a new layer, and renumbered and renamed, if necessary to preserve uniqueness.
By Number
All layers read in that have the same index number as an existing layer will be merged with that layer rather than creating a new layer.
By Name
All layers read in that have the same name as an existing layer will be merged with that layer rather than creating a new layer.
Editing render layers There are attributes unique to render layers, including the Renderable attribute. You can change this attribute directly in the Layer Editor or you can use the Edit Layer window. There are additional render layer attributes that you can change using only the Attribute Editor. These attributes are also found in the Render Layer/Pass Control settings in the Render Globals. See Using Maya: Rendering.
Note To rename a render layer, see "To name a layer:" on page 132.
Note You can’t change the color of render layer objects. To edit a render layer directly in the Layer Editor: Click the Renderable attribute indicator until it displays the desired value. The Renderable indicator is marked R if Renderable is on and blank if it’s off.
Renderable is on Renderable is off
To edit a render layer using the Edit Layer window: 1
Select a render layer and select Layers > Edit Selected Layer(s).
USING MAYA: ESSENTIALS 137
DISPLAYING OBJECTS | 5 Using layers or Right-click a render layer and select Edit Layer from the pop-up menu. The Edit Layer window appears.
2
Modify the render layer attributes as desired and click Save.
Name
Optionally, specify a name for the render layer.
Renderable
Controls whether the objects in the layer actually render. This command can be useful for performing test renders, but the main controls for rendering layers are in the Render Layer/Pass Control settings in the Render Globals. For more information on these settings, see Using Maya: Rendering. To modify render layer attributes using the Attribute Editor: 1
Select a layer in the Layer Editor and then select Layers > Layer Attributes. or Right-click a layer in the Layer Editor and select Attributes from the pop-up menu. The Attribute Editor opens.
2
Modify the layer attributes as desired and click Close. For information on these attributes, see Render Layer Options in Using Maya: Rendering.
USING MAYA: ESSENTIALS 138
6
MODELING AIDS Maya has many features that help you build and position objects. This section describes some of those features and tells how to use them. For a comprehensive guide to modeling features, see Using Maya: NURBS Modeling, Using Maya: Polygonal Modeling, and Using Maya: Subdivision Surfaces Modeling.
SNAPPING The snap options let you control an object or component’s position by attaching it to a grid, point, curve, or view plane. As you draw, rotate, resize, or drag the object, it snaps to the grid, point, curve, or view plane.
Snapping icons
Sn
a Sn p to a g Sn p to rid s a Sn p t cur v o ap p es to oin vi ts ew pl a
ne
s
Four icons in the Status Line control snap mode as you move or rotate objects and create curves:
Snap to grids
Snaps a vertex (CV or polygonal vertex) or pivot point to a grid corner. If you select Snap to grids before you create a curve, its vertices snap to the grid corners. For more information on CVs, see Using Maya: NURBS Modeling.
Snap to curves
Snaps a vertex (CV or polygonal vertex) or pivot point to a curve or curve on surface.
Snap to points
Snaps a vertex (CV or polygonal vertex) or pivot point to a point.
Snap to view planes
Snaps a vertex (CV or polygonal vertex) or pivot point to a view plane.
USING MAYA: ESSENTIALS 139
MODELING AIDS | 6 Snapping To snap an object or object component to a grid, curve, point, or view plane: 1
To snap to a grid, select Display > Grid to display a grid in your workspace. or To snap to a curve, create a curve. or To snap to a point, create an object with several CVs or vertices (for example, a curve). or To snap to a view plane, select a view (perspective, top, front, or side).
2
Click the appropriate snap icon in the Status Line.
3
Select the object or object component you want to snap to the grid, curve, point, or view plane. If you are snapping an object component (for example, a vertex, edit point, hull, or curve on surface), use the Select by component type icon on the Status Line to select the component. For information on selecting by component, see "Limiting selection by component type" on page 147. Note that when you select several components, each component snaps to the same point.
4
Click the Move Tool icon. When you select several components, the move manipulator is placed at the center of the selection’s bounding box.
5
If you are snapping to a point, right-click on the object with the vertices you are snapping to and select Control Vertex or Vertex, to display the vertices.
6
Use the middle mouse button to click and drag anywhere on the grid, curve, points, or view plane. The object snaps to the grid, curve, points, or view plane. You can now move the object along the grid, curve, point, or view plane.
Snapping hotkeys The hotkeys for snapping are: •
x for grid snap
•
c for curve snap
•
v for point snap
To use the grid snap hotkey: 1
Select the object or component you want to snap and click the Move Tool icon.
2
Press and hold down the x key while click-dragging on the grid with the middle mouse button.
USING MAYA: ESSENTIALS 140
MODELING AIDS | 6 Snapping To use the curve snap hotkey: 1
Select the object or component you want to snap and click the Move Tool icon.
2
Press and hold down the c key while click-dragging on the curve you want to snap to with the middle mouse button. To use the point snap hotkey:
1
Select the object or component you want to snap and select the Move Tool.
2
Right-click the object with vertices (CVs or polygonal) that you want to snap to (for example, a curve), and select Control Vertex or Vertex to display the vertices.
3
Press and hold down the v key and click-drag the selected object with the right mouse button to the point you want to snap to.
Snapping along a constraint axis You can constrain object positioning along a particular axis. If you turn on snapping and drag a Move Tool manipulator arrow (as opposed to dragging the pivot point), Maya uses a combination of the snap and the axis constraint. If you are using grid snap, Maya snaps to the nearest grid line along the specified axis. If you are using point snap and grab the end of the arrow, the manipulator has an initial jump because the center of the manipulator (not the tip) follows the mouse position. It is useful to snap to an axis when you want to align a group of vertices to a particular Y position.
Tip To minimize the initial jump, click closer to (but not on) the center of the manipulator. This is especially important if you are using a large arrow on the manipulator. To change the size of the manipulator arrows, press the = and - keys.
Snapping to a curve on surface or isoparm curve A curve on surface is a curve you have either plotted directly onto a live surface in UV parameter space, rather than a curve in world space or projected onto a surface as a result of a project or intersect function. Curves on surfaces are often used for trimming. You can use Snap to curves to snap to an isoparm curve or a curve on surface. This is useful if you want to snap a pivot to the edge of a surface. But if you are moving vertices on a surface (with curve snap on) you can accidentally snap to a curve on surface.
USING MAYA: ESSENTIALS 141
MODELING AIDS | 6 Snapping
Tip To avoid unintentional snapping, use the c hotkey instead of the Snap to curves icon in the Status Line. See "To use the curve snap hotkey:" on page 141.
Snapping aligning objects Instead of using the Move and Rotate Tools, you can easily move an object to a specific point by snap aligning the object. You can snap a point directly to any other point (where a point can be a surface point, curve intersection point, vertex, locator, etc.). 2 Select destination point
3 Snap Align Objects Point to Point
1 Select snap point
If you select two points on each object, the points define an axis snap, which means the object will be rotated as well as translated. This technique is useful for orienting one object with another along some arbitrary axis.
Tip Use the shift key to select more than one point or object.
USING MAYA: ESSENTIALS 142
MODELING AIDS | 6 Snapping
3
4 1
2
1 Select snap axis
3-4 Snap Align Objects Two Points to Two Points (e.g. locators)
2 Select destination axis
If you select three points on each object, you can specify exactly how the objects should be aligned against eachother. For example, you could be modeling a house and a roof and need to join the two parts together. In addition, you can snap align a selection of objects to an axis or axes in 3D space using the Align Objects Options window. See "To snap align objects:" on page 144. To snap a point to another point: 1
Select the point that you want to snap to another point.
2
Shift-click to select the point you want to snap to the first point.
3
Select Modify > Snap Align Objects > Point to Point. The first selected point snaps to the second selected point. Note that the whole object is translated, not just the select point. For example, if you used CVs as points, the selected CV is not moved alone, but the entire surface is.
Note If the objects are part of a group(s), then you can control the alignment by specifying the Object, Parent, or Grandparent option in the Options window. To snap two points to two points: 1
Select the first point on the snap axis.
2
Shift-click to select the second point on the snap axis. This defines the snap axis.
3
Shift-click to select the first point on the destination axis. The first point you selected in step 1 will snap to this point.
4
Shift-click to select the second point to define the destination axis. This defines the destination axis.
USING MAYA: ESSENTIALS 143
MODELING AIDS | 6 Snapping 5
Select Modify > Snap Align Objects > Two Points to Two Points. The first selected point snaps to the third selected point, and the axis defined in steps 1 and 2 lines up with the axis defined in steps 3 and 4. To snap three points to three points:
1
Select three points on an object. Use shift-click to select the second and third points.
2
Shift-click to select three points on the destination object. Select the points on the destination object in the order you want the snap to occur. The first point should correspond to the first point selected on the other object, and so on.
3
Select Modify > Snap Align Objects > 3 Points to 3 Points. To snap align objects:
Align Mode
Align In
Align to
1
Select the objects and then select Modify > Snap Align Objects > Align Objects ❐. The Align Objects Options window appears.
2
Specify the following options and then click Align.
You can select from one of five different alignment modes according to the objects’ bounding boxes. Min
Aligns selected objects according to the minimum value of the objects’ bounding boxes in the chosen axes.
Mid
Aligns selected objects according to the middle value of the objects’ bounding boxes in the chosen axes.
Max
Aligns selected objects according to the maximum value of the objects’ bounding boxes in the chosen axes.
Dist
Aligns selected objects so the space between the their bounding boxes is evenly distributed in the chosen axes.
Stack
Aligns selected objects so their bounding boxes are positioned adjacently in the chosen axes.
You can select an axis or multiple axes in which to align the selected objects. World X
Sets the world X axis as the alignment axis.
World Y
Sets the world Yaxis as the alignment axis.
World Z
Sets the world Z axis as the alignment axis.
You can use this pull-down menu to specify how to align objects in the Min, Mid, and Max modes. This pull-down menu does not apply to the Dist (Distribute) or Stack modes.
USING MAYA: ESSENTIALS 144
MODELING AIDS | 6 Snapping Selection Average Last Selected Object
Uses the average minimum, middle, or maximum value of the objects’ bounding boxes as the alignment reference. Uses the minimum, middle, or maximum value of the bounding box of the last selected object as the alignment reference.
The following are examples of using the Align Objects options. Objects before aligning Max, World Y, Selection Average
Min, World X, Last Selected Object
Mid, World Y, Last Selected Object Stack, World Y
USING MAYA: ESSENTIALS 145
MODELING AIDS | 6 Limiting selections
LIMITING SELECTIONS Because Maya works on a selection-based mode, picking items is critical to modeling. If you forget what needs to be picked for a tool or an action, hold and drag the mouse button over the menu item. The Help Line displays the type of selection required for the current item. You can limit the items you can select in the workspace to specific types of objects, components, or hierarchy elements. By limiting object selection, you can avoid unintentionally selecting a nearby object. Limiting object selection is also known as creating a pick mask or selection mask.
Limiting selection by object type You can limit selection to various types of objects, such as NURBS curves. To select only a specific type of object: 1
Turn on the Select by object type icon.
Select by object type
2
Click the adjacent icon to display the Set the object selection mask pull-down menu and select All Objects Off.
3
Turn on one of the following icons: s ns ou tio ics ing ane s a s le s es ce m m er ll nd oint urv urfa efor yna end isce a H J C S D D R M
To further limit the items you can select, click the right mouse button on the icon and turn off the appropriate checkboxes. 4
Select the object. You can only select the type of object you have specified.
5
To return to the default selection mask, click the left-most icon in the Status Line to display the Set the selection mask pull-down menu and select Initial Default. Example Suppose you’ve created a tubular object and want to select the joint chain within the object.
USING MAYA: ESSENTIALS 146
MODELING AIDS | 6 Limiting selections
Joint
1
Turn on the Select by object type icon.
2
Click the
3
Turn on the Joints icon.
4
Click the object’s root joint. The root and its children become the selected objects.
5
To return to Maya’s default selection mask, click the left-most Line and select Initial Default.
icon to the right and select All Objects Off.
icon in the Status
Limiting selection by component type You can limit your selection to a specific type of object component, such as polygonal vertices.
Using the selection mask to select components To select only a type of component: 1
Select the object that has the components you want to select.
2
Turn on the Select by component type icon. f
Select by component type
4
Turn on one of the following icons:
in Po
lls
Hu
Pi
ce
s
et er Fa
Po in Pa ts ra m
s
ne
Li
vo Ha ts n Lo dle an ca s d lR Im o ag tat e ion Pl A an xe es s
Click the adjacent icon to display the Set the component selection mask pull-down menu and select All Components Off.
ts
3
USING MAYA: ESSENTIALS 147
MODELING AIDS | 6 Limiting selections To further limit the items you can select, click the right mouse button on the icon and turn off the appropriate checkboxes. 5
Select the component. If you didn’t previously select the object containing the component, the object’s components will be displayed but not selected. Select the component again. Maya selects only the specified type of component.
6
To return to Maya’s default selection mask, click the left-most icon in the Status Line to display the Set the selection mask pull-down menu and select Initial Default.
Using the Paint Selection Tool to paint-select components You can select, unselect, and toggle the selection of vertices by painting over them with the Paint Selection Tool. You can also use the Paint Selection Tool to select, unselect, and toggle the selection of faces and edges on polygons and subdivision surfaces. Painting gives you much greater control when selecting components and enables you to work much faster. The vertices in the following illustration were selected in seconds with a single brush stroke.
You can apply global selections to the entire selected surface. With the click of a button, you can select, unselect, or toggle the selection all the components on a surface. To select, unselect, or toggle the selection of vertices: 1
Select the surface.
2
Select the Paint Selection Tool and open the Tool Settings editor (Edit > Paint Selection Tool ❐). Maya switches to component mode automatically.
3
In the Paint Operation section, select a paint operation (Select, Unselect, or Toggle) and then drag the brush across the surface. or To select, unselect, or toggle the selection of all the vertices on the selected surface, click Select All, Unselect All, or Toggle All, respectively. For details, see "Paint Operations" on page 149. To select polygon or subdivision surface faces:
1
Select the surface.
2
Select the Paint Selection Tool and open the Tool Settings editor (Edit > Paint Selection Tool ❐).
3
Right-click the surface and select Face from the marking menu,
USING MAYA: ESSENTIALS 148
MODELING AIDS | 6 Limiting selections 4
In the Paint Operation section, select a paint operation (Select, Unselect, or Toggle) and then drag the brush across the surface. or To select, unselect, or toggle the selection of all the faces on the selected surface, click Select All, Unselect All, or Toggle All, respectively. For details, see "Paint Operations" on page 149. To select polygon or subdivision surface edges:
1
Select the surface.
2
Select the Paint Selection Tool and open the Tool Settings editor (Edit > Paint Selection Tool ❐).
3
Right-click the surface and select Edge from the marking menu,
4
In the Paint Operation section, select a paint operation (Select, Unselect, or Toggle) and then drag the brush across the surface. or To select, unselect, or toggle the selection of all the edges on the selected surface, click Select All, Unselect All, or Toggle All, respectively. For details, see "Paint Operations" on page 149.
Paint Selection Tool settings To modify Paint Selection Tool settings, select the Paint Selection Tool and open the Tool Settings editor (Edit > Paint Selection Tool ❐). Maya switches to component mode automatically. Paint Operations settings are described below. For details on Brush, Stroke, Stylus Pressure, Attribute Maps, and Display settings, see “Paint Tool settings (new architecture)” in Using Maya: Painting.
Tip You can define hotkey combinations to change most of the settings without opening the Tool Settings editor. For details on setting hotkey combinations, see “Defining Artisan hotkeys” in Using Maya: Painting. Paint Operations Select a paint operation and paint, or click a paint operation button to perform the operation. Paint Operation
Select one of the following paint operations. Select
Selects painted components.
Unselect
Unselects selected painted components.
Toggle
Unselects selected components and selects unselected components.
USING MAYA: ESSENTIALS 149
MODELING AIDS | 6 Limiting selections
Select
Unselect
Toggle
Tips •
To unselect selected components while Select is chosen, press the Ctrl key and paint over them. Similarly, when Unselect is chosen, press the Ctrl key and paint to select unselected components.
•
Press u + left mouse button and select the paint operation from the marking menu instead of the from the Tool Settings editor.
Add to Current Selection
By default, this option is turned on so that each stroke adds to the previous selection. This means you do not have to press the Shift key when you make a brush stroke to select, unselect, or toggle the selection of more components. If you want each stroke to override the previous one, turn Add to Current Selection off. Select All
Selects all components on the selected surface(s).
Unselect All
Unselects all selected components on the selected surface(s).
Toggle All
Selects all unselected components and unselects all selected components on the selected surface(s).
Before selection
USING MAYA: ESSENTIALS 150
Select All
Unselect All
Toggle All
MODELING AIDS | 6 Limiting selections
Limiting selection to hierarchy items You can limit selection to the following hierarchy items: •
root – a heirarchy’s top object
•
leaf– descendent object For information about hierarchies, see "Understanding scene hierarchy terminology" on page 265. To select only a hierarchy root or leaf:
1
Turn on the Select by hierarchy and combinations icon.
Select by hierarchy and combinations
2
Turn on the Root or Leaf icon.
Leaf Root
or Click the adjacent icon to display the Set the hierarchy selection mask pull-down menu and select Root or Leaf. 3
Select the object. Notice you can select only a root or leaf object.
4
To return to Maya’s default selection mask, click the left-most icon in the Status Line to display the Set the selection mask pull-down menu and select Initial Default.
Limiting selection to template objects You can limit your selections to template objects. To select only a template object: 1
Turn on the Select by hierarchy and combinations icon.
Select by hierarchy and combinations
2
Turn on the Template icon. Template
or Click the adjacent icon to display the Set the hierarchy selection mask pull-down menu and select Template. 3
Select the object. Maya selects only a template object.
4
To return to Maya’s default selection mask, click the left-most icon in the Status Line to display the Set the selection mask pull-down menu and select Initial Default.
USING MAYA: ESSENTIALS 151
MODELING AIDS | 6 Limiting selections
Limiting selection by task You can limit your selection to the objects or components that pertain to types of Maya tasks. For instance, you can limit selection to objects and components relevant to dynamics tasks. To limit selection by Maya task: 1
If the Set the selection mask pull-down menu selection set icons on the Status Line.
icon isn’t showing, expand the
Click the bar to expand
2
Click the icon to display the Set the selection mask pull-down menu and select one of these categories:
•
Animation
•
Polygons
•
NURBS
•
Deform
•
Dynamics
•
Rendering This creates a selection mask that limits selection to the objects and components in the chosen category.
3
Do one of the following:
•
To select an object in the chosen category, drag a selection box around the object.
•
To select a component in the chosen category, click the component directly. You usually need to display components before you can select them. For example, to select CVs, first select Display > NURBS Components > CVs to display them and the select the desired CVs. If you drag the selection box around any of the CVs, you select the CVs rather than the object. To use the default Maya selection limitations: Click the Set the selection mask pull-down menu Initial Default.
icon in the Status Line and select
To allow selection of all objects: Click the Set the selection mask pull-down menu All Objects.
USING MAYA: ESSENTIALS 152
icon in the Status Line and select
MODELING AIDS | 6 Freezing and resetting transformations
Tip You can customize the priority of object or component selection for situations where you drag a selection box around multiple objects or components. To prioritize object selection: 1
Select Window > Settings/Preferences > Preferences and choose the Selection category.
2
Select Custom from the PreSets pull-down menu.
3
Select an item in the Priority list.
4
Enter a priority number for the item in the data box. Higher numbers have higher priority.
5
Click Save when done.
Moving selection limitations to the shelf You can put your selection limitation choices on a shelf for future use. To move selection limitations to a shelf: 1
Select a shelf tab.
2
Turn on the object or component selection limitation icons.
3
Right-click individual icons to turn on or off item checkboxes.
4
Click the adjacent icon to display the Set the (type) selection mask pull-down menu and select Save to Shelf. An icon labeled MEL appears on the shelf. If you click this icon, the selection limitations take effect and the Status Line icons show the selection limitations. You can change the MEL icon, as described in "Changing shelf icons" on page 345. If you want to add an icon label, see "Setting Shelf options" on page 348.
FREEZING AND RESETTING TRANSFORMATIONS Before animating a model you just created, you may want to freeze its transformation. Freezing sets the existing translation, rotation, or scale for selected objects to be the initial state. The result is that transform values change to zero (or one for scale), but the object itself remains in place. You can also reset an object’s transformations at any time. The reset command transforms the object back to the translation, rotation, and scale it was when created or last frozen. You can apply these operations separately for translation, rotation, or scale. To freeze or reset an object: 1
Select one or more objects that you have moved, rotated, or resized.
2
Choose Modify > Freeze (or Reset) Transformations ❒.
USING MAYA: ESSENTIALS 153
MODELING AIDS | 6 Locking transform tools and manipulators 3
In the Options window, turn on or off Translate, Rotate, or Scale, as needed.
4
Click Appy and then Close.
LOCKING TRANSFORM TOOLS AND MANIPULATORS If you are going to be using a single tool on an object for a long time, you can lock the transform tools—Move, Rotate, Scale—and the Show Manipulator Tools. It is also useful to lock tools when you use a stylus input device. After you lock a tool, you can’t use the left mouse button to select objects in the workspace. The left mouse button works the same way as the middle mouse button does during normal use of the Move, Rotate, Scale, or Manipulator Tools. If you need to select objects after locking a tool, use the Outliner or Hypergraph. To lock the Move, Rotate, Scale, or Show Manipulator Tool: 1
Select the object.
2
Select the tool.
3
Turn on the Lock current selection
icon in the Status Line.
To unlock the tool and return to normal mouse usage, turn off the icon.
USING CONSTRUCTION HISTORY When you create an object surface using deformers or certain modeling tools, Maya keeps a construction history for the object. A construction history is a record of the options, geometry, and modeling actions that you used to create the object. You can use the construction history to modify an object by making simple changes to the original elements of the history. You don’t have to repeat all the steps that went into the object’s creation. Construction history adds complexity to a scene and therefore slows Maya operation. For this reason you might decide to turn it off for some scenes. You can turn off the creation of construction history for all subsequent modeling activities. If you do this, you won’t be able to tweak history options and geometry for object surfaces you create afterwards. Alternatively, you can delete a single object’s construction history.
Note Construction history and future operations are synonomous with construction inputs and outputs. To turn off construction history for all objects: Turn off the Construction History
USING MAYA: ESSENTIALS 154
icon in the Status Line.
MODELING AIDS | 6 Using construction history
Tip When you attach curves or animate CVs, turn construction history off or you may get unexpected results. To delete an object’s construction history: 1
Select the object.
2
Select Edit > Delete by Type > History.
Tip If you animate CVs on an object that was created with history, do not delete the object’s history. The CV animation may not be correct and unexpected results will occur. To use the construction history to modify an object: 1
Select the object.
2
Click either the construction inputs or outputs icon on the Status Line and select the desired input or output from the pop-up menu.
3
Modify the inputs in the Channel Box or in the Attribute Editor. To view the construction history list window:
Node State
Filter
1
Select the object.
2
Click either the construction inputs or outputs icon on the Status Line and select Complete List from the pop-up menu. The List of History/Future Operations window appears for the selected object.
3
Specify the options and then click Close. Select a node state from the pull-down menu. Normal
Displays the object/component normally.
Blocking
Hides the object/component and disables it so it’s not included in animation or rendering.
Specify a filter option from the pull-down menu. List
The node is listed in the List of History/Future Operations window.
Include
The node is not listed in the List of History/Future Operations window.
Tip In the List of History/Future Operations window, in some cases you may select and drag an item using the middle mouse button to rearrange the item’s position in the list. You can use this procedure for deformers, but not modeling operations.
USING MAYA: ESSENTIALS 155
MODELING AIDS | 6 Making objects live
Tip Select an object and then press A and hold down the left mouse button on the object to open a marking menu of history and future options. Examples of using construction history: •
If you create two curves with a loft between them, you can modify the loft inputs easily, move curves on CVs, and rebuild more or less points on it.
•
Use the List of History/Future Operations window to block Global Stitch when animating, as it slows Maya down, and then turn it back on (Normal Node State) for rendering.
MAKING OBJECTS LIVE When you “make an object live,” you can use its surface as a construction aid. You can make NURBS surfaces, poly meshes, and construction planes into live objects. Making a NURBS surface live is one way to create a curve on surface.
Note Only one object can be live at a time. The live object displays in a special green color in wireframe mode to indicate its status. To make an object live: 1
Select the object.
2
Select Modify > Make Live or click the Make Live
3
To turn off a live object, select Modify > Make Not Live or click the Make Live icon again.
icon on the Status Line.
To create a curve on surface by placing it onto a live surface: 1
Select the surface.
2
Select Modify > Make Live or click the Make Live icon on the Status Line.
3
Use any curve creation tool to draw the curve directly onto the surface.
USING MAYA: ESSENTIALS 156
MODELING AIDS | 6 Creating levels of detail
The sphere is live. When drawing the EP curve, it snaps to the sphere’s surface.
The sphere is not live. When drawing the EP curve, it does not snap to the sphere’s surface.
Notes All creation tools respect a live surface. Actions do not. You can use Make Live to place particles on an object's surface or on joints and polygons. When an object is live and the Move Tool is the current tool, the active object snaps to the live object.
CREATING LEVELS OF DETAIL You can group geometry into a special Level of Detail group, which means that depending on how far the group is from the camera, a different child, or resolution, of the group is displayed. An object can have any number of levels of detail, but typically 3 to 5 levels are used in the creation of a game. Level 1 is drawn when the object is closest to the camera and it typically has the most geometry. Level N is drawn when the object is far away from the camera and has the least amount of geometry. This level can be empty. Creating levels of detail can involve one or more artists/programmers, and two tasks. The first task is to create the models for each level. The second task is to set up the order of the models (usually by complexity) and the distances at which each level is drawn.
USING MAYA: ESSENTIALS 157
MODELING AIDS | 6 Creating levels of detail
Notes •
Setting up level of detail will not work if you specify less than two levels of detail.
•
Different levels can come from different sets, layers, and can be reference objects.
•
Level of Detail only supports discrete levels of detail. For example, there is no blending between levels.
•
You can use NURBS, polygons, or subdivision surfaces to create the different levels, and each level can use a different geometry type if you want.
To create levels of detail: 1
Create models to represent different levels of detail, in order of geometric complexity. The models can be in different layers or sets, or they can be referenced objects.
2
Position the models together in a modeling view at approximately the distance that you want the middle object to appear in the level of detail. Positioning the objects together helps you keep track of them in cases where you have multiple groups and many models in the same scene.
3
Look through the camera to which you want to associate the level of detail group.
4
Do one of the following:
•
Select the models in the order you want them to appear in the level of detail group (either lowest to highest or highest to lowest), then select Edit > Level of Detail > Group.
•
Select a camera and the models in the order you want them to appear in the level of detail group, then select Edit Level of Detail > Group. The selected camera is used in the level of detail group. The objects are grouped under a new node, called lodGroup#, which is linked to the camera through which you are looking.
5
Preview the levels by zooming in and out.
Note Only one of the levels is visible at a time. The levels switch as you zoom in and out.
USING MAYA: ESSENTIALS 158
MODELING AIDS | 6 Creating levels of detail
Changing the Threshold distances You can change the distances at which the levels are switched using the Channel Box. To change a Threshold distance: 1
Select the level of detail group node in the Hypergraph. Its level of detail attributes are displayed in the Channel Box.
2
Edit the Threshold value for the object whose distance you want to change, and press Enter.
Re-ordering the levels You can re-order the levels after you create a level of detail group. To re-order the levels in the Outliner: In the Outliner, use the middle mouse button to drag the object you want to move into its new position within the group. This is the easiest way to re-order the levels. To re-order the levels in the Hypergraph: 1
In the Hypergraph, use the middle mouse button to remove the object you want to re-order from the group. The other objects in the group move up the group hierarchy.
2
Use the middle mouse button to drag the removed object onto the lodGroup node. The object is added to the bottom of the lodGroup’s hierarchy.
Tip You can also re-order a group by selecting Edit > Level of Detail > Ungroup. Re-order the objects and create a new group.
Adding and editing levels To add a new level: 1
Create a new object to add to the level of detail group.
2
Do one of the following:
•
In the Hypergraph, use the middle mouse button to drag the new object onto the lodGroup node.
•
In the Outliner, use the middle mouse button to drag the new object onto the group. The new object is added to the bottom of the lodGroup’s hierarchy.
Tip You can also re-order a group by selecting Edit > Level of Detail > Ungroup. Re-order the objects and create a new group.
USING MAYA: ESSENTIALS 159
MODELING AIDS | 6 Creating levels of detail
Previewing more than one object at the same time You can preview different objects at the same time to compare them. To view more than one object: 1
In the Hypergraph, select the level of detail group node. The node’s attributes are displayed in the Channel Box. Each Display Level has three possible settings: uselod, show, and hide.
2
Use the left mouse button to click on one of the Display Level’s uselod text. A dropdown menu with the three options is displayed.
3
Select one of the options. You can show or hide any combination of objects.
Tip Reset the Display Levels to uselod to return to the regular level of detail behavior.
Notes about orthographic cameras and level of detail Level of Detail displays one child of a level of detail group, depending on the group’s distance to a camera. For perspective cameras, this means measuring the distance between the camera position to the center of the bounding box of the group. For orthographic cameras, the distance is measured differently. This is because zooming, panning, and dollying in an orthographic view does not change the camera position, but instead changes the camera’s orthographic width. So the distance is measured as: distance = (default camera distance) * (camera’s orthographic width)/(default orthographic width)
Substituting Maya’s default values in this equation results in the following: distance = 3.333 * (camera’s orthographic width)
USING MAYA: ESSENTIALS 160
7
MANAGING FILES AND PROJECTS Maya includes many features to help you manage your files and projects. This chapter describes how to create scenes, open and save scenes, import and export files, how to create and edit projects, and what files formats are supported by Maya.
CREATING A NEW SCENE When you create a new scene file, the current scene file is closed and a new, empty scene appears. To create a new scene: 1
Select File > New Scene. If you haven’t saved the current scene, a warning dialog box appears.
2
To save the contents of the current scene file, click Yes. To discard the present scene file, click No.
OPENING A SCENE When you open a scene, Maya tries to read the scene’s contents through a filter based on currently supported file formats. For a list of file types you can open in Maya, see "Supported file formats" on page 174. To open a scene: 1
Select File > Open Scene. Maya displays a file browser. When you start up Maya, the file browser automatically goes to the scenes directory of your current project. For information on setting projects, see "Creating projects" on page 171.
USING MAYA: ESSENTIALS 161
MANAGING FILES AND PROJECTS | 7 Opening a scene
2
To display all the file types you can open, select Best Guess from the Files of type pull-down menu (Windows only). or To display specific file types, select the file type from the Files of type pull-down menu (Windows only).
3
Navigate to the file you want to open and click Open or double-click the file.
Note Maya lists the files you have opened in the current Maya session on the Recent Files submenu. You can open these files at any time during the session by selecting File > Recent Files > filename.
Setting Open options The Open Options window lets you set general options and options that are specific to file types. To set Open options: 1
Select File > Open Scene ❐. or
•
Select File > Open Scene and click the Options button in the Open window (Windows).
•
Select File > Open Scene and select Options > Options in the Open window (UNIX). The Open Options window opens.
2
In the Open Options window, you can set the options listed below and then click Open to open a file
USING MAYA: ESSENTIALS 162
MANAGING FILES AND PROJECTS | 7 Opening a scene General options File Type
Select the file format you want to use as a default for the next time you open a file. If you have a project set up, when you open a scene, the browser points to the directory containing files of that type. On Windows, it also sets the filter to display only files of the selected type. See "Creating projects" on page 171 for information on setting up projects. For example, if you set File Type to DXF, when you open a scene, the Open window displays the contents of CurrentProject/DXF. On Windows, it also sets your filter type to DXF. Depending on the File Type you select, various File Type Specific Options are displayed.
Execute Script Nodes
Script nodes contain Mel scripts in mayaAscii or mayaBinary files. You can designate a script node to execute its script when the node is read from a file, or before or after rendering a frame. You can create and edit the script nodes using the Expression Editor. See the chapter “Using Script Nodes” in the Using Maya: MEL book for information on creating and editing script nodes. User interface configuration information is stored inside the Maya scene file as an attribute on a script node. If you disable the Execute Script Nodes option, the UI script nodes are not executed. However, we recommend disabling script node execution only if you have an error in your script. Load Deferred References
Turn on the Load Deferred References option to load referenced files that may have been unloaded. When you unload a reference, Maya removes the reference contents from the scene but “remembers” how the reference was connected into the scene. If you create a scene with references, unload some of them, and then save the scene, you have created some deferred references. If you turn on the Load Deferred References option, the deferred references are loaded when you open the scene. If you turn off Load Deferred References, the deferred references are not loaded when you open the scene. Turn on Load Deferred References when rendering a scene in which the animators were working with only part of the scene loaded when they saved the scene. mayaAscii, MayaBinary, and MEL. File Type Specific Options Use Verbose Names
Displays the full names of node attributes in the file. For example, if you select the Use Verbose Names option, attribute names are listed as, setAttr.translate 0 0 0 when you open the Maya ASCII file in a text editor. If you turn off the Use Verbose Names option, attribute names are listed as setAttr .t 0 0 0.
USING MAYA: ESSENTIALS 163
MANAGING FILES AND PROJECTS | 7 Opening a scene OBJ File Type Specific Options Create Multiple Objects
Specifies how shapes are created in OBJ files. Select True to create individual shapes based on grouping information specified in the OBJ file. Select False to create one shape for the entire file, with object sets corresponding to each of the specified groups. You cannot have overlapping groups. If you do, Maya informs you that overlapping groups exist, and re-reads the file as if the option were set to False. Sound (audio) File Type Specific Options Sound File Offset
Specifies the time the sound should start playing. For example, suppose you created an animation of a bird walking a tightrope, and you wanted the sound file to play after the bird reached the end of the rope. If you knew that the bird reached the end of the tightrope at time 108, you would specify a sound file offset of 108. Move files You must import move files (see "Importing move files" on page 177). Anim files You must import anim files ("Importing animation curves" on page 179). Illustrator and EPS files You must import Illustrator and EPS files (see "Importing Adobe Illustrator® and EPS files" on page 178).
USING MAYA: ESSENTIALS 164
MANAGING FILES AND PROJECTS | 7 Saving files
SAVING FILES You use Save Scene and Save Scene As to save the current scene, save the current scene using a new name, or convert a file from Maya ASCII to Maya Binary and vice versa. To convert a file into formats other than Maya ASCII and Maya Binary, use the Export option ("Exporting files" on page 185). Before you save, we recommend that you optimize scene size for improved performance, memory use, and reduced use of disk space (File > Optimize > Scene Size ❐). For details, see "Optimizing scene size" on page 168. To save a scene file: 1
Select File > Save Scene. If you have not specified a name for the scene, the Save window opens:
2
Select mayaAscii or mayaBinary from the Write As pull-down menu (UNIX). or Select mayaAscii or mayaBinary from the Files of type pull-down menu (Windows). This selects the format for your scene.
•
Maya Binary files are usually smaller and load faster than Maya ASCII files.
•
Maya ASCII files have the same information as Maya Binary files, and you can edit them using a text editor. Both types of files work with the UNIX operating system and the Windows operating system.
3
Type the name of the new file. Maya does not add a file extension by default. If you want Maya to add the .ma or .mb extension, change the Default File Extensions option (see page 167).
4
Click Save. Maya saves the contents of the file under the specified name.
Note If your scene includes referenced files, the Save Scene and Save Scene As options save your current working file. The names of files you’ve imported by reference do not change. To rename a scene file: 1
Select File > Save Scene As. The Save window opens.
2
Type the new name of the file and then click Save. Maya saves the contents of the file under the specified name.
USING MAYA: ESSENTIALS 165
MANAGING FILES AND PROJECTS | 7 Saving files To convert a file: 1
Open the scene file.
2
Select File > Save Scene As.
3
Select mayaAscii or mayaBinary from Write As pull-down, depending on how you want to convert the scene. or Select mayaAscii or mayaBinary from the Files of type pull-down menu (Windows).
4
Click Save. Maya saves the scene in the specified format.
Setting save options For your convenience, you can predefine some of the options that apply when you use Save Scene and Save Scene As. You can override these predefined options when you save the scene. To set Save Scene options: 1
Select File > Save Scene ❐. The Save Scene Options window opens.
2
Set the options listed below and then click Save Scene to the save the scene or click Close to save the options without saving the scene.
Incremental Save
When Incremental Save is turned on and you save the scene, a backup folder by the same name is created in the scenes\incrementalsave folder and a backup is made of the file that was previously saved to disk. Each time you save, another backup file is created. These backup files are incremental (filename.001.mb, filename.002.mb) so the previous backup is not overwritten. The number of incremental backups created is infinite by default.
Limit Incremental Saves
Applies a limit to the number of incremental backup files that Maya creates and stores. The default limit is 20 increments. Number of Increments
Type a value or drag the slider to specify a limit.
Note When the Limit Increment Saves checkbox is turned on, Incremental Save stores only the limited number of incremental backup files. Once the limit is reached, Maya deletes the oldest incremental file and replaces it with the latest incremental backup file.
USING MAYA: ESSENTIALS 166
MANAGING FILES AND PROJECTS | 7 Saving files To set Save Scene As options:
File Type
1
Select File > Save Scene As ❐. The Save Scene As Options window opens.
2
You can set the following options in the Save Scene As Options window and click Save Scene As to save the scene. Sets the file type to mayaBinary or mayaAscii. The default is mayaBinary.
Default File Extensions
Adds the file extension .ma to Maya ASCII filenames and .mb to Maya Binary filenames. 3D Paint Texture Options
These options define how Maya saves file textures created with the 3D Paint Tool when you save a scene. For information on using the 3D Paint Tool, see Using Maya: Painting. Always
Unless Referenced
Never
Disk Cache Options
Saves different versions of the file textures when you save different versions of a scene. Use this setting if you are working on different iterations or versions of the file texture. Saves file textures only if the painted character is not referenced. When this option is selected, Maya uses the file textures from the referenced file, even if you save the scene with a new name. If the character is not referenced and you save a copy of the scene with this option selected, Maya creates a copy of the file textures. Does not save a new file texture. Use this setting if you are no longer changing the file textures and want to continue to use the saved file textures, even if you save the scene with a new name.
This refers to the new jiggle deformer requiring disk cache, which is implemented as a DG node and gets updated during a file save. Always
Creates a copy of the jiggle disk cache file when the scene is saved for the first time or saved to a new name. The cache file name corresponds with the scene file name. This is the default.
Never
Does not save a copy of the jiggle disk cache file. Use this option to prevent the copy from being created and save disk space.
In the New Project and Edit Project windows, we’ve added a Disk Cache option to the list of Data Transfer Locations (File > Project > New, File > Project > Edit Current). This allows you to set the default directory in which to store the jiggle deformer’s disk cache files.
Note In both the New Project and Edit Project windows, there is a Disk Cache option in the list of Data Transfer Locations (File > Project > New, File > Project > Edit Current). This allows you to set the default directory in which to store the jiggle deformer’s disk cache files. Use Verbose Names
Displays the full names of node attributes. For more information about using full names see, "Setting Open options" on page 162. USING MAYA: ESSENTIALS 167
MANAGING FILES AND PROJECTS | 7 Optimizing scene size
Tips for reducing file size When you save a new scene file, Maya saves the user interface information in the scene by default. The user interface file includes information about the interface like the current panel(s) and layout. To decrease the size of files you create, you can turn the default setting off so these user interface files are not created. To turn user interface file creation off: 1
Choose Window > Settings/Preferences > Preferences and select the Misc category.
2
Turn off the Save Panel Layouts with File check box in the Panel Configurations section.
3
Click Save to preserve your changes.
OPTIMIZING SCENE SIZE You can optimize the size of your scene by removing the following: •
invalid NURBS surfaces and curves
•
empty sets, partitions, and transforms
•
unused animation and NURBS curves, cached data, deformers, expressions, group ID, rendering, snapshot, and unit conversion nodes, locators, point constraints, and referenced items We recommend that you make a habit of optimizing scene size before you save. Optimizing your scene size before saving can:
•
improve the overall performance of Maya (the improvement can be significant)
•
improve Maya’s use of memory
•
reduce unnecessary waste of disk space To optimize scene size:
1
Select File > Optimize Scene Size ❐. The Optimize Scene Size Options window opens.
2
Select the items you want removed from the scene.
3
To optimize the scene using these settings, click Optimize and then OK.
Note Your settings are saved so that when you select File > Optimize Scene Size, the saved settings are used.
USING MAYA: ESSENTIALS 168
MANAGING FILES AND PROJECTS | 7 Managing projects
MANAGING PROJECTS A project is a collection of one or more scene files. A project also includes files related to the scene, such as texture files for rendering or geometry files for modeling. It specifies the directories for the scene data and the search paths to use when referencing files. For example, if you were working on a project called Randy_the_Robot, you could create a directory called robot to hold all the files related to that project, including scene, sound, rendering, and animation. Placing all the files in one directory makes it easier to manage the project, including referencing the files. When you start Maya for the first time, it creates a default directory called “default.” This directory contains default settings for all the subdirectories under default.
Default projects directory
Typically, these subdirectories contain information on all files associated with a specific project. For example, the sound subdirectory contains all sound files used by a scene. For more information on setting up projects, see "Creating projects" on page 171.
USING MAYA: ESSENTIALS 169
MANAGING FILES AND PROJECTS | 7 Managing projects
Where Maya stores scene information Maya stores scene information in three locations according to the type of information: •
Scene File Locations – Stores scene files.
•
Project File Locations – Stores files such as textures, lights, images, source images,
.mel files, and rendering scenes. •
Data Transfer Locations – Stores files that are in other formats such as .dxf, .obj, and
plug-ins.
Using absolute and relative paths You can specify either an absolute or relative path to a particular directory.
What is an absolute path? An absolute path starts at the root of a file system and works down the directory tree to the requested file. If you move a scene to a new directory, any absolute paths you created become unusable. You must correct the paths before Maya can read the scene again. Note that Maya also supports UNC paths, if your network supports them.
Tip Absolute paths must always start with a drive letter (Windows) or slash (UNIX). For example, C:\username\maya\projects\Storm\wind.
What is a relative path? Relative paths point to a directory by describing its relationship to the current scene. For example, if you want to access all files in project Storm, under directory hurricane, then type hurricane\Storm. If you change the name of the project directory, then all you have to do is change the name of the directory. You do not have to change the entire path to the associated project files. Example of a relative path Here is an example of a relative path that goes up two levels to the projects directory, then down one directory to project hurricane\Storm. ..\..\projects\hurricane\Storm\Wind
Tip Normally, you should use a relative path. Special situations require an absolute path—for example, if you want to place all lights for all projects in the same directory.
USING MAYA: ESSENTIALS 170
MANAGING FILES AND PROJECTS | 7 Managing projects
Multiple project directory paths If you have multiple locations for project files, including directories outside your project area, you can list them all in the New Project or Edit Project window. Separate the directories using a colon (UNIX) or semi-colon (Windows). For example, you may have a local sourceimages directory and one that is shared on the network, as shown in the following illustration. Multiple directories (Windows example)
You can mix relative and absolute paths, as the above example illustrates. The entry sourceimages is relative to the project directory, while g:\sharedimages is absolute. Make sure to start absolute paths with either a slash (UNIX) or drive letter (Windows).
Creating projects You can structure a project file to suit the requirements of a particular project. To create a new project: 1
Select File > Project > New. The New Project window opens.
~This will change. User interface field is going away
2
Enter the name of the new project in the Name text box.
3
In the Location text box, enter or browse to the directory that will contain the new project.
USING MAYA: ESSENTIALS 171
MANAGING FILES AND PROJECTS | 7 Managing projects 4
You can click Use Defaults to let Maya assign the default names for the following location. or You can set the locations by typing them in and then click Accept. Specifies the directory used to save scene files. This directory normally contains only geometry information, unless you instruct Maya to put all of the information on the file into this subdirectory. You can also use this text box to enter search criteria for scene information. For more information, see "Multiple project directory paths" on page 171.
Scenes
Project Data Locations
Specifies the directories for files containing project textures, lights, source images, images, and render scenes.
Data Transfer Locations
These locations specify the paths to the directories containing files in formats that may require conversion.
Note The location directories can be expanded using plug-ins. Each time you add a plug-in, the New Project window displays the addition. You can then specify the path to the plug-in’s directory. For more information, see "Using plug-ins for exporting" on page 188.
Note If you leave a text box blank, Maya does not create a subdirectory. If you create a scene using an unspecified project setting, Maya saves the information in the project location directory.
Specifying the current project Use Set Project to specify the current project. To specify a current project: 1
Select File > Project > Set. A file browser opens.
2
Select a project. Maya changes the path to the new project.
3
Click OK.
Editing the current project If any file location information has changed, use Edit Current to update the directories. For example, you may have relocated your sound files to a new directory and want to make sure that Maya is able to find them.
Note You cannot change the name or location of the project file.
USING MAYA: ESSENTIALS 172
MANAGING FILES AND PROJECTS | 7 Mapping missing directories To edit a project: 1
Select File > Project > Edit Current. The Edit Project window opens.
2
Click a triangle button to expand a section of directories related to the Scene, Project, or Data Transfer file locations.
3
Make changes and then click Accept. Maya updates the information on the project file.
MAPPING MISSING DIRECTORIES The dirmap command lets you map a missing directory to a different non-missing directory. This is most useful when you are moving scenes from UNIX to Windows.
Mapping from UNIX to Windows You can use the dirmap command to map your UNIX directory to your Windows directory. For example, if you enter the following commands: dirmap -enable true; dirmap -m "/home/user/maya" "C:/aw/maya/user"
These commands enable dirmap and add a mapping from /home/user/maya to C:/aw/ maya/user. Now, if you try to open the file on Windows: file -open “/home/user/maya/projects/default/scenes/scene1.ma";
Maya is not able to find the directory so it uses the dirmap data and tries again using: file -open "C:/aw/maya/user/projects/default/scenes/scene1.ma";
Mapping from UNIX to UNIX You can also use the dirmap command to map UNIX directories to other UNIX directories. For example, suppose you are running out of disk space and add a new disk, you can map your old directories to you new ones: dirmap -enable true dirmap -m "/home/user/maya/projects" "/bigdisk/maya/projects";
Note This works only if the original directory is missing. If the directory is there but the file is missing, you will get a normal “file not found” error. See the dirmap command in the online MEL command documentation for more information.
USING MAYA: ESSENTIALS 173
MANAGING FILES AND PROJECTS | 7 Supported file formats
SUPPORTED FILE FORMATS You can open and import the following file formats:
File extension
Filename
Description
Program used by
Platform
.ma
Maya ASCII
Native ASCII file format.
Maya
UNIX & Windows
.mb
Maya Binary
Native binary file format. This is the default file format.
Maya
UNIX & Windows
.mel
MEL
Maya Embedded Language, the scripting language used by Maya.
Maya
UNIX & Windows
.dxf
Drawing Exchange File
Exchanges geometric and drawing information between microCAD systems.
Auto CAD
UNIX & Windows
.geo
ExploreGeo
Geometry files. Can be imported only. Note that blobs, shaders, and groups are not converted
Explore
UNIX only
.obj
object file
ASCII files that define geometry and other object properties.
Advanced Visualizer
UNIX & Windows
.iges
Initial Graphics Exchange Specification
Standard for exchanging geometric information.
CAD systems
UNIX & Windows
.rib
RIB
RIB input/output of geometry.
Renderman
UNIX & Windows
.wire
aliasWire
Wire files.
PowerAnimator
UNIX & Windows
audio (various extensions)
audio files such as WAVE and aiff
Audio files for sampling in mono or stereo.
Various
UNIX & Windows
USING MAYA: ESSENTIALS 174
MANAGING FILES AND PROJECTS | 7 Importing files
File extension
Filename
Description
Program used by
Platform
image (various extensions)
Alias, BMP, CINEON, EPS, IFF, GIF, JPEG, Maya, RGB, RLA, SGI , SoftImage, 24or 32-bit Targa, TIFF, and XPM
Image files for textures or image planes.
Various
UNIX & Windows
.avi
AVI
Video for Windows Microsoft
Various
Windows only
An ASCII file that stores the channel data (such as x translate, y translate, and z translate) from a PreView scene file.
PreView
.mov
move
Note that this is the only movie file type supported on Windows. UNIX & Windows
IMPORTING FILES Maya has built-in translators that let you import into Maya scenes and files created in other applications. See "Supported file formats" on page 174 to see the types of files you can import. There are two ways to import a file: •
You can copy the imported file into the current scene using File > Import. See "Importing files by copying" on page 176 for details.
•
You can import the file by reference using File > Create Reference. When you import by reference, Maya makes a link to the file rather than copying it. See "Importing files by reference" on page 180 for details.
Using default nodes Default nodes are built-in nodes that always exist in Maya. These nodes represent global elements, such as camera positions, shader colors, and current time frames. When you import a file into an active scene, Maya uses the default nodes for the active scene. For example, if you changed a scene’s default shader color to red, this change would be saved. However, if you imported this scene into another scene, Maya would ignore the changed shader color and use the current default shader color instead. This is to prevent default nodes from suddenly changing. USING MAYA: ESSENTIALS 175
MANAGING FILES AND PROJECTS | 7 Importing files Since default nodes are always present in Maya, you don’t need to create them when you open a file. Only changes made to the defaults are saved. For more information on default nodes, see Using Maya: Expressions.
Importing files by copying Importing by copying makes it easier to transfer imported material from one scene to another. However, copying increases the file size. It also means that you must delete the imported objects and import the source scene again, if you change it. To import by copying: 1
Select File > Import.
2
Navigate to the file you want to import.
3
Double-click the name of the file you want to import. Maya copies the contents of the specified file into the current scene.
Setting import options Import options are values you specify, that take effect whenever you import a file into a scene. You can override the import options for a specific session. To set import options:
Group
Use Namespaces
1
Select File > Import ❐. The Import Options window opens.
2
You can set the following options and then click Import to import a file. Specifies whether the imported objects are grouped under a single transform when you import the file. Grouping makes it easier to work on the nodes of imported objects. The default is off. When you import or reference a scene with the Use Namespaces option turned on, Maya creates a new namespace that contains the imported or referenced data. Turning on the Use Namespaces option ensures that all nodes are uniquely named. A namespace is a grouping of objects under a given name. Each item in a namespace is identified by its own name along with the namespace it belongs to. By default, the basename of the imported or referenced file is added to the beginning of the imported or referenced object names, separated by colons. For example, if you are importing a scene named foo.ma that contains an object named ball, after it’s imported the ball is named foo:ball. You can change the prefix by selecting Resolve clashing nodes with this string and entering a prefix. You can create, name, parent, and remove namespaces using the namespace command. See the online documentation for MEL Command Reference information on the namespace command. (Help > MEL Command Reference) Namespaces do not effect selection, the DAG, the Dependency Graph, or any other aspect of Maya.
Resolve Name Clashes with
When you import a scene into another scene, naming conflicts occur if the nodes share the same name and parent nodes. USING MAYA: ESSENTIALS 176
MANAGING FILES AND PROJECTS | 7 Importing files To resolve these naming conflicts, you can rename only nodes with the same name and parents (clashing nodes) or you can rename all nodes. You specify whether to use the filename as the prefix (the default) or to create a prefix string. For more information on node hierarchy, see Using Maya: Expressions.
Tip We recommend you use namespaces to resolve naming conflicts instead of using the Name clash options when importing or referencing files. Choose from the pull-down menu the file type you will be importing . If you aren’t sure what type of file you will be importing, you can select Best Guess.
File Type
Depending on the file type you select, various file type specific options may be displayed, see "Setting Open options" on page 162 for information on these options.
Importing move files When you import move files, you must list the attributes to import or export in the text list in the move file option box. The move file format is just a list of numbers. No information on how those numbers should be used is included in the move file. Instead, each row is assumed to be a frame of data, and each column represents a single channel of data. This is the same move file format used by the Wavefront PreView program, with the addition that comment characters (# or // ) at the beginning of a line are allowed. Since time data is not stored with the file, when exporting a move file, the attribute’s value is written at each frame. The units of the file are your current units in Maya. When importing a move file, the current time of the scene is used as the starting point of the import. For both the import and export functions, all node naming clash and group options are ignored. To import a move file: 1
Select File > Import ❐. The Import Options window opens.
2
Select move from the File Type pull-down menu.
The following file type specific options apply to importing move files: USING MAYA: ESSENTIALS 177
MANAGING FILES AND PROJECTS | 7 Importing files Type the name of an attribute in the Attributes box and click Add to add the attribute to the list of attributes to use when importing or exporting. If the attribute is already included in the list, a duplicate is not made. You can add several attributes at one time by separating them with a space. To remove an attribute, type the name of the attribute and click Remove.
Attributes
From Channel Box
Click From Channel Box to combine all of the selected objects in Maya, in the order of their selection, with the channels selected in the Channel Box and place them in the list. For example, if sphere and cone are selected, and tx, sx are selected in the Channel Box, sphere.tx sphere.sx cone.tx and cone.sx are added to the list of attribute to import and export.
Remove Selected
Click Remove Selected to remove all of the attributes selected in the list.
Remove All
Click Remove All to remove all of the attributes from the list.
Precision
This is ignored in file export. For file import, this sets the precision of the file. When you click import or export, the move file is written or read and only the attributes in the list are affected.
Importing Adobe Illustrator® and EPS files You can import Illustrator and encapsulated postscript (EPS) files into Maya. With this feature, you can create 3D models based on 2D graphics, such as text or logos. Maya imports them as NURBS curves, which you can then group into surfaces, convert to polygons, and so forth. Support for Illustrator files extends from version 4 up to version 8. Any versions before 4 or after 8 are not necessarily supported. How curves are converted The curves from Illustrator and EPS files are actually Bezier curve segments. During import, Maya attaches the segments into a single curve. The Curve Degree is set to 3 (cubic) and the Knot Spacing is set to Multiple End Knots. To import an Illustrator or EPS file: 1
Choose File > Import.
2
In the file browser, navigate to the Illustrator or EPS file.
3
If needed, click the Options button (Windows) or choose Options > Options (UNIX) to set the following controls.
4
Scale Factor
Allows you to control the scale of the curves produced from the import. It is the same operation as using the Scale Tool.
Group
Turn on this option to group the imported curves. It is the same operation as using the Edit > Group option.
Click Import.
USING MAYA: ESSENTIALS 178
MANAGING FILES AND PROJECTS | 7 Importing files
Importing animation curves You can import animation curves from an anim file. To do this, you must first select the objects you want to connect to the animation curves. If nothing is selected the anim import will fail. Maya imports the animation curve into the API clipboard and pastes it into the file. To import animation curves from an anim file: 1
Select Window > Settings/Preferences > Plug-in Manager to verify that the animImportExport plug-in is loaded.
2
Open the file into which you want to import the animation curve.
3
Select the object which you want to connect to the animation curves.
4
Select File > Import.
5
Select animImport from the Read As pull-down menu (UNIX). or Select animImport from the Files of type pull-down menu (Windows).
6
Navigate to the file you want to import.
7
Double-click the name of the file you want to import. Maya copies the contents of the specified file into the current scene. To set anim import options:
Time Range
Help Images
1
Select File > Import ❐. The Import Options window opens.
2
Select animImport from the File Type pull-down menu.
3
Set the following options specific to animImport files and then click Import. Select a time range option and specify the appropriate settings. Start
Imports the animation information to the selected objects so that the animation starts at the time specified in the Start Time field.
Start/End
Imports the animation information to the selected object or objects, scaling the animation to fit into the time range as specified in the Start Time and End Time fields. Animation information from the keys clipboard is either scaled or clipped depending on the setting of the Clipboard Adjustment option.
Current
Imports the animation information to the selected objects so that the animation starts at the current time as displayed in the Animation Controls.
Clipboard
Transfers the animation information to the selected object(s), preserving the duration and timing of the animation information on the keys clipboard.
Copies
The value specifies the number of copies of the anim curves that will be imported. Multiple copies are appended sequentially.
Turn on Help Images to display illustrations of the effects of the various anim import options.
USING MAYA: ESSENTIALS 179
MANAGING FILES AND PROJECTS | 7 Importing files Clipboard Adjustment
Specify an option for how to handle the Clipboard contents.
Paste Method
Replace Region
Connect
Preserve
Pastes the contents of the clipboard into their new positions on the curve without any changes.
Scale
Becomes enabled when Start/End is selected. The complete contents of the clipboard curves are stretched or compressed to fit into the specified import Time Range.
Fit
Becomes enabled when Start/End is selected. The contents of the clipboard are preserved (that is, not stretched or compressed) and as much as will fit into the specified time range is pasted into the new area.
Specify a paste method. Insert
Places the clipboard contents before any existing keys in the specified time range. The keys from the original curve that were after the specified time range are shifted in time by the pasted range times.
Replace
Becomes enabled when Start/End or Clipboard is selected. The clipboard contents overwrite any existing keys in the specified time range.
Merge
The clipboard contents are added to any existing keys on the curve. In the case where a clipboard key is at the same time as an existing key, the clipboard’s key replaces the existing key.
These buttons are enabled when Paste Method is set to Replace. Time Range
Replace keys and curve segment information in the specified time range with the contents of the keys clipboard.
Entire Curve
Is available only when the Time Range setting is Clipboard. The Entire Curve setting replaces the animation curve(s) on the imported attributes with the contents of the keys clipboard, in effect deleting any existing animation curves on these attributes and applying the new curves from the keys clipboard.
When turned on, adjusts the keys clipboard curves in value, so there’s no discontinuity in the animation at the start of the pasted segment.
Importing files by reference When you import a scene by reference, Maya makes a link from the current scene to the source scene. This link points to the latest saved version of the scene. You cannot rename, delete, or ungroup objects from a referenced file. You can develop the referenced file while you use it in other scenes. For example, say you had three scenes in an animation that all used the same props. In one scene, the chair is beside the table. In the second, the chair is on top of the table. In the third, the chair is on the floor. If you imported the files by reference, three animators could use the same props, saving file space and sharing changes made to the surface characteristics and shading of the objects.
USING MAYA: ESSENTIALS 180
MANAGING FILES AND PROJECTS | 7 Importing files
Note Node names from referenced files appear red in the Hypergraph. In contrast, node names from non-referenced files appear black. To specify a referenced file: 1
Select File > Create Reference.
2
In the file browser, navigate to the file to reference and click Reference. You can also use this window to reference files on other systems (including UNIX) on your network. Maya loads the selected scene into the scene you are working on.
Tip Turn on the Use Namespaces option if you referenced expressions that include statements in MEL command format that include object names. Statements in conventional expression format work whether or not you include object names. The Expression Editor resolves name changes.
Setting Reference options You can specify file reference options. Maya uses these options the next time you import by reference. You can change the options as you work to override existing import by reference options for only the current session. To set reference options: 1
Select File > Create Reference ❐. The Reference Options window opens.
2
Set the options. See "Setting import options" on page 176 for information on setting Group, Namespaces, Name clash, and File Type options.
Using the Reference Editor You use the Reference Editor to specify settings for importing files by reference. You can: •
Create Reference (see "Importing files by reference" on page 180).
•
Import Reference (see "Importing a referenced scene" on page 182).
•
Export Selection As Reference (see "Exporting a selection as a reference" on page 182).
•
Remove Reference (see "Removing a reference from a scene" on page 183).
•
Select Reference Contents (see "Selecting the contents of a referenced scene" on page 183).
•
Load Reference/Unload Reference (see "Loading and unloading reference files" on page 183.
•
Replace Reference (see "Replacing reference files" on page 184).
•
Clean up References (see "Cleaning up references" on page 184).
USING MAYA: ESSENTIALS 181
MANAGING FILES AND PROJECTS | 7 Importing files To use the Reference Editor: 1
Select File > Reference Editor. The Reference Editor opens.
2
Select a referenced file. When you select a referenced file using the Reference Editor, Maya displays information about the file, called File Particulars. File Particulars
Name
Displays the name of the file.
Type
Displays the file format.
Status
Indicates if the file has been changed in some way.
Load
Indicates is the referenced file is loaded or unloaded. See "Loading and unloading reference files" on page 183.
Sub-type
Displays the sub-type of file.
I/O
Indicates if the file can be changed. Referenced files are always Read Only, while files you create yourself are always Writable.
Rename Prefix
Displays a prefix that can be applied to object names in the event of name clashes or namespaces.
Importing a referenced scene You can import a scene that used to be referenced. This breaks the reference connection. To import a referenced file: 1
Select File > Reference Editor.
2
Click the arrow next to the scene name and select the referenced file to be imported.
3
Select File > Import Reference.
Exporting a selection as a reference This lets you export parts of the scene you are working on as a referenced file. Exporting a referenced file is similar to File > Export Selection. However, when exporting selections as a referenced file, the selections in the Maya window exist USING MAYA: ESSENTIALS 182
MANAGING FILES AND PROJECTS | 7 Importing files only as referenced objects. If you make changes to the new referenced file, the objects in the existing scene change. For more information on exporting selections, see "Exporting files" on page 185. To export a referenced file: 1
Select objects in the scene file.
2
Select File > Reference Editor.
3
Select File > Export Selection as Reference.
4
Type the name of the referenced file, choose a file type from the Write As pull-down menu, then click Export Reference.
Removing a reference from a scene You can remove a referenced file from a scene if you do not need it anymore. When you delete the referenced file, referenced objects disappear and all connections are broken permanently. If you want to remove a reference and keep the connections intact, see "Loading and unloading reference files" on page 183. To remove a referenced file: 1
Select File > Reference Editor.
2
Select a referenced file.
3
Select Edit > Remove Reference. Maya displays a message warning you that this action cannot be undone.
4
Click Remove to remove the referenced file.
Selecting the contents of a referenced scene You can select objects in your scene that come from a referenced file. This lets you identify which objects exist in a referenced file without having to open the source file. To select objects from a referenced file: 1
Select File > Reference Editor.
2
Select a referenced file.
3
Select Edit > Select Reference Contents. The objects from the referenced file are selected and displayed in a different color.
Loading and unloading reference files In a scene that contains reference files, you can unload a reference file if it is not needed while you are working on a different part of the scene. This improves the interactive performance of Maya. You load it back in when you are ready for that part of the scene. To unload a reference file: 1
Select File > Reference Editor.
2
In the Reference Editor, expand the scene name to display the reference files.
3
Highlight the reference file you want to unload.
USING MAYA: ESSENTIALS 183
MANAGING FILES AND PROJECTS | 7 Importing files 4
Select Reference > Unload Reference. The reference file no longer appears in the scene. To load a reference file:
1
Select File > Reference Editor.
2
In the Reference Editor, expand the scene name to display the reference files.
3
Highlight the reference file you want to load.
4
Select Reference > Load Reference. The reference file appears in the scene.
Replacing reference files You can replace a reference file with another reference file. This is useful for substituting high and low resolution geometry. To replace a reference file: 1
Select File > Reference Editor.
2
In the Reference Editor, expand the scene name to display the reference files.
3
Highlight the reference file you want to replace.
4
Select Reference > Replace Reference.
5
Navigate to the replacement file and click Reference. The reference file is replaced. All connections are maintained.
Cleaning up references When you use reference files, Maya records any changes to the reference file. If you load, unload, or replace reference files, these changes may or may not be used. When you clean up references, you remove any recorded changes that aren’t being used. For example, if you replace a high-resolution reference file with a low-resolution, Maya records the connections, dynamic attributes, changed values, and disconnected attributes, which may not apply to the low-resolution version. When you substitute the high-resolution version again, the connections and values are restored. However, if you don’t substitute the high-resolution version, or you modify the high-resolution version before you substitute it, the scene may have dangling connections and unused values. When you clean up references, you eliminates this. You should clean up reference when you are done swapping reference files. To clean up references: 1
Select File > Reference Editor.
2
Select File > Clean Up Reference.
USING MAYA: ESSENTIALS 184
MANAGING FILES AND PROJECTS | 7 Exporting files
EXPORTING FILES You export files when you want to copy all of a scene’s contents (including referenced files) into a single file. Export also lets you convert a file into formats other than Maya ASCII and Maya Binary. Export copies all of a scene’s contents into another file, regardless of how the scene is divided into segments and references. In essence, Export collapses the entire scene into one file. This is essential when you want to save the scene’s contents to another file type, such as an IGES file, which doesn’t support Maya references. You can export scenes in several file formats depending on which export plug-ins you have installed. For more information on export plug-ins, see "Using plug-ins for exporting" on page 188.
Note If you export selected objects to an existing scene, it will overwrite the contents of the target file. If you want to add the contents of a scene to another scene, you must use File > Import. For more information, see "Importing files by copying" on page 176. When you export the contents of a scene, the entire contents of the scene, including referenced files, are written to a single file. To export the contents of a scene: 1
Select File > Export All.
2
Specify the name and file type you want to export the information to. If Maya detects an existing file with the same name, it will ask if you want to overwrite the existing file. The options for exporting are the same as those you use to save a file, except more export file types are available through plug-ins.
Note New export file formats may be added through plug-ins. For more information, see "Using plug-ins for exporting" on page 188.
Setting export options You can set the default file format for exporting by selecting File > Export All ❐. For Maya ASCII and Maya Binary formats, the Export All options are the same as the Save Scene As options (see "Setting save options" on page 166). File formats you export to using plug-ins have different options (see "Using plug-ins for exporting" on page 188.
USING MAYA: ESSENTIALS 185
MANAGING FILES AND PROJECTS | 7 Exporting files
Exporting scene elements You may want to export certain elements of a scene, for example, expressions. You can specify the scene elements that are included in the export data. To export specific elements of a file: 1
Select File > Export Selection ❐. The Export Selection Options window opens.
2
Set the following export preferences: File Type – Sets the File Type to mayaBinary or mayaAscii. The default is
mayaBinary.
Note For information about “move” files, see "Exporting move files" on page 187. Default File Extensions – Adds the file extension .ma to Maya ASCII filenames and .mb to Maya Binary filenames. Keep Only a Reference – Turn on to keep a reference to the file and move all of the
selected nodes out of the current scene. You must first select the objects in the scene. Use Namespaces – When you reference a scene with the Use Namespaces option
turned on, Maya creates a new namespace that contains the referenced data. Turning on the Use Namespaces option ensures that all nodes are uniquely named. For more information on Namespaces, see "Setting import options" on page 176) Prefix with – Select the file name to use the filename as the namespace. Select this
string and enter a name to be used for the namespace. Include These Inputs – Turn on to include or off to exclude any of the following
inputs: History – Includes or excludes construction history of the selected nodes. See "Using
construction history" on page 154 for more information. Channels – Includes or extrudes attribute values. See Using Maya: Animation for more information on attribute values. Expressions – Includes or excludes expressions. See Using Maya: Expressions for more information on expressions. Constraints – Includes or excludes constraints. See Using Maya: Animation for more
information on constraints. Include Texture Info – Turn on to export rendering information. The default is off. Use Verbose Names – Specifies whether you want to use long flag names for MEL
commands and full attribute names in the ASCII text.
USING MAYA: ESSENTIALS 186
MANAGING FILES AND PROJECTS | 7 Exporting files
Exporting move files When you import move files, you must list the attributes to import or export in the text list in the move file option box. The move file format is just list of numbers. No information on how those numbers should be used is included in the move file. Instead, each row is assumed to be a frame of data, and each column represents a single channel of data. This is the same move file format used by the Wavefront PreView program, with the addition that comment characters (# or // ) at the beginning of a line are allowed. Since time data is not stored with the file, when exporting a move file, the attribute’s value is written at each frame. The units of the file are your current units in Maya. When importing a move file, the current time of the scene is used as the starting point of the import. For both the import and export functions, all node naming clash and group options are ignored. To export a move file: 1
Select File > Export Selection ❐. The Export Selection Options window opens.
2
Select move from the File Type pull-down menu. The Export Selection Options window extends to display File Type Specific Options. The following file type specific options apply to importing move files:
Attributes
From Channel Box
Type the name of an attribute in the Attributes box and click Add to add the attribute to the list of attributes to use when importing or exporting. If the attribute is already included in the list, a duplicate is not made. To remove an attribute, type the name of the attribute and click Remove. You can add several attributes at one time by separating them with a space. Click From Channel Box to combine all of the selected objects in Maya, in the order of their selection, with the channels selected in the Channel Box and place them in the list. For example, if sphere and cone are selected, and tx, sx are selected in the Channel Box, sphere.tx, sphere.sx, cone.tx, and cone.sx are added to the list of attribute to import and export.
Remove Selected
Click Remove Selected to remove all of the attributes selected in the list.
Remove All
Click Remove All to remove all of the attributes from the list.
Precision
This is ignored in file export. For file import, this sets the precision of the file. When you click import or export, the move file is written or read and only the attributes in the list are affected.
USING MAYA: ESSENTIALS 187
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting
USING PLUG-INS FOR EXPORTING Maya plug-ins provide translators for exporting to various file formats. For more information about file conversions and file formats in general, see the online documentation Maya File Formats and Translators.
Note Maya plug-ins are typically designed to work on a specific operating system. Before you can use a plug-in, you must load it into Maya using a MEL command or the Plug-in Manager. To load a plug-in: 1
Select Window > Settings/Preferences > Plug-in Manager.
2
Locate the plug-in and click the loaded button.
3
After the plug-in loads, click the i button to get information on the plug-in.
Exporting to Wavefront (OBJ) The objExport plug-in lets you export Maya polygon data to the Wavefront OBJ ASCII file format. It converts: •
Maya texture coordinate and vertex normal information.
•
Maya renderable set information into material names.
•
Maya component set information into groups. To export a file in OBJ format:
1
Select Window > Settings/Preferences > Plug-in Manager to verify that the objExport plug-in is loaded.
2
Select File > Export All or File > Export Selection.
3
Select OBJExport from the Write As pull-down menu (UNIX). or Select OBJExport from the Files of Type pull-down menu (Windows).
Note The objExport plug-in does not export OBJ formatted curves, surfaces, smoothing groups, or point group materials. It also does not support NURBS. Use the MayaToIgesDxf plug-in for scenes that contain NURBS surfaces.
USING MAYA: ESSENTIALS 188
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting To set OBJ export options: 1
Select File > Export All ❐ or File > Export Selection ❐. The corresponding Export Options window opens.
2
Select OBJexport from the File Type pull-down menu.
3
Click to turn on or off exportation of Groups, Point groups, Materials, Smoothing, and Normals.
4
Click Export All or Export Selection.
Exporting to IGES, DXF, and Alias Wire The MayaToAlias plug-in lets you export Maya scene information to an IGES, DXF, or Alias Wire file. To export a file in IGES, DXF, or Alias Wire format: 1
Select Window > Settings/Preferences > Plug-in Manager to verify that the plug-in is loaded.
2
Select File > Export All or File > Export Selection.
3
Select IGESexport, DXFexport, or aliasWireExport from the Write As pull-down menu (UNIX). or Select IGESexport, DXFexport, or aliasWireExport from the Files of Type pull-down menu (Windows).
Note When exporting to Alias Wire files, we write version 8.1 files for UNIX and version 9.5 files for Windows.
USING MAYA: ESSENTIALS 189
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting
Exporting to RenderMan The ribExport plug-in lets you export scenes created in Maya to the RIB (RenderMan) format. The plug-in exports NURBS and polygonal geometry. All types of animation in Maya are supported, including keys, expressions, path, deformations, and motion blur. The ribExport plug-in supports ambient, directional, point, and spot lights. It does not support plug-in lights. Simple non-textured shaders are supported, although only the shader color is exported; all other shading attributes are ignored. Phong and Blinn shaders are exported as “plastic” and Lambert shaders are exported as “matte.” Per-face shading groups are not supported; only shading groups that are assigned to objects or object instances are exported. Plug-in shaders and textures are not supported. When exporting Maya scenes into RIB, note that the # character is a special formatting character in RenderMan image names (See the RenderMan user manual for information on its formatting capabilities). If you want to include a real # character in a RenderMan image name, you must use “##”. The image name constructed by the ribExport plug-in includes the contents of the “imageName” attribute of the renderable cameras. If you want to include the special RenderMan formatting characters in an image, the imageName attribute is the place those characters should be placed in quotes.
Note When you create a camera in PowerAnimator, it is automatically given a name that ends with the “#” character and a number. When the AliasToMaya translator converts these cameras into Maya cameras, the “#” is kept in the imageName attribute. If you want to render these scenes with RenderMan, the cameras will need to be edited, and the “#” characters in the imageName attributes replaced with “##”. To export a file to RenderMan format: 1
Select Window > Settings/Preferences > Plug-in Manager to verify that the ribExport plug-in is loaded.
2
Select File > Export All or File > Export Selection.
3
Select RIBexport from the Write As pull-down menu (UNIX). or Select RIBexport from the Files of Type pull-down menu (Windows). To set RenderMan export options:
1
Select File > Export All ❐ or File > Export Selection ❐. The corresponding Export Options window opens.
2
Select RIBexport from the File Type pull-down menu. The window extends to display File Type Specific Options.
USING MAYA: ESSENTIALS 190
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting 3
You can set the following options. Default File Extensions – Specifies whether the .rib extension will be appended to the specified file name. The .rib extension is not added if the specified filename already contains that extension. Single File Output – If set to No, each frame is written to a single file. If set to Yes, all
frames are written to one file. The default is Yes. Extension Padding – If the Single File Output option is set to No, then this option
specifies whether the RIB file extensions will be padded with 0’s. Geometry Motion Blur – Specifies whether geometry motion blur information is
written to the RIB file. Pixel Samples – Specifies the number of samples taken for each pixel. This value will
be used for both the X and Y directions. The default is 3.
Exporting animation curves You can export animation curves to an anim file. To do this, you must first select the objects connected to the animation curves. If nothing is selected the anim export will fail. Maya copies the anim curve into the API clipboard and pastes it into the new file. To export animation curves to an anim file: 1
Select Window > Settings/Preferences > Plug-in Manager to verify that the animImportExport plug-in is loaded.
2
Select the object whose animation curve you want to export.
3
Select File > Export All or File > Export Selection.
4
Select animExport from the Write As pull-down menu (UNIX). or Select animExport from the Files of Type pull-down menu (Windows). To set anim export options:
1
Select File > Export All ❐ or File > Export Selection ❐. The corresponding Export Options window opens.
2
Select animExport from the File Type pull-down menu. The window extends to display File Type Specific Options.
USING MAYA: ESSENTIALS 191
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting 3 Precision
You can set the following options. Sets the precision of the numbers stored in the file. The choices are: Float – Eight digits of precision Double – Seventeen digits of precision Custom – A setting between 1 and 18.
File Contents
Use Node and Leaf Attribute Names – When the Use Node and Leaf Attribute checkbox is selected, the node and leaf attribute names in the clipboard are written to the file.
When the checkbox is not selected, only the full attribute name is written to the file. Verbose Units – When the Verbose Units checkbox is selected, long unit names are
used in the file, otherwise short unit names are used. Hierarchy
The Hierarchy setting provides control over which nodes will be copied within a hierarchy. Selected – Only the selected object’s animation copies to the keys clipboard. Below – Copies the animation of the selected object and all objects below it to the
clipboard. Channels
This setting is available when you want to copy only attributes selected in the Channel Box. All Keyable – All keyable channels of the selected object’s animation are copied to the
clipboard. From Channel Box – Only those channels selected in the Channel Box are copied to
the clipboard. Control Points
This option enables or disables the copy action for all the CVs, polygon vertices, and lattice points associated with a geometry shape (or transform node hierarchically above the geometry shape). Normally, when a control point is copied, only the selected control point is copied. The Control Points option enables the copying for all the control points associated with an object. This is useful when you are doing control point-intensive animation and don’t want to select each control point to copy the animation.
Shapes
This option determines if the animation of a shape attribute of an object as well as the animation of the associated transform attribute are copied, or if only the transform node’s animation is copied. Generally, when an object is selected in a modeling window, the transform node (above the shape hierarchically) is selected. For example, if a camera, NURBS object, or light is selected, the associated transform node is selected for copying.
Time Range
All – Copies all the animation information of the selected object or objects to the keys
clipboard. Start/End – copies only the animation information in the range specified in the Start
Time and End Time fields of the selected object or objects to the keys clipboard. Help Images
When checked, this option displays a diagram of the copy action, and in particular represents graphically the two methods of copying animation information.
USING MAYA: ESSENTIALS 192
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting Method
Keys – Copies only keys within the selected range to the keys clipboard. Segments – Copies animation curve segments and any keys in the selected range to
the keys clipboard.
Note The Segments method of copying keys will create keys for the copied animation segment at the start and end times in order to preserve the shape of the animation curve, if keys do not already exist at those points.
USING MAYA: ESSENTIALS 193
MANAGING FILES AND PROJECTS | 7 Using plug-ins for exporting
USING MAYA: ESSENTIALS 194
8
SETTING ENVIRONMENT VARIABLES This chapter describes how to set environment variables using the Maya.env file and lists standard Maya environment variables that you may want to modify.
ABOUT ENVIRONMENT VARIABLES Environment variables are a useful way to modify the standard path locations and behavior used by Maya. Typical examples include: •
Setting MAYA_SCRIPT_PATH to point to a directory where you keep custom scripts.
•
Setting TEMPDIR to point to an area with more disk space so that you have enough room for temporary render cache files.
•
Setting MAYA_DISABLE_BACKSPACE_DELETE if you prefer that the backspace key does not perform deletion. Many of the variables used by Maya are set automatically when you start Maya. To configure Maya further, you can set additional environment variables. There are two places you can set environment variables: in the Maya.env file and in the operating system (through the UNIX command line, UNIX .cshrc file, or NT registry). Using the Maya.env file is the recommended method and is the subject of this chapter. The variables set in the operating system (through the UNIX command line, UNIX .cshrc file, or NT registry) take priority over the settings in the Maya.env file. However, when Maya verifies the environment settings, it may add default settings.
CREATING THE MAYA.ENV FILE While you can set environment variables in the operating system (such as the UNIX .cshrc file or NT registry), you should use the Maya.env file in most cases so you don’t clutter the standard environment settings. Another advantage of using Maya.env occurs when you are performing distributed rendering among several Windows machines. In this case, you can set up Maya.env as a roaming profile to be shared by all the machines. See your networking documentation for details on setting up roaming profiles. USING MAYA: ESSENTIALS 195
SETTING ENVIRONMENT VARIABLES | 8 Creating the Maya.env file To create Maya.env: 1
Create Maya.env in a text editor (such as jot or Notepad). For UNIX, make sure to use capital M for Maya.env.
2
Set each variable on a single line in the following form: NAME = VALUE
where NAME is the name of the environment variable, and VALUE is its value. For other formatting rules, see "Rules for Maya.env" on page 196. 3
Save the file to one of the following locations.
UNIX
Windows
~/maya/version
drive:\WinNT\Profiles\UserName\maya\version
or
or
~/maya
drive:\WinNT\Profiles\UserName\maya
Note These directory locations are the default. You can use a different directory if you specify it in the MAYA_APP_DIR environment variable, which must be set outside of Maya and the Maya.env file. See "Standard Maya environment variables" on page 199.
Rules for Maya.env •
You can set any variable, including ones that you define yourself. The only variables you cannot set in Maya.env are MAYA_APP_DIR and either HOME (for UNIX) or USERPROFILE (for NT).
•
For directory paths, use backslash (\) for NT and forward slash (/) for UNIX.
•
To separate several paths, use semicolon (;) for NT and colon (:) for UNIX.
•
You can include blank lines or lines that begin with # (comment character).
•
Extra spaces around the NAME and VALUE are ignored.
•
You can use variable substitution by typing either $variable (UNIX) or %variable% (NT). For example: MAYA_PLUG_IN_PATH = $MAYA_APP_DIR/scripts/test (UNIX) MAYA_PLUG_IN_PATH = %MAYA_APP_DIR%\scripts\test (NT)
This example uses $MAYA_APP_DIR, one of Maya’s standard environment variables. You can also use variables that you define yourself, either in the Maya.env file or in the operating system. •
If you define your own variable, make sure it does not contain these characters: Space Tab / : * " < > |
USING MAYA: ESSENTIALS 196
SETTING ENVIRONMENT VARIABLES | 8 Creating the Maya.env file
Note Although we recommend using different formatting for NT and UNIX (such as \ and ; for NT, and / and : for UNIX), Maya does recognize both formatting styles no matter what platform you use. It’s still best to keep a platform-specific format to avoid possible errors. UNIX example: The following example shows how you can define your own variable (SHARED_MAYA_DIR) and use it to set the value of other Maya variables. SHARED_MAYA_DIR = HostName:/usr/localhome/public/maya/4.0 MAYA_SCRIPT_PATH = $SHARED_MAYA_DIR/scripts:$MAYA_APP_DIR/scripts/custom MAYA_PLUG_IN_PATH = $SHARED_MAYA_DIR/plug-ins TMPDIR = /disk2/tempspace
Windows example: This example is the same as UNIX, but with NT-specific formatting. MAYA_SCRIPT_PATH = %MAYA_APP_DIR%\scripts\test MAYA_PLUG_IN_PATH = %MAYA_LOCATION%\devkit\plug-ins;%MAYA_LOCATION%\devkit\test TMPDIR = D:\tempspace
Where Maya looks for Maya.env Maya looks for the Maya.env file in MAYA_APP_DIR/version or MAYA_APP_DIR, which is an environment variable you may optionally set outside of Maya and the Maya.env file. If you did not explicitly set MAYA_APP_DIR, the following directories are used:
UNIX
Windows
~/maya/version
drive:\WinNT\Profiles\UserName\maya\version
or
or
~/maya
drive:\WinNT\Profiles\UserName\maya
USING MAYA: ESSENTIALS 197
SETTING ENVIRONMENT VARIABLES | 8 Modifying standard paths
MODIFYING STANDARD PATHS When Maya builds all the environment variable settings into its memory, it makes some verifications and adjustments. For several path environment variables, Maya adds a string of standard paths to the end of the variable setting. The standard paths contain items Maya requires to run. The affected environment variables are: MAYA_PLUG_IN_PATH MAYA_MODULE_PATH MAYA_SCRIPT_PATH XBMLANGPATH
If you set these variables, the path you give comes before the standard paths. First priority is given to settings made through the operating system, followed by Maya.env settings. Standard paths are always last. For a list of the standard paths, see the specific environment variable in the section "Standard Maya environment variables" on page 199.
Warning Because your path settings take priority over standard Maya paths, a conflict may occur and Maya may fail to load. In this case, try starting Maya with only default settings by typing the following at the command line: maya -default.
Other path settings For the system PATH variable, Maya adds $MAYA_LOCATION/bin. On UNIX, it also adds /usr/aw/com/bin. Maya checks whether the directory specified by the HOME variable (UNIX) or USERPROFILE variable (NT) exists and is writable. If not, Maya issues a prompt for you to provide a writable home directory. Note that HOME and USERPROFILE cannot be set in the Maya.env file.
USING MAYA: ESSENTIALS 198
SETTING ENVIRONMENT VARIABLES | 8 Standard Maya environment variables
STANDARD MAYA ENVIRONMENT VARIABLES This section lists the Maya environment variables you might typically use. MAYA_APP_DIR
This variable defines your personal Maya application directory. This directory contains your projects and other important items: •
the prefs directory
•
the projects directory
•
mayaRenderLog.txt
•
mayaLog
•
mayaJournal
•
the scripts directory
•
(Maya.env, if you choose to create it, can also reside in this directory) You can only set MAYA_APP_DIR from the operating system; you cannot use Maya.env. If you do not set it, the default values are: ~username/maya (UNIX) or drive:\WINNT\Profiles\username (NT).
MAYA_DEBUG_ENABLE_CRASH_REPORTING
When Maya encounters a fatal error, this variable writes a crash report file (.crash) in the current working directory. This file contains a detailed description of what Maya was doing when the failure occurred. To enable this option, set the value equal to 1. To disable it, set the value to 0 (zero) or leave it undefined. MAYA_DISABLE_BACKSPACE_DELETE
Disables the functionality of the backspace key. To enable this option, set the value equal to 1. To disable it, set the value to 0 (zero) or leave it undefined. MAYA_FILE_ICON_PATH
This variable has become obsolete since Maya 3.0. See "XBMLANGPATH" on page 202 as this variable should be used instead. MAYA_HELP_URL
This variable is used to override the path where help files are found. The default is $MAYA_LOCATION/docs/en_US/html/. e.g. MAYA_HELP_URL=$MAYA_LOCATION/docs/ja_JP.EUC/html/
Note Incorrect use of this flag will prevent online help from working within Maya. If your company has installed the documentation in a central location to save disk space, and you are accessing it via an intranet, then you need to use both the MAYA_HELP_URL and the showHelp command to see online documentation. Set MAYA_HELP_URL to the URL address of the top level of the online help. (i.e. The place where the MasterIndex.html file is found.) e.g. MAYA_HELP_URL=http://company.com/maya4.0/docs/en_US/html/
USING MAYA: ESSENTIALS 199
SETTING ENVIRONMENT VARIABLES | 8 Standard Maya environment variables Then each user needs to copy the file helpTable onto their machine. This file is also at the top level of the online help. The last step is to add a line to each user’s "userSetup.mel" file that tells Maya where to find the local helpTable. e.g. showHelp -helpTable "$HOME/maya/4.0/helpTable"; The showHelp command needs a path to the helpTable, not a URL. MAYA_LOCATION
The path for the Maya installation directory. If it is not set, it defaults to /usr/aw/ mayaVersionNumber (UNIX) or drive:\AW\mayaVersionNumber (NT). MAYA_MODULE_PATH
Defines the search paths for Maya module files. A module file describes the install location for certain Maya components, such as subdivision surfaces. Generally, you don’t need to set this variable. But, keep in mind that for each path extracted from the modules files, Maya appends the suffixes “plug-ins”, “scripts” and “icons” and “icons,” and then adds the appended path to MAYA_PLUG_IN_PATH, MAYA_SCRIPT_PATH, and XBMLANGPATH, respectively. The following table lists the default paths, which will always follow any path that you specify.
Default for Windows
Default for UNIX
%MAYA_APP_DIR%\maya\4.0\modules %MAYA_APP_DIR%\maya\modules C:\AW\Modules\maya\4.0 C:\AW\Modules\maya
$MAYA_APP_DIR/maya/4.0/modules $MAYA_APP_DIR/maya/modules /usr/aw/modules/maya/4.0 /usr/aw/modules/maya
MAYA_NO_JITTER_FINAL_COLOR
If you are quantizing to 8-bit color, we apply some randomness, or jitter, to the color. To enable this option, set the value equal to 1. To disable it, set the value to 0 (zero) or leave it undefined. MAYA_OVERRIDE_UI
If this environment variable is set, Maya won’t load the file initialLayout.mel, which creates the interface. You must specify an alternate file to run (for example, MAYA_OVERRIDE_UI = test.mel). This variable should only be specified if you want to completely replace Maya’s UI for your own, custom-programmed interface. MAYA_PLUG_IN_PATH
Search path for plug-ins. When a plug-in is specified by relative path name, the directories in this path will be searched for the given plug-in name. This path also determines which directories will be listed in the Plug-in Manager. The following table lists the default paths, which will always follow any path that you specify.
USING MAYA: ESSENTIALS 200
SETTING ENVIRONMENT VARIABLES | 8 Standard Maya environment variables
Default for Windows
Default for UNIX
%MAYA_APP_DIR%\maya\4.0\plug-ins %MAYA_APP_DIR%\maya\plug-ins %MAYA_LOCATION%\bin\plug-ins
$MAYA_APP_DIR/maya/4.0/plug-ins $MAYA_APP_DIR/maya/plug-ins /usr/aw/userconfig/maya/4.0/plug-ins /usr/aw/userconfig/maya/plug-ins $MAYA_LOCATION/bin/plug-ins
MAYA_PROJECT
Defines the default location of your project. You can change the location at any time by choosing File > Project. This variable simply defines the default. MAYA_RENDERER_RT_BACKGROUND_COLOR
If you set this variable to 1, Maya includes the camera background in the calculation of reflection and refraction rays. If you set this variable to 0 (zero) or leave it undefined, Maya ignores the background color for these rays. MAYA_SCRIPT_PATH
Colon-separated search path for Mel scripts. If an unresolved Mel procedure is called, then this path will be searched for a script that implements it. Also, if a Mel file is sourced without giving the full path, then this path will be searched. The following table lists the default paths, which will always follow any path that you specify.
Default for Windows
Default for UNIX
%MAYA_APP_DIR%\maya\4.0\scripts %MAYA_APP_DIR%\maya\scripts %MAYA_APP_DIR%\maya\4.0\prefs\shelves %MAYA_LOCATION%\scripts\startup %MAYA_LOCATION%\scripts\others %MAYA_LOCATION%\scripts\AETemplates %MAYA_LOCATION%\scripts\paintEffects %MAYA_LOCATION%\scripts\cloth %MAYA_LOCATION%\scripts\live %MAYA_LOCATION%\scripts\fur
$MAYA_APP_DIR/maya/4.0/scripts $MAYA_APP_DIR/maya/scripts /usr/aw/userconfig/maya/4.0/scripts /usr/aw/userconfig/maya/scripts $MAYA_APP_DIR/maya/4.0/prefs/ shelves $MAYA_LOCATION/scripts/startup $MAYA_LOCATION/scripts/others $MAYA_LOCATION/scripts/AETemplates $MAYA_LOCATION/scripts/paintEffects $MAYA_LOCATION/scripts/cloth $MAYA_LOCATION/scripts/live $MAYA_LOCATION/scripts/fur
MAYA_USE_V1_CAMERA
Allows you to revert to the old (Maya 1.0/1.5) camera model behavior. Starting with Maya 2.0, we have fixed how the camera behaves when lens squeeze is not 1.0, or when the resolution’s aspect ratio is not the same as the x-resolution divided by the y-resolution. If you are in the middle of a job started with Maya 1.0/1.5, you may need the old (incorrect) behavior for continuity. To enable this option, set the value equal to 1. To disable it, set the value to 0 (zero) or leave it undefined. USING MAYA: ESSENTIALS 201
SETTING ENVIRONMENT VARIABLES | 8 Standard Maya environment variables MAYA_USE_VERSION1_DISPLACEMENT
Allows you to revert to the old (Maya 1.0) displacement mapping behavior. Starting with Maya 1.5/2.0, we significantly improved displacement mapping. If you are in the middle of a job started using Maya 1.0, you may need the old behavior for continuity. To enable this option, set the value equal to 1. To disable it, set the value to 0 (zero) or leave it undefined. MAYA_USE_VERSION1_POLY_TANGENT
Allows you to revert to the old (Maya 1.0) polygon tangent calculation behavior. For Maya 1.5/2.0 we significantly improved the way we calculate tangents on polygon objects. This primarily affects bump-mapping. If you are in the middle of a job started using Maya 1.0, you may need the old behavior for continuity. To enable this option, set the value equal to 1. To disable it, set the value to 0 (zero) or leave it undefined. TMPDIR and TEMP
This variable specifies the directory location Maya uses for various temporary files, such as: •
temporary render cache files during a render
•
crash files if Maya crashes On UNIX, set TMPDIR only. On NT, set both TEMP and TMPDIR. If not set, the temporary directory is /tmp (UNIX) or C:/temp (NT).
XBMLANGPATH
For both UNIX and Windows, this variable specifies the location of icon files, such as icons used for Shelf buttons. On UNIX, the syntax is slightly different then other paths. For example: XBMLANGPATH = "./icons/%B:$HOME/dev/icons/%B"
In this example, %B is acts as a placeholder that will be replaced by Maya with the bitmap filename. The following table lists the default paths, which will always follow any path that you specify.
Default for Windows
Default for UNIX
%MAYA_APP_DIR%\maya\4.0\prefs\icons %MAYA_APP_DIR%\maya\prefs\icons %MAYA_LOCATION%\icons %MAYA_LOCATION%\icons\paintEffects %MAYA_LOCATION%\icons\cloth %MAYA_LOCATION%\icons\live %MAYA_LOCATION%\icons\fur
$MAYA_APP_DIR/maya/4.0/prefs/icons/%B $MAYA_APP_DIR/maya/prefs/icons/%B /usr/aw/userconfig/maya/4.0/icons/%B /usr/aw/userconfig/maya/icons/%B $MAYA_LOCATION/icons/%B $MAYA_LOCATION/icons/paintEffects/%B $MAYA_LOCATION/icons/cloth/%B $MAYA_LOCATION/icons/live/%B $MAYA_LOCATION/icons/fur/%B
USING MAYA: ESSENTIALS 202
SETTING ENVIRONMENT VARIABLES | 8 Standard Maya environment variables WINEDITOR
Allows you to override the Expression Editor and use your own editor. The editor must be set to run in the foreground. MAYA_PAINT_EFFECTS_THREADS
As of Maya 4.0, Paint Effects uses the multiple processors on your machine when painting and rendering. You can set this variable to control the number of processors used by Maya. The minimum is one (1) and the maximum is three (3).
USING MAYA: ESSENTIALS 203
SETTING ENVIRONMENT VARIABLES | 8 Standard Maya environment variables
USING MAYA: ESSENTIALS 204
Image by Ben Radcliffe
PART 2
EDITORS
9
USING MAYA EDITORS The chapter describes Maya editors, including: several of the General Editors, the Relationship Editor, the Attribute Editor, the Channel Box, and the Outliner. General Editors are tools you can use in a number of diverse workflows. One of the General Editors, the Attribute Spread Sheet, lets you see and modify attributes for multiple objects simultaneously. You use it to view and edit attributes in a columnar layout, and to keyframe them. The Relationship Editor provides a single place to work with memberships for sets, deformer sets, character sets, partitions, display layers, shading groups, and light linking. You can quickly see the relationships, and select and remove items in those relationships. The Attribute Editor is used to examine a particular object’s attributes in more detail, and with a more explanatory interface. Its advantage is that it is very detailed, and allows you to work on one object at a time. This is particularly useful for dealing with particles. The Channel Box is the primary, fastest, and most streamlined tool for editing object attributes. It lets you quickly set keys, and lock, unlock, or create expressions on attributes. The Outliner lists the objects, lights, cameras, and other items in a scene. This arrangement is called the scene hierarchy. Maya includes several other editors not described in this chapter. For details, refer to the following: •
Reference Editor, see "Using the Reference Editor" on page 181
•
Hypergraph, see "Using the Hypergraph" on page 263
•
Layer Editor, see "Using layers" on page 130
•
Rendering Editors, see Using Maya: Rendering
•
Animation Editors, see Using Maya: Animation
•
Render Globals, see Using Maya: Rendering
•
Hypershade, see Using Maya: Rendering
•
Visor, see Using Maya: Rendering
•
Expression Editor, see Using Maya: Expressions
USING MAYA: ESSENTIALS 207
USING MAYA EDITORS | 9 Using General Editors
USING GENERAL EDITORS General editors are grouped together because they are useful across all functional areas of Maya (Animation, Modeling, Dynamics, Rendering). To select a general editor: Select Window > General Editors and click the appropriate menu item: Component Editor
Lets you edit data assigned to components. For example, you can use the Component Editor to modify the weights assigned to individual CVs by cluster deformers. See "Using the Component Editor" on page 209.
Attribute Spread Sheet
Lets you view and edit attributes for multiple objects at the same time. See "Using the Attribute Spread Sheet" on page 212. Connection Editor
Visor
Blind Data Editor
Channel Control
Script Editor Command Shell
Lets you explicitly connect any two attributes. For example, you could use the Connection Editor to connect a shader attribute to a texture attribute. See the book Using Maya: Rendering. Lets you manage your Maya files for various applications, including rendering and Paint Effects. For more information, see Using Maya: Rendering, Using Maya: Painting, and Using Maya: Animation. You can use Maya's Blind Data Editor to define the blind data types you need, and then apply the blind data to objects or components in your scene. The blind data editor also allows you to query your scene for blind data of a specific type or set of values and use false coloring to visualize what blind data is assigned to each objects. For more information, see Using Maya: Polygonal Modeling. Displays all of a node’s attributes and lets you make them keyable or not keyable, editable or not editable (locked or unlocked). Since the Channel Box lists only keyable attributes, you often use Channel Control to add attributes to the items displayed in the Channel Box. For information on using Channel Control, see Using Maya: Animation. For information on the Channel Box, see "Using the Channel Box" on page 236. Lets you edit a script. See Using Maya: MEL. Lets you enter MEL commands directly through a command window. See Using Maya: MEL.
USING MAYA: ESSENTIALS 208
USING MAYA EDITORS | 9 Using General Editors
Using the Component Editor Use the Component Editor to edit data assigned to components. For example, you can use the Component Editor to modify the weights assigned to individual CVs by cluster deformers.
You can use the Component Editor to edit the component data of particles, springs, NURBS CVs, polygonal vertices, and lattice points. For example, you can edit the following component data with the Component Editor: •
the stiffness of individual springs
•
the colors of individual particles
•
polygonal vertex normals and colors
•
the weights of CVs, vertices, or lattice points influenced by cluster deformers
•
the weights assigned to CVs, vertices, or lattice points after smooth or rigid skinning
Editing component data With the Component Editor, you can find out what data is currently assigned to particular components, and then change that data. To query component data: 1
Select the components whose data you want to edit.
2
Select Window > General Editors > Component Editor. The Component Editor opens. The Component Editor displays the component data for currently selected components in the workspace. By default, the Component Editor updates dynamically as you select components in the workspace. Also, as you select components in the Component Editor, the workspace updates dynamically.
USING MAYA: ESSENTIALS 209
USING MAYA EDITORS | 9 Using General Editors
Click on tabs to select component types or influences Objects influencing component data listed by column Components listed by rows Component data is displayed for editing in a spreadsheet
3
Click the Polygons, AdvPolygons, Springs, Particles, Weighted Deformers, JointClusters, and SkinClusters, tabs to view component data.
Polygons
Lists component data of polygonal vertices, including color or normal data in world space coordinates. If color or normal data are not shared at the vertex level, the column displays the word UnShared. These unshared values can be viewed and edited from the AdvPolygons tab.
AdvPolygons
Lists vertex face component data, including color and normal values for the vertex face.
Springs
Lists component data for springs, including stiffness and damping data.
Particles
Lists component data for particles, including color or velocity data.
Weighted Deformers
Lists component data of CVs, vertices, or lattice points influenced by cluster deformers (cluster weights).
JointClusters
Lists component data of CVs, vertices, or lattice points bound to a skeleton’s joints by rigid skinning (joint cluster weights).
SkinClusters
Lists component data of CVs, vertices, or lattice points bound to a skeleton’s joints by smooth skinning (skin cluster weights). Note that if the components are organized into sets, the sets are also listed. To modify component data: 1
In the Component Editor’s spreadsheet, click the component data text box you want to edit. Only the component whose text box you selected is now selected in the workspace.
2
Enter a new value or use the slider bar. To modify several components at once:
1
In the workspace, select the components whose data you want to edit.
2
In the Component Editor’s spreadsheet, drag through the component data text boxes you want to edit.
3
Enter the value you want all the text boxes to have.
USING MAYA: ESSENTIALS 210
USING MAYA EDITORS | 9 Using General Editors To modify an entire row or column (UNIX only): 1
In the workspace, select the components whose data you want to edit.
2
In the Component Editor’s spreadsheet, click one of the text boxes in the row or column.
3
Click the row or column heading. Now all the text boxes for the row or column are selected.
4
Enter a value for all the text boxes in the row or column. To modify an entire row or column (Windows only):
1
In the workspace, select the points whose weights you want to edit.
2
To change all the entries of a row or column, in the Component Editor’s spreadsheet, select the row or column heading.
3
Shift select any of the text boxes in that row or column.
4
Enter a new value to update the entire row or column.
Updating component data By default, the Component Editor updates its display automatically to list whatever components you’ve just selected in the workspace. This automatic updating enables the rapid selection and editing of component data. If you prefer, you can turn automatic updating off so that the Component Editor lists components you selected in the workspace only when you tell it to do so. In contrast to automatic updating, this approach is called manual loading. To use automatic updating: In the Component Editor, select List > Auto Update, turning Auto Update on. (This is the default.)
Note The display does not automatically update if you undo, redo, or modify components in the workspace. For these types of changes, you must manually load components to refresh the Component Editor display. To use manual loading: 1
In the Component Editor, select List > Auto Update, turning Auto Update off.
2
In the workspace, select the components whose data you want to edit.
3
To list the components in the Component Editor, select List > Load Selected Components. Alternatively, click the Load Components button located below the spreadsheet.
USING MAYA: ESSENTIALS 211
USING MAYA EDITORS | 9 Using General Editors
Changing the display You can control the number of decimal places that are shown in the Component Editor. To change the display of decimal places: 1
Select List > Change Precision. The Change Precision dialog box opens.
2
Type the number of decimal places and select OK. The Channel Box fields resize to show the precision you have specified.
Note Select Channels > Settings > Reset to Default to return the width, precision, and channel name type back to the default settings.
Using the Attribute Spread Sheet Attributes (also known as channels) are qualities or characteristics that affect the visual representation of objects (for example. position or color) or behavior of objects (for example, the damping of a joint or magnitude of a force). You can use the Attribute Spread Sheet to set various attributes for more than one object in a pane or for a particular node of an object. You can also use this tool to assign various attributes from the Attribute Editor to multiple objects or nodes. Use the Attribute Spread Sheet to see and edit attributes for multiple objects simultaneously. It doesn't show whether attributes are connected or locked, and it does not show multi-attributes at all. To examine the attributes of a node in more detail, and with a more explanatory interface, you can use the Attribute Editor. However, the Attribute Editor can be slower than the Attribute Spread Sheet, because you can only work on one object at a time. (The Channel Box works on all selected objects.)
Displaying the Attribute Spread Sheet Use the Attribute Spread Sheet to change the attributes for an object. To display the Attribute Spreadsheet: 1
Select the node you want to change the attributes for.
2
Select Window > General Editors > Attribute Spread Sheet. Maya displays the node’s name in the Attribute Spread Sheet.
Notes When the Attribute Spread Sheet first opens, the Keyable tab is selected. This tab displays all the keyable attributes of the selected objects. Most other tabs display useful subsets of these attributes. The All tab displays all attributes, keyable or not. Many attributes useful in editing an object are not stored in its main node, but rather in the shape node associated with it. Some of the tabs in the Attribute Spread Sheet (such as Shape Keyable, Tessellation, and so on) show you attributes in the associated shape.
USING MAYA: ESSENTIALS 212
USING MAYA EDITORS | 9 Using General Editors
selected node
name of the selected node
Tips If you have any problems selecting a node, select Window > Hypergraph. For more information, see "Using the Hypergraph" on page 263. To select all of an object’s nodes at once, drag a box around the object. To display shorter attribute names: When you display the Attribute Spread Sheet, Maya shows the full attribute names. You can make the column smaller by showing the short names instead. To show the short attribute name, select Names > Short Attribute Names in the Attribute Spread Sheet. To show the long attribute name, select Names > Long Attribute Names.
Entering values for attributes You can set any of these combinations with one text entry. •
a single attribute of one or more objects
•
two or more attributes of the same object
•
two or more attributes of multiple objects For example, you can enter the value 5 in one text box to change the three attributes for scaling along the X, Y, and Z axis for more than one object. You can also change the values of several attributes by a relative amount. For example, you can add 3 to the Scale X, Scale Y, and Scale Z attributes. Entering an exact value for object attributes You can give one or more attributes an exact value as follows: To change the value of a single attribute:
1
Select the object(s). The Attribute Spreadsheet displays the attributes of the object(s).
2
In the Attribute Spreadsheet, click the attribute’s text box. For example, click the Scale X text box.
USING MAYA: ESSENTIALS 213
USING MAYA EDITORS | 9 Using General Editors 3
Type the new entry and press Enter or the tab key. For example, type 5 and press Enter. For a Scale X entry, this sets the X axis scaling of all selected objects to 5 grid units. To change the value of two or more attributes:
1
Select the object(s). The Attribute Spreadsheet displays the attributes of the object(s).
2
In the Attribute Spreadsheet, select the desired attribute text boxes. For example, you can click the Translate X text box and drag through to the Translate Y text box for an object, then drag down to select the Translate X and Y boxes for other objects. The first box you click is where you enter the value. The other selected text boxes turn black. This lets you know they’re selected in addition to the box where you’ll type the new number.
Drag through adjacent boxes
Tip To select several adjacent boxes, drag through them. To add a non-adjacent box to a selection, Ctrl-click the additional box. To select a range of boxes, click the first box and Shift-click the last box. To select an entire row of boxes, click the node name. To select an entire column of boxes, click the column name. 3
Type the new entry and press Enter or the tab key. For example, type 5 and press Enter. If Translate X and Translate Y are selected when you enter 5, all selected Translate X and Translate Y attributes become 5.
USING MAYA: ESSENTIALS 214
USING MAYA EDITORS | 9 Using General Editors Entering a relative value for attributes You can change the values of several attributes by a relative amount. For example, you can add 3 to the Scale X, Scale Y, and Scale Z attributes. To do this, you must enter these arithmetic operators in the text boxes:
Arithmetic operator
Operation
Example entry
+=
Adds the entry to the existing value in each selected box
+= 3.5
-=
Subtracts the entry to the existing value in each selected box
-= 3.333
*=
Multiplies the entry to the existing value in each selected box
*= 7
/=
Divides the entry to the existing value in each selected box
/= 3
For example, suppose you’ve selected an object named Ball. Its Scale X and Scale Y attributes are set to 3 and 5 in the Attribute Spreadsheet. If you select the Scale X and Scale Y text boxes, typing += 2 in the text box adds 2 to each value. So Scale X would become 5 and Scale Y would become 7.
Managing the layout of information There are three ways to manage information in the Attribute Spread Sheet: •
Select Layouts > Show Selected Columns Only to display selected columns of information. This reduces the amount of information on your display.
•
Use Layouts > Remember This Layout to save a selected layout and recall it later.
•
Use Layouts > Delete Current Layout to delete a layout.
USING MAYA: ESSENTIALS 215
USING MAYA EDITORS | 9 Using General Editors To show selected columns: 1
From the Attribute Spread Sheet, select the tab that has the attributes that you want to display. Each attribute occupies a column.
2
Click on the title of one of the columns you want to show. Ctrl-click to select additional columns until you have selected all the attributes you are interested in.
3
Select Layouts > Show Selected Columns Only. All the other columns are hidden, leaving only the ones you have selected. This layout persists until you select another tab, or close the Attribute Spread Sheet. To make the new layout permanent, follow the next set of steps.
To remember a layout: 1
Select Layouts > Remember This Layout. The Remember Layout window opens.
2
Type the name of the new layout and then click Remember. Maya adds a tab for this new layout. You can now recall the layout by clicking on the tab. To delete a layout: To delete a layout, select Layouts > Delete Current Layout. Maya removes the tab from the window.
Note You can remove Maya’s pre-defined tabs, but they will return the next time you open the window.
Setting attribute keys in the Attribute Spread Sheet Keys are markers that represent the value of an attribute of an object at a particular time. When the value of an attribute is different at one key from another, that attribute’s value will change over time as Maya calculates the value of the attribute in the time between the keys, and that attribute is animated. The act of placing a key is called “setting a key” for that attribute at that time. For details, see Using Maya: Animation. To set attribute keys in the Attribute Spread Sheet: 1
Select the cells you want to set keys for.
2
Select Key > Key Selected.
USING MAYA: ESSENTIALS 216
USING MAYA EDITORS | 9 Using the Relationship Editor
USING THE RELATIONSHIP EDITOR Use the Relationship Editor to edit relationships in Maya, where a relationship is a collection or grouping of objects or components. These relationships include: •
sets
•
deformer sets
•
character sets
•
partitions
•
display layers
•
render layers
•
light linking (light-centric and object-centric)
•
UV linking (texture-centric and UV-centric)
Note The Relationship Editor is separate from the Dynamic Relationships Editor, which is used to control relationships of particle objects. See Using Maya: Dynamics for more information. For all these types of relationships, you can do the following in the Relationship Editor: •
specify view options (see "Setting view options" on page 218)
•
select which relationships and objects display ("Displaying relationships and objects" on page 218)
•
create and delete relationships (see "Creating relationships" on page 220)
•
select members of a relationship (see "Selecting relationships, relationship members, and objects" on page 221)
•
add and remove members of a relationship (see "Adding and removing relationship members" on page 221)
•
filter which relationships and objects display in the Relationship Editor (see "Selecting which relationships and objects show" on page 219) To open the Relationship Editor:
•
From the main Maya window, select Window > Relationship Editors and select the relationship you want to work with. (You can change this from within the Relationship Editor.) or
•
From a panel, select Panels > Panel > Relationship Editor. Note that this opens the Relationship Editor in a panel rather than a separate window. The Relationship Editor opens.
USING MAYA: ESSENTIALS 217
USING MAYA EDITORS | 9 Using the Relationship Editor
Select the type of relationship you want to work with
The left side of the editor displays relationships of the type you selected, while the right side of the editor displays objects in the scene.
Setting view options You can set view options for sets, partitions, characters, and deformer sets. You can automatically expand the relationships in the display area so you can see the members of each relationship without having to click the plus sign beside them. In the Relationship Editor, select the relationship type, then select Options > Auto Expand Frames to turn it on.
Displaying relationships and objects Using the List menu, you can control which relationships are loaded in the left panel of the Relationship Editor, and which objects are loaded in right panel. By default, all relationships and objects display, but you may want to limit the display so you can see what you’re working on more clearly. You can also control what displays in the Relationship Editor using the Show menu. For details, see "Selecting which relationships and objects show" on page 219. To display relationships: On the left panel, select one of the following options from the List menu. Auto Load All
Turn this on to automatically display all relationships of the selected type in the scene. This is the default.
Manual Load
Turn this on to display relationships by choosing one of the following options: Load from Selection Add from Selection Remove from Selection
USING MAYA: ESSENTIALS 218
Display only the relationships associated with the objects selected in the scene. Add to the display the relationships associated with the objects selected in the scene. Remove from the display the relationships associated with the objects selected in the scene.
USING MAYA EDITORS | 9 Using the Relationship Editor To display objects: On the right side panel, select one of the following options from the List menu. Turn this on to automatically display all objects in the scene.
Auto Load All Auto Load Selection
Turn this on to automatically display objects in the relationships associated with the objects selected in the scene. Turn this on to display objects by choosing one of the following options:
Manual Load
Load List from Selection
Display only the selected objects.
Add Selection to List
Add to the display the objects selected in the scene.
Remove Selection from List
Remove from the display the objects selected in the scene.
Selecting which relationships and objects show You can display a subset of relationships and objects in the Relationship Editor using the Show menu. What you can display depends on the relationship you are editing. For more information, see "Limiting the information shown in editors" on page 258. To select which relationships show: •
In the left panel of the Relationship Editor, select Show > Objects, then select the types of relationships you want to show. Only the items you select will display in the left panel. or
•
Type text in the Text Filter box to limit the display to items with that text. For details, see "Limiting the display to items containing specific text" on page 259. To show all relationships:
•
In the left panel of the Relationship Editor, select Show > Objects, then turn off the items you now want to show. or
•
To show all types of relationships, select Show > Show All. To select which objects show:
•
In the right panel of the Relationship Editor, select Show > Objects, then select the types of objects you want to show. Only the items you select will display in the right panel. or
•
Type text in the Text Filter box to limit the display to items with that text. For details, see "Limiting the display to items containing specific text" on page 259.
USING MAYA: ESSENTIALS 219
USING MAYA EDITORS | 9 Using the Relationship Editor To show all objects: •
In the right panel of the Relationship Editor, select Show > Objects, then turn off the items you now want to show. or
•
To show all types of objects, select Show > Show All.
Creating relationships From the Relationship Editor, you can create the following relationships: •
sets (see "Creating sets" on page 303
•
partitions (see "Creating, displaying, and removing partitions" on page 308)
•
characters (see Using Maya: Character Setup)
•
display layers (see "Using layers" on page 130)
•
render layers (see "Using layers" on page 130)
•
shading groups (see Using Maya: Rendering)
•
light sets and object sets (see Using Maya: Rendering) You cannot create deformer sets. In general, use the following procedure to create a new relationship. To create a relationship in the Relationship Editor:
1
Select the objects or items in the workspace, Outliner, or elsewhere. If you don’t select any objects or items, an empty set will be created. You can add to it later. See "Adding and removing relationship members" on page 221.
2
Open the Relationship Editor (see "To open the Relationship Editor:" on page 217).
3
Select the type of relationship you want to create, if it isn’t already selected.
4
For sets, partitions, and characters:
•
On the left panel of the editor, select Edit > Create Relationship ❒, where Relationship is the type of relationship you are creating (set, partition, character). An Options window opens.
•
In the Name box, type a name for the set. For example, if you are creating a set with polygonal objects, you might call the set polyObjects.
•
Click Apply and Close. or For light sets, or object sets, select Edit > Create Relationship, where Relationship is the type of relationship you are creating (partition, character, display layer). The new set appears on the left side of the Relationship Editor. If a relationship or other item in the scene already has the specified name, the new set name will be appended with a number. For example, entering top results in top1, because top is the name of a camera that exists in every scene by default. To rename a relationship in the Relationship Editor: Double-click the name of the relationshi, type the new name and press Enter.
USING MAYA: ESSENTIALS 220
USING MAYA EDITORS | 9 Using the Relationship Editor To delete a relationship in the Relationship Editor: In the left panel, click on the relationship you want to delete and select Edit > Delete Highlighted.
Selecting relationships, relationship members, and objects You can use the Relationship Editor to quickly select relationships, members of relationships, and objects in your scene. When you select a relationship, it becomes active in the channel box, or the Attribute Editor. To select a relationship: 1
In the left panel of the Relationship Editor, click the relationship(s) you want to select. Notice that member of the set are highlighted in the Objects panel.
2
Select Edit > Select Highlighted. The relationship(s) becomes active. To select set members:
1
In the left panel of the Relationship Editor, click the relationship(s) with the members you want to select.
2
Select Edit > Select Set Members, The members of the highlighted set are selected in the scene. To select objects in your scene:
1
In the right panel of the Relationship Editor, click the object(s) you want to select in your scene.
2
Select Edit > Select Highlighted. The highlighted objects are selected in your scene.
Adding and removing relationship members Use the Relationship Editor to quickly add and remove objects or items from a relationship. To add objects or items to a relationship: 1
In the left panel of the Relationship Editor, click the relationship you want to add objects or items to.
2
In the right panel of the Relationship Editor, click on the objects or items you want to add to the relationship. or In the scene, select the objects or items you want to add to the relationship and select Edit > Add Selected Items or click the plus sign button beside the relationship type at the top left of the Relationship Editor.
USING MAYA: ESSENTIALS 221
USING MAYA EDITORS | 9 Using the Attribute Editor To remove objects or items from a relationship: 1
In the left panel of the Relationship Editor, expand the relationship you want to remove objects or items from by clicking the plus sign (+) beside it, if it is not already expanded.
2
Still in the left panel, click on the object or item you want to remove from the expanded relationship and select Edit > Remove Highlighted from Set. or
1
In the left panel of the Relationship Editor, click the relationship you want to remove objects or items from.
2
In the Object panel of the Relationship Editor, click on the highlighted objects or items you want to remove from the relationship. or In the scene, select the objects or items you want to remove from the relationship and select Edit > Remove Selected Items or click the minus sign (-) beside the relationship type at the top left of the Relationship Editor.
USING THE ATTRIBUTE EDITOR Use the Attribute Editor to view and set the attributes for any object or node. For example, you can use the Attribute Editor to change the rotation order of an object (that is, the rotation order under the scale/rotate/translate attributes.) You can also use the Attribute Editor to turn many items in the Display menu on and off. The Attribute Editor provides access to all attributes for an object or node. You can also use the Channel Box and the Attribute Spreadsheet to view and set attributes. The Channel Box provides access to keyable attributes only. For information on the Channel Box, see "Using the Channel Box" on page 236. The Attribute Spreadsheet provides access to all attributes, and lets you change attribute values for multiple objects at the same time. For information on the Attribute Spreadsheet, see "Using the Attribute Spread Sheet" on page 212.
Displaying the Attribute Editor The Attribute Editor displays in a separate window or in the main Maya window, depending on your preference settings (Window > Settings/Preferences > Preferences, Interface category). To open the Attribute Editor: Do one of the following: •
Click the Show or hide the Attribute Editor button on the Status Line
•
Select Window > Attribute Editor.
•
Press Ctrl-A in the view.
•
Right-click the object or node and select it from the marking menu.
•
Select Display > UI Elements > Attribute Editor.
•
In the Hypergraph, select the object or node, then select Edit > Attributes.
•
Double-click a node in the Hypershade, Visor, Multilister, or Outliner.
USING MAYA: ESSENTIALS 222
.
USING MAYA EDITORS | 9 Using the Attribute Editor
To change the default display of the Attribute Editor: 1
Select Window > Settings/Preferences > Preferences and then the Interface category.
2
Select one of the following options beside Open Attribute Editor and click Save.
In Separate Window
Opens the Attribute Editor in a separate window. In Main Maya Window
Opens the Attribute Editor in the main Maya window where the Channel Box normally resides. You can switch between displaying the Attribute Editor and Channel Box using the Show or hide buttons on the Status Line or from the Display > UI Elements submenu. (You cannot display both the Attribute Editor and the Channel Box in the main Maya window at the same time.) Common attributes and buttons Each tab in the Attribute Editor represents an individual node and contains all the attributes for that node. Click a tab to display and modify the attributes for that node. For details about specific attributes, refer to the appropriate Using Maya book. The following attributes and buttons are common to most Attribute Editor tabs. •
the name of the node (for example, nurbsSphere1 or lambert1)
•
Input Connection button Click the Input Connection button to display the first input connection node for the currently displayed node. Right-click the Input Connection button to display a list of all input connection nodes. You can then choose a node from this list to display in the Attribute Editor. USING MAYA: ESSENTIALS 223
USING MAYA EDITORS | 9 Using the Attribute Editor •
Output Connection button Click the Output Connection button to display the first output connection node for the currently displayed node. Right-click the Output Connection button to display a list of all output connection nodes. You can then choose a node from this list to display in the Attribute Editor.
•
Focus button — Click this button to set the Attribute Editor focus to this node.
•
a sample image or icon that represents the node (where appropriate)
•
Select button — Click this button to select the node that is currently displayed in the Attribute Editor.
•
Load Attributes button — Click this button to manually load the attributes of the selected object or node.
•
Copy Tab button — Click this button to create a new window containing the selected tab. See "Viewing attributes for different objects at the same time" on page 226. Menus The Attribute Editor has the following menus:
List
Selected/ Object
Use this menu to load attributes into the Attribute Editor and to define which items display in the Selected/Object menu. See "Loading object attributes into the Attribute Editor" on page 225. The Selected menu lists objects currently selected in the scene while the Object menu displays all the objects in the scene of a selected type. See "Loading attributes from the Selected/Object menu" on page 226.
Focus
This menu displays all nodes that have been selected in the scene while the Attribute Editor is open. The most recently selected node is at the top of the list. "Loading attributes from the Focus menu" on page 226.
Attributes
Use this menu to add, edit, and delete extra attributes for an object or node. These appear under the Extra Attributes section. You can also add, edit, and delete attributes using the Modify menu. For details, see "Adding a custom attribute" on page 227, "Editing custom attributes" on page 229, and "Deleting custom attributes" on page 230. Right-click menu options For some attributes, a pop-up menu appears when you right-click the attribute name or text box. This pop-up menu has the following options:
output connection node
If you set a key for the attribute or connect a texture to it, the resulting output connection node name displays as the first menu item. To load the attributes for this node into the Attribute Editor, select it. Create New Expression
Select this option to create a new expression for the attribute. For details, see "Launching the Expression Editor" on page 232. Set Key
Select this option to set a key for the attribute. For details, see "Setting keys for attributes in the Attribute Editor" on page 231. This options disappears from the menu if you have already connected a texture to the attribute.
USING MAYA: ESSENTIALS 224
USING MAYA EDITORS | 9 Using the Attribute Editor Select this option to link the attribute values. For details, see "Linking attributes" on page 232.
Set Driven Key Break Connection
Select this option to break the connection between the attribute and a key or texture. For details, see "Breaking connections" on page 232.
Create New Texture
Select this option to connect a texture to the attribute. For details, see "Mapping a texture to an attribute value" on page 233. This option displays for color attributes only. Select it to open the Color Chooser. For details, see "Using the Color Chooser" on page 233.
Color Chooser Lock/Unlock Attribute
Select the Lock option to lock an attribute value so that it cannot be changed. Use Unlock Attribute to unlock the value. For details, see "Locking attribute values" on page 232. Ignore/Don’t Ignore when Rendering
This option displays only for attributes that are connected to keys or textures. Select the Ignore when Rendering option to ignore the connection when rendering. If the attribute has a map button, the button changes to indicate that the connection will be ignored. Indicates that the attribute is connected to a key or texture Indicates that the connection will be ignored when rendering
Select the Don’t Ignore when Rendering option to render with the set connection. For details, see Using Maya: Rendering.
Loading object attributes into the Attribute Editor Loading attributes into the Attribute Editor makes them available to view or edit. There are three ways to load object attributes into the Attribute Editor: •
automatically when you select the object
•
manually
•
by selecting the object from the Attribute Editor Selected/Object menu
•
by selecting the object from the Focus menu
Loading attributes automatically When you select an object, its attributes are automatically loaded into the Attribute Editor where you can view and edit them. Each node of the selected object automatically appears as a tab. This is the default method. To automatically load attributes for selected objects: In the Attribute Editor, select List > Auto Load Selected Attributes to turn it on.
USING MAYA: ESSENTIALS 225
USING MAYA EDITORS | 9 Using the Attribute Editor
Note If you select more than one item, Maya automatically updates the most recently selected one (that is, the most recent one in the pick list).
Loading attributes manually If Auto Load Selected Attributes is turned off, after selecting an object, you must manually load the object’s attributes into the Attribute Editor to view and edit them. To manually load attributes for selected objects: •
In the Attribute Editor, select List > Load Selected Attributes. or
•
Click the Load Attributes button at the bottom of the Attribute Editor.
Loading attributes from the Selected/Object menu By default, the menu that appears beside the List menu is the Selected menu. It lists all selected objects in the scene so they are readily available for loading into the Attribute Editor. To list selected objects in the Selected menu, select List > Selected Items. Instead of listing selected objects for easy availability in the Attribute Editor, you can list objects of a specified type. If you choose to do this, the menu that appears beside the List menu becomes the Object menu. To list all objects in the scene of a specified type, select the object category from the List menu (Dynamics, Kinematics, Deformers, Lights, Shading), then select the object. For example, to list all joints in the scene under the Object menu, select List > Kinematics > Joints. To load attributes for objects in the Selected/Object menu: In the Attribute Editor, select Selected > objectName, where objectName is the name of the object you want to load into the Attribute Editor.
Loading attributes from the Focus menu The Focus menu displays all nodes that have been selected in the scene while the Attribute Editor is open. You can think of it as a history of the nodes you’ve viewed in the Attribute Editor. The most recently selected node is at the top of the list. Use it to redisplay the attributes for these nodes. To redisplay node attributes: In the Attribute Editor menu bar, select Focus, then select the node you want to load. The attributes for the selected node appear in the Attribute Editor.
Viewing attributes for different objects at the same time You can simultaneously view attributes for multiple objects by opening multiple copies of the Attribute Editor.
USING MAYA: ESSENTIALS 226
USING MAYA EDITORS | 9 Using the Attribute Editor To view attributes for different objects at the same time: 1
Select the first object and load the attributes into the Attribute Editor. (See "Loading object attributes into the Attribute Editor" on page 225.)
2
In the Attribute Editor, click Copy Tab to create another version of the Attribute Editor. It appears as a separate window with the attributes for the selected object loaded.
3
Select the next object and load the attributes into the original Attribute Editor. Note that the attributes for the first selected object remain loaded in the copy of the Attribute Editor.
4
Repeat steps 2 and 3 for each other object you want to view attributes for simultaneously.
Adding a custom attribute Custom attributes are attributes you optionally add and define from the Add Attribute window. Although custom attributes are dynamically added to an object, we refer to them as custom to distinguish them from the built-in dynamic attributes. Custom attributes have no direct effect on any characteristic of an object in Maya. You can use them to control a combination of other attributes. You might also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes. When you add a custom attribute to an object, it appears in the Extra Attributes section of the Attribute Editor (and in the Channel Box, if you make the attribute keyable). For practical examples of when you would add extra attributes, see Using Maya: Expressions. For details on editing a custom attribute, see "Editing custom attributes" on page 229. For details on deleting a custom attribute, see "Deleting custom attributes" on page 230.
USING MAYA: ESSENTIALS 227
USING MAYA EDITORS | 9 Using the Attribute Editor To create a new attribute definition: 1
In the Attribute Editor, select Attributes > Add Attributes and click the New tab.
2
Set the new attribute options as follows and click the Add button. To view the new attribute controls, expand the Extra Attributes section in the Attribute Editor. Setting new attribute options
Attribute Name
Type the name of the attribute you are adding.
Make Attribute Keyable
Turn this option on to make this attribute keyable. For information about keyable attributes, see Using Maya: Animation. Data Type
Select the data type for the attribute: Vector
Creates a vector attribute consisting of three floating point values.
Float
Creates a floating point attribute.
Integer
Creates an integer attribute.
Boolean
Creates an attribute consisting of an on/off turn.
String
Creates a string attribute that accepts alphanumeric entries as data entry, such as a filename.
Enum
Creates an attribute that accepts selections from an “enumerated” or drop-down list.
USING MAYA: ESSENTIALS 228
USING MAYA EDITORS | 9 Using the Attribute Editor
Note If you select Vector or Integer, you can also set Numeric Attributes. Select a type:
Attribute Type
Scalar
Creates a per object attribute that you can set to a single value that applies to every particle in the object. A vector scalar is considered a single value with three numbers. If you select Scalar, you can specify Minimum, Maximum, and Default values for a Float or Integer attribute.
Array
Creates a per particle attribute. You can set this type of attribute to different values for each particle. If you select Array, you can also create a counterpart initial state attribute by turning on Add Initial State Attribute.
Add Initial State Attribute
Numeric Attributes
Turn on to create a corresponding initial state attribute for the added attribute. Without this corresponding attribute, you can’t save a particle object’s current attribute values for initial state usage. You must write a creation expression if you decide to initialize the custom attribute’s value upon rewinding the animation. If you know you’re going to write a creation expression for a custom attribute, you can set Add Initial State Attribute to off when you add the attribute. Otherwise, set Add Initial State Attribute to on whenever you add a custom per particle attribute.
For scalar attributes, Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value for the attribute. When you're adding a new Enum attribute, you need to define the list of acceptable strings. There are two default strings, "Green" and "Blue", in the Enum Names list that you can change. To change, select Green or Blue and then enter the new string in the New Name text box. To add a new string, click the blank entry below the last list item and type the string in the New Name text box.
Enum Names
Editing custom attributes You can edit custom (or dynamic) attributes from either the main menu (Modify > Edit Attribute) or from the Attribute Editor (Attributes > Rename Attributes).You can perform the following editing operations on custom attributes. •
You can rename a custom attribute. Select it in the Attributes list and modify the name in the New Name text box.
•
You can add, remove, or modify minimum and maximum values (for Integer, Float, and Vector type attributes). Select the attribute in the Attributes list and then turn on or off the Has Minimum and Has Maximum checkboxes, as well as type values for these in the corresponding Min/Max text boxes.
•
You can control the display of custom attributes in the Channel Box. Select the attribute in the Attributes list and then turn the Keyable check box on or off. When Keyable is turned on, the custom attribute appears in the Channel Box.
USING MAYA: ESSENTIALS 229
USING MAYA EDITORS | 9 Using the Attribute Editor •
You can change Enum strings. Select the Enum attribute in the Attributes list and modify the strings in the Enum list the same way you created them.
Note String type custom attributes do not appear in the Channel Box, therefore you can’t edit the Keyable check box for them.
Note When you create a Vector type custom attribute, three child attributes are created (nameX, nameY, nameZ, where name is the name of the attribute). For example, if you created a vector attribute named Speed, the children would be SpeedX, SpeedY, and SpeedZ. You can’t access the Numeric Attribute Properties (Keyable and Min/Max) of the parent vector attribute. You have to select a child attribute and modify its Numeric Attribute Properties.
Deleting custom attributes You can delete custom (or dynamic) attributes from either the main menu (Modify > Delete Attribute) or from the Attribute Editor (Attributes > Delete Attributes). You cannot delete built-in dynamic attributes.
Changing node behavior You can improve Maya’s performance by changing node behavior settings. To change node behavior, select the node and expand the Node Behavior section of the Attribute Editor.
Caching
Turn Caching on to temporarily store upstream node evaluations in the cache. When Maya needs these evaluations (as input to the node), it uses the information stored in the cache rather than re-evaluating the upstream node. If no changes have been made to the node, it redraws more quickly. The cache is destroyed when you edit an attribute. Note that caching uses more memory, which could affect Maya’s performance.
Node State
Changing the node state can improve performance. There are six possible node states: Normal
Causes the node to behave normally, according to the defined settings and effects. This is the default.
HasNoEffect
Disables any effects on the node so that fewer calculations are necessary at the time of redraw. Note that the effect will not render until you reset the Node State back to Normal. Maya evaluates the nodes in the node’s history, but not the node itself.
USING MAYA: ESSENTIALS 230
USING MAYA EDITORS | 9 Using the Attribute Editor For example, if you translate a cluster to deform a geometry, then set the Node State of the cluster node to HasNoEffect, the geometry will appear undeformed, as though the translation had not occurred. To view the effect, change the Node State back to Normal. Temporarily hides the node and does not display the results of any input (upstream evaluations) to the node. This can speed the redraw. It is also useful when you have complex scenes and want to edit only one aspect of a node. Blocked nodes do not render.
Blocking
For example, if you have a complex revolved surface and want to edit the curve, but don’t want to wait while the curve redraws, select Blocking and edit the curve. To display the modified revolved surface, reset the Node State to Normal. Note that Blocking has no effect on deformers. If the dependency graph refresh performance setting (Window > General Editors > Performance Settings) is set to Demand or Release, the node will take the Normal state when in the Hypergraph you select Update or release the mouse button.
Waiting-Normal
WaitingHasNoEffect
If the dependency graph refresh performance setting (Window > General Editors > Performance Settings) is set to Demand or Release, the node will take the HasNoEffect state when in the Hypergraph you select Update or release the mouse button.
WaitingBlocking
If the dependency graph refresh performance setting (Window > General Editors > Performance Settings) is set to Demand or Release, the node will take the Blocking state when in the Hypergraph you select Update or release the mouse button.
Setting keys for attributes in the Attribute Editor You can set a key for an object attribute in the Attribute Editor. For details about keys, see Using Maya: Animation. To set a key for one attribute: 1
Select the object.
2
Click the timeline frame number where you want to set the key. Click the timeline
3
In the Attribute Editor, select the attribute value.
4
Type the value of the attribute and press Enter.
5
Right-click the attribute name or text box and select Set Key. This sets the key for the object attribute value.
USING MAYA: ESSENTIALS 231
USING MAYA EDITORS | 9 Using the Attribute Editor
Tip To set a key for all attributes, use the Channel Box. For details, see "Setting keys for attributes from the Channel Box" on page 244.
Linking attributes Maya has a special type of key called a driven key that links one attribute value to another. When you create a driven key, you specify a driver attribute value and a driven attribute value. The value of the driven attribute is locked to a corresponding value of the driver attribute. You can link attributes from the Attribute Editor by right-clicking the attribute text box or label and selecting Set Driven Key. For details, see Using Maya: Animation.
Breaking connections In the Attribute Editor, the text box for an attribute that is connected to an expression, key, or other attribute (for example texture attribute) is displayed in a different color, depending on your color settings. To break a connection: 1
Select the object.
2
In the Attribute Editor, right-click the attribute name or text box and select Break Connections.
Locking attribute values You can lock an attribute value to avoid accidentally changing it later. To lock an attribute: 1
Select the object.
2
In the Attribute Editor, set the attribute value you want to lock.
3
Right-click the attribute name or text box and select Lock Attribute. This locks the value. The Attribute Editor displays locked attributes with a gray background. (This color may not be visible while the text box is selected.) When you’ve locked an attribute, you cannot change its value in the Attribute Editor, Channel Box, the workspace, or elsewhere. You must unlock the attribute to change its value. To unlock an attribute:
1
Select the object.
2
In the Attribute Editor, right-click the attribute name or text box and select Unlock Attribute.
Launching the Expression Editor You can launch the Expression Editor for the attribute selected in the Attribute Editor. USING MAYA: ESSENTIALS 232
USING MAYA EDITORS | 9 Using the Color Chooser To start the Expression Editor: In the Attribute Editor, right-click the attribute name or text box and select Create New Expression. The Expression Editor opens. For details on its use, see Using Maya: Expressions.
Mapping a texture to an attribute value You can map textures to non-keyed attributes in the Attribute Editor. To map a texture to an attribute value: •
In the Attribute Editor, right-click the attribute name or text box and select Create New Texture. or
•
Click the map button beside the attribute . The button changes to indicate there is a connection. Click this button to view the attributes for the connected node. The Create Render Node window opens. For details, see Using Maya: Rendering.
USING THE COLOR CHOOSER The Color Chooser is a color selection tool that launches when you click a color attribute in the Attribute Editor. (It also opens when assigning interface colors in the Colors window; see "Changing color settings" on page 330 for more information.) When you select a new color in the Color Chooser, it becomes the current color, shown in the top left tile of the Color Chooser and also in the color block of the Colors window or Attribute Editor. You can then close the Color Chooser. The Color chooser has several color selection tools. See the following illustration and topics for an explanation.
USING MAYA: ESSENTIALS 233
USING MAYA EDITORS | 9 Using the Color Chooser
Current color
Storage tiles—to store, right-click a tile or click the arrow button
Eyedropper
Color wheel
Sliders (RGB and HSV)
Blend box Palettes (including Adobe palettes)
Using the color wheel and storage tiles The fastest way to select a color is to drag the selector in the color wheel. Once you have the color selected, you can drag the brightness control on the left. Another quick way to select a color is to left click on one of the storage tiles at the top. To store the current color on a tile, right click a tile or click the arrow button.
Using the eyedropper The eyedropper tool lets you grab a color from anywhere on the computer screen, including other applications. Click the eyedropper button, then position the eyedropper cursor anywhere on your screen. Click again to grab the color.
Using the sliders For precise color selection, you can use the color sliders. You can switch between RGB sliders (Red, Green, Blue) or HSV (Hue, Saturation, Value), depending on the color model you want. HSV
In this color model, Hue corresponds to the pure colors of the rainbow, such as yellow, blue, and green. Saturation is the amount of white mixed with the hue to set the intensity of the color. Value is the amount of black mixed with the hue to make it darker. If the Value is 0 (zero), then the color is black, regardless of the values for Hue and Saturation.
RGB
This color model describes how red, green, and blue light combines at different intensities to produce different colors. Using RGB, you can choose which value range you want. 0 to 1
USING MAYA: ESSENTIALS 234
Each component color has a value from 0 to 1.
USING MAYA EDITORS | 9 Using the Color Chooser 0 to 255
Each component color has a value from 0 (zero intensity) to 255 (full intensity). This model is useful because it relates directly to how monitors emit light to create colors. However, it is often hard for people to figure out what the RGB values are for a specific color.
With the A (alpha) slider, you can control the opacity or transparency of the color you choose. Many Maya options already have an alpha or transparency control, but if it does not or you are calling the Color Chooser from the command line, you can use this slider to control the alpha channel.
A (alpha) slider
Using the Blend box The Blend box creates a blend between colors so that you can select a new color from the blended gradient. The following illustration explains how to use it.
1. To set a blend color, click a corner. It’s replaced with the current color in memory.
2. Click anywhere in the blend box to select a blended color.
Using the Palette In the Palette section, you can create and save custom color palettes. You can also open Adobe color palettes (file extension .aco), if it is in one of the following formats: RGB, HSV, CMYK, Lab, or Inverted Lab. (Other formats, such as Pantone, are not supported.) The following illustration highlights the palette components. Choose a palette from the pull-down Left click a cell to select a color ...or... right click a cell to store a color
Click Blend to create a color gradient between a group of cells you selected
Open, Save, and Close palettes
To create a custom palette 1
Select a color using any of the Color Chooser tools, such as the Wheel.
2
Right click on any tile to store the current color there.
3
To create a blended gradient, select several tiles by dragging the mouse, then click Blend. A color gradient is created between the first and last tiles in your selection. For example, as shown below, you may want more color gradations than in the default palette.
USING MAYA: ESSENTIALS 235
USING MAYA EDITORS | 9 Using the Channel Box
Blended tiles
4
When finished assigning colors, click Save and specify the filename. You can save the file in any directory. It is saved in ascii format.
USING THE CHANNEL BOX Like the Attribute Editor, you use the Channel Box to modify an object’s attribute values. The Channel Box is different from the Attribute Editor in that: •
It displays only the keyable attributes for the selected object. (You can make an object keyable, and therefore display in the Channel box by selecting Windows > Channel Control. For information on using Channel Control, see Using Maya: Animation.)
•
You can change multiple attribute values of multiple objects (see "Entering values for attributes" on page 240)
•
It takes up much less space in the window.
•
You can control construction history. The information displayed in the Channel Box varies, depending on what kind of object or component you have selected. If you haven’t selected an object, the Channel Box region is blank.
Displaying the Channel Box The Channel Box appears in the Maya window only if you choose to display it. It appears to the right of the workspace.
Note You can display either the Channel Box or the Attribute Editor in the main Maya window, but not both. To display the Channel Box: 1
Select the object (or component) that has the attributes you want to modify.
2
If the Channel Box is not already displayed, click the Show or hide the Channel Box/ layer Editor button on the Status Line or turn on Display > UI Elements > Channel Box/Layer Editor. The following example shows the attributes of a selected sphere in the Channel Box.
USING MAYA: ESSENTIALS 236
USING MAYA EDITORS | 9 Using the Channel Box
Note Use the Channel Box Bar to switch between the Channel Box and Layer Editor.
Show the Channel Box Show the Layer Editor
Show the Channel Box and Layer Editor
Channel Box Selected object
Object attributes
Object attributes
Displaying object attributes When you select a geometric object, the Channel Box displays these sections:
Section
Usage
objectName
Lists the keyable transform attributes that translate, scale, and rotate the object’s absolute position in the world space. Also shows the object’s visibility attribute.
SHAPES
Lists the names of nodes that define the geometry of the object. Other nodes, such as related particle emitters may be found here.
INPUTS
Lists the names of other nodes that affect this one. Typically, these comprise the “construction history” of the node.
OUTPUTS
Lists the names of the output nodes (nodes that receive data) for this node.
USING MAYA: ESSENTIALS 237
USING MAYA EDITORS | 9 Using the Channel Box If you’ve selected two or more objects, the Channel Box displays the attributes for the last object selected only. To display the attributes in the Channel Box of another selected object, select Object > objectName. Note that edits you make in the Channel Box will affect all selected objects of the same type as the one displayed.
Note When you set an attribute value using an expression or a Key, the attribute text box displays in a different color. (The actual color depends on which color scheme you are using.)
Adding attributes to the Channel Box The Channel Box includes keyable attributes only. To add an attribute to the Channel Box, you must make it keyable. To make an attribute keyable: 1
Select the objects that have the attribute(s) you want to make keyable.
2
Select Window > General Editors > Channel Control and click the Keyable tab. The Channel Control window opens.
3
In the Non Keyable box, select the attributes you want to make keyable. Ctrl- or Shift-click to select more than one attribute.
4
If you selected more than one object, turn on Change all selected objects of the same type to enable the editing of attributes common to the selected objects.
5
Click Move. The selected attributes move to the Keyable box.
6
Click Close. The attributes appear in the Channel Box.
Displaying component attributes If you display attributes of an object component, the Channel Box displays only one section for shape attributes that pertain to the component. For example, suppose you’ve created a NURBS curve with the following CVs:
If you turn on component selection mode (in the main menu bar) and select the CVs, the Channel Box displays this:
USING MAYA: ESSENTIALS 238
USING MAYA EDITORS | 9 Using the Channel Box
You can display the CV values in the Channel Box and enter new values. To display the values, click CVs (click to show) in the Channel Box.
Changing the display format To make more workspace available while you display the Channel Box, you can display abbreviations for the attribute names.
Complete names
Abbreviations
To display attribute name abbreviations: In the Channel Box, select Channels > Channel Names > Short. There are three choices for names: Long displays the full, correct channel name, Short displays the abbreviation, and Nice displays the name in the most readable form.
USING MAYA: ESSENTIALS 239
USING MAYA EDITORS | 9 Using the Channel Box
Tip The Channel Box is set to only show two decimal places of precision. You can increase this precision up to fifteen places by selecting Channels > Settings > Change Precision.
Entering values for attributes With a single entry from your keyboard, you can change the value of: •
a single attribute of one or more objects
•
two or more attributes of the same object
•
two or more attributes of multiple objects Object 1
Object 2
Object 3
Object 4
Scale Y
Scale X Scale Y Scale Z
Scale X Scale Y
Scale X Scale Y
You can set any of these combinations with one text entry. For example, you can enter the value 5 in one text box to change the three attributes for scaling along the X, Y, and Z axis. You can also change the values of several attributes by a relative amount. For example, you can add 3 to the Scale X, Scale Y, and Scale Z attributes.
Tip When you enter a value in the Channel Box, you can press the tab key or one of the Enter (or Return) keys. If you press the Enter key on the numeric keypad, the keyboard focus will stay in the Channel Box. If you press the other Enter key, the keyboard focus will go back to the last selected panel.
Entering an exact value for object attributes You can give one or more attributes an exact value as follows: To change the value of a single attribute of one or more objects: 1
Select the object or objects. For example, select the object from the Outliner or in the workspace. If you select two or more objects, the Channel Box displays only the attributes of the object you selected last.
2
In the Channel Box, click the attribute’s text box. For example, click the Scale X text box.
USING MAYA: ESSENTIALS 240
USING MAYA EDITORS | 9 Using the Channel Box
Click the text box
3
Type the new entry and press Enter. For example, type 5 and press Enter. For a Scale X entry, this sets the X axis scaling of all selected objects to 5 grid units. To change the value of two or more attributes of the same object:
1
Select the object.
2
In the Channel Box, select the desired attribute text boxes. For example, you can click the Translate X text box and drag through to the Translate Z text box. The first box you click is where you enter the value. The other selected text boxes turn black. This lets you know they’re selected in addition to the box where you’ll type the new number.
Drag through adjacent boxes
Tip You can select multiple text boxes: To select several adjacent boxes, drag through them. To add a non-adjacent box to a selection, Ctrl-click the additional box. To select a range of boxes, click the first box and Shift-click the last box. 3
Type the new entry and press Enter. For example, type 5 and press Enter. If X translate, Y translate, and Z translate are selected when you enter 5, all three attributes become 5.
USING MAYA: ESSENTIALS 241
USING MAYA EDITORS | 9 Using the Channel Box To change the value of two or more attributes of multiple objects: 1
Select the objects.
2
In the Channel Box, select the attribute’s text boxes.
3
Type the entry and press Enter.
Entering a relative value for attributes You can change the values of several attributes by a relative amount. For example, you can add 3 to the Scale X, Scale Y, and Scale Z attributes. To do this, you must enter these arithmetic operators in the text boxes:
Arithmetic operator
Operation
Example entry
+=
Adds the entry to the existing value in each selected box
+= 3.5
-=
Subtracts the entry to the existing value in each selected box
-= 3.333
*=
Multiplies the entry to the existing value in each selected box
*= 7
/=
Divides the entry to the existing value in each selected box
/= 3
For example, suppose you’ve selected an object named Ball. Its Scale X and Scale Y attributes are set to 3 and 5 in the Channel Box. If you select the Scale X and Scale Y text boxes, typing += 2 in the text box adds 2 to each value. So Scale X would become 5 and Scale Y would become 7.
Entering values using manipulators By default, when you click an object’s translate, rotate, or scale attribute name (such as Translate X), manipulators appear on the object in the workspace. The manipulators are the same ones displayed with the Move, Rotate, and Scale tools. You can drag the manipulators directly using the left mouse button.
USING MAYA: ESSENTIALS 242
USING MAYA EDITORS | 9 Using the Channel Box If you do not want to display these manipulators, select Channels > Settings, then select either No Manips or Invisible Manips. If you select No Manips, you can only perform these operations from the Channel Box by entering values in the text boxes. If you select Invisible Manips, you perform these operations using the mouse (see "Entering values with the mouse (channel slider)" on page 243) or by entering values in the text boxes. You can also switch between using manipulators, no manipulators, and the mouse (channel slider) using the buttons at the top of the Channel Box.
Standard Manips
Invisible Manips
No Manips
Entering values with the mouse (channel slider) For most attributes in the Channel Box, you can click the attribute name or text box then drag the middle mouse button in the workspace to change its value. Dragging to the right decreases the value, dragging to the left increases the value. You can also press the Ctrl key while dragging for fine control. To use this interactive channel slider, you must set the channel box to use standard or invisible manipulators (Channels > Settings then select Standard Manips or Invisible Manips). If you select Channels > Settings > No Manips, you cannot enter attribute values with the mouse. You must enter the values for these attributes in the text boxes. When you select Channels > Settings > Invisible Manips, the cursor changes to a left and right pointing arrow when you press the middle mouse button, indicating that you are using the channel slider to change values. You can set how quickly the channel slider responds when you drag. Select Channels > Settings, then select Slow, Medium, or Fast or switch these settings using the buttons at the top of the Channel Box.
Slow
Medium
Fast
You can also specify whether the attribute values change linearly as you drag (values increase steadily as you drag), or hyperbolically (values increase more sharply as you drag). Turn off Channels > Settings > Hyperbolic to change the values linearly, and on to change values hyperbolically, or switch the settings using the buttons at the top of the Channel Box.
Linear
Hyperbolic
Entering values for attributes with a pop-up menu For some attributes, a pop-up menu appears when you click the mouse in its text box. You can choose from the selections displayed by dragging the mouse over the desired choice.
USING MAYA: ESSENTIALS 243
USING MAYA EDITORS | 9 Using the Channel Box Example Suppose you add the predefined Node State attribute to a NURBS sphere’s keyable attributes. (You can do this with Window > General Editors > Channel Control.) Node State appears in the list of attributes below the transform attributes.
If you click in the Node State text box, a pop-up menu appears with six choices: Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, WaitingBlocking. Drag the mouse over the desired selection. For information on these states, see "Changing node behavior" on page 230.
Setting keys for attributes from the Channel Box You can set a key for one or more object attributes in the Channel Box. For details about keys, see Using Maya: Animation. To set a key for one attribute: 1
Select the object.
2
Click the timeline frame number where you want to set the key. Click the timeline
3
Click the attribute name to select it. For example, click Translate X.
4
Type the value of the attribute and press Enter. For example, enter 10 and press Enter.
5
In the Channel Box, choose Channels > Key Selected. or Right-click the attribute name or text box and select Key Selected. This sets the key for the object attribute value you specified. Setting a key for all attributes
1
Click the timeline frame number where you want to set the key.
USING MAYA: ESSENTIALS 244
USING MAYA EDITORS | 9 Using the Channel Box 2
Enter values for the desired attributes in the Channel Box. Press Enter after entering the attributes.
3
In the Channel Box, select Channels > Key All. or Right-click the attribute name or text box and select Key All. This sets the key for all the object attribute values displayed in the Channel Box.
Note You can key the same attribute value for two or more objects. Select the objects, click the frame, enter the value in the text box, then select Channels > Key Selected. You can also key multiple attribute values for multiple objects. Follow the instructions in the previous paragraph, only select several attribute text boxes using Ctrl- or Shift-click before typing the numerical entry. To copy keyed attribute values: 1
Select the object.
2
In the Channel Box, select the desired attributes. (You can select either the attribute name, or the attribute text boxes.)
3
Select Channels > Copy Selected. or Right-click the attribute name or text box and select Copy Selected.
4
Select the attributes you want to paste the keyframed values to.
5
Select Channels > Paste Selected. or Right-click the attribute name or text box and select Paste Selected.
Setting breakdown keys for attributes from the Channel Box Breakdowns are a type of key that maintains a proportional relationship with adjacent keys. You can set a breakdown key for an attribute from the Channel Box. For information about breakdowns, see Using Maya: Animation. To set a breakdown for selected attributes: 1
Select the object.
2
Click the timeline frame number where you want to set the breakdown.
3
Select the attributes you want to set breakdowns for.
4
Enter the values of the attributes.
5
Select Channels > Breakdown Selected. or Right-click the attribute name or text box and select Breakdown Selected.
USING MAYA: ESSENTIALS 245
USING MAYA EDITORS | 9 Using the Channel Box To set breakdowns for all attributes: 1
Select the object.
2
Click the timeline frame number where you want to set the breakdowns.
3
Enter the values of the attributes.
4
In the Channel Box, select Channels > Breakdown All. or Right-click the attribute name or text box and select Breakdown All.
Breaking connections from the Channel Box In the Channel Box, the text box for an attribute that is connected to an expression, key, or other attribute (for example texture attribute) is displayed in a different color, depending on your color settings. To break a connection: 1
Select the object.
2
In the Channel Box, select the connected attribute (click the attribute name or text box).
3
Select Channels > Break Connections. or Right-click the attribute name or text box and select Break Connections.
Locking attribute values from the Channel Box You can lock an attribute value to avoid accidentally changing it later. To lock an attribute: 1
Select the object.
2
In the Channel Box, click the attribute name.
3
If you need to set the attribute value before locking it, type a value and press Enter.
4
In the Channel Box, select Channels > Lock Selected. or Right-click the attribute name or text box and select Lock Selected. This locks the value. The Channel Box displays locked attributes with a gray background. (This color may not be visible while the text box is selected.) When you’ve locked an attribute, you cannot change its value in the Channel Box, the workspace, or elsewhere. You must unlock the attribute to change its value.
USING MAYA: ESSENTIALS 246
USING MAYA EDITORS | 9 Using the Channel Box
Tip You can lock two or more attributes at the same time. Ctrl- or Shift-click the attribute names to select them, then select Channel > Lock Selected (or right-click the attribute names and select Lock Selected). To unlock an attribute: 1
Select the object.
2
In the Channel Box, click the attribute name.
3
In the Channel Box, select Channels > Unlock Selected. or Right-click the attribute name or text box and select Unlock Selected.
Launching the Expression Editor from the Channel Box You can launch the Expression Editor for the attribute selected in the Channel Box. To start the Expression Editor: •
In the Channel Box, select Channels > Expressions. or
•
Right-click the attribute name or text box and select Expressions. The Expression Editor appears. See Using Maya: Expressions for details on its use.
Linking attributes from the Channel Box Maya has a special type of key called a driven key that links one attribute value to another. When you create a driven key, you specify a driver attribute value and a driven attribute value. The value of the driven attribute is locked to a corresponding value of the driver attribute. You can link attributes from the Channel Box by selecting the attribute and then selecting Channels > Set Driven Key (or by right-clicking the attribute name or text box and selecting Set Driven Key). For details, see Using Maya: Animation.
Modifying an object’s history (inputs) Use the INPUTS component of the Channel Box to modify an object’s construction history. Since all objects in Maya can be created with “History On,” you can change initial parameters after the fact. In the following example, we change the object’s radius from 0.5 to 0.8, its height from 1 to 2, and its X, Y, and Z subdivisions from 20, 1, and 8 to 18, 2, and 5, respectively. To modify an object’s history: 1
Select the object you want to modify.
USING MAYA: ESSENTIALS 247
USING MAYA EDITORS | 9 Using the Channel Box
Click here to display the boxes
2
Type the new information in the respective boxes and press Enter. Each time you change part of the object’s history, Maya changes the object.
3
To return to the original setting for Subdivision Z, select Edit > Undo or press Ctrl-Z. The object returns to its original scale for Subdivision Z.
4
Repeat for the other boxes.
USING MAYA: ESSENTIALS 248
USING MAYA EDITORS | 9 Using the Outliner
USING THE OUTLINER You can use the Outliner to do these tasks: •
Examine the structure and components of the scene. See "Navigating the Outliner" on page 251.
•
Display shape nodes, connections, and attributes. See "Displaying shape nodes" on page 252.
•
Make an object the child of a parent object. A child adopts attribute changes made to the parent. See "Parenting objects" on page 254.
•
Select and rename an object. See "Selecting and renaming objects" on page 256.
•
Reorder nodes. Reordering a node’s position in the Outliner affects Maya’s evaluation order for the object. See "Reordering nodes" on page 257.
Tip If your scene has many objects or it contains character skeletons, consider using the Hypergraph instead of the Outliner. The Hypergraph displays the scene hierarchy in a graphical format that’s more convenient for complex scenes. See Chapter 10, “Using the Hypergraph.” You can open the Outliner in its own window or in a workspace panel. If you display it in a workspace panel, you see the Maya user interface and the Outliner at the same time without having to reposition the windows. To open the Outliner in its own window: From the menu bar or Hotbox, select Window > Outliner. The Outliner opens. Menu bar
Scene hierarchy
Scale and move the window as needed. To open the Outliner in a workspace panel: From a workspace panel, select Panels > Panel > Outliner.
USING MAYA: ESSENTIALS 249
USING MAYA EDITORS | 9 Using the Outliner Outliner panel items The Outliner’s menu bar selections control what types of objects and other items are displayed in the scene hierarchy. A scene hierarchy is sometimes referred to as a DAG (for Directed Acyclic Graph). The Outliner lists invisible objects, such as the perspective, top, front, and side cameras, in blue text. In a new, empty scene, the Outliner lists only these objects and the default light and object sets. As you add objects to the scene, they appear in the Outliner.
Understanding scene hierarchy terminology A common technique in modeling, rendering, and animating is to work with objects in a hierarchical relationship. To work with a hierarchy you must understand the terminology for describing the relationship of objects. We use the following figure to define common hierarchy terminology:
Parent
An object or other item that controls attributes of one or more children. A parent can also be the child of another parent. In the figure, InnerSolarSystem is a parent of Sun. Sun is a parent of Mercury, Venus, Earth, and Mars. Earth is a parent of Moon.
Child
An object whose attributes are controlled by its parent. A child can be the parent of other children. A child is connected to its parent by an indented right angle line. Sun is a child of InnerSolarSystem. Mercury, Venus, Earth, and Mars are children of Sun. Moon is a child of Earth.
Node
A parent, child, or independent object or item. InnerSolarSystem, Sun, Moon, persp, top, and all other entries in the example are nodes.
Hierarchy
The arrangement of all connected nodes that make up a scene or object. The scene hierarchy is made of all nodes in the figure. The Earth hierarchy consists of Earth and Moon.
Transform node
A node that contains an object’s transformation attributes—values for its translation, rotation, and scale. It also holds information on any parent-child relationships it has with other nodes. Transform nodes are also called DAG objects.
USING MAYA: ESSENTIALS 250
USING MAYA EDITORS | 9 Using the Outliner InnerSolarSystem, Sun, Moon, and all other entries in the example are transform nodes. Shape node
A node that holds an object’s geometry attributes or attributes other than the object’s transform node attributes. A shape node is always a child of a transform node. Shape nodes do not appear in the Outliner by default. To display shape nodes, see "Displaying shape nodes" on page 252.
Navigating the Outliner As you examine a scene with many objects, you must scroll or expand the Outliner panel. You’ll also need to expand or collapse the display of nodes. You expand a node to see the child node below it. You collapse a node to simplify your view of the hierarchy. To expand a node: Click the plus sign ( ) to its left. The plus sign ( ) changes to a minus sign ( ). To collapse a node: Click minus sign ( ) to its left. The minus sign ( ) changes to a plus sign ( ). Note that Hierarchies become highlighted if they are collapsed but contain an item that is selected. To expand a node’s entire hierarchy: Shift-click the plus sign ( ) to its left. The plus sign ( ) changes to a minus sign ( ). If your scene has many objects in a complex hierarchy, you might need to expand many nodes to find a child. To find the node quickly, you can select the object in the workspace and choose a menu entry to expand all nodes necessary to list the object.
Tip To select Outliner menus more conveniently from a pop-up menu, click the right mouse button in the Outliner window. To split the Outliner window: You can split the Outliner window in order to see either end of a long list. To split the window, click the separator at the bottom of the window and drag it up. Restore full display by dragging the separator back to the bottom. As visual cue, moving your cursor over the separator bar changes it to: (UNIX) or (Windows).
Drag the separator bar to split the outliner
USING MAYA: ESSENTIALS 251
USING MAYA EDITORS | 9 Using the Outliner
Displaying shape nodes By default, the Outliner displays only DAG objects in the scene. DAG objects are transform nodes. You can also display shape nodes, the nodes that hold an object’s geometry attributes or attributes other than the object’s transform node attributes. To display shape nodes: In the Outliner, turn on Display > Shapes. Example Suppose you select Create > NURBS Primitives > Sphere to create a sphere. Maya creates a transform node and a shape node. If you turn on Display > Shapes and expand the nurbsSphere1 node, the shape node appears underneath.
Maya gives the nodes the default names shown in the figure. The nurbsSphere1 is the transform node; nurbsSphereShape1 is the shape node. If you rename the transform node, for example, as Bubble, Maya renames the shape node BubbleShape. If you rename the shape node, Maya does not rename the transform node. Maya doesn’t transmit a child’s attribute changes up to its parent.
Note The Display and Show menu settings are saved with a scene file. The menu settings are not saved when you open a new or different scene.
Displaying attributes You can display attributes of the nodes shown in the Outliner. To simplify the Outliner’s appearance, you can also limit the display of attributes to the following categories: •
keyable attributes
•
translate, scale, and rotate attributes
•
attributes connected to an animation curve or expression
•
attributes connected to any controlling node To display all attributes:
1
Select Display > Attributes (Channels) to turn it on. (Make sure you are not showing only selected items by selecting Show > Show All.) A plus symbol ( ) appears to the left of each node.
2
Click ( ) to display the node’s attributes. The ( ) changes to a minus symbol ( ) when the node’s attributes are expanded. You can click the minus symbol to collapse the attributes.
USING MAYA: ESSENTIALS 252
USING MAYA EDITORS | 9 Using the Outliner Some attributes also appear with ( ) to the left. These are compound attributes consisting of two or more attributes. Click ( ) for a compound attribute to see its component attributes. For example, the compound Translate attribute is made of Translate X, Translate Y, and Translate Z attributes. You can’t use the Outliner to change attributes’ values. You can set them in the Channel Box, Attribute Editor, or Attribute Spreadsheet. Note also that you use those tools to set the value of noncompound attributes only. You can set compound attributes (to set the component attributes) only with MEL commands.
Tips To open the Attribute Editor for a node, double-click the icon beside the node name. You can double-click a noncompound attribute to start the Expression Editor with the attribute automatically selected. To display only keyable attributes: 1
Select Display > Attributes (Channels) to turn it on.
2
Select Show > Attributes > Keyable to turn it on. To display only translate, scale, and rotate attributes:
1
Select Display > Attributes (Channels) to turn it on.
2
Select Show > Attributes and turn on one of these:
Rotate
Displays only Rotate attributes.
Scale
Displays only Scale attributes.
Translate
Displays only Translate attributes.
Scale Rotate Translate
Displays only Scale, Rotate, and Translate attributes. 3
Click ( ) to expand the compound Translate, Rotate, or Scale attributes into the component attributes. For example, if you expand the compound Translate attribute, the Outliner displays Translate X, Translate Y, and Translate Z attributes. To display only attributes connected to a controlling node:
1
Select Display > Attributes (Channels) to turn it on.
2
Click ( ) to display the node’s attributes.
3
Select Display > Connected to turn it on. This displays only the attributes whose value is connected to the following types of controlling nodes:
•
keys
•
set driven key
•
constraint
•
motion path USING MAYA: ESSENTIALS 253
USING MAYA EDITORS | 9 Using the Outliner •
expression
•
any other direct connection Example Suppose you create a NURBS sphere named Ball and a NURBS cone named Cone. You write an expression to assign the value of Ball’s translateY attribute to Cone’s translateY attribute. If you select Cone, turn on Display > Attributes (Channels) and Display > Connected, then expand Cone and the Translate attribute, the Outliner displays the following: Only connected attributes are displayed in the list of attributes
To display only attributes connected to anim curves or expressions: Select Show > Attributes and turn on one of these: Driven by Anim Curve
Displays only attributes with an animation curve. This includes attributes animated with keys, set driven keys, constraints, and motion paths. Driven by Expression
Displays only attributes controlled by expressions. To display all attributes again: Select Show > Attributes > Clear Below.
Displaying specific types of nodes To simplify the Outliner’s appearance, you can limit node display to various categories. To display only specific types of nodes: 1
Turn on Display > Shapes or Display > DAG Objects Only, as appropriate.
2
Select Show > Objects > and the type of node. To display all nodes again: Select Show > Objects > Clear Below.
Parenting objects You can make an object the child of a parent object. The child adopts some or all attribute changes made to the parent. For example, suppose you animate a planet to orbit the center of the workspace. If you make a moon the child of the planet, it follows the motion of the planet.
USING MAYA: ESSENTIALS 254
USING MAYA EDITORS | 9 Using the Outliner Though the moon is the child of the planet, you can also give the moon motion that’s independent of the planet. For example, you can make it orbit the planet. If you later change the orbiting motion of the planet, the moon continues to follow the planet’s motion, but stills retains its original orbiting motion. To control multiple objects with one node, you can also create an empty group and make several objects its children. By grouping objects under one node, you can move, shade, apply texture, and do many other actions to all the objects by working with the group node. Example BackTire
FrontTire
1. Create original objects.
Tires
2. Create empty node and name it Tires.
Tires
3. Group objects under Tires.
BackTire FrontTire
4. Move, rotate, shade Tires.
To parent an object in the Outliner: 1
Make sure both objects are visible in the Outliner. If you can’t see both nodes at the same time even after maximizing and scrolling the Outliner, use Edit > Parent in Maya’s main menu bar. In the Outliner, Ctrl-click the children first, then Ctrl-click the parent, then select Edit > Parent.
2
In the Outliner, use the middle mouse button to drag the child node onto the parent node. Use the middle mouse button to drag Moon onto Planet
Moon is now a child of Planet
To parent several objects to a new group node: 1
From the main menu bar, choose Create > Empty Group. A new group node appears in the Outliner named null1. This node is an invisible, empty object.
2
Use the middle mouse button to drag an object node onto the null1 node. The object becomes a child of the null1 node.
3
Repeat this step for other objects to be children of the group.
4
Rename the null1 node to something more meaningful. For example, you might rename a group with four flower petals as flower. The Outliner displays the objects parented to the group node.
USING MAYA: ESSENTIALS 255
USING MAYA EDITORS | 9 Using the Outliner
If you modify the group node attributes, its corresponding member’s attributes are also modified. For example, if you decrease the Y scale attribute for a flower group node, the Y scale attributes of the four petals decrease also. To break the relationship between parent and child: 1
Select the child.
2
From the Maya main menu bar, select Edit > Unparent.
Prefixing hierarchy names You can give the same prefix to all objects within a hierarchy. For example, if you select a parent object and give it a prefix, all objects under that parent will now have the same prefix name. To assign prefix hierarchy names: 1
Select the parent.
2
From the Maya main menu bar, select Modify > Prefix Hierarchy Names.
3
Enter a prefix name in the Prefix Hierarchy window and click OK.
Selecting and renaming objects You can select and rename objects and other nodes in the Outliner. Selecting an object in the Outliner is useful when the workspace is crowded with objects. You can give two nodes the same name, but only if each has a different parent (as in the following example).
To select an object: 1
Scroll to find the node that represents the object or component.
2
Click the node to select it. The node is highlighted in the scene to indicate it is selected. To select a set: Select Display > Select Set Members. The set members are selected in the Outliner and in the workspace.
USING MAYA: ESSENTIALS 256
USING MAYA EDITORS | 9 Using the Outliner To deselect an object: Click an empty spot in the Maya workspace. (You can also click below the last item in the Outliner.) When you deselect a node, its highlighting turns off. To rename an object: 1
Double-click the name of the object in the Outliner.
2
Enter the name in the text box.
Reordering nodes You can automatically sort the nodes or you can reorder the position of nodes in the Outliner. For example, to make the node’s Outliner position correspond to its spatial position in the workspace. Be aware that reordering an object’s position in the Outliner might may affect its behavior or appearance in your scene. Reordering a node’s position in the Outliner affects Maya’s evaluation order for the object. Maya evaluates objects as listed from top to bottom in the Outliner. For example, Maya typically renders nodes in the order they appear in the Outliner. Changing this order changes their rendering order. However, if a node has transparency, Maya puts the node in a delayed render queue. Maya renders objects in the queue after all opaque objects. To sort nodes in the Outliner: Select Display > Sort Order and then select a sort order type. Scene Hierarchy
Displays objects in the order of the scene hierarchy.
Alphabetical Within Type
Displays objects in alphabetical order by DAG object name. To reorder a node in the Outliner: Use the middle mouse button to drag the node to another position. As you drag, a horizontal line appears in the Outliner that indicates where the dragged node will be positioned. Release the mouse button at the desired position. Example Suppose you created a scene containing several of the solar system’s planets, including earth. As you add each planet, the Outliner adds a node representing the planet. Maya puts each new node in the Outliner below existing nodes. The location of the planet nodes in the Outliner might not represent the spatial relationship of the planets in the workspace as in this example:
USING MAYA: ESSENTIALS 257
USING MAYA EDITORS | 9 Limiting the information shown in editors Here, earth sits further from mercury than mars. In the actual solar system, and in your workspace, this is not true. To make the Outliner reflect the positioning of the earth in the workspace, use the middle mouse button to drag the earth above mars. Maya positions earth below venus and above mars.
LIMITING THE INFORMATION SHOWN IN EDITORS You can limit which information shows in the Outliner, Hypergraph, Graph Editor, Dope Sheet, and Relationship Editor. Each of these editors has a Text Filter box and Show menu (except the Dope Sheet, which has only the Show menu). With these controls, you can limit the display to the following: •
items containing specified text (for example, type spot* to show items beginning with spot)
•
object types (Geometry, NURBS Objects, Polygon Objects, Subdiv Objects, Cameras, Joints, IKHandles, Characters, Sets, Lights, Materials, Textures, Renderable Objects, Shading Groups, Partitions)
•
attribute types (Hidden, Driven by Anim Curve, Driven by Expression, Keyable, Rotate, Scale, Translate, Scale Rotate Translate)
Filter on/off icon
Text Filter box
For details, see the next topic, "Limiting the display" on page 259. Also, using the Show menu, you can also do the following: •
"Showing all items not currently displayed" on page 260
•
"Storing your restrictions" on page 260
•
"Controlling display of auxiliary nodes" on page 262
USING MAYA: ESSENTIALS 258
USING MAYA EDITORS | 9 Limiting the information shown in editors
Limiting the display You can limit the amount of information shown in the Outliner, Hypergraph, Graph Editor, and Relationship Editor by selecting the object types and attribute types you want shown. You can show items containing specified strings. You can also store your selections for later use. When you limit the display in the editor, the icon beside the Text Filter box changes. All objects and attributes show Filtered display (only objects and attributes of selected types or containing specified text show)
When you have a filter active, you can revert to showing all objects by clicking the filtered display icon ( ).
Limiting the display to items containing specific text Use the Text Filter box to limit the display to all objects and attributes with names containing the text string you type. Type the string in the box and click Enter. This box is case sensitive. For example, typing nurbs will yield different results than typing NURBS. Use the asterisk (*) wildcard to match any number of characters in the string. For example, to show all items with names starting with nurbs, type nurbs* in the text filter box and press Enter. Use the question mark (?) wildcard to match a single character. For example, to show items bodyFur and bodyfur (remember, the box is case sensitive), type body?ur and press Enter.
Limiting the display to selected objects You can limit the display to any combination of the following objects: Geometry, NURBS Objects, Polygon Objects, Subdiv Objects, Cameras, Joints, IKHandles, Characters, Sets, Lights, Materials, Textures, Renderable Objects, Shading Groups, and Partitions. To limit the display to objects of a specified type: Select Show > Objects, then select the items you want to display (turn them on). Only the items you select will display. If you do not want an object type to show, turn it off. To clear the list so that no restrictions are placed on what displays (in effect, you are removing the object filter), select Show > Objects > Clear Below.
Limiting the display to selected attributes You can limit the display to any combination of the following attributes: Hidden, Driven by Anim Curve, Driven by Expression, Keyable, Scale, Rotate, Translate, and Scale Rotate Translate. In the Relationship Editor you can limit the display of attributes of a specific type when character editing only. In the Outliner, you can limit the display of attributes of a specific type only if Display > Attributes (Channels) is turned on. You cannot limit the attribute display in the Hypergraph. USING MAYA: ESSENTIALS 259
USING MAYA EDITORS | 9 Limiting the information shown in editors To limit the display of attributes of a specified type: Select Show > Attributes, then select the items you want to display (turn them on). Only the items you select will show. If you do not want an attribute type to show, turn it off. To clear the list so that all attributes display (in effect, you are removing the attribute filter), select Show > Attributes > Clear Below.
Limiting the display of object or attribute types based on the selected items Instead of limiting the display using the Objects and Attributes menus, you can limit the display to all objects or attributes of the same type as the selected (highlighted) objects or attributes by selecting Show > Show Selected Type(s). You must first select objects or attributes (in the Outliner or workspace) to make this command available.
Applying custom display restrictions If you saved your display restrictions (see "Storing your restrictions" on page 260), it appears on the Show > Objects menu or Show > Attributes menu, (depending on the type of items selected). To apply it, simply select it from the appropriate menu (turn it on).
Showing all items not currently displayed You can quickly turn the display to show all items that are not currently displayed. To do this, select Show > Invert Shown to turn it on.
Showing all items (removing restrictions) To quickly remove all restrictions so that all objects and attributes show, click the filtered display icon ( ) or select Show > Show All.
Storing your restrictions You can store your display restrictions for later use. Restrictions that you store in one editor are available for use in the other editors. To store your restrictions: 1
In the Outliner or workspace, select the objects and attributes that are the type you want to show.
2
Select Show > Show Selected Type(s). The editor shows all objects and attributes that are the same type as the selected objects.
3
Select Show > Create Entry. The Create Entry window opens.
USING MAYA: ESSENTIALS 260
USING MAYA EDITORS | 9 Limiting the information shown in editors
If you selected only objects in step #1, only the Objects section appears on the Create Entry window. Similarly, if you selected only attributes in step #1, only the Attributes section appears. 4
In the Objects section (if there is one), turn Entry name on and type a name for the selection list in the adjacent box. This name will appear on the Show > Objects menu.
5
In the Attributes section (if there is one), turn Entry name on and type a name for the selection list in the adjacent box. This name will appear on the Show > Attributes menu.
6
Click Save.
Deleting stored restrictions Deleting a stored restrition removes it from the Show > Objects or Show > Attributes menu. To delete a stored restriction: 1
Select Show > Delete Entry. The Delete Entry window opens.
2
To delete from the Objects list, click the Objects tab, then click the entries you want to delete. or To delete from the Attributes list, click the Attributes tab, then click the entries you want to delete.
3
Click Delete.
USING MAYA: ESSENTIALS 261
USING MAYA EDITORS | 9 Limiting the information shown in editors
Controlling display of auxiliary nodes By default, there are several auxiliary nodes, such as unitConversion, that do not show in the Outliner and other editors. These nodes are hidden to reduce clutter. If you need them to show or you want to hide additional nodes, you can use the Show menu selections: Show Auxiliary Nodes and Auxiliary Nodes. Your Auxiliary Node settings are saved immediately in your preferences, so they affect all editors. They are loaded whenever you start Maya. To show a hidden auxiliary node: •
To see all auxiliary nodes, choose Show > Show Auxiliary Nodes. or
•
To selectively show an auxiliary node, choose Show > Auxiliary Nodes to open the Auxiliary Nodes window. From the list of auxiliary nodes, select the ones you want to show and click Remove From List.
To hide a node: 1
Choose Show > Auxiliary Nodes to open the Auxiliary Nodes window.
2
Select a node from the Available Node Types list and click Add To Hide List (Above).
Note Select Options > Auxiliary Nodes are Hidden in Editors to hide the node types in the top list. This is the same as turning off Show > Show Auxiliary Nodes. Select Options > All Nodes are Shown in Editors to show all node types in Maya editors.
USING MAYA: ESSENTIALS 262
10
USING THE HYPERGRAPH The Hypergraph shows a graphical relationship between components of a scene. You can display two kinds of graphs in the Hypergraph: the scene hierarchy or dependency graph. The scene hierarchy shows the ordered arrangement of objects, lights, cameras, and other items that make up a scene. It’s similar to the Outliner but has more features and visual aids for working with the hierarchy of scene components. Here’s an example of scene hierarchy:
A dependency graph shows the architectural connections between Maya entities that input and output data. For example, it shows connections between shading group elements that create an object’s material appearance.
OPENING THE HYPERGRAPH You can open the Hypergraph in its own window or in a workspace panel. Displaying it in a workspace panel has the advantage of letting you see the Maya user interface and the Hypergraph without having to reposition the windows.
USING MAYA: ESSENTIALS 263
USING THE HYPERGRAPH | 10 Opening the Hypergraph To open the Hypergraph in its own window: From the menu bar or Hotbox, select Window > Hypergraph. The Hypergraph opens. Menu bar Tool bar
Scale and move the window as needed. To open the Hypergraph in a workspace panel: From a workspace panel, select Panels > Panel > Hypergraph. When you display the Hypergraph the first time, the scene hierarchy displays. In subsequent displays of the Hypergraph, the scene hierarchy or dependency graph appears, depending on which was displayed the previous time you closed the window. Note that a scene hierarchy is also referred to as a DAG (directed acyclic graph). If you display the scene hierarchy for a new, empty scene, you’ll see no graph. If you display the scene hierarchy, invisible objects such as the perspective, top, front, and side cameras do not appear in the graph by default. In contrast, the Outliner shows the default cameras unless you choose not to display them.
Note Unless instructions in this chapter state otherwise, make all menu choices from the Hypergraph menu bar. Hypergraph menu bar The Hypergraph menu bar has entries for working with the scene hierarchy or dependency graph. Hypergraph tool bar The tool bar has icons for commonly used Hypergraph menu bar selections. To see the selection that an icon represents, move the mouse pointer over the icon. If po-up help is turned on (Help > Popup Help), the name of the selection appears in a yellow pop-up. Otherwise, look in the help line at the bottom of the Maya window. USING MAYA: ESSENTIALS 264
USING THE HYPERGRAPH | 10 Understanding scene hierarchy terminology
UNDERSTANDING SCENE HIERARCHY TERMINOLOGY A common technique in modeling, rendering, and animation is to work with objects in a hierarchical relationship. To work with a hierarchy you must understand the terminology for describing the relationship of objects. The following figure illustrates a scene hierachy.
Parent
An object or other item that controls attributes of one or more children. A parent can also be the child of another parent. In the figure, InnerSolarSystem is a parent of Sun. Sun is a parent of Mercury, Venus, Earth, and Mars. Earth is a parent of Moon.
Child
An object having attributes controlled by its parent. A child can be the parent of other children. A child in the graph is connected to its parent by an indented right angle line. Sun is a child of InnerSolarSystem. Mercury, Venus, Earth, and Mars are children of Sun. Moon is a child of Earth.
Node
A parent, child, or independent item. This refers generally to any box in the graph. InnerSolarSystem, Sun, Moon, and all other boxes in the graph are nodes.
Subnode
Any node below another node in the hierarchy. The subnodes of InnerSolarSystem are Sun, Mercury, Venus, Earth, Moon, and Mars. The subnodes of Sun are Mercury, Venus, Earth, Moon, and Mars. The subnode of Earth is Moon. Moon and Mars have no subnodes.
Branch
All nodes along a path from a parent to child. A branch from Sun to Moon includes Sun, Earth, and Moon.
Hierarchy
The arrangement of all connected nodes that make up a scene or object. The scene hierarchy is made of all nodes in the figure. The Earth hierarchy consists of Earth and Moon.
USING MAYA: ESSENTIALS 265
USING THE HYPERGRAPH | 10 Using the scene hierarchy A node that contains an object’s transformation attributes—values for its translation, rotation, scale, and so on. It also holds information on parent-child relationships it has with other nodes.
Transform node
InnerSolarSystem, Sun, Moon, and all other boxes shown in the example are transform nodes. A shape node holds an object’s geometry attributes or attributes other than the object’s transform node attributes. Shape nodes do not appear in the scene hierarchy by default. To display shape nodes, see "Displaying special nodes and connections" on page 268.
Shape node
The scene hierarchy and the dependency graph display animated nodes as slanted boxes. If you animate a node with an expression, it displays a regular rectangle rather than a slanted box. All other animation techniques display a slanted box. Specifically, a slanted box indicates that the node has a param curve connected to it.
USING THE SCENE HIERARCHY You can use the scene hierarchy to: •
display special nodes and connections You can display shape, invisible, and underworld nodes. You can also show expression, constraint, and deformer connections that link nodes. See "Displaying special nodes and connections" on page 268.
•
make an object the child of a parent object (known as parenting) A child adopts attribute changes made to the parent. See "Parenting objects" on page 270.
•
reorder the position of nodes (see "Rearranging scene hierarchy nodes" on page 272)
•
create a free-form graph of the hierarchy that suits your visual preference (see "Creating a free-form hierarchy" on page 273)
•
select, rename, and hide objects, and edit attributes of an object (see "Editing objects" on page 286)
•
examine the structure of the scene The Outliner lists the components of a scene as an indented list. The Hypergraph shows the relationship of the objects of the scene graphically. See "Altering the view of a graph" on page 289 for details on navigating the view of the graph.
Expanding scene hierarchy nodes As you examine a scene hierarchy, you can expand or collapse the display of nodes. Collapsing nodes is helpful for lessening clutter in a hierarchy. You expand a node to see nodes below it. For a selected node, you can display: •
subnodes one level below the node
•
all subnodes below a node When you know where a node is in the workspace but you’re not sure of its graph position, you can select the node in the workspace and expand all nodes necessary to display and highlight it.
USING MAYA: ESSENTIALS 266
USING THE HYPERGRAPH | 10 Using the scene hierarchy A selected node is yellow in the scene hierarchy.
Note A node name followed by “...” is abbreviated in the graph. See "Dollying the view" on page 289 to learn how to view the full name. For other graph viewing techniques, see "Altering the view of a graph" on page 289. To expand a node: 1
Select the node. If the node is not visible in the scene hierarchy, select it in the workspace or Outliner.
2
Select: Edit > Expand to expand a node to one level below. Edit > Expand All to expand all subnodes below a node. Edit > Show Selected to display and expand a node not visible in the graph.
A red arrow appears below a node if it’s collapsed.
Expanded node
To collapse a node: 1
Select the node.
2
Select Edit > Collapse.
Tips •
To expand or collapse a node, double-click it.
•
To quickly select Hypergraph menus, click the right mouse button in an empty part of the Hypergraph window.
•
To display context-sensitive Hypergraph menus, move the mouse over a node and click the right mouse button. These menus are also available from the main Hypergraph menus, but they apply only to the selected node.
•
For details on navigating the view of the graph, see "Altering the view of a graph" on page 289.
USING MAYA: ESSENTIALS 267
USING THE HYPERGRAPH | 10 Using the scene hierarchy
Displaying special nodes and connections You can display shape, invisible, and underworld nodes in the scene hierarchy. You can also display expression, constraint, and deformer connections that link different nodes.
Shape, invisible, and underworld nodes By default, the scene hierarchy does not display shape nodes, invisible nodes, or underworld nodes. It displays only transform nodes—nodes that hold attributes and other information on an object’s transformation and parent-child relationships. A shape node holds an object’s geometry attributes or attributes other than the object’s transform node attributes. A shape node is a child of a transform node. A transform node has only one shape node. An invisible node is any object you have hidden using Display > Hide from Maya’s menu bar. The default cameras top, front, side, and persp are also invisible nodes. An underworld node is a pair of nodes below a shape node. When you create a curve on a NURBS surface, Maya generates an underworld transform node and shape node below the shape node of the surface. The CV positions of underworld nodes have UV coordinates on the surface rather than coordinates in world or local space. To display invisible nodes, object shape nodes, or underworld nodes: Turn on these options: •
Options > Display > Shape Nodes
•
Options > Display > Invisible Nodes
•
Options > Display > Underworld Nodes Invisible nodes display with the text grayed. Underworld nodes appear only if you also display shape nodes in the graph. A dotted line in the scene hierarchy indicates a connection to an underworld node. Connections to instanced objects are also indicated by dotted lines.
Note Hypergraph option settings are saved with a scene file. The options are not saved for Maya globally. Example Suppose you select Create > NURBS Primitives > Sphere to create a sphere. Maya creates a transform node and a shape node. The sphere’s shape node holds the mathematical description of the sphere’s shape. The sphere’s transform node holds the sphere’s position, scaling, rotation, and so on. The shape node is the child of the transform node. If you select Options > Display > Shape Nodes in the Hypergraph, the scene hierarchy shows these nodes for the sphere:
USING MAYA: ESSENTIALS 268
USING THE HYPERGRAPH | 10 Using the scene hierarchy
Maya gives the nodes the default names shown in the preceding figure. The transform node is nurbsSphere1, the shape node is nurbsSphereShape1. If you rename the transform node, for example, to Bubble, Maya renames the shape node to BubbleShape. If you rename the shape node, Maya does not rename the transform node. Maya doesn’t transmit a child’s attribute changes up to its parent. Example Suppose you select Create > NURBS Primitives > Sphere to create a sphere. Maya creates a transform node and a sphere node. Suppose you then select Modify > Make Live, then use the Create > CV Curve Tool to draw a curve on the surface of the sphere. If you turn on the display of shape nodes and underworld nodes, the scene hierarchy appears as follows:
Maya gives the nodes the default names shown. The transform node is nurbsSphere1, the shape node is nurbsSphereShape1. The curve1 and curveShape1 nodes are underworld nodes for the curve created on the sphere’s surface. When a curve-on-surface is hard to select in the workspace because of crowding or complex geometry, you can select it easily in the scene hierarchy with underworld nodes displayed.
Expression, constraint, and deformer connections You can display color-coded lines in the scene hierarchy that illustrate nodes connected by an expression, constraint, or deformer. To display nodes connected by an expression, constraint, or deformer: Turn on any or all of these options: •
Options > Display > Expression Connections
•
Options > Display > Constraint Connections
•
Options > Display > Deformer Connections To hide these connections, turn off the appropriate options.
USING MAYA: ESSENTIALS 269
USING THE HYPERGRAPH | 10 Using the scene hierarchy Example Suppose you create a NURBS sphere named Ball and a NURBS cone named Cone. You write an expression to assign the value of Ball’s translateY attribute to Cone’s translateY attribute. The expression links the two values. When you move Ball up or down in the workspace (in a Y-axis direction), Cone moves up or down the same amount. If you select Options > Display > Expression Connections, the scene hierarchy displays this:
This line means attributes in the two nodes are connected, for instance, by an expression.
Tip You can change the color-coding of the connection lines and other important entities by selecting Window > Settings/Preferences > Colors from Maya’s main menu bar and expanding Hypergraph/Hypershade.
Parenting objects You can make an object the child of a parent object. The child adopts some or all attribute changes made to the parent. For example, suppose you animate a planet to orbit the center of the workspace. If you make a moon the child of the planet, it follows the motion of the planet. Though the moon is the child of the planet, you can also give the moon motion that’s independent of the planet. For example, you can make it orbit the planet. If you later change the orbiting motion of the planet, the moon continues to follow the planet’s motion, but stills retains its original orbiting motion. To control multiple objects with one node, you can also create an empty group and make several objects its children. By grouping objects under one node, you can move, shade, apply texture, and do many other actions to all the objects by working with the group node. Example BackTire
FrontTire
1. Create original objects.
Tires
2. Create empty node and name it Tires.
Tires
3. Group objects under Tires.
BackTire FrontTire
USING MAYA: ESSENTIALS 270
4. Move, rotate, shade Tires.
USING THE HYPERGRAPH | 10 Using the scene hierarchy To parent an object: In the scene hierarchy, use the middle mouse button to drag the child node on the parent node. Use the middle mouse button to drag Moon onto Planet.
Moon is now a child of Planet.
If the parent node is not visible in the window, drag the child toward it in the direction of the parent. The graph view scrolls as you drag into the Hypergraph’s window border. To parent several objects to a new node: 1
From the Maya main menu bar, select Create > Empty Group. A new node appears in the scene hierarchy named null1. This node is an invisible, empty object.
2
Use the middle mouse button to drag an object node onto the null1 node. The object becomes a child of the null1 node.
3
Repeat this step for other objects to be children of the group.
4
Rename the null1 node to something more meaningful. For example, you might rename a group containing four flower petals as flower. See "Renaming an object" on page 287. The scene hierarchy displays the objects parented to the group node:
If you modify the group node attributes, its corresponding member’s attributes also are modified. For example, if you scale down a flower group node, the four petals scale down also. To break the relationship between parent and child: With the middle mouse button, drag the child node to an empty spot in the workspace.
USING MAYA: ESSENTIALS 271
USING THE HYPERGRAPH | 10 Using the scene hierarchy
Rearranging scene hierarchy nodes You can rearrange the position of nodes in a scene hierarchy to suit your preferences as follows: •
Move a node’s relative position.
•
Create a free-form scene hierarchy.
•
Display the graph vertically or horizontally. See "Displaying a graph vertically or horizontally" on page 295. Note that Maya updates the scene hierarchy as you modify a scene.
Changing a node’s relative position You can move a node’s relative position vertically or horizontally in a scene hierarchy. You might want to do this, for example, to make the node’s graph position correspond to its spatial position in the workspace. Be aware that rearranging an object’s position in the Hypergraph might alter its behavior or appearance in your scene. Reordering a node’s position in the graph affects Maya’s evaluation order for the object. The evaluation order occurs from left to right and top to bottom for a scene hierarchy displayed in automatic layout. For example, Maya typically renders nodes in the order they appear in the scene hierarchy. Changing this order changes their rendering order. If a node has transparency, however, Maya puts the node in a delayed render queue. Maya renders this queue after all opaque objects. To see the evaluation order for a graph currently in free-form layout, select Options > Layout > Automatic Layout. To return to the free-form layout, select Options > Layout > Freeform Layout. To move a node in the graph: Use Ctrl-middle mouse button to drag the node on top of another node. In a horizontal graph, the dragged node replaces the other node’s position. The other node’s position gets pushed to the right. In a vertical graph, the dragged node replaces the other node’s position. The other node’s position gets pushed downward. Example Suppose you created a scene containing several of the solar system’s planets, including earth. As you add each planet, the scene hierarchy puts a node representing the planet in the graph. Maya puts each new node in the graph to the right of existing nodes. The location of the planet nodes in the graph might not represent the spatial relationship of the planets in the workspace, as in this example:
Here, Earth sits further from mercury than mars. In the actual solar system and in your workspace, this is not true. To make the graph reflect the positioning of the earth in the workspace, use Ctrlmiddle mouse button to drag the Earth on top of Mars. USING MAYA: ESSENTIALS 272
USING THE HYPERGRAPH | 10 Using the scene hierarchy Maya positions the node to the right of Venus and to the left of Mars. Thereafter, you’ll know where to look for Earth in the scene hierarchy.
Creating a free-form hierarchy Maya lets you select a free-form layout for the scene hierarchy to suit your node position preferences. By doing so, you can make the graph’s appearance resemble the appearance of characters or other complex objects in your scene. This helps you find and select components from the hierarchy more quickly. For example, suppose you modeled a human hand. You can customize the graph so the location of its nodes resembles the arrangement of the joints that represent the fingers and palm:
Important Move as few nodes as necessary. When you drag a node to a new position in the graph, you increase the scene’s file size and the Maya processing time needed to work with the scene. When you move a parent node, Maya automatically moves its children with it. Automatically moved children do not increase the file size and processing time. To make a free-form graph: 1
Select Options > Layout > Freeform Layout.
2
Drag nodes to the desired positions in the graph. If the spot where you want to put a node is not visible in the window, drag the node past the edge of the window. The window scrolls in the direction you drag. To drag two or more nodes to another position, click the first node, Shift-click the second node and any other nodes, then drag to the desired position. To drag a parent but not its children, Ctrl-Shift-click the node and drag to the desired position.
USING MAYA: ESSENTIALS 273
USING THE HYPERGRAPH | 10 Using the scene hierarchy To return to the automatically generated layout: Select Options > Layout > Automatic Layout. You can return to your previous free-form graph arrangement by selecting Options > Layout > Freeform Layout. To reset the free-form graph: If you create a free-form graph and you decide you no longer like its appearance, you can reset the graph to the automatic layout. 1
Select Edit > Reset Freeform Layout.
2
Click Yes when asked to confirm your selection.
Displaying a background image with a scene hierarchy You can display a single image of your choice as the background for a scene hierarchy. This is helpful if you want to create a free-form hierarchy that lets you identify and select a character’s joints and nodes more easily. For example, suppose you modeled a human character. Suppose further you rendered an image of the character or used a snapshot utility to capture an image of the character’s skeleton in the workspace. You can display the image in the background of a free-form hierarchy, then position nodes and joints to match the character skeleton. This helps you identify scene hierarchy components more quickly.
USING MAYA: ESSENTIALS 274
USING THE HYPERGRAPH | 10 Using the scene hierarchy
The character skeleton exists behind the scene hierarchy. With this arrangement, you can quickly find nodes, for example, that represents the character’s feet and ankles. To import the background image: 1
Switch to freeform layout, if you are not already in it (Options > Layout > Freeform Layout). Note that you can import an image for the free-form layout only. Having a background image for the automatic layout has no practical purpose. The node positions for the automatic layout are fixed.
2
Select View > Load Background Image. A file browser appears.
3
Select and load the image. The image appears in the scene hierarchy.
4
Dolly or track to bring the image into view.
5
Move nodes to positions on top of the image.
USING MAYA: ESSENTIALS 275
USING THE HYPERGRAPH | 10 Understanding the dependency graph Whenever you display the scene hierarchy in the Hypergraph (in freeform layout), the image appears behind the nodes. To turn the display of the background image off or on: Turn on or off Options > Display > Background Image (in free-form). You can display the image in the background of a free-form hierarchy.
UNDERSTANDING THE DEPENDENCY GRAPH The dependency graph displays connections between nodes in Maya that input and output data. A dependency graph node can represent an object’s geometry, for example, a NURBS sphere. A node can also represent a Maya operation such as a deformer. Inputs and outputs are the connections between nodes, including direction of influence. A dependency graph has no parent-child relationships, only data flow. You can display a dependency graph, for example, to see the data flow between nodes that make up an object’s construction history or shading. All nodes in a scene hierarchy also can be displayed in a dependency graph. However, not all nodes in a dependency can be displayed in a scene graph. For example, a NURBS sphere’s transform and shape nodes appear in a scene graph and therefore can be displayed in a dependency graph. A shading group node or deformer operation node that appears in a dependency graph never appears in a scene hierarchy. A dependency graph node takes input data from one or more other nodes and uses the input to create output data. When you create models, deform objects, animate, process audio, and so on, dependency graph nodes work with the data involved. Although we refer to a dependency graph as a singular graph, be aware you can display two or more independent graphs of connected nodes in the same window. We refer to each independent graph also as a dependency graph. Maya updates the dependency graph as you modify a scene.
USING A DEPENDENCY GRAPH The dependency graph is a tool for programmers who extend Maya capabilities. If you’re an advanced Maya user, you’ll also find it useful to: •
examine render node connections (see "Displaying render node connections" on page 277)
•
examine other node connections (see "Displaying upstream and downstream connections" on page 278)
•
disconnect rendering nodes and other nodes (see "Disconnecting nodes in a dependency graph" on page 281)
•
connect rendering nodes and other nodes (see "Connecting nodes in a dependency graph" on page 282) Avoid disconnecting and connecting nodes unless you have an understanding of Maya’s architecture. You’ll spare yourself frustration tracking down resulting problems.
USING MAYA: ESSENTIALS 276
USING THE HYPERGRAPH | 10 Using a dependency graph See "Editing objects" on page 286 and "Altering the view of a graph" on page 289 for additional details on working with a dependency graph.
Tip As a new user of the Hypergraph, you might be unsure whether you’re looking at the scene hierarchy or a dependency graph. If you see arrows between nodes, you’re looking at a dependency graph. If Scene Hierarchy under the Graph menu is grayed, you’re looking at the scene hierarchy.
Displaying render node connections You can show connections to shading groups, materials, textures, and lights. See Using Maya: Rendering for details. To display render node connections: Select one of these options: •
Rendering > Show Shading Groups
•
Rendering > Show Materials
•
Rendering > Show Textures
•
Rendering > Show Lights
•
Rendering > Show Images Example Suppose you create a NURBS sphere, then use the Hypershade to create and assign a Phong shading group to it. Next you use the Hypershade to create a 2D checker texture and assign it to the Phong node. The Hypershade displays the following contents:
The following dependency graph appears when you select Rendering > Show Shading Groups in the Hypergraph. Connection line
USING MAYA: ESSENTIALS 277
USING THE HYPERGRAPH | 10 Using a dependency graph The connection lines between nodes show connection direction. The connection line originates at a node that outputs data, and the line points to a node receiving the data as input. The preceding figure shows that the flow of output goes from the phong1SG shading group to the renderPartition. Although you can see most of the same nodes in the Hypershade, the dependency graph shows the nodes in a flow diagram. This makes it easy to see the connections between the nodes that make up a shading group. If you move your mouse pointer over a connection line, small white boxes appear next to the input node and output node. The white box next to an input node shows the node’s name and attribute that receives the input.
checker1.outColor
phong1.color
Mouse pointer
The white box next to an output node shows the node’s name and attribute that provides the output. Each node name and attribute is separated by a period, for example, checker1.outColor and phong1.color. In the preceding figure, the outColor attribute of checker1 is output to the color attribute of phong1. In many cases, you must be familiar with Maya internal operation details to understand the node and attribute names you see in the white boxes.
Displaying upstream and downstream connections You can show upstream and downstream connections to a selected node. An upstream connection is a node that provides input to the selected node. A downstream connection is a node that receives input from the selected node. To see connections to most objects, you must select the shape node of the object rather than the transform node. To select a node and display its connections: 1
Select the node. To select a shape node from the scene hierarchy, make sure Options > Display > Shape Nodes is turned on.
Tip You can select an object’s shape node in the scene hierarchy without showing shape nodes. Select the object’s transform node, put the mouse pointer in the Maya or Hypergraph window, then press your keyboard’s down arrow key. The shape node is displayed in the Attribute Editor. Selecting a shape node with this technique is useful for scenes having many nodes, where displaying all shape nodes in the scene hierarchy takes up a lot of panel space. Press the up arrow key to return to the transform node.
USING MAYA: ESSENTIALS 278
USING THE HYPERGRAPH | 10 Using a dependency graph 2
Select one of the following:
•
Graph > Up and Downstream Connections
•
Graph > Upstream Connections
•
Graph > Downstream Connections When you display upstream connections for a node, you see the chain of nodes that provide input to each other all the way to the selected node. When you display downstream connections for a node, you see the chain of nodes that output to each other, all the way through to the end receiving node. Example Suppose you create a wine glass surface by revolving a NURBS curve. The following dependency graph appears when you select the revolved surface’s shape node and select Graph > Up and Downstream Connections:
Note that the graph is shown with a vertical orientation to make the illustration fit on this page. By default, a dependency graph has a horizontal orientation. See "Displaying a graph vertically or horizontally" on page 295. The connection lines between nodes show connection direction. The connection line originates at a node that outputs data, and the line points to a node receiving the data as input. For information on the connection line colors, see "Connection line colors" on page 280. The example graph shows that a curve provides input to the revolve operation node. The revolve operation generates a revolved shape—the wine glass. The revolved shape is connected to initialShadingGroup, which sets the default color of all geometric shapes created in Maya. If you move your mouse pointer over a connection line, small white boxes appear next to the input node and output node. The white box next to an input node shows the node’s name and attribute that receives the input. The white box next to an output node shows the node’s name and attribute that provides the output. Each node name and attribute is separated by a period. In many cases, you must be familiar with Maya internal operation details to understand the node and attribute names you see in the white boxes.
USING MAYA: ESSENTIALS 279
USING THE HYPERGRAPH | 10 Using a dependency graph Note that the dependency graph and scene hierarchy display animated nodes as slanted boxes. If you animate a node with an expression, it displays a regular rectangle rather than a slanted box. All other animation techniques display a slanted box. Specifically, a slanted box indicates Ball has a param curve connected to it. Example Suppose you keyframe the translateX attribute of a NURBS sphere named Ball. If you select Ball’s transform node and display all upstream and downstream connections, this graph appears:
The slanted box indicates Ball’s transform node has been animated. The graph doesn’t indicate which type of animation technique controls the attribute.
Connection line colors The connection lines are color-coded to indicate the type of attribute that is connecting the nodes. In this case, attribute types are single, double, triple, data, and array. See the following table for an explanation.
Default Color
Attribute Type
Example Attributes
Blue
Single
transform.translateX, makeNurbsSphere.radius
Cyan
Double
file.repeatUV, cameraShape.cameraAperature
Green
Triple
transform.translate, lambert.color
Magenta
Data
nurbsSurface.create, makeNurbsSphere.outputSurface
Red
Array
particleShape.position, particleShape.velocity
These colors are the default. You can change them in the Colors window (Window > Settings/Preferences > Colors). Also note that a dotted line in the scene hierarchy indicates a connection to an underworld node or an instanced object.
Dragging nodes into a dependency graph You can drag one or more nodes from the Outliner or Hypershade into the dependency graph to display the dependency graph of the node or nodes. This is ideal for keeping irrelevant nodes out of view when you’re creating and assigning rendering nodes. Any dependency graphs previously in the display remain there. 1
To clear out all graphs from the display, select Edit > Clear View.
USING MAYA: ESSENTIALS 280
USING THE HYPERGRAPH | 10 Using a dependency graph 2
Click Yes to confirm. Note that you can also drag a node into the dependency graph from any part of Maya that lets you drag icons. To drag the node into the dependency graph: Use the middle mouse button to drag the node or nodes into the Hypergraph panel.
Disconnecting nodes in a dependency graph You can use the dependency graph to disconnect nodes. To disconnect nodes: 1
Click the connection line representing the connection in the dependency graph. The connection line turns yellow to indicate it’s selected.
2
Press your keyboard’s Backspace key. The connection line disappears, indicating you disconnected the connection. To update the graph’s layout to display the disconnected nodes more appropriately, select Graph > Layout. Example Suppose you create a NURBS sphere named Ball. You then use the Hypershade to create a Phong E material with red color and assign the resulting phongE1SG shading group node to Ball. The Hypershade displays the following contents.
The following dependency graph appears when you select Rendering > Show Shading Groups, then select the phongE1SG node and select Graph > Up and Downstream Connections.
The graph shows that an attribute of the BallShape node (that represents Ball’s geometry) is input to the phongE1SG shading group node. Ball gets its color from the phongE1SG node. To stop the phongE1SG node from setting Ball’s color, do the following: 1
Click the connection line leading from BallShape to phongE1SG. The connection line turns yellow to indicate it’s selected.
2
Press the Backspace key on your keyboard. USING MAYA: ESSENTIALS 281
USING THE HYPERGRAPH | 10 Using a dependency graph The connection line disappears, indicating you disconnected the nodes. The phongE1SG no longer controls Ball’s color. Ball keeps its previous shading group attribute values. In other words, it stays red and doesn’t become the default gray. If you alter attributes of phongE1SG, though, the changes are not passed to Ball. You can reconnect BallShape to another shading group node to make it control Ball’s shading. For example, you can use the middle mouse button to drag BallShape from the Outliner onto initialShadingGroup. Ball’s color becomes the default gray color set in the initialShadingGroup node. Note that each geometric object you create is connected to the initialShadingGroup node, by default, until you connect it to another shading group.
Connecting nodes in a dependency graph The dependency graph offers convenient ways to connect nodes while you examine the graph. In the dependency graph, you can: •
launch the Connection Editor
•
launch a window that displays input or output attributes you can connect to
•
connect a node’s default output attribute to a node’s default input attribute To launch the Connection Editor: Use Shift-middle mouse button to drag from an output node to an input node. The Connection Editor opens. The Outputs pane of the Connection Editor displays the dragged node and its attributes. The Inputs pane displays the attributes of the destination node. See Using Maya: Rendering for details on the Connection Editor. To create a default connection: Use the middle mouse button to drag the output node onto the input node. Maya connects the default output attribute from the output node to the default input attribute of the input node. Usually, the default input and output attributes are the attributes you would most likely want to connect. If the attributes aren’t compatible, no connection occurs and the Connection Editor appears instead. Example Suppose you create a NURBS sphere and cone named Ball and Cone. You use the Hypershade to create a Phong E material with red color, and a Blinn material with blue color. You assign the resulting phongE1SG shading group node to Ball, and the blinn1SG shading group to the Cone. The Hypershade displays the following contents:
USING MAYA: ESSENTIALS 282
USING THE HYPERGRAPH | 10 Using a dependency graph The following dependency graph appears when you select Rendering > Show Shading Groups, select the phongE1SG and blinn1SG shading groups and select Graph > Up and Downstream Connections.
The graph shows ConeShape connected to the blinn1SG shading group, and BallShape connected to the phongE1SG shading group. You can swap the colors of Ball and Cone by reversing their connections to the shading groups. To reverse connections: 1
Use the middle mouse button to drag ConeShape onto phongE1SG. This reconnects the default output attribute of the ConeShape node to the default input attribute of the phongE1SG node. Cone becomes red.
2
Use the middle mouse button to drag BallShape onto blinn1SG. This reconnects the default output attribute of the ConeShape node to the default input attribute of the phongE1SG node. Ball becomes blue.
Tip Select Rendering > Create Render Node to create a new material, texture, or light. You can then connect to the new node using the dependency graph. Example Suppose you create a NURBS sphere named Ball. You then use the Hypershade to create a Phong E material with blue color and assign the corresponding phongE1SG shading group node to Ball to color it blue.
You then create a black and white 2D checker texture, but you haven’t assigned it to an object.
USING MAYA: ESSENTIALS 283
USING THE HYPERGRAPH | 10 Using a dependency graph The Hypershade displays the following contents.
To replace Ball’s blue color with the checker texture, you must use the middle mouse button to drag the texture node onto the shading group. If you select Rendering > Show Shading Groups, you’ll see the shading groups in the scene, but not the textures.
If you select Rendering > Show Textures, you’ll see the textures created in the scene, but not the shading groups.
To drag the checker1 texture onto the phongE1SG shading group, you need to display them in the graph at the same time. Do the following steps: 1
While the checker1 node is displayed in the dependency graph, use the middle mouse button to drag the phongE1SG shading group node from the Hypershade into the Hypergraph window.
2
Select the checker1 and phongE1SG nodes and select Graph > Upstream and Downstream Connections. The dependency graph for the phongE1SG node appears as follows.
3
Use the middle mouse button to drag the checker1 node onto the phongE1SG or PhongE1 node. Maya makes a connection from checker1 to phongE1 and draws a connection line representing the connection:
USING MAYA: ESSENTIALS 284
USING THE HYPERGRAPH | 10 Using a dependency graph
Ball shows a black and white checkerboard texture, rather than blue color. Turn on Shading > Smooth Shade All and Shading > Hardware Texturing to display shading and textures of objects in your workspace.
4
To redraw the graph with better organization of connection lines, select Graph > Layout.
5
Dolly and track to bring the reorganized graph into view:
6
Move the mouse pointer over the connection line between checker1 and phongE1. White boxes appear next to the nodes. They show that the default output outColor attribute of checker1 connects to the default input color attribute of phongE1. Because of this connection, the black and white checker1 texture provides the material color for the phongE1 node and therefore the phongE1SG shading group. An object connected to the phongE1SG shading group receives the black and white checker1 texture. To launch the display of input or output attributes:
1
Drag a connection line to a node. If you drag the side of the line closer to the original output node, you display output attributes of the destination node. If you drag the side of the line closer to the original input node, you display input attributes of the destination node. After you drag a connection line to a node, a pop-up menu displays listing either of the appropriate attributes you can connect to, either input or output. The part of the connection line you drag determines whether you display the node’s input or output attributes.
2
Click the attribute you want to connect to.
USING MAYA: ESSENTIALS 285
USING THE HYPERGRAPH | 10 Editing objects
Updating the layout of a dependency graph When you add or connect nodes in a scene, the dependency graph might place the nodes in a position that isn’t easy to read. If you don’t like the positioning of the added node, you can update the graph’s layout to a default reorganized layout. To update the dependency graph’s layout: 1
Select Graph > Layout. A window opens and asks you to confirm your choice.
2
Click Yes. To return to the scene hierarchy from the dependency graph: Select Graph > Scene Hierarchy.
Clearing the contents of a dependency graph You can clear the display of the dependency graph from the Hypergraph window. This is helpful when you’re looking at connections for one or more nodes, but want to look at unrelated nodes without the clutter of the existing nodes. To clear the contents of the dependency graph: 1
Select Edit > Clear View. A window requesting confirmation appears.
2
Click Yes.
Returning to the scene hierarchy While examining a dependency graph, you can return to the view of the scene hierarchy. To return to the view of the scene hierarchy: Select Graph > Scene Hierarchy.
EDITING OBJECTS There are several ways to edit objects as you’re examining the scene hierarchy or dependency graph. You can: •
select objects
•
add and select an IK handle
•
rename objects
•
hide objects
•
edit a selected node’s attributes
•
add a render node
Selecting objects The scene hierarchy and dependency graph offer a convenient way to select objects or other items in a scene. This is useful when items in the workspace are crowded and overlapping.
USING MAYA: ESSENTIALS 286
USING THE HYPERGRAPH | 10 Editing objects To select an object: 1
Track and dolly the view to find the node that represents the object or component. For example, if your scene has an object named Ball, bring the node representing Ball into view in the scene hierarchy.
2
Click the node to select it. The node changes to yellow.
Click a node to select the object it represents.
To deselect an object: Click an empty spot in the window. When you deselect a node, it becomes gray again.
Adding and selecting an IK handle In a scene having an IK character with a complex, crowded skeleton, you can use the scene hierarchy to easily add an IK handle to a joint chain. This lets you select the handle easily. To add an IK handle: 1
In the Animation menu set, select Skeleton > IK Handle Tool.
2
In the scene hierarchy, select the top node of the joint chain.
3
Shift-select the bottom node of the joint chain. Maya creates an end effector and IK handle for the joint chain.
IK handle icon
To select an IK handle: Click the IK handle icon to the right of the end effector node. The IK handle node and icon turn yellow to indicate you selected it. If you make the IK handle node the child of another node, its location might be hard to find in the graph. The IK handle icon to the right of the end effector at the bottom of the joint chain makes it easy to find.
Renaming an object You can rename an object or other item in the scene hierarchy or dependency graph. You can give two nodes the same name, but only if each has a different parent.
USING MAYA: ESSENTIALS 287
USING THE HYPERGRAPH | 10 Editing objects
RoadBike
FrontTire
MountainBike
BackTire
FrontTire
BackTire
This is allowed.
Bike
Tire
Tire
This is not allowed.
To rename an object: 1
Right-click on the node representing the object and select Rename from the pop-up menu. A small text box appears in the node:
2
Enter the new name.
Hiding an object in the workspace You can use the scene hierarchy or dependency graph to make an object or other item invisible in the workspace. To hide an object: Right-click the node representing the object and select Hide from the pop-up menu. The object disappears from the workspace and the text on the node becomes grayed in the scene hierarchy. To display a hidden object: 1
Select Options > Display > Invisible Nodes. The text on a node representing a hidden object is grayed to indicate it’s invisible in the workspace.
Invisible node
2
Right-click on the node representing the object and select Show from the pop-up menu. The object reappears in the workspace.
Editing an object’s attributes After you select a node in the scene hierarchy or dependency graph, you can edit its attributes:
USING MAYA: ESSENTIALS 288
USING THE HYPERGRAPH | 10 Altering the view of a graph To edit a node’s attributes: 1
Select the node in the graph.
2
Select Edit > Attributes. The attributes for the selected node load into the Attribute Editor.
Creating a render node You can launch the Create Render Node window to create a new material, texture, and light. This is convenient when you’re examining the dependency graph for a rendering node. The Create Render Node window is the same window that appears when you select Create > Create Render Node from the Hypershade. To create a render node: Select Rendering > Create Render Node. The Create Render Node window opens. For details, see Using Maya: Rendering.
ALTERING THE VIEW OF A GRAPH A scene hierarchy or dependency graph covers a lot of screen space for complex scenes. For example, you might create a detailed kinematic character that results in thousands of nodes. The following pages describe general navigation techniques for examining a graph. You can use the techniques with a scene hierarchy or dependency graph, unless otherwise noted.
Tracking the view You can move the view of the graph up, down, or sideways. To track the view: In the graph view, use Alt-middle mouse button to drag in the desired direction.
Dollying the view You can enlarge or shrink the view of the graph. To dolly the view: In the graph view, hold down the Alt key and drag the left and middle mouse buttons to the left to shrink the view; drag to the right to enlarge the view.
USING MAYA: ESSENTIALS 289
USING THE HYPERGRAPH | 10 Altering the view of a graph
Note If you dolly away from a graph, the text in node boxes becomes abbreviated. An ellipses (...) appears to the right of the abbreviation. To read the text, move the mouse pointer over the box. The node’s name appears in a pop-up box. The type of node appears in parentheses next to the node name. For example, if you see Ball (transform) in a box, it means the box represents the node named Ball, which is a transform node.
Dollying a region You can dolly the view of a selected region by dragging a selection box around it. To dolly a region: Ctrl-Alt-drag a selection box from left to right around the region.
Drag from left to right
The region in the selection box expands to the center of the Hypergraph window.
To dolly away from a selection: Ctrl-Alt-drag a selection box from right to left around the region.
USING MAYA: ESSENTIALS 290
USING THE HYPERGRAPH | 10 Altering the view of a graph
Fitting an entire graph in the window You can fit an entire graph in the Hypergraph window. This is helpful if you want to see the general organization of nodes. To fit the entire scene graph in the window: Select View > Frame All.
In a large graph, the node names will be too small to read. You’ll need to dolly and track this view to read the names.
Centering selected nodes in the window You can center and expand the view of selected nodes in the Hypergraph window. You might want to do this, for example, when you’re looking at a distant, unreadable view of the graph, and you want to read the name of the currently selected object. To center selected nodes in the window: 1
Click the node or nodes in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
Select View > Frame Selection. Here’s an example.
Selected node
USING MAYA: ESSENTIALS 291
USING THE HYPERGRAPH | 10 Altering the view of a graph
Centering a hierarchy in the window You can center a selected node’s hierarchy in the Hypergraph window. This is useful when you want to focus on a group of related nodes above and below the selected node. This option works only in the scene hierarchy, not in the dependency graph. To center a hierarchy in the window: 1
Click the node in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
Select View > Frame Hierarchy.
Centering a hierarchy branch in the window You can center the branch descending from a node in the Hypergraph window. This is useful when you want to focus on the related nodes below a selected node. This option works only in the scene hierarchy, not in the dependency graph. To center a branch in the window: 1
Click the node in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
Select View > Frame Branch.
Adjusting view transition speed When you change the panel view of a graph, for example, by selecting View > Previous View, Maya dollies from one view to another instantaneously, by default. You can slow Maya’s transition speed between views to make the view change action easier to see. To adjust the transition speed between views: 1
Turn on Options > Transitions > Animate Transitions.
2
Select Options > Transitions > and select one of these speeds:
•
5 Frames
•
10 Frames
•
15 Frames
•
20 Frames 20 Frames dollies slowest, 5 Frames dollies fastest. To return to the default transition speed between views: Turn off Options > Transitions > Animate Transitions.
Setting graph update options Whenever you add or delete an object, rendering node, or other item in the scene, the Hypergraph updates the scene hierarchy and dependency graph, by default. When you select an object in the scene hierarchy or dependency graph, the object is also selected in the workspace, Outliner, and elsewhere in Maya. Also, when you select an object in the workspace, Outliner, and elsewhere in Maya, the object becomes selected in the scene hierarchy or dependency graph. USING MAYA: ESSENTIALS 292
USING THE HYPERGRAPH | 10 Altering the view of a graph These updates slow Maya operation when you work with a complex scene or when you’re examining nodes or dragging nodes to new positions in a free-form hierarchy. You can turn off updating to improve operation speed. To turn off graph updates for created nodes: Turn off Options > Update > On Nodes Creation. If you turn this option on later, the graph displays all previously added and deleted nodes. To turn off Hypergraph selection updates: Turn off Options > Update > On Selection.
Undoing a view of a scene hierarchy As you track, dolly, and make other changes to the view of a scene hierarchy, you may want to return to a previous view. Maya keeps the history of your view changes and lets you return to one or more previous views. After you display a previous view, you can move forward again to other view. To change to a previous view: Select View > Previous View. To see the view before this one, select View > Previous View again. To see the view ahead: Select View > Next View. This works only after you use View > Previous View. To see another view ahead, select View > Next View again.
Using bookmarks for graph views You can bookmark the view of a graph to return to it later. For instance, suppose you dolly the view to see a group of nodes, then bookmark the view. If you dolly to a different view of the scene, you can select the bookmarked view to return to it. Note that the layout of the nodes in a previously bookmarked view changes when you modify a scene as follows: •
add or delete objects.
•
reposition nodes in a free-form hierarchy
•
expand or collapse nodes
•
display invisible, shape, or underworld nodes If a node was selected and entirely visible in the view at the time of bookmarking, when you return to the bookmarked view, the node appears in the same position regardless of how you altered the graph. If no node was selected or if a selected node was only partly visible in the view, returning to the bookmarked view shows the previously displayed region in the graph.
USING MAYA: ESSENTIALS 293
USING THE HYPERGRAPH | 10 Altering the view of a graph Depending on how you altered the graph, the previously displayed nodes might not appear in the bookmarked region anymore. You’ll likely need to create a new bookmark. As you add or delete nodes in a scene, Maya updates the layout of the scene hierarchy and dependency graph. Don’t be alarmed if you notice a node disappears from a previously bookmarked view of the dependency graph. This is usually the result of Maya conforming with its default graph layout.
Tip You can ensure that a bookmarked view displays a node even after you reposition, add, or delete nodes in the scene. To do so, select the node and make sure its entire outline is visible in the view before creating the bookmark. If you select two or more nodes, the bookmarked view displays the first node selected. To bookmark a view: 1
Track and dolly the view as desired.
2
Select Bookmarks > Create Bookmark. The bookmarked view gets a default name, for example, hyperView1. The name appears at the bottom of the Bookmarks menu. To name a view before bookmarking it:
1
Track and dolly the view as desired.
2
Select Bookmarks > Create Bookmark ❒. The Name Bookmark window opens and prompts for the bookmark name.
3
Enter a bookmark name and click OK. To return to a bookmarked view: Select Bookmarks and the name of the bookmark at the bottom of the menu. For example, select Bookmarks > MonsterHead. To delete a bookmarked view:
1
Select Bookmarks > Bookmark Editor. The Bookmarks window opens, showing all bookmarks you added.
2
Select the name of the bookmark.
3
Select Edit > Delete Bookmark. The name of the bookmark is deleted. To rename a bookmarked view:
1
Select Bookmarks > Bookmark Editor. The Bookmarks window opens, showing all bookmarks you added.
2
Select the name of the bookmark.
3
Select Edit > Rename Bookmark. The Rename Bookmark window opens and prompts for the bookmark name.
4
Enter the new name and click OK.
USING MAYA: ESSENTIALS 294
USING THE HYPERGRAPH | 10 Altering the view of a graph You can also rename a bookmark by selecting Bookmarks > name ❒, where name is the name of the bookmark. A prompt window opens and lets you enter the new name.
Displaying a graph vertically or horizontally The scene hierarchy and dependency graph have a horizontal layout by default.
If you prefer to look at a graph upright, you can change to a vertical layout.
To display the graph vertically: Select Options > Orientation > Vertical. To display the graph horizontally: Select Options > Orientation > Horizontal.
Rebuilding the graphs If your scene hierarchy or dependency graph doesn’t seem up to date, you can rebuild the graphs. For example, if you add an object to a scene and it doesn’t appear in the scene hierarchy, rebuild the graphs to make the scene hierarchy aware of the object’s presence. To rebuild the graph: Select Graph > Rebuild.
USING MAYA: ESSENTIALS 295
USING THE HYPERGRAPH | 10 Altering the view of a graph
USING MAYA: ESSENTIALS 296
11
SETS AND PARTITIONS A set is a collection of objects or components. For example, a set might include geometric objects, NURBS CVs, polygonal vertices, lattice points, polygonal facets, or other items. Any item you can select can be in a set. In some instances, Maya creates sets for you as you work with objects. For example, when you add a cluster to several CVs of a NURBS cone, Maya makes a set of the CVs. You can edit and tune such sets to control the area affected by deformation. You can also create a custom set so you can work on its items with a single action. For instance, you can create a set of NURBS objects, then hide or display them as a single entity.
You can edit and tune sets to control deformation of one or more objects.
HOW YOU CAN USE SETS Here are the ways you can use sets: •
simplifying selection of objects or components that you regularly select or have difficulty selecting in the workspace
•
assigning objects to shading groups for rendering
•
moving objects from one layer to another
•
adjusting deformer, skin, and flexor deformation
•
adjusting the weight of cluster, cluster flexor, and skin points If you apply a deformer or skin to a geometric object, Maya creates a set for the geometry’s CVs, vertices, or points. You can add or remove set members to alter the effect of the deformer or skin. See Using Maya: Character Setup for details on deformers and skins.
USING MAYA: ESSENTIALS 297
SETS AND PARTITIONS | 11 Understanding sets For clusters and cluster flexors, you can apply different weights to the set members to increase or decrease deformations at specified points. For skin, you can apply different weights to the set members to increase or decrease skin deformation around the joints. You can create your own set of objects or components for easier selection and transformation. For instance, suppose you need to repeatedly select the same few CVs around the eye of a cyclops to animate the eye. Rather than struggle to select the CVs with a selection box, you might create a set named cyclops_eye for the CVs, then select the set by clicking the set name in the Relationship Editor. When you create a shading group with the Hypershade, Maya creates a set that represents the shading group. You can work with such sets rather than the Hypershade to conveniently assign shading groups to objects. See Using Maya: Rendering for details on shading groups. When you create a layer, Maya creates a set that represents it. You can work with sets rather than layer menu entries to quickly move members from one layer to another. When you add a field to vertices, CVs, or edit points, Maya creates a set named after the field, for instance, uniformFieldShape1Set. The set members are the vertices, CVs, or edit points to which you added the field. You can add or remove the set members to alter the effect of the field. See Using Maya: Dynamics for details on fields.
UNDERSTANDING SETS It’s easiest to learn about sets by examining the display of the Relationship Editor, the main tool for working with sets. You can launch the Relationship Editor by selecting it from the main menu or with other common techniques such as the Hotbox. For more information about the Relationship Editor, see "Using the Relationship Editor" on page 217. To open the Relationship Editor: From the main Maya menu, choose Window > Relationship Editors > Sets. The Relationship Editor opens.
USING MAYA: ESSENTIALS 298
SETS AND PARTITIONS | 11 Understanding sets
Scale and move the window as needed. You can also display the Relationship Editor in a workspace panel by choosing Panels > Panel > Relationship Editor. This lets you see the Maya user interface and the Relationship Editor without having to reposition the windows.
Note Unless instructions in this chapter state otherwise, make all menu choices from the Relationship Editor’s menu bar.
Sets you create When you create a set, the Relationship Editor displays the set’s name and contents. You can apply an operation to a set to affect all its members. Example Suppose you create three NURBS spheres. You can put the spheres in a set as follows: 1
Select the spheres in the workspace, Outliner, or elsewhere.
2
In the Sets panel of the Relationship Editor, select Edit > Create Set. The Relationship Editor displays the newly created set. By default, Maya gives the set the name set1 or something similar. To use your own name rather than the default, choose Edit > Create Set ❒.
3
Click the plus sign (+) next to the set to expand its contents.
USING MAYA: ESSENTIALS 299
SETS AND PARTITIONS | 11 Understanding sets
The set contains nurbsSphere1, nurbsSphere2, and nurbsSphere3. Items indented below a set name are its members. You can select the set to do operations on each of its members. 4
To select the objects in the set, click the set name and select Edit > Select Set Members. This selects the three spheres that are members of the set. With the sphere members selected, you can do operations such as:
•
hide them from the workspace view
•
translate, rotate, and scale
•
start the Attribute Editor, so all three spheres are available for editing there Subsequent topics provide more details on working with sets.
Sets created by Maya A new empty scene has the following default sets: •
defaultLightSet
•
defaultObjectSet (not used)
•
defaultLayer
•
Shading group sets (initialShadingGroup, initialParticleSE) In addition to the default sets, Maya creates sets automatically when you create shaders. It also creates sets automatically when you create deformers, flexors, or when you bind skin (Deformer and skin point sets).
defaultLightSet When you add a light to the scene, the light becomes a member of the defaultLight set by default. Maya keeps all lights in these sets, even when you assign a light to another set.
defaultLayer Each scene has a default display layer that consists of all objects that have not been assigned to any other layer. When you remove an object from a layer, it becomes a member of the default layer.
Shading group sets A new, empty scene has two shading group sets by default: initialShadingGroup and initialParticleSE. These sets control the default shading of objects added to the scene.
USING MAYA: ESSENTIALS 300
SETS AND PARTITIONS | 11 Understanding sets When you add a geometric object to the scene, the object becomes a member of the initialShadingGroup set by default. The shading group colors its members a dull gray. (You can see the default gray color of such objects in the workspace by choosing Shading > Smooth Shade All.) If you create a sphere, for instance, Maya adds the sphere to the initialShadingGroup set.
Member of the set initialShadingGroup
Maya keeps a newly added geometric object in the initialShadingGroup set until you create and assign a different shader to the object. Maya then relocates the object to a set it creates for the shading group you created. You typically won’t do anything directly with the initialShadingGroup set. It’s for Maya’s internal use as you make shading choices. Example Suppose you use the Hypershade to create a Phong material. When you create the node, Maya creates a set named phong1SG. This set represents the Phong shading group. Suppose further you use the Hypershade to assign phong1SG to a geometric object named nurbsSphere1. Maya moves the object from the initialShadingGroup to the phong1SG set.
Member of phong1SG
The object receives its surface shading from the options you set in the Attribute Editor for the phong1SG node. If you were to add a particle object to a scene, it would become part of the initialParticleSE shading group set. This set has the same purpose as initialShadingGroup, only it controls the default shading characteristics of particles rather than geometry. An object can be part of only one shading group set—whether initialShadingGroup, the initialParticleSE, or one you create. By looking at the members of the shading group sets, you can see which objects are shaded by the shading groups you’ve added to your scene. To try out various shaders on different objects, use the middle-mouse button to drag objects from one shading group set to another. USING MAYA: ESSENTIALS 301
SETS AND PARTITIONS | 11 Understanding sets For more details on working with shading groups, see Using Maya: Rendering.
Deformer and skin point sets When you attach a deformer to an object, Maya creates a set from the object’s points. When you bind skin to a skeleton, Maya creates two or more sets for the skin points attached to the joints. (To see these sets, you must select Deformer Set Editing from the drop-down list in the Relationship Editor.) See Using Maya: Character Setup for details on deformers and skin points. Example Suppose you create a NURBS cone, select several CVs, then choose Deform > Create Cluster from the Animation menu to apply a cluster.
Apply cluster to these points
Maya creates a set named cluster1Set or something similar by default.
Applying a cluster creates a set
The set contains the points in the cone controlled by the cluster. In such sets, you can alter deformations by adding and removing points or by editing point weights of existing members. For example, you can add corresponding points from a newly added cone in the scene. The added points deform with the existing points as you translate, rotate, or scale the cluster handle.
USING MAYA: ESSENTIALS 302
SETS AND PARTITIONS | 11 Creating, selecting, and removing sets
CREATING, SELECTING, AND REMOVING SETS The following topics describe how to create, select, and remove a set. Note that binding skin or adding a deformer or flexor to an object automatically creates one or more sets. You don’t need to create a set for such objects. See "Sets created by Maya" on page 300 for details.
Creating sets You can create a set of geometric objects, CVs, vertices, polygonal faces, or other items. To create a set with a default name: 1
Select the objects or items in the workspace, Outliner, or elsewhere. For example, use the Paint Selection Tool (Edit > Paint Selection Tool) to select CVs. If you don’t select any objects, an empty set will be created in the next step. You can add to an empty set later.
2
From Maya’s main menu, select Create > Sets > Set. or From the Relationship Editor, select Set Editing from the drop-down list and select Edit > Create Set in the Sets panel. The set appears with a default name in the Relationship Editor. To create a set and name it:
1
Select the objects or items in the workspace, Outliner, or elsewhere.
2
From Maya’s main menu, choose Create > Sets > Set ❒. or From the Relationship Editor, select Set Editing from the drop-down list and select Edit > Create Set ❒ from the Sets panel. The Create Set Options window opens.
3
Enter the name of the set in the Name text box. For example, enter nurbsObjects.
USING MAYA: ESSENTIALS 303
SETS AND PARTITIONS | 11 Creating, selecting, and removing sets Other options in the window let you add the set to a partition. See "Adding sets to partitions" on page 309 for details. 4
Click Apply and Close. The set appears with the chosen name in the Relationship Editor. If a set or other item in the scene already has the specified name, the new set name will be appended with a number.
Selecting sets You can select a set or the contents of a set. You must select a set to remove or rename it. You must select the contents of the set to apply an action to each member of the set. To select a set: 1
In the right panel of the Relationship Editor, click the name of the set and select Edit > Select Highlighted. You can also select the set in the Outliner or Hypergraph’s dependency graph view. To display set members in the Outliner so you can select them, turn on Display > Set members. To display sets in the Hypergraph’s dependency graph view, select the object shape node associated with the set and choose Graph > Up and Downstream Connections. To select a set’s contents only:
1
In the left panel of the Relationship Editor, click the name of the set.
2
Select Edit > Select Set Members. This selects the contents of the set, but not the set.
Removing sets If you are no longer using a set, you can remove it without removing its members. To remove a set, but not its members: 1
In the Relationship Editor, select Set Editing from the drop-down list.
2
Click the name of the set in the left panel.
3
Select Edit > Delete Highlighted.
Creating sets for quick selection You can create a set of joints, geometry, CVs, materials, or other items for quick selection in the main menu. You might want to do this, for instance, so you can select different animation characters quickly without having to start the Relationship Editor. This is also useful for selecting items not visible in the workspace, for instance, invisible objects. To create a quick select set: 1
Select the objects or items.
2
From the main Maya menu bar, select Create > Sets > Quick Select Set. The Create Quick Select Set window prompts for a set name.
USING MAYA: ESSENTIALS 304
SETS AND PARTITIONS | 11 Editing set membership 3
Enter the set name for the items and click OK. This creates the set and puts its name in the cascading menu to the right of Edit > Quick Select Sets in the Maya main menu. To select items in the quick select set: From the main Maya menu bar, select Edit > Quick Select Sets and the name of the set. This selects the items in the set, not the set itself.
EDITING SET MEMBERSHIP You can add or remove members of a set using the Relationship Editor, the Paint Set Membership Tool, or the Edit Membership Tool. The advantage of the Relationship Editor is that it: •
includes a formatted list of set members and associated objects
•
displays U and V parameters of NURBS curve and surface CVs
•
lets you edit the weight of cluster, cluster flexor, and skin points For information on using the Relationship Editor to add and remove set members, see "Adding and removing relationship members" on page 221. The advantage of the Paint Set Membership Tool is that you can modify which of a deformable object’s points (for example, CVs or vertices) belong to multiple deformer sets by painting the points you want added to, transferred to, or removed from the set, directly on the object. Color feedback makes sets easy to identify. See Using Maya: Character Setup for details. The advantage of the Edit Membership Tool is that you can add and remove set members in the workspace without using another window or panel. This is ideal for quickly altering membership of sets Maya creates for deformers and skin. See Using Maya: Character Setup for details.
ALTERING THE DISPLAY OF SETS You can display all sets in your scene (including character sets, deformer sets, shading groups, and layers) in the Relationship Editor. For information on the options for narrowing or broadening which sets display, so you spend less time scrolling and expanding sets, see the following: •
"Displaying relationships and objects" on page 218
•
"Setting view options" on page 218
•
"Selecting which relationships and objects show" on page 219
USING MAYA: ESSENTIALS 305
SETS AND PARTITIONS | 11 Understanding partitions
UNDERSTANDING PARTITIONS A partition is a collection of related sets. The sets in a partition can have no overlapping members. As you create shading groups, bind skin, and do a few other tasks, Maya creates partitions. It does this to keep the sets separate where an operation would be hindered by overlapping members. You can also create custom partitions to keep your own sets separate.
Partitions you create When you use the Create > Sets > Set menu item to create a set, its members can, by default, exist in any other set you’ve created. In some instances, you might want to prevent two sets from having overlapping members. You can do this by creating a partition and putting the sets in it. Example Suppose you’re animating a cartoon character’s nose as he smiles and laughs. You added a cluster to several CVs for adjusting the nose as he smiles and another cluster to different CVs for adjusting the nose as he laughs. Creating the two clusters creates a set for each group of CVs. Occasionally you want to move CVs from one set to the other, to alter the deformations that occur as you transform the clusters. When you move the CVs from one set to the other set, they remain in the first set. You might not want the CVs in the first set because they add undesirable deformations as you transform the cluster. To avoid this problem, you can create a partition and put both sets in it. The partition prevents one set from having members of another set. When you move the CVs from the first set to the second set, they’re automatically removed from the first set. You can also add a partition to prevent clusters from having overlapping members when you add the cluster with Deform > Create Cluster ❒. See Using Maya: Character Setup for details.
USING MAYA: ESSENTIALS 306
SETS AND PARTITIONS | 11 Understanding partitions
The LaughCVs and SmileCVs sets in the NoseParts partition cannot have overlapping members.
Partitions created by Maya Maya creates partitions in cases where objects or items must be kept separate for correct operation. A new scene has two partitions by default: •
characterPartition
•
renderPartition The characterPartition contains the character sets for each character you create. With all the character sets in the same partition, you can be sure that the attributes in one character set will not be in some other character set. The renderPartition contains the shading group sets explained in "Shading group sets" on page 300. Because you can apply only one shading group per object or per polygonal facet, the rendering partition ensures you can’t accidentally render a single object or polygonal facet with two shading groups. If you rigid bind skin to a skeleton, Maya also creates a partition. The partition has the name joint1skinPartition or something similar. It contains all the skin point sets in your scene. The partition prevents you from assigning skin points to two different joints, which would result in undesirable skin deformations when you manipulate a skeleton. If creating a deformer with the Exclusive option, Maya creates a partition named deformPartition by default. The partition contains all deformer point sets in your scene. It prevents you from assigning points to two different sets, which might result in undesirable deformations when you manipulate the deformers. Because Maya creates partitions for you when it makes sense to do so, you’ll rarely need to create your own partitions. Still, if you find a situation where you need to create one, you can do so as described in the next topic.
USING MAYA: ESSENTIALS 307
SETS AND PARTITIONS | 11 Creating, displaying, and removing partitions
CREATING, DISPLAYING, AND REMOVING PARTITIONS The following procedures describe how to create, display, and remove partitions. To create a partition: 1
Make sure no objects or other items are selected.
2
Select any sets you want to put in the partition. See "Selecting sets" on page 304 for details.
3
To create a partition with a default name, select Create > Sets > Partition on the Maya main menu. or In the Relationship Editor, select Partition Editing from the drop-down list and select Edit > Create Partition in the Partitions panel.
Note To name the partition when you create it, replace step #3 with: Select Create > Sets > Partition ❐ in the Maya main menu or in the Relationship Editor, select Edit > Create Partition ❐. Enter the name of the partition in the Name text box of the Partition Options window and click Apply and Close. To display partitions: In the Relationship Editor, select Partition Editing from the drop-down list. The partitions appear in the left panel. To see the sets a partition contains, click the plus sign (+) beside the partition name. To remove a partition, but not its sets: 1
In the Relationship Editor, select Partition Editing from the drop-down list and click the name of the partition in the left panel.
2
Select Edit > Delete Highlighted. This removes the partition, but not the sets within the partition. To remove a set from a partition:
1
In the Relationship Editor, select Partition Editing from the drop-down list.
2
In the Partitions panel, expand the partition to see the set(s).
3
Click the set you want to remove and select Edit > Remove Highlighted from Partition.
USING MAYA: ESSENTIALS 308
SETS AND PARTITIONS | 11 Adding sets to partitions
ADDING SETS TO PARTITIONS The following procedures describe how to add and move sets to partitions: To add a set to an existing partition when you create the set: 1
Select the objects or items to be put in the set.
2
From Maya’s main menu, select Create > Sets > Set ❒. or In the Relationship Editor, select Set Editing from the drop-down list and select Edit > Create Set ❒ in the left panel. The Create Set Options window opens.
3
Enter the name of the set in the Name text box.
4
To add the set to a partition turn on Only if Exclusive or By Making Exclusive.
5
Select the name of the partition from the Partition pull-down menu.
6
Click the Apply and Close button. If the partition already has a set containing elements of the selected object, when you select Only if Exclusive, Maya doesn’t add the member and instead displays a warning message in the Command Feedback Line. If you select By Making Exclusive, Maya adds the member to the set after removing the member from the set it’s already part of. Maya puts the set in the selected partition. To add a set to a partition:
1
In the Relationship Editor, select Partition Editing from the drop-down list.
2
In the Partitions panel, click the partition you want to add to.
3
In the Objects panel, click the set to be added into the partition. or Select the set in the Outliner and select Edit > Add Selected Items in the Relationship Editor.
USING MAYA: ESSENTIALS 309
SETS AND PARTITIONS | 11 Adding sets to partitions
USING MAYA: ESSENTIALS 310
Image by Kevin Mannens
PART 3
PREFERENCES
12
SETTING PREFERENCES You can use preferences to customize Maya to the way you work. You can change general color definitions, the way manipulators display, and the appearance of the Shelf, menu bars, and panels. This chapter describes how to set preferences in Maya.
SETTINGS/PREFERENCES MENU The Window > Settings/Preferences menu gives you access to the various Maya preferences windows, including: Preferences
See "Preferences window" on page 316 in this chapter.
Tool Settings
Opens the settings for the current tool. See "Specifying tool settings" on page 332 in this chapter. Also see information on the specific tool.
Performance Settings
See "Specifying performance settings" on page 333 in this chapter. Hotkeys
Displays the Hotkey Editor to let you create and edit your own hotkey combinations. See "Assigning hotkeys" on page 362.
Colors
Displays the Colors window to let you specify the color of various components of Maya, including the Hypergraph and the Multilister. See "Changing color settings" on page 330 in this chapter.
Marking Menus
Displays the Marking Menus window to let you edit the marking menus. See "Creating and editing marking menus" on page 351.
Shelves
Displays the Shelves window to let you create and edit shelves. See "Creating and editing shelves" on page 339.
Panels
Displays the Panels window to let you create and edit your own panels. See "Working with Panels and Layouts" on page 367.
Plug-in Manager
Opens the Plug-in Manager to let you load and unload plug-in software and Maya modules. See "Loading and unloading plug-ins" on page 334.
USING MAYA: ESSENTIALS 313
SETTING PREFERENCES | 12 Where Maya stores preferences
WHERE MAYA STORES PREFERENCES Many of the settings that define the Maya user interface are stored in .mel files in the the following directory: ~username/maya/4.0/prefs (UNIX) drive:\Windows\Profiles\username\maya\4.0\prefs (Windows NT) drive:\My Documents\username\maya\4.0\prefs (Windows 2000) Shelves are stored in the shelves subdirectory, icons are stored in the icons subdirectory, and marking menus are stored in the markingMenus subdirectory. When you customize Maya, your new settings are stored in user preference files, so that each time you open Maya, your settings are used instead of the Maya default settings. If you delete a preference file, Maya uses the default settings. Color and hotkey files The following .mel files store settings you have customized using the Colors window and Hotkey Editor. •
userColors.mel – Contains preferences defined on the Active and Inactive tabs of the Colors window.
•
userRGBColors.mel – Contains preferences defined on the General tab of the Colors window.
•
paletteColors.mel – Defines the colors (RGB) making up the index palette in the Active and Inactive tabs of the Colors window.
•
userHotkeys.mel – Contains any hotkeys you have assigned in the Hotkey Editor window.
•
userNamedCommands.mel – Contains all the commands that have hotkeys assigned to them. Default hotbox marking menus The following files define the default Hotbox marking menus.
•
menu_ChangePanelLayout.mel – North
•
menu_ChangePanelType.mel – South
•
menu_ChangeSelectionMask.mel – West
•
menu_CommonModelingPanes.mel – Center
•
menu_ControlPaneVisibility.mel – East User preferences The following files define user preferences.
•
userPrefs.mel – Contains preferences defined in the Preferences window (Window > Settings/Preferences > Preferences).
•
windowPrefs.mel – Defines the default size and position of Maya windows.
USING MAYA: ESSENTIALS 314
SETTING PREFERENCES | 12 Saving preferences using userSetup.mel
SAVING PREFERENCES USING USERSETUP.MEL While you save most Maya user preferences through the user interface, you can also store preferences not stored through the user interface by creating the file userSetup.mel in the following directory: ~username/maya/4.0/scripts (UNIX) drive:\Windows\Profiles\username\maya\4.0\scripts (Windows NT) drive:\My Documents\username\maya\4.0\scripts (Windows 2000) Whenever you launch Maya, the MEL commands in this file run. For example, you could put the following command in the userSetup.mel file: alias djs jointDisplayScale;
This creates an alias named djs, that lets you set the joint size without using the Display > Joint Size menu or typing jointDisplayScale. You can enter the djs alias with a joint size in the Command Line or Script Editor: djs 1.5;
In this example, the joint size is set to 1.5.
Important The scene is cleared of all objects after the commands in the userSetup.mel file are run. Therefore, any scene elements created using the userSetup.mel file will have been removed when Maya comes up. For details about writing MEL scripts, see Using Maya: MEL.
USING MAYA: ESSENTIALS 315
SETTING PREFERENCES | 12 Preferences window
PREFERENCES WINDOW You can set a variety of preferences in the Preferences window (Window > Settings/ Preferences > Preferences). Select a category on the left and set the related preferences on the right.
Saving and reverting changes Your changes to the preferences are saved automatically when you quit Maya or when you click the Save button in the Preferences window. If you need to revert to previous settings, you can use the options under the Edit menu: Revert to Saved and Restore Default Settings. Revert to Saved returns all preferences to the settings when you last saved. Restore Default Settings returns all preferences to the default settings.
Tip For your preference changes to take effect, make sure you click Save.
Interface Menu Set
This determines which menu set displays in the main Maya menu bar on start-up. The default is Animation.
Show Menubar
Hides or displays the main menu bar and the Panels menu bar.
Show Title Bar
Hides or displays the title bars in the main window and the Script Editor. The title bar includes window control buttons for expanding and collapsing the application.
Windows
Turn on Remember Size and Position so that Maya restores the size and position of all windows when closed and re-opened. If turned off, the Maya windows always display in the center of the screen upon opening.
USING MAYA: ESSENTIALS 316
SETTING PREFERENCES | 12 Preferences window Command Line
Turn on Hold Focus if you want the cursor to stay in the Command Line after you press Enter. Otherwise, the cursor returns to the current window.
Open Attribute Editor
Use this option to specify how the Attribute Editor displays when you open it (such as pressing Ctrl+A). To open the Attribute Editor in a separate window, select In Separate Window. To open the Attribute Editor in the main Maya window, select In Main Maya Window. Open Tool Settings
Expression Editor
Use this option to specify how the Tool Settings display when you open them. To open the Tool Settings in a separate window, select In Separate Window. To open the Tool Settings in the main Maya window, select In Main Maya Window. Select an Expression Editor for editing text.
UI Elements Visible UI Elements
Hides or displays UI elements. You can also control this display from the Display > UI Elements menu. Turns on any elements you want displayed in the Maya main window.
Note You cannot display both the Channel Box and the Attribute Editor in the main Maya window at the same time.
Misc Display Time Window Selection
Window Visibility
Specify a display time for pop-up help. The default is four seconds. Select whether Maya uses the existing help browser window (Use an Existing Help Browser Window) or creates a new one (Create a New Help Browser Window for Maya Help) when you select a Help menu item. Select whether an html browser appears when you select Help > Library, Global Index, Search, Maya Basics, or MEL. The default is on.
When Saving
When Save Panel Layouts with File is turned on, the panel layouts are saved with the scene file. The default is on. (This replaces the former Save File options.)
When Opening
When turned on, this restores saved layouts from the file. The default is on. (This replaces the former Open File options.)
Starting New Scenes
You can specify a layout for new scenes. Keep Current Layout
Keeps the current layout for new scenes.
Use Layout Specified Below Creates new scenes based on the layout selected from the pull-
down menu. Single Perspective View is the default.
USING MAYA: ESSENTIALS 317
SETTING PREFERENCES | 12 Preferences window
Display Fast Interaction
Turns Fast Interaction on to improve performance by displaying fewer geometric entities (such as polygons). The default is off.
Axes
Displays one or both of the XYZ coordinates (view and origin axes). If you disable both choices, no XYZ coordinates appear.
Grid Plane
View Axis
Displays the XYZ coordinates in the bottom left corner of the view. The default is on.
Origin Axis
Displays the XYZ coordinates at coordinates 0, 0, 0. The default is on.
Displays or hides the grid plane. The grid is a 2D plane that represents 3D dimensions in the view. It is useful when you want to animate motion relative to a solid surface. Select Hide to hide the grid. The default is Show. This setting overrides the Display > Grid setting described in "Using a grid" on page 115.
Active Object Pivots
Specify whether to display pivot points. The default is off.
Affected Highlighting
Turns highlighting display on or off. An object associated with or affected by a selected object is highlighted in a different color. The default is on.
Note You can edit this highlight color by selecting Window > Settings/ Preferences > Colors, clicking the Active tab, expanding General, and modifying Active Affected. Wireframe on Shaded
Select how you want to display the wireframe on shaded objects.
Region of Effect
Full
Displays normal resolution wireframes on shaded objects. This is the default.
Reduced
Displays fewer wires on shaded objects.
None
Displays no wires on shaded objects. Performance is enhanced if you select None.
This option lets you turn on or off the region of effect display. Region of effect is the part of an object that will potentially change as a result of moving selected CVs. Note that curves show the region of effect as well as surfaces. The default is on.
USING MAYA: ESSENTIALS 318
SETTING PREFERENCES | 12 Preferences window
Region of Effect on
Region of Effect off
Shade Templates
If on, template objects appear shaded in shaded view. If off, the templated objects appear as wireframes while all other objects appear shaded. The default is off.
Kinematics Joint Size
Changes the display size of skeleton joint sizes. The range is from 0.01 to 5.0.
IK Handle Size
Changes the display size of IK handles. The range is from 0.01 to 5.0.
Animation Steps before Current Frame
Specifies how many ghosted images are drawn at frames before the current frame. Type a value or drag the slider. The default is 3. Steps after Current Frame
Specifies how many ghosted images are drawn at frames after the current frame. Type a value or drag the slider. The default is 3. Frames Per Step
Specifies the number of frames between drawing the ghosts. Type a value or drag the slider. The default is 3.
Manipulators Global Scale
Specifies the size of the manipulators. The range is from 0.10 to 10.00.
USING MAYA: ESSENTIALS 319
SETTING PREFERENCES | 12 Preferences window Handle Size
Specifies the size of the handle. The range is from 4 to 100.
Line Size
Specifies the line thickness size of the rotate manipulator’s rings.
Line Pick Size
Determines the line thickness used when picking the rotate manipulator rings. The pick size should be the same as line size, so you can identify which handle will be picked by the size of the ring.
Previous State Size
Controls the size of the points drawn for a previous feedback. For example, for the Move Tool, an axis is drawn to indicate the previous position, with square points at the end of the axes. This controls the size of the squares. Rotate and scale manipulators also have previous state feedback. This type of feedback is shown only when you drag; it disappears as soon as you release the mouse.
Default Manipulator
You can specify a Default Manipulator option in the Show Manipulator section to control what manipulator, if any, appears when you select the Show Manipulator Tool. The Default Manipulator options include: None
Does not display a manipulator.
Translate
Displays the Move Tool’s manipulator.
Rotate
Displays the Rotate Tool’s manipulator.
Scale
Displays the Scale Tool’s manipulator.
Transform
Displays the Transform (triple) manipulator.
Smart
Checks the first child and if it is a shape displays the history manipulator for the shape. Otherwise displays the Transform (triple) manipulator. This is the default.
USING MAYA: ESSENTIALS 320
SETTING PREFERENCES | 12 Preferences window
NURBS New Curves, New Surfaces
Select whether you want Edit Points, Hulls, and/or CVs on new curves or new surfaces:
Note These options work only on new curves or surfaces, not existing items. Surface Divisions
Curve Divisions Shaded Divisions
Controls the smoothness of an object in a view. It also affects the rendering of newly created surfaces. Enter a value or use the slider. The range is from 0 to 64. The higher the value, the smoother the surface. Controls the smoothness of a curve in a view. Enter a value or use the slider. The range is from 1 to 128. The higher the value, the smoother the curve. Controls how smooth your smooth-shaded object looks. Enter a value or use the slider. The range is from 1 to 64. The higher the value, the smoother the smoothshaded object.
Polygons Vertices
Edges
Highlight
Specify how you want vertices to display: Display
Turns the display of vertices on or off.
Normals
Displays vertex normals on or off.
Backculling
Makes vertices invisible in areas where the normal is pointing away from the camera.
Specify how you want edges to display: Standard
Displays all edges the same (hard or soft).
Soft/Hard
Displays soft edges as dotted lines and hard edges as solid lines.
Only Hard
Displays hard edges only (makes soft invisible).
Specify how you want to highlight polygons: Border Edges Texture Borders
Displays thicker outside edges to make them more visible for certain operations. Displays a thick border to highlight the area a texture affects per polygon or per vertex.
Border Width
Specify the width of the polygon border. The range is from 1 to 10.
Faces
Specify how you want faces to display: Centers
Displays a small square to indicate the face center.
Normals
Shows the normals at the center of each polygon.
Triangles
Displays all polygons as triangles.
USING MAYA: ESSENTIALS 321
SETTING PREFERENCES | 12 Preferences window Non-planar
Show Item Numbers
Displays non-planar faces with a tinted color for easy identification. A non-planar face has vertices that lie outside the plane of the face. By identifying and eliminating non-planar faces, you can avoid unexpected results from reshaping the surface later.
Specify where you want item numbers displayed: at each vertex (Vertices), at each edge (Edges), on each face (Faces), or at each UV (UVs).
Normals Size
Specifies the display size of the normals. The range is from 0.1 to 10.
Color
Turn Colored Shading on to use the Apply Color operation (Edit Polygons > Colors > Apply Color). For details, Using Maya: Polygonal Modeling.
Color Material
These menu options override any existing material channels and replace them with the vertex colors you assign. For all options other than None, lighting affects the object’s shading.
Backface Culling
None
None of the material properties of the shader(s) assigned to the object are used. In this case lighting is also disabled.
Ambient
The ambient material channel of the assigned shader(s) is overridden by the vertex color.
Ambient+Diffuse
The ambient and diffuse material channels of the assigned shader(s) are overridden by the vertex color.
Diffuse
The diffuse material channel of the assigned shader(s) is overridden by the vertex color.
Specular
The specular material channel of the assigned shader(s) is overridden by the vertex color.
Emission
The emission material channel of the assigned shader(s) is overridden by the vertex color.
Specify the display for backface culling: Off
No backface culling occurs. This is the default.
On
Surfaces become invisible in areas where the normal is pointing away from the camera.
Keep Wire
Displays wireframe outlines, but any areas where the normal is pointing away from the camera are hidden.
Keep Hard Edges
Sets backface culling for soft edges only. See Using Maya: Polygonal Modeling for more information on polygonal modeling.
Settings Up Axis
Sets the up axis to Y or Z. The default is Y. See "Orienting the XYZ system" on page 41.
Linear
Sets the unit of measure for operations that use linear values, for example, moving and scaling. The default unit for measuring linear values is centimeters.
Angular
Sets the unit of measure for operations that use an angular value, for example, rotation. The default unit for measuring angular values is degrees.
USING MAYA: ESSENTIALS 322
SETTING PREFERENCES | 12 Preferences window Time
Sets Maya’s internal representation of what one “second” is. For example, in a dynamics simulation, which relies on real world timings, the resulting simulation will produce keys which represent one second as 24 frames (Maya’s default value). It also allows you to compensate for intermediate output devices (for example, Abekas, etc.) which may have different frame rates to your final output (for example, Film). When changed, your animation keys will move in time to match that range. This is only while your time units are on that alternate setting. Returning the time units to your creation setting will return your keys to their original location. The default for measuring time is Film 24fps (24 frames per second).
Note Be sure you set your preferred time unit for a particular session, before creating any animation. This will ensure correct timing of your keyframes, for the final output and final fps setting. Keep Keys at Current Frame
By default when you change the current time unit, the times for any existing keys are modified so that playback timing is preserved. For example, a key set at frame 12film changes to frame 15ntsc when the current time unit is changed to ntsc, since they both represent a key at 0.5 seconds. When this option is on, it will leave the key at 12ntsc that was originally at 12film. The default setting for this option is off. The option will turn itself on once the current time unit is changed. Tolerance The Tolerance value determines the degree of accuracy that is maintained between the original and fit (or interpolated) curves. This setting applies globally to Maya. You can change it on a case-by-case basis. Set the following tolerance options:
Positional
Set the degree of accuracy between the actual positions of the original and interpolated curves.
Tangential
Set the degree of accuracy required to determine if two NURBS objects are to be made tangent across a shared edge or point.
Dynamics Auto Create Rigid Body
Turn this option on to automatically create active rigid bodies when you connect an object to a field (apply a field’s influence to geometry). Run Up To Current Time
If you click a frame in the Time Slider, the correct state of all dynamic objects in the scene is displayed only if Maya performs run-up to calculate each frame prior to that frame. Turn this option on if you want to click frames in the Time Slider. Note that run-up also occurs for hidden objects. Leave run-up turned off if you want to prevent Maya from calculating dynamics when you click in the Time Slider. This is useful in a scene that has both nondynamic objects and complex dynamic objects, where you want the state of nondynamic objects to appear promptly after you click the Time Slider. If you are keying dynamic objects, it’s also useful leave run-up turned off to avoid waiting for run-up calculations that are irrelevant to your keying activities. USING MAYA: ESSENTIALS 323
SETTING PREFERENCES | 12 Preferences window Run Up From
Select one of the following options: Previous Time
If you click a frame higher than the current frame, run-up starts from the prior current time and ends at the frame you click. Select this option if you won’t be changing any attributes of a dynamic object in the scene. This setting lessens the time you’ll spend waiting for run-up. If you click a frame lower than the current frame, run-up starts from the beginning of the animation.
Start Time
Run-up starts from the start frame regardless of where you click in the Time Slider. Select this option if you plan to change any attributes of a dynamic object in the scene. This ensures that you see the correct object states when you click in the Time Slider after modifying an object’s dynamics.
Save Startup Cache for Particles
When this option is turned on (the default), Maya automatically saves the start-up cache for all your particles every time you save the file. Unlike particle disk caches, you don't have to create the start-up cache explicitly every time. See Using Maya: Dynamics for more information.
Files/Projects Default Projects Directory, Always Start in This Project
Use these settings to set up a default projects directory when you create new projects and on startup. Files, Increments, Projects On File Save
File Import Merge
Specify how many files, increments, and projects you want to have listed in each of the File > Recent submenus. Specify the compression mode you want to use when saving an ASCII file: Compressed
Saves files in compressed mode. File compression reduces the sizes of large files so they do not occupy as much space on your hard drive.
Uncompressed
Saves files in uncompressed mode.
As Is
Keeps files in their original compression mode rather than compressing or uncompressing them. As Is is the default.
Specify how you want the Display Layer merged when you import a file. None
All layers read in are put in a new layer, renumbered, and renamed, if necessary to preserve uniqueness.
By Number
Rather than creating a new layer, all layers read in that have the same index number as an existing layer are merged with that layer.
By Name
Rather than creating a new layer, all layers read in that have the same name as an existing layer are merged with that layer.
USING MAYA: ESSENTIALS 324
SETTING PREFERENCES | 12 Preferences window
Keys Auto Key New Curve Default Weighted Tangents
Turn Auto Key on to automatically set keys on keyable attributes of an animated object (including lights, shaders, textures, cameras, and so on). Use this menu to create blends between rotations using quaternions rather than Euler angles. Turn Weighted Tangents on to give animation curve tangents weight. The default is turned off, which means the tangents are non-weighted.
Default In Tangent, Default Out Tangent
Set the default In and Out Tangents to: Spline
Creates an animation curve that is smooth between the key before and the key after the selected key.
Linear
Creates an animation curve as a straight line joining two keys.
Clamped
Creates an animation curve which has the characteristics of linear and spline curves.
Flat
Sets the in and out tangents of the key to be horizontal (with a slope of 0 degrees).
Stepped
Creates an animation curve whose out tangent is a flat curve.
Modeling Output Geometry As
Interaction Mode
These settings determine the type of geometry created from modeling actions such as Revolve, Loft, Extrude, Fillet Blend, and so forth. Setting it here affects all applicable modeling actions. Otherwise, select Mixed to use the individual settings of each modeling action. Specify whether you want certain NURBS modeling commands to behave like actions or tools. An action performs a discreet function on selected objects. A tool lets you manipulate objects until you complete the operation. You may want to change actions to tools as you become proficient at Maya’s NURBS modeling, or it you are accustomed to Power Animator tools. To globally change the applicable modeling tools, choose Everything is a Tool or Everything is an Action. To individually set each command, choose Mixed.
While Duplicating
Select an option to specify how to handle node names while duplicating child nodes. Retain Same Name for Child Nodes The child node name remains the same when the hierarchy is
duplicated. This is the default. Assign Unique Name to Child Nodes The child node is renamed when the hierarchy is duplicated.
USING MAYA: ESSENTIALS 325
SETTING PREFERENCES | 12 Preferences window
Selection Modifiers Modifiers control Maya selection operations. They work with masks to control what is displayed when you select items. You can turn on one or more of the following: Single Marquee Select
Selects the first object in a hierarchy. Click Drag Select
Affects Active
Popup Menu Selection
Lets you perform one-step click-dragging with the transformation tools. You can move one object using the Move tool, then click on a second object and the Move tool displays. This means you do not have to select the object and the Move tool again— you can keep using the Move tool on any subsequent selected object. The default is off. If you change from object to component selection mode, the selected object is not affected. This option lets you select objects and components at the same time. The default is on. When objects overlap in the view, lets you display a pop-up list of the objects so you can select them. Left-click on the overlap area to display the menu. The default is off.
Ignore Selection Priority
Treats all objects with the same priority. The selection order does not matter. The default is off. Expand Popup List
If you turned on Expand Popup List, displays all the pop-up list of objects and everything underneath it in the hierarchy. The default is off.
USING MAYA: ESSENTIALS 326
SETTING PREFERENCES | 12 Preferences window Click Box Size
This option controls the size of the selection area around the mouse pointer, or click box. If you are having problems with selecting objects or components, try adjusting this option. For example, a higher click box size might make it easier to select curves. Increasing the click box size is also useful if you have a high resolution screen display. Polygon Selection
Select Faces with
Specify how you want to select polygonal faces: Center
Select polygonal faces at their center. In other words, you must click the box at the center of the face to select the entire face.
Whole Face
Select the entire face. You can click anywhere on the face, even any face edge, to select it.
Priority You can specify a selection priority for objects and components. By default, NURBS curves have a higher selection priority than surfaces. This means that Maya will select the NURBS curve before the surface when you select geometry that contains both NURBS curves and surfaces. 1 Scroll to select the item you want to prioritize. 2 Select Custom. 3 Enter the priority number.
Snapping With these options, you can control the size region around the mouse pointer that is used for the snap operation. Use Snap Tolerance
Snap Tolerance
When on, the snap region is restricted to a square area around the cursor, defined by the Snap Tolerance option. When off, the snap region is unlimited; you can snap to anything viewable. Controls the size of the snapping area around the cursor when Use Snap Tolerance is on. For example, if you have two curves close together and you try snapping to one of the curves, the object may snap to the wrong curve. To avoid this, try using a small Snap Tolerance value.
Sound Waveform Display
The Waveform Display option allows you to control how much of the sound’s waveform is displayed. Top
Displays only the top half of the sound.
USING MAYA: ESSENTIALS 327
SETTING PREFERENCES | 12 Preferences window
Bottom
Displays only the bottom half of the sound.
All
Displays the full waveform.
Repeat on Hold
Repeats a sound at the current time. You must hold the mouse button down in the Time Slider. For more information on using sound with Maya, see Using Maya: Animation.
Repeat Size
Controls how much sound (in the current time unit) is repeated when you turn on Repeat on Hold.
Timeline Playback Start/ End
Specifies the range of time to use as your time playback range.
Animation Start/ End
Displays the entire range of times available.
Height
Adjusts the height of the time slider. This helps with sound synching (as a soundtrack can be displayed in the time slider.) Select 1x for the default size, 2x to double the size of the slider, and 4x to increase the size four times.
Key Ticks
Keyframe ticks show the location of keys along the time slider. Select None to turn the key tick display off, Active to display only active keys, or Channel Box to display only those keys in the Channel Box.
Options
Turn the following options on or off:
Timecode Offset
Timecode
Changes the default display of time to video standard timecode. Enables the Timecode Offset box so you can supply timecodes to match the timing from videotape.
Snapping
Turns key snapping on or off. When on, the time indicator shows integer values only.
The Timecode Offset lets you specify how time 0 on the Time Slider appears when displaying in Timecode mode. For example, if the Timecode Offset is set to three hours (a value of 03:00:00:00), the Timecode Display would read 03:00:00:00 at time 0.
USING MAYA: ESSENTIALS 328
SETTING PREFERENCES | 12 Preferences window Update View
Specifies whether Maya plays back an animation in All modeling views or only in the active view. The default is Active.
Looping
Specifies how you want Maya to play back an animation. Select Once to play an animation once, then stop. Select Oscillate to play an animation forwards and backwards continuously. Select Continuous to play an animation continuously. Continuous is the default setting.
Playback Speed
Specifies the frame rate for playback. Play every frame – Displays all the frames of your animation. Each frame is updated
completely before proceeding to the next one. Specify the exact rate in the Playback by box. This rate reflects your system’s ability to draw your animation on screen and is not necessarily a real-time playback mode. This is the default setting. Real-time (24 fps) – Plays your animation in real-time. Some frames may be dropped
(not displayed) to execute this in real-time. This depends on your system’s capabilities, the complexity of your scenes, and the display mode for the playback. Half (12 fps) – Plays back at exactly half the speed of real time. Twice (48 fps) – Plays back at twice real-time speed. Other – Enables the Other box so you can enter an exact ratio of playback rate to real-
time. Playback by
If you select Play every frame for the Playback Speed, specify the exact rate in this box. This rate reflects your system’s ability to draw you animation on screen and is not necessarily a real-time playback mode. The default setting is 1.0.
Undo Undo
Select On if you want to be able to undo operations. This is the default. See "Selecting objects" on page 69.
Queue
Select Infinite to perform an unlimited number of undo operations. This option can use a lot of memory. Select Finite to limit the number of undo operations you can perform (specified in the Queue Size box). The default is Finite.
Queue Size
If Finite is the selected Queue setting, specify here the number of undo operations you can perform. The default is 10.
Modules Maya includes a number of different software modules. Each time you start Maya, the software loads all the available licensed modules.
Disabling packages to free up RAM Loading several modules can use a lot of RAM and thus increase the start-up time. To avoid this, you can disable one or more of the modules. You can still load a disabled module by selecting it from the main menu bar.
Disabling modules based on tasks You can also disable various modules based on the specific tasks you are performing. For example, if you are only rendering, you can improve system response time by disabling Dynamics.
USING MAYA: ESSENTIALS 329
SETTING PREFERENCES | 12 Changing color settings
Note If you enable or disable a module, you must exit Maya and restart the software for the changes to take effect.
CHANGING COLOR SETTINGS You may want to make certain components stand out from a scene or object.
Tips Use lighter colors for active components and darker colors for inactive components. If you have made changes to the color settings for a tool and want to restore the original settings, select Edit > Reset to Defaults in the Colors window.
Changing default colors You can change the default colors used by Maya in the Colors window To open the Colors window: Select Window > Settings/Preferences > Colors. The Colors window opens.
The Colors window has three tabs. Each tab allows you to change the default colors for a different set of components. General tab
Use the General tab to change the default colors for components in these areas: 3D Views, User Defined, Ghosts, Heads Up Display, Animation, Animation Editors, Multilister, Hypergraph / Hypershade, Outliner, and Trax Editor.
Active tab
Use the Active tab to change the default colors for components in these areas: General, Objects, Components, Deformers, Manipulators, Animation, and Artisan Brushes.
USING MAYA: ESSENTIALS 330
SETTING PREFERENCES | 12 Changing color settings Use the Inactive tab to set the colors for objects that are not selected. The Inactive tab lets you change the default colors in the following areas or tools: General, Modeling, Objects, Components, Deformers, and Animation.
Inactive tab
To change a default color: 1
Open the Color window (Window > Settings/Preferences > Colors) and click the appropriate tab (General, Active, or Inactive).
2
Expand the component type for the item you want to change.
3
Click on a component’s color to open the Color Chooser. Click here to display the Color Chooser
or In the Active or Inactive tab, click on a component to select it. Maya matches the existing color to one that most closely resembles it on the Index Palette. Double-click the corresponding color on the Index Palette to open the Color Chooser.
Click here...
...then double-click here
4
Select the color in the Color Chooser. See "Using the Color Chooser" on page 233.
5
Click Save.
USING MAYA: ESSENTIALS 331
SETTING PREFERENCES | 12 Specifying tool settings
Note You can change the color value in the Colors window by dragging the slider beside the component color.
SPECIFYING TOOL SETTINGS Tool settings determine how a tool behaves. For example, if you are using the EP Curve Tool, you can specify whether the knot spacing is uniform or chord length. To change a tool’s settings: 1
Do one of the following to open the Tool Settings window: Click the Show or hide Tool Settings button
on the Status Line.
or If the tool is represented by an icon in the Tool Box, double-click it. or If the tool is in a menu, select the option box (❐) located beside the tool. or Select the tool and then select Window > Settings/Preferences > Tool Settings. 2
Make the desired changes and click Close. To return to a tool’s default settings: In the Tool Settings window, click Reset Tool.
Duplicating a tool Using shelves, you can have two tools with the same name but different tool settings. For example, you can have two versions of the Particle Tool. See "To add a tool from the Tool Box:" on page 342.
USING MAYA: ESSENTIALS 332
SETTING PREFERENCES | 12 Specifying performance settings
SPECIFYING PERFORMANCE SETTINGS You use the Performance Settings window to set when you want to refresh the screen when manipulating objects and to control complex operations, such as stitching and deformation. You can use the performance settings to suspend these complex operations during mouse interaction or to completely disable them. This improves performance by reducing the amount of evaluation necessary during interaction and playback. To specify performance settings: Select Window > Settings/Preferences > Performance Settings. The Performance Settings window opens.
Selecting screen refresh options To set when to refresh (or redraw the screen) when manipulating objects, in the Dependency Graph Evaluation section, select one of the following: Drag
Refreshes the display during the drag.
Demand
Refreshes the display only when you release the mouse button and click the Refresh button that appears in the bottom right of the display window.
Release
Refreshes the display only when you release the mouse button. Controlling complex operations on surfaces To control complex operations on surfaces during mouse interaction, in the Surfaces section, select one of the following beside the surface:
On
Performs complex operations during mouse interactions.
Off
Completely disables complex operations during mouse interaction.
Interactive
Suspends complex operations during mouse interaction.
USING MAYA: ESSENTIALS 333
SETTING PREFERENCES | 12 Loading and unloading plug-ins Controlling complex operations on deformers To control complex operations on deformers during mouse interaction, in the Deformers section, select one of the following beside the surface: On
Performs complex operations during mouse interactions.
Off
Completely disables complex operations during mouse interaction.
Interactive
Suspends complex operations during mouse interaction.
Per Node
For Cluster Resolution and Lattice Resolution only, improves redraw performance for individual cluster or lattice deformations by setting the Use Partial Resolution attribute to partial and setting the Percent Resolution on a per node basis. For details, see Using Maya: Character Setup.
Global
For Cluster Resolution and Lattice Resolution only, improves the redraw performance of all cluster or lattice deformations. (You do not need to set the Percent Resolution for each cluster or lattice.) Set Global Cluster Resolution and Global Lattice Resolution to Full, High, Medium, or Low. A Low setting corresponds to a low percentage, and therefore more improved performance. For more information on surfaces, see Using Maya: NURBS Modeling and Using Maya: Polygonal Modeling. For more information on deformers, see Using Maya: Character Setup.
LOADING AND UNLOADING PLUG-INS A plug-in is an add-on module that extends Maya’s capabilities. File translators are plug-ins you use to import and export various file formats. You can create or purchase specialty plug-ins to customize Maya for a specific job. Some features that can be added through plug-ins are: •
file translators
•
tools
•
objects (nodes)
•
MEL commands
•
device drivers The Plug-in Manager identifies which plug-ins are loaded into Maya. If you have a plug-in that you use frequently, you can make sure it is always there. The Plug-in Manager automatically scans all the directories in the plug-in path and lists available plug-in features.
Loading plug-ins You can manually load plug-ins each time you run Maya, or you can have them load automatically when you start Maya.
USING MAYA: ESSENTIALS 334
SETTING PREFERENCES | 12 Loading and unloading plug-ins To load a plug-in: Select Window > Settings/Preferences > Plug-in Manager. The Plug-in Manager window opens.
Click here to load the plug-in
Click here to enable the auto load feature
Selecting loading options Turn on or off the appropriate option beside the plug-in. loaded
Turn on loaded to load the plug-in for the current Maya session.
auto load
Turn on auto load to load the plug-in so that the next time you start Maya the plugin loads automatically.
Displaying plug-in information To view information about a particular plug-in, you must first load it, then click the i button beside the plug-in.
USING MAYA: ESSENTIALS 335
SETTING PREFERENCES | 12 Loading and unloading plug-ins
Click here to display information on the plug-in
Maya displays the following information for a selected plug-in: Name
The name of the plug-in. On UNIX, plug-ins have the extension .so. On Windows, they have the extension .mll.
Path
The location of the file. On UNIX, the default plug-in location is /usr/aw/maya4.0/ bin/plug-ins. On Windows, the default plug-in location is drive:\aw\maya4.0\bin\plug-ins.
Vendor
The manufacturer of the plug-in.
Plug-in Version
The version number of the plug-in.
For API Version
The version of the Maya API (Application Programmer Interface) the plug-in was compiled for.
Note You cannot load a plug-in for any version of Maya that predates the version it was compiled for. Auto Load
Indicates whether the plug-in has been marked for auto load.
Is Loaded
Indicates whether the plug-in is loaded.
Plug-in Features
Displays a list of the features added by the plug-in (for example, commands, dependency nodes, file translators). To display additional plug-ins, click the triangle to open the Other Registered Plugins section.
Unloading a plug-in You can unload a plug-in when you finish with it. To unload a plug-in, turn off the loaded check box next to it.
USING MAYA: ESSENTIALS 336
SETTING PREFERENCES | 12 Loading and unloading plug-ins If you are developing a plug-in, unload it so the source code can be changed, the plug-in recompiled, and then reloaded. Removing references to the plug-in Before you can unload a plug-in, you must first remove all references to it from the Maya scene. Otherwise, Maya converts the plug-in nodes to unknown nodes. For example, if you load a shader plug-in and then unload that same shader plug-in without first removing the special shader node and all of its references in the scene, Maya will display an error message the next time you open that scene. If you try to unload a plug-in while it is in use, a warning message will display. You can then cancel the unload or force it. If you force the unload of a plug-in while it is in use, you cannot reload that plugin’s node. Maya converts the existing nodes to unknown nodes. When you reload plug-ins, you cannot change the type of these existing unknown nodes.
USING MAYA: ESSENTIALS 337
SETTING PREFERENCES | 12 Loading and unloading plug-ins
USING MAYA: ESSENTIALS 338
13
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS This chapter provides detailed information about Maya’s shelves, marking menus, and hotkeys. This information is for advanced users. Shelves are user-customizable areas to hold the actions and tools you use most often. Marking menus are an innovative way of selecting various menu items with the right mouse button. Hotkeys are keyboard shortcuts for commands.
CREATING AND EDITING SHELVES You use shelves to put all the tools or action icons you use in one place. You can drag tools, options, and actions onto a shelf from the Tool Box, a menu, or the Script Editor. From the Maya main window, you can perform the following tasks: •
add shelf items (see "Adding shelf items" on page 342)
•
remove shelf items (see "Removing shelf items" on page 344)
•
move and copy shelf items (see "Moving and copying shelf items" on page 344) You can use the Shelves window to:
•
create and delete shelves (see "Creating and deleting shelves" on page 341 and "Reordering the shelves" on page 345)
•
change shelf icons (see "Changing shelf icons" on page 345)
•
change icon labels (see "Changing icon labels" on page 347)
•
add overlay labels (see "Setting Shelf options" on page 348)
•
change MEL commands associated with an icon (see "Changing MEL command(s) associated with an icon" on page 349) To open the Shelves window: Select Window > Settings/Preferences > Shelves.
USING MAYA: ESSENTIALS 339
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Shelves
Click the Shelves tab to display existing shelves. From here you can create, delete, and rename shelves and change their order. For details, see "Creating and deleting shelves" on page 341 and "Reordering the shelves" on page 345.
Shelf Contents
Click the Shelf Contents tab to display the contents of a specific shelf. From here you can move and delete shelf items, change an item’s label and tooltip, as well as change its icon and icon name. For details, see "Changing shelf icons" on page 345, "Changing icon labels" on page 347, and "Setting Shelf options" on page 348.
Edit Commands
Click the Edit Commands tab to view and edit the MEL code associated with a tool or action. For details, see "Changing MEL command(s) associated with an icon" on page 349.
Label & Tooltips
Specify a brief description of the tool. This description appears with the icon in the icon or text modes, as well as in the tooltip (the pop-up description when the mouse hovers over the icon). For details, see "Changing icon labels" on page 347. (Where it appears is determined by Options menu settings. For details, see "Setting Shelf options" on page 348).
Icon Name
Type a label for the icon. This text appears on top of the icon to distinguish it from other items that use the same icon. Note that the icon name always appears on top of the icon, unlike the label, which you can specify to show or hide.
Change Image
Click this button to change the icon image. For details, see "Changing shelf icons" on page 345.
Save All Shelves Close
Click Save All Shelves to save all changes immediately and write the information to the user shelves directory. The file name for a shelf file has the prefix shelf_. Click Close to accept your changes but not write them to the disk immediately. If your UI preference is to save shelf changes only when explicitly requested, the changes will stay in effect only for the current session. Otherwise your changes will be saved the next time you save a file or quit the application. For information on changing this preference, see "Setting Shelf options" on page 348.
USING MAYA: ESSENTIALS 340
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Creating and deleting shelves In addition to using the default shelves, you can create custom shelves. Use custom shelves to group common or frequently used tools, menu commands, or MEL commands for easy access. To create a shelf: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab. Maya displays the names of all existing shelves.
2
Click New Shelf. Maya displays a default name for the new shelf in the Name text box and adds a new shelf tab in the main Maya window.
Default name for new shelf
3
Double-click the name in the Name text box, type the new shelf name (for example, Kinematics) and then press Enter. Maya adds the name of the new shelf to the Shelves window and the Maya window.
Name of the new shelf
4
Click Save All Shelves.
USING MAYA: ESSENTIALS 341
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Note The shelf tabs must be turned on to see them. In the main Maya window, click the Shelf pull-down menu and select Shelf Tabs to turn them on.
To delete a shelf: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab. Maya displays the names of all existing shelves.
2
Select the shelf you want to delete, then click Delete Shelf. (You do not have to delete any of the associated icons before deleting the shelf.) You are prompted to confirm the deletion.
3
Click OK. Maya removes the shelf from the list of existing shelves and from the Maya window.
Note You cannot undo a delete command. However, Maya retains the shelf information in the file shelf_NAME.mel.deleted in the user shelves directory: ~username/maya/4.0/prefs/shelves (UNIX) drive:\WINNT\Profiles\username\maya\4.0\prefs\shelves (Windows NT) drive:\My Documents\username\maya\4.0\shelves (Windows 2000) So if you want to restore a deleted shelf, rename the file to shelf_NAME.mel, then restart Maya.
Adding shelf items You can add menu commands, MEL commands, and tools to shelves from the Tool Box, a menu, or the Script Editor. You can also save multiple versions of the same tool to the shelf with different settings. For example, add a Sculpt Surfaces Tool with the Push option selected and another Sculpt Surfaces Tool with the Pull operation selected. To add a tool from the Tool Box: Using the middle mouse button, drag the tool to the shelf.
USING MAYA: ESSENTIALS 342
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
This creates an editable tool on the shelf. If you select this tool from the shelf and change any settings in the Tool Settings window, the settings for the shelf item also change. These new settings become the default for the shelf tool. To add a menu item to a shelf: Press Ctrl-Shift-Alt (UNIX), Ctrl-Shift (Windows), then select the item from the appropriate menu. Maya places the item on the shelf. This adds the base tool to the shelf. Any changes you make to the tool settings will be reflected in the shelf tool also. To add a MEL command to a shelf from the Script Editor: 1
In the Script Editor (Window > General Editors > Script Editor), highlight the MEL command text that you want to add to a shelf.
2
Using the middle mouse button, drag the selected text to the shelf and release. This places a MEL icon on the shelf. When you click the icon, Maya runs the command(s). For example:
1
Open the Script Editor window (Window > General Editors > Script Editor).
2
Select Create > NURBS Primitives > Sphere. A sphere appears at the origin.
3
Select the Move Tool and drag a manipulator arrow to move the sphere. The MEL command move -r 5.315 0 0; (with your own coordinates), appears in the upper pane of the Script Editor.
4
Highlight the MEL command text in the upper pane of the Script Editor.
5
Using the middle mouse button, drag the selected text to the shelf and release. This places a MEL icon on the shelf. When clicked, the icon executes the move -r 5.315 0 0; command again.
USING MAYA: ESSENTIALS 343
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Removing shelf items There are two ways you can delete a shelf item. You can use the middle mouse button to drag items to the garbage can directly on the shelf or you can use the Shelves window. To remove a shelf item directly from a shelf. Use the middle mouse button to drag the icon to the garbage can.
Maya removes the icon from the shelf. To remove a shelf item using the Shelves window: 1
Open the Shelves window (Window > Settings/Preferences > Shelves).
2
Click the Shelves tab, then select the shelf containing the tool or action you want to delete. The selected shelf becomes active in the main Maya window.
3
Click the Shelf Contents tab.
4
Select the description of the icon you want to delete, then click Delete Item. Maya removes the icon from the shelf.
5
Click Save All Shelves or Close.
Moving and copying shelf items You can move shelf items to change the order they appear and you can move shelf items between shelf tabs. You can also copy shelf items. For example, you can add the same tool to a shelf more than once, but with different settings. The original tool must have been added to the shelf from the Tool Box (see "To add a tool from the Tool Box:" on page 342). To change the order of shelf items: •
On the shelf, use the middle mouse button to drag the icon to the desired position. or
1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelf Contents tab.
2
Select the item you want to move and click Move Up or Move Down until the item appears where you want it to appear.
3
Click Save All Shelves or Close. To move an item between shelves.
1
Use the middle mouse button to drag the icon onto the other shelf tab. The icon is removed from the current shelf.
2
Click the shelf tab on which you dropped the icon. The icon is visible on the new shelf.
USING MAYA: ESSENTIALS 344
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves To copy an existing item on the shelf: Press the Ctrl key and use the middle mouse button to drag the icon to its new position. A copy of the icon appears on the shelf.
Renaming shelves You can change the name of a shelf at any time to something more meaningful (for example, from ShelfLayout1 to Dynamics). To rename a shelf: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab.
2
Select the shelf you want to rename. Maya displays the name of the selected shelf in the Name text box.
3
In the Name text box, change the name and then press Enter. Maya displays the new name in the list of existing shelves and in the Maya window. You cannot use spaces or special characters (for example, !,@,#,$,%) in shelf names.
4
Click Save All Shelves or Close.
Reordering the shelves You can reorder the shelves that you use frequently. This is especially helpful if you have more shelves than Maya can display at once. To reorder the shelves: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab. Maya displays all available shelves in the order they appear in the Maya window.
2
Select the shelf you want to move, then click the Move Up or Move Down button until the selected shelf appears where you want it to appear.
3
Click Save All Shelves or Close.
Changing shelf icons On UNIX, Maya uses xpm (UNIX) images for the shelf button icons. Maya Windows uses bitmap (bmp) images and xpm images. You can assign a new image to a shelf button to more accurately reflect the button’s function. If you want to use an icon design other than the Maya default image, you must create your own image file. You cannot modify Maya’s default shelf button icons. To create a new icon image: Use any available 2D image program to create new image files. The image file size must be 32 x 32 pixels to fit within the shelf button. Typically, you place the image in your user icons directory: ~username/maya/4.0/prefs/icons (UNIX) drive:\WINNT\Profiles\username\maya\4.0\prefs\icons (Windows NT) drive:\My Documents\username\maya\4.0\prefs\icons (Windows 2000) If you use a different directory, you should specify it in the XBMLANGPATH environment variable. See Chapter 8, “Setting Environment Variables.” USING MAYA: ESSENTIALS 345
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves To change an icon’s image: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab.
2
Select the shelf containing the tool you want to change.
3
Click the Shelf Contents tab.
Description of icon
Icon image
4
Select the description of the shelf item you want to change, then click the Change Image button. A file browser window opens with the images directory selected. On UNIX, the browser is called the Pixmap Selector. The browser defaults to /usr/ aw/maya4.0/icons, the location of Maya’s default icons. On Windows, the default icons are stored in drive:\AW\Maya4.0\extras\icons.
5
Select a Maya default image or navigate to a new user-created image (it must have the file extension .xpm or .bmp).
Note Maya stores the image as a reference file. If you move it, you must specify the new location by using the Shelves editor or by setting the XBMLANGPATH variable. 6
On UNIX, click Apply to see your change in the main Maya window without closing the Pixmap Selector. Click Done to apply your change and close the Pixmap Selector. On Windows, click Open.
7
Click Save All Shelves or Close.
USING MAYA: ESSENTIALS 346
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Note On UNIX, you can modify existing images and create new ones from the Pixmap Selector. To modify an existing image (but not a Maya default shelf button icon), select it and click the Modify button to launch the xpaint application. Make your changes and save them. To create a new image, click the New button, type a name for the new file, then click OK to create a blank image in the icons directory. Select the new image and modify it.
Changing icon labels You can change the label of a tool or action icon if you: •
Want to make it more indicative of the function it performs.
•
Have changed the options and want to change the name to reflect changes. For example, if you modify a copy of the sphere action so that it now creates a hemisphere, you can change both the label and icon to reflect this change. To change an icon’s label:
1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab.
2
Select the shelf that contains the icon you want. The selected shelf becomes active in the main Maya window.
3
Click the Shelf Contents tab, then click the name of the icon you want to relabel.
4
Enter the new label for the icon in the Label & Tooltips text box and then press Enter. Maya changes the tool label in the Shelves window and on the shelf in the main Maya window.
New label for the Sphere action
USING MAYA: ESSENTIALS 347
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Note To show or hide the label for the tool, see "Setting Shelf options" on page 348. 5
Click Save All Shelves. When you move the cursor over the icon, Maya displays the new label on the Help Line and in the pop-up help.
Setting Shelf options Use the Options menu in the Shelves window to specify the appearance of the shelf labels and to specify when to save the shelf changes. Icon Only
Displays only the icon. This is the default.
Icon/Text Below
Displays the label below the icon.
Icon/Text Beside
Displays the label beside the icon.
Save Automatically Save Only on Request
When this option is on, your changes to the shelves are saved when you exit Maya. This is the default. When this option is on, your changes to the shelves are only saved when you select Save All Shelves in the Shelves window. If you don’t save your changes, then they are lost when you exit Maya.
USING MAYA: ESSENTIALS 348
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
Adding icon names Maya uses families of icons to represent related tools and actions. You can create an icon name to distinguish individual icons. For example, if you have several MEL command icons on your shelf, they all look the same because they all use the same default icon. You can use overlay labels to distinguish between these MEL buttons as shown in this illustration.
Icon name on a MEL command icon
You use the Shelves window to assign an icon name to a tool or action. To assign an icon name to an icon: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab.
2
Select the shelf containing the tool you want to rename. The selected shelf becomes active in the main Maya window.
3
Click the Shelf Contents tab, then select the tool you want to rename.
4
Enter the name in the Icon Name text box and then press Enter. Maya adds an icon name on top of the tool in the shelf.
5
Click Save All Shelves.
Changing MEL command(s) associated with an icon All actions on the shelf consist of a single or series of MEL commands. You can change these commands to change the behavior of the action. In the following example, we modify the MEL code for a move command to change the action’s behavior. To modify an action’s MEL code: 1
Open the Shelves window (Window > Settings/Preferences > Shelves) and click the Shelves tab.
2
Select the shelf containing the item you want to edit. The selected shelf becomes active in the main Maya window.
3
Click the Shelf Contents tab and select the item you want to edit.
USING MAYA: ESSENTIALS 349
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing shelves
4
Click the Edit Commands tab. The commands for the shelf item appear in the text area.
5
Make any necessary changes to the commands.
6
Press Enter on the keyboard. When you click the icon for this action, the revised commands will run.
7
Click Save All Shelves or Close.
USING MAYA: ESSENTIALS 350
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
CREATING AND EDITING MARKING MENUS Marking menus let you quickly access various tools and actions. You can customize a marking menu’s format and content. A marking menu has a radial portion and an overflow portion. The radial portion consists of one to eight menu items arranged in a circle.
Each menu item represents a command you have added to that marking menu. You can use the Marking Menus window to add, change, or delete a menu item or command. For more information on using the Marking Menus window, see "Modifying existing marking menus" on page 355. The overflow portion (or linear portion) has one or more menu items. The overflow items are arranged in a column below the radial items. Marking menus can be hierarchal. In other words, any menu item can have a submenu.
Note Each menu and submenu can contain a maximum of 38 menu items. You can use the Marking Menus window to: •
create marking menus (see "Creating marking menus" on page 352)
•
attach a marking menu to a hotkey (see "Assigning marking menus to hotkeys" on page 355)
•
modify existing marking menus (see "Modifying existing marking menus" on page 355)
•
add submenus to marking menu items (see "Adding submenus to menu items" on page 358)
•
add MEL scripts to marking menus (see "Associating a MEL script with a menu item" on page 359)
•
delete marking menus (see "Deleting marking menus" on page 360) To display the Marking Menus window: Select Window > Settings/Preferences > Marking Menus.
USING MAYA: ESSENTIALS 351
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus Marking menu defaults
Zone
Associated mouse buttons
Creating marking menus You can modify the default marking menus or use the Marking Menus window to create new marking menus. You can add the following items to marking menus: •
text from the Script Editor
•
tool icons and action icons from a shelf
•
the Select, Lasso, Translate, Rotate, Scale, and Show Manipulator icons in the Tool Box You can associate your marking menu with a zone or mouse button in the Hotbox, or a specific hotkey to the marking menu. The Hotbox can support a different menu for each mouse button in each of the Hotbox’s five zones. You can create three menus per zone, for a total of 15 marking menus (3 menus x 5 zones) with eight commands per marking menu. This gives you approximately 120 total commands (3 menus x 5 zones x 8 commands). To create a marking menu:
1
Select Window > Settings/Preferences > Marking Menus. The Marking Menus window opens.
2
Click Create Marking Menu. The Create Marking Menu window opens.
USING MAYA: ESSENTIALS 352
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
Place tool or action icons here
Enter name of the marking menu
3
Use the middle mouse button to drag tools or actions to the Create Marking Menu window. For example, to add the Pencil Curve Tool, select Create > Pencil Curve Tool. The tool displays in the Tool Box. Using the middle mouse button, drag the Pencil Curve Tool from the Tool Box to the Create Marking Menu window.
Note You can also add MEL commands to the Marking Menus window. For details, see "Associating a MEL script with a menu item" on page 359. 4
Repeat step 3 for any additional tools.
USING MAYA: ESSENTIALS 353
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
Tips To delete an icon from the Create Marking Menu window, right-click the icon and select Delete Menu Item. To create a submenu, see "Adding submenus to menu items" on page 358. This is useful if you want to increase the number of menu items you can access from a marking menu. 5
Enter the name of the new menu in the Menu Name text box.
6
To move a tool’s position, use the middle mouse button to drag the icon to a new position within the Create Marking Menu window.
Tip If a tool has an option box, you can make changes to the options. Click here to change the tool’s options
7
When you are satisfied with the position of every tool in the marking menu, click Save and then close the Create Marking Menu window.
8
Set the following options in the Marking Menu window and click Apply Settings, then Close.
Use Marking Menu in
Specify whether the marking menu is linked to the Hotbox or a hotkey. For information on linking a marking menu to a hotkey, see "Assigning marking menus to hotkeys" on page 355. Hotbox Region Mouse Button(s)
If you selected Hotbox for Use Marking Menu in, select the Hotbox zone the marking menu occupies: North, South, East, West, or Center. Select the left, middle, or right mouse button used to display the marking menu. You can select one, two, or three mouse buttons.
USING MAYA: ESSENTIALS 354
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
Assigning marking menus to hotkeys In addition to adding or customizing marking menus in the Hotbox, you can assign a marking menu to a specific hotkey. Each time you press the hotkey and the left mouse button, the associated marking menu appears. For example, the q key is associated with the Select marking menu.
Note A marking menu/hotkey combination will not work in a tear-off window. You display marking menus by pressing the left mouse button and the appropriate hotkey. The following hotkeys bring up marking menus.
Hotkey
Action on Marking Menu
a
Select All History, Disable All Future, Select All Future, and Enable All Future
d
High, Medium, and Low Quality Display
e
Rotate X, Y, and Z
h
Modeling, Animation, Dynamics, Rendering
q
Select Mask (see previous illustration)
r
Scale X, Y, Z and Scale XYZ
w
Translate X, Y, Z and Translate XYZ
For more information on setting hotkeys, see "Assigning hotkeys" on page 362.
Modifying existing marking menus Use the Edit Marking Menu button in the Marking Menus window to modify existing marking menus. You can add, edit, or delete individual menu items in a marking menu. You can also add submenus to add more tools and actions to a marking menu. For details, see "Adding submenus to menu items" on page 358. Each icon in the Edit Marking Menu window corresponds to a menu item in a marking menu. For information on adding menu items to an existing marking menu, see "Creating marking menus" on page 352.
USING MAYA: ESSENTIALS 355
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
To delete a menu item: 1
Open the Marking Menus window (Window > Settings/Preferences > Marking Menus).
2
Select an existing marking menu.
3
Click Edit Marking Menu. The Edit Marking Menu window appears with each icon corresponding to a menu item.
4
Right-click the menu icon you want to delete and select Delete Menu Item from the pop-up menu.
5
Select Save and then Close. To edit a menu item:
1
Open the Edit Marking Menu window.
2
Right-click the menu icon you want to edit and select Edit Menu Item from the popup menu. The Edit window appears that is according to the position of the icon (for example, Edit North, Edit North East, Edit East, Edit South East, Edit South, etc.).
USING MAYA: ESSENTIALS 356
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
3
Set the following options and then click Save and Close.
Label
Enter the name of the marking menu item.
Icon Filename
Enter the name of the icon file. For more information, see Using Maya: MEL.
Command(s)
Enter the MEL script used as the command for the menu item. You can drag the MEL script from the Script Editor’s bottom panel with the middle mouse button.
Check Box
Displays a check box beside the marking menu item.
Radio Button
Displays a check box beside the marking menu item.
Neither
Displays nothing beside the marking menu item.
Option Box
Turn Option Box on to display the option box ❐ beside the menu item so you can change a tool’s options from the marking menu.
Note If the tool or action does not have an options window, you must use MEL code to create the box. Once the box is created, you must write MEL code to invoke the option window. For more information on MEL commands, see Using Maya: MEL. Option Box Command(s)
Enter the MEL script to use as the command for the menu item’s option box.
USING MAYA: ESSENTIALS 357
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
Adding submenus to menu items Like the main pull-down menus, menu items in a marking menu can have submenus. These submenus let you add extra tools and actions to a marking menu.
Note If you create submenus under an overflow menu item, the submenus cannot contain any radial items. In the following example, there are four menu items associated with one submenu.
Adding a submenu: In the following example, a submenu is associated with an icon. 1
Open the Marking Menus window (Window > Settings/Preferences > Marking Menus).
2
Select the marking menu that has the menu item you want to add a submenu to.
3
Click Edit Marking Menu.
4
Right-click the icon you want to add a submenu to and select Popup Submenu from the pop-up menu. The icon changes shape indicating that a submenu is associated with it and the Submenu Editor window opens.
USING MAYA: ESSENTIALS 358
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
Menu item icon changes to this
5
Using the middle mouse button, drag tools or actions to the Submenu Editor.
6
Close the Submenu Editor window.
7
To test the submenu, click in the Click Here to Test box.
8
Click Save or Close.
Associating a MEL script with a menu item If you have written a script to perform a particular task, you can associate it with a menu item in a marking menu. In the following example a MEL script is added to an existing marking menu. To associate a script with an menu item: 1
Open the Marking Menus window (Window > Settings/Preferences > Marking Menus).
2
Select the marking menu that has the menu item you want to add a submenu to and click Edit Marking Menu. or Click Create Marking Menu to create a new marking menu. For more information, see "Creating marking menus" on page 352.
3
Open the Script Editor (Window > General Editors > Script Editor).
4
With the left mouse button, highlight the MEL script you want to associate with a marking menu.
5
Using the middle mouse button, drag the the highlighted text to the marking menu’s menu item in the Edit or Create Marking Menu window.
6
Right-click the new MEL icon and select Edit Menu Item.
7
Add a label for the menu item. For details, see "Modifying existing marking menus" on page 355.
8
Click Save and then close the Marking Menus window. USING MAYA: ESSENTIALS 359
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus
Deleting marking menus You can use the Marking Menus window to delete marking menus. When you delete a marking menu you can create a backup file which allows you to restore the menu. To delete a marking menu: 1
Open the Marking Menus window (Window > Settings/Preferences > Marking Menus).
2
Select the marking menu, then click Delete Marking Menu. The following dialog box appears.
3
If you want to delete the marking menu but keep a backup copy of it, select Create Backup. Maya stores the backup file in the user prefs directory with a file extension of .bak. For information on how to recover the marking menu, see "To restore a marking menu backup:" on page 360. or If you want to delete the marking menu without creating a backup file, click Do Not Backup.
Note You cannot recover a marking menu after you select Do Not Backup. Maya removes the marking menu from the Marking Menus window. 4
Click Close. To restore a marking menu backup:
Note You must exit Maya before restoring a deleted marking menu. 1
Rename the marking menu backup file menu_MenuName.mel.bak to menu_MenuName.mel.
2
Restart your system.
USING MAYA: ESSENTIALS 360
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Creating and editing marking menus 3
Select Window > Settings/Preferences > Marking Menus. The following message appears.
4
Click Load Menus. The recovered marking menu appears in the Marking Menu window.
Note Because Maya does not recover the mouse button assignment, you will have to re-assign a mouse button to the recovered marking menu.
USING MAYA: ESSENTIALS 361
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Assigning hotkeys
ASSIGNING HOTKEYS If you use a selection frequently, you may want to assign it to a hotkey. For example, if you frequently select File > Import, you can assign a hotkey to it. This decreases your reliance on the main menu. You assign hotkeys in the Hotkey Editor (Window > Settings/Preferences > Hotkeys) window. It lists menu items in the main menus, as well as commonly-used operations, such as Display Wireframe (hotkey 4). Also, you can assign hotkeys to your own MEL scripts or to commands that accompany plug-in software.
Select a command here...
...assign the hotkey here
You can add a custom command here so you can assign it a hotkey
Hotkeys on menu labels When you assign a hotkey to a menu item, the change appears on the main menu label. (This feature does not apply to menu labels in the hotbox.) Hotkeys shown beside menu selections
USING MAYA: ESSENTIALS 362
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Assigning hotkeys
How hotkeys are saved Maya saves your custom hotkey preferences so that they do not interfere with the default Maya hotkey settings. Your preferences will not be overwritten when you upgrade to the next Maya version. The file names containing hotkey preferences are userHotkeys.mel and userNamedCommands.mel under user prefs directory: ~username/maya/4.0/prefs (UNIX) drive:\WINNT\Profiles\username\maya\4.0\prefs (Windows NT) drive:\My Documents\username\maya\4.0\prefs (Windows 2000)
Assigning hotkeys to standard commands Use the top half of the Hotkey Editor to assign hotkeys to a menu selection or standard command. To help you choose hotkeys, you can also view a list of mapped and unmapped keys. To assign a hotkey: 1
Choose Window > Settings/Preferences > Hotkeys.
2
Select the category and command. There are categories for all of the main menus and for several other commands. Menu commands for plug-ins, including Live and Fur, are under the User category. If you have trouble finding a command, click Search (see "Example—creating a hotkey for a view menu option:" on page 365).
3
In the Assign New Hotkey area, specify the key combination and other settings. You can see a list of which keys are unmapped by clicking List All. Key
Enter the key you want to assign to the selected command. Enter a letter from A to Z (upper and lower case are different keys) or a number from 0 to 9. You cannot use more than one letter or number. Or, choose a special key from the pull-down list. For example, if you want the right arrow key to act as the trigger, assign it here.
Modifier
Select either Alt or Ctrl for the hotkey modifier.
Direction
Use Press or Release to associate a command with the press or a release of a key. For example, you can create a hotkey to instruct Maya to snap to a curve when you press a key, then turn off the snapping when you release it. If you added a key to an operation ending with (Press) or (Release), add the same key to the corresponding (Release) or (Press) operation.
Add to Recent Command List Query
Turn on so that this hotkey can appear in the Edit > Recent Commands window. Click Query to determine whether the specified key settings have already been assigned to a command.
USING MAYA: ESSENTIALS 363
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Assigning hotkeys Find
4
Click Find to highlight the category and command for the key you enter in the Key field.
Click Assign. The new hotkey appears in the Current Hotkeys list.
Viewing hotkey lists Click List All to view a list of mapped and unmapped keys. This opens the List Hotkeys window that allows you to sort the keys in various ways. To print the hotkeys list to a file, click Save to File and specify a destination directory.
No Modifiers
Lists only single hotkeys, without Ctrl or Alt.
Ctrl
Lists only hotkeys with a Ctrl + key combination.
Alt
Lists only hotkeys with an Alt + key combination.
List All
Lists all hotkeys.
Ignore Release
Turn on to ignore the hotkeys that activate when you release the key, versus when you press the key. Turn off to see all hotkeys, including the ones activated when you release the key.
Searching for commands Click the Search button at the bottom of the Hotkey Editor to perform a search through all existing commands. For example, you may want to perform a search if you know part of a command name, but not the category. Or, if you are adding a new command, you can first search for commands that are related. In the Search for Command window, you type a case-sensitive string and press Enter. The program searches for that string in the command names and command syntax. You can use * to represent any character or characters. You can also use brackets to enclose both capital and lower-case letters, such as: [aA]. USING MAYA: ESSENTIALS 364
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Assigning hotkeys
Changing or deleting a hotkey If you want to alter or delete an existing hotkey, select it from the Current Hotkeys list and click Remove. You can then assign a different hotkey as needed. You cannot restore a hotkey after you have deleted it; you must reassign it.
Adding commands for hotkey assignment If there is a MEL command or script you want to invoke with a hotkey, you can add that command and then assign it a hotkey. This capability is also useful for assigning hotkeys to the selections on the Panel menu bar: View, Shading, Lighting, Show, and Panels (see "Example—creating a hotkey for a view menu option:" on page 365). To add a new command for hotkey assignment: 1
Click New.
2
Complete the Name and Description. These fields are for future reference. They only appear in the Hotkey Editor.
3
Select a category from the Category pop-up menu.
4
Enter the MEL command into the Command box.
5
Click Accept. The command should appear under the chosen category. You can now assign a hotkey to this command. Example—creating a hotkey for a view menu option:
1
In the Hotkey Editor, click New.
2
Complete the Name, Description, and Category. For the Command, you will cut and paste from the Script Editor.
3
Open the Script Editor (Window > General Editors > Script Editor).
4
In the Script Editor, select Script > Echo All Commands. This instructs Maya to display all MEL commands used to execute any menu options.
5
In the Panel menu bar, select the menu item you want to create a hotkey for (for example, Shading > Smooth Shade Selected Items).
6
Select the echoed MEL command from the Script Editor window.
7
Copy and paste the command into the Command box in the Hotkeys window. On UNIX, use the middle mouse. On Windows, use Ctrl+C (copy) and Ctrl+V (paste). USING MAYA: ESSENTIALS 365
CUSTOMIZING SHELVES, MARKING MENUS, AND HOTKEYS | 13 Assigning hotkeys
8
Click Accept in the Hotkeys window. The command appears under the chosen category. You can now assign a hotkey to this command.
USING MAYA: ESSENTIALS 366
14
WORKING WITH PANELS AND LAYOUTS You can use panels and layouts to customize your workspace. Panels consist of interface elements, such as graphs, camera views, editors, and Outliners, that you can view within the main window. Layouts are groups of panels.
USING THE PANEL EDITOR You use the Panel Editor to assign panels and layouts to your workspace. The Panel Editor also lists the existing layouts and panels. To display the Panel Editor: •
On the Maya menu bar, select Window > Settings/Preferences > Panels. or
•
On the view menu bar, select Panels > Panel Editor.
You can select the following Panel Editor tabs: Panels
Displays existing panels you can rename or delete. See "Creating and deleting panels" on page 368 and "Renaming existing panels" on page 368.
New Panel
Displays the types of panels that you can create. See "Creating and deleting panels" on page 368. USING MAYA: ESSENTIALS 367
WORKING WITH PANELS AND LAYOUTS | 14 Managing panels Layouts
Displays existing panel layouts and can be used to create additional layouts. See "Creating layouts" on page 371.
Edit Layouts
Displays the current panel layout for editing. See "Defining layouts" on page 370.
History
Displays the history of the panels you used. See "Maintaining layout history" on page 374.
MANAGING PANELS A panel is a collection of interface display elements. You can view panels within the main window or tear them off so they exist in a separate window. Panels can consist of a single element, such as a camera view in a Modeling panel, or multiple elements, such as the Multilister with its many buttons and tabs. Panels have their own menu bars for their specific options.
Renaming existing panels You rename existing panels using the Panel Editor. To rename a panel: 1
Select Panels > Panel Editor.
2
Select the panel you want to rename.
Note You cannot rename the Top, Side, Front, or Persp view panels. 3
Type the new name in the Label text box, then press Enter. Maya changes the name of the panel in the list of existing panels.
4
To make sure that the renamed panel appears in the list of available panels, select Panels > Panel.
Creating and deleting panels Sometimes an object or scene is too big to fit in a window. When this happens, you may want to create a second panel. For example, if you created a skeleton and wanted to use the Outliner to look at two different parts of the object at the same time, you could create a second Outliner. Since the Outliner cannot display all of the nodes of the skeleton, you could use the second Outliner to view different parts of the object.
USING MAYA: ESSENTIALS 368
WORKING WITH PANELS AND LAYOUTS | 14 Managing panels To create a new panel: 1
Select Panels > Panel Editor and click the New Panel tab.
2
If you have more than one view open, select the view where you want the new panel to appear.
3
Select a panel (such as the Outliner), then click Make New Panel. Maya creates a new panel and lists it before the selected view. The name of the new panel appears in the Panels tab.
Note Not all panels can be duplicated. For example, only one Hypergraph panel is allowed. If you try to create multiple Hypergraph panels, Maya displays an alert message. 4
To view a second Outliner, select Windows > Outliner. Both Outliner windows now appear in the view. You can now make changes to the Outliners so they display different information about the scene.
USING MAYA: ESSENTIALS 369
WORKING WITH PANELS AND LAYOUTS | 14 Defining layouts To delete a panel: Once you have deleted a panel, you cannot restore it. 1
Select Panels > Panel Editor.
2
On the Panels tab, select the panel you want to delete, then select Delete. A confirmation dialog appears.
3
To confirm the deletion, click OK. Maya removes the panel from the display.
DEFINING LAYOUTS You often work with the same combinations of panels, depending on the task you are working on. When you render, you might want to work with the Multilister, RenderView and a perspective view. When you edit models, you might use the Outliner and a perspective view. Panel layouts provide these kinds of configurations. A number of predefined layouts are provided in Maya, but you can also create your own.
Selecting panel layouts There are three ways to select panel layouts: •
from the Quick Layout buttons in the Tool Box
•
from the main Maya window
•
from a view panel
•
from the Panel Editor To select a panel layout from the Tool Box: Click the desired Quick Layout button in the Tool Box. To select a panel layout from the main Maya window: On the main Maya menu bar, select Window > Saved Layouts, then select the layout you want to use. To select a panel layout from a view panel: On the Panel menu bar, select Panels > Saved Layouts, then select the layout you want to use. To select a panel layout from the Panel Editor.
1
Select Panels > Panel Editor and click the Layouts tab.
2
Select one of the layouts. Selecting any item from the list applies that panel layout to the main window. Try a few of them. Some panels take a moment to load the first time you use them.
3
To return to the original panel layout, select Current Layout from the list.
USING MAYA: ESSENTIALS 370
WORKING WITH PANELS AND LAYOUTS | 14 Defining layouts
Adding a layout to a shelf Add a layout to a shelf so you can select it quickly. To add a layout to a shelf: 1
Select a shelf by clicking the shelf tab.
2
Select Panels > Panel Editor and click the Layouts tab.
3
Select the layout, then click Add to Shelf. To add a name to the layout shelf icon (it displays as a MEL icon), see "To assign an icon name to an icon:" on page 349.
Creating layouts By default, any new panel layouts you create are saved with your preference file. This allows you to use them with any of your scene files. You can also create and save panel layouts that are only available with a specific scene. To create a layout: 1
Select Panels > Panel Editor and click the Layouts tab. or Right-click a Quick Layout button in the Tool Box, select Edit Layouts and then click the Layouts tab.
2
Select a layout, such as the Four View, and then click New Layout.
3
Rename the layout in the Name text box.
4
Click the Edit Layouts tab.
Maya displays two additional subtabs:
5
Configurations
Use this tab to change the configuration and proportions of the layout.
Contents
Use this tab to change which panels appear in the layout.
From the Configuration pull-down menu, select the panel configuration required (in this example, Four Panes).
USING MAYA: ESSENTIALS 371
WORKING WITH PANELS AND LAYOUTS | 14 Defining layouts 6
Resize the panes by dragging the borders in the thumbnail view of the layout. The main window changes to reflect your changes.
Click-drag here to change the width of the display. Click-drag here to change the height of the display
7
Click the Contents tab.
Click here to display available panel types
8
Select whether you want layout to be scene independent or associated with the scene. Scene Independent
Scene independent layouts are available for all scenes. Their contents are defined by panel types. If you have multiple panels of the same type in a scene, it is not certain which panels show up when you select your layout. This is not a problem in most cases; however, if you are working in a particular scene a great deal, then develop layouts that you can save specifically with that scene.
Associated with Scene
USING MAYA: ESSENTIALS 372
These layouts are only usable with the current scene. You can specify a particular panel if you have more than one of the same type.
WORKING WITH PANELS AND LAYOUTS | 14 Defining layouts
Note If you want to look through cameras other than the built-in persp, top, front, or side cameras, create another model panel for use in your panel layout. The Top View, Front View, Side View, and Persp View layouts use their respective built-in cameras as defaults. 9
From the Select Panel by Type menus, select panels for your panes.
10 Click the Layouts tab and select another layout. The main window changes to show the selected layout. 11 Select the layout you just created and close the Panels window. Your new panel layout displays in the main window. Your layout also appears in the Panels > Saved Layouts menu and the Windows > Saved Layouts menu. To save the current layout: 1
Select Window > Save Current Layout. The Save Panel Arrangement window opens.
2
Type a name for the new layout and click OK. The layout appears in the Panels > Saved Layouts menu and the Windows > Saved Layouts menu.
Deleting layouts At some point, you may no longer need layouts you created so you may delete them. To delete a layout: 1
Select Panels > Panel Editor.
2
Click the Layouts tab, select the layout you want to delete and then click Delete. A Confirm dialog appears.
3
Click OK to delete the layout.
4
Close the Panels window. To remove a layout icon from the shelf: Use the middle mouse button to drag the icon to the garbage can.
Note When you delete a layout, you only delete the named panel configuration, not the source panels.
USING MAYA: ESSENTIALS 373
WORKING WITH PANELS AND LAYOUTS | 14 Defining layouts
Maintaining layout history Maya keeps a record of panel layout changes. This lets you step forward or back through each view. This is helpful if you are moving between two layouts and cannot remember their names. To display panel history: Select Panels > Panel Editor and click the History tab.
History Depth
Specify the number of configurations you want stored in the history.
Wrap History
Toggle this on to return you to the first view or the most recent view configuration when you reach the end of recorded history.
Clear History
Click this button to delete the record of all the panels you have used.
Previous Layout
Click this button to browse back through the panel layouts.
Next Layout
Click this button to browse forward through the panel layouts.
USING MAYA: ESSENTIALS 374
INDEX 3D Paint Texture Options Save Scene As Options 167
A absolute path 170 values 98, 100 actions defined 30 redoing 82 undoing 82 Add Attributes option, Attribute Editor 227 Add Instance option 80 Add to Current Selection brush option 150 Advanced Visualizer file format 174 Affects Active modifier option 326 aiff file format 174 Alias Wire exporting file in 189 aliasWire format 174 Align Objects 144 Align Objects option 142 aligning objects, snapping 142 vertices 141 All Components Off option 147 Angle of view 44 Angular units option 322 anim file exporting 191 importing 179 animated nodes 266, 280 animating rotation channels 94 transitions (of view) 292
animation continuous play option 329 controls 328 curves exporting 191 importing 179 using to create falloff 104 key options 325 menus 20 nodes 68 oscillating 329 playback options 329 preferences button 22 Animation Details Heads Up Display 118 animation markers hiding 122 Animation Start/End option 328 animImportExport plug-in 179, 191 aperture 44 API, version for plug-ins 335 applications, importing files from 175 Apply Current to All option 121 Arc Length Tool 112 arc lengths locators 113 measuring 112 Array Cloning. See Duplicate Options window 74 ASCII file 165 format 174, 175
Attribute Editor 207, 222 arc length locator 113 axis display 87 breaking connections 232 compared to Attribute Spread Sheet 212 custom attributes, adding 227 displaying 222 distance locators 109 linking attributes 232 loading attributes into 225 locators 106 locking attribute values 232 mapping textures to attributes 233 node behavior 230 opening multiple copies 226 parameter locators 111 pivot points 85, 86 right-click menu options 224 rotation order 92 setting keys 231 Attribute Spread Sheet 207, 212 layout 215 names, shortening 213 option 208, 212
ANIMATION
Numerics
USING MAYA: ESSENTIALS 375
INDEX
attributes adding to Channel Box 238 Attribute Editor 225 Attribute Spread Sheet 212 breakdown keys, setting 245 changing multiple values 214, 241 Channel Box 237 components, displaying in Channel Box 238 compound 253 connections, breaking 232, 246 custom 227 default input and output 285 defined 212 deleting custom 230 displaying 252 editing 82, 212, 288 editing custom 229 editing multiple 208, 212 handles 84 ignoring when rendering 225 keying 216, 231, 244 linking 232, 247 locking values 232, 246 mapping textures to 233 relative values, entering 215, 242 showing for just one view 115 unlocking 232, 247 values 186, 213, 240 audio file format 174 Auto Key animation option 325 button 22 auto load plug-in option 335 Autodesk file format 174 Autom Create Rigid Body dynamics option 323 automatic graph layout 274 automatically created sets 297 auxiliary nodes 262 avi file format 175
USING MAYA: ESSENTIALS 376
axes changing from command line 88 constraint, snapping 141 description 87 displaying 87 global 87 local 87 orientation 94 restricting object movement to 89 rotation order 94 snap 142 Axes option 87 azimuth description 51 Azimuth Elevation Tool 51
B Backculling display option 321 Backface Culling option 121, 322 backfaces culling, display 322 displaying and hiding 126 Background Color attribute Environment attributes 57 background image importing to scene hierarchy 274 Backspace key 72 backup copies of marking menus 360 Based on distance option 102, 103, 104 binary file format 174 bitmap images for shelf icons 345 Blend box 235 Bookmark Editor 66 bookmarks 66 adding to shelf 67 automatic view change 293 creating 66, 294 deleting 67, 294 predefined 66 renaming 67, 294 returning to 294 selecting 67 Boomarks option 67 Border Edges option 321 Border Width option 321 borders edges 321
Bounding Box Dolly camera setting 50 Bounding Box option 120 branches 265 centering in view 292 breakdown keys, setting 245 breaking parent-child relationship 256, 271
C caching 230 CAD system file format 174 camera Center of Interest option 45, 58 Camera Aperture 55 Camera Attribute Editor 54 Camera Names 118 Heads Up Display 118 Camera Options 45 Camera Properties attributes 45 Camera Settings option, View menu 53 Camera Tools option, View menu 48 Camera/Light Manipulator option 128, 129
INDEX
cameras 59 aperture 44 azimuth 51 center of interest 51, 128 changing settings 53 clipping planes 128 creating 44 cycling index 128 default display of 250, 264 displaying 48 dollying 50 elevation 51 field chart 53 fill 54 film gate 53 frustrum 53 gate 53 hiding 122 horizontal 54 journal 53 looking through 52 manipulators 97, 122, 128 moving 48 orthographic 59 oversan 54 overview 43 perspective 53 pitch 51 resolution gate 53 revolving 49, 51 rolling 51 safe action 54 safe title 54 tools 49 tracking 49 tumbling (NT) 121 yaw 51 yaw pitch 51 zooming 51 categories of projects 170 Center of interest 45, 58 Center of Interest option 128, 129 Center polygon selection option 327 Center zone marking menu 37 centering nodes in view 291 Change Precision dialog box Component Editor 212
Channel Box 207, 236 adding attributes to 238 attribute components 238 attribute values, entering 240 attributes 237 breakdown keys, setting 245 breaking connections 246 custom attributes, deleting 230 custom attributes, editing 229 displaying 236 Expression Editor, launching 247 format, changing 239 history 247 history node, selecting 96 keys, setting 244 linking attributes 247 locking attribute values 246 manipulators 242 name abbreviations 239 pop-up menus in 243 precision 240 values, entering with mouse 243 Channel Control option 208, 236 channel slider 243 channelBox command 240 channels data file format 175 defined 212 deleting 73 material, overriding 322 Channels delete option 73 Channels option 186 characterPartition 307 Check Box option 357 check boxes in marking menus 357 children 250, 254, 265, 270 breaking relationship 256 Clamped animation option 325 cleaning up referenced files 184 clearing graph display 286 Click Box Size 327 Click Drag Select modifier option 326 Click Here to Test box 358 Clipping Planes option 128 Clone. See Duplicate option 74 Closest Visible Depth Depth Type 56 clusters 298 sets 302
collapsing nodes 251, 266 sets 300 Color Chooser window 233 Color Index Mode option (IRIX) 121 Color Material option 322 Color Shading option 322 color wheel 234 colors changing 330 default, changing 330 selection 233 swapping object 283 value 234 Colors customize UI option 330 Colors window 330 combined transformations 100 command line absolute values 100 axis origin, changing 88 focus, default 317 moving, rotating, or scaling from 100 relative values 100 Command Shell option 208 Command(s) option 357 commands adding to shelf from Script Editor 343 adding to shelves 342 complex models, displaying 120 scenes, display performance 121 Component Editor 209 modifying data 210 option 208 querying data 209 updating data 211 Component selection mode 146 pivot points, pinning 86 components deleting by type 73 editing 209 limiting selection 146, 147 paint-selecting 148 querying data 209 selecting using selection mask 147 selection mode 326 compound attributes 253 Compressed option 324 compression mode 324
USING MAYA: ESSENTIALS 377
INDEX
Cone Angle option 129 configuring workspace 370 connecting default output to input 282 nodes 282 Connection Editor launching from dependency graph 282 option 208 connection lines in dependency graph 278 in scene hierarchy 269 connections breaking 232, 246 creating default 282 direction of 278 displaying 269 constraining rotations 92 constraint axis, snapping along 141 constraints 186 connections, displaying 269 Constraints option 186 construction curve 97 construction history 186 deleting 155 effect on speed 154 manipulators 95 turning off 154 tweaking 154 continuous play option 329 controlling node, attributes connected to 253 coordinates local 43 system 41, 42 world 42 copying files 176, 180 objects 74 shelf items 344 Create Display Layer window 132 Create Empty Group option 80 Create Layer option 132 Create Marking Menu option 352 Create Multiple Objects option 164 Create Partition option 308 Create Quick Select Set 304 Create Reference option 175, 181 Create Render Node window launching 289 Create Set option 303 Create Set Options window 309
USING MAYA: ESSENTIALS 378
creating new materials, textures, or lights 289 new projects 171 projects 169 scene file 161 culling, backface 322 current project, editing 172 Curve Divisions option 321 curve on surface creating 156 snapping to 141 curves arc lengths, measuring 112 constraining on surface 91 construction 97 input 97 interpolated, setting tolerance 323 isoparm, snapping to 141 modification falloff 104 new, display options 321 NURBS 105 on surface, moving 91 on surface, snapping to 139, 141 parameter range 97 parameter values, displaying 110 smoothness, controlling 321 snapping to 139, 140 custom attributes, deleting 230 custom attributes, editing 229 Custom Polygon Display 127 CVs displaying on new curves or surfaces 321 modifying proportionally 101 moving 89 paint-selecting 148 selecting 148, 149 transforming proportionally 101 CVs, hiding 122 Cycling Index option 128, 129
D DAG nodes, instancing 77 Data Transfer File Locations 170 Decay Regions option 129
default input and output attributes 285 layer 134 nodes, importing 175 Default File Extensions option 186, 191 Default Home option 59 Default In/Out Tangent animation options 325 Default Object manipulator 98 Default Object Manipulator option 98 defaultLayer 300 defaultLightSet 300 defaultObjectSet 300 Deferred References 163 deformers adjusting operation of 297 complex operations, controlling 334 connections, displaying 269 geometry, hiding 123 hiding 122, 124 sets 297, 302 skin 298 deformPartition 307 Degree option 103 Delete All Objects by Type option 74 Delete by Type option 73 Delete Current Layout option 215 Delete key 72 Delete layer 131 Delete Marking Menu option 360 Delete Shelf option 342 deleting by type 73 channels 73 hotkeys 365 icons 354 marking menu items 356 marking menus 360 objects 72 objects by type 74 options, setting 73 plug-ins 337 referenced files 183 shelves 342 Dense Wireframe Acceleration option (NT) 121
INDEX
dependency graph 263 displaying lights 277 displaying textures 277 how to use 276 materials 277 rebuilding 285 shading groups 277 types of nodes 276 understanding the 276 Depth attribute Output Settings attributes 56 depth file description, for cameras 56 Depth Of Field 55 Depth Of Field attribute 55 Depth Type Closest Visible Depth 56 Furthest Visible Depth 56 Output Settings attributes 56 device drivers, plug-ins 334 directories, mapping missing 173 Disable Nodes command 68 disabling Hotbox 35 modules 329 Disk Cache Options Save Scene As Options 167 Display Field Chart attribute 58 Display Film Gate attribute 57 Display Layer Options window 132 display layers 130, 134 attributes 136 default 300 import options 324 index number 324 merge options 137, 324 options 132 selecting all objects in 72 Display Level attribute 160 Display Local Axis option 87 Display menu 115 Display Options attributes cameras 57 display performance 121 improving 120, 126 Display Polygon Count 118 Display Resolution attribute 58 Display Rotate Pivot option 85 Display Safe Action attribute 58 Display Safe Title attribute 58 Display Scale Pivot option 85 Display Time Pop-up Help 317
displaying entire graph in view 291 grid 115 hidden objects 288 horizontal graph 295 objects 115, 120 objects as semi-transparent 120 up and downstream connections 278 vertical graph 295 distance locators 107, 108, 109 locators, specifying translate values 109 measuring 107 point, snapping 108 Distance Cutoff option 102, 103 Distance Tool 107 Dolly Bounding Box camera setting 50 camera settings 50 Local camera setting 50 Snap box dolly to camera settings 50 Surface camera setting 50 Dolly Tool 50 dollying cameras 50 graph view 289 selected region 290 Don’t Ignore when Rendering option 225 downstream connections 278 dragging node from Outliner or Multilister 280 to reconnect nodes 284 Drawing Exchange File file format 174 Driven by Anim Curve show option 254 Driven by Expression show option 254 driven keys 232, 247 Duplicate Input Connections option 74 Duplicate option 74 Duplicate Options window 74 Duplicate Upstream Graph option 74 Duplicate with Transform 75 duplicating objects 74 options 74
DXF exporting 189 file format 174 file format, exporting file in 189 dynamics menus 20
E East zone marking menu 37 echoing last action 82 edges hard, displaying 321 numbering 322 paint-selecting 148, 149 selecting 149 soft 321 Edges display option 321 Edit Bookmarks option 66 Edit Commands tab 339 Edit Layer 131 Edit Marking Menu button 355 Edit Membership Tool 305 Edit menu 69 edit mode 85 moving a pivot point 85 pinning pivot points 86 edit points displaying on new curves or surfaces 321 editing marking menu items 356 editing objects 286 editors 207 Attribute 207 Attribute Spread Sheet 212 Channel Box 236 Color Chooser 233 Component 209 Connection 208 Expression 232, 247 general 207 limiting information displayed in 258 Outliner 249 Performance Settings 333 Plug-in Manager 334 Relationship 207 elevation description, for azimuth elevation tool 51 ellipses (...) in graph 290
USING MAYA: ESSENTIALS 379
INDEX
empty groups 80 nodes 255, 271 Enable Nodes command 68 Environment attributes 57 environment variables setting 195 EPS file import 178 evaluation order, position in Outliner 257 Execute Script Nodes option 163 Expand Popup List modifier option 326 expanding nodes 251, 266 set contents 299 Explore file format 174 ExploreGeo file format 174 Export All option 185 Export Selected As Reference option 181 Export Selection option 182, 186 exporting animation curves 191 DXF 189 files 189 IGES 189 move files 187 obj file format 188 plug-ins 188 referenced files 182 rendering information 186 RenderMan 190 scene contents 185 Expression Editor 207 default, selecting 317 opening from Attribute Editor 232 opening from Channel Box 247 expressions 186 connections, displaying 269 delete options 73 Expressions option 186 Extension Padding option 191 eyedropper tool 234
F F Stop attribute 56
USING MAYA: ESSENTIALS 380
faces centers, displaying 321 display options 321 normals, displaying 321 numbering 322 paint-selecting 148 selecting 148 falloff curve modification 104 linear modification 102 power modification 103 Proportional Modification tool 102 script modification 103 Far Clip Plane attribute 46 Fast Interaction option 318 Field Chart option 53 file formats avi 175 movie 175 File Type option 163, 167, 177, 186 files absolute paths 170 exporting in IGES, DXF, or Alias Wire 189 for shelf button icons 346 formats 174, 175 importing 175, 180 management 161 Particulars 182 reference options 181 referenced 180, 181, 182, 183, 184 relative paths 170 saving 165 searching for 171 size, reducing 168 translators, plug-ins 334 Fill option 54 Film Aspect Ratio attribute 55 Film Back attributes 55 Film Back Properties attributes 45 Film Gate attribute 55 Film Gate option 53 Film Offset attribute 55 filters 258 moving to shelf 153 Flat animation option 325 Flat Shade options 120 Fly Tool 52 focal length 43 Focus Distance attribute 55 Focus Region Scale attribute 56
focus, command line 317 Force to Add option 309 Frame All option Maya View menu 52 Frame Rate 118 Heads Up Display 118 frame rate, playback 329 Frame Selection 52 Free playback option 329 free-form hierarchy 274, 276 creating 273 Freeze Transformations option 153 Freeze. See Templates option 130 freezing transformations 153 frustrum 53 renderable 53 Furthest Visible Depth Depth Type 56
G garbage can 344 gate 53 General Preferences option 84 General Editors 207 Attribute Spreadsheet 212 option 208 Performance Settings 333 Plug-in Manager 334 selecting 208 tools settings 332 geo file format 174 geometry file format 174 hiding 122, 123 Geometry Motion Blur option 191 Gimbal manipulator 92 Gimbal rotate mode 93 Gimbal rotation manipulator 94 global axis 87 changing from command line 88 global rotate mode 93 Global Scale manipulator option 319 Graph Editor, limiting information displayed in 258 graphics card, Dense Wireframe Acceleration option 121
INDEX
graphs clearing display 286 dollying view 289 navigation techniques 289 rebuilding 295 tracking 289 turning off updates 293 viewing 289 grid corners, snapping to 139 default 116 displaying 115 hiding 116 options 116 snapping to 139, 140 specifying appearance 116 Grid option 116 Grid Options window 116 ground plane 42 Group option 176 Group option. Hierarchies (3D Studio Max). See Group option 78 Group Options window 78 Group Pivot option 78 Group Under option 78 groups empty 80 imported objects 176 nodes 255, 270 objects 78 options 78 Ungroup options 80
H Half (12 fps) playback option 329 Handle Size manipulator option 319 handles active 89 active or current 84 attributes 84 color 84 keyframing active 84 manipulator 84 scale manipulator 94 size, specifying 319 sizing 84 hard edges backface culling option 322 displaying 321 Hardware Fog option 121
Hardware Texturing option 121 Heads Up Display changing colors 330 Heads Up Display menu 118 Height animation option 328 help 39 A|W web site 39 browser options 317 popup 39 hidden objects 288 Hide Cloth option 122 Hide Deformers option 122, 124 Hide Geometry option 122, 123 Hide Kinematics option 122, 123 Hide menu 122 Hide Selection option 122 Hide Unselected CVs 122 Hide Unselected Objects 122 hiding animation markers 122 camera manipulators 122 light manipulators 122 objects 122 texture placements 122 Hierarchies (3D Studio Max). See Ungroup option 79 hierarchy 207 centering node in view 292 creating 80 limiting selection to 151 names, prefixing 256 removing objects from 81 terminology 250 Hierarchy List. See Outliner 207 highlighting colors, changing 330 polygons 321 history accessing 95 construction 186 modifying 247 node, selecting 96 History option 186 Hold Focus command line option 317 Horizontal Film Aperture attribute see Camera Aperture attribute Horizontal Film Offset attribute see Film Offset attribute horizontal layout of graph 279, 295 Horizontal option 54
Hotbox 352 appearance, changing 34 disabling 35 displaying 33 hiding menubars 35 making transparent 35 marking menus 352 menus, changing 34 region option 352 Style option 35 style, changing 35 turning off 35 using 33 using marking menu in 36 zones 33, 36 hotkeys assigning 362 customizing 339 deleting 365 marking menus 37, 352, 355 snapping 140 transformations 83 Hotkeys option 35 Hotkeys window 35, 362 categories 365 HSV color model 234 html browser 317 hulls displaying on new curves or surfaces 321 Hypergraph 263 layout, updating 286 limiting information displayed in 258 menu bar 264 opening 263 tool bar 264 using to select a view 52
I Icon Filename option 357 icon names 349 icons bitmap images 345 changing on shelves 345 deleting from marking menu 354 images on shelves 345 xpm images 345 IGES exporting 189 exporting file in 189 file format 174
USING MAYA: ESSENTIALS 381
INDEX
Ignore Selection Priority modifier option 326 when Rendering option 225 IK Handle Size kinematics option 319 IK handles adding 287 display size, setting 319 hiding 123 selecting 287 Illustrator file import 178 image displaying as background 274 file format 175 icon 345 Image attribute Output Settings 56 Image Plane attribute Environment attributes 57 Import option 175, 176 Import Reference option 181 importing animation curves 179 files 175 by copying 180 by reference 181 merging layers 137 move files 177 plug-in 188 improving speed, Hypergraph 293 In Main Maya Window option 223 In Separate Window option 223 In Tangents, default 325 Include These Inputs option 186 Including Texture Info option 186 information, plug-ins 335 Initial Default option 146 Initial Graphics Exchange Specification format 174 initialParticleSE 300 initialShadingGroup 300 input curve 97 nodes 278 INPUTS 237 instance 76 DAG nodes 77 deleting from hierarchy 81 limitations 76 interactive display 121 Interactive Shading option 121
USING MAYA: ESSENTIALS 382
interface turning elements off or on 37 interpolated curves tolerance, setting 323 intialParticleSE 300 Invert Selection 70 invisible nodes 268 objects 288 Invisible Manips option 242 isoparms curve, snapping to 141
J jiggle deformer Disk Cache Options 167 Joint Size kinematics option 319 joint1skinPartition 307 joints display size, setting 319 hiding 123 Journal Command attribute 58 Journal option 53
K Keep Hard Edges option 322 Keep Only a Reference option 186 Keep Original option 97 Keep Wire option 322 Key Selected option 216 Key Ticks option 328 Keyable tab, Attribute Spreadsheet 212 keys attribute, setting 231, 244 creating 216 options 325 snapping option 328 kinematics hiding 122, 123
L Label option 357 Label tab 339 labels icons on shelves 347 Lasso Tool 70, 83
lattices hiding 124 points, displaying and hiding 126 shape, displaying and hiding 127 Layer Attributes option 136, 138 Layer Editor Add Selected Objects 131 Attributes 131 displaying 131 Membership 131 Remove Objects 131 Remove Selected Object(s) from Layers 132 Select All Unused Layers 132 Select Objects 131 layers assigning objects to 132 attributes 136, 138 creating 132 display and render 130 import options 324 index number 324 merge options 137, 324 moving sets to 298 naming 132 removing objects from 133 renaming 132 selecting all objects in 72 layouts 370 adding to shelf 371 associated with scene 371 Attribute Spread Sheet 215 changes to 374 configuring 371 creating 371 deleting 373 history, maintaining 374 Scene Independent 371 selecting 370 updating graph 286 Layouts option 62 Layouts option, Panels menu 64 leaf, selecting only 151 lens 43 Lens Properties attributes 45
INDEX
level of detail 157 adding a level 159 changing threshold distances 159 creating 157 Display Level attribute 160 orthographic cameras 160 previewing several objects 160 re-ordering levels 159 Threshold attribute 159 light linking Relationship Editor 217 lighting 60 Lighting menu 60 lights barn doors 129 center of interest 129 cone angle 129 cycling index 129 decay regions 129 dependency graph 277 hiding 122 manipulators 97, 128, 129 manipulators, hiding and showing 122 penumbra 129 pivot 129 limiting selection by object type 146 by task 152 object and component 146 to hierarchy items 151 to template objects 151 Line Pick Size manipulator option 319 Line Size manipulator option 319 linear modification falloff 102 Linear animation option 325 Linear units option 322 lines thickness, manipulators 319 live, making objects 156 Load Deferred References, option 163 Load Menus option 360 Loaded plug-in option 335 loading plug-ins 188 referenced files 183 Local Dolly camera setting 50
local axis 87 coordinates 43 rotate mode 93 rotation axes, displaying and hiding 127 space, distance locator 109 space, Move tool 90 Local Space option, pivot points 86 location of projects 170 locators arc length 112 creating 106 distance 107, 109 distance, moving 108 moving 106 parameter values 110 parameter, moving 111 repositioning from Attribute Editor 106 transforming 106 Lock current selection icon 154 Locked Tumble camera setting 49 locking attribute values 232, 246 pivot points 86 transform tool or manipulator 154 LOD 157 lod 157 Long Attribute Names option, Attribute Spreadsheed 213 Look At Selection 52 Look through Barn Doors option 129 Look Through Selected option, Panels menu 52 Looping animation option 329
M ma file format 174 Make Live option 156 Make New Layers Current 132 managing files 161
manipulators 83 active 89 camera 97 displaying 128 hiding 122 Channel Box 242 color 84 combined Move/Rotate/ Scale 100 default object 98 displaying 128 Gimbal 92, 94 handles 84 displaying and hiding 127 light 97 displaying 128 hiding 122 locking 154 Move curve on surface 91 Move tool 90 pivot point 85 Rotate tool 92 scale tool 94 Show Manipulator tool 95 sizing handles 84 snapping 141 thickness 319 Mapping missing directories 173 marker animation path 92 hiding 122 marking menus backup files for 360 creating 352 customizing 339, 351 default 36 deleting 360 deleting icons from 354 deleting items 356 editing items 356 Hotbox 36, 314 hotkeys 37, 355 MEL scripts on 359 modifying 355 restoring backups of 360 right mouse button 38 submenus, adding 358 using 36 zones 352 Marking Menus window 351 marking views 66 mask description, for cameras 56 Mask attribute Output Settings attributes 56
USING MAYA: ESSENTIALS 383
INDEX
material channels, overriding 322 materials dependency graph 277 Maya A|W web site 39 ASCII file format 174 Binary file format 174 Embedded Language file format 174 projects 169 scene information 170 version and release date 39 MayaToIgesDxf plug-in 188 Measure menu 107 measure tools 107 measuring arc lengths 112 MEL 103 file format 174 plug-ins 334 MEL commands 208 adding to marking menu 357, 359 adding to shelf 343 customizing on shelf 349 scene orientation 42 MEL scripts adding to marking menu 357, 359 adding to shelf 343 customizing on shelf 349 propMod script 103, 105 membership editing 207 Membership option 133 memory, improving use of 168 menu bars hiding 35 Hypergraph 264 Outliner 250 menu options adding to shelves 342 option boxes 30 Menu Set preference 316 menu sets 20 Hotbox 33 menu_ChangePanelLayout.mel 31 4 menu_ChangePanelType.mel 314 menu_ChangeSelectionMask.mel 3 14 menu_CommonModelingPanes.mel 314 menu_ControlPaneVisibility.mel 3 14
USING MAYA: ESSENTIALS 384
menus context sensitive 267 Hotbox 34 option boxes 30 quick access 33 selecting 20 merging display layers 137, 324 microCAD systems file format 174 Minibar 83, 88, 93, 94 adding tool to shelf 342 modeling aids 139 menus 20 models, complex 120 Modifier Stack. See construction history 186 Modifiers (3D Studio Max). See deformers 123 modules disabling 329 options 329 selecting 20 Motion Blur attributes Create Camera Options 47 motion path markers 92 mouse entering values in Channel Box 243 marking menu buttons 38, 352 suspending complex operations during interaction 333 Mouse button(s) option 352 move command 100 move files 175 exporting 187 importing 177 Move manipulator 91 Move Tool 83 Move tool 88, 90, 154 coordinate system 90 motion path markers 92 restricting movement 89 tips 89 Move Up and Down shelf buttons 345 Move/Rotate/Scale tool 100 movement, restricting to one axis 89 moving numeric values 98, 100 selection limitations to shelf 153
N namespaces 176 native ASCII file format 174 binary file format 174 Near Clip Plane attribute 46 New Curves option 321 New Layer button 132 new scene configuration Starting New Scenes Preferences 317 New Surfaces option 321 next view 293 No Gate option 53 No Manips option 242 node state 230 nodes 250, 265 animated 266, 280 attribute names in dependency graph 278, 279 behavior, changing 230 child 250, 254, 265, 270 collapsing 251, 266 connecting 282 containing param curves 266, 280 controlling 253 DAG 77 default 175 displaying underworld 268 dragging from Outliiner or Multilister 280 dragging to reconnect 284 empty group 255, 271 enabling and disabling 68 expanding 251, 266 framing in Hypergraph view 291 group 255, 270 history, selecting 96 input 278 invisible 267, 268 moving relative position 272 output 278 parent 250, 254, 265, 270 plug-ins 334 renaming 256, 287 reordering in outliner 257 selecting 256, 286 shape 251, 252, 266, 268 slanted boxes 266, 280 subnodes 265, 266 transform 250, 266 types 254
INDEX
nonlinears, hiding 124 non-sacred tool 22 normal layer 134 Normal (24 fps) playback option 329 normals size on polygons 322 North zone, marking menu 36 numbering edges 322 faces 322 vertices 322 numeric input field 28 moving, rotating, or scaling from 98 numeric values absolute and relative 98 NURBS components, displaying and hiding 127 curves using to create falloff 105 curves, hiding 123 display options 321 smoothness 127 surfaces, hiding 123
O obj file format 174 exporting to 165, 166, 188 Object Components option 126 Object Details 118 Heads Up Display 118 Object selection mode 146 objectName 237
objects assigning to layers 132 attributes 82, 288 components, displaying and hiding 126 deleting 72 displaying 115, 120 duplicating 74 editing 69, 286 editing attributes of 288 file format 174 grouping 78, 176 hiding 122, 288 invisible 288 limiting selection 146 live 156 moving 88, 100 parenting 80, 254 plug-ins 334 removing from hierarchy 81 removing from layers 133 rotating 92 scaling 94 selecting 69, 286 selection mode 326 priorities 153 shape, changing 89 showing for just one view 115 smoothness, controlling 321 snapping to grid, curve, point, or view plane 140 space coordinate system, Move tool 90 templates 130, 151 transforming 83 ungrouping 79 unparenting 81 untemplating 130 objExport plug-in 188 On File Save compression option 324 Open Scene option 162 opening Expression Editor 232, 247 scene file 161 scene files 162 operations, complex, supsending 333 Optimize Scene Size option 168 Optimize Scene Size Options window 168 optimizing scene size 168 Option Box Command(s) option 357
option boxes 30 options 102 Orbit Camera. See Tumble Tool 49 order rotation 92 rotation channels 94 orientation, changing 42 origin setting transformations to 153 Origin Axis 118 Heads Up Display 118 Origin option 87 Ortho step Tumble camera setting 49 Orthographic Camera 47 orthographic camera width of 48 Orthographic option, Panels menu 59 orthographic view 43 creating 59 Orthographic views camera settings 49 Orthographic Views attributes Attribute Editor, cameras 58 Orthographic Width 48 Oscillate animation option 329 Out Tangents, default 325 Outliner 207, 249 attributes, displaying in 252 limiting information displayed in 258 menu bar 250 navigating 251 nodes displaying in 254 renaming 256 reordering 257 selecting 256 opening 249 panel 249 output nodes 278 Output Settings attributes 56 OUTPUTS 237 overlapping set members, preventing 306 Overlay Label tab 339 Overscan camera attribute 53 Overscan option 54
USING MAYA: ESSENTIALS 385
INDEX
P packages disabling 329 options 329 Paint Selection Tool 148 paint operations 149 settings 149 Paint Set Membership Tool, editing sets 305 paint-selecting components 148 palette in Color Chooser 235 paletteColors.mel 314 Panel Configurations 168 Panel Editor 367 Panel option 61 panels 368 arrangements, saving 370 arranging 371 creating 368 deleting 370 layouts, selecting 370 managing 368 renaming 368 Panels menu 61 panes, resizing 371 param curves 266, 280 parameter locators, editing 111 range, changing 97 values, displaying 110 Parameter Tool 110 Parent option 80 Parent Options window 80 Parent to World option 81 parents 250, 254, 265, 270 breaking relationship 256, 271 creating 255, 271 object hierachies 255 object hierarchies 80 removing object from 81 Partial curve range option 97 partitions 306 adding sets to 309 created by Maya 307 created by you 306 creating 308 default 307 defined 306 displaying 308 removing 308 sets, removing from 308
USING MAYA: ESSENTIALS 386
path absolute 170 animation marker, moving 92 plug-ins 335 Penumbra option 129 performance improvements 168 Performance Settings 333 window 333 performance, improving 121, 126, 230, 318, 333 perspective 44, 59 creating view 59 view 58 Perspective option 52, 53, 58 perspective view 43 pick mask 146 pinning pivot points 86 pitch 51 Pivot camera option 128 Pivot light option 129 pivot points 86 defined 84 displaying 85, 127 displaying and hiding 127 manipulator 85 moving 85 pinning 86 temporary 86 unpinning or unlocking 87 World Space 86 Pixel Samples option 191 placements, texture 122 planes hiding 122 view 139 playback buttons 22 frame rate, setting 329 range, setting 328 Playback Range 22 Playback Speed option 329 Playback Start/End options 328
plug-ins API version 335 auto loading 335 features 335 importing 188 information about 335 loading 334 manager 334 MayaToIges 188 objExport 188 path 335 references, removing 337 unloading 336 version 335 point snap hotkey 140 Point to Point option 142 points cluster 302 measuring distance between 107 snapping 139, 142 snapping to 140 Points option 120 Poly Count Heads Up Display 118 polygon count 118 Polygons components, displaying and hiding 127 polygons border width 321 display options 321 displaying as triangles 321 faces, displaying 321 normal size, specifying 322 numbering faces, edges, or vertices 322 surfaces, hiding 123 texture border, thickening display 321 Pop HotBox hotkey 35 popup help 39 popup menu Channel Box 243 Popup Menu Selection modifier option 326 Popup Submenu option 358 Positional tolerance option 323 power modification falloff 103 PowerAnimator file formant 174 Predefined Bookmarks option 66 pre-defined tabs, Attribute Spreadsheet 216
INDEX
preferences files 314 saving using userSetup.mel 315 setting 313 stored location 314 Prefix with option 186 Preserve Position option 78, 80, 81 PreView file format 175 Previous State Size manipulator option 319 Previous View option 59 previous view, returning to 293 priority for object selection 153 priority preference 327 projects categories and locations 170 creating new 171 definition of 169 directories 169 editing 172 setting 172 propmod 101 propMod script 103, 105 Proportional Modification tool 101, 102 proportional scaling 94 proportional transformations 101 falloff 102
Q quality shading 120 querying component data 209 Queue option 329 Queue Size option 82, 329 Quick Layout buttons 61 Quick Select Set option 304
R Radio Button option 357 radio buttons in marking menus 357 RAM, freeing 329 Range Slider options 328 range, parameter 97 rebuilding graph 285, 295
Recent Commands option 34 Recent Files 162 Redo option 82 redoing actions 82 redraw options 333 reference layers 134 Reference Editor 181, 183 Reference option 181 referenced files 180, 181 cleaning up 184 exporting 182, 185 importing 182, 185 loading/unloading 183 removing 183 replacing 184 selecting objects from 183 references deferred 163 plug-in 337 refresh options 333 Region of Affect 318, 319 region, dollying 290 Relationship Editor 207, 217 creating relationships 220 editing sets 305 limiting display 219 limiting information displayed in 258 objects, displaying 218 opening 217, 298 relationships, displaying 218 sets 303 view options, setting 218 Relationship Editors option 298 relationships 221 adding members 221 creating 220 displaying 218 editing 217 removing members 221 selecting members 221 relative paths of files 170 relative values command line 100 entering 99, 215, 242 release date 39 Remember this Layout option 215 Remove Instance option 81 Remove Reference option 181 removing referenced files 183
renaming layers 132 nodes 256, 287 Render File Locations 170 render layers 130, 137 renderable layers 137 Renderable attribute 56 rendering exporting information 186 menus 20 resolution 53 renderlayers attributes 138 RenderMan exporting 190 format 174 renderPartition 307 reorder shelves 345 reordering nodes in Outliner 257 shelves 345 Repeat on Hold sound option 327 Repeat Size sound option 327 repeating actions 82 replacing referenced files 184 resetting transformations 153 Resolution Gate option 53 resolution, wireframe 318 Resolve Name Clashes with option 176 restoring backup marking menus 360 reversing actions 82 revolve history node 96 revolving cameras 49 RGB color model 234 RIB file format 174 ribExport plug-in 190 right mouse button, marking menus 38 Roll Scale setting 51 Roll Tool 51 rolling cameras 51 root, selecting only 151
USING MAYA: ESSENTIALS 387
INDEX
rotate axis 94 channels, animating 94 command 100 modes 93 numeric values 98, 100 objects 92 order 92, 94 pivot points, displaying 127 Rotate Tool 83 Rotate tool 92, 154 Rotation type setting 51 Run Up From dynamics option 323 Run Up To Current Time dynamics option 323
S Safe Action option 54 Safe Title option 54 Save All Shelves button 339 Save Panel Layouts with File option 168 Saved Layouts selecting 370 saving Attribute Spread Sheet layouts 215 files 165 scene information 170 scale command 100 numeric values 98, 100 objects 94 pivot points 127 proportionally 94 Scale setting 50, 51 Scale Tool 83 Scale tool 94, 154 manipulator 94 scene file creating 161 opening 161 Scene File Locations 170
USING MAYA: ESSENTIALS 388
scene hierarchy 266 automatic layout 274 creating free-form 273 defined 263 displaying background image 274 displaying special nodes and connections 268 parenting 270 rearranging nodes 272 terminology 250, 265 Scene Independent layouts 371 scenes display performance 121 exporting 185 hierarchy 207 importing 175 lighting 60 opening 162 optimizing size 168 referencing 180 saved information 170 too big to fit window 368 Schematic window. See Hypergraph 263 screen refresh options 333 Script Editor option 208 Script Editor, adding command to shelf 343 Script Nodes 163 scripts 208 customizing on shelf 349 modification falloff 103 on marking menus 357, 359 propMod 103, 105 sculpt objects, hiding 124 searching for files 171 Select All button 150 Select All by Type option 71 Select All History option 96 Select All option 70 Select Hierarchy and Combinations icon 151 Select paint operation 149 Select Reference Contents option 181 Select Tool 83
selecting 221 all objects 70 components 147, 148 CVs 148, 149 edges 148, 149 faces 148, 149 IK handles 287 inverting a selection 70 Lasso Tool 70 multiple objects 70 multiple text boxes 214, 241 nodes in Outliner 256 objects 69, 286, 297 objects by name 72 objects by type 71 objects in a set 72 objects individually 69 template objects 151 vertices 148, 149 selection handles, displaying 127 limiiting by object type 146 limiting by component 147 limiting by task 152 masks 37, 146 priority 153, 327 Selection Mask options window 89 Set Driven Key option 232, 247 Set Project option 172
INDEX
sets addiing to partitions 309 adding members 305 automatically created 297 cluster 298 collapsing 300 created by Maya 300 by you 299 creating 303 creating for easy object selection 304 default naming of 299 defaultLayer 300 defaultLightSet 300 defaultObjectSet 300 defined 297 deformer 297, 302 displaying in Relationship Editor 305 editing 217 expanding a set’s contents 299 explained 298 indentation 300 initialShadingGroup 300 intialParticleSE 300 member weights 298 membership, editing 305 overlapping members, preventing 306 quick select 304 removing 304 from partition 308 members 305 selecting 304 contents only 300 quickly 304 shading group 300 simplifying selection with 297 skin point 298, 302 user-created 297, 298 uses 297 setting key attributes 231 performance 333 project 172 Shade options 120 Shaded Divisions option 321 shaded objects smoothness, controlling 321 wireframe on 318 shading applying to all objects 121 interactive 121 quality 120
shading groups changing selected 284 display example 277 displaying in dependency graph 277 sets 300 sets Maya creates 300 Shading menu 120 shape nodes 251, 266 displaying 268 displaying in Outliner 252 SHAPES section 237 Shelf Contents tab 339 shelves bookmarks, adding 67 commands, adding to 343 copying items 344 creating 339, 341 customizing 339 deleting 342 editing 339 icons, changing 345 items, adding to 342 layouts adding to 371 MEL commands, customizing 349 moving filters to 153 moving items between 344 options 348 removing items from 344 renaming 345 reordering 345 reordering items on 344 using 21 Shelves tab 339 Shelves window, opening 339 Short Attribute Names option, Attribute Spreadsheet 213 Show All Panes option 64 Show Auxiliary Nodes 262 Show Manipulator Tool 83 Show Manipulator tool 95, 154 default manipulator 98 history node 96 lights and cameras 97 Show menu 115, 258 Show Only Viewing Panes option 64 Show Selected Columns Only option 215 Show Text box 258 Shutter Angle description, for cameras 47 Shutter Angle attribute 57
shutters on spotlight 129 Single File Output option 191 Single Marquee Select modifier option 326 size handles 319 IK handle 319 joints 319 manipulators 319 scene, optimizing 168 skin points sets 298, 302 slanted boxes 266, 280 Smart Transform option 74 Smooth Shade options 120 smooth skin influences hiding 124 smoothness setting 321 Snap to Curves option 139 to Grids option 139 to Points option 139 to View Planes option 139 Snap Align Objects option 142, 144 snap axis 142 Snap box dolly to camera settings 50 Snap to curves icon for distance measure 108 Snap Tolerance 327 snapping 139 aligning objects 142 along a constraint axis 141 animation option 328 distance measure point 108 hotkeys 140 icons 139 to a curve on surface 141 to a curve or curve on surface 139 to a point 139 to a view plane 139 to an isoparm curve 141 to grid corners 139 soft edges backface culling 322 displaying 321 sound 164 animation options 327 File Offset option 164 repeating on hold 327 sound synching 328
USING MAYA: ESSENTIALS 389
INDEX
South zone marking menu 37 space bar 33 Special Effects attributes cameras 57 Specify Selected Lights option 61 speed of Hypergraph, mproving 293 Spline animation option 325 spread sheet, attribute 207 Spreadsheet window. See Attribute Spread Sheet 212 Standard Manips option 242 Static Channels, delete options 73 Status Line 20 Stepped Tumble camera setting 49 Stepped animaton option 325 subCurve 97 Subdivision Surface Smoothness 127 Subdivision Surfaces components, displaying and hiding 127 Submenu Editor 358 submenus, adding to marking menus 358 subnodes 265, 266 Sudivision surfaces, hiding 123 Surface Dolly camera setting 50 Surface Divisions option 321 surface history 95 surfaces arc lengths, measuring 112 complex operations, controlling 333 making live 156 moving curves on 91 new, display options 321 parameter values, displaying 110 smoothness, controlling 321 suspending complex operations 333
T tabs pre-defined, Attribute Spreadsheet 216 Tangential tolerance option 323
USING MAYA: ESSENTIALS 390
tangents, weighted 325 Tape. See Measure menu 107 task, limiting selection to 152 Tear Off Copy option, Panels menu 62 Tear Off option, Panels menu 62 template layer 134 template objects creating 130 limiting selection to 151 returning to standard display 130 untemplating 130 Templates option 130 text boxes selecting multiple 214, 241 texture border thickening display 321 Texture Border option 321 Texture Placements option 122 textures displaying in dependency graph 277 graph display example 284 mapping to attributes 233 Three Points to Three Points option 142 Threshold Output Settings attribute 57 Threshold attribute 159 TIFF file format 175 time ranges, setting 328 Time Slider 22 time slider height, adjusting 328 key ticks option 328 options 328 time to video standard timecode, default 328 Time units option 322 Timecode animation option 328 Timecode Offset option 328 timecodes matching timing from videotape 328 Toggle All button 150 Toggle paint operation 149 toggling CV selection 149 edge selection 149 face selection 149 vertices selection 149
tool bar, Hypergraph 264 Tool Box 21, 31 tool settings 332 Tool Settings option 332 Tool Settings window 90 tools 83 adding to shelf 342 adding to shelves 342 camera 49 defined 30 dragging to shelf 339 duplicating on shelf 344 Minibar 83 plug-ins 334 setting options 332 tooltips 39 Track Geometry setting 50 Track Scale setting 50 Track Tool 49 tracking cameras 49 graph view 289 transferring objects to layers 132 transformations combining 100 freezing and resetting 153 Move/Rotate/Scale tool 100 nodes 250, 266 pivot points 84 rotate attributes 94 tools, locking 154 using Numeric Input field 99 transforming objects from command line 100 Move tool 88 moving tips 89 restricting movement 89 rotation 92 transition speed, changing 292 Transparency Based depth Output Settings attributes, for cameras 57 triad option 90 triangles, displaying polygons as 321 Truck Camera. See Track Tool 49 Try to Add option 309
INDEX
Tumble Locked camera setting 49 Ortho step camera setting 49 Orthographic views camera settings 49 Stepped camera setting 49 Tumble camera about camera settings 49 Tumble pivot camera setting 49 Tumble scale camera setting 49 Tumble camera about camera settings 49 Tumble pivot Tumble camera setting 49 Tumble Pivot attribute 58 Tumble Tool 49 tweaking construction history 154 Twice (48 fps) playback option 329 Two Points to To Points option 142 Two Sided Lighting option 60 type deleting object components by 73 deleting objects by 74 selecting by 71
U UI elements displaying 19 hiding 19 Uncompressed option 324 underworld nodes, displaying 268 undo actions 82 setting number of 329 Undo option 82, 329 Ungroup option 79 Ungroup Options window 80 ungrouping objects 79 Units options 322 units preferences 322 unloading plug-ins 336 referenced files 183 unlocking attributes 232, 247 pivot points 87 tools 154 Unmap Key button 35 unparenting objects 81
unpinning pivot points 87 Unselect All button 150 Unselect brush option 149 unselected objects, hiding 122 unselecting CVs 148, 149 edges 148 faces 148 vertices 148, 149 untemplate 130 Up Axis coordinate system option 322 up axis, changing 42 update options, Hypergraph 292 Update View animation option 329 upstream and downstream connections 278 Use All Lights option 60 Use Current Layer 133 Use Current Layer option 133 Use Default Lighting option 60 Use Marking Menu in option 352 Use Namespaces option 176, 186 Use Previously Specified Lights option 60 Use Selected Lights option 60 Use Verbose Names option 163, 167 Use Verbose Names options 186 User defined anim curve option 104 User defined script option 103, 104 user interface file, turning off creation 168 preferences files 314 userColors.mel 314 user-created sets 297, 298 userHotkeys.mel 314 userNamedCommands.mel 314 userPrefs.mel 314 userRGBColors.mel 314 userSetup.mel 315 UV linking Relationship Editor 217 Update 90
V values absolute 100 numeric, entering 98 relative 100
version and release date 39 vertex normals, displaying 321 Vertical Film Aperture attribute see Camera Aperture attribute Vertical Film Offset attribute see Film Offset attribute vertical layout of graph 279, 295 Vertical option 54 vertices 149 aligning 141 display options 321 numbering 322 paint-selecting 148 selecting 148, 149 Vertices option 321 view centering branch 292 centering node hierarchy 292 centering nodes 291 changing transistion speed 292 dollying graph 289 history 293 next 293 returning to prior 293 tracking graph 289 View Arrangement option, Window menu 64 View Axis 118 Heads Up Display 118 view menu bars, hiding 35 view planes, snapping to 139, 140 views arranging 61 changing in current panel 37 displaying 64 laying out 64 marking 66 saving in layouts 371 selecting with Hypergraph 52 switching between 37
W walk throughs 52 WAVE file format 174 Waveform Display sound option 327 waveform, displaying 327 Wavefront, exporting to 188 web site 39 Weighted Tangents key option 325 weights, set member 298
USING MAYA: ESSENTIALS 391
INDEX
West zone marking menu 37 When Opening option Preferences 317 When Saving option Preferences 317 white boxes in dependency graph 278, 279 Whole Face polygon selection option 327 Window Options option, Hotbox 35 Window Selection help browser option 317 Window Visibility help browser option 317 windowPrefs.mel 314 windows changing layout 36 wire file format 174 wireframe backface culling 322 change color 119 change color to default 119 displaying 120 displaying on shaded objects 318 option 120 resolution 318 shade option 120 Wireframe Color Display menu 119 Wireframe Colors changing palette 119 Wireframe on Shaded option 318 working units options 322 World Coordinate System option 42 world space 42 Move tool 90 World Space option 86 wrap influences, hiding 124
X xpm images for shelf icons 345 X-ray shade option 120 XYZ coordinate system 41
Y yaw 51
USING MAYA: ESSENTIALS 392
Yaw Pitch Tool 51 yellow nodes 287 Y-up orientation 41
Z zones Hotbox 33 marking menu 352 marking menu defaults 36 Zoom Scale setting 51 Zoom Tool 51 zooming cameras 51 Z-up orientation 42
CHARACTER SETUP VERSION 4
CHARACTER SETUP
2001, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A. All rights reserved. Maya 4 Documentation Team: Steven Brooks, Susan-Belle Ferguson, Lisa Ford, Claude Macri, Susan Park, Diane Ramey, and Linda Rose. Alias is a registered trademark and Alias|Wavefront, the Alias|Wavefront logo, Conductors, Dispatcher, Trax, Wavefront IPR, VizPaint2D, and ZaP!iT are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Maya is a registered trademark and Maya Artisan, Maya Builder, Maya Cloth, Maya Complete, Maya Fur, Maya F/X, Maya Invigorator, Maya Invigorator Lite Edition, Maya Live, Maya Paint Effects, Maya Real Time SDK,and Maya Unlimited are trademarks of Silicon Graphics, Inc., used exclusively by Alias|Wavefront, a division of Silicon Graphics Limited. IRIX and Silicon Graphics are registered trademarks and SGI is a trademark of Silicon Graphics, Inc. Wacom is a trademark of Wacom Co., Ltd. NVidia is a registered trademark and Gforce is a trademark of NVidia Corporation. Inferno and Flame are registered trademarks of Discreet Logic Inc. Linux is a registered trademark of Linus Torvalds. Red Hat is a registered trademark of Red Hat, Inc. Microsoft, Windows NT, and Windows 2000 are trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark, licensed exclusively through X/Open Company, Ltd. All other product names mentioned are trademarks or registered trademarks of their respective owners. Graph Layout Toolkit, 1992-1996 Tom Sawyer Software, Berkeley, California. All Rights Reserved. This document contains proprietary and confidential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, its affiliates, nor their directors, officers, employees, or agents are responsible for punitive or multiple damages or lost profits or other special, direct, indirect, incidental, or consequential damages including any damages resulting from loss of business arising out of or resulting from the use of this material, or for technical or editorial omissions made in this document.
ALIAS|WAVEFRONT ■ 210 KING STREET EAST ■ TORONTO, CANADA M5A 1J7
CONTENTS Part 1
Part 1 Character Setup and Maya 1
INTRODUCING CHARACTER SETUP
29
Understanding character setup How to use this book
2
31
CHARACTER SETUP FEATURES Using deformers Using skeletons Skinning
30
33 34
35
36
Using constraints
36
Using character sets
37
Part 2
Part 2 Deformers 3
INTRODUCING DEFORMERS Understanding deformers
41 41
Deformable objects, points, and sets
42
Nodes, history, and the deformation order Deformer placement
43
44
Editing deformer set membership
46
Editing deformer sets with Relationship Editor Providing exclusive deformer set membership
46 46
Editing deformer set membership with Edit Membership Tool Painting deformer set membership
47
Pruning deformer set membership
48
Point tweaking on objects being deformed
49
Displaying and hiding intermediate objects
50
Changing an object’s deformation order Showing and hiding all deformers Changing evaluation performance
46
50
51 51
USING MAYA: CHARACTER SETUP 3
CONTENTS
Changing deformer performance settings
51
Editing advanced deformer creation options Editing parallel blender channels
52
52
Creating shearing effects with shear channels Modeling with deformers
53
53
Setup and animation with deformers
54
Editing node behavior to improve performance Understanding node behavior attributes Editing node behavior
4
54 54
55
USING BLEND SHAPE DEFORMERS
57
Understanding blend shape deformers Target and base objects
57
58
Target shapes, base shapes, and blend shapes Targets
58
58
Related MEL commands
58
Dependency graph nodes
59
Creating blend shape deformers
59
Setting creation options
59
Creating a blend shape deformer
61
Editing blend shape deformation effects
61
Using the Blend Shape editor
61
Changing Blend Shape editor slider orientation
62
Editing blend shape deformer channels
62
Editing blend shape deformer attributes
63
Scaling influence of all targets
64
Matching position, rotation, and scaling of targets Blending objects with different topologies Deleting a target’s object
65
Setting target weights
65
Setting keys for blend shapes
66
Saving a blend shape as a new target Selecting a blend shape deformer node Creating a new blend shape deformer Adding target object shapes Setting add options
67 67
Adding a target object shape
USING MAYA: CHARACTER SETUP 4
64
68
66 67 67
64
CONTENTS
Removing target object shapes
69
Setting remove options
69
Removing a target shape
69
Swapping target object shapes
70
Setting swap options
70
Swapping two target shapes
70
Deleting blend shape deformers
5
USING LATTICE DEFORMERS
70
73
Understanding lattice deformers Lattices
73
73
Influence lattice and base lattice
73
Lattices as deformable objects
74
Lattice deformers and lattice flexors Related MEL commands
74
Dependency graph nodes Creating lattice deformers
74
74 74
Setting creation options
75
Creating a lattice deformer
76
Editing lattice deformation effects
76
Editing the influence lattice
77
Editing lattice deformer channels
77
Editing lattice deformer attributes
78
Editing influence lattice shape channels
79
Editing influence lattice shape attributes
79
Resetting influence lattice shape and location
80
Resetting influence lattice points and removing tweaks Editing lattice deformer sets
80
Pruning lattice deformer sets
81
Changing influence lattice resolution Toggling lattice shape handle (L icon)
81 81
Turning on or off display of lattice points
82
Showing and hiding all lattice deformers
82
Weighting lattice points to alter their influence Sculpting the influence lattice
82
82
Freezing the lattice deformation mapping Editing the base lattice
80
82
84
Grouping base and influence lattices
84
Parenting lattices to objects being deformed
84
USING MAYA: CHARACTER SETUP 5
CONTENTS
Deforming a lattice with other deformers
84
Assuring a smooth deformation through the base lattice Improving performance
85
Changing lattice resolution performance settings Deleting lattice deformers
85
85
Skinning with lattice deformers
6
USING CLUSTER DEFORMERS
86
87
Understanding cluster deformers
87
Related MEL commands
87
Dependency graph nodes Creating cluster deformers
88 88
Setting creation options
88
Creating a cluster deformer
89
Editing cluster deformation effects
89
Manipulating the cluster handle (C icon) Editing cluster deformer channels Editing cluster attributes
90 91
Pruning cluster deformer sets Editing cluster weights
89
90
Editing cluster deformer sets
91
92
Painting cluster weights
93
Adjusting jiggle weight by painting
99
Setting the cluster relative to the parent transform
102
Controlling the deformation percentage of the entire cluster Using weighted nodes
102
Setting the location of the cluster handle Deleting cluster deformers
7
USING JIGGLE DEFORMERS
105 105
Setting jiggle creation options Editing jiggle attributes
106
106
Adjusting jiggle weight by painting Using disk cache for jiggle animation
USING BEND NONLINEAR DEFORMERS Understanding bend deformers Related MEL commands
USING MAYA: CHARACTER SETUP 6
102
102
Creating Jiggle deformers
8
85
111 111 111
107 107
102
CONTENTS
Dependency graph nodes Creating bend deformers
112
112
Setting creation options
112
Creating a bend deformer
113
Editing bend deformation effects
113
Manipulating bend deformer handles Editing bend deformer channels
114
Editing bend deformer attributes
115
Deleting a bend deformer
9
114
116
USING FLARE NONLINEAR DEFORMERS
117
Understanding flare deformers
117
Related MEL commands
117
Dependency graph nodes Creating flare deformers
118
118
Setting creation options
118
Creating a flare deformer
119
Editing flare deformation effects
120
Manipulating flare deformer handles Editing flare deformer channels
121
Editing flare deformer attributes
122
Deleting flare deformers
10
120
123
USING SINE NONLINEAR DEFORMERS
125
Understanding sine deformers
125
Related MEL commands
125
Dependency graph nodes Creating sine deformers
125
126
Setting creation options
126
Creating a sine deformer Editing sine deformation effects
127 127
Manipulating sine deformer handles Editing sine deformer channels
129
Editing sine deformer attributes
129
Deleting sine deformers
11
128
130
USING SQUASH NONLINEAR DEFORMERS
131
USING MAYA: CHARACTER SETUP 7
CONTENTS
Understanding squash deformers
131
Related MEL commands
131
Dependency graph nodes Creating squash deformers
131 132
Setting creation options
132
Creating a squash deformer
133
Editing squash deformation effects
133
Manipulating squash deformer handles
134
Editing squash deformer channels
135
Editing squash deformer attributes
135
Deleting squash deformers Examples
136
137
Squashing a sphere onto the ground Bouncing ball setup
12
137
139
USING TWIST NONLINEAR DEFORMERS
143
Understanding twist deformers
143
Related MEL commands
143
Dependency graph nodes Creating twist deformers
143
144
Setting creation options
144
Creating a twist deformer
145
Editing twist deformation effects
145
Manipulating twist deformer handles Editing twist deformer channels
146
Editing twist deformer attributes
147
Deleting twist deformers Example
148
148
Spiral staircase modeling
13
148
USING WAVE NONLINEAR DEFORMERS Understanding wave deformers
149
Dependency graph nodes Creating wave deformers
149
150
Setting creation options Creating a wave deformer
USING MAYA: CHARACTER SETUP
149 149
Related MEL commands
8
145
150 151
CONTENTS
Editing wave deformation effects
151
Manipulating wave deformer handles Editing wave deformer channels
152
Editing wave deformer attributes
153
Deleting wave deformers Example
154
154
Ripple animation
14
151
154
USING SCULPT DEFORMERS
159
Understanding sculpt deformers Sculpt sphere
159
159
Flip mode
159
Project mode
160
Stretch mode
160
Related MEL commands
160
Dependency graph nodes Creating sculpt deformers
160
161
Setting creation options
161
Creating a sculpt deformer
162
Editing sculpt deformation effects
162
Manipulating the sculpt sphere
162
Manipulating the stretch origin locator Editing sculpt deformer channels
163
Editing sculpt deformer attributes
164
Editing sculpt deformer sets
165
Pruning sculpt deformer sets Deleting sculpt deformers
15
163
USING WIRE DEFORMERS Quick start
165
165 167
167
Understanding wire deformers
170
Influence wires and base wires Holders
170
170
Wire dropoff locators
171
Related MEL commands
171
Dependency graph nodes Creating wire deformers
171
171
Specifying Wire Tool’s tool settings
172
USING MAYA: CHARACTER SETUP 9
CONTENTS
Creating a wire deformer without holders
173
Creating a wire deformer with holders Editing wire deformation effects
174
175
Moving, rotating, and scaling influence wires
175
Moving, rotating, and scaling deformable objects Editing the shape of influence wires
175
Moving, rotating, and scaling base wires Adding influence wires
175
175
176
Removing influence wires
176
Controlling the effects of crossed influence wires Resetting influence wires
176
177
Creating wires groups that parent influence wires to base wires Editing wire deformer channels
177
Editing wire deformer attributes
178
Using wire dropoff locators for localized deformation effects Smoothing jagged effects Adding and removing holders
182 182
Moving, rotating, scaling holders Editing the shape of holders
183
Pruning wire deformer sets
USING WRINKLE DEFORMERS
183 183
Editing wire deformer sets
16
183
183 185
Understanding wrinkle deformers
185
Radial wrinkle deformers
186
Tangential wrinkle deformers
186
Custom wrinkle deformers
186
Related MEL commands
186
Dependency graph nodes Creating wrinkle deformers
186 187
Specifying Wrinkle Tool’s tool settings Creating a wrinkle deformer Editing wrinkle deformation effects
187
188 188
Manipulating the wrinkle deformer’s cluster deformer handle Moving, rotating, and scaling the influence wires Editing the wrinkle deformer’s cluster deformer Editing the wrinkle deformer’s wire deformers
USING MAYA: CHARACTER SETUP 10
180
182
Limiting the wire deformation region
Deleting wire deformers
177
189 189 189
188
CONTENTS
Deleting wrinkle deformers
17
USING WRAP DEFORMERS
189
191
Understanding wrap deformers Deformable objects
191 191
Wrap influence objects and wrap base objects Dependency graph nodes Creating wrap deformers
192
192
192
Creating objects to use as wrap influence objects Setting creation options
193
193
Creating a wrap deformer
195
Editing wrap deformation effects
195
Moving, rotating, or scaling wrap influence objects Manipulating wrap influence object points
195
196
Moving, rotating, or scaling deformed object
196
Editing NURBS wrap influence object channels
196
Editing polygonal wrap influence object channels Editing wrap deformer channels
197
Editing wrap deformer attributes
199
Adding and removing wrap influence objects Improving performance Deleting wrap deformers
200
200 200
Skinning with wrap deformers Examples
197
201
201
Deforming high-res sphere with low-res sphere Deforming plane with five cones
201
202
Part 3
Part 3 Skeletons 18
INTRODUCING SKELETONS
207
Understanding skeletons
207
Editing node behavior to improve performance Understanding node behavior attributes Editing node behavior Workflow summary
208 208
208
209
USING MAYA: CHARACTER SETUP 11
CONTENTS
19
BUILDING SKELETONS
211
Understanding skeleton construction Joints and bones Joint chains Limbs
212
213 214
214
Skeleton hierarchy
215
Related MEL commands
215
Dependency graph nodes
216
Creating joint chains and limbs
216
Specifying Joint Tool’s tool settings Creating a joint chain Creating a limb Editing joints
216
218 218
218
Editing joint attributes
218
Displaying a joint’s local axis
222
Orienting a joint’s local axis
222
Moving, rotating, or scaling a joint and its bone Editing joint chains, limbs, and skeletons Viewing skeleton hierarchy
222
223
223
Selecting joints and navigating the skeleton’s hierarchy Displaying all the local axes in a limb or skeleton Reorienting all local axes in limb or skeleton Inserting a joint
223
224
Removing a joint
224
Disconnecting joints to create new skeletons
225
Connecting joints to combine two skeletons Mirroring limbs or skeletons Rerooting a skeleton
225
226 227
Setting display size of all joints
227
Displaying joints as boxes rather than bones Setting and assuming preferred angles
20
POSING SKELETONS
231
Understanding skeleton posing Forward kinematics (FK) Inverse kinematics (IK) IK handles and IK chains IK solvers and systems Related MEL commands USING MAYA: CHARACTER SETUP 12
223
232 232 233 234 235 235
227 228
223
CONTENTS
Dependency graph nodes
236
Posing with forward kinematics (FK)
236
Posing with inverse kinematics (IK)
236
IK rotate plane handles and solvers
236
IK single chain handles and solvers IK spline handles and solvers Using IK solvers and systems
237 237
237
Creating IK solvers
237
Editing IK system attributes
238
Disabling and enabling all IK solver nodes Switching between IK and FK
239
239
Procedures for switching between IK and FK
240
About the Graph Editor display resulting from Set IK/FK Key Example of switching from FK to IK
21
USING IK ROTATE PLANE HANDLES
242
245
Understanding IK rotate plane handles Start and end joints
246
246
Handle position control gnomon End effector
247
Handle wire
248
Handle vector
249
Joint chain plane
249
Joint chain plane indicator
250
250
Reference plane Pole vector
247
248
Rotation disc
Twist disc
242
251 251
Reference plane indicator Twist indicator
252
252
Related MEL commands
252
Dependency graph nodes
252
Understanding IK rotate plane solver behavior Creating IK rotate plane handles
253
253
Specifying IK Handle Tool’s tool settings Creating an IK rotate plane handle Posing IK rotate plane handles Moving the handle
253 254
254 254 USING MAYA: CHARACTER SETUP 13
CONTENTS
Manipulating the pole vector
254
Manipulating the twist disc
255
Controlling joint chain flipping Editing IK rotate plane handles
255 255
Editing IK rotate plane handle channels
255
Editing IK rotate plane handle attributes
256
Editing IK rotate plane solver attributes Deleting IK rotate plane handles
22
260
USING IK SINGLE CHAIN HANDLES
261
Understanding IK single chain handles Start and end joints
259
262
262
Handle position and orientation control gnomon End effector
263
Handle wire
264
Handle vector
264
Related MEL commands
264
Dependency graph nodes
265
Understanding IK single chain solver behavior Creating IK single chain handles
265
265
Specifying IK Handle Tool’s tool settings Creating an IK single chain handle Posing IK single chain handles Moving the handle
265 266
267 267
Rotating the handle
267
Editing IK single chain handles
267
Editing IK single chain handle channels
267
Editing IK single chain handle attributes
268
Editing IK single chain solver attributes Deleting IK single chain handles
23
USING IK SPLINE HANDLES
270
271
273
Understanding IK spline handles
273
Related MEL commands
273
Dependency graph nodes Creating IK spline handles Animating the joint chain
274 274 275
Setting options before creating the IK spline handle USING MAYA: CHARACTER SETUP 14
263
278
CONTENTS
Setting attributes after creating the IK spline handle Preventing unwanted start joint flipping Working with soft body curves
282
283
Tips for working with IK spline handles
284
Working with human skeletons
284
Working with animal skeletons
285
Working with sinuous motion on skeletons
24
USING IK TWO BONE HANDLES Quick start
281
286
289
290
Understanding IK two bone handles Start and end joints
291
292
Handle position control gnomon End effector
293
Handle wire
293
Handle vector
292
294
Rotation disc
294
Joint chain plane
295
Joint chain plane indicator Twist disc
296
Reference plane Pole vector
295
296 296
Reference plane indicator Twist indicator
297
297
Related MEL commands
298
Dependency graph nodes
298
Understanding IK two bone solver behavior Creating IK two bone handles
298
299
Setting up the IK two bone solver
299
Specifying IK Handle Tool’s tool settings Creating an IK two bone handle Posing IK two bone handles Moving the handle
300
300 300
Manipulating the pole vector Manipulating the twist disc
300 301
Controlling joint chain flipping Editing IK two bone handles
299
301
301
Editing IK two bone handle channels
301
USING MAYA: CHARACTER SETUP 15
CONTENTS
Editing IK two bone handle attributes
302
Editing IK two bone solver attributes Deleting IK two bone handles
305
305
IK two bone solver plug-in source code
306
Part 4
Part 4 Skinning 25
INTRODUCING SKINNING
309
Understanding skinning
309
Deformable objects and skin objects Direct skinning methods
310
Indirect skinning methods Bind pose
309
310
311
Double transformation effects
311
Editing skin point set memberships
311
Changing a skinned object’s deformation order Point tweaking skinned objects
312
Editing node behavior to improve performance Understanding node behavior attributes Editing node behavior Workflow summary
26
SMOOTH SKINNING
314
314 315
Understanding smooth skinning
316
Smooth skin objects and points Smooth skin point weights Smooth skin point sets
316 316
318
Smooth skin influence objects Related MEL commands
318 319
Dependency graph nodes Binding smooth skin
319
319
Setting smooth bind options Checking the binding
319 321
Adjusting smooth skin behavior Editing smooth skin USING MAYA: CHARACTER SETUP 16
321
311
321
313 313
CONTENTS
Going to the bind pose
321
Overcoming problems with reaching bind pose Changing the bind pose
322
322
Editing maximum influences
322
Editing joint smooth skin attributes
322
Editing skin cluster channels
323
Editing skin cluster attributes
324
Editing skin point weights
325
Painting smooth skin point weights
327
Mirroring smooth skin weights
331
Copying smooth skin weights
331
Resetting skin point weights to default weights Holding smooth skin weights
332
332
Controlling smooth skin weight normalization Pruning insignificant smooth skin weights
333 334
Removing unused influences from a smooth skinned surface Batch export and import of smooth skin weight maps Detaching smooth skin
338
Adding an influence object
339
Removing an influence object
340
Editing NURBS influence object attributes
340
Editing polygonal influence object attributes
341
341
Skinning a cylinder by smooth skinning Hand muscle bulge with influence object
341 345
Using influence objects to prevent unwanted deformation
27
334
337
Using smooth skin influence objects
Examples
334
RIGID SKINNING
351
Understanding rigid skinning
352
Rigid skin objects and points Rigid skin point weights Rigid skin point sets Flexors
353
353
Dependency graph nodes
354 354
354
Setting rigid bind options Binding skin
352 352
Related MEL commands
Binding rigid skin
348
355
356
USING MAYA: CHARACTER SETUP 17
CONTENTS
Checking the binding
356
Adjusting rigid skin behavior Editing rigid skin
356
356
Going to the bind pose
356
Overcoming problems with reaching the bind pose Changing the bind pose
357
Editing joint cluster channels
357
Editing joint cluster attributes
358
Editing rigid skin point weights
359
Painting rigid skin point weights
361
Editing rigid skin point set membership
363
Painting rigid skin point set membership Detaching rigid skin
364
366
Detaching and reattaching skeleton
367
Detaching and reattaching selected joints Creating flexors
368
368
Creating all types of flexors Editing joint lattice flexor effects
368 370
Manipulating the joint lattice flexor’s influence lattice Copying joint lattice flexors
Editing bone lattice flexor effects
371
372
Manipulating bone lattice flexor’s influence lattice Copying bone lattice flexors
372
Editing bone lattice flexor channels
372
Reassigning bone lattice flexor joints
373
Editing joint or bone sculpt flexor effects
374
Manipulating the sculpt sphere
374
Editing sculpt flexor channels Editing joint cluster flexor effects
374 375
Editing with joint cluster flexor manipulators 375
Skinning a cylinder by rigid skinning
USING MAYA: CHARACTER SETUP 18
370
370
Editing joint lattice flexor channels
Example
357
375
375
372
CONTENTS
Part 5
Part 5 Constraints 28
INTRODUCING CONSTRAINTS
381
Understanding constraints
381
Constraint node behavior
382
Understanding node behavior attributes Editing node behavior
382
383
Enabling and disabling all constraint nodes Workflow summary
29
384
USING POINT CONSTRAINTS
385
Understanding point constraints
385
Constrained and target objects Target point
383
385
386
Target object weights
386
Constrained object’s position Locked channels
386
386
Related MEL commands
386
Dependency graph nodes Creating point constraints
386
387
Setting constraint options
387
Creating a point constraint Editing point constraints
387
387
Editing point constraint channels
388
Editing point constraint attributes
388
Adding target objects
389
Removing target objects
390
Changing target object weights
390
Animating target object weights
390
Offsetting constrained object’s position Deleting point constraints
390
391
Using point on curve locator constraints
391
Creating point on curve locator constraint Editing least squares modifier attributes
30
USING AIM CONSTRAINTS
391 392
395
USING MAYA: CHARACTER SETUP 19
CONTENTS
Understanding aim constraints
395
Constrained and target objects Target point
395
395
Target object weights
396
Constrained object’s orientation Rolling effects
396
397
Motion history dependence effects Locked channels
398
Related MEL commands
398
Dependency graph nodes Creating aim constraints
398
398
Setting constraint options
398
Creating an aim constraint Editing aim constraints
397
399
399
Editing aim constraint channels
399
Editing aim constraint attributes
400
Adding target objects
402
Removing target objects
402
Changing target object weights Preventing rolling effects
403
403
Controlling motion history dependence effects Deleting aim constraints Examples
404
404
Aiming a sphere at a sphere
404
Aiming a cone at a sphere
31
USING ORIENT CONSTRAINTS
405
407
Understanding orient constraints
407
Constrained and target objects Target orientation
407
407
Target object weights
408
Constrained object’s orientation Locked channels
408
Related MEL commands
408
Dependency graph nodes Creating orient constraints
408 408
Setting constraint options Creating an orient constraint
USING MAYA: CHARACTER SETUP 20
408
408 409
403
CONTENTS
Editing orient constraints
409
Editing orient constraint channels
409
Editing orient constraint attributes
410
Adding target objects
411
Removing target objects
411
Changing target object weights
411
Animating target object weights
412
Deleting orient constraints
32
USING SCALE CONSTRAINTS
412 413
Understanding scale constraints
413
Constrained and target objects Target scale
413
414
Target object weights
414
Constrained object’s scaling Locked channels
414
414
Related MEL commands
414
Dependency graph nodes Creating scale constraints
414
414
Setting constraint options
414
Creating a scale constraint Editing scale constraints
415
415
Editing scale constraint channels
415
Editing scale constraint attributes
416
Adding target objects
417
Removing target objects
Changing target object weights
417
Animating target object weights
418
Deleting scale constraints
33
417
418
USING GEOMETRY CONSTRAINTS
419
Understanding geometry constraints
419
Constrained and target objects Target point
419
420
Target object weights
420
Constrained object’s position Motion history dependence Locked channels
420 420
420
Related MEL commands
420
USING MAYA: CHARACTER SETUP 21
CONTENTS
Dependency graph nodes
421
Creating geometry constraints
421
Setting constraint options
421
Creating a geometry constraint Editing geometry constraints
421
422
Editing geometry constraint channels
422
Editing geometry constraint attributes
422
Adding target objects
423
Removing target objects
424
Changing target object weights
424
Animating target object weights
424
Animating the constrained object
425
Using a point constraint with a geometry constraint Deleting geometry constraints
34
USING NORMAL CONSTRAINTS
425 427
Understanding normal constraints
427
Constrained and target objects Target vector
428
428
Target object weights
428
Constrained object’s orientation Rolling effects
428
429
Motion history dependence effects Locked channels
429
430
Related MEL commands
430
Dependency graph nodes Creating normal constraints
430 430
Setting constraint options
430
Creating a normal constraint Editing normal constraints
431
432
Editing normal constraint channels
432
Editing normal constraint attributes
432
Adding target objects Removing target objects
434 435
Changing target object weights Preventing rolling effects
435
435
Controlling motion history dependence effects Deleting normal constraints
USING MAYA: CHARACTER SETUP 22
425
436
436
CONTENTS
35
USING TANGENT CONSTRAINTS
437
Understanding tangent constraints
437
Constrained and target objects Target vector
438
438
Target object weights
438
Constrained object’s orientation Rolling effects
438
439
Motion history dependence effects Locked channels
439
440
Related MEL commands
440
Dependency graph nodes Creating tangent constraints
440 440
Setting constraint options
440
Creating a tangent constraint Editing tangent constraints
441
442
Editing tangent constraint channels
442
Editing tangent constraint attributes
442
Adding target objects
444
Removing target objects
445
Changing target object weights Preventing rolling effects
445
445
Controlling motion history dependence effects Deleting tangent constraints
36
446
USING POLE VECTOR CONSTRAINTS
447
Understanding pole vector constraints Target objects Target point
447
448 448
Target object weights
448
Constrained pole vector’s end position Locked channels
446
448
448
Related MEL commands
449
Dependency graph nodes
449
Creating pole vector constraints
449
Setting constraint options
449
Creating a pole vector constraint Editing pole vector constraints
450
450
Editing pole vector constraint channels
450
USING MAYA: CHARACTER SETUP 23
CONTENTS
Editing pole vector constraint attributes Adding target objects
450
452
Removing target objects
452
Changing target object weights
452
Offsetting constrained pole vector’s end position Deleting pole vector constraints
453
453
Part 6
Part 6 Character Sets 37
INTRODUCING CHARACTER SETS
457
Understanding character sets
457
Character node behavior
458
Understanding node behavior attributes Editing node behavior Workflow summary
38
458
459
459
DEFINING CHARACTER SETS
461
Understanding character set definition Related MEL commands
462
Dependency graph nodes Creating character sets
461 462
462
Setting creation options
462
Creating a character set
463
Creating character sets within character sets Creating subcharacter sets Editing character sets
464 464
Selecting character sets
464
Adding channels to a character set
465
Removing channels from a character set Editing character set channels Editing character attributes Editing a character set
24
465
465 466
466
Viewing and editing the character partition Merging character sets
468
Deleting character sets
468
USING MAYA: CHARACTER SETUP
464
467
CONTENTS
39
ANIMATING CHARACTER SETS
469
Understanding animating characters Setting the current character Set Keyframing character sets
469 470
470
Creating expressions for character sets
470
Using motion capture for character sets
471
USING MAYA: CHARACTER SETUP 25
CONTENTS
USING MAYA: CHARACTER SETUP 26
PART 1
CHARACTER SETUP AND MAYA
1
INTRODUCING CHARACTER SETUP Maya offers the most sophisticated tools available for setting up characters so that you can then focus on the creative challenges of character animation.
Character setup by Jason Schleifer
CHARACTER SETUP AND MAYA
CHARACTER SETUP 29
INTRODUCING CHARACTER SETUP | 1 Understanding character setup
UNDERSTANDING CHARACTER SETUP Character setup (or “rigging”) is preparing models and related objects for animation. Model of character
Model set up and ready for animation
A model consists of one or more geometry objects (for example, NURBS or polygonal surfaces). Preparing the model for animation includes using Maya’s deformers, skeletons, skinning, constraints, and characters features in the Animation menu set. This book focuses on these features. For overviews of these features, see Chapter 2, “Character Setup Features.” This book assumes you understand Maya’s fundamental features. To get started quickly with the several important character setup features, see the Character Setup lessons in Instant Maya. Character setup can also involve the use of expressions (see Using Maya: Expressions) and dynamics (see Using Maya: Dynamics). As you prepare for animation, you should think ahead about how you would like to render your characters (see Using Maya: Rendering). Further, during character setup you might want to take advantage of other aspects of Maya, such as Maya Fur and Maya Cloth. After you’ve set up your characters, you’re ready to animate them. For more information about Maya’s animation features, see Using Maya: Animation.
CHARACTER SETUP 30
PART 1
INTRODUCING CHARACTER SETUP | 1 How to use this book
HOW TO USE THIS BOOK
Character setup by Jason Schleifer
Using Maya: Character Setup is a task-oriented reference. It describes the features of the Animation menu set’s Deform, Skeleton, Skin, Constrain, and Character menus. (For information about the other menus in the Animation menu set, refer to Using Maya: Animation.) As you use the features provided by the Deform, Skeleton, Skin, Constrain, and Character menus, use this book as a reference to find out more about the basic tasks of character setup. For example, to find out about editing a particular attribute, look it up in the index and then turn to the appropriate section. This book is not meant to be read straight through, but skimming through it can provide you with an overall picture of Maya’s character setup features.
CHARACTER SETUP AND MAYA
CHARACTER SETUP 31
INTRODUCING CHARACTER SETUP | 1 How to use this book
CHARACTER SETUP 32
PART 1
2
CHARACTER SETUP FEATURES The character setup features include deformers, skeletons, skinning, constraints, and characters.
Image and character setup by the Stain X team
CHARACTER SETUP AND MAYA
CHARACTER SETUP 33
CHARACTER SETUP FEATURES | 2 Using deformers
USING DEFORMERS
Deformers enable you to change the shape of objects. Deformers features are available in the Animation menu set’s Deform menu. For more information on deformers, see Chapter 3, “Introducing Deformers.”
CHARACTER SETUP 34
PART 1
CHARACTER SETUP FEATURES | 2 Using skeletons
USING SKELETONS
Skeletons enable you to create hierarchical, articulated deformation effects. Skeletons features are available from the Animation menu set’s Skeleton menu. For more information on skeletons, see Chapter 18, “Introducing Skeletons.” After you create a skeleton, you bind it to objects you want to deform by skinning.
CHARACTER SETUP AND MAYA
CHARACTER SETUP 35
CHARACTER SETUP FEATURES | 2 Skinning
SKINNING
Skinning is setting up a model’s objects so that they can be deformed by skeletons. Skinning features are available from the Animation menu set’s Skin menu. For more information on skinning, see Chapter 25, “Introducing Skinning.”
USING CONSTRAINTS
Constraints enable you to constrain the position, orientation, or scale of an object to other objects. Constraints features are available from the Animation menu set’s Constrain menu. For more information on constraints, see Chapter 28, “Introducing Constraints.”
CHARACTER SETUP 36
PART 1
CHARACTER SETUP FEATURES | 2 Using character sets
USING CHARACTER SETS
Character sets bring together all the aspects of a character that you want to animate together. Character sets are available from the Animation menu set’s Character menu. For more information on character sets, see Chapter 37, “Introducing Character Sets.”
CHARACTER SETUP AND MAYA
CHARACTER SETUP 37
CHARACTER SETUP FEATURES | 2 Using character sets
CHARACTER SETUP 38
PART 1
PART 2
DEFORMERS
3
INTRODUCING DEFORMERS Maya’s deformers enable you to change the shape of objects. Lattice and squash deformers acting on head
UNDERSTANDING DEFORMERS With Maya’s deformers, you can change the shape of objects. Maya includes the following types of deformers:
DEFORMERS
•
Blend shape deformers: Blend shape deformers let you change the shape of one object into the shapes of other objects. For more information, see Chapter 4, “Using Blend Shape Deformers.”
•
Lattice deformers: Lattice deformers enable you to deform objects with lattices. For more information, see Chapter 5, “Using Lattice Deformers.”
•
Jiggle deformers: Jiggle deformers let you cause points on a surface or curve to shake as they move, speed up, or slow down. For more details, see Chapter 7, “Using Jiggle Deformers.”
CHARACTER SETUP 41
INTRODUCING DEFORMERS | 3 Understanding deformers •
Cluster deformers: Cluster deformers enable you to control a set of an object’s points (CVs, vertices, or lattice points) with varying amounts of influence. For more information, see Chapter 6, “Using Cluster Deformers.”
•
Bend nonlinear deformers: Bend deformers enable you to bend an object along an arc. For more information, see Chapter 8, “Using Bend Nonlinear Deformers.”
•
Flare nonlinear deformers: Flare deformers enable you to flare or taper an object about two axes. For more information, see Chapter 9, “Using Flare Nonlinear Deformers.”
•
Sine nonlinear deformers: Sine deformers enable you to change to the shape of an object along a sine wave. For more information, see Chapter 10, “Using Sine Nonlinear Deformers.”
•
Squash nonlinear deformers: Squash deformers enable you to squash and stretch objects. For more information, see Chapter 11, “Using Squash Nonlinear Deformers.”
•
Twist nonlinear deformers: Twist deformers enables you to twist the shape of objects. For more information, see Chapter 12, “Using Twist Nonlinear Deformers.”
•
Wave nonlinear deformers: Wave deformers enable you to deform objects with a circular sine wave and create ripple effects. For more information, see Chapter 13, “Using Wave Nonlinear Deformers.”
•
Sculpt deformers: Sculpt deformers enable you to deform objects with a spherical influence object. For more information, see Chapter 14, “Using Sculpt Deformers.”
•
Wire deformers: Wire deformers enable you to deform objects with one or more NURBS curves. For more information, see Chapter 15, “Using Wire Deformers.”
•
Wrinkle deformers: Wrinkle deformers enable you to create detailed wrinkling effects by combining wire deformers with a cluster deformer. For more information, see Chapter 16, “Using Wrinkle Deformers.”
•
Wrap deformers: Wrap deformers enable you to deform objects with NURBS surfaces, NURBS curves, or polygonal surfaces (meshes). For more information, see Chapter 17, “Using Wrap Deformers.” Note that other software packages use the terms “modifiers” and “space warp” to refer to what Maya calls deformers.
Deformable objects, points, and sets A deformer can create deformation effects on any deformable object. A deformable object is any object whose structure is defined by control points. Control points include NURBS control vertices (CVs), polygonal vertices, and lattice points. NURBS curves, NURBS surfaces, polygonal surfaces (meshes), and lattices are all deformable objects. For brevity, control points are often called points, and the control points of a deformable object are often called deformable object points. Maya Unlimited’s subdivision surfaces are deformable. For more information, see Using Maya: Subdivision Surfaces Modeling. Using Maya’s API development tools, you can define your own, custom deformable objects. For more information, see the online Maya Developer’s Tool Kit documentation. A character’s model can consist of one deformable object (for example, a large polygonal surface) or of groups of deformable objects (for example, groups of NURBS surfaces).
CHARACTER SETUP 42
PART 2
INTRODUCING DEFORMERS | 3 Understanding deformers When you create a deformer, Maya puts all the deformable object points that the deformer can affect into a set, called a deformer set. You can edit this set; for more information, see "Editing deformer set membership" on page 46.
Nodes, history, and the deformation order One way to think about a scene in Maya is that it is a web of nodes. Each node consists of specific information and actions associated with that information. Each node can receive, hold, and provide information by means of attributes. A node’s attributes can connect to the attributes of other nodes, thus forming the web of nodes. As you use Maya’s interface, Maya creates, connects, evaluates, and destroys nodes. At any moment, what you see in the workspace is the result of how Maya is continuously evaluating the web of nodes that underlies and comprises your work. In short, underlying everything you do in Maya lies Maya’s dynamic, node-based architecture.
Dependency graph Maya’s dependency graph provides a representation of the relationships between connected nodes. To view the dependency graph, you can use the Hypergraph (for more information, see Using Maya: Essentials). For any particular node, the dependency graph shows the node’s history. The node’s history includes all the nodes that are connected to it, or are connected to nodes that are connected to it, and so on. For discussing a node’s history, the terms upstream and downstream can be useful. Upstream nodes are nodes that can be evaluated before the node itself is evaluated, and downstream nodes are nodes that can be evaluated only after the node itself is evaluated. Note that, from Maya’s perspective, a node’s history includes its future as well as its past.
Deformation order It’s important to keep a node’s history in mind when using deformers. The deformation effect provided by a particular deformer can depend on where Maya places the deformer in the node’s history. The reason is that the deformation effect can vary depending on the order in which Maya evaluates the deformations. The order in which Maya evaluates deformations is called the deformation order. In general, you can apply as many deformers to an object as you like. Because the effects depend on the order in which the deformers deform the object, you can create a great variety of effects. For example, for a NURBS cylinder, if you create a bend deformer and then create a sine deformer, the result will be different than if you first created the sine deformer and then created the bend deformer.
DEFORMERS
CHARACTER SETUP 43
INTRODUCING DEFORMERS | 3 Understanding deformers
Undeformed cylinder
Bend followed by sine
Sine followed by bend
In general, by default, the order in which deformers act on a deformable object’s original shape is the order in which the deformers were created. The deformers created first act on the original shape first, and the deformers created last act on the original shape last.
Deformation chain Consider the history of a NURBS sphere being deformed by one or more deformers. In the dependency graph, the original (undeformed) shape node (nurbsSphereShapenOrig) would follow immediately after the make node (makeNurbSpheren). Note that Maya sometimes refers to an object displayed as the original shape node an “intermediate object.” Maya places a tweak node (tweakn) after the original shape node (for more information on tweak nodes, see "Point tweaking on objects being deformed" on page 49). After the tweak node, Maya places the deformer nodes that carry out deformations, typically in the order that the deformers were created. The order in which Maya places the deformer nodes downstream from the original shape node determines the deformation order. However, note that you can control deformer placement (see "Deformer placement" on page 44) when you create a deformer, and change the deformation order (see "Changing an object’s deformation order" on page 50) after creation. Finally, after the deformer nodes, Maya places a shape node that provides the final (deformed) shape of the sphere (nurbsSphereShapen). The sphere’s history determines the deformation order. Because Maya evaluates the sphere starting from the make node and working all the way through in order to the final (deformed) shape node, the node connections involved are said to provide a “deformation chain.”
Deformer placement When you create a deformer, you can specify the deformer’s placement in the deformable object’s deformation order (see "Editing advanced deformer creation options" on page 52). The placement can affect the deformer’s effect and performance. Maya includes the following deformation order placement options: •
CHARACTER SETUP 44
Default placement PART 2
INTRODUCING DEFORMERS | 3 Understanding deformers •
Before placement
•
After placement
•
Split placement
•
Parallel placement
•
Front Of Chain placement Note that after you create a deformer, you can edit a deformer node’s placement by changing the deformation order (see "Changing an object’s deformation order" on page 50).
Default placement With Default placement, Maya places the deformer just upstream of (before) the deformed shape. Default placement is the same as Before placement unless the deformer is going to act on a shape node with no history. In this case, the placement will be the same as After placement. When you create a number of deformers for an object with Default placement, the result is a deformation chain whose order is the same as the order in which you created the deformers.
Before placement With Before placement, Maya places the deformer immediately upstream of the deformable object’s deformed shape. In the object’s history, the deformer will be placed right before the deformed shape.
After placement With After placement, Maya places the deformer immediately downstream of (after) the deformable object. You would use After placement to create an intermediate deformed shape somewhere in the middle of the object’s history. Note that with After placement, the original shape of the object is not hidden.
Split placement With Split placement, Maya splits the deformation into two deformation chains. You would use Split placement to deform an object in two ways at the same time, creating two final shapes that originate from the same original shape.
Parallel placement With Parallel placement, Maya places the deformer in parallel with the existing upstream nodes in the object’s history, and then blends the effects provided by the existing upstream nodes and the deformer. A parallel blender node (default name: parallelBlendern) that blends the effects of the existing upstream nodes and the new deformer will be placed right before the final shape. Parallel placement is useful when you want to blend the influences of several deformers acting on an object. For example, if for some object you create a bend deformer with Default placement, and then create a Sine deformer with Parallel placement, you can directly control how much influence each deformer has on the object, blending the influence of each deformer. The parallelBlender node provides a weight channel for each deformer. You can edit the channels of the parallel blender node; for more information, see "Editing parallel blender channels" on page 52. DEFORMERS
CHARACTER SETUP 45
INTRODUCING DEFORMERS | 3 Editing deformer set membership
Front Of Chain placement Front Of Chain placement is available as a creation option for blend shape deformers only. A typical use of blend shape deformers is to create deformation effects on a skinned character. Front Of Chain placement assures that blend shape deformation effects occur before the deformation effects provided by the skinning occur. If the effects were to occur afterwards, undesirable double transformation effects could occur when you pose the skeleton. (For more information on double transformation effects, see "Double transformation effects" on page 311). With Front Of Chain placement, you put the deformer in front of all the deformer and skinning nodes in the deformable object’s shape history, but not ahead of any tweak nodes. (Tweak nodes enable you to do point tweaking on objects being deformed; for more information, see "Point tweaking on objects being deformed" on page 49.) Note that the input to the deformer will be the upstream shape rather than the visible downstream shape. Consequently, when you create the deformer, the deformation effect will be most intuitive if the downstream deformers are in their reset positions, using HasNoEffect node states. (For more information about node states, see "Editing node behavior to improve performance" on page 54).
EDITING DEFORMER SET MEMBERSHIP Maya provides several ways that you can edit deformer set membership. You can edit deformer set membership with the Relationship Editor. The Relationship Editor lists all the deformer sets in your scene, and lists all the points in each set. With the Relationship Editor, you can also provide for exclusive deformer set membership so that a point can be in only one set. You can directly edit deformer set memberships by picking deformable object points with the Edit Membership Tool. Further, you can paint deformer set memberships interactively with the Paint Set Membership Tool. This tool provides an intuitive, easy-to-use way to edit set membership. For the cluster, sculpt, lattice, and wire deformers only, you can quickly prune all points from the deformer set. Editing deformer set membership is described in the following topics:
Editing deformer sets with Relationship Editor To edit deformer sets with the Relationship Editor, select Window > Relationship Editors > Deformer Sets. For more information about sets and using the Relationship Editor, refer to Using Maya: Essentials.
Providing exclusive deformer set membership The exclusive option helps you to create non-overlapping deformations by ensuring that the sets belonging to each deformer are mutually exclusive. The mutual exclusivity of the deformers is accomplished by placing the deformer’s sets into a partition. The partition guarantees that the sets will continue to be mutually exclusive even if you edit the membership of the sets. To put deformer sets into a partition, use the Relationship Editor. For more information on sets, partitions, and the Relationship Editor, refer to Using Maya: Essentials.
Editing deformer set membership with Edit Membership Tool You can directly edit deformer set membership with the Edit Membership Tool.
CHARACTER SETUP 46
PART 2
INTRODUCING DEFORMERS | 3 Editing deformer set membership To edit deformer set membership with the Edit Membership Tool: 1
Select Deform > Edit Membership Tool.
2
Select the deformer you want to edit.
3
Go into component selection mode (click the select by component type icon). The members of the deformer set whose joint you selected are displayed in yellow. This set is the currently selected set. Members of other sets are displayed in other colors. Points displayed in dark red are not in a set.
4
To add points to the currently selected set, select them while pressing the Shift key and left mouse button, and then release the mouse button. The selected points are now displayed in yellow, indicating they are in the currently selected set.
5
To remove points from the currently selected set, select them while pressing the Ctrl key and the left mouse button, and then release the mouse button. The selected points are now displayed in dark red, indicating they are currently not in a set.
6
Click the Select Tool to quit the editing mode.
Painting deformer set membership Using the Paint Set Membership Tool you can modify which of a deformable object’s points (for example, CVs or vertices) belong to multiple deformer sets by painting the points you want added to, transferred to, or removed from the set. To modify which vertices belong to a set: 1
Select a deformed object (or a skinned object).
2
Go into smooth shading mode by selecting Shading > Smooth Shade All (default hotkey: 5).
3
Select Deform > Paint Set Membership Tool ❐ and define tool settings, if required. For details on defining tool settings, see "Setting Paint Set Membership Tool options" on page 48.
4
Select the set you want to modify, as follows:
•
In the Tool Settings editor (Deform > Paint Set Membership Tool ❐), click the SetMembership tab. In the Set Membership section, click the set in the Select Set To Modify box. The selected set name appears in the Set To Modify box. or
DEFORMERS
•
Use the Pick Color Mode hotkey (default hotkey: /) to select the set on the surface. Hold down the hotkey, click on the set you want to paint (click anywhere on the colored area), then release the hotkey.
5
Select an operation and define the tool settings, if required. For details, see "Setting Paint Set Membership Tool options" on page 48.
6
Drag over the CVs or vertices you want to add to, transfer to, or remove from the selected set.
CHARACTER SETUP 47
INTRODUCING DEFORMERS | 3 Editing deformer set membership
Setting Paint Set Membership Tool options Before you paint set membership, set the options for the Paint Set Membership Tool. The settings determine the effect you will achieve when you paint with the tool. You can define the following tool settings: •
brush stamp profile
•
paint set membership operation
•
set to modify For details on defining settings, see Using Maya: Painting. To define Paint Set Membership Tool options: Select the Paint Set Membership Tool and open the Tool Settings editor (Deform > Paint Set Membership Tool ❐). Selecting the paint set membership operation If the object includes multiple deformer sets, the Add operation leaves the painted CVs or vertices in the their current sets and adds them to the selected set.
Add
If the object is a rigid skin object, the Add operation does the same thing as the Transfer operation: removes the painted CVs or vertices from their current set and adds them to the selected set. If the object includes multiple deformer sets, the Transfer operation removes the painted CVs or vertices from their current sets and adds them to the selected set.
Transfer
If the object is a rigid skin object, the Transfer operation does the same thing as the Add operation: removes the painted CVs or vertices from their current set and adds them to the selected set. The Remove operation removes the painted CVs or vertices from the sets they belong to, so the CVs vertices are not influenced by any deformers or joints.
Remove
Selecting the set to modify Select Set To Modify
Click the name of the set you want to add to, transfer to, or remove from. This is just one way of selecting the set. There are two others. For details, see "Painting deformer set membership" on page 47. The name of the set you select appears in this box.
Set To Modify
Pruning deformer set membership You can remove unaffected points from a deformer set based on which points the deformer is affecting. Use this to avoid unnecessary calculations for points that are not being affected by the deformation. To prune deformer set membership: 1
Select deformable objects whose currently unaffected points you want to prune from the deformation.
2
Select Deform > Prune Membership, and from the cascading menu select the deformer whose set you want to prune.
CHARACTER SETUP 48
PART 2
INTRODUCING DEFORMERS | 3 Point tweaking on objects being deformed The pruning operation considers only the current position of each component in the undeformed and deformed versions of the geometry affected by the specified deformation. If you have animated attributes of your deformation, the pruning operation is performed based only on the current attribute values. This means that components that are potentially affected at other frames of your animation might get pruned out if they are unaffected at the current frame. Since a typical blend shape operation has weights of 0.0 for some target shapes at any point in time, this operation is especially dangerous when applied to blend shape deformations. For this reason, there is no menu item provided to prune membership for blend shape deformers. (You can still use this function through the command line.)
POINT TWEAKING ON OBJECTS BEING DEFORMED Point tweaking is moving or setting keys on the individual points of an object. When you tweak the points of an object for which you have already created some deformers, Maya automatically prevents the unexpected effects that can occur when you use deformers. Maya does so by applying the tweaks to the object before applying any deformations to the object. When you create deformers, Maya creates tweak nodes as well as deformation nodes. In the dependency graph, Maya places the tweak nodes upstream from the deformation nodes so that any point tweaking is carried out before the evaluation of the deformation nodes. This placement means that, by default, an object’s deformation order includes point tweaking first, and then includes deformations in the order that the deformers were created.
Avoid changing the number of points after you create deformers You can do point tweaking on objects after you have created deformers for them, but you should avoid changing the number of the object’s points (for example, CVs, vertices, or lattice points). Changing the number of points can lead to unexpected deformation effects. Note that when the deformation order includes point tweaking first (the default), CVs may not move in the same direction as the Move tool’s manipulator if the attributes of the deformers do not have their initial (reset) values. If you would like to change this, reset the deformers to have their initial (reset) values. Alternatively, you could change the deformation order so that Maya applies the point tweaking after applying deformations. However, if Maya applies point tweaking after applying deformations, you may get unexpected effects when you use the deformers. If you do some point tweaking and then want to check how the object deforms without the tweaking, you can disable the tweak node. To change point tweaking’s deformation order: 1
In the scene, move the pointer to the object being deformed and press the right mouse button. A marking menu is displayed.
2 DEFORMERS
From the marking menu, select Inputs > Complete List.
CHARACTER SETUP 49
INTRODUCING DEFORMERS | 3 Displaying and hiding intermediate objects The List of history operations window is displayed for the selected object. 3
Move the pointer over the name of the tweak node (default name: tweakn) whose order you want to change. Press the middle mouse button, drag over the name of the operation that is where you want point tweaking to take place, and release the mouse button. To disable a tweak node:
1
Open the tweak node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Set Node State to HasNoEffect. To enable a tweak node:
1
Open the tweak node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Set Node State to Normal.
DISPLAYING AND HIDING INTERMEDIATE OBJECTS An intermediate object is an object’s shape prior to its deformation. After you deform an object, you can still view its prior shape by displaying its intermediate object. Comparing the intermediate object with the deformed object can be a useful way to judge the effect of a deformation. To display intermediate deformation object(s): 1
Select the object(s) being deformed.
2
Select Deform > Display Intermediate Objects. To hide intermediate deformation object(s):
1
Select the intermediate object(s) being displayed.
2
Select Deform > Hide Intermediate Objects.
CHANGING AN OBJECT’S DEFORMATION ORDER When you use more than one deformer to deform an object, the final effect of the deformations can vary depending on the order in which the deformations occur. By default, the deformations occur in the order that the deformers were created for the object. The deformer created first deforms the object first, and the deformer created last deforms the object last. However, you can change, or re-order, the deformation order to get the effect you want. To change deformation order: 1
In the scene, move the pointer to the object being deformed and press the right mouse button. A marking menu is displayed.
CHARACTER SETUP 50
PART 2
INTRODUCING DEFORMERS | 3 Showing and hiding all deformers 2
From the marking menu, select Inputs > Complete List. The List of history operations window is displayed for the selected object.
3
Move the pointer over the name of the deformer whose order you want to change. Press the middle mouse button, drag over the name of the operation you want the deformer to precede, and release the mouse button.
SHOWING AND HIDING ALL DEFORMERS To show all deformers: 1
Select Display > Show > Show Deformers > All. Note that you can also show all lattices, sculpt influence objects, cluster handles, nonlinear deformer handles, or wrap influence objects. To hide all deformers:
1
Select Display > Hide > Hide Deformers > All. Note that you can also hide all lattices, sculpt influence objects, cluster handles, nonlinear deformer handles, or wrap influence objects.
CHANGING EVALUATION PERFORMANCE You can change dependency graph node evaluation performance so that the scene refreshes right after you drag the mouse, or only when you tell the scene to refresh, or only when you release the mouse button. Changing the evaluation performance can improve scene display speed if you have many complex objects being deformed. To change dependency graph node performance: 1
Select Window > General Editors > Performance Settings.
2
In the Performance Settings window, note the Dependency Graph Evaluation section.
3
Click one of the Refresh On options:
Drag
Specifies that the scene display refreshes right after you drag the mouse.
Demand
Specifies that the scene display refreshes only when you tell the scene to refresh.
Release
Specifies that the scene display refreshes when you release the mouse button. 4
When you’re done, click Close.
CHANGING DEFORMER PERFORMANCE SETTINGS To change deformer performance settings:
DEFORMERS
1
Select Window > Settings/Preferences > Performance Settings.
2
In the Performance Settings window, note the Deformers section.
CHARACTER SETUP 51
INTRODUCING DEFORMERS | 3 Editing advanced deformer creation options You can click the performance of the following to On, Off, or Interactive: sculpt influence objects (Sculpts), lattice influence objects (Lattices), wire influence objects (Wires), blend shapes, and clusters. You can set Cluster Resolution to Per Node, Global, or Interactive. You can set the Lattice Resolution to Per Node, Global, or Interactive. 3
When you’re done, click Close.
EDITING ADVANCED DEFORMER CREATION OPTIONS All of Maya’s deformers include advanced creation options. These options specify the deformation order placement of the deformer, and the characteristics of the deformer set. To understand these advanced creation options, you need to be familiar with the following topics: •
"Deformable objects, points, and sets" on page 42
•
"Nodes, history, and the deformation order" on page 43
•
"Deformer placement" on page 44 To set advanced creation options:
1
Open the creation options window for the deformer you want to create (select Deform > Create Deformer ❒).
2
Click the Advanced tab to set the advanced creation options: Advanced
Deformation Order
Specifies the placement of the deformer node in the deformable object’s history. For more information about deformer placement, see "Deformer placement" on page 44.
Exclusive
Specifies whether the deformer set is in a partition. Sets in a partition can have no overlapping members. Check on or off (default is off). If on, the Exclusive Partition and Existing Partitions options become available.
Partition To Use
Lists any existing partitions, and a default selection Create New Partition. If you select Create New Partition, you can edit the New Partition Name field to specify the name of a new partition. (Available if Exclusive is on.)
New Partition Name
Specifies the name of a new partition that will include the deformer set. The suggested partition name is deformPartition, which will be created if it does not already exist. Typically, you might put all your exclusive deformer sets in the partition named deformParition. However, you can create as many partitions as you like, and name them whatever you want. (Available if Exclusive is on.)
EDITING PARALLEL BLENDER CHANNELS In some object’s deformation chain, when the placement of one (or more) of the deformers is set to Parallel, you can blend the influences of the deformers in the chain in parallel.
CHARACTER SETUP 52
PART 2
INTRODUCING DEFORMERS | 3 Creating shearing effects with shear channels To edit channels with the Channel Box: 1
Select a parallel blender node (default name: parallelBlendern). One quick way to select the blend shape deformer node is to select the object being deformed, and then select the parallel blender node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Select values from 0 to 1. You can also enter values from -2 to 2. A value of 2 would double the overall deformation effect. A negative value would invert the effect. Default is 1.
Weight[n]
Specifies the influence of one of the deformers in the deformation chain. A value 0 specifies that the target has no influence; a value of 1 specifies that the target has maximum influence. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives finer control, and pressing the Shift key gives you coarser control.
CREATING SHEARING EFFECTS WITH SHEAR CHANNELS To add shear channels: 1
Select the deformable object.
2
Select Window > General Editors > Channel Control. The Channel Control window is displayed. In the Non Keyable pane, note the following attributes: shearXY, shearXZ, and shearYZ.
3
For each attribute, select it, and click the << Move button. The attributes are added to the Keyable pane. In the Channel Box, the channels for the object now include Shear XY, Shear XZ, and Shear YZ. You can now create shearing effects by using the Channel Box.
4
To close the Channel Control window, click the Close button.
MODELING WITH DEFORMERS You can use deformers as modeling tools for shaping NURBS or polygonal objects. When you are finished modeling, be sure delete the deformer along with the rest of the object’s history. Note that in the context of modeling, an object’s history can be called its “construction history.” To delete an object’s history: 1
DEFORMERS
Select the object.
CHARACTER SETUP 53
INTRODUCING DEFORMERS | 3 Setup and animation with deformers 2
Select Edit > Delete By Type > History.
SETUP AND ANIMATION WITH DEFORMERS You can set keys on any of deformer’s keyable attributes (or channels). Keys can be set in the Channel Box, the Timeline, the Graph Editor, the Dope Sheet, or by using Maya Embedded Language (MEL) commands. When setting up characters, you can create attributes that drive deformer attributes by adding new attributes, and then defining relationships between the new attributes and the deformer attributes. Add new attributes from the Add Attribute window (Modify > Add Attribute). Define relationships between attributes with the Connection Editor (Window > General Editors > Connection Editor), the Set Driven Key window (Animate > Set Driven Key > Set ❒), or by writing expressions in the Expression Editor (Window > Animation Editors > Expression Editor). This book refers to channels as keyable attributes that are displayed in the Channel Box. You can use the Channel Control editor to specify that a node’s animatable (potentially keyable) attributes that are not in the Channel Box by default be displayed as channels in the Channel Box. Note that it’s possible to put nonanimatable (and therefore non-keyable) attributes into the Channel Box, but in general all channels in the Channel Box are keyable attributes. For more information on Maya’s animation features, refer to Using Maya: Animation.
EDITING NODE BEHAVIOR TO IMPROVE PERFORMANCE For each object in your scene, if there has been any change to its node or any of the nodes in its history (its upstream or downstream nodes), Maya will evaluate the nodes and update the display. A deformed object has more nodes in its history than an undeformed object. If you have many deformed objects in your scene, you can improve the display performance by editing the node behavior attributes of the deformed object nodes.
Understanding node behavior attributes The node behavior attributes include Caching and Node State. Caching
Specifies that Maya store the results of upstream evaluations, and then provide those results to the node. This saves Maya from having to re-evaluate the upstream nodes every time the node needs the results. If there are no changes to the upstream nodes, then this setting can improve display performance with no loss of results. However, note that caching uses more memory than would otherwise be used, which might adversely affect performance. Also, if there are changes to upstream nodes, more memory is allocated and then freed during each deformation, which might also adversely affect display performance.
Node State
Set Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, WaitingHasNoEffect, or Waiting-Blocking.
Normal
Specifies that Maya evaluate and display the deformation. Maya will evaluate the node as usual. This is the default.
CHARACTER SETUP 54
PART 2
INTRODUCING DEFORMERS | 3 Editing node behavior to improve performance HasNoEffect
Specifies that Maya prevent the deformation, but display the object. Maya will evaluate the nodes in the node’s history, but not the node itself.
Blocking
Specifies that Maya prevent the deformation, and not display the object. Maya will not report the results of any evaluations of upstream nodes to this node.
Waiting-Normal
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting (Window > Settings/Preferences > Performance Settings) is set to Demand or Release, the node takes the Normal state when you click Update or release the mouse button.
WaitingHasNoEffect
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node takes the HasNoEffect state when you click Update or release the mouse button.
WaitingBlocking
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the Blocking state when you click Update or release the mouse button.
Editing node behavior To set node behavior:
DEFORMERS
1
Open the node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Click Caching on or off.
4
Select the Node State as Normal, HasNoEffect, or Blocking. (The Waiting-Normal, Waiting-HasNoEffect, and Waiting-Blocking states are for Maya’s internal use.)
5
Close the Attribute Editor.
CHARACTER SETUP 55
INTRODUCING DEFORMERS | 3 Editing node behavior to improve performance
CHARACTER SETUP 56
PART 2
4
USING BLEND SHAPE DEFORMERS With blend shape deformers, you change the shape of one object into the shapes of other objects.
UNDERSTANDING BLEND SHAPE DEFORMERS Blend shape deformers enable you to deform a surface into the shapes of other surfaces. You can blend shapes with the same or different number of vertices (or CVs). In character setup, a typical use of a blend shape deformer is to set up poses for facial animation.
DEFORMERS
CHARACTER SETUP 57
USING BLEND SHAPE DEFORMERS | 4 Understanding blend shape deformers
Unlike the other deformers, the blend shape deformer has an editor that enables you to control all the blend shape deformers in your scene. You can use the editor to control the influence of the targets of each blend shape deformer, create new blend shape deformers, set keys, and so on. Note that other software packages use the terms “morph,” “morphing,” and “shape interp” to refer to what Maya provides with blend shape deformers.
Target and base objects When creating a blend shape deformer, you identify one or more objects whose shapes you want to use to deform the shape of some other object. Objects whose shapes you want to use to deform the shape of another object are called target objects, and the object being deformed is called the base object.
Target shapes, base shapes, and blend shapes The shapes of the target objects are called target shapes, or target object shapes. The base object’s resulting deformed shape is called the blend shape, whereas its original shape is called the base shape, or base object shape.
Targets A blend shape deformer includes a keyable attribute (channel) for evaluating each target object shape’s influence on the base object’s shape. These attributes are called targets, though by default they are named after the various target objects. Each target specifies the influence, or weight, of a given shape independently of the other targets. Depending on how you create or edit the blend shape deformer, however, a target can represent the influence of a series of target object shapes instead of just one shape.
Related MEL commands MEL commands related to blend shape deformers include the following: •
CHARACTER SETUP 58
blendShape PART 2
USING BLEND SHAPE DEFORMERS | 4 Creating blend shape deformers •
blendShapeEditor
•
blendShapePanel
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a blend shape deformer can include the following: •
Blend shape deformer node, which is the algorithm node for the blend shape deformer (default name: blendShapen).
•
Blend shape set node (default name: blendShapenSet).
•
Tweak node (default name: tweakn). For more information about these nodes, refer to the online Node and Attribute Reference.
CREATING BLEND SHAPE DEFORMERS When creating blend shape deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options:
DEFORMERS
1
If you also want to create a blend shape deformer now, select one or more deformable objects for target object shape(s), and then select one deformable object as the base object shape.
2
Select Deform > Create Blend Shape ❒.
3
The BlendShape Options window is displayed.
4
Click the Basic and Advanced tabs to set the creation options:
CHARACTER SETUP 59
USING BLEND SHAPE DEFORMERS | 4 Creating blend shape deformers Basic BlendShape Node
Specifies the name of the blend shape deformer (the blend shape deformer algorithm node). You might want to use a name that reminds you of the role of the blend shape deformation (for example, lipSync). If you don’t specify a name, Maya provides the default name blendShapen.
Envelope
Specifies the deformation scale factor. Use the slider to specify values from 0.0000 to 1.0000. Default is 1.0000.
Origin
Specifies whether the blend shape will be relative to the base object shape’s position, rotation, and scale. Click Local or World.
Local
Local will blend the base object shape to the target object shape(s) while ignoring differences in position, rotation, and scale between the base object and the target object(s). For facial animation setup, you would typically want to select Local. In general, Local is useful when you want to have your target object(s) in various separate positions for easy viewing but don’t want their positions to affect the deformation.
World
World will blend the base object shape to the target object shape(s), taking into account any differences in position, rotation, and scale between the target object shape(s). Click Local or World. Default is Local.
Target Shape Options
Includes the In-Between, Check Topology, and Delete Targets options. In-Between
Specifies whether the blending will be in series or in parallel. If on, the blending will be in series. Shape transitions will occur in the order in which you selected the target shape(s). The effect will be that the blend shape will be able to change from the first target object shape, to the second, and so on, back and forth through the series of target object shapes chained together as “in-between” shapes. If off, the blending will occur in parallel. Each target object shape can influence the blending simultaneously in a parallel fashion rather than one after another in a series fashion. Typically, for facial animation setup, you would want In-Between off so that you can have a variety of basic facial expressions that form the basis of all the possible expressions. Because the blending is in parallel, you can control the influence of each basic expression at any moment to get a nearly infinite variety of highly nuanced expressions. Click on or off. Default is off.
Check Topology
Delete Targets
CHARACTER SETUP 60
Specifies whether to check if the base shape and the target shape(s) have the same topology. For example, if using NURBS objects, you could check if all the shapes have the same number of CVs. Click on or off. Default is on. Specifies whether to delete the target shape(s) after creation. Deleting target shapes can be useful if you don’t need to see or manipulate the target shape(s), and want to improve display performance. However, be sure to save a copy of the target shapes in case you later decide you need to adjust them. Default is off.
PART 2
USING BLEND SHAPE DEFORMERS | 4 Editing blend shape deformation effects Advanced See "Editing advanced deformer creation options" on page 52. Note that the default Front Of Chain option is only available for blend shape deformers. •
Click Create if you want to create a blend shape deformer now. or
•
Click Save to save the creation options. or
•
Click Reset to reset to the default creation options. or
•
Click Close to close the BlendShape Options window.
Creating a blend shape deformer To create a blend shape deformer: 1
Select one or more deformable objects for target object shape(s), and then select one deformable object as the base object shape.
2
Select Deform > Create Blend Shape. A blend shape deformer is created with the currently set creation options. To create deformation effects:
1
Edit the blend shape deformer channels and attributes.
2
Use the Blend Shape editor (Window > Animation Editors > Blend Shape) to control the influence of the target object shapes. For more information, see the next section.
EDITING BLEND SHAPE DEFORMATION EFFECTS You can edit blend shape deformation effects as described in the following topics:
Using the Blend Shape editor The Blend Shape editor provides you with controls for all of the blend shape deformers in your scene. To use the Blend Shape editor: 1
Select Window > Animation Editors > Blend Shape. The Blend Shape editor is displayed. The editor includes a section for each blend shape deformer in your scene.
2
Click on the name of the blend shape deformer you want to control (default name: blendShapen). The editor expands to show controls for the selected blend shape deformer.
DEFORMERS
CHARACTER SETUP 61
USING BLEND SHAPE DEFORMERS | 4 Editing blend shape deformation effects Target weight sliders
Each slider provides a way for you to set the target weight quickly. By default, each target slider sets values from the minimum value (by default, 0.000) to the maximum value (by default, 1.000). The current weight is displayed in the target weight box below the target slider. You can change the orientation of the sliders. For more information, see "Changing Blend Shape editor slider orientation" on page 62.
Target weight boxes
Each box displays the current weight for each target. By default, a target weight can range from the minimum value (by default, 0.000) to the maximum value (by default, 1.000). As you change values, the target weight sliders update according to the value you enter in the target weight boxes. You can enter values from -10.000 to 10.000 to invert or amplify the target’s influence. If you enter a value greater than the current maximum value (by default, 1.000), the maximum value changes to double the value or to 10.000 if double the value is greater than 10.000. If you enter a value less than the current minimum value (by default, 0.000), the minimum value changes to double the value or to 10.000 if double the value is less than -10.000. When you enter values less than the current minimum or greater than the current maximum, the target weight sliders change to reflect the new range of values.
Target names
By default, the target name is the name of a target object (for example, nurbsSphere1). If you prefer, enter some other name for the target name. Entering a new target name does not change the name of the target object. Changing the target name is useful if you want to give a more appropriate target name after you’ve created the blend shape deformer.
New button
Click to create a new blend shape deformer. Clicking New is the same as selecting Deform > Create Blend Shape.
Add button
Bake the selected base shape and add it as a target.
Key All button
Key all weights at their current values.
Reset All button
Set all weight values to zero.
Select button
Select the blend shape deformer node.
Key buttons
Key the current value, or drag and drop on the Timeline to set an exclusive key.
Changing Blend Shape editor slider orientation You can control the orientation of the sliders in the Blend Shape window (Window > Animation Editors > Blend Shape). The sliders can be arranged vertically or horizontally, whichever is most intuitive for you. To orient the sliders vertically, select Options > Orientation > Vertical (the default). To orient the sliders horizontally, select Options > Orientation > Horizontal.
Editing blend shape deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a blend shape deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing blend shape deformer attributes" on page 63).
CHARACTER SETUP 62
PART 2
USING BLEND SHAPE DEFORMERS | 4 Editing blend shape deformation effects To edit channels with the Channel Box: 1
Select a blend shape deformer node (default name: blendShapen). One quick way to select the blend shape deformer node is to select the object being deformed, and then select the blend shape deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Select values from 0 to 1. You can also enter values from -2 to 2. A value of 2 would double the overall deformation effect. A negative value would invert the effect. Default is 1.
Target
Specifies the weight of the named target. A value of 0 specifies that the target has no influence; a value of 1 specifies that the target has maximum influence. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key will give you finer control, and pressing the Shift key will give you coarser control.
Editing blend shape deformer attributes To edit attributes with the Attribute Editor: 1
Select the blend shape deformer node (default name: blendShapen).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl A).
3
The following sections make available attributes: Blend Shape Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Blend Shape Attributes
Origin
Specifies whether the blend shape is relative to the base object shape’s position, rotation, and scale, or is directly specified by you. Select local, world, or user. Local blends the base object shape to the target object shape(s) while ignoring differences in position, rotation, and scale between the target shape(s). World blends the base object shape to the target object shape(s), taking into account any differences in position, rotation, and scale between the target object shape(s). Note that the local and world selections are identical to the Origin creation option’s selections. For more information, see "Setting creation options" on page 59. The user selection, however, is not one of the Origin creation option’s selections. User specifies that two special attributes, baseOrigin and targetOrigin, provide origin information. For more information on these attributes, see the online documentation for the blend shape deformer node (default name: blendShapen) and the blendShape MEL command. You can use the setAttr MEL command to set the values of the baseOrigin and targetOrigin attributes.
DEFORMERS
CHARACTER SETUP 63
USING BLEND SHAPE DEFORMERS | 4 Editing blend shape deformation effects Weight Target
Specifies the influence value, or weight, of the named target. A value 0.000 specifies that the target has no influence; a value of 1.000 specifies that the target has maximum influence. For each named target, use slider to select values from 0.000 to 1.000. Deformer Attributes
Envelope
Specifies the deformation scale factor. Use slider to select values from 0.000 to 1.000. You can also enter values from -2.000 to 2.000. A value of 2.000 would double the overall deformation effect. A negative value would invert the effect. Default is 1.000. Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Scaling influence of all targets You can scale the effect of all targets on the base by editing the Envelope channel or attribute. Though the slider Envelope only specifies values from 0 to 1, you can enter values from -2 to 2. If Envelope is 2, the influence of every target is doubled. If Envelope is 0.5, the influence of every target is halved. If Envelope is negative, the influence of every target is inverted. If the cumulative effect of the targets deforms the base more than you want, you can scale down the overall deformation effect by setting Envelope to some value between 0 and 1. For more information on setting the Envelope channel or attribute, see "Editing blend shape deformer channels" on page 62 and "Editing blend shape deformer attributes" on page 63.
Matching position, rotation, and scaling of targets You can control whether the deformation of the base is influenced by the position, rotation, or scaling of targets with the Origin attribute. For more information, see "Editing blend shape deformer attributes" on page 63.
Blending objects with different topologies You can blend shapes with the same or different number of vertices or CVs. When you create a blend shape deformer, you should turn the Check Topology creation option off if you want to blend objects that have different numbers of CVs or vertices. For more information on Check Topology, see "Setting creation options" on page 59. If objects have the same number of CVs or vertices but their order is different, Maya blends the shapes whether Check Topology is on or off. However, the position of the base CVs will be transformed to the position of the target CVs. This change might cause the object to blend in a way you might not expect. To ensure a smooth transition between base and target, make sure the order of CVs is the same in both objects.
CHARACTER SETUP 64
PART 2
USING BLEND SHAPE DEFORMERS | 4 Editing blend shape deformation effects In addition to blending individual objects, you can blend hierarchies of objects. Make sure both hierarchies have the same number of children and parenting relationships. To blend hierarchies, you must select the parent of the target hierarchy (or hierarchies) first and the parent of the base hierarchy last before creating the blend shape. The parent of each must be a transform. Each child in the base blends into its corresponding child in the target. The order of children in the Outliner (and Hypergraph) determines which children blend. If necessary, use the Outliner to change the order of objects in the hierarchies. A common blend shape technique is to create duplicates of a base, deform the duplicates, then use them as targets. For example, you might make several copies of a face, and then alter the copies to create a smiling face, frowning face, a crying face, and so on. If you use this technique, turn on the Check Topology creation option when you create the blend shape deformer. This checks that the base and target hierarchy shapes have the same number of CVs. If the CVs are different and Check Topology is off, you might see, for instance, an eye blending into the nose. If Check Topology is on, the members of the hierarchies must have corresponding numbers of CVs.
Deleting a target’s object After you create a blend shape, you can delete the target objects to free up memory and so improve Maya’s performance. When you delete a target, the blend shape node keeps the target deformations in memory and the target slider deforms the base as if the target remained. The object is removed. You save the most memory when you have complex targets that have only a few components that have moved slightly from the base. For complex targets that have many components moved from the base, you save the least memory. Don’t delete the targets if you want to modify their shapes or remove them from the blend shape. Remember that when you modify targets, Maya updates the resulting blend shape. You can delete the object manually from your scene, or you can have Maya delete the targets when you create the blend shape. To delete the target object before creating blend shape: Click the Delete Targets creation option on (see "Setting creation options" on page 59). To delete the target object after creating blend shape: Select and delete the object in the workspace or Outliner.
Setting target weights To set the influence of targets on the blend shape, you adjust each target’s weight slider. Each target’s name is in a box under the slider. If the entire name of a target does not fit inside a box, drag left or right inside the box to see the undisplayed part. You can move each slider from 0 to 1. A setting of 0 means that the target has no effect on the base. A setting of 1 makes the base identical to the target unless other targets also affect the base.
DEFORMERS
CHARACTER SETUP 65
USING BLEND SHAPE DEFORMERS | 4 Editing blend shape deformation effects You can enter values beyond the slider range in the weight boxes below the sliders. A value above 1 exaggerates the target’s influence. Negative values move the base in a direction opposite the target components. To reset all sliders to 0, click Reset All. To adjust weight sliders, in the Blend Shape editor (Window > Animation Editors > Blend Shape), drag the slider or enter a value in the weight box.
Setting keys for blend shapes You can set key blend shapes with the Blend Shape editor. You can set keys on all the target sliders at their current values, or key an individual target slider at its maximum influence value (1). Keying an individual target slider at 1 keys the influence of that target slider only, ignoring the possible blending influences of the other target sliders. To key all target sliders: 1
In the Blend Shape editor, adjust the sliders to create the desired blend shape.
2
In the Time Slider, click the frame where you want to set keys.
3
In the Blend Shape editor, click the Key All button. Maya sets keys for all the target sliders in the blend shape deformer. To key the maximum influence of one target slider:
1
In the Time Slider, click the frame where you want to set the key.
2
In the Blend Shape editor, set the target slider to 1.
3
Click the Key button below the target slider. Maya sets a key for that target slider only, ignoring the possible blending influences of the other target sliders.
Saving a blend shape as a new target After you create a blend shape from a mix of slider settings, you can save the shape as a new target for the base. After creating the new target, you can drag a single slider to deform the base object to that target. To save a blend shape as a new target: 1
Set the target sliders to deform the base object.
2
Select the base.
3
Click Add in the Blend Shape editor. Maya creates a new target at the same location as the base. A slider for the target appears in the Blend Shape editor. Move the new target away from the base. If in local mode, you can modify the target’s shape, for instance, by transforming its CVs or vertices. Use the new target slider to deform the base to the target.
CHARACTER SETUP 66
PART 2
USING BLEND SHAPE DEFORMERS | 4 Adding target object shapes
Selecting a blend shape deformer node When you create a blend shape deformer, a blend shape deformer algorithm node (default name: blendShapen) appears in the scene’s dependency graph upstream of the base object’s shape node. This node uses the target slider weight settings to create a blend shape from the base. The blend shape deformer node name appears in the Blend Shape editor above and to the left of the associated target sliders. To display the animation keys of weights in the Time Slider, Graph Editor, and the Dope Sheet, you must select the blend shape deformer node. To select the blend shape node: Click the Select button for the blend shape node in the Blend Shape editor.
Creating a new blend shape deformer You can create a blend shape deformer using the Blend Shape editor instead of by selecting Deform > Create Blend Shape. The new blend shape node is chained sequentially by default. (If you want to put one blend shape node in conjunction with another one, change the deformer placement to parallel.) To create a new blend shape using the Blend Shape editor: 1
Select all targets.
2
Shift-click to select the base. You must select the base last.
3
Click New in the Blend Shape editor. The new blend shape node and slider(s) appear in the Blend Shape editor.
ADDING TARGET OBJECT SHAPES You can add target object shapes to a blend shape deformer. When adding target object shapes, you can first set the add options and then add the target object shapes, or you can immediately add the objects with the current add options.
Setting add options To set add options: 1
If you also want to add target object shapes now, select one or more deformable objects as new target object shape(s), and then a blend shape deformer’s base object shape.
2
Select Deform > Edit Blend Shape > Add ❒. The BlendShape Add Options window is displayed.
3 Specify Node
DEFORMERS
Specify the options: If the base object shape you selected is influenced by only one blend shape deformer, you don’t need Specify Node on. If on, you can specify BlendShape Node and Existing Nodes. Default is off.
CHARACTER SETUP 67
USING BLEND SHAPE DEFORMERS | 4 Adding target object shapes BlendShape Node
Specifies the name of the blend shape deformer to which you want to add the target object shapes. (Available if Specify Node is on.) Lists all the blend shape deformer nodes in the scene, and indicates the blend shape deformer to which you want to add target object shapes. (Available if Specify Node is on.)
Existing Nodes
Add In-Between Target
Specifies whether you want to specify the Target Index and In-Between weight. Typically, you would want to do so to control the effect of the target object shapes you are adding. If the blend shape deformer blends target object shapes in parallel (the In-Between creation option was off when you created the blend shape deformer), you can add the new target object shapes so that they work in series with one of the existing target object shapes. One quick way you can identify the appropriate value for Target Index is by looking at the order of the target sliders in the Blend Shape Editor (Window > Animation Editors > Blend Shape). Note that in the editor, each target object shape has its own target slider. In the editor, going from left to right, the Target Index value for the left-most target slider would be 1, the next 2, and so on.
Target Index
If the blend shape deformer blends target object shapes in series (the In-Between creation option was on when you created the blend shape deformer), Target Index can only be 1 because there is only one target slider. In this case, you don’t have to specify Target Index, but you do need to specify the In-Between Weight. In-Between Weight
Specifies the weight at which the added target object shape will have maximum influence. Use slider to select values from 0 to any value less than 1. Do not select 1 because 1 is the weight at which the existing target object shape has its maximum influence.
Target Shape Options
Specifies whether to check if the added target object shapes have the same topology as the base object shape and the existing target object shape(s). For example, if using NURBS objects, you could check if all the shapes have the same number of CVs. Click Check Topology on or off. Default is on. 4
Click Apply if you want to add the selected target object shapes now. or
•
Click Save if you want to save the options you’ve specified. or
•
Click Reset to reset to the default options. or
•
Click Close to close the BlendShape Add Options window.
Adding a target object shape To add a target shape: 1
Select one or more deformable objects as new target object shape(s), and then a blend shape deformer’s base object shape.
CHARACTER SETUP
PART 2
68
USING BLEND SHAPE DEFORMERS | 4 Removing target object shapes 2
Select Deform > Edit Blend Shape > Add. Maya adds the target object shapes to the blend shape deformer.
REMOVING TARGET OBJECT SHAPES You can remove target object shapes from a blend shape deformer. When removing target object shapes, you can first set the remove options and then remove the target object shapes, or you can immediately remove the objects with the current remove options.
Setting remove options To set remove options: 1
Select Deform > Edit Blend Shape > Remove ❒. The BlendShape Remove Options window is displayed.
2
Specify the options: If the base object shape you selected is influenced by only one blend shape deformer, you don’t need to set Specify Node on. If on, you can specify BlendShape Node and Existing Nodes. Default is off.
Specify Node
BlendShape Node
Specifies the name of the blend shape deformer whose target object shapes you want to remove. (Available if Specify Node is on.) Lists all the blend shape deformer nodes in the scene, and indicates the blend shape deformer whose target object shapes you want to remove. (Available if Specify Node is on.)
Existing Nodes
3
Click Apply if you want to remove the selected target object shapes now. or
•
Click Save if you want to save the options you’ve specified. or
•
Click Reset to reset to the default options. or
•
Click Close to close the BlendShape Remove Options window.
Removing a target shape To remove a target shape: 1
Select the target objects you want to remove.
2
Select Deform > Edit Blend Shape > Remove. Maya removes the target object shapes.
DEFORMERS
CHARACTER SETUP 69
USING BLEND SHAPE DEFORMERS | 4 Swapping target object shapes
SWAPPING TARGET OBJECT SHAPES You can swap the order of target object shapes. When swapping target object shapes, you can first set the swap options and then swap the target object shapes, or you can immediately swap the objects with the current swap options.
Setting swap options To set swap options: 1
If you want to swap now, select two target objects whose order you want to swap.
2
Select Deform > Edit Blend Shape > Swap ❒. The BlendShape Swap Options window is displayed.
3
Specify the options: If the base object shape you selected is influenced by only one blend shape deformer, you don’t need to set Specify Node on. If on, you can specify BlendShape Node and Existing Nodes. Default is off.
Specify Node
BlendShape Node
Specifies the name of the blend shape deformer whose target object shapes you want to swap. (Available if Specify Node is on.) Lists all the blend shape deformer nodes in the scene, and indicates the blend shape deformer whose target object shapes you want to swap. (Available if Specify Node is on.)
Existing Nodes
4
Click Apply if you want to swap the selected target object shapes now. or
•
Click Save if you want to save the options you’ve specified. or
•
Click Reset to reset to the default options. or
•
Click Close to close the BlendShape Swap Options window.
Swapping two target shapes To swap two target shapes: 1
Select two target objects whose order you want to swap.
2
Select Deform > Edit Blend Shape > Swap. Maya swaps the order of the target object shapes.
DELETING BLEND SHAPE DEFORMERS To delete a blend shape deformer: 1
Select the blend shape deformer node.
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 70
PART 2
USING BLEND SHAPE DEFORMERS | 4 Deleting blend shape deformers The deformer nodes are all deleted. However, the base object still has the tweak node as an input node, so any tweaks you might have made are preserved.
DEFORMERS
CHARACTER SETUP 71
USING BLEND SHAPE DEFORMERS | 4 Deleting blend shape deformers
CHARACTER SETUP 72
PART 2
5
USING LATTICE DEFORMERS With lattice deformers, you can deform objects with lattices.
Lattice deformer acting on an ear. You can create deformation effects by moving the lattice’s points.
UNDERSTANDING LATTICE DEFORMERS A lattice deformer surrounds a deformable object with a lattice that you can manipulate to change the object’s shape.
Lattices A lattice is a structure of points for carrying out free-form deformations on any deformable object. To create deformation effects, you edit the lattice by moving, rotating, or scaling the lattice structure, or by directly manipulating the lattice points. In general, you create effects by editing any of the lattice deformer’s attributes.
Influence lattice and base lattice A lattice deformer includes two lattices: an influence lattice and a base lattice. By itself, the term “lattice” typically refers to the influence lattice. You create deformation effects by editing or animating the influence lattice. The lattice DEFORMERS
CHARACTER SETUP 73
USING LATTICE DEFORMERS | 5 Creating lattice deformers deformer’s effect is based on any difference between the base lattice’s lattice points and the influence lattice’s lattice points. By default, the base lattice is hidden so that you can focus on manipulating the influence lattice. However, remember that the deformation effect depends on the relationship between the influence lattice and the base lattice.
Lattices as deformable objects Unique among deformer influence objects, lattices are themselves deformable objects. That means that you can create deformers that deform a lattice. For example, you can deform a lattice with a sculpt deformer, and the effect of the deformation on the lattice points will in turn deform the object the lattice is deforming. You can also assign deformation weights to lattice points by creating a cluster deformer for the lattice. Further, you can bind a lattice to a skeleton. When you move the skeleton, the lattice will deform with the action of the joints.
Lattice deformers and lattice flexors Flexors are special objects you use to control the deformation effects of rigid skinning. Two types of flexors, joint lattice flexors and bone lattice flexors, use lattice deformer nodes.
Related MEL commands MEL commands related to lattice deformers include the following: •
lattice
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a lattice deformers can include the following: •
Lattice deformer node (default name: ffdn).
•
Influence lattice transform node (default name: ffdnLattice).
•
Influence lattice shape node (default name: ffdnLatticeShape).
•
Base lattice transform node (default name: ffdnBase).
•
Base lattice shape node (default name: ffdnBaseShape).
•
Tweak node (default name: tweakn).
•
Lattice deformer set node (default name: ffdnSet). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING LATTICE DEFORMERS When creating lattice deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
CHARACTER SETUP 74
PART 2
USING LATTICE DEFORMERS | 5 Creating lattice deformers
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a lattice deformer now, select one or more deformable objects.
2
Select Deform > Create Lattice ❒. The Lattice Options window is displayed.
3
Click the Basic and Advanced tabs to set the creation options: Basic
Divisions
Specifies the structure of the lattice in the lattice’s local STU space. (STU space provides a special coordinate system for specifying the structure of lattices.) You can specify the lattice’s structure in terms of S, T, and U divisions. When you specify the divisions, you also indirectly specify the number of lattice points in the lattice, because the lattice points are located where the divisions meet on the lattice’s exterior. The greater the number of divisions, the greater the lattice point resolution. Though your control over the deformation increases with the number of lattice points, the performance may be affected. The default settings are S has 2 divisions, T has 5 divisions, and U has 2 divisions, which provides 20 lattice points.
Local Mode
Specifies whether each lattice point can influence only the deformable object’s points that are nearby (local), or can influence all the deformable object’s points. Check on or off (default is on). If on, you can specify Local Divisions.
Local Divisions
Specifies the extent of each lattice point’s local influence in terms of the lattice’s local STU space. (Only available if Local Mode is on.) The default settings are S has 2 divisions, T has 2 divisions, and U has 2 divisions. With the default setting, each lattice point can only influence the deformable object’s points that are at most two divisions away (in S, T, or U) from the lattice point.
Positioning
Specifies whether the lattice is centered around the selected deformable object(s), or positioned at the workspace origin. Typically you would want the lattice centered around the object(s) so that you can create deformation effects right after you create the deformer. However, you might want the object to be initially free of the lattice’s influence, deforming only when it moves into the base lattice’s space. For example, you might develop a ghost (the deformable object) that could squeeze through a keyhole-shaped influence lattice and then pop out on the other side, resuming its original shape.
DEFORMERS
CHARACTER SETUP 75
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects Check on to center the lattice; check off to put the lattice at workspace origin. Default is on. Grouping
Specifies whether to group the influence lattice and base lattice together. Grouping the influence lattice and base lattice enables you to transform (move, rotate, or scale) the two together. Check on or off. Default is off: the influence lattice and base lattice are not grouped by default.
Parenting
Specifies whether to parent the lattice to the selected deformable object(s) upon deformer creation. Parenting them enables you to transform (move, rotate, or scale) them together. Check on or off. Default is off.
Freeze Mode
Specifies whether to freeze the lattice deformation mapping. If frozen (checked on), components of objects being deformed that are inside the influence lattice remain fixed inside the lattice and affected only by the influence lattice, even if you transform (move, rotate, or scale) the object or the base lattice. For more information, see "Freezing the lattice deformation mapping" on page 82. Check on or off. Default is off. Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create if you want to create a lattice deformer now. or
•
Click Save to save the creation options. or
•
Click Reset to reset to the default creation options. or
•
Click Close to close the Lattice Options window.
Creating a lattice deformer To create a lattice deformer: 1
Select one or more deformable objects.
2
Select Deform > Create Lattice. A lattice deformer is created with the currently set creation options. To create deformation effects:
1
Move, rotate, or scale influence lattice points.
2
Edit lattice deformer channels and attributes. For more information on creating and editing deformation effects, see the next section.
EDITING LATTICE DEFORMATION EFFECTS You can edit lattice deformation effects as described in the following topics:
CHARACTER SETUP 76
PART 2
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects
Editing the influence lattice To move, rotate, or scale the lattice: 1
Select the lattice deformer handle node (default name: ffdnLattice).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing the Insert key, moving the pivot point, and then pressing the Insert key again. Remember that you can access the deformer handle’s local axes (Display > Component Display > Local Rotation Axes), it’s rotate and scale pivots (Display > Component Display > Rotate Pivots or Scale Pivots) and it’s selection handle (Display > Component Display > Selection Handles). To edit by moving, rotating, or scaling lattice points:
1
Select the lattice deformer handle node (default name: ffdnLattice).
2
Go into component mode (click the Select By Component Type button).
3
Select lattice points.
4
Move (translate), rotate, or scale the points to change the effect of the deformation.
Editing lattice deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a lattice deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing lattice deformer attributes" on page 78). To edit channels with the Channel Box: 1
Select a lattice deformer node (default name: ffdn). One quick way to select the lattice deformer node is to select the object being deformed, and then select the lattice deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Envelope Local Influence S
Local Influence T
DEFORMERS
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Values can vary from 0 to 1. Default is 1. Specifies the extent of each lattice point’s local influence along the S axis of the lattice’s local STU space. (Only effective if deformer was created with Local Mode on; if not, in the Attribute Editor, under Freeform Deformation Attributes, click Local on.) The default is 2. Specifies the extent of each lattice point’s local influence along the T axis of the lattice’s local STU space. (Only effective if deformer was created with Local Mode on; if not, in the Attribute Editor, under Freeform Deformation Attributes, click Local on.) The default is 2.
CHARACTER SETUP 77
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects Local Influence U
Specifies the extent of each lattice point’s local influence along the U axis of the lattice’s local STU space. (Only effective if deformer was created with Local Mode on; if not, in the Attribute Editor, under Freeform Deformation Attributes, click Local on.) The default is 2. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing lattice deformer attributes To edit attributes with the Attribute Editor: 1
Select the lattice deformer node (default name: ffdn).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Freeform Deformation Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Freeform Deformation Attributes
Local
Local Influence S Local Influence T Local Influence U Partial Resolution
Specifies whether each lattice point can influence only the deformable object’s points that are nearby (Local on), or can influence all the deformable object’s points (Local off). Check on or off (default is on). If on, you can specify Local Influence S, Local Influence T, and Local Influence U. Specifies the extent of each lattice point’s local influence along the S axis of the lattice’s local STU space. Use slider to select values from 2 to 30. The default is 2. Specifies the extent of each lattice point’s local influence along the T axis of the lattice’s local STU space. Use slider to select values from 2 to 30. The default is 2. Specifies the extent of each lattice point’s local influence along the U axis of the lattice’s local STU space. Use slider to select values from 2 to 30. The default is 2. Specifies whether Maya calculates the deformation with full resolution or partial resolution. Select full or partial. Default is full. If you don’t need to see the deformation at full resolution, you can improve display performance by reducing the accuracy of the deformation. To do so, select partial. With partial selected, use the Partial Resolution slider to specify the deformation calculation’s accuracy. A tolerance of 0 means you want full accuracy; the maximum value of 0.1 decreases the accuracy significantly. Select values from to 0.000 to 0.100. Default is 0.010. If you have set the accuracy to partial, set the accuracy of each deformer back to full before you render the scene if you want to render the deformation with full accuracy.
CHARACTER SETUP 78
PART 2
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects Freeze Geometry
Specifies whether to freeze the lattice deformation mapping. If frozen (checked on), components (for example, CVs) of objects being deformed that are inside the influence lattice become fixed inside the lattice and affected only by the influence lattice, even if you transform (move, rotate, or scale) the object or the base lattice. For more information, see "Freezing the lattice deformation mapping" on page 82. Check on or off. Default is off. Deformer Attributes Specifies the deformation scale factor. Select values from 0 to 1. Default is 1.
Envelope
Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Editing influence lattice shape channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a lattice deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing influence lattice shape attributes" on page 79). To edit channels with the Channel Box: 1
Select a lattice shape node (default name: ffdnLatticeShape). In the Outliner, clicking on the lattice’s transform node (default name: ffdnLattice) will also display the lattice shape node in the Channel Box. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
S Divisions
Specifies the number of S divisions in the influence lattice’s structure. Default is 2.
T Divisions
Specifies the number of T divisions in the influence lattice’s structure. Default is 5.
U Divisions
Specifies the number of U divisions in the influence lattice’s structure. Default is 2. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing influence lattice shape attributes To edit attributes with the Attribute Editor:
DEFORMERS
1
Select the lattice shape node (default name: ffdnLatticeShape).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
CHARACTER SETUP 79
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects 3
The following sections make available attributes: Lattice History, Object Display, Node Behavior, and Extra Attributes. Lattice History
S Divisions
Specifies the number of S divisions in the influence lattice’s structure. Default is 2.
T Divisions
Specifies the number of T divisions in the influence lattice’s structure. Default is 5.
U Divisions
Specifies the number of U divisions in the influence lattice’s structure. Default is 2. Object Display (Shape node display attributes.) Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Resetting influence lattice shape and location You can reset the deformed lattice to return it to the location and shape of the base lattice. Reset the lattice to clear all adjustments you have made to the influence lattice. Do this when you want to: •
start over with the deformation
•
rotate, scale, or translate the base lattice and the deformed lattice together, from their initial positions
•
parent the base lattice at the center of the deformed lattice, before manipulating the lattice. To reset the lattice:
1
Select the lattice.
2
Select Deform > Edit Lattice > Reset Lattice.
Resetting influence lattice points and removing tweaks After lattice point tweaking or changing the STU divisions, you can reset the lattice points to their original positioning in local space. This does not modify the lattice object’s transformation in world space. Use this when you want to change the number of divisions on the lattice or start over with the deformation. To reset lattice points after tweaking: 1
Select the lattice.
2
Select Deform > Edit Lattice > Remove Lattice Tweaks.
Editing lattice deformer sets For more information, see "Editing deformer set membership" on page 46.
CHARACTER SETUP 80
PART 2
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects
Pruning lattice deformer sets By pruning lattice deformer sets, you can remove points from the set that are not presently being affected by the deformer. You can prune the deformer set to avoid unnecessary calculations for points that are not part of the deformation effect. To prune deformer set membership: 1
Select deformable objects whose currently unaffected points you want to prune from the deformation.
2
Select Deform > Prune Membership > Lattice. Maya removes the deformable object’s points currently unaffected points from the lattice deformer set.
Changing influence lattice resolution To deform the geometry by a finer or coarser resolution, you can change the number of lattice points. Using the Divisions attribute, you can increase or decrease the divisions along S, T, and U (the X-, Y-, and Z-axis, respectively, if the lattice were in the default position at the origin). Note that the greater the number of divisions, the more calculations Maya has to do to deform the geometry and the slower the performance. To speed up the performance to counteract the effect of a high-resolution lattice, see “Improving performance” on page 99. You gain no resolution in the deformation by having more lattice points in the lattice than points on the geometry. The resolution is limited by the spacing of points across the geometry. Note that if you’ve moved the points, you have to reset the points before changing the resolution. You can reset the lattice by choosing Deform > Edit Lattice > Reset Lattice. However, you cannot change the resolution of a lattice if the lattice points have been moved from their reset position or the lattice has history. If you want to change the number of divisions on a lattice whose points have been moved, choose Deform > Edit Lattice > Reset Lattice Tweaks, and then change the divisions of the lattice. If you want to change the divisions on a lattice with history, find the upstream lattice shape and change its divisions. You can find the upstream lattice by selecting the lattice and looking in the attribute editor tabs for the original lattice shape, which will typically share the same base name as the downstream lattice appended by “Orig.”
Toggling lattice shape handle (L icon) To help control screen clutter and display performance, you can select between displaying an “L” icon as the lattice deformer handle and displaying the deformer’s lattices. To select the lattice shape display: 1
Select the lattice deformer.
2
Select Display > Component Display > Lattice Shape. The lattice deformer selects between displaying its lattices and the “L” icon.
DEFORMERS
CHARACTER SETUP 81
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects
Turning on or off display of lattice points To turn on or off lattice shape display: 1
Select the lattice deformer.
2
Select Display > Component Display > Lattice Points.
Showing and hiding all lattice deformers To show all lattice deformers: Select Display > Show > Show Deformers > Lattices. To hide all lattice deformers: Select Display > Hide > Hide Deformers > Lattices.
Weighting lattice points to alter their influence The influence of individual lattice points can vary if the lattice points have been assigned weights. You can have weights assigned to lattice points in two ways: •
You can create a cluster deformer that acts on the lattice deformer. You can then control the weights assigned to each lattice point by the cluster deformer. For more information on cluster deformers, see Chapter 6, “Using Cluster Deformers.”
•
You can do skinning with lattice deformers. For more information, see "Skinning with lattice deformers" on page 86.
Sculpting the influence lattice You can use a sculpt deformer to shape a lattice deformer’s influence lattice. Using a sculpt deformer in this way can provide a great way to get smooth, rounded lattice deformations. Trying to achieve the same rounded effect by tweaking (moving) lattice points could require some painstaking effort. For more information on sculpt deformers, see Chapter 14, “Using Sculpt Deformers.”
Freezing the lattice deformation mapping A lattice deformer’s deformation effects normally depend on whether the objects being deformed are inside the base lattice (default name: ffdnBase). If the objects are completely outside of the base lattice, deformation effects cease. The effects cease because the lattice deformer calculates the effects based on the spatial relationship between the base lattice, the influence lattice, and the positions of the objects inside the base lattice. If the objects are outside of the base lattice, Maya cannot calculate the effects. Similarly, if an object is only partially inside the base lattice, only the components (for example, CVs) of the object inside the base lattice can be affected by the influence lattice.
CHARACTER SETUP 82
PART 2
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects
Influence lattice deforming sphere partially inside lattice.
Sphere no longer affected by influence lattice because it is now outside of the base lattice. (The base lattice is not displayed unless selected, but by default it is located inside the influence lattice, and has the influence lattice’s original shape.)
Freezing the lattice deformation mapping locks the influence lattice’s control over deformable object components inside the influence lattice. If you want to have the components of deformable objects inside of the influence lattice to remain inside and under the influence of the influence lattice even when you move the objects or the base lattice, you can do so by freezing the lattice deformation mapping.
Influence lattice deforming sphere partially inside lattice. Now the lattice deformation mapping is frozen.
Because lattice deformation mapping has been frozen, components of sphere inside the influence lattice remain inside it even as you move the sphere outside of the base lattice and influence lattice.
Freezing the lattice deformation mapping freezes an influence lattice’s relationship with all of the components inside it. Object components (for example, CVs) inside the influence lattice at the time of freezing will stay fixed inside the lattice, and will only be affected by changes to the influence lattice. Even if you move the base lattice so that those components are no longer in it, the components themselves will remain under the influence of the influence lattice. However, components outside the influence lattice will move when you move the object, causing deformation effects on the object. You can freeze the deformation mapping when you create a lattice deformer by clicking the Freeze Mode creation option on (see "Setting creation options" on page 75). However, if the influence lattice surrounds the object, you won’t be able to move any of its components outside of the influence lattice unless you change the Freeze
DEFORMERS
CHARACTER SETUP 83
USING LATTICE DEFORMERS | 5 Editing lattice deformation effects Geometry attribute. After you’ve created a lattice deformer, you can change whether it freezes the deformation mapping by editing the Freeze Geometry attribute (see "Editing lattice deformer attributes" on page 78).
Editing the base lattice The base lattice is not visible unless you select it. You can move, rotate, or scale a base lattice. However, unlike the influence lattice, the base lattice does not have lattice points.
Grouping base and influence lattices To move the base lattice and the deformed lattice together, you can group them. Group the lattices when you are moving the lattice to deform a stationary geometry. For example, suppose you wanted to slam a fish bowl on a character’s head so that the head then conforms to the shape of the bowl. To do this, you could use a lattice deformer to shape a geometry for the fishbowl and a geometry for the head. You could then group the base lattice and deformed lattice, parent them to the fishbowl geometry, and move them all away from the head. When you move them away, the head will return to its normal shape, but when you move them back the head will take the shape of the fishbowl. To group the deformed lattice and the base lattice: 1
Select the deformed lattice and base lattice.
2
Select Edit > Group. If you have grouped the base lattice and the deformed lattice, a simple way to select the two lattices in the scene (without opening the Outliner) is to select the deformed lattice and press the Up Arrow key to get the group node.
Parenting lattices to objects being deformed You can parent the lattice and base lattice to the objects being deformed by them so that you can move and continue the deformation. For example, if your character’s squashed hat is deformed with a lattice, parent the lattice to the hat and the base lattice so the hat stays deformed as it moves. To parent the lattice to the geometry: You can parent the lattice to the geometry in two ways, depending on when you’re parenting: •
After you create the lattice, open the Outliner and drag and drop the lattice onto the geometry using the middle mouse button. An alternate way is to select the lattice, then the geometry, and choose Edit Parent.
•
Before you create the lattice, open the Lattice Options window (select Deform > Lattice ❒) and turn on the Parenting creation option.
Deforming a lattice with other deformers You can deform any deformed lattice just as you can deform a geometry with other deformers. For example, you can put a sculpt or cluster deformer on a lattice, and deform the lattice shape.
CHARACTER SETUP 84
PART 2
USING LATTICE DEFORMERS | 5 Deleting lattice deformers
Assuring a smooth deformation through the base lattice If you are setting up or animating the deformable object so that it passes through the base lattice, note that editing the outermost parts of the influence lattice can cause a sudden deformation in the object’s shape. If you have edited the outermost parts of the influence lattice, the deformable object will suddenly deform as it enters the base lattice.
Improving performance The greater the number of lattice points, the greater your control over the deformation, but the slower the performance. Note that a lattice should always have fewer lattice points than the deformable object has points. You gain no increase in control over the deformation by having more lattice points than the object itself has points. You can edit node behavior to improve performance. For more information, see "Editing node behavior to improve performance" on page 54. You can change the lattice resolution performance. To change the lattice resolution performance, set the Partial Resolution attribute (see "Editing lattice deformer attributes" on page 78). Finally, you can change the lattice deformer performance settings. To change lattice deformer performance settings: 1
Select Window > Settings/Preferences > Performance.
2
In the Performance Settings window, note the Deformers section.
3
Click the performance of Lattices to On, Off, or Interactive. (For more information, see Using Maya: Essentials.)
4
When you’re done, click Close.
Changing lattice resolution performance settings To change lattice resolution settings: 1
Select Window > Settings/Preferences > Performance.In the Performance Settings window, note the Deformers section.
2
Set the Lattice Resolution to Per Node, Global, or Interactive.
3
When you’re done, click Close.
DELETING LATTICE DEFORMERS To delete a lattice deformer: 1
Select the lattice deformer node.
2
Select Edit > Delete (default shortcut: Backspace key). The deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved.
DEFORMERS
CHARACTER SETUP 85
USING LATTICE DEFORMERS | 5 Skinning with lattice deformers
SKINNING WITH LATTICE DEFORMERS Skinning is the process of binding deformable objects to a skeleton. Typically, the deformable objects that are bound are NURBS or polygonal surfaces. These geometry objects become the character’s surface, or skin, and their shapes are influenced by the action of the skeleton’s joints. Once you’ve built a skeleton for a character, you can skin your character by using a smooth skinning method or a rigid skinning method. Because influence lattices are deformable objects, you can also bind them to a skeleton by smooth or rigid skinning. In turn, these can influence the NURBS or polygonal surfaces that provide the character’s skin. In skinning with lattice deformers, you create lattice deformers for the deformable objects that you want to use for the character’s skin. Then you bind the influence lattices to the skeleton. The result is that the skeleton’s movement influences the objects indirectly through the lattice deformers. Meanwhile, you can manipulate the influence lattices for more control over the deformation. This approach, skinning with lattice deformers, is called lattice skinning. If you wish, you could use lattice skinning to skin an entire character. A more common approach is to use smooth or rigid skinning for much of the character’s skin, but then also to use lattice skinning for finer control over certain areas. In many situations, lattice skinning can provide superior smoothing effects, particularly in areas near where a character’s limbs and main body meet (for example, a shoulder and armpit area). However, if you do use lattice skinning with smooth or rigid skinning, you need to be very careful about how all the many control points (CVs, polygonal vertices, or lattice points) involved are organized. You will need to organize points into various sets and those sets into various partitions to make later editing easier and to avoid double transformation effects. Note that lattice skinning should not be confused with lattice flexors. Lattice flexors are for use with rigid skinning only. They help to smooth out deformations provided by rigid skinning, and their influence is by default limited to the skin area near a particular joint. For more information on skinning, see Chapter 25, “Understanding skinning.”
CHARACTER SETUP 86
PART 2
6
USING CLUSTER DEFORMERS A cluster deformer creates a set whose members consist of selected points (CVs, vertices, or lattice points). You assign a percentage weight to each point, indicating how much you want each point to be affected by any translation, rotation, or scale of the cluster set. When you transform the cluster, the points are transformed according to the percentages you have specified.
Cluster deformer gradually stretching nose. You can move the cluster handle (C icon) to create deformation effects.
UNDERSTANDING CLUSTER DEFORMERS A cluster deformer applies a transformation to a geometry’s points in such a way that you can adjust the percentage that each point is affected by the transformation. Use clusters when you want to affect geometry in different amounts by one or more transformations. For example, you can create a cluster for a door so that when it is slammed, the middle bows slightly.
Related MEL commands MEL commands related to cluster deformers include the following: •
cluster
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
DEFORMERS
CHARACTER SETUP 87
USING CLUSTER DEFORMERS | 6 Creating cluster deformers
Dependency graph nodes The dependency graph nodes for a wire deformer can include the following: •
Cluster deformer node, which is the algorithm node for the wire deformer (default name: clustern).
•
Cluster handle node (default name: clusterHandlen).
•
Tweak node (default name: tweakn). The tweak node provides a way for Maya to carry out point tweaking on the deformable object before any deformation or skinning effects are carried out.
•
A deformer set node (default name: clusternSet). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING CLUSTER DEFORMERS When creating cluster deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a lattice deformer now, select one or more deformable objects.
2
Select Deform > Create Cluster ❒.
3
The Cluster Options window is displayed.
4
Click the Basic and Advanced tabs to set the creation options: Basic
Mode
CHARACTER SETUP 88
Specifies whether the cluster deformation will occur only when the cluster deformer handle itself is transformed (moved, rotated, or scaled). With Relative clicked on, only transformations to the cluster deformer handle itself will cause deformation effects. With Relative off, transformations to objects parented to the cluster deformer handle can cause deformation effects.
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects For example, suppose you are using a cluster deformer to smooth deformation effects around the wrist joint of a character’s skinned arm. If you create a cluster deformer with Relative on, and then parent the cluster deformer handle to a wrist joint, you can rotate the shoulder joint without causing cluster deformation effects around the wrist. But when you move the cluster deformer handle itself, you cause cluster deformation effects around the wrist. Click on or off. Default is on. Specifies the deformation scale factor. A value of 0 provides no deformation, a value of 0.5 provides a deformation effect scaled to half of its full effect, and a value of 1 provides the full deformation effect. Use the slider to select values between 0 and 1. Default is 1.
Envelope
Advanced For information on these creation options, see "Editing advanced deformer creation options" on page 52. •
Click Create if you want to create a cluster deformer now. or
•
Click Save to save the creation options. or
•
Click Reset to reset to the default creation options. or
•
Click Close to close the Cluster Options window.
Creating a cluster deformer To create a cluster deformer: 1
Select one or more deformable objects.
2
Select Deform > Create Cluster. A cluster deformer is created with the currently set creation options. In the Channel Box, the cluster handle node is listed (default name: clusternHandle). In the Outliner and Hypergraph, a cluster deformer node is added (default name: clustern).
EDITING CLUSTER DEFORMATION EFFECTS After you have created a cluster deformer, you can edit the deformer’s effects as described in the following topics:
Manipulating the cluster handle (C icon) Each cluster deformer includes a cluster deformer handle. In the workspace, the handle is a C icon (the letter “C”). You can select the handle, and move, rotate, and scale it to create deformation effects. Of course, the effects depend on the cluster weights that control the effect of the cluster deformer on the deformable object’s
DEFORMERS
CHARACTER SETUP 89
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects points (NURBS CVs, polygonal vertices, or lattice points). For more information on editing and painting cluster weights, see "Editing cluster weights" on page 92 and "Painting cluster weights" on page 93. Note that wrinkle deformers use cluster deformers, and that you can also manipulate the effects of wrinkle deformers with the cluster deformer handle’s C icon. For more information on wrinkle deformers, see Chapter 16, “Using Wrinkle Deformers.”
Editing cluster deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a cluster deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing cluster attributes" on page 90). To edit channels with the Channel Box: 1
Select a cluster deformer node (default name: clustern). One quick way to select the cluster deformer node is to select the object being deformed, and then select the cluster deformer node in its history from the Channel Box (under INPUTS). Another way is to select the cluster deformer handle (the C icon). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Values can range from 0 to 1. A value of 0 specifies no deformation effect, and a value of 1 specifies the maximum deformation effect. Default is 1.
Envelope
3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives finer control, and pressing the Shift key gives coarser control.
Editing cluster attributes To edit attributes with the Attribute Editor: 1
Select the cluster deformer node (default name: clustern).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Cluster Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Cluster Attributes
Relative
CHARACTER SETUP 90
Specifies whether the cluster deformation occurs only when the cluster deformer handle itself is transformed (moved, rotated, or scaled). With Relative on, only transformations to the cluster deformer handle itself cause deformation effects. Transformations to any objects parented to the handle do not cause deformation
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects effects. With Relative off, transformations to objects parented to the cluster deformer handle can cause deformation effects. The Relative attribute was initially set by the Mode creation option when you created the cluster deformer (see "Setting creation options" on page 88). Partial Resolution
Percent Resolution
Angle Interpolation
Specifies whether Maya provides the complete deformation, or only an approximation of the deformation. Selections include full and partial. Full specifies the complete deformation. Partial specifies an approximation of the deformation, which can improve Maya’s display performance. With partial, Maya rounds down the cluster weights based on the Percent Resolution. Default is full. Specifies the increment percentage by which the cluster deformation resolution is rounded down. Maya uses the increment percentage to round off the cluster weights to the next lowest increment. For example, with a Percent Resolution of 5.00, a cluster weight of .94 would be rounded down to .90. A cluster weight of .46 would be rounded down to .45. Default is 5.00. (Available only if Partial Resolution is set to partial.) Specifies the interpolation direction. Use this attribute to correct undesirable discontinuities in the deformation effect when you change cluster weights even by a small amount. The discontinuities occur when the cluster deformer uses an inappropriate interpolation direction to guide the deformation effect. To change the interpolation direction, you can set Angle Interpolation to closest, positive, or negative. By default, Angle Interpolation is closest, which provides the usual rigid skinning deformation effects. The default setting is fine for most situations, but when you encounter discontinuities you can adjust the deformation effect by selecting a positive or negative interpolation. Deformer Attributes
Envelope
Specifies the deformation scale factor. Use slider to select values between 0.000 and 1.000. Default is 1.000. Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Editing cluster deformer sets For more information on editing deformer set membership, see "Editing deformer set membership" on page 46.
Pruning cluster deformer sets By pruning cluster deformer sets, you can remove points from the set that are not presently being affected by the deformer. You can prune the deformer set to avoid unnecessary calculations for points that are not part of the deformation effect.
DEFORMERS
CHARACTER SETUP 91
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects To prune deformer set membership: 1
Select deformable objects whose currently unaffected points you want to prune from the deformation.
2
Select Deform > Prune Membership > Cluster. Maya removes the deformable object’s points currently unaffected points from the cluster deformer set.
Editing cluster weights After you create the cluster, set up the percentages based on the amount that you want the points or control vertices to be affected. For some cases, you may set one percentage for the whole object. For example, a stick on moving water, in which the cluster handle is set to move at 50% the transformation of the water. At other times, you may want some parts of the geometry to be affected more or less than other parts. For example, you could have a scene with waving trees, where the treetops are affected the most, the trunk near the ground affected at 0%. With the Component Editor, you can directly modify the values of individual cluster weights. You can also paint cluster weights (see "Painting cluster weights" on page 93). To query cluster weights: 1
Select the points whose cluster weights you want to edit.
2
Select Window > General Editors > Component Editor. The Component Editor is displayed. The Component Editor displays the component data for currently selected components in the workspace. By default, the Component Editor updates dynamically as you select components in the workspace. Also, as you select components in the Component Editor, the workspace updates dynamically as well.
3
Click on the Weighted Deformers tab. The Weighted Deformers section lists the weights assigned to CVs, vertices, or lattice points by cluster deformers (default names: clustern). To modify a point’s cluster weight:
1
In the Component Editor’s spreadsheet, click the component data box you want to edit. Only the component whose box you’ve selected is now selected in the workspace.
2
Enter a new value. To modify several cluster weights at once:
1
In the workspace, select the points whose weights you want to edit.
2
In the Component Editor’s spreadsheet, drag through the component data boxes you want to edit.
3
Enter the value you want all the boxes to have.
CHARACTER SETUP 92
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects To modify an entire row or column (UNIX only): 1
In the workspace, select the points whose weights you want to edit.
2
In the Component Editor’s spreadsheet, click one of the boxes in the row or column.
3
Click the row or column heading. Now all the boxes for the row or column are selected.
4
Enter a value for all the boxes in the row or column. To modify an entire row or column (Windows only):
1
In the workspace, select the points whose weights you want to edit.
2
To change all the entries of a row or column, in the Component Editor’s spreadsheet, select the row or column heading.
3
Shift select any of the boxes in that row or column.
4
Enter a new value to update the entire row or column. For more information about the Component Editor, see Using Maya: Essentials.
Painting cluster weights Using the Paint Cluster Weights Tool, you can set cluster weights simply by painting over the clustered surface. Although you can transform the cluster first, then paint weights on the surface, the Paint Cluster Weights Tool provides color feedback so you know which parts of the clusters have different weights before you transform the cluster. Weights display as a range of grayscale values, with a weight of 1 displaying as white and 0 as black.
Weight of 1.0 Weight of 0.75 Weight of 0.25 Weight of 0.15 Before cluster translation
After cluster translation in Y direction
To paint weights on a cluster:
DEFORMERS
1
Select the surface with the cluster you want to paint weights on.
2
Go into smooth shading mode (select Shading > Smooth Shade All or press the default hotkey, 5).
3
Select the Paint Cluster Weights Tool and open the Tool Settings editor (Deform > Paint Cluster Weights Tool ❐).
CHARACTER SETUP 93
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects The Paint Cluster Weights Tool automatically detects clusters on the surface and selects one for painting. 4
Check that Color Feedback is turned on in the Display section. Color feedback helps you identify the weights on the surface by representing them as grayscale values (smaller values are darker, larger values are lighter).
Tip You can use the default hotkey Alt c to turn Color Feedback on and off outside the Tools Settings Editor. 5
Select the cluster you want to paint. In the Paint Attributes section of the Tool Settings window, click the clustern.weights button and select the appropriate cluster weights name from the pop-up menu. Note that you can only paint weights on one cluster at a time. If you select more than one cluster, you can only paint weights on the active one (the one that provides color feedback). If the surface has only one cluster, you can select the surface alone. The selected cluster turns white, representing a weight value of 1, the default.
Tip If you are painting on a single surface, you can skip step 3 and select the cluster without opening the Tool Settings window by right-clicking the surface and selecting the appropriate cluster weights name from the Paint command submenu. 6
Select a brush, paint operation, and value and define other settings as required. See "Paint Cluster Weights Tool settings" on page 96.
7
Drag the brush across the cluster.
Tip You can quickly pick weight values from one cluster and paint them on another cluster or the same cluster using hotkeys. 1
Select the cluster with the weight values you want to pick.
2
Hold down the Pick Color Mode hotkey (default hotkey: /), click on the area of the cluster with the weight you want to pick, then release the hotkey.
3
If you are painting the picked weight on the same cluster, drag the brush across the cluster. If you are painting the picked weight on another cluster, select that cluster, then drag the brush across it.
CHARACTER SETUP 94
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects
Painting weights on restricted areas When you paint weights over selected vertices, your strokes are applied only to the weights corresponding with the selected vertices. In effect, the unselected vertices act as a mask, where only selected vertices are affected by any painting or flooding you do. Before creating the mask you must first create the cluster. For details on masking surfaces, see “Restricting an area for painting” in Using Maya: Painting.
Flooding clusters Flooding a cluster is like taking a huge brush and applying its settings to the entire cluster. When you flood a cluster, the weight of each vertex in the cluster changes according to the value and operation set for the tool. To flood a cluster, follow the steps under "To paint weights on a cluster:" on page 93, but instead of painting in step 7, click the Flood button (hotkey: Alt f).
Tip To smooth the transition between cluster weights, select the Smooth paint operation and flood the cluster.
Mapping weight values to clusters Using the Paint Cluster Weights Tool you can map attribute values onto surface vertices relative to the UVs. The settings for the tool are applied to the cluster vertices using the mapped values. In the following example, notice that only the cluster is affected by the map.
Mapped surface
Attribute map
For details on mapping, see “Mapping attributes” in Using Maya: Painting.
DEFORMERS
CHARACTER SETUP 95
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects
Paint Cluster Weights Tool settings To modify Paint Cluster Weights Tool settings, select the Paint Cluster Weights Tool and open the Tool Settings editor (Deform > Paint Cluster Weights Tool ❐). For details on Brush, Stroke, Stylus Pressure, Attribute Maps, and Display settings, see “Brush Tool settings (new architecture)” in Using Maya: Painting. Paint Attributes settings are described below.
Tip You can define hotkey combinations to change most of the settings without opening the Tool Settings editor. For details on setting hotkey combinations, see “Defining Artisan hotkeys” in Using Maya: Painting. Paint Attributes clustern.weights jointClustern.weights
Displays the name of the cluster selected to paint and the attribute you are painting (weights). To select another cluster to paint, click this button and select the appropriate cluster weights name. By default, the tool selects the first cluster it detects on the surface (for example, cluster1.weights, or jointCluster3.weights). Filter: cluster
Sets a filter so that only cluster nodes display on the menu for the button above this one. You are painting clusters with the Paint Cluster Weights Tool, so you do not need to change this filter.
Paint Operation
Select which paint operation you want to perform on the selected cluster. Replace
Your brush stroke replaces the vertex weight with the weight set for the brush.
Add
Your brush stroke adds the vertex weight to the weight set for the brush.
Scale
Your brush stroke scales the vertex weight by the weight factor set for the brush.
Smooth
Your brush stroke averages the weights of adjacent vertices to produce a smoother transition between weights.
Value
Set the weight value to apply when you perform any of the painting operations.
Min/Max Value
Set the minimum and maximum possible paint values. By default, you can paint values between 0 and 1. Setting the Min/Max Values you can extend or narrow the range of values. Negative values are useful for subtracting weight. For example, if you set Min Value to -1, Value to -0.5, and select Add for the operation, you would subtract 0.5 from the weight of vertices you paint. Positive values are used as multipliers.
CHARACTER SETUP 96
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects
Tip To help you differentiate paint values when you paint with ranges greater than 0 to 1 (for example, -5 to 5), and to maximize the range of values that display when you paint values with ranges between 0 to 1 (for example, 0.2 to 0.8), set Min Color and Max Color (in the Display section) to correspond with the Min/Max values. Select whether you want to clamp the values within a specified range, regardless of the Value set when you paint.
Clamp
Lower
Turn this on to clamp the lower value to the Clamp Value specified below. For example, if you clamp Lower and set the lower Clamp Value to 0.5, the values you paint will never be less than 0.5, even if you set the Value to 0.25.
Upper
Turn this on to clamp the upper value to the Clamp Value specified below. For example, if you clamp Upper, set the upper Clamp Value to 0.75, and set Value to 1, the values you paint will never be greater than 0.75.
Clamp Values
Set the Lower and Upper values for clamping.
Flood
Click Flood to apply the brush settings to all the weights on the selected cluster. The result depends on the brush settings defined when you perform the flood.
Vector Index
If you are painting a three channel attribute (RGB or XYZ), select the channel you want to paint. Cluster weight is a single channel attribute, therefore you do not need to change this setting.
Painting weights on rigid skin objects When using rigid skinning, Maya creates a joint cluster node for each joint of the skeleton. The joint cluster nodes assign weights to the rigid skin points to control how the rigid skin objects deform. You can use the Paint Cluster Weights Tool to modify the rigid skin point weights. In the following example, notice how the surface folds at the joint. You can use the Paint Cluster Weights Tool to quickly smooth out the fold.
Before smoothing
After smoothing
Note that painting smooth skin point weights requires the use of a different painting tool (see "Painting smooth skin point weights" on page 327). To paint weights on a rigid bound skin: 1
DEFORMERS
Select the rigid skin object you want to paint weights on.
CHARACTER SETUP 97
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects 2
Go into smooth shading mode (select Shading > Smooth Shade All or press the default hotkey, 5).
3
Select Deform > Paint Cluster Weights Tool ❐.
4
Check that Color Feedback is turned on in the Display section. Color feedback helps you identify the weights on the surface by representing them as grayscale values (smaller values are darker, larger values are lighter).
Tip You can use the default hotkey Alt c to turn Color Feedback on and off outside the Tools Settings Editor. 5
Select the joint cluster you want to paint weights on. In the Paint Attributes section of the Tool Settings window, click the jointClustern.weights button and select the appropriate joint cluster weights name from the pop-up menu. Note that you can only paint weights on one cluster at a time. If you select more than one cluster, you can only paint weights on the active one (the one that provides color feedback). If the surface has only one cluster, you can select the surface alone.
Tip If you are painting on a single surface, you can skip step 3 and select the joint cluster without opening the Tool Settings window by right-clicking the surface and selecting the appropriate cluster weights name from the Paint command submenu. 6
Select a brush, paint operation, and value and define other settings as required. See "Paint Cluster Weights Tool settings" on page 96.
7
Drag the brush across the cluster.
Tip You can quickly pick weight values from one cluster and paint them on another cluster or the same cluster using hotkeys. 1
Select the cluster with the weight values you want to pick.
2
Hold down the Pick Color Mode hotkey (default hotkey: /), click on the area of the cluster with the weight you want to pick, then release the hotkey.
3
If you are painting the picked weight on the same cluster, drag the brush across the cluster. If you are painting the picked weight on another cluster, select that cluster, then drag the brush across it.
CHARACTER SETUP 98
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects
Adjusting jiggle weight by painting After you create a jiggle deformer for an object or specific points, you can tune the jiggle of individual points by painting their jiggle weight values. Typically you'll get best results if you use higher jiggle weight values at the central area of jiggle region and lower values at the edge of the jiggle region. Fading the values from center to edge often works well. To paint jiggle weights: 1
Select the surface with the jiggle deformer you want to paint weights on.
2
Go into smooth shading mode (select Shading > Smooth Shade All or press the default hotkey, 5).
3
Select the Paint Jiggle Weights Tool and open the Tool Settings editor (Deform > Paint Jiggle Weights Tool ❐). The Paint Jiggle Weights Tool automatically detects jiggle deformers on the surface.
4
Check that Color Feedback is turned on in the Display section. Color feedback helps you identify the weights on the surface by representing them as grayscale values (smaller values are darker, larger values are lighter).
Tip You can use the default hotkey Alt c to turn Color Feedback on and off outside the Tools Settings Editor. 5
Select the jiggle deformer you want to paint. In the Paint Attributes section of the Tool Settings window, click the jigglen.weights button and select the appropriate jiggle weights name from the pop-up menu. Note that you can only paint weights on one jiggle deformer at a time. If you select more than one jiggle deformer, you can only paint weights on the active one (the one that provides color feedback). If the surface has only one jiggle deformer, you can select the surface alone.
Tip If you are painting on a single surface, you can skip step 3 and select the jiggle deformer and weight attribute without opening the Tool Settings window by right-clicking the surface and selecting the appropriate jiggle weights name from the Paint command submenu.
DEFORMERS
6
Select a brush, paint operation, and value and define other settings as required. See "Paint Cluster Weights Tool settings" on page 96.
7
Drag the brush across the deformer where you want to change the weights.
CHARACTER SETUP 99
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects
Tip Using hotkeys, you can quickly pick weight values from one jiggle deformer and paint them on another jiggle deformer or the same one. 1
Select the jiggle deformer with the weight values you want to pick.
2
Hold down the Pick Color Mode hotkey (default hotkey: /), click on the area of the jiggle deformer with the weight you want to pick, then release the hotkey.
3
If you are painting the picked weight on the same deformer, drag the brush across the deformer. If you are painting the picked weight on another jiggle deformer, select that deformer, then drag the brush across it.
Painting weights on masked jiggle deformers When you paint weights over selected vertices, your strokes are applied only to the weights corresponding with the selected vertices. In effect, the unselected vertices act as a mask, where only selected vertices are affected by any painting or flooding you do. Before creating the mask you must first create the jiggle deformer. For details on masking surfaces, see “Restricting an area for painting” in Using Maya: Painting.
Flooding jiggle deformers Flooding a jiggle deformer is like taking a huge brush and applying its settings to the entire cluster. When you flood a deformer, the weight of each vertex in the deformer changes according to the value and operation set for the tool. To flood a cluster, follow the steps under "To paint jiggle weights:" on page 99, but instead of painting in step 7, click the Flood button (hotkey: Alt f).
Tip To smooth the transition between jiggle weights, select the Smooth paint operation and flood the jiggle deformer.
Mapping weight values to jiggle deformers Using the Paint Cluster Weights Tool you can map attribute values onto surface vertices relative to the UVs. The settings for the tool are applied to the cluster vertices using the mapped values. For details on mapping, see “Mapping attributes” in Using Maya: Painting.
Paint Jiggle Weights Tool settings To modify Paint Jiggle Weights Tool settings, select the Paint Jiggle Weights Tool and open the Tool Settings editor (Deform > Paint Jiggle Weights Tool ❐). For details on Brush, Stroke, Stylus Pressure, Attribute Maps, and Display settings, see “Brush Tool settings (new architecture)” in Using Maya: Painting.
CHARACTER SETUP 100
PART 2
USING CLUSTER DEFORMERS | 6 Editing cluster deformation effects Paint Attributes settings are described next.
Tip You can define hotkey combinations to change most of the settings without opening the Tool Settings editor. For details, see “Defining Artisan hotkeys” in Using Maya: Painting. Paint Attributes jigglen.weights
Displays the name of the jiggle node selected to paint and the attribute you are painting (weights). To select another deformer to paint, click this button and select the appropriate jiggle deformer weights name. By default, the tool selects the first jiggle deformer it detects on the surface (for example, jiggle2.weights).
Filter: jiggle
Sets a filter so that only jiggle deformer nodes display on the menu for the button above this one. You are painting jiggle weights with the Paint Jiggle Weights Tool, so you do not need to change this filter.
Paint Operation
Select which paint operation you want to perform on the selected jiggle deformer. Replace
Your brush stroke replaces the painted weight with the weight set for the brush.
Add
Your brush stroke adds the painted weight to the weight set for the brush.
Scale
Your brush stroke scales the painted weight by the weight factor set for the brush.
Smooth
Your brush stroke averages the weights of adjacent vertices to produce a smoother transition between weights.
Value
Set the weight value to apply when you perform any of the painting operations.
Min/Max Value
Set the minimum and maximum possible paint values. By default, you can paint values between 0 and 1. Setting the Min/Max Values you can extend or narrow the range of values. Negative values are useful for subtracting weight. For example, if you set Min Value to -1, Value to -0.5, and select Add for the operation, you would subtract 0.5 from the weight of vertices you paint. Positive values are used as multipliers.
Tip To help you differentiate paint values when you paint with ranges greater than 0 to 1 (for example, -5 to 5), and to maximize the range of values that display when you paint values with ranges between 0 to 1 (for example, 0.2 to 0.8), set Min Color and Max Color (in the Display section) to correspond with the Min/Max values. Clamp
DEFORMERS
Select whether you want to clamp the values within a specified range, regardless of the Value set when you paint.
CHARACTER SETUP 101
USING CLUSTER DEFORMERS | 6 Deleting cluster deformers Lower
Turn this on to clamp the lower value to the Clamp Value specified below. For example, if you clamp Lower and set the lower Clamp Value to 0.5, the values you paint will never be less than 0.5, even if you set the Value to 0.25.
Upper
Turn this on to clamp the upper value to the Clamp Value specified below. For example, if you clamp Upper, set the upper Clamp Value to 0.75, and set Value to 1, the values you paint will never be greater than 0.75.
Clamp Values
Set the Lower and Upper values for clamping.
Flood
Click Flood to apply the brush settings to all the weights on the selected jiggle deformer. The result depends on the brush settings defined when you perform the flood.
Vector Index
If you are painting a three channel attribute (RGB or XYZ), select the channel you want to paint. Jiggle deformer weight is a single channel attribute, therefore you do not need to change this setting.
Setting the cluster relative to the parent transform Using the Relative attribute, you can set the cluster deformation to be active only when the direct parent of the cluster handle is transformed. This lets you create effects where a hierarchy of parent objects do not all affect the cluster deformation. For example, if you parent the cluster handle to a wrist joint and turn on its Relative attribute, you can rotate the shoulder without the cluster affecting the skin around the wrist, even though the wrist’s position changes. When you move the wrist itself, the cluster deforms the geometry as desired.
Controlling the deformation percentage of the entire cluster You can control the percentage of deformation for the entire cluster using the Envelope channel. Change Envelope to scale all the cluster weights in the same way. If you set the Envelope value and also various values for cluster weights, all the values affect the deformation.
Using weighted nodes You can use another object for the cluster handle, the movement of which controls the cluster. Specify the object you want to use in the cluster handle shape node, under the Weighted Node attribute.
Setting the location of the cluster handle You can control the placement of the cluster handle (displayed as a “C”) by specifying the location of the cluster handle’s origin. To do so, from the clusternHandleShape tab of the Attribute editor, set the Origin attribute. The Origin attribute includes fields for X-axis, Y-axis, and Z-axis values.
DELETING CLUSTER DEFORMERS To delete a cluster deformer: 1
CHARACTER SETUP 102
Select the cluster deformer node.
PART 2
USING CLUSTER DEFORMERS | 6 Deleting cluster deformers 2
Select Edit > Delete (default shortcut: Backspace key). The deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved.
DEFORMERS
CHARACTER SETUP 103
USING CLUSTER DEFORMERS | 6 Deleting cluster deformers
CHARACTER SETUP 104
PART 2
7
USING JIGGLE DEFORMERS With the jiggle deformer, you can cause points on a surface or curve to shake as they move, speed up, or slow down. For instance, you can create effects such as: •
a wrestler’s stomach shaking
•
hair jiggling
•
an insect’s antennae vibrating You can apply jiggle to specific points or to the entire object. In the context of jiggle deformers, the term points means CVs, lattice points, or the vertices of polygonal or subdivision surfaces. A useful technique is to apply jiggle to an influence object that underlies and alters the skin. Be aware that you can create two or more jiggle image by Lee Graft deformers on different points of a single object. You can get the same effect more simply by applying a single jiggle deformer to the points and adjusting the jiggle weights (see "Adjusting jiggle weight by painting" on page 107).
CREATING JIGGLE DEFORMERS You can set creation options and then create a deformer, or you can create a deformer with the current creation options and edit the options later. 1
Select the points or entire object you want to jiggle.
2
Select Deform > Create Jiggle Deformer. or Select Deform > Create Jiggle Deformer ❒. In the options window, set the creation options (see below), and then click the Create button.
3
DEFORMERS
After you play the animation to check the results, tune the jiggle as described in "Adjusting jiggle weight by painting" on page 107.
CHARACTER SETUP 105
USING JIGGLE DEFORMERS | 7 Creating Jiggle deformers
Setting jiggle creation options The Create Jiggle Deformer options window has attributes on two tabs: Basic and Advanced. Basic Stiffness
Sets the rigidity of the jiggle, from 0 to 1. High values diminish elasticity and speed up the jiggle; the points act as if controlled by tight springs. Low values slow the jiggle and create an effect like spongy springs.
Damping
Mutes the springiness of the jiggle. A high value minimizes jiggle. A low value increases springiness.
Weight
Scales the jiggle effect up or down on all points, regardless of individual weights. The individual jiggle weights do not change value, only the overall amount of jiggle.
Jiggle Only After Object Jiggle occurs only after a moving object stops, not while it moves. Stops Ignore Transform Jiggle applies only to animated points, not to the animated
transform node of the object. For example, suppose you have animated a kangaroo hopping as it talks. You animated the hopping motion by keying the translate attributes of the transform node, and you animated the talking mouth by keying points of the mouth. With Ignore Transform on, only the talking mouth will jiggle. Advanced The options on the Advanced tab are common to all deformers. See the online Character Setup material for details on these options.
Editing jiggle attributes After you create a jiggle deformer, you can edit several attributes of the jiggle deformer after you create it. To edit the attributes, select the object to which you applied the jiggle, display the Attribute Editor, and then click the jigglen tab. Jiggle Attributes: Enable
Enable turns on the jiggle. (Default setting.) Disable turns off the jiggle. Enable Only After Object Stops causes the jiggling to occur only after a moving object stops, not while it moves.
Stiffness
See "Stiffness" on page 106.
Damping
See "Damping" on page 106.
Jiggle Weight
See "Weight" on page 106.
Force Along Normal
Sets how much jiggling occurs in directions normal to the surface.
Force On Tangent Sets how much jiggling occurs in directions tangent to the surface.
CHARACTER SETUP 106
PART 2
USING JIGGLE DEFORMERS | 7 Creating Jiggle deformers Motion Multiplier
If you select Enable Only When Resting (see description for Enable), the Motion Multiplier scales how much the object jiggles after it stops moving.
Ignore Transform See "Ignore Transform" on page 106.
Disk Cache Attributes Disk Cache
If you’ve created jiggle cache for the jiggle animation controlled by this jiggle node, this field shows the name of the jiggle cache node. You can click the arrow button to the right of the name to view the jiggle cache settings. See "Setting disk cache creation options" on page 108.
Deformer Attributes Envelope
Scales the amount the points move during deformation. Adjust the slider to select values from 0 to 1. You can also enter values from 2 to 2 in the text box. A value of 2 doubles the effect. A negative value inverts the effect. Default is 1.
Important To avoid unexpected deformations, do not change the number of a deformable object’s points after you create a deformer.
Adjusting jiggle weight by painting See "Adjusting jiggle weight by painting" on page 99.
Using disk cache for jiggle animation When you create jiggle disk cache for your scene, Maya stores on disk the frame-byframe processing of jiggle animation. Before you can render jiggle animation with motion blur, you must create jiggle disk cache. More specifically, if the Motion Blur option is turned on in the Render Globals, you must create jiggle disk cache before you render the animation. Otherwise the rendered animation sequence will display the animation incorrectly. Note that the jiggling object’s Motion Blur option setting is irrelevant to this issue. Creating the cache is also beneficial for scenes that play slowly because of their complexity. If you create the cache, you can go directly to any frame in the Time Slider and see an accurate portrayal of the jiggled objects. Without the cache, you would need to wait for the animation to play from the beginning of the Time Slider up to that frame. Jiggle processing is efficient and does not slow a scene much. Unless your scene plays unusually slowly because of its complexity, you’ll want to create disk cache only as a prelude to rendering with motion blur.
Creating jiggle disk cache When you create jiggle disk cache, you can set creation options and then create the cache, or you can immediately create the cache with the current creation options.
DEFORMERS
CHARACTER SETUP 107
USING JIGGLE DEFORMERS | 7 Creating Jiggle deformers To create disk cache for jiggle: •
Select Deform > Create Jiggle Disk Cache. or
•
Select Deform > Create Jiggle Disk Cache ❒ to set creation options (see below), and then click the Create button in the options window. Maya creates the jiggle cache and creates a permanent jiggle cache file for each jiggle deformer in the scene. The file or files are in the current project’s data folder, and are named scene_jigglen.mcj. Usually you do not need to know the location of the files. However, if you move the scene to a different project, you must also move the jiggle cache file to the corresponding data folder of that project so that the scene plays or renders using the cache. Note the following issues: By default, if you save an existing scene as a new name, Maya makes a copy of the jiggle cache file and gives it a name that corresponds with the new scene name. To save disk space, you can prevent this copy from being created: Select File > Save Scene As ❒. Click the Options button to display the options window. In the options window, turn on turn on Never for this option: Copy Jiggle Disk Cache Files on Save Scene As. Then click the Save Scene As button. If you’ve never saved the scene (the scene is untitled), Maya creates the jiggle cache file(s) only after you save the scene.
Setting disk cache creation options The Create Disk Cache options follow: Cache Time Range Specifies which frames are cached. It is easiest to cache the entire
frame range of the Time Line. However, you can create smaller cache files to conserve disk space by caching only the frames where objects jiggle. Time Slider caches all frames of the Playback Start/End range. Render Globals caches the frame range specified in the Image File Output section of the Render Globals window. (Select Window > Rendering Editors > Render Globals.) Start/End caches a frame range you specify in the Start Time and End Time boxes. Start Time End Time Over Sample
Sets the cached frame range. Available only if you select Custom for the Cache Frame Range. Oversampling and undersampling specify how often Maya calculates jitter per frame. If you select Over Sample, a Rate value of 2 or larger might increase the precision of the cached jiggle in scenes where a jiggling object collides with a rigid body quickly and repeatedly. If you select Under Sample, a Rate value of 2 or larger decreases the precision of the cached jiggle, but quickens the caching operation. An Under Sample Rate of 2, for instance, means Maya calculates jitter once every two frames.
CHARACTER SETUP 108
PART 2
USING JIGGLE DEFORMERS | 7 Creating Jiggle deformers If a jiggling object collides unrealistically with a rigid body, select Over Sample and set a Rate that matches the Over Samples setting available in Solvers > Edit Oversampling or Cache Settings. Rate
Sets an integer value for the Over Sample or Under Sample.
Disabling or deleting jiggle animation after caching If you want to modify the jiggle animation after caching, for example, by changing the Stiffness, you must disable or delete the cache so the scene plays with the modifications. Before you render again, you must create the cache again. Deleting cache is also useful if you need to free up disk space. Be aware that if you disable a jiggle deformer (rather than the cache), you also disable playback of the jiggle cache and cannot create the jiggle cache. To disable or delete the jiggle cache for all jiggling objects: 1
Select Deform > Jiggle Disk Cache Attributes to display the Attribute Editor.
2
In the Control For All Caches section:
•
Click Delete All Caches. or
•
From the Enable Status menu, select Disable All. To delete the jiggle cache for a particular object:
DEFORMERS
1
Select the object to which you applied the jiggle deformer.
2
Select Window > Attribute Editor. Select the jigglenCache tab. (Expand the size of the Attribute Editor to see all tabs.)
3
Click Delete Cache.
CHARACTER SETUP 109
USING JIGGLE DEFORMERS | 7 Creating Jiggle deformers
CHARACTER SETUP 110
PART 2
8
USING BEND NONLINEAR DEFORMERS With bend deformers, you can bend an object along an arc. Bend deformer acting on a cone
UNDERSTANDING BEND DEFORMERS Bend deformers enable you to bend any deformable object along a circular arc. They are useful both for character setup and modeling. Bend deformers include handles that enable you to control the extent and curvature of the bending effects in an intuitive manner.
Related MEL commands MEL commands related to bend deformers include the following:
DEFORMERS
•
nonLinear
•
reorderDeformers
CHARACTER SETUP 111
USING BEND NONLINEAR DEFORMERS | 8 Creating bend deformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a bend deformer can include the following: •
Bend deformer algorithm node (default name: bendn; also note deformBend and nonLinear nodes)
•
Bend deformer handle node (default name: bendnHandle)
•
Bend deformer handle shape node (default name: bendnHandleShape)
•
Bend deformer set node (default name: bendnSet)
•
Tweak node (default name: tweakn) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING BEND DEFORMERS When creating bend deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Bend ❒. The Create Bend Deformer Options window is displayed.
3
Click the Basic and Advanced tabs to set the creation options. Basic
Low Bound
Specifies lower extent of the bending along the bend deformer’s negative Y-axis. Values can be negative numbers or zero. Values can be negative numbers or zero. Use slider to select values from -10.0000 to 0.0000. Default is -1.0000.
High Bound
Specifies upper extent of the bending along the bend deformer’s positive Y-axis. Values can be positive numbers only (minimum is 0.0000). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
CHARACTER SETUP 112
PART 2
USING BEND NONLINEAR DEFORMERS | 8 Editing bend deformation effects Specifies the amount of bending. Negative values specify the bending towards the bend deformer’s negative X-axis; positive values specify the bending towards the deformer’s positive X-axis. Use slider to select values from -4.0000 to 4.0000. Default is 0.0000, which specifies no bending.
Curvature
Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a bend deformer. or
•
Click Save to save creation options without creating a bend deformer. or
•
Click Reset to reset to default creation options. or
•
Click Close to close the window.
Creating a bend deformer To create a bend deformer: 1
Select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Bend. Maya creates a bend deformer with the previously set creation options. In the scene, the bend deformer handle is displayed as the currently selected object. The bend deformer handle (and its pivot point) are placed at the center of the object. In the Outliner, the bend deformer handle is listed (default name: bendnHandle). In the Channel Box, the bendnHandle and bendnHandleShape nodes are selected. To create deformation effects:
1
Manipulate the bend deformer handle.
2
Edit bend deformer channels and attributes. For more information on creating and editing deformation effects, see the next section.
EDITING BEND DEFORMATION EFFECTS After you create the bend deformer, its handle is displayed in your scene and its nodes are listed in the Channel Box. The nodes include the bend handle node (default name: bendnHandle), the bend handle shape node (bendnHandleShape), and the bend deformer node (default name: bendn). You can edit the effects of the bend deformer by editing the bend handle node and the bend deformer node. You can move (translate), rotate, and scale the bend handle to edit the effects of the deformation. You can also edit the bend deformer node’s keyable attributes (channels), which are displayed in the Channel Box. You can edit bend deformation effects as described in the following topics:
DEFORMERS
CHARACTER SETUP 113
USING BEND NONLINEAR DEFORMERS | 8 Editing bend deformation effects
Manipulating bend deformer handles To edit by using the handle manipulators: 1
Select the bend deformer node (default name: bendn).
2
Select the Show Manipulator Tool (default shortcut: t key).
3
Note the manipulators on the bend deformer handle. These enable you to edit attributes interactively. Bend deformer handle manipulators
High Bound
Curvature
Low Bound
4
In the scene, select one of the manipulators on the bend deformer handle. Press the middle mouse button and move the mouse to edit interactively. Note that the Channel Box updates the values you are changing. To edit by moving, rotating, or scaling the handle:
1
Select the bend deformer handle node (default name: bendnHandle).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing Insert key, move the pivot point, and then press the Insert key again.
Editing bend deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a bend deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing bend deformer attributes" on page 115). To edit channels with the Channel Box: 1
CHARACTER SETUP 114
Select the bend deformer node (default name: bendn).
PART 2
USING BEND NONLINEAR DEFORMERS | 8 Editing bend deformation effects One quick way to select the bend deformer node is to select the object being deformed, and then select the bend deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control). 2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Default is 1.
Curvature
Specifies the amount of bending. Negative values specify the bending towards the bend deformer’s negative X-axis; positive values specify the bending towards the deformer’s positive X-axis. Default is 0, which specifies no bending.
Low Bound
Specifies lower extent of the bending along the bend deformer’s negative Y-axis. Values can be negative numbers or zero. Values can be negative numbers or zero. Default is -1.
High Bound
Specifies upper extent of the bending along the bend deformer’s positive Y-axis. Values can be positive numbers only (minimum is 0.0000). Default is 1. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing bend deformer attributes To edit with the Attribute Editor: 1
Select the bend deformer node (default name: bendn).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Nonlinear Deformer Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Nonlinear Deformer Attributes
Curvature
Specifies the amount of bending. Negative values specify the bending towards the bend deformer’s negative X-axis; positive values specify the bending towards the deformer’s positive X-axis. Use the slider to select values from -4.0000 to 4.0000. Default is 0.0000, which specifies no bending.
Low Bound
Specifies the lower extent of the bending along the bend deformer’s negative Y-axis. Values can be negative numbers or zero. Values can be negative numbers or zero. Use the slider to select values from -10.0000 to 0.0000. Default is -1.0000.
High Bound
Specifies the upper extent of the bending along the bend deformer’s positive Y-axis. Values can be positive numbers only (minimum is 0.0000). Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000. Deformer Attributes
Envelope
DEFORMERS
Specifies the deformation scale factor. Select values from 0 to 1. Default is 1.
CHARACTER SETUP 115
USING BEND NONLINEAR DEFORMERS | 8 Deleting a bend deformer Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
DELETING A BEND DEFORMER To delete a bend deformer: 1
Select the bend deformer handle.
2
Select Edit > Delete (default shortcut: Backspace key). The bend deformer handle, bend deformer handle shape, and bend deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved. Also, note that the various input nodes that structure the evaluation of the deformation are not deleted.
CHARACTER SETUP 116
PART 2
9
USING FLARE NONLINEAR DEFORMERS The flare deformer flares or tapers an object about two axes. Flare deformer acting on a cylinder
UNDERSTANDING FLARE DEFORMERS Flare deformers enable you to flare out or taper in any deformable object along two axes. They are useful both for character setup and modeling. Flare deformers include handles that enable you to control the extent and curvature of the flaring or tapering effects in an intuitive manner.
Related MEL commands MEL commands related to flare deformers include the following: •
nonLinear
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
DEFORMERS
CHARACTER SETUP 117
USING FLARE NONLINEAR DEFORMERS | 9 Creating flare deformers
Dependency graph nodes The dependency graph nodes for a flare deformer can include the following: •
Flare deformer algorithm node (default name: flaren; also note deformFlare and nonLinear nodes)
•
Flare deformer handle node (default name: flarenHandle)
•
Flare deformer handle shape node (default name: flarenHandleShape)
•
Flare deformer set node (default name: flarenSet)
•
Tweak node (default name: tweakn) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING FLARE DEFORMERS When creating flare deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Flare ❒. The Create Flare Deformer Options window is displayed.
3
Click the Basic and Advanced tabs to set the creation options. Basic
Low Bound
Specifies the lower extent of the flare on the deformer’s local negative Y-axis. Values can be negative numbers or zero. Use the slider to select values from negative 10.0000 to 0.0000. Default is -1.0000.
High Bound
Specifies the upper extent of the flare on the deformer’s positive local Y-axis. Values can be positive numbers only (minimum value is 0). Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
CHARACTER SETUP 118
PART 2
USING FLARE NONLINEAR DEFORMERS | 9 Creating flare deformers Start Flare X
Specifies the amount of flaring from the deformer’s X-axis at the Low Bound. The flaring progresses along the deformer’s local X-axis, varying according to the value of Curve. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Start Flare Z
Specifies the amount of flaring from the deformer’s Z-axis at the Low Bound. The flaring progresses along the deformer’s local Z-axis to the High Bound, varying according to the value of Curve. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
End Flare X
Specifies the amount of flaring from the deformer’s X-axis at the High Bound. The flaring starts at the Low Bound and progresses along the deformer’s local X-axis to the High Bound, varying according to the value of Curve. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
End Flare Z
Specifies the amount of flaring from the deformer’s Z-axis at the High Bound. The flaring starts at the Low Bound and progresses along the deformer’s local Z-axis to the High Bound, varying according to the value of Curve. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Curve
Specifies the amount of curvature (the profile of the flaring curve) between the Low Bound and the High Bound. A value of 0 specifies no curvature (linear interpolation). Positive values specify outward, bulging curvatures; negative values specify inward, hourglass-shaped curvatures. Use the slider to select values from 0.0000 to 10.0000. Default is 0.0000. Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a flare deformer. or
•
Click Save to save creation options without creating a flare deformer. or
•
Click Reset to reset to default creation options. or
•
Click Close to close the window.
Creating a flare deformer To create a flare deformer: 1
Select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Flare. Maya creates a flare deformer with the previously set creation options. In the scene, the flare deformer handle is displayed as the currently selected object. The flare deformer handle (and its pivot point) are placed at the center of the object. In the Outliner, the flare deformer handle is listed (default name: flarenHandle). In the Channel Box, the flarenHandle and flarenHandleShape nodes are selected. To create deformation effects:
DEFORMERS
1
Manipulate the flare deformer handle.
2
Edit flare deformer channels and attributes.
CHARACTER SETUP 119
USING FLARE NONLINEAR DEFORMERS | 9 Editing flare deformation effects For more information on creating and editing deformation effects, see the next section.
EDITING FLARE DEFORMATION EFFECTS After you create the flare deformer, its handle is displayed in your scene and its nodes are listed in the Channel Box. The nodes include the flare handle node (default name: flarenHandle), the flare handle shape node (flarenHandleShape), and the flare deformer node (default name: flaren). You can edit the effects of the flare deformer by editing the flare handle node and the flare deformer node. You can move (translate), rotate, and scale the flare handle to edit the effects of the deformation. You can also edit the flare deformer node’s keyable attributes (channels), which are displayed in the Channel Box. You can edit bend deformation effects in a variety of ways: •
Manipulating flare deformer handles
•
Editing flare deformer channels
•
Editing flare deformer attributes
Manipulating flare deformer handles To edit with the handle manipulators: 1
Select the flare deformer node (default name: flaren).
2
Select the Show Manipulator Tool (default shortcut: t key).
3
Note the manipulators on the flare deformer handle. These enable you to edit attributes interactively. Flare deformer handle manipulators
High Bound
End Flare X End Flare Z Curve
Low Bound
Start Flare X
Start Flare Z
4
CHARACTER SETUP 120
In the scene, select one of the manipulators on the flare deformer handle. Press the middle mouse button and move the mouse to edit interactively. Note that the Channel Box updates the values you are changing.
PART 2
USING FLARE NONLINEAR DEFORMERS | 9 Editing flare deformation effects To edit by moving, rotating, or scaling the handle: 1
Select the flare deformer handle node (default name: flarenHandle).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing the Insert key, moving the pivot point, and then pressing the Insert key again.
Editing flare deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a lattice deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing flare deformer attributes" on page 122). To edit with the Channel Box: 1
Select the flare deformer node (default name: flaren). One quick way to select the flare deformer node is to select the object being deformed, and then select the flare deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Default is 1.
Start Flare X
Specifies the amount of flaring from the deformer’s X-axis at the Low Bound. The flaring progresses along the deformer’s local X-axis, varying according to the value of Curve. Default is 1.
Start Flare Z
Specifies the amount of flaring from the deformer’s Z-axis at the Low Bound. The flaring progresses along the deformer’s local Z-axis to the High Bound, varying according to the value of Curve. Default is 1.
End Flare X
Specifies the amount of flaring from the deformer’s X-axis at the High Bound. The flaring starts at the Low Bound and progresses along the deformer’s local X-axis to the High Bound, varying according to the value of Curve. Default is 1.
End Flare Z
Specifies the amount of flaring from the deformer’s Z-axis at the High Bound. The flaring starts at the Low Bound and progresses along the deformer’s local Z-axis to the High Bound, varying according to the value of Curve. Default is 1.
Curve
Specifies the amount of curvature (the profile of the flaring curve) between the Low Bound and the High Bound. A value of 0 specifies no curvature (linear interpolation). Positive values specify outward, bulging curvatures; negative values specify inward, hourglass-shaped curvatures. Default is 0.
Low Bound
Specifies the lower extent of the flare on the deformer’s local negative Y-axis. Values can be negative numbers or zero. Default is -1.
High Bound
Specifies the upper extent of the flare on the deformer’s positive local Y-axis. Values can be positive numbers only (minimum value is 0). Default is 1. 3
DEFORMERS
Click on a channel name with the left mouse button.
CHARACTER SETUP 121
USING FLARE NONLINEAR DEFORMERS | 9 Editing flare deformation effects 4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing flare deformer attributes To edit with the Attribute Editor: 1
Select the flare deformer node (default name: flaren).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Nonlinear Deformer Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Nonlinear Deformer Attributes
Start Flare X
Specifies the amount of flaring from the deformer’s X-axis at the Low Bound. The flaring progresses along the deformer’s local X-axis, varying according to the value of Curve. Use the slider to select values from 0.000 to 10.000. Default is 1.000.
Start Flare Z
Specifies the amount of flaring from the deformer’s Z-axis at the Low Bound. The flaring progresses along the deformer’s local Z-axis to the High Bound, varying according to the value of Curve. Use the slider to select values from 0.000 to 10.000. Default is 1.000.
End Flare X
Specifies the amount of flaring from the deformer’s X-axis at the High Bound. The flaring starts at the Low Bound and progresses along the deformer’s local X-axis to the High Bound, varying according to the value of Curve. Use the slider to select values from 0.000 to 10.000. Default is 1.000.
End Flare Z
Specifies the amount of flaring from the deformer’s Z-axis at the High Bound. The flaring starts at the Low Bound and progresses along the deformer’s local Z-axis to the High Bound, varying according to the value of Curve. Use the slider to select values from 0.000 to 10.000. Default is 1.000.
Curve
Specifies the amount of curvature (the profile of the flaring curve) between the Low Bound and the High Bound. A value of 0 specifies no curvature (linear interpolation). Positive values specify outward, bulging curvatures; negative values specify inward, hourglass-shaped curvatures. Use the slider to select values from 3.000 to 3.000. Default is 0.000.
Low Bound
Specifies lower extent of the flare on the deformer’s local negative Y-axis. Values can be negative numbers or zero. Use the slider to select values from negative 10.000 to 0.000. Default is -1.000.
High Bound
Specifies upper extent of the flare on the deformer’s positive local Y-axis. Values can be positive numbers only (minimum value is 0). Use the slider to select values from 0.000 to 10.000. Default is 1.000. Deformer Attributes
Envelope
Specifies the deformation scale factor. Use slider to select values from 0.000 to 1.000. Default is 1.000. Node Behavior See "Editing node behavior to improve performance" on page 54.
CHARACTER SETUP 122
PART 2
USING FLARE NONLINEAR DEFORMERS | 9 Deleting flare deformers Extra Attributes (No extra attributes by default.)
DELETING FLARE DEFORMERS To delete a flare deformer: 1
Select the flare deformer handle.
2
Select Edit > Delete (default shortcut: Backspace key). The flare deformer handle, flare deformer handle shape, and flare deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved. Also, note that the various input nodes that structure the evaluation of the deformation are not deleted.
DEFORMERS
CHARACTER SETUP 123
USING FLARE NONLINEAR DEFORMERS | 9 Deleting flare deformers
CHARACTER SETUP 124
PART 2
10
USING SINE NONLINEAR DEFORMERS The sine deformer changes the shape of an object along a sine wave. Sine deformer acting on a cylinder
UNDERSTANDING SINE DEFORMERS Sine deformers enable you to undulate any deformable object along a sine wave. They are useful both for character setup and modeling. Sine deformers include handles that you can use to control the extent, amplitude, and wavelength of the sine wave effects in an intuitive manner.
Related MEL commands MEL commands related to sine deformers include the following: •
nonLinear
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a sine deformer can include the following: DEFORMERS
CHARACTER SETUP 125
USING SINE NONLINEAR DEFORMERS | 10 Creating sine deformers •
Sine deformer algorithm node (default name: sinen; also note deformSine and nonLinear nodes)
•
Sine deformer handle node (default name: sinenHandle)
•
Sine deformer handle shape node (default name: sinenHandleShape)
•
Sine deformer set node (default name: sinenSet)
•
Tweak node (default name: tweakn) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING SINE DEFORMERS When creating sine deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Sine ❒. The Create Sine Deformer Options window is displayed.
3
Click the Basic and Advanced tabs to set the creation options. Basic
Low Bound
Specifies the extent of the sine wave along the deformer’s local negative Y-axis. Values can be negative numbers or zero. Use the slider to specify values from negative 10.0000 to 0.0000. Default is -1.0000.
High Bound
Specifies the extent of the sine wave along the deformer’s local positive Y-axis. Values can be positive numbers only (minimum value is 0). Use the slider to specify values from 0.0000 to 10.0000. Default is 1.0000.
Amplitude
Specifies the amplitude (maximum wave amount) of the sine wave. Use the slider to specify values from -5.0000 to 5.0000. Default is 0.0000 (no wave).
CHARACTER SETUP 126
PART 2
USING SINE NONLINEAR DEFORMERS | 10 Editing sine deformation effects Wavelength
Specifies the frequency of the sine wave along the deformer’s local Y-axis. For greater frequency, decrease the wavelength; for lesser frequency, increase the wavelength. Use the slider to specify values from -0.1000 to 10.0000. Default is 2.0000.
Dropoff
Specifies how the amplitude decays. Negative values specify a decay towards the center of the deformer handle (maximum is -1.0000), and positive values specify a decay away from the center of the deformer handle (maximum is 1.0000). Use the slider to specify values from -1.0000 to 1.0000. Default is 0.0000 (no decay).
Offset
Specifies the location of the sine wave relative to the center of the deformer handle. Changing this value can create a wriggling effect. Use the slider to specify values from -10.0000 to 10.0000. Default is 0.0000. Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a sine deformer. or
•
Click Save to save creation options without creating a sine deformer. or
•
Click Reset to reset to default creation options. or
•
Click Close to close the window.
Creating a sine deformer To create a Sine deformer: 1
Select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Sine. Maya creates a sine deformer with the previously set creation options. In the scene, the sine deformer handle is displayed as the currently selected object. The sine deformer handle (and its pivot point) are placed at the center of the object. In the Outliner, the sine deformer handle is listed (default name: sinenHandle). In the Channel Box, the sinenHandle and sinenHandleShape nodes are selected.
EDITING SINE DEFORMATION EFFECTS After you create the sine deformer, its handle is displayed in your scene and its nodes are listed in the Channel Box. The nodes include the sine handle node (default name: sinenHandle), the sine handle shape node (sinenHandleShape), and the sine deformer node (default name: sinen). You can edit the effects of the sine deformer by editing the sine handle node and the sine deformer node. You can move (translate), rotate, and scale the sine handle to edit the effects of the deformation. You can also edit the sine deformer node’s keyable attributes (channels), which are displayed in the Channel Box. You can edit bend deformation effects in a variety of ways: • DEFORMERS
Manipulating sine deformer handles
CHARACTER SETUP 127
USING SINE NONLINEAR DEFORMERS | 10 Editing sine deformation effects •
Editing sine deformer channels
•
Editing sine deformer attributes
Manipulating sine deformer handles To edit by using the handle manipulators: 1
Select the sine deformer node (default name: sinen).
2
Select the Show Manipulator Tool (default shortcut: t key).
3
Note the manipulators on the sine deformer handle. These enable you to edit attributes interactively.
Sine deformer handle manipulators
High Bound Wavelength
Offset
Amplitude
Low Bound Note: adjust Dropoff from the Channel Box
4
In the scene, select one of the manipulators on the sine deformer handle. Press the middle mouse button and move the mouse to edit interactively. Note that the Channel Box updates the values you are changing. To edit by moving, rotating, or scaling the handle:
1
Select the sine deformer handle node (default name: sinenHandle).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing the Insert key, moving the pivot point, and then pressing the Insert key again. Remember that you can access the deformer handle’s local axes (Display > Component Display > Local Rotation Axes), rotate and scale pivots (Display > Component Display > Rotate Pivots or Scale Pivots) and selection handle (Display > Component Display > Selection Handles).
CHARACTER SETUP 128
PART 2
USING SINE NONLINEAR DEFORMERS | 10 Editing sine deformation effects
Editing sine deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a sine deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing sine deformer attributes" on page 129). To edit the with the Channel Box: 1
Select the sine deformer node (default name: sinen). One quick way to select the sine deformer node is to select the object being deformed, and then select the sine deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Default is 1.
Amplitude
Specifies the amplitude (maximum wave amount) of the sine wave. Default is 0 (no wave).
Wavelength
Specifies the frequency of the sine wave along the deformer’s local Y-axis. For greater frequency, decrease the wavelength; for lesser frequency, increase the wavelength. Default is 2.
Offset
Specifies the location of the sine wave relative to the center of the deformer handle. Changing this value can create a wriggling effect. Default is 0.
Dropoff
Specifies how the amplitude decays. Negative values specify a decay towards the center of the deformer handle (maximum is -1), and positive values specify a decay away from the center of the deformer handle (maximum is 1). Default is 0 (no decay).
Low Bound
Specifies the extent of the sine wave along the deformer’s local negative Y-axis. Values can be negative numbers or zero. Default is -1.
High Bound
Specifies the extent of the sine wave along the deformer’s local positive Y-axis. Values can be positive numbers only (minimum value is 0). Default is 1. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing sine deformer attributes To edit with the Attribute Editor:
DEFORMERS
1
Select the sine deformer node (default name: sinen).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Nonlinear Deformer Attributes, Deformer Attributes, Node Behavior, and Extra Attributes.
CHARACTER SETUP 129
USING SINE NONLINEAR DEFORMERS | 10 Deleting sine deformers Nonlinear Deformer Attributes Amplitude
Specifies the amplitude (maximum wave amount) of the sine wave. Use the slider to select values from -5.000 to 5.000. Default is 0.000 (no wave).
Wavelength
Specifies the frequency of the sine wave along the deformer’s local Y-axis. For greater frequency, decrease the wavelength; for lesser frequency, increase the wavelength. Use the slider to select values from 0.100 to 10.000. Default is 2.000.
Offset
Specifies the location of the sine wave relative to the center of the deformer handle. Changing this value can create a wriggling effect. Use the slider to select values from -10.000 to 10.000. Default is 0.000.
Dropoff
Specifies how the amplitude decays. Negative values specify a decay towards the center of the deformer handle (maximum is -1.000), and positive values specify a decay away from the center of the deformer handle (maximum is 1.000). Use the slider to select values from -1.000 to 1.000. Default is 0.000 (no decay).
Low Bound
Specifies the extent of the sine wave along the deformer’s local negative Y-axis. Values can be negative numbers or zero. Use the slider to select values from negative 10.000 to 0.000. Default is -1.000.
High Bound
Specifies the extent of the sine wave along the deformer’s local positive Y-axis. Values can be positive numbers only (minimum value is 0.000). Use the slider to select values from 0.000 to 10.000. Default is 1.000. Deformer Attributes Specifies the deformation scale factor. Select values from 0 to 1. Default is 1.
Envelope
Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
DELETING SINE DEFORMERS To delete a sine deformer: 1
Select the sine deformer handle.
2
Select Edit > Delete (default shortcut: Backspace key). The sine deformer handle, sine deformer handle shape, and sine deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved. Also, note that the various input nodes that structure the evaluation of the deformation are not deleted.
CHARACTER SETUP 130
PART 2
11
USING SQUASH NONLINEAR DEFORMERS The squash deformer squashes and stretches objects.
Squash deformer acting on a sphere
UNDERSTANDING SQUASH DEFORMERS Squash deformers enable you to squash and stretch any deformable object along an axis. They are useful both for character setup (classic squash and stretch effects) and modeling. Squash deformers include handles that enable you to control the extent and magnitude of the squash or stretch effects in an intuitive manner.
Related MEL commands MEL commands related to squash deformers include the following: •
nonLinear
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a squash deformer can include the following:
DEFORMERS
CHARACTER SETUP 131
USING SQUASH NONLINEAR DEFORMERS | 11 Creating squash deformers •
Squash deformer algorithm node (default name: squashn; also note deformSquash and nonLinear nodes)
•
Squash deformer handle node (default name: squashnHandle)
•
Squash deformer handle shape node (default name: squashnHandleShape)
•
Squash deformer set node (default name: squashnSet)
•
Tweak node (default name: tweakn) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING SQUASH DEFORMERS When creating squash deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Squash ❒. The Create Squash Deformer Options window is displayed.
3
Click the Basic and Advanced tabs to set the creation options. Basic
Low Bound
Specifies the lower extent of squashing (or stretching) along the deformer’s local negative Y-axis. Use the slider to select values from negative 10.0000 to 0.0000. Default is -1.0000.
High Bound
Specifies the upper extent of squashing (or stretching) along the deformer’s local positive Y-axis. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Start Smoothness
CHARACTER SETUP 132
Specifies the amount of initial smoothing toward the low bound position (along the deformer’s local negative Y-axis). Use slider to select values from 0.0000 to 1.0000. Default is 0.0000.
PART 2
USING SQUASH NONLINEAR DEFORMERS | 11 Editing squash deformation effects End Smoothness
Specifies the amount of final smoothing towards the high bound position (along the deformer’s local positive Y-axis). Use the slider to select values from 0.0000 to 1.0000. Default is 0.0000.
Max Expand Position
Specifies the center of maximum expansion between the high bound position and the low bound position. Values can be between 0.01000 (near the low bound position) to 0.9900 (near the high bound position). Use the slider to select values from 0.0100 to 0.9900. Default is 0.5000.
Expand
Specifies the amount of expansion outwards during squashing or inwards during stretching. Use the slider to select values from 0.0000 to 1.7000. Default is 1.0000.
Factor
Specifies the amount of squashing or stretching. Increasing negative values specify squashing along deformer’s local Y-axis; increasing positive values specify stretching along deformer’s local Y-axis. Use the slider to select values from -10.0000 to 10.0000. Default is 0.0000 (no squashing or stretching). Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a squash deformer. or
•
Click Save to save creation options without creating a squash deformer. or
•
Click Reset to reset to default creation options. or
•
Click Close to close the window.
Creating a squash deformer To create a squash deformer: 1
Select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Squash. Maya creates a squash deformer with the previously set creation options. In the scene, the squash deformer handle is displayed as the currently selected object. The squash deformer handle (and its pivot point) are placed at the center of the object. In the Outliner, the squash deformer handle is listed (default name: squashnHandle). In the Channel Box, the squashnHandle and squashnHandleShape nodes are selected.
EDITING SQUASH DEFORMATION EFFECTS After you create the squash deformer, its handle is displayed in your scene and its nodes are listed in the Channel Box. The nodes include the squash handle node (default name: squashnHandle), the squash handle shape node (squashnHandleShape), and the squash deformer node (default name: squashn).
DEFORMERS
CHARACTER SETUP 133
USING SQUASH NONLINEAR DEFORMERS | 11 Editing squash deformation effects You can edit the effects of the squash deformer by editing the squash handle node and the squash deformer node. You can move (translate), rotate, and scale the squash handle to edit the effects of the deformation. You can also edit the squash deformer node’s keyable attributes (channels), which are displayed in the Channel Box.
Manipulating squash deformer handles To edit using handle manipulators: 1
Select the squash deformer node (default name: squashn).
2
Select the Show Manipulator Tool (default shortcut: t key).
3
Note the manipulators on the squash deformer handle. These enable you to edit attributes interactively. Squash deformer handle manipulators
High Bound
Factor
Max Expand Position
Low Bound Note: adjust Expand, Start Smoothness, and End Smoothness from the Channel Box
4
In the scene, select one of the manipulators on the squash deformer handle. Press the middle mouse button and move the mouse to edit interactively. Note that the Channel Box updates the values you are changing. To edit by moving, rotating, or scaling handle:
1
Select the squash deformer handle node (default name: squashnHandle).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing the Insert key, moving the pivot point, and then pressing the Insert key again. Remember that you can access the deformer handle’s local axes (Display > Component Display > Local Rotation Axes), rotate and scale pivots (Display > Component Display > Rotate Pivots or Scale Pivots) and selection handle (Display > Component Display > Selection Handle).
CHARACTER SETUP 134
PART 2
USING SQUASH NONLINEAR DEFORMERS | 11 Editing squash deformation effects
Editing squash deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a squash deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing squash deformer attributes" on page 135). To edit with the Channel Box: 1
Select the squash deformer node (default name: squashn). One quick way to select the squash deformer node is to select the object being deformed, and then select the squash deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Default is 1.
Factor
Specifies the amount of squashing or stretching. Increasing negative values specify squashing along deformer’s local Y-axis; increasing positive values specify stretching along deformer’s local Y-axis. Default is 0 (no squashing or stretching).
Expand
Specifies the amount of expansion outwards during squashing or inwards during stretching. Minimum value is 0; maximum value is 10. Default is 1.
Max Expand Position
Specifies the center of maximum expansion between the high bound position and the low bound position. Values can be between 0.01 (near the low bound position) to 0.99 (near the high bound position). Default is 0.5.
Start Smoothness
Specifies the amount of initial smoothing towards the low bound position (along the deformer’s local negative Y-axis). Values can be from 0 to 1. Default is 0.
End Smoothness
Specifies the amount of final smoothing towards the high bound position (along the deformer’s local positive Y-axis). Values can be from 0 to 1. Default is 0.
Low Bound
Specifies the lower extent of squashing (or stretching) along the deformer’s local negative Y-axis. Default is -1.
High Bound
Specifies upper extent of squashing (or stretching) along the deformer’s local positive Y-axis. Default is 1. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key will give you finer control, and pressing the Shift key will give you coarser control.
Editing squash deformer attributes To edit with the Attribute Editor: 1
DEFORMERS
Select the squash deformer node (default name: squashn).
CHARACTER SETUP 135
USING SQUASH NONLINEAR DEFORMERS | 11 Deleting squash deformers 2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a). The following sections make available attributes: Nonlinear Deformer Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Nonlinear Deformer Attributes
Factor
Specifies the amount of squashing or stretching. Increasing negative values specify squashing along deformer’s local Y-axis; increasing positive values specify stretching along deformer’s local Y-axis. Use the slider to select values from -10.000 to 10.000. Default is 0.000 (no squashing or stretching).
Expand
Specifies the amount of expansion outwards during squashing or inwards during stretching. Minimum value is 0; maximum value is 10. Use the slider to select values from 0.000 to 10.000. Default is 1.000.
Max Expand Pos
Specifies the center of maximum expansion between the high bound position and the low bound position. Values can be between 0.010 (near the low bound position) to 0.990 (near the high bound position). Use the slider to select values from 0.010 to 0.990. Default is 0.5. (This attribute corresponds to the Max Expand Position channel.)
Start Smoothness
Specifies the amount of initial smoothing towards the low bound position (along the deformer’s local negative Y-axis). Use the slider to select values from 0.000 to 1.000. Values can be from 0.000 to 1.000. Default is 0.000.
End Smoothness
Specifies the amount of final smoothing towards the high bound position (along the deformer’s local positive Y-axis). Use the slider to select values from 0.000 to 1.000. Default is 0.000.
Low Bound
Specifies the lower extent of squashing (or stretching) along the deformer’s local negative Y-axis. Use the slider to select values from -10.000 to 0.000. Default is -1.000.
High Bound
Specifies the upper extent of squashing (or stretching) along the deformer’s local positive Y-axis. Use the slider to select values from 0.000 to 10.000. Default is 1.000. Deformer Attributes Specifies the deformation scale factor. Select values from 0.000 to 1.000. Default is 1.000.
Envelope
Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
DELETING SQUASH DEFORMERS To delete a Squash deformer: 1
Select the Squash deformer handle.
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 136
PART 2
USING SQUASH NONLINEAR DEFORMERS | 11 Examples The squash deformer handle, squash deformer handle shape, and squash deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved. Also, note that the various input nodes that structure the evaluation of the deformation are not deleted.
EXAMPLES This section includes two examples of using squash deformers:
Squashing a sphere onto the ground By default, Maya places nonlinear deformer handles at the center of the object to be deformed. For instance, when you create a sphere and create a squash deformer for it, Maya places the squash deformer handle at the center of the sphere. The deformation will be relative to the sphere’s center. If you want to squash the sphere against the ground, you can adjust the squash deformer’s attributes and move the squash deformer handle so that the deformation will be relative to where the sphere touches the ground. In general, you can make these adjustments so that the squashing effect can occur relative to any location inside or outside of the sphere. To set up the sphere and the deformer:
DEFORMERS
1
Create a primitive NURBS sphere.
2
Press 3 key to increase the display resolution.
3
Move the sphere so that it is sitting on the grid in a perspective view.
4
Create a squash deformer for the sphere.
CHARACTER SETUP 137
USING SQUASH NONLINEAR DEFORMERS | 11 Examples
To edit the deformer: 1
Edit the squash deformer by setting squash1’s attributes as follows:
Low Bound
0
High Bound
0.75 2
Move the deformer handle so the lower boundary is where the sphere is making contact with the ground:
To squash the sphere against the ground: 1
Now, from the Channel Box, interactively change the Factor. The squash deformation takes place relative to the bottom of the sphere, where the sphere is touching the ground.
CHARACTER SETUP 138
PART 2
USING SQUASH NONLINEAR DEFORMERS | 11 Examples
Bouncing ball setup
You can create squash and stretch effects with the squash deformer. This example shows how you can set up a ball for a bouncing ball animation, a classic test of an animator’s skills. To create NURBS sphere with squash control: 1
Do the previous example.
2
Set squash1’s Factor attribute back to 0. To create deformer for stretch control:
1
Create another squash deformer for the sphere to provide stretch control. Use the default creation options. The squash1 deformer provides the squashing that occurs when the ball lands on the ground. The deformer you’ve just created (squash2) will provide the stretching that will occur when the ball is in flight. To define the ball:
1
Group the sphere (nurbsSphere1) and the deformer handles (squash1Handle and squash2Handle).
2
Rename the group ball.
3
Open the Channel Control window (Window > General Editors > Channel Control), and make the following attributes Non Keyable:
•
scaleX, scaleY, scaleZ
•
visibility The Channel Box now lists only the following keyable attributes for ball: Translate X, Translate Y, Translate Z, Rotate X, Rotate Y, and Rotate Z.
4
Close the Channel Control window. Now you will add two attributes to the ball for squashing and stretching.
DEFORMERS
5
With the ball selected, select Modify > Add Attribute.
•
Add a keyable attribute called flyStretch, with the following Min/Max Values: Minimum 0, Maximum 10, Default 0.
•
Add a keyable attribute called landSquash, with the following Min/Max Values: Minimum 0, Maximum 10, Default 0.
CHARACTER SETUP 139
USING SQUASH NONLINEAR DEFORMERS | 11 Examples 6
Close the Add Attribute window. To set driver and driven keys for stretching:
1
Open the Set Driven Key window (Animate > Set Driven Key > Set ❒).
2
Load ball as driver, select flyStretch attribute, and set the attribute to 0.
3
Load squash2 as driven, select factor attribute, and set the attribute to 0.
4
Click Key.
5
Set ball’s flyStretch attribute to 10.
6
Set squash2’s factor attribute at 0.6.
7
Click Key. To set driver and driven keys for squashing:
1
Open the Set Driven Key window if it is not already opened.
2
Load ball as driver, select landSquash attribute, and set the attribute to 0.
3
Load squash1 as driven, select factor attribute, and set the attribute to 0.
4
Click Key.
5
Set ball’s landSquash attribute to 10.
6
Set squash1’s factor attribute at -2.
7
Click Key.
8
Click Close to close the editor. Now the ball is ready for a bouncing ball animation with squash and stretch effects. Animate the ball You’ve now set up the ball for animation. Try creating an animation of the ball bouncing. Include stretch effects when the ball is in flight and squash effects when the ball hits the ground. For example, your animation might look something like the following: Ball starting to stretch as it falls towards the ground.
CHARACTER SETUP 140
PART 2
USING SQUASH NONLINEAR DEFORMERS | 11 Examples
Ball stretching while in flight (increasing Fly Stretch attribute).
Ball lands on the ground. Fly Stretch attribute is 0, and Land Squash attribute is 10.
DEFORMERS
CHARACTER SETUP 141
USING SQUASH NONLINEAR DEFORMERS | 11 Examples
Ball leaving the ground with reduced squashing and increased stretching.
Ball in flight again at full stretch.
These images show just a simple example of a bouncing ball. As you develop your animation of a bouncing ball, try to see how much “character” you can give to the ball’s movements.
CHARACTER SETUP 142
PART 2
12
USING TWIST NONLINEAR DEFORMERS The twist deformer twists the shape of an object.
Twist deformer acting on a box
UNDERSTANDING TWIST DEFORMERS Twist deformers enable you to twist any deformable object about an axis. They are useful both for character setup and modeling. Twist deformers include handles that enable you to control the extent and degree of the twisting effects in an intuitive manner.
Related MEL commands MEL commands related to twist deformers include the following: •
nonLinear
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a twist deformer can include the following:
DEFORMERS
CHARACTER SETUP 143
USING TWIST NONLINEAR DEFORMERS | 12 Creating twist deformers •
Twist deformer algorithm node (default name: twistn; also note deformTwist and nonLinear nodes)
•
Twist deformer handle node (default name: twistnHandle)
•
Twist deformer handle shape node (default name: twistnHandleShape)
•
Twist deformer set node (default name: twistnSet)
•
Tweak node (default name: tweakn) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING TWIST DEFORMERS When creating twist deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Twist ❒. The Create Twist Deformer Options window is displayed. Basic
Low Bound
Specifies the position of the start angle twisting on the deformer’s local Y-axis. Values must be negative numbers or zero. Use the slider to select values from 10.0000 to 0.0000. Default is -1.0000.
High Bound
Specifies the position of the end angle twisting on the deformer’s local Y-axis. Values must be positive numbers. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Start Angle
Specifies the degree of twisting at the low bound position on the deformer handle’s local negative Y-axis. Use the slider to select values from -10.0000 to 10.0000. Default is 0.0000.
End Angle
Specifies the degree of twisting at the high bound position on the deformer handle’s local positive Y-axis. Use the slider to select values from -10.0000 to 10.0000. Default is 0.0000.
CHARACTER SETUP 144
PART 2
USING TWIST NONLINEAR DEFORMERS | 12 Editing twist deformation effects Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a twist deformer. or
•
Click Save to save creation options without creating a twist deformer. or
•
Click Reset to reset to default creation options. or
•
Click Close to close the window.
Creating a twist deformer To create a twist deformer: 1
Select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Twist. Maya creates a twist deformer with the previously set creation options. In the scene, the twist deformer handle is displayed as the currently selected object. The twist deformer handle (and its pivot point) are placed at the center of the object. In the Outliner, the twist deformer handle is listed (default name: twistnHandle). In the Channel Box, the twistnHandle and twistnHandleShape nodes are selected.
EDITING TWIST DEFORMATION EFFECTS After you create the twist deformer, its handle is displayed in your scene and its nodes are listed in the Channel Box. The nodes include the twist handle node (default name: twistnHandle), the twist handle shape node (twistnHandleShape), and the Twist deformer node (default name: twistn). You can edit the effects of the twist deformer by editing the twist handle node and the twist deformer node. You can move (translate), rotate, and scale the twist handle to edit the effects of the deformation. You can also edit the twist deformer node’s keyable attributes (channels), which are displayed in the Channel Box.
Manipulating twist deformer handles To edit by using handle manipulators:
DEFORMERS
1
Select the twist deformer node (default name: twistn).
2
Select the Show Manipulator Tool (default shortcut: t key).
3
Note the manipulators on the twist deformer handle. These enable you to edit attributes interactively.
CHARACTER SETUP 145
USING TWIST NONLINEAR DEFORMERS | 12 Editing twist deformation effects
Twist deformer handle manipulators
End Angle indicator
Start Angle indicator
4
High Bound
Low Bound
In the scene, select one of the manipulators on the twist deformer handle. Press the middle mouse button and move the mouse to edit interactively. Note that the Channel Box updates the values you are changing. To edit by moving, rotating, or scaling handle:
1
Select the twist deformer handle node (default name: twistnHandle).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing the Insert key, moving the pivot point, and then pressing the Insert key again. Remember that you can access the deformer handle’s local axes (Display > Component Display > Local Rotation Axes), rotate and scale pivots (Display > Component Display > Rotate Pivots or Scale Pivots) and selection handle (Display > Component Display > Selection Handle).
Editing twist deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a twist deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing twist deformer attributes" on page 147). To edit with the Channel Box: 1
Select the twist deformer node (default name: twistn). One quick way to select the twist deformer node is to select the object being deformed, and then select the twist deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Envelope
CHARACTER SETUP 146
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Default is 1.
PART 2
USING TWIST NONLINEAR DEFORMERS | 12 Editing twist deformation effects Start Angle
Specifies the degree of twisting at the low bound position on the deformer handle’s local negative Y-axis. Default is 0.
End Angle
Specifies the degree of twisting at the high bound position on the deformer handle’s local positive Y-axis. Default is 0.
Low Bound
Specifies the position of the start angle twisting on the deformer’s local Y-axis. Values must be negative numbers or zero. Default is -1.
High Bound
Specifies the position of the end angle twisting on the deformer’s local Y-axis. Values must be positive numbers. Default is 1. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing twist deformer attributes To edit with the Attribute Editor: 1
Select the twist deformer node (default name: twistn).
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a). The following sections make available attributes: Nonlinear Deformer Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Nonlinear Deformer Attributes
Start Angle
Specifies the degree of twisting at the low bound position on the deformer handle’s local negative Y-axis. Use the slider to select values from -859.437 to 859.437. Default is 0.000.
End Angle
Specifies the degree of twisting at the high bound position on the deformer handle’s local positive Y-axis. Use the slider to select values from -859.437 to 859.437. Default is 0.000.
Low Bound
Specifies the position of the start angle twisting on the deformer’s local Y-axis. Use the slider to select values from -10.000 to 0.000. Default is -1.000.
High Bound
Specifies the position of the end angle twisting on the deformer’s local Y-axis. Use the slider to select values from 0.000 to 10.000. Default is 1.000. Deformer Attributes
Envelope
Specifies the deformation scale factor. Select values from 0.000 to 1.000. Default is 1.000. Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
DEFORMERS
CHARACTER SETUP 147
USING TWIST NONLINEAR DEFORMERS | 12 Deleting twist deformers
DELETING TWIST DEFORMERS To delete a Twist deformer: 1
Select the twist deformer handle.
2
Select Edit > Delete (default shortcut: Backspace key). The twist deformer handle, twist deformer handle shape, and twist deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved. Also, note that the various input nodes that structure the evaluation of the deformation are not deleted.
EXAMPLE Spiral staircase modeling
Image by Peter Miller
The foundation, rail, and moldings of the staircase’s model were shaped with the twist deformer.
CHARACTER SETUP 148
PART 2
13
USING WAVE NONLINEAR DEFORMERS The wave deformer deforms an object based on a circular sine wave for ripple effects. If you’d like to explore an example now, see "Example" on page 154.
Wave deformer acting on a plane
UNDERSTANDING WAVE DEFORMERS The wave deformer is similar to the sine deformer. The sine deformer’s sine wave propagates in the deformer’s local Y-axis, with the amplitude along the X-axis. The wave deformer’s sine wave propagates along the deformer’s local X and Z axes, with the amplitude along the Y-axis. Wave deformers include handles that enable you to control the extent, amplitude, and wavelength of the wave effects in an intuitive manner.
Related MEL commands MEL commands related to wave deformers include the following: •
nonLinear
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a wave deformer can include the following:
DEFORMERS
CHARACTER SETUP 149
USING WAVE NONLINEAR DEFORMERS | 13 Creating wave deformers •
Wave deformer algorithm node (default name: waven; also note deformWave and nonLinear nodes)
•
Wave deformer handle node (default name: wavenHandle)
•
Wave deformer handle shape node (default name: wavenHandleShape)
•
Wave deformer set node (default name: wavenSet)
•
Tweak node (default name: tweakn) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING WAVE DEFORMERS When creating wave deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Wave ❒. The Create Wave Deformer Options window is displayed. Basic
Min Radius
Specifies the minimum radius of the circular sine wave. Use the slider to select values from 0.0000 to 1.0000. Default is 0.0000.
Max Radius
Specifies the maximum radius of the circular sine wave. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Amplitude
Specifies the amplitude (maximum wave amount) of the sine wave. Use slider to select values from -5.0000 to 5.0000. Default is 0.0000 (no wave).
Wavelength
Specifies the frequency of the sine wave. For greater frequency, decrease the wavelength; for lesser frequency, increase the wavelength. Use the slider to select values from -0.1000 to 10.0000. Default is 1.0000.
CHARACTER SETUP 150
PART 2
USING WAVE NONLINEAR DEFORMERS | 13 Editing wave deformation effects Dropoff
Specifies how the amplitude decays. Negative values specify a decay towards the center of the deformer handle (maximum is -1.0000), and positive values specify a decay away from the center of the deformer handle (maximum is 1.0000). Use the slider to select values from -1.0000 to 1.0000. Default is 0.0000 (no decay).
Offset
Specifies the location of the sine wave relative to the center of the deformer handle. Changing this value can create a rippling effect. Use the slider to select values from 10.0000 to 10.0000. Default is 0. Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a wave deformer. or
•
Click Save to save creation options without creating a wave deformer. or
•
Click Reset to reset to default creation options. or
•
Click Close to close the window.
Creating a wave deformer To create a wave deformer: 1
Select the object(s) you want to deform.
2
Select Deform > Create Nonlinear > Wave. Maya creates a wave deformer with the previously set creation options. In the scene, the wave deformer handle is displayed as the currently selected object. The wave deformer handle (and its pivot point) are placed at the center of the object. In the Outliner, the wave deformer handle is listed (default name: wavenHandle). In the Channel Box, the wavenHandle and wavenHandleShape nodes are selected.
EDITING WAVE DEFORMATION EFFECTS After you create the wave deformer, its handle is displayed in your scene and its nodes are listed in the Channel Box. The nodes include the wave handle node (default name: wavenHandle), the wave handle shape node (wavenHandleShape), and the wave deformer node (default name: waven). You can edit the effects of the wave deformer by editing the wave handle node and the wave deformer node. You can move (translate), rotate, and scale the wave handle to edit the effects of the deformation. You can also edit the wave deformer node’s keyable attributes (channels), which are displayed in the Channel Box.
Manipulating wave deformer handles To edit by using handle manipulators:
DEFORMERS
1
Select the wave deformer node (default name: waven).
2
Select the Show Manipulator Tool (default shortcut: t key).
CHARACTER SETUP 151
USING WAVE NONLINEAR DEFORMERS | 13 Editing wave deformation effects 3
Note the manipulators on the wave deformer handle. These enable you to edit attributes interactively. Wave deformer handle manipulators
Amplitude
Wavelength
Offset and Min Radius
Max Radius
Note: Offset and Min Radius manipulators are both at the center of the handle by default.
4
Note: adjust Dropoff from the Channel Box.
In the scene, select one of the manipulators on the wave deformer handle. Press the middle mouse button and move the mouse to edit interactively. Note that the Channel Box updates the values you are changing. Note that the Offset and Min Radius manipulators are both located at the center of the handle by default. To edit by moving, rotating or scaling handle:
1
Select the wave deformer handle node (default name: wavenHandle).
2
Move (translate), rotate, or scale the handle to change the effect of the deformation.
3
Move or rotate the handle pivot point by pressing the Insert key, moving the pivot point, and then pressing the Insert key again. Remember that you can access the deformer handle’s local axes (Display > Component Display > Local Rotation Axes), rotate and scale pivots (Display > Component Display > Rotate Pivots or Scale Pivots) and selection handle (Display > Component Display > Selection Handle).
Editing wave deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a twist deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing wave deformer attributes" on page 153). To edit with the Channel Box: 1
CHARACTER SETUP 152
Select the wave deformer node (default name: waven).
PART 2
USING WAVE NONLINEAR DEFORMERS | 13 Editing wave deformation effects One quick way to select the wave deformer node is to select the object being deformed, and then select the wave deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control). 2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Default is 1.
Amplitude
Specifies the amplitude (maximum wave amount) of the sine wave. Default is 0 (no wave).
Wavelength
Specifies the frequency of the sine wave. For greater frequency, decrease the wavelength; for lesser frequency, increase the wavelength. Default is 1.
Offset
Specifies the location of the sine wave relative to the center of the deformer handle. Changing this value can create a rippling effect. Default is 0.
Dropoff
Specifies how the amplitude decays. Negative values specify a decay toward the center of the deformer handle (maximum is -1), and positive values specify a decay away from the center of the deformer handle (maximum is 1). Default is 0 (no decay).
Dropoff Position
Specifies the location of the maximum amplitude between the minimum radius and the maximum radius (only has effect when Dropoff is not 0). The value can range from 0 to 1, with 0 specifying the dropoff position at the minimum radius, and 1 specifying the dropoff position at the maximum radius. A value of 0.5 places the dropoff position halfway between the minimum radius and maximum radius. Default is 0.
Min Radius
Specifies the minimum radius of the circular sine wave. Minimum value is 0; Maximum value is 1. Default is 0.
Max Radius
Specifies the maximum radius of the circular sine wave. Minimum value is 0; Maximum value is 1. Default is 1. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing wave deformer attributes To edit with the Attribute Editor: 1
Select the wave deformer node (default name: waven).
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a). The following sections make available attributes: Nonlinear Deformer Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Nonlinear Deformer Attributes
Amplitude
DEFORMERS
Specifies the amplitude (maximum wave amount) of the sine wave. Use the slider to select values from -5.000 to 5.000. Default is 0.000 (no wave).
CHARACTER SETUP 153
USING WAVE NONLINEAR DEFORMERS | 13 Deleting wave deformers Wavelength
Specifies the frequency of the sine wave. For greater frequency, decrease the wavelength; for lesser frequency, increase the wavelength. Use the slider to select values from 0.100 to 10.000. Default is 1.000.
Offset
Specifies the location of the sine wave relative to the center of the deformer handle. Changing this value can create a rippling effect. Use the slider to select values from 10.000 to 10.000. Default is 0.000.
Dropoff
Specifies how the amplitude decays. Negative values specify a decay towards the center of the deformer handle (maximum is -1.000), and positive values specify a decay away from the center of the deformer handle (maximum is 1.000). Use the slider to select values from -1.000 and 1.000. Default is 0.000 (no decay).
Min Radius
Specifies the minimum radius of the circular sine wave. Minimum value is 0.000; Maximum value is 1.000. Use the slider to select values from 0.000 to 10.000. Default is 0.000.
Max Radius
Specifies the maximum radius of the circular sine wave. Minimum value is 0.000; Maximum value is 1.000. Use the slider to select values from 0.000 to 10.000. Default is 1.000. Deformer Attributes Specifies the deformation scale factor. Select values from 0.000 to 1.000. Default is 1.000.
Envelope
Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
DELETING WAVE DEFORMERS To delete a wave deformer: 1
Select the wave deformer handle.
2
Select Edit > Delete (default shortcut: Backspace key). The wave deformer handle, wave deformer handle shape, and wave deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved. Also, note that the various input nodes that structure the evaluation of the deformation are not deleted.
EXAMPLE Ripple animation You can create ripple effects by using a wave deformer on a NURBS or polygonal surface. This example shows how you can create a simple ripple effect on a NURBS plane.
CHARACTER SETUP 154
PART 2
USING WAVE NONLINEAR DEFORMERS | 13 Example
To create the NURBS plane: Create a NURBS plane, using the default creation options except set Width to 20, U Patches to 40, and V Patches to 40. To create a wave deformer: With the plane selected, create a wave deformer for the plane with the following creation options: Min Radius
0
Max Radius
1
Amplitude
0.2
Wavelength
0.4
Dropoff
1
Offset
0 The result follows:
Next, you will set keys at frames 1, 10, and 20. To key ripple at frame 1: 1
In the Timeline, select frame 1.
2
In the Channel Box, set wave1’s attributes as follows:
Amplitude
0.0
Max Radius
0.1
DEFORMERS
CHARACTER SETUP 155
USING WAVE NONLINEAR DEFORMERS | 13 Example
Ripple at frame 1
3
Set keys for all of wave1’s attributes. To key ripple at frame 10:
1
In the Timeline, select frame 10.
2
In the Channel Box, set wave1’s attributes as follows:
Amplitude
-0.2 (negative value allows first wavelet to go down)
Dropoff Position
0.5
Max Radius
1 The result is as follows:
Ripple at frame 10
3
Set keys for all of wave1’s attributes. To key ripple at frame 20:
1
In the Timeline, select frame 20.
2
In the Channel Box, set wave1’s attributes as follows:
Min Radius
1
Amplitude
-0.1 The result is as follows:
CHARACTER SETUP 156
PART 2
USING WAVE NONLINEAR DEFORMERS | 13 Example
Ripple at frame 20
3
Set keys for all of wave1’s attributes. To see the ripple:
1
Scrub or play the animation.
2
You can create more intricate and complicated rippling effects by continuing to adjust the wave deformer’s attributes. You can also apply additional wave or sine deformers to the plane for more complex results.
Using an expression for wave dropoff Instead of animating the Dropoff Position attribute, you could write an expression that drives the drop off of the wave. The expression would be as follows: wave1.offset = wave1.wavelength * .25;
DEFORMERS
CHARACTER SETUP 157
USING WAVE NONLINEAR DEFORMERS | 13 Example
CHARACTER SETUP 158
PART 2
14
USING SCULPT DEFORMERS With sculpt deformers, you can deform objects with a spherical influence object called a sculpt sphere.
UNDERSTANDING SCULPT DEFORMERS Sculpt deformers are useful for creating any kind of rounded deformation effect. For example, in setting a character for facial animation, you could use sculpt deformers to control the character’s chin, brow, or cheek actions.
Sculpt sphere The sculpt sphere is the spherical wireframe influence object you manipulate to create deformation effects. The sculpt sphere’s deformation effects depend on the mode of the sculpt deformer. Sculpt deformer modes include flip, project, and stretch.
Flip mode A sculpt deformer in flip mode has an implicit locator in the center of the sculpt sphere. When the sculpt sphere is near the geometry, deformation occurs. This mode is called flip mode because as the center of the sculpt sphere passes through the surface, the deformed surface flips to the other side of the sculpt sphere.
DEFORMERS
CHARACTER SETUP 159
USING SCULPT DEFORMERS | 14 Understanding sculpt deformers
Project mode In project mode the sculpt deformer projects the geometry onto the surface of the sculpt sphere. The extent to which the projection takes place depends on the sculpt deformer’s Dropoff Distance attribute. While the Dropoff Distance specifies the extent of the projection directly onto the sculpt sphere, the Maximum Displacement attribute specifies whether the projection takes place directly onto the sculpt sphere, inside the sculpt sphere, or outside of the sculpt sphere. With a Maximum Displacement of 1.0, the projection takes place on the surface of the sculpt sphere. This is the effect you would usually want to achieve with project mode. However, by changing the Maximum Displacement you can displace the projection from the surface of the sculpt sphere. With a Maximum Displacement between 0 and 1.0, the projection takes place within the sculpt sphere. With a Maximum Displacement greater than 1.0, the projection takes place outside of the surface of the sculpt sphere. Finally, with a Maximum Displacement of 0, the geometry is projected into the center of the sculpt sphere. Finally, with a Maximum Displacement of less than 0, the projected geometry turns inside out as it is projected through the center of the sculpt sphere.
Stretch mode In stretch mode, as you move the sculpt sphere away from the geometry, the affected surface of the geometry stretches or bulges to stay with the sculpt sphere. The stretch direction extends from the point marked by a stretch origin locator to the surface of the sculpt sphere. When you create a sculpt deformer in stretch mode, you can select and move the stretch origin locator as you do any object, or parent it to the sculpt sphere and move them in combination. Depending on the effect you want to create, you could also parent the locator to some other object in the animation.
Related MEL commands MEL commands related to sculpt deformers include the following: •
sculpt
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a sculpt deformer can include the following: •
Sculpt deformer node, which is the algorithm node for the sculpt deformer (default name: sculptn).
•
Sculpt sphere node (default name: sculptnSphere).
•
Sculpt sphere shape node (default name: sphereShapen).
•
Stretch origin locator node, which is the locator’s transform node (default name: sculptnStretchOrigin).
•
Stretch origin locator shape, which is the locator’s shape node (default name: sculptnStretchOriginShape).
CHARACTER SETUP 160
PART 2
USING SCULPT DEFORMERS | 14 Creating sculpt deformers •
A deformer set node (default name: sculptnSet).
•
Tweak node (default name: tweakn). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING SCULPT DEFORMERS When creating sculpt deformers, you can first set creation options and then create a deformer, or you can immediately create a deformer with the current creation options. If you’re not sure what the current creation options are, checking them before you create a deformer can save you some time adjusting the deformer’s attributes afterwards.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Setting creation options To set creation options: 1
If you also want to create a sculpt deformer now, select one or more deformable objects.
2
Select Deform > Create Sculpt Deformer ❒.
3
The Sculpt Options window is displayed.
4
Click the Basic and Advanced tabs to set the creation options: Basic
Mode
Specifies the sculpt deformer’s mode. Select Flip, Project, or Stretch. Default is Stretch.
Inside Mode
Specifies how the deformer influences the deformable object’s points located inside the sculpt sphere. There are two modes: Ring and Even. Ring mode pushes inside points outside of the sculpt sphere, creating a contoured, ring-like effect around the sculpt sphere. Even mode spreads the inside points all around the sculpt sphere evenly, creating a smooth, spherical effect.
Select Ring or Even. Default is Even. Max Displacement
DEFORMERS
Specifies the distance that the sculpt sphere can push a deformable object’s points from the sphere’s surface. Use the slider to select values from -10.000 to 10.000. Default is 0.100.
CHARACTER SETUP 161
USING SCULPT DEFORMERS | 14 Editing sculpt deformation effects Specifies how the sculpt sphere’s range of influence declines or drops off. (The range of influence is specified with the Dropoff Distance.) There are two Dropoff Types: None and Linear.
Dropoff Type
None specifies no decline, providing a sudden dropoff effect. Linear specifies a gradual decline, providing a dropoff effect that decreases linearly. Select None or Linear. (Default is Linear.) Dropoff Distance
Specifies the sculpt sphere’s range of influence. (How the range of influence can decline is specified by Dropoff Type.)
Positioning
Specifies the placement of the sculpt sphere. Click Positioning on to center sculpt sphere within the deformable object. Click off to place sculpt sphere at the workspace origin. Note that if you are creating a stretch sculpt deformer (Mode is set to Stretch), the stretch origin locator will be placed with the sculpt sphere. Default is on, which centers the sculpt sphere within the deformable object.
Grouping
If you are creating a stretch sculpt deformer (Mode is set to Stretch), you can choose whether the stretch origin locator will be put in a group with the sculpt sphere. Click on to group the sculpt sphere with the stretch origin locator. Default is off. Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create if you want to create a sculpt deformer now. or
•
Click Save to save the creation options. or
•
Click Reset to reset to the default creation options. or
•
Click Close to close the Sculpt Options window.
Creating a sculpt deformer To create a sculpt deformer: 1
Select one or more deformable objects.
2
Select Deform > Create Sculpt. A sculpt deformer is created with the currently set creation options.
EDITING SCULPT DEFORMATION EFFECTS You can create sculpt deformation effects as described in the following topics:
Manipulating the sculpt sphere To manipulate the sculpt sphere: 1
CHARACTER SETUP 162
In the workspace or the Outliner, select the sculpt sphere (default name: sculptnSphere). PART 2
USING SCULPT DEFORMERS | 14 Editing sculpt deformation effects 2
To create deformation effects, move, rotate, or scale the sculpt sphere.
Manipulating the stretch origin locator If the sculpt deformer is in stretch mode (Mode attribute is set to Stretch), you can create deformation effects by directly manipulating the stretch origin locator as well as the sculpt sphere. To manipulate the stretch origin locator: 1
In the workspace or the Outliner, select the stretch origin locator (default name: sculptnStretchOrigin).
2
To create deformation effects, move, rotate, or scale the stretch origin locator.
Editing sculpt deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a sculpt deformer’s channels. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control). To edit all attributes, use the Attribute Editor (see "Editing sculpt deformer attributes" on page 164). To edit channels with the Channel Box: 1
Select a sculpt deformer node (default name: sculptn). One quick way to select the sculpt deformer node is to select the object being deformed, and then select the sculpt deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control.)
2
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Values can vary from 0 to 1. Default is 1.
Envelope Maximum Displacement
Specifies the distance that the sculpt sphere can push a deformable object’s points from the sphere’s surface. Enter values from -10.000 to 10.000. Default is 0.100. (When you created the deformer, Maximum Displacement was set to the Max Displacement creation option’s value.) The effect can depend on the deformer’s Mode attribute setting. For instance, if Mode is set to Project, see "Project mode" on page 160. Dropoff Distance
Specifies the sculpt sphere’s range of influence. How the range of influence can decline is specified by Dropoff Type attribute. The effect can depend on the deformer’s Mode attribute setting. For instance, if Mode is set to Project, see "Project mode" on page 160. 3
DEFORMERS
Click on a channel name with the left mouse button.
CHARACTER SETUP 163
USING SCULPT DEFORMERS | 14 Editing sculpt deformation effects 4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing sculpt deformer attributes You can edit all of a sculpt deformer’s attributes with the Attribute Editor. To edit attributes with the Attribute Editor: 1
Select the sculpt deformer node (default name: sculptn).
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Sculpt History, Deformer Attributes, Node Behavior, and Extra Attributes. Sculpt History
Mode
Specifies the sculpt deformer’s mode. To create a flip, project, or stretch sculpt deformer, select Flip, Project, or Stretch. Default is Stretch.
Inside Mode
Specifies how the deformer influences the deformable object’s points located inside the sculpt sphere. There are two modes: Ring and Even. Ring mode pushes inside points outside of the sculpt sphere, creating a contoured, ring-like effect around the sculpt sphere. Even mode spreads the inside points all around the sculpt sphere evenly, creating a smooth, spherical effect. Select Ring or Even. Default is Even.
Max Displacement
Dropoff Type
Specifies the distance that the sculpt sphere can push a deformable object’s points from the sphere’s surface. Use the slider to select values from -10.000 to 10.000. Default is 0.100. (Max Displacement corresponds to the Maximum Displacement channel.) The effect can depend on the deformer’s Mode attribute setting. For instance, if Mode is set to Project, see "Project mode" on page 160. Specifies how the sculpt sphere’s range of influence declines or drops off. (The range of influence is specified with the Dropoff Distance.) There are two Dropoff Types: None and Linear. None specifies no decline, providing a sudden dropoff effect. Linear specifies a gradual decline, providing a dropoff effect that decreases linearly. Select None or Linear. (Default is Linear.)
Dropoff Distance
Specifies the sculpt sphere’s range of influence. Note that Dropoff Type specifies how the range of influence can decline. The effect can depend on the deformer’s Mode attribute setting. For instance, if Mode is set to Project, see "Project mode" on page 160. Deformer Attributes
Envelope
CHARACTER SETUP 164
Specifies the deformation scale factor. Values can vary from 0 to 1. Default is 1.
PART 2
USING SCULPT DEFORMERS | 14 Deleting sculpt deformers Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Editing sculpt deformer sets For more information, see "Editing deformer set membership" on page 46.
Pruning sculpt deformer sets By pruning sculpt deformer sets, you can remove points from the set that are not presently being affected by the deformer. You can prune the deformer set to avoid unnecessary calculations for points that are not part of the deformation effect. To prune deformer set membership: 1
Select deformable objects whose currently unaffected points you want to prune from the deformation.
2
Select Deform > Prune Membership > Sculpt. Maya removes the deformable object’s points currently unaffected points from the sculpt deformer set.
DELETING SCULPT DEFORMERS To delete a sculpt deformer: 1
Select the sculpt deformer node.
2
Select Edit > Delete (default shortcut: Backspace key). The deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved.
DEFORMERS
CHARACTER SETUP 165
USING SCULPT DEFORMERS | 14 Deleting sculpt deformers
CHARACTER SETUP 166
PART 2
15
USING WIRE DEFORMERS Wire deformers are like the armatures used by sculptors to shape objects. With a wire deformer, you use one or more NURBS curves to change the shape of objects. For a quick example of creating a wire deformer, see "Quick start" on page 167.
Wire deformer providing subtle effects around character’s eyebrow
QUICK START This section shows you how to create a typical wire deformer as quickly as possible.
DEFORMERS
CHARACTER SETUP 167
USING WIRE DEFORMERS | 15 Quick start
In this example, you will deform a surface with an S-shaped curve, limiting the deformation region with a circle. To create a NURBS plane: Create a NURBS plane with Width 40, Length Ratio 1, Patches U 40, Patches V 40, and Degree Cubic. To create a curve for an influence wire: Draw an S-shaped curve on the center area of the plane. (Use the CV Curve Tool or EP Curve Tool.)
To create a circle for limiting the deformation region: Create a circle that surrounds the S-shaped curve on the plane.
CHARACTER SETUP 168
PART 2
USING WIRE DEFORMERS | 15 Quick start
You’ll use the circle to limit the deformation region. A curve that limits the deformation region is called a holder. To create the wire deformer: 1
Select Deform > Wire Tool.
2
In the Tool Settings window, click Holders on (default is off).
3
Close the Tool Settings window. In the workspace, note the cursor is now cross-shaped, indicating you are using the Wire Tool. Be sure you do the next four steps in exactly the following order:
4
Select the plane and press Enter.
5
Select the S-shaped curve, and press Enter.
6
Select the circle, and press Enter.
7
Finally, select nothing in the workspace, and press Enter. You can use as many holders as you like; selecting nothing tells Maya you are done selecting holders, and tells it to create the wire deformer. Maya now creates a wire deformer. You can now manipulate the S-shaped curve to create deformation effects. Note that only the region within the circle can be affected. To create deformations:
DEFORMERS
1
Select the S-shaped curve.
2
Move the S-shaped curve up.
CHARACTER SETUP 169
USING WIRE DEFORMERS | 15 Understanding wire deformers
The plane deforms upwards as if attracted to the S-curve. The wire deformer uses the S-shaped curve to influence the shape of the deformation, so this curve is called an influence wire. Meanwhile, because the circle is limiting the deformation region, it’s called a holder. 3
Rotate the S-shaped curve to get a swirling “chakra” deformation effect.
UNDERSTANDING WIRE DEFORMERS Wire deformers enable you to change the shapes of deformable objects with one or more NURBS curves. In character setup, wire deformers are especially useful for setting up lip and eyebrow deformations. To create further wrinkling effects, you can also use the wrinkle deformer. Wire deformers can also be useful for shaping NURBS or polygonal objects during modeling.
Influence wires and base wires The NURBS curves you use to create deformations are called influence wires, or simply wires. When you create a wire deformer, another curve, called a base wire, is created for each influence wire. The deformation effect provided by an influence wire is based on the difference between the influence wire and the base wire.
Holders Holders are curves that you can use to limit the deformation region. As with other curves, you can move, rotate, or scale holders. You can also edit a holder’s shape. Moving, rotating, scaling, or editing holders can change the deformation effect.
CHARACTER SETUP 170
PART 2
USING WIRE DEFORMERS | 15 Creating wire deformers
Wire dropoff locators Wire dropoff locators provide a way for you to create localized deformation effects along an influence curve.
Related MEL commands MEL commands related to wire deformers include the following: •
wire
•
wireContext
•
dropoffLocator
•
reorderDeformers For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a wire deformer can include the following: •
Wire deformer node, which is the algorithm node for the wire deformer (default name: wiren).
•
Base wire nodes for each influence wire (default names: influenceWireBaseWire, and influenceWireBaseWireShape).
•
A deformer set node (default name: wirenSet).
•
Wire dropoff locator shape nodes (default name: locatorShapen) for each wire dropoff locator.
•
Wires group nodes that parent influence wires and their base wires (default name: influenceWireWires)
•
Tweak node (default name: tweakn). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING WIRE DEFORMERS To create a wire deformer, you use the Wire Tool. The characteristics of the wire deformer you create depend on the Wire Tool’s tool settings. By default, the Wire Tool is set to create a wire deformer with holders. After you’ve set the Wire Tool’s tool settings, you can create wire deformers that include one or more influence wires, and one or more holders.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
DEFORMERS
CHARACTER SETUP 171
USING WIRE DEFORMERS | 15 Creating wire deformers
Specifying Wire Tool’s tool settings To specify tool settings: 1
Select Deform > Wire Tool ❒.
2
The Tool Settings window is displayed.
3
Set the Tool Defaults tab’s Wire Options as follows: Wire Options
Holders
Specifies whether you want to create a wire deformer with holders. Holders are curves that you can use to limit the deformation region. Click on or off. Default is off.
Envelope
Specifies the deformation scale factor. Use the slider to select a value between 0.0000 and 2.0000. A value of 0 specifies no deformation effect. Default is 1.0000.
Crossing Effect
Specifies the amplitude of the deformation effect where two of the deformer’s influence wires cross. Use the slider to select values from 0.0000 to 2.0000. Default is 0.0000, which specifies a smooth, not additive, effect.
Local Influence
Specifies the localization of the deformation effect of two or more influence wires. Use the slider to select values from 0.0000 to 2.0000. Default is 0.0000.
Dropoff Distance
Specifies the range of influence of each influence wire. Use the slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Deformation Order
Specifies the placement of the deformer node in the deformable object’s history. Placement selections include Default, Before, After, Split, or Parallel. Default typically places the deformer immediately upstream of the current final shape node. Before places the deformer immediately upstream of (before) the current final shape node. (Default and Before typically provide the same placement.) After places the deformer immediately downstream of (after) the current final shape node, and creates a new final shape node. Split splits the upstream deformation history into two separate deformation chains, providing two final shapes originating from the same deformable object. Parallel creates a final shape that blends the object’s current upstream history in parallel with the new deformer. Select Default, Before, After, Split, or Parallel. Specifies whether the deformer set will be in a partition. If a deformer set is in a partition, the points in the set cannot be in any other set. The result is that only the deformer you are about to create can influence the points. Check on or off (default is off). If on, the Exclusive Partition and Existing Partitions options become available.
Exclusive
Exclusive Partition
Specifies the name of the partition. (Default name is deformPartition.) Available if Exclusive is on.
Existing Partitions
Specifies an existing partition. (Default existing partition is characterPartition.) Available if Exclusive is on. •
Click Reset Tool to reset to the default tool settings. or
•
CHARACTER SETUP 172
Click Close to close the Tool Settings window.
PART 2
USING WIRE DEFORMERS | 15 Creating wire deformers Note that you can change the tool settings whenever you are using the Wire Tool by selecting Window > General Editors > Tool Settings.
Creating a wire deformer without holders You can create a wire deformer without holders or with holders. Holders are curves that you can use to limit the deformation region. The workflow for creating wire deformers without holders is shorter than the workflow for creating wire deformers with holders. Further, you can limit the deformation region by adding holders later, or by using a variety of other methods (see "Limiting the wire deformation region" on page 182). To create a wire deformer without holders: 1
Be sure the Wire Tool’s tool setting for Holders is off (the default is off).
2
Create the curve(s) you want to use as influence wire(s). For best results, place them on or near the deformable object(s).
3
Select Deform > Wire Tool. The cursor changes to a crosshair icon, and the Wire Tool icon is displayed in the Tool Box. You are now ready to use the Wire Tool to create a wire deformer with the Wire Tool’s current tool settings. The prompt line displays information to lead you through the process of creating a wire deformer.
4
Select the object(s) you want to deform, and press the Enter key. Now you are ready to select the one or more curves you want to use as wires.
5
Select all of the curves you want to use as influence wires. If the only curves on the object’s surface are the curves you want to use as influence wires, drag the cursor over all the curves on the object. The Wire Tool knows to select only the curves.
6
Press the Enter key. A wire deformer is created based on the Wire Tool’s tool settings. The curves you selected are now influence wires that you can use to deform the object(s) you selected. A base wire is created for each influence wire. The base wire(s) are listed in the Outliner. By default, they are not shown in the scene, but they do influence the deformation effect. The wire node calculates the deformation effect based on differences between each influence wire and its base wire. A deformer set is created. The deformer set includes all the deformable object’s points that can be influenced by the wire deformer. To create deformation effects:
1
Move, rotate, or scale the influence wire(s).
2
Edit the wire deformer’s channels. For more information on creating and editing deformation effects, see "Editing wire deformation effects" on page 175.
DEFORMERS
CHARACTER SETUP 173
USING WIRE DEFORMERS | 15 Creating wire deformers
Creating a wire deformer with holders Creating a wire deformer with holders is similar to creating a wire deformer without holders. The main difference is that after you select the curves you want to use as influence wires, you then select the other curves you want to use as holders for each influence wire. Consequently, the process for creating a wire deformer with holders can be somewhat longer than the process for creating a wire deformer without holders. Keep in mind that you can assign holders to each of the wire deformer’s influence wires, and you can assign a holder to more than one influence wire. After you create the wire deformer, you can add or remove holders. To create a wire deformer with holders: 1
Specify the Wire Tool’s tool settings so that Holders is on (this is the default).
2
On or near the deformable object(s), create the curve(s) you want to use as influence wire(s).
3
On or near the deformable object(s), create the curve(s) you want to use as holders.
4
Select Deform > Wire Tool. The cursor changes to a cross-hair, and the Wire Tool icon is displayed in theTool Box. You are now ready to use the Wire Tool to create a wire deformer with the Wire Tool’s current tool settings. Note that the prompt line displays information to lead you through the process of creating a wire deformer.
5
Select the object(s) you want to deform, and press the Enter key.
6
Select a curve that you want to use as an influence wire, and press the Enter key.
7
For each holder that you want to assign to the influence wire, select a holder curve, and press Enter. If you don’t want to assign any holders to the influence wire, clear the selection list by selecting empty space, and then press Enter.
8
When you’re done selecting holders for the influence wire, clear the selection list by selecting empty space, and then press Enter.
9
For each influence wire you want to create, repeat steps 6 through 8.
Assigning a holder to more than one influence wire You can assign a holder to more than one influence wire. To do so, pick a curve that will be an influence wire, press Enter, then select the curve that will be a holder, and press Enter again. Pick the next curve that will be an influence wire, press Enter, then select the same holder curve, and press Enter again. Continue this process for each influence wire curve that will be assigned the holder curve. 10 When you are ready to create the wire deformer, clear the selection list by selecting empty space, and then press Enter. A wire deformer is created based on the Wire Tool’s tool settings. The curves you selected are now influence wires that you can use to deform the object(s) you selected.
CHARACTER SETUP 174
PART 2
USING WIRE DEFORMERS | 15 Editing wire deformation effects A base wire is created for each influence wire. The base wire(s) are listed in the Outliner. By default, they are not shown in the scene, but they do influence the deformation effect. The wire node calculates the deformation effect based on differences between each influence wire and its base wire. A deformer set is created. The deformer set includes all the deformable object’s points that can be influenced by the wire deformer. To create deformation effects: 1
Move, rotate, or scale the influence wire(s).
2
Edit the wire deformer’s channels. For more information on creating and editing deformation effects, see the next section, "Editing wire deformation effects" on page 175.
EDITING WIRE DEFORMATION EFFECTS After you have created a wire deformer, you can edit a wire deformer’s effects as described in the following pages.
In case of no deformation effects If a wire deformer does not deform an object when you manipulate the influence wire(s), the influence wire curve(s) may not have been placed close enough to the object when you created the wire deformer. You can get deformation effects by moving the base wire(s).
Moving, rotating, and scaling influence wires You can create deformation effects by moving, rotating, or scaling the influence wires individually or as a group. You can move, rotate, or scale an influence wire in the same way that you would move, rotate, or scale any object in Maya.
Moving, rotating, and scaling deformable objects You can also create deformation effects by moving, rotating, or scaling the deformable object(s) through the influence wires. You can move, rotate, or scale a deformable object in the same way that you would move, rotate, or scale any object in Maya.
Editing the shape of influence wires You can create deformation effects by editing the influence wires. You edit the shape of the influence wires in the same way that you edit NURBS curves during modeling.
Moving, rotating, and scaling base wires You can move, rotate, or scale the base wires to create various deformation effects. The base wires are hidden by default. However, you can select them in the Outliner, display them, and then directly manipulate them.
DEFORMERS
CHARACTER SETUP 175
USING WIRE DEFORMERS | 15 Editing wire deformation effects Note that you cannot edit the shape of the base wires, though you can edit the shape of the influence wires.
Adding influence wires After you have created a wire deformer with one or more influence wires, you might decide you need more influence wires to get the effect you want. To add an influence wire: 1
Select the curves you want to add to the deformer.
2
Shift-click on any wire in the deformer to select the deformer to which you want add the curves as influence wires.
3
Select Deform > Edit Wire > Add. The selected curves become influence wires for the wire deformer.
Removing influence wires You can remove influence wires from a wire deformer. Note that removing all of a wire deformer’s influence wires also removes the wire deformer node from the deformed object’s history. To remove an influence wire: 1
Select the curves that you want to remove as influence wires.
2
Select Deform > Edit Wire > Remove.
3
The selected curves are no longer influence wires.
Controlling the effects of crossed influence wires If a wire deformer includes more than one influence wire, you can create some interesting deformation effects by positioning the wires so that they cross. When two wires cross, you can get an additive deformation effect where the wires cross. This is because both wires are influencing some of the same points.
Getting an additive effect where wires cross You can control to what extent the deformation effect is the sum of the influences of both wires by editing the wire deformer’s Crossing Effect attribute. The Crossing Effect attribute can have a value from 0 to 1. A value of 1 makes the total influence the sum of the influence of the two wires, creating an additive deformation effect where the wires cross. A value of 0 smooths out the deformation, so that there is no additive deformation effect where the wires cross. By default, Crossing Effect is 0, resulting in a smooth rather than an additive effect. You can edit Crossing Effect from the Channel Box or the Attribute Editor.
Localizing the influence of crossed wires at different distances If the wires are at different distances from the deformed object, you can control which wires influence the deformation effect more by editing the wire deformer’s Local Influence attribute. The Local Influence attribute controls how localized each wire’s influence is. The greater the Local Influence, the more the points closest each wire are influenced by the wire closest to them. You can edit Local Influence from the Channel Box or the Attribute Editor.
CHARACTER SETUP 176
PART 2
USING WIRE DEFORMERS | 15 Editing wire deformation effects
Resetting influence wires You can reset an influence wire so that it does not create deformation effects. By resetting an influence wire, you put the influence wire in the same position as the base wire. To reset influence wires 1
Select the influence wire(s) you want to reset.
2
Select Deform > Edit Wire > Reset.
Creating wires groups that parent influence wires to base wires After you create a wire deformer, by default the base wire will not move when you move the influence wire. Because the deformation effect is based on the relationship between the influence wire and the base wire, when you move the influence wire you get an effect that always originates from the base wire’s location. This is useful for creating effects that always originate from the same place. However, you can have the base wire move with the influence wire. To create a wires group: 1
Select the influence wire.
2
Select Deform > Edit Wire > Parent Base Wire. A wires group is created that includes the influence wire and the base wire. The wires group is named after the influence wire and listed in the Outliner.
Editing wire deformer channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a wire deformer’s channels. To edit all attributes, use the Attribute Editor (see "Editing wire deformer attributes" on page 178). To edit channels with the Channel Box: 1
Select a wire deformer node (default name: wiren). One quick way to select the wire deformer node is to select the object being deformed, and then select the wire deformer node in its history from the Channel Box (under INPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Values range from 0 to 1. Default is 1.
Crossing Effect
Specifies the amplitude of the deformation effect when two influence wires cross. Values range from 0 (smooth effect) to 1 (additive effect). Default is 0.
Tension
Specifies the influence wire’s attraction strength. Values specify how strongly the influence wire can attract the deformable object’s points away from the base wire. The attraction strength therefore expresses a tension between the influence wire and the base wire. Values range from -10 (weakest) to 10 (strongest). Default is 1.
DEFORMERS
CHARACTER SETUP 177
USING WIRE DEFORMERS | 15 Editing wire deformation effects Local Influence
Specifies the localization of the deformation effect of two or more influence wires. Values range from 0 and 1, with 1 specifying greatest localization. Default is 0.
Rotation
Specifies an effect that varies between shearing and tangency. Values range from 0 and 1, with 0 indicating maximum shearing and 1 maximum tangency.
Dropoff Distance[n]
Specifies the range of influence for each influence wire. The value of n indicates which influence wire. As the value of Dropoff Distance increases, more points within the deformation region are influenced by the influence wire. Default is 1.
Scale[n]
Specifies the scale of influence for each influence wire. The value of n indicates which influence wire. Scale controls the strength of an influence wire’s attraction to points in the deformation region. Scale’s value has the effect of scaling a surface radially around an influence wire. The scaling effect can be gradually reduced by the Dropoff Distance.
Locator Envelope[n]
Specifies the deformation scale factor for a wire dropoff locator. The value of n indicates which wire dropoff locator. Default is 1. These channels are only displayed if you have created wire dropoff locators (see "Using wire dropoff locators for localized deformation effects" on page 180).
Wire Locator Twist[n]
Specifies localized twisting effects around a wire dropoff locator. The value of n indicates which wire dropoff locator. As you increase or decrease the value, you see a twisting of the region of the surface influenced by the wire dropoff locator. In character setup, changing Wire Locator Twist can provide subtle effects for lip and eyebrow action. Default is 0, which specifies no twisting effects. These channels are displayed only if you have created wire dropoff locators (see "Using wire dropoff locators for localized deformation effects" on page 180). 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key will give you finer control, and pressing the Shift key will give you coarser control.
Editing wire deformer attributes You can edit all of a wire deformer’s attributes with the Attribute Editor. To edit attributes with the Attribute Editor: 1
Select the wire deformer node (default name: wiren).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Parameters, Scale, Dropoff Distance, Locators, Deformer Attributes, Node Behavior, and Extra Attributes. Parameters
Rotation
CHARACTER SETUP 178
Specifies an effect that varies between shearing and tangency. Values range from 0 and 1, with 0 indicating maximum shearing and 1 maximum tangency. Use the slider to select values from 0.000 to 1.000. Default is 1.000.
PART 2
USING WIRE DEFORMERS | 15 Editing wire deformation effects Crossing Effect
Specifies the amplitude of the deformation effect when two influence wires cross. Values can vary from 0 (smooth effect) to 1 (additive effect). Default is 0. Use the slider to select values from 0.000 to 1.000. Default is 0.000.
Local Influence
Specifies the localization of the deformation effect of two or more influence wires. Values range from 0 and 1, with 1 specifying greatest localization. Use the slider to select values from 0.000 to 1.000. Default is 0.000.
Tension
Specifies the influence wire’s attraction strength. Values specify how strongly the influence wire can attract the deformable object’s points away from the base wire. The attraction strength is therefore expresses a tension between the influence wire and the base wire. Use the slider to select values from -10.000 to 10.000. Default is 1.000.
Freeze Geometry
Specifies whether to freeze the wire deformation effect. If frozen (checked on), components (for example, CVs) of objects being deformed that are under the influence of the influence wire become fixed and affected only by the influence wire, even if you transform (move, rotate, or scale) the object or the base wire. The reason you would want to freeze geometry is to improve performance. Note that you should not move geometry objects relative to the base wire with freeze geometry checked on. Check on or off. Default is off. Scale
curven
Specifies the scale of influence for each influence wire. The value of n indicates which influence wire. Default is 1.00. Dropoff Distance
curven
Specifies the range of influence for each influence wire. The value of n indicates which influence wire. Default is 1.00. Locators If you have created any wire dropoff locators, this section lists the attributes for each wire dropoff locator on each influence wire.
curveShapen>locatorn
Identifies the influence wire shape (default name: curveShapen) and the wire dropoff locators (default name: locatorn) on that wire. The locators are numbered in the order that they were created, starting with 1. Param[n]
Specifies the location of the wire dropoff locator on the influence wire curve. The value of n indicates which wire dropoff locator, numbered in the order created, starting with 0. The value is in terms of the curve’s U parameter.
Percent[n]
Specifies the local effect the locator has on the influence wire’s dropoff. The value of n indicates which wire dropoff locator, numbered in the order created, starting from 0. By default, the influence wire has two implicit locators at each end with a Percent of 1.000; other locators have an effect relative to the Percent of those locators. Use the slider to select values from 0.000 to 1.000. Default is 1.000.
Twist[n]
Specifies localized twisting effects around a wire dropoff locator. The value of n indicates which wire dropoff locator, numbered in the order created, starting with 0. As you increase or decrease the value, you see a twisting of the region of the surface influenced by the wire dropoff locator. In character setup, changing Twist can
DEFORMERS
CHARACTER SETUP 179
USING WIRE DEFORMERS | 15 Editing wire deformation effects provide subtle effects for lip and eyebrow action. Default is 0, which specifies no twisting effects. (Note that this attribute corresponds to the Wire Dropoff Twist channel.) Envelope[n]
Specifies the deformation scale factor for a wire dropoff locator. The value of n indicates which wire dropoff locator, numbered in the order created, starting with 0. Default is 1. (Note that this attribute corresponds to the Locator Envelope channel.) Deformer Attributes Specifies the deformation scale factor. Values range from 0.000 to 1.000.
Envelope
Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Using wire dropoff locators for localized deformation effects You can vary the deformation effect at specific points along an influence wire by using wire dropoff locators. Wire dropoff locators are locators that you place along an influence wire. Each locator has attributes that you can then edit to create localized deformation effects. For each influence wire, you can add as many locators as you like. To add a wire dropoff locator, you identify a curve point on the influence wire curve. You then specify that the point is a wire dropoff locator. To add a wire dropoff locator: 1
To select a curve point on the influence wire, right-click the influence wire curve and select Curve Point from the marking menu.
2
Click the influence wire curve roughly where you would like to put the wire dropoff locator. The curve point is displayed as a small yellow box.
3
Drag along the curve to adjust the point’s position on the curve. As you drag, you move the curve point. The curve point’s position is defined in terms of the curve’s U parameter. Now you need to specify the curve point as a wire dropoff locator.
4
Select Deform > Wire Dropoff Locator. The curve point is now a wire dropoff locator.
5
To add more wire dropoff locators, repeat steps 2 through 5. To move a wire dropoff locator:
1
Be sure you are in components selection mode, with the parameter points selection mask on.
2
Select the wire dropoff locator shape node.
3
Select the Move Tool.
4
You can now move the dropoff locator along the influence wire curve.
CHARACTER SETUP 180
PART 2
USING WIRE DEFORMERS | 15 Editing wire deformation effects To edit a wire dropoff locator’s channels: 1
Select the wire dropoff locator shape node (default name: locatorShapen).
2
In the Channel Box, the following channels are listed:
Percent
Specifies the local effect the locator has on the influence wire’s dropoff. By default, the influence wire has two implicit locators at each end with a Percent of 1; other locators have an effect relative to the Percent of those locators.
Param
Specifies the location of the wire dropoff locator on the influence wire curve. The value is in terms of the curve’s U parameter. 3
Note the wire deformer also includes Locator Envelope and Wire Locator Twist channels for each wire dropoff locator (see "Editing wire deformer channels" on page 177). These channels correspond to the wire deformer’s Envelope and Twist attributes (see "Editing wire deformer attributes" on page 178; refer to the Attribute Editor’s Locators section). To edit a wire dropoff locator’s attributes:
1
Select a wire dropoff locator (default name: locatorShapen).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Dropoff Locator Attributes, Render Stats, Object Display, Node Behavior, and Extra Attributes. Dropoff Locator Attributes Along with the Percent, Param, and Local Position attributes listed here, two other attributes are available to control the deformation effects of a wire dropoff locator: the Twist attribute and the Envelope attribute. These attributes are available as attributes of the wire deformer. For more information, see "Editing wire deformer attributes" on page 178; refer to the Attribute Editor’s Locator section.
Percent
Specifies the local effect the locator has on the influence wire’s dropoff. By default, the influence wire has two implicit locators at each end with a Percent of 1.000; other locators have an effect relative to the Percent of those locators. Use the slider to select values from 0.000 to 1.000. Default is 1.000. Note that this attribute is also available as an attribute of the wire deformer. (See "Editing wire deformer attributes" on page 178; refer to the Attribute Editor’s Locators section.)
Param
Specifies the location of the wire dropoff locator on the influence wire curve. The value is in terms of the curve’s U parameter. Note that this attribute is also available as an attribute of the wire deformer. (See "Editing wire deformer attributes" on page 178; refer to the Attribute Editor’s Locator section.)
Local Position
Specifies the local position of the wire dropoff locator on the influence wire curve. Render Stats This section includes settings for rendering. For more information about rendering, see Using Maya: Rendering. Object Display This section includes settings for the dropoff locator’s visibility (the Visibility attribute) and templating (the Template attribute).
DEFORMERS
CHARACTER SETUP 181
USING WIRE DEFORMERS | 15 Editing wire deformation effects Node Behavior See "Editing node behavior to improve performance" on page 54. Extra Attributes (No extra attributes by default.)
Smoothing jagged effects In certain situations, a wire deformer can produce an undesirable jagged effect along the surface of an object. An influence wire placed diagonally along a NURBS surface can create a jagged effect if the spacing between the surface’s control vertices is too large for the value of the wire deformer’s dropoff distance attribute. In general, the spacing of a deformable object’s points should be at least twice as dense as the Dropoff Distance. To smooth jagged effects: •
Increase the wire deformer’s Dropoff Distance attribute (see "Editing wire deformer attributes" on page 178). or
•
Add more points to the object’s surface. For example, if the object is a NURBS surface, increase the number of control vertices.
Limiting the wire deformation region To limit the deformation region, you can use a wire deformer with holders, edit the deformer set, or prune the deformer set. Holders are curves you can use to limit the deformation region. To create a wire deformer with holders, see "Creating a wire deformer with holders" on page 174. To add or remove holders, see "Adding and removing holders" on page 182. To edit how the deformation region is limited by holders, you can move, rotate, or scale the holders. To move, rotate, or scale holders, see "Moving, rotating, scaling holders" on page 183. You can also edit the shape of holders. To edit the shape of holders, see "Editing the shape of holders" on page 183. A wire deformer set includes the points of a deformable object that are influenced by a wire deformer. To limit the wire deformation region, you can edit which points are in the wire deformer set. To edit a deformer set, see "Editing wire deformer sets" on page 183. You can also prune all of the points that are not currently being deformed from the set. Pruning the set is a quick way to limit the deformation region because you can do it as you interact with the influence wires. To prune a deformer set, see "Pruning wire deformer sets" on page 183.
Adding and removing holders Holders are curves that limit the deformation region. Adding or removing a holder can sometimes lead to unexpected changes in the deformation region. You can remedy these effects by editing and pruning the wire deformer set.
CHARACTER SETUP 182
PART 2
USING WIRE DEFORMERS | 15 Deleting wire deformers To add holders: 1
Select the curves you want to add to the deformer as holders.
2
Shift-click on any wire in the deformer to select the deformer to which you want add the curves as holders.
3
Select Deform > Edit Wire > Add Holder. The selected curves become holders for the wire deformer. To remove holders:
1
Select the curves that you want to remove as holders.
2
Select Deform > Edit Wire > Remove. The selected curves are no longer holders.
Moving, rotating, scaling holders Moving, rotating, or scaling holders can change the deformation effect and the deformation region. You can move, rotate, or scale a holder in the same way that you would move, rotate, or scale any object in Maya.
Editing the shape of holders Editing the shape of holders can change the deformation effect and the deformation region. You edit the shape of holders in the same way that you edit NURBS curves during modeling.
Editing wire deformer sets For more information, see "Editing deformer set membership" on page 46.
Pruning wire deformer sets Pruning is useful for quickly limiting the deformation region as you manipulate influence wires. To prune deformer set membership: 1
Select a wire deformer node.
2
Move the influence wire(s) so that only those points you want to keep in the deformer set are being affected.
3
Select Deform > Prune Membership > Wire. The undeformed points are removed from the deformer set.
DELETING WIRE DEFORMERS To delete a wire deformer: 1
Select the wire deformer node.
2
Select Edit > Delete (default shortcut: Backspace key). The deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved.
DEFORMERS
CHARACTER SETUP 183
USING WIRE DEFORMERS | 15 Deleting wire deformers
CHARACTER SETUP 184
PART 2
16
USING WRINKLE DEFORMERS A wrinkle deformer combines a cluster deformer with one or more wire deformers. Wrinkle deformers are useful for creating detailed wrinkling effects.
Wrinkle deformer consisting of cluster deformer controlling wire deformers
Wrinkle deformer acting on character’s mouth
UNDERSTANDING WRINKLE DEFORMERS A wrinkle deformer provides a cluster of wire deformers. You can create deformation effects by controlling the entire cluster of wire deformers, or by manipulating individual influence wires.
DEFORMERS
CHARACTER SETUP 185
USING WRINKLE DEFORMERS | 16 Understanding wrinkle deformers Because a wrinkle deformer is a combination of a cluster deformer and one or more wire deformers, animating a wrinkle deformer involves animating the attributes of the cluster deformer and the wrinkle deformers rather than the attributes of the wrinkle deformer. For wrinkling a single NURBS surface, you can use three types of wrinkle deformers: radial wrinkles, tangential wrinkles, and custom wrinkles.
Radial wrinkle deformers Radial wrinkle deformers combine influence wires that branch from a single point, like spokes on a wheel. A radial wrinkle deformer can only deform a single NURBS surface.
Tangential wrinkle deformers Tangential wrinkle deformers combine influence wires that are roughly parallel. A tangential wrinkle deformer can only deform a single NURBS surface.
Custom wrinkle deformers Custom wrinkle deformers combine influence wires you have created in the fashion that best suits the effect you would like to make. A custom wrinkle deformer can deform a single NURBS surface or many NURBS surfaces. A custom wrinkle deformer can also deform polygonal surfaces and lattices. In short, a custom wrinkle deform can deform any deformable object.
Related MEL commands MEL commands related to wrinkle deformers include the following: •
wrinkle
•
wrinkleContext For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a wrinkle deformer can include the following: •
Cluster deformer node, which is the algorithm node for the wire deformer (default name: clustern).
•
Cluster handle node (default name: clusterHandlen).
•
Wire deformer nodes, which are the algorithm nodes for the wire deformer (default name: wiren).
•
Tweak node (default name: tweakn).
•
Base wire nodes for each influence wire (default names: influenceWireBaseWire and influenceWireBaseWireShape).
•
Cluster deformer set node (default name: clusternSet).
•
Wire deformer set nodes (default names: wirenSet).
•
Wire dropoff locator shape nodes (default name: locatorShapen) for each wire dropoff locator.
CHARACTER SETUP 186
PART 2
USING WRINKLE DEFORMERS | 16 Creating wrinkle deformers •
Wires group nodes that parent influence wires and their base wires (default name: influenceWireWires). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING WRINKLE DEFORMERS To create a wrinkle deformer, you use the Wrinkle Tool. The characteristics of the wrinkle deformer you create depend on the Wrinkle Tool’s tool settings.
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later.
Specifying Wrinkle Tool’s tool settings To specify tool settings: 1
Select Deform > Wrinkle Tool ❒.
2
The Tool Settings window is displayed.
3
Set the Tool Defaults tab’s Wrinkle Options as follows: Wrinkle Options
Type
Specifies the type of wrinkle deformer. Select Tangential, Radial, or Custom. Default is Radial.
Amount
Specifies the number of parent influence wires in the wrinkle deformer. (The total number of influence wires can also include child influence wires specified by Radial Branch Amount and Radial Branch Depth). Use the slider to select value between 0 and 20. Default is 3.
Thickness
Specifies the surface dropoff, which is the area influenced by each influence wire. Use the slider to select values from 0.0000 to 2.0000. Default is 1.0000.
Randomness
Specifies how close the wrinkle deformer conforms to the specified Amount, Intensity, Radial Branch Amount, and Radial Branch Depth. Use the slider to select values from 0.0000 to 1.0000. Default is 0.2000.
Intensity
Specifies the sharpness of the creases created by the influence wires. The minimum intensity (0) specifies smooth creases. The maximum intensity (1) specifies sharp, steep creases. Use slider to select values from 0.0000 to 1.0000. Default is 0.5000.
Radial Branch Amount
Specifies the number of child influence wires that branch from each parent influence wire. Applies to radial wrinkle deformers only. Use slider to select values from 0 to 10. Default is 2.
DEFORMERS
CHARACTER SETUP 187
USING WRINKLE DEFORMERS | 16 Editing wrinkle deformation effects Radial Branch Depth
Specifies the depth of the influence wire hierarchy, which is the number of levels of child influence wires that branch from each parent influence wire. Increasing the Radial Branch Depth exponentially increases the total number of influence wires. Applies to radial wrinkle deformers only. Use slider to select values from 0 to 4. Default is 0. •
Click Reset Tool to reset to default options. or
•
Click Close to close the Tool Settings window. Note that you can change the tool settings whenever you are using the Wire Tool by selecting Windows > General Editors > Tool Settings.
Creating a wrinkle deformer To create a wrinkle deformer: 1
Select one or more deformable objects. Typically, the deformable object is a NURBS surface.
2
Select Deform > Wrinkle Tool. A UV region of the surface is highlighted, allowing you to shape a wire cluster for deforming the surface.
3
Using the middle mouse button, shape the UV region. Scale it using the circle in the middle of each side, rotate it using the corners, and move it using the dot in the middle of the UV region.
4
Press Enter when the UV region fits the area of the deformable object. The “C” icon is the wrinkle deformer’s cluster deformer handle. To create wrinkle deformation effects:
1
Move, rotate, or scale the cluster deformer handle (the “C” icon).
2
Move, rotate, or scale the influence wires. For more information on creating and editing deformation effects, see "Editing wrinkle deformation effects" on page 188.
EDITING WRINKLE DEFORMATION EFFECTS After you have created a wrinkle deformer, you can edit the deformer’s effects as described in the following topics:
Manipulating the wrinkle deformer’s cluster deformer handle The techniques for manipulating a wrinkle deformer’s cluster deformer handle (the C icon) are the same as the techniques for manipulating a regular cluster deformer handle. For information on manipulating cluster deformer handles, see "Manipulating the cluster handle (C icon)" on page 89.
CHARACTER SETUP 188
PART 2
USING WRINKLE DEFORMERS | 16 Deleting wrinkle deformers
Moving, rotating, and scaling the influence wires To move, rotate, or scale influence wires: 1
In the Outliner, select the influence wires you want to move, rotate, or scale. The influence wires are listed under the wrinkle deformer’s cluster deformer handle.
2
Select Display > Show > Show Selection. Now you can manipulate each influence wire in the same way that you would if working with a wire deformer. For example, you can even move the base wires or add wire dropoff locators.
Editing the wrinkle deformer’s cluster deformer The techniques for editing a wrinkle deformer’s cluster deformer are the same as the techniques for editing a regular cluster deformer. For information on editing cluster deformers, see "Editing cluster deformation effects" on page 89.
Editing the wrinkle deformer’s wire deformers The techniques for editing a wrinkle deformer’s wire deformers are the same as the techniques for editing regular wire deformers. For information on editing wire deformers, see "Editing wire deformation effects" on page 175.
DELETING WRINKLE DEFORMERS To delete a wrinkle deformer: 1
Select the wrinkle deformer’s cluster deformer node.
2
Select Edit > Delete (default shortcut: Backspace key). The deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved.
DEFORMERS
CHARACTER SETUP 189
USING WRINKLE DEFORMERS | 16 Deleting wrinkle deformers
CHARACTER SETUP 190
PART 2
17
USING WRAP DEFORMERS With wrap deformers, you can shape deformable objects with NURBS or polygonal objects. The shapes of the NURBS or polygonal objects you use provide the shapes of the deformation. If you’d like to explore some examples now, see "Examples" on page 201. Cone and cube acting as wrap influence objects to deform head with wrap deformer
Cone wrap influence object
Cube wrap influence object
UNDERSTANDING WRAP DEFORMERS A wrap deformer can deform deformable objects with NURBS surfaces, NURBS curves, or polygonal surfaces (meshes).
Deformable objects A deformable object is any object whose structure is defined by NURBS control vertices (CVs), polygonal vertices, or lattice points. NURBS curves, NURBS surfaces, polygonal surfaces (meshes), and the lattices of lattice deformers are all deformable objects. DEFORMERS
CHARACTER SETUP 191
USING WRAP DEFORMERS | 17 Creating wrap deformers
Wrap influence objects and wrap base objects A wrap influence object is a NURBS or polygonal object being used by a wrap deformer (the wrap deformer algorithm node) to deform an object. The shape and the transformations of the wrap influence objects and their points provide the shape of the deformation. When you create a wrap influence object, Maya makes a copy of the influence object and uses it as a base shape for the deformation. Any difference in position, orientation, or shape between the base shape and the wrap influence object results in a deformation of the surface being influenced by the wrap deformer. A wrap deformer can include one or more influence objects. You’ll often use several wrap influence objects to create deformation effects based on the competing influences of the objects. You can influence one or more deformable objects with the same wrap influence objects. When you create a wrap deformer, Maya creates a wrap deformer node for each deformable object. Note that wrap influence objects are themselves deformable objects. You can deform them with other deformers, or use them with smooth or rigid skinning.
Dependency graph nodes The dependency graph nodes for a wrap deformer can include the following: •
Wrap deformer algorithm node, created for each object being deformed (default name: wrapn)
•
Wrap influence object node, a shape node that provides the shape for wrap influence objects (default name example: nurbsObjectName).
•
Wrap base object node, a shape node for each wrap influence object’s base shape (default name: wrapInfluenceObjectBase)
•
Tweak node (default name: tweakn). The tweak node provides a way for Maya to carry out point tweaking on the deformable object before any deformation or skinning effects are carried out. (This node is created when you create the first deformation node that affects a given deformable object.) For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING WRAP DEFORMERS Creating a wrap deformer includes creating the objects you want to use as wrap influence objects, setting creation options, and then creating the wrap deformer.
CHARACTER SETUP 192
PART 2
USING WRAP DEFORMERS | 17 Creating wrap deformers
Avoid changing number of object points after you create deformers You should avoid changing the number of a deformable object’s points (for example, CVs, vertices, or lattice points) after you create a deformer. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the deformable object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later. You should also avoid changing the number of a wrap influence object’s points (CVs or vertices) after you create a wrap deformer.
Creating objects to use as wrap influence objects To create objects to use as wrap influence objects: 1
Model one or more NURBS surfaces, NURBS curves, or polygonal surfaces that you want to use as wrap influence objects. Note that the shape and distribution of CVs or vertices can affect the wrap deformation effect. Typically, you would want to have fewer points (CVs, for example) in the influence object(s) than in the objects you want to deform.
2
Position the object or objects that you want to use as wrap influence objects. Place them around the object(s) you want to deform so that they can influence the object(s).
3
If you are going to use more than one object as a wrap influence object, group those objects together now. You must group all those objects together before you create the wrap deformer. However, note that you can also add wrap influence objects after you have created a wrap deformer (see "Adding and removing wrap influence objects" on page 200).
Rendering wrap influence objects If you want to render a wrap influence object, be sure that you first turn on the object’s Primary Visibility (in the Attribute Editor’s Render Stats section). When you tell Maya to use some object as a wrap influence object, Maya turns off the Primary Visibility attribute because typically you would not want to render a wrap influence object. However, in some situations, you might want to render the wrap influence object. For example, you might use a cloth garment as a wrap influence object, and then wish to render both the action of the garment and the wrap deformer’s effects.
Setting creation options To set creation options: 1
If you also want to create a deformer now, select the object(s) you want to deform.
2
Select Deform > Create Wrap ❒. The Create Wrap Deformer Options window is displayed.
3
DEFORMERS
Click the Basic and Advanced tabs to set the creation options.
CHARACTER SETUP 193
USING WRAP DEFORMERS | 17 Creating wrap deformers Basic Weight Threshold
Specifies the influence of the wrap influence objects’ shapes based on the proximity of their components to the objects being deformed. Depending on the point density (for example, the number of CVs) of the wrap influence objects, changing the Weight Threshold can change the overall smoothness of the deformation effect. Values range from 0.000 (smooth) to 1.000 (sharp). Use the slider to select values from 0.000 to 1.000. Default is 0.000.
Limit Influence Area
Click Use Max Distance on to set the Max Distance. Specifies the influence area of wrap influence object points. By limiting the influence area with Max Distance, you can limit how much memory Maya requires to perform the deformation. The less memory required, the better the performance. Using Max Distance is especially useful when you are working with high-resolution wrap influence objects.
Max Distance
Max Distance’s value is in terms of Maya’s linear units, which are by default centimeters (select Options > General Preferences; click Units tab). The default for Max Distance is 0, which provides the default performance of the wrap deformer. The default value of 0 does not specify no influence area. A value of 0 specifies that each point has an infinite influence area, with the influence area constrained by the Weight Threshold attribute. However, a Max Distance setting such as 0.1 would greatly limit the influence area to within a distance of 0.1 units from each point. Such a setting would require less memory than 0 or a setting greater than 0.1. Note that Weight Threshold takes effect within the influence area indicated by Max Distance. Maya allocates memory for the wrap deformer when it is created. You can change Max Distance after you create the wrap deformer. That can also improve performance, but for best results try to set the desired value as a creation option. Of course, deciding on the best Max Distance value may require some experimentation. In general, for best performance, you’ll want to try minimize Max Distance to some value greater than 0. Note that setting Max Distance to 0 would be better than setting it to a relatively large number (for example, 30), and then lowering the Weight Threshold as desired. This is because a relatively large number will cause more memory allocation than the default setting of 0, even though 0 specifies an infinite influence area. To find the best value, start with 0 or a very small value, and then work up towards the desired value. Advanced See "Editing advanced deformer creation options" on page 52. •
Click Create to create a wrap deformer. or
•
Click Save to save creation options without creating a wrap deformer. or
•
Click Reset to reset to default creation options. or
•
CHARACTER SETUP 194
Click Close to close the window.
PART 2
USING WRAP DEFORMERS | 17 Editing wrap deformation effects
Creating a wrap deformer Before you create a wrap deformer, you need to create the objects you want to use as wrap influence objects. (For more information, see the previous section.) Unlike most other deformers, wrap deformers do not have any creation options. You can create wrap deformers immediately without having to consider the default creation options. Note that the time required to create a wrap deformer can vary depending on the resolution of the wrap influence object(s). The resolution can also affect the deformation calculation time as you manipulate the wrap deformer. To create a wrap deformer: 1
Select the object(s) you want to deform.
2
Select the previously created object or group of objects you want to use as wrap influence objects. For more information on creating wrap influence objects, see "Creating objects to use as wrap influence objects" on page 193.
3
Select Deform > Create Wrap. Maya creates a wrap deformer node for each object you want to deform. Maya also creates wrap base objects for each wrap influence object. The Outliner lists the wrap base objects, which are hidden by default. Note that if you are using more than one influence object and have therefore grouped them together, the base objects are placed in the same group as the influence objects. The creation time can vary, depending on the number and resolution of the deformable objects and wrap influence objects. To create deformation effects:
1
Move, rotate, or scale the wrap influence object(s).
2
Move the points of the wrap influence object(s).
3
Edit channels added to the wrap influence objects, and edit the channels of the wrap deformer(s). For more information on creating and editing deformation effects, see the next section.
EDITING WRAP DEFORMATION EFFECTS You can edit wrap deformation effects as described in the following topics:
Moving, rotating, or scaling wrap influence objects You can produce deformation effects by manipulating the wrap influence objects. If you have a group of influence objects, note that moving, rotating, or scaling the group node will not produce deformation effects because the base objects are in the same group as the influence objects. Maya provides deformation effects based on differences between the influence objects and the base objects. To produce deformation effects, you have to manipulate the influence objects individually. If you want to manipulate all the influence objects as a group, you can create a new group DEFORMERS
CHARACTER SETUP 195
USING WRAP DEFORMERS | 17 Editing wrap deformation effects that includes only the influence objects and not the base objects. Alternatively, you can remove the base objects from the already existing group. To do so, select the base object(s), and then select Edit > Unparent. To move, rotate, or scale a wrap influence object: 1
Select the wrap influence object.
2
Move, rotate, or scale the wrap influence object.
Manipulating wrap influence object points You can produce further deformation effects by manipulating the points of wrap influence objects. For example, you can create effects by moving one or more CVs of a NURBS wrap influence object, or by rotating or scaling several CVs. To edit by manipulating wrap influence object points: 1
Select points (CVs or vertices) of the wrap influence object.
2
Move, rotate, or scale the vertices.
Moving, rotating, or scaling deformed object You can produce deformation effects by manipulating the deformed object in the vicinity of the wrap influence object(s). To move, rotate, or scale the deformed object: 1
Select the deformed object.
2
Move, rotate, or scale the deformed object.
Editing NURBS wrap influence object channels NURBS curves or surfaces acting as wrap influence objects get two attributes added to them: the Dropoff and Wrap Samples attributes. The most convenient way to edit these channels is to use the Channel Box, but these attributes are also listed by the wrap influence object’s Attribute Editor, under the Extra Attributes tab. To edit channels with the Channel Box: 1
Select the NURBS curve or surface acting as a wrap influence object. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Dropoff
CHARACTER SETUP 196
In the Channel Box, the following channels are included: Specifies how rapidly the wrap influence object’s influence decreases with distance. The greater the value, the more rapid the decrease in influence with distance, and the less the extent of the object’s influence. The lower the value, the further the influence and the greater the extent of the object’s influence. Varying the Dropoff value is particularly useful when you want to vary the influence of several wrap influence objects. Values range from 0 (no dropoff, maximum extent of influence) to 20 (rapid dropoff, minimal extent of influence). Default is 4.
PART 2
USING WRAP DEFORMERS | 17 Editing wrap deformation effects Specifies the number of samples of the wrap influence object’s shape the wrap algorithm uses to evaluate the object’s shape. The greater the value, the more the deformation reflects the resolution of the wrap influence object. Default is 10. You can specify values greater than 10, but more than 10 may not be necessary for good results, and the greater the number, the more calculation time required.
Wrap Samples
3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing polygonal wrap influence object channels Polygonal surfaces acting as wrap influence objects get three attributes added to them: the Dropoff, Smoothness, and Infl Type attributes. The most convenient way to edit these channels is with the Channel Box, but these attributes are also listed by the wrap influence object’s Attribute Editor, under the Extra Attributes tab. To edit channels with the Channel Box: 1
Select the polygonal surface acting as a wrap influence object. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control.)
2
In the Channel Box, the following channels are included:
Dropoff
Specifies how rapidly the wrap influence object’s influence decreases with distance. The greater the value, the more rapid the decrease in influence with distance, and the lesser the extent of the object’s influence. The lower the value, the further the influence, and the greater the extent of the object’s influence. Varying the Dropoff value is particularly useful when you want to vary the influence of several wrap influence objects. Values can range from 0 (no dropoff, maximum extent of influence) to 20 (rapid dropoff, minimal extent of influence). Default is 4.
Smoothness
Specifies how much the deformation effect accurately reflects or smooths over the faces of the wrap influence object. Useful when a low-resolution wrap influence object is deforming a high-resolution object. Default is 0.000.
Infl Type
Specifies whether the deformation takes place based on the wrap influence object’s faces or vertices. 1 specifies vertices, 2 specifies faces. Default is 2. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing wrap deformer channels To edit channels with the Channel Box: 1
DEFORMERS
Select a wrap deformer node (default name: wiren).
CHARACTER SETUP 197
USING WRAP DEFORMERS | 17 Editing wrap deformation effects One quick way to select the wrap deformer node is to select the object being deformed, and then select the wrap deformer node in its history from the Channel Box (under INPUTS). Each object being deformed has its own upstream wrap deformer node. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control.) 2 Envelope Weight Threshold
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Default is 1. Values less than zero invert the deformation effect, and values greater than 1 magnify the deformation effect. Specifies the influence of the wrap influence objects’ shapes based on the proximity of their components to the objects being deformed. Depending on the point density (for example, the number of CVs) of the wrap influence objects, changing the Weight Threshold can change the overall smoothness of the deformation effect. Values range from 0 (smooth) to 1 (sharp). For example, consider a polygonal wrap influence object. A value of 0 means all faces have an influence. Values between 0 and 1 limit influence based on component proximity. For instance, 0.5 specifies that only the closest half of the faces have influence. A value of 1 indicates that only the closest faces have influence. A value of 1 provides sharper effects, reflecting the immediate changes from one polygonal face to another. A setting of 0 provides smoother effects, more reflective of the overall shape of the polygonal wrap influence object than of its individual faces. For each wrap influence object, the effect of this attribute can be further controlled by changing the Dropoff and Wrap Samples values (see "Editing NURBS wrap influence object channels" on page 196).
Max Distance
Specifies the influence area of wrap influence object points. By limiting the influence area with Max Distance, you can limit how much memory Maya requires to perform the deformation. The less memory required, the better the performance. Using Max Distance is especially useful when you are working with high-resolution wrap influence objects. Max Distance’s value is in terms of Maya’s linear units, which are by default centimeters (select Window > Settings/Preferences > Preferences; click Settings category). The default for Max Distance is 0, which provides the default performance of the wrap deformer. The default value of 0 does not specify no influence area. A value of 0 specifies that each point has an infinite influence area, with the influence area constrained by the Weight Threshold attribute. However, a Max Distance setting such as 0.1 would greatly limit the influence area to within a distance of 0.1 units from each point. Such a setting would require less memory than 0 or a setting greater than 0.1. Note that the Weight Threshold attribute takes effect within the influence area indicated by Max Distance. Maya allocates memory for the wrap deformer when it is created. You can set Max Distance as a creation option. You can also change Max Distance after you create the wrap deformer. That can also improve performance, but for best results try to set the desired value as a creation option. Of course, deciding on the best Max Distance value may require some experimentation. In general, for best performance, you’ll want to try minimize Max Distance to some value greater than 0. Note that setting
CHARACTER SETUP 198
PART 2
USING WRAP DEFORMERS | 17 Editing wrap deformation effects Max Distance to 0 would be better than setting it to a relatively large number (for example, 30), and then lowering the Weight Threshold as desired. This is because a relatively large number will cause more memory allocation than the default setting of 0, even though 0 specifies an infinite influence area. To find the best value, start with 0 or a very small value, and then work up towards the desired value. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing wrap deformer attributes To edit attributes with the Attribute Editor: 1
Select a wrap deformer node (default name: wrapn).
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Wrap Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Wrap Attributes
Weight Threshold
Specifies the influence of the wrap influence objects’ shapes based on the proximity of their components to the objects being deformed. Depending on the point density (for example, the number of CVs) of the wrap influence objects, changing the Weight Threshold can change the overall smoothness of the deformation effect. Values range from 0.000 (sharp) to 1.000 (smooth). Use the slider to select values from 0.000 to 1.000. Default is 0.000. Specifies the influence area of wrap influence object points. By limiting the influence area with Max Distance, you can limit how much memory Maya requires to perform the deformation. The less memory required, the better the performance. Using Max Distance is especially useful when you are working with high-resolution wrap influence objects.
Max Distance
Deformer Attributes Specifies the deformation scale factor. Default is 1.000. Values less than zero invert the deformation effect, and values greater than 1.000 magnify the deformation effect.
Envelope
Node Behavior For more information, see "Editing node behavior to improve performance" on page 54. Extra Attributes (By default, there are no extra attributes.) •
DEFORMERS
Click Select to select the node you are now editing as the currently selected object in your scene.
CHARACTER SETUP 199
USING WRAP DEFORMERS | 17 Deleting wrap deformers or •
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding and removing wrap influence objects You can add more wrap influence objects at any time after you create wrap deformers. In removing a wrap influence object, what you remove is the object’s role as a wrap influence object. Removing does not delete the object. To add influence objects: 1
If needed, create the objects you want to use as wrap influence objects. For more information, see "Creating objects to use as wrap influence objects" on page 193.
2
Select the deformed object(s), or their wrap deformer nodes, to which you want to add the wrap influence object.
3
Now also select the object or group of objects that you want to add as wrap influence objects.
4
Select Deform > Edit Wrap > Add Influence. To remove influence objects:
1
Select the deformed object(s), or their wrap deformer nodes, from which you want to remove the wrap influence object.
2
Now also select the wrap influence objects whose influence you want to remove.
3
Select Deform > Edit Wrap > Remove Influence.
Improving performance You can improve the performance of a wrap deformer with the Max Distance creation option, channel, and attribute. For more information, see "Setting creation options" on page 193, "Editing wrap deformer channels" on page 197, and "Editing wrap deformer attributes" on page 199. You can also improve performance by changing dependency graph evaluation performance, and by changing node behavior. For more information, see “Changing evaluation performance” on page 51 in Chapter 3, and "Editing node behavior to improve performance" on page 54.
DELETING WRAP DEFORMERS To delete a wrap deformer: 1
Select the wrap deformer node.
2
Select Edit > Delete (default shortcut: Backspace key). The deformer nodes are all deleted. However, the object still has the tweak node as an input node, so any tweaks you might have made are preserved.
CHARACTER SETUP 200
PART 2
USING WRAP DEFORMERS | 17 Skinning with wrap deformers
SKINNING WITH WRAP DEFORMERS Skinning is the process of binding deformable objects to a skeleton. Typically, the deformable objects that are bound are NURBS or polygonal surfaces (meshes). These geometry objects become the character’s surface, or skin, and their shapes are influenced by the action of the skeleton’s joints. Once you’ve built a skeleton for a character, you can skin your character by using a smooth skinning method or a rigid skinning method. Because wrap influence objects are themselves deformable objects, you can also bind them to a skeleton by smooth or rigid skinning. In turn, these can influence the NURBS or polygonal surfaces that provide the character’s skin. In skinning with wrap deformers, you create wrap deformers for the deformable objects that you want to use for the character’s skin. Then you bind the wrap influence objects to the skeleton. The result is that the skeleton’s movement influences the objects being deformed by the wrap influence objects indirectly. Meanwhile, you can manipulate the wrap influence objects for more control over the deformation. This approach, skinning with wrap deformers, is called wrap skinning.
EXAMPLES This section offers some examples of using wrap deformers: •
"Deforming high-res sphere with low-res sphere" on page 201
•
"Deforming plane with five cones" on page 202
Deforming high-res sphere with low-res sphere In this short example, you will use a low-resolution sphere to deform a highresolution sphere. To create high-res sphere: Create a NURBS sphere with the default options, except set Sections to 40 and Spans to 20. To create low-res sphere: Create a NURBS sphere with the default options, except set Radius to 3. The low-res sphere surrounds the high-res sphere, whose resolution is five times that of the low-res sphere.
DEFORMERS
CHARACTER SETUP 201
USING WRAP DEFORMERS | 17 Examples To create wrap deformer: 1
Select the high-res sphere, and then select the low-res sphere.
2
Select Deform > Create Wrap. The low-res sphere is now a wrap influence object. To find out more about creating wrap deformers, see "Creating wrap deformers" on page 192. To create deformation effects:
1
Select some of the CVs of the low-res sphere and move them.
The high-res sphere deforms in response to the changes to the other sphere’s CVs. 2
Switch to object selection mode, keeping the low-res sphere selected. In the Channel Box, note the sphere’s two new channels: Dropoff and Wrap Samples.
3
Set Dropoff to 20.
The deformation becomes more pronounced. If you’d like to experiment further with Dropoff and Wrap Samples, see "Editing NURBS wrap influence object channels" on page 196.
Deforming plane with five cones To create plane: •
Create a NURBS plane with all the default options, except set Width to 20, U Patches to 20, and V Patches to 20.
CHARACTER SETUP
PART 2
202
USING WRAP DEFORMERS | 17 Examples To create cones: 1
Create five NURBS cones with all default options. Arrange them on the plane as follows:
2
Group all the cones together. To create wrap deformer:
1
Select the plane, then select the cones group.
2
Select Deform > Create Wrap. To deform plane by moving cones: Move, rotate, or scale the cones to deform the plane.
You can create a wide variety of deformation effects just by manipulating the cones. To edit deformation effects: 1
DEFORMERS
Experiment with each cone’s Dropoff channel.
CHARACTER SETUP 203
USING WRAP DEFORMERS | 17 Examples
For more information on the Dropoff and Wrap Samples channels, see "Editing NURBS wrap influence object channels" on page 196. 2
In the Channel Box, note that the wrap deformer node (wrap1) is listed in the OUTPUTS for the cones and in the INPUTS for the plane. Select the wrap deformer node. Experiment with wrap1’s Weight Threshold channel, which can provide sharper or smoother deformation effects.
Weight Threshold channel set to 0.5.
For more information on the wrap deformer channels, see "Editing wrap deformer channels" on page 197. Note that you can also move the plane away from or into the influence of the cones. You could create an animation in which the plane goes through a deformation when it gets close to the cones.
CHARACTER SETUP 204
PART 2
PART 3
SKELETONS
18
INTRODUCING SKELETONS Skeletons are hierarchical, articulated structures for posing and animating deformable objects.
A skeleton used to animate a human character
UNDERSTANDING SKELETONS Skeletons are hierarchical, articulated structures for posing and animating deformable objects that have been skinned. (For more information on skinning, see Chapter 25, “Introducing Skinning.”) Skeletons provide structures for animating hierarchical actions in much the same way that a human skeleton determines how a human body can move. For more information about a skeleton’s structure, including its joints, bones, joint chains, limbs, and hierarchical organization, see "Understanding skeleton construction" on page 212.
SKELETONS
CHARACTER SETUP 207
INTRODUCING SKELETONS | 18 Editing node behavior to improve performance
EDITING NODE BEHAVIOR TO IMPROVE PERFORMANCE You don’t need to know about node behavior in order to use skeletons effectively. If you are new to skeletons, you can skip this section. However, familiarity with node behavior can provide you with more control over skeleton manipulation and performance. For each object in your scene, if there has been any change to its node or any of the nodes in its history (its upstream or downstream nodes), Maya will evaluate the nodes and update the display. You can improve performance by editing the node behavior attributes.
Understanding node behavior attributes The node behavior attributes include Caching and Node State. Caching
Specifies that Maya store the results of upstream evaluations, and then provide those results to the node. This saves Maya from having to re-evaluate the upstream nodes every time the node needs the results. If there are no changes to the upstream nodes, then this setting can improve display performance with no loss of results. However, note that caching uses more memory than would otherwise be used, which could adversely affect performance. Also, if there are changes to upstream nodes, more memory is allocated and then freed during each deformation, which could also adversely affect display performance.
Node State
Set Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, WaitingHasNoEffect, or Waiting-Blocking.
Normal
Specifies that Maya evaluate the node and display the results. Maya will evaluate the node as usual. This is the default.
HasNoEffect
Specifies that Maya prevent the evaluation of the node, but still display the node. Maya will evaluate the nodes in the node’s history, but not the node itself.
Blocking
Specifies that Maya not evaluate or display the node. Maya will not report the results of any evaluations of upstream nodes to this node.
Waiting-Normal
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting (Window > Settings/Preferences > Performance Settings) is set to Demand or Release, the node will take the Normal state when you click Update or release the mouse button.
WaitingHasNoEffect
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the HasNoEffect state when you click Update or release the mouse button.
WaitingBlocking
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the Blocking state when you click Update or release the mouse button.
Editing node behavior To set node behavior: 1
Open the node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
CHARACTER SETUP 208
PART 3
INTRODUCING SKELETONS | 18 Workflow summary 3
Click Caching on or off.
4
Select the Node State as Normal, HasNoEffect, or Blocking. (The Waiting-Normal, Waiting-HasNoEffect, and Waiting-Blocking states are for Maya’s internal use.)
5
Close the Attribute Editor.
WORKFLOW SUMMARY After you’ve created a model for your character, the next step is to build a skeleton. The skeleton provides a way to create articulated deformation effects on the model after you skin the model’s deformable objects to the skeleton. (For more information on skinning, see Chapter 25, “Introducing Skinning.”) In setting up a skeleton, the first thing to do is to build the skeleton. For more information on building skeletons, see Chapter 19, “Building Skeletons.” After you’ve built the skeleton, you can pose it either before or after skinning. For more information on posing skeletons, see Chapter 20, “Posing Skeletons.”
SKELETONS
CHARACTER SETUP 209
INTRODUCING SKELETONS | 18 Workflow summary
CHARACTER SETUP 210
PART 3
19
BUILDING SKELETONS Building skeletons is the process of constructing hierarchical, articulated structures made of joints and bones. Once you’ve built a skeleton, you can use it to skin a character with smooth or rigid skinning. You can also group or parent objects to joints and bones, and use the skeleton to control the objects’ movements.
Skeleton for human character
SKELETONS
Skeleton for human hand with local rotation axes displayed for each joint
CHARACTER SETUP 211
BUILDING SKELETONS | 19 Understanding skeleton construction
UNDERSTANDING SKELETON CONSTRUCTION
As you construct a skeleton, use multiple camera views to make sure that your skeleton fits the deformable objects appropriately in all three dimensions.
Additionally, the grid can be quite useful for judging the size and shape of the skeleton. You can position and rescale the grid to suit your work.
CHARACTER SETUP 212
PART 3
BUILDING SKELETONS | 19 Understanding skeleton construction
In skinning, you bind deformable objects to skeletons. In building a skeleton, you should be thinking about which skinning method you will be using. Building a skeleton for smooth skinning could suggest a somewhat different skeleton construction strategy than building a skeleton for rigid skinning, lattice skinning, or wrap skinning. For example, because smooth skinning enables gradual deformations that can be influenced by several joints, you could use joints to create deformation effects that indicate breathing or muscle action. Using joints for this might not work very well with rigid skinning, and instead you might use flexors for such effects.
Joints and bones Joints
Bones of joints
Joints are the building blocks of skeletons. Each joint can have one or more bones attached to it. The action of a bone attached to a joint is controlled by the joint’s rotation and movement. Various joint attributes specify how the joint can act. For example, you can specify limitations on how far a joint can rotate. Ball joint A ball joint is a joint that can rotate about all three of its local axes.
SKELETONS
CHARACTER SETUP 213
BUILDING SKELETONS | 19 Understanding skeleton construction Universal joint A universal joint is a joint that can rotate only about any two of its local axes. A human wrist would be a good example of a universal joint, though a wrist has limitations on the extent it can rotate. Hinge joint A hinge joint is a joint that can rotate only about one of its local axes. A human knee would be a good example of a hinge joint.
Joint chains A joint chain is any group of joints and their bones connected in a series. The joints are connected linearly; you could draw a line through a joint chain’s series of joints and their bones without having to retrace your path. A given joint chain begins at the highest joint in the joint chain’s action hierarchy. This joint is the joint chain’s parent joint.
Joint chain Joint chain
Joint chain
As you create joint chains for your character, think about how you are going to use IK handles to pose the joint chains. Joint chains that consist of four or fewer joints are much easier to pose with IK handles than those that have many more joints. When you create joint chains, avoid joint chains that are in straight lines. Having some of the joints rotated slightly at various appropriate angles will make the joint chain easier to pose with IK handles.
Limbs A limb is any group of one or more connected joint chains. The chains may branch off from one another, forming a tree-like structure. Unlike a joint chain, a limb’s joints may not be connected linearly; you may not be able to draw a line through all of a limb’s joints and their bones without doubling back. A given limb begins at the highest joint in the limb’s action hierarchy. This joint is the limb’s parent joint.
CHARACTER SETUP 214
PART 3
BUILDING SKELETONS | 19 Understanding skeleton construction
Limbs consist of one or more connected joint chains
When you begin building a skeleton that will have many symmetrical limbs, start in the center of the workspace near the scene’s world origin. Starting near the center will make it easier for you to create skeletons with many symmetrical parts.
Skeleton hierarchy A root joint is the highest joint in a skeleton’s hierarchy. A skeleton can have only one root joint. A parent joint is any joint higher in a skeleton’s action hierarchy than any of the other joints that are influenced by that joint’s action. Joints below a given parent joint in the action hierarchy are called child joints.
Root joint
Related MEL commands MEL commands related to building skeletons include the following:
SKELETONS
•
disconnectJoint
•
insertJoint
•
insertJointCtx
•
joint
CHARACTER SETUP 215
BUILDING SKELETONS | 19 Creating joint chains and limbs •
jointCtx
•
jointDisplayScale
•
mirrorJoint
•
removeJoint
•
reroot For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for joints include: •
Joint nodes (default name: jointn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING JOINT CHAINS AND LIMBS You begin building a skeleton by creating a joint chain is a series of joints and their bones. You can then add to the joint chain by continuing that joint chain or by creating new joint chains starting from any of the joint chain’s joints. In this way you can create a complex structure of various joint chains and limbs. These joint chains and limbs define a skeleton’s action hierarchy.
Specifying Joint Tool’s tool settings To specify tool settings: 1
Select Skeleton > Joint Tool ❒.
2
The Tool Settings window is displayed.
3
Set the Tool Defaults tab’s Joint Options as follows: Joint Options
Degrees of Freedom
Auto Joint Orient
Specifies which of the joint’s local axes the joint can rotate about during inverse kinematics (IK) posing. Click X, Y, or Z. The default setting allows the joint to rotate about all three of its local axes during IK posing. Specifies the orientation of a joint’s local axis. Selections include none, xyz, yzx, zxy, xzy, yxz, zyx. The none selection specifies that the joint’s local axis have the orientation of the world axis. The other selections specify that the joint’s local axis be oriented so that the first axis (for example, the X-axis for the xyz selection) points into the joint’s bone. (If the joint has more than one child joint, the first axis points into the bone that connects to the child joint created first.) The third axis points sideways from the joint and its bone connecting the child joint, and the second axis points at right angles to the first axis and third axis. All three axes are aligned according to the right hand rule.
CHARACTER SETUP 216
PART 3
BUILDING SKELETONS | 19 Creating joint chains and limbs The default selection is xyz. In this orientation, the positive X-axis points into the joint’s bone and towards the joint’s first child joint. The Z-axis points sideways from the joint and its bone connecting the child joint, and the Y-axis points at right angles to the X-axis and Z-axis. Note that if you want to have a hinge joint rotate about a particular axis (for example, the joint’s local X-axis), you must be sure that axis is not the axis that points into the joint’s bone. For example, if you want the joint to rotate about its local X-axis and Auto Joint Orient is xyz, the joint won’t be able to rotate. Scale Compensate
Specifies whether the joints you create can be scaled automatically when you scale joints above them in the skeleton’s hierarchy. (Note that when you scale a joint, you change the size of the joint’s bone.) If Scale Compensate is on, the joints will not be affected if you scale their parents. Having Scale Compensate on can prevent undesirable shearing effects that can occur after you’ve skinned a character and then decide to scale a joint along one or two of its axes. Also, having Scale Compensate on can make it easier for you to change the length of individual bones. Default is on.
Auto Joint Limits
Specifies that Maya automatically limit the extent a joint can rotate about its axes according to the angles at which you build the skeleton’s joints. With Auto Joint Limits on, the smaller inner angle of a joint rounded off to 180 degrees is set as the allowable range of rotation. For example, when you are creating a knee joint, if you create the joint slightly bent back, the joint will automatically not be able to swing the lower leg bone forward of the upper leg bone, nor will it be able to wobble from side to side. The joint will not be able to rotate in any other way except through the inner angle rounded off to 180 degrees. However, note that this limitation does not change the joint’s Degrees of Freedom setting. This setting does not apply to a joint chain’s start and end joints.
Create IK Handle
Specifies that Maya create an IK handle when you are done creating a joint chain. The IK handle will run from the joint chain’s start joint to its end joint. If you create a limb, Maya creates an IK handle only for the most recently built joint chain in the limb. Note that a more typical workflow is to create a complete skeleton, and then later add IK handles where desired. If on, the IK Handle Options section is displayed. IK Handle Options Specifies the creation options for the IK handle that Maya will create when you are done creating a joint chain. (Available only if Create IK Handle is on). For more information on these options, see Chapter 21, “Using IK Rotate Plane Handles” and Chapter 22, “Using IK Single Chain Handles”. •
Click Reset Tool to reset to the default tool settings. or
•
Click Close to close the Tool Settings window. Note that you can change the tool settings whenever you are using the Joint Tool by selecting Window > Settings Preferences > Tool Settings.
SKELETONS
CHARACTER SETUP 217
BUILDING SKELETONS | 19 Editing joints
Creating a joint chain To create a joint or joint chain: 1
Select Skeleton > Joint Tool.
2
In the workspace, click where you want to create a joint.
3
Click again where you want to create the next joint in the joint chain.
4
Continue until you’ve created all the joints you want in the joint chain.
5
Press the Enter key. To position the most recently created joint while using Joint Tool:
1
While using the Joint Tool, press the middle mouse button.
2
The transform manipulator appears and you can move the current joint in any direction. After you’ve positioned the current joint, you can continue creating joints by pressing the left mouse button. Another way to position the most recently created joint is to press the Insert key, drag by pressing the left or middle mouse button, and then press the Insert key again. You can then continue with using the Joint Tool.
Creating a limb Creating a limb is similar to creating a joint chain. While you are using the Joint Tool to create joints, you can traverse the hierarchy of joints you’ve already created by pressing the arrow keys. By using the arrow keys, you can go back to any previously created joint and create new joints that branch off from current joint chains. As with creating a joint chain, press the Enter key when you are done.
EDITING JOINTS You can edit joints as described in the following topics:
Editing joint attributes To edit joint attributes with the Attribute Editor: 1
Select the joint node (default name: jointn).
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Joint, Joint Rotation Limit Dampening, Limit Information, Scale, Display, Node Behavior, and Extra Attributes. Transform Attributes
Translate
Specifies the joint’s translation (Translate X, Y, and Z) attribute values in world space.
Rotate
Specifies the rotation (Rotate X, Y, and Z attribute values) of the joint’s bone(s) about the joint in world space.
CHARACTER SETUP 218
PART 3
BUILDING SKELETONS | 19 Editing joints Scale
Specifies the joint’s scale (Scale X, Y, and Z) attribute values in world space.
Rotate Order
Specifies the joint’s rotation order. For example, if the rotation order is xyz, the joint first rotates about its X-axis, then its Y-axis, and finally its Z-axis. Select xyz, yzx, zxy, xzy, yxz, zyx. Default is xyz.
Rotate Axis
Specifies the orientation of the joint’s bone(s) relative to the orientation of the joint’s local rotation axis.
Inherits Transform
Specifies whether the joint can be affected by the translation, rotation, or scaling of its parent joint. Joint
Degrees of Freedom
Stiffness
Specifies which of its local axes the joint can rotate about during inverse kinematics (IK) posing and animation. Click on or off X, Y, or Z. Default allows the joint to rotate about all three axes during IK posing and animation. Specifies a joint’s resistance to rotation, or stiffness, during inverse kinematics (IK) posing. Set the Stiffness only if it’s important that certain joints in a joint chain controlled by an IK handle rotate less freely than others. For example, you might want joints in the mid-back of a human to rotate less freely than those in the lower back. Stiffness operates relatively between joints in a joint chain controlled by IK handles. IK solver calculations for stiffness can require a little more time than usually required, so use stiffness only when its effect is particularly important. You set the stiffness for each axis separately. You can use this for joints that move in several directions. For example, a wrist joint moves more freely bending toward the forearm than it does from side to side. When stiffness is specified, the IK solver adjusts the internal energy strictly under the constraint that the end effectors stay fixed. Therefore, if there are no redundant degrees of freedom, the stiffness won’t modify the single chain IK solver’s solution. Specify values from 0 to 100 for the X-axis, Y-axis, and Z-axis of the joint’s local axis. The effect of the values is relative to the values assigned to other joints in the joint chain. For example, in a joint chain with two joints, if joint1 has a Stiffness of 1.0 and joint2 has 2.0, joint2 will be twice as stiff as joint1. With stiffness set to 0, no stiffness is specified. In general, this is the recommended setting for all of a skeleton’s joints. However, remember that the Stiffness values for each joint in a joint chain controlled by an IK handle are relative to the values for all the other joints in the joint chain. Consequently, if you set the Stiffness for at least one of the joints, you should also set the Stiffness values for the other joints in the chain so that they do not have the default (0). For example, you might set the Stiffness values for all the joints in the chain to 1, and then set the Stiffness values for the very stiff joints to 2 (twice as stiff as the rest), or 3 (three times as stiff), and so forth. If some of the joints in the chain still have the default setting of 0, the joints can lock up during IK posing.
Preferred Angle
Specifies how an inverse kinematics (IK) handle will prefer to rotate a joint during IK posing. The IK solver often can rotate a joint in a number of different ways in order to reach the goal. Similarly, when more than one IK handle passes through a joint, the first priority of all the IK solvers is to make all the IK handles reach their goals. Often a variety of joint rotations can allow the IK handles to reach their goals.
SKELETONS
CHARACTER SETUP 219
BUILDING SKELETONS | 19 Editing joints Depending on how you want your character to move, some rotations are more appropriate than others. You can identify preferred angles for your character’s actions. Two types of IK solvers, the single chain IK solver and the rotate plane IK solver, will then give those angles priority over other possible angles during joint rotation. The angles you give priority to are the preferred angles. Joint Orient
Specifies the orientation of the joint’s local rotation axis.
Segment Scale Compensate
Specifies whether the scaling (the Scale X, Y, and Z attribute values) of the joint’s parent joint affects the joint. If on, the joint compensates for the scaling of its parent joint, and so is not affected. Click on or off. Default is on. Joint Rotation Limit Damping For most living creatures, when a joint rotates as far as it can, it tends to slow down or “dampen” before reaching its limit. For example, an elbow does not snap straight, but gradually slows down as the lower arm aligns with the upper arm. In animation terminology, the effect is that of an “ease-in.” Joint dampening applies resistance to a joint as it approaches its joint limits. Instead of the joint abruptly stopping when it reaches its limits, you can use damping to slow it down smoothly. Depending on the strength and range you set, a joint with dampening will not reach its limit boundary, unless forced. The dampening factor for joints affects only the solution computed by an IK solver; it does not affect joints that are animated by other means. Min Damp Range Max Damp Range Min Damp Strength
Max Damp Strength
Specifies the angles (relative to the minimum joint limit angles) at which resistance begins to occur. Specifies the angles (relative to the maximum joint limit angles) at which resistance begins to occur. Specifies the amount of increasing resistance within the Min Damp Range. Values can range from 0, which takes the joint all the way to its limit with no resistance, to 100, which halts the joint at the outer edge of the damp range. A value of 50 would specify a gradually increasing resistance as the joint rotates past the Min Damp Range angle. Specifies the amount of increasing resistance within the Max Damp Range. Values can range from 0, which takes the joint all the way to its limit with no resistance, to 100, which halts the joint at the outer edge of the damp range. A value of 50 would specify a gradually increasing resistance as the joint rotates past the Max Damp Range angle. Limit Information Select the Translate, Rotate, or Scale sections.
CHARACTER SETUP 220
PART 3
BUILDING SKELETONS | 19 Editing joints Translate Trans Limit X
Specifies translation limits on the joint’s local X-axis. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Y
Specifies translation limits on the joint’s local Y-axis.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Z
Specifies translation limits on the joint’s local Z-axis. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Rotate
Rot Limit X
Specifies rotation limits about the joint’s local X-axis.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Y
Specifies rotation limits about the joint’s local Y-axis.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Z
Specifies rotation limits about the joint’s local Z-axis. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Scale
Scale Limit X
Specifies scaling limits along the joint’s local X-axis.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Y
Specifies scaling limits along the joint’s local Y-axis. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Z
Specifies scaling limits along the joint’s local Z-axis.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Display Selections for the joint’s selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See "Editing node behavior to improve performance" on page 208. Extra Attributes (No extra attributes by default.)
SKELETONS
CHARACTER SETUP 221
BUILDING SKELETONS | 19 Editing joints
Displaying a joint’s local axis To display a joint’s local rotation axis: 1
Select the joint.
2
Select Display > Component Display > Local Rotation Axes.
Orienting a joint’s local axis To orient a local axis: 1
Select the joint.
2
Display the joint’s local axis (select Display > Component Display > Local Rotation Axes).
3
To select a joint’s local axis, you need to be in components selection mode, with the miscellaneous selection mask for local rotation axes on:
•
Select by component type (Default hotkey: F8.)
•
Select by component type: Miscellaneous.
•
Move the cursor over the Miscellaneous icon, and click the right mouse button. Be sure that Local Rotation Axes is checked on.
4
Select the local axis.
5
Select the Rotate Tool (default hotkey: e). Use the Rotate Tool to orient the local axis by hand. To enter precise values, you can use a command such as the following: rotate -r -os 180 0 0;
This command rotates the local axes 180 degrees about the X-axis.
Moving, rotating, or scaling a joint and its bone You can move, rotate, or scale joints by selecting them and then using the Move Tool, Rotate Tool, or Scale Tool. You can also move, rotate, or scale by using the Channel Box or the Attribute Editor. You can lengthen a joint’s bone by scaling it along local axis that points into the bone, or widen the bone by scaling it along the local axis that is perpendicular to the bone’s direction. When you move a joint, you also move any joints below it in the skeleton’s hierarchy. However, you can also move one joint only if you want to adjust a certain joint’s location. To move one joint only: 1
Select the joint you want to position.
2
Select the Move Tool (default shortcut: w key).
3
Press the Insert key. The transform manipulator appears at the selected joint.
4
CHARACTER SETUP 222
Move any joint in the skeleton by selecting and dragging it with the left mouse button. PART 3
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons
EDITING JOINT CHAINS, LIMBS, AND SKELETONS The following topics describe how to edit joint chains, limbs, and skeletons. Many of the tasks for editing joint chains, limbs, and skeletons can have serious effects on IK handles and skinning. If you edit joints that have IK handles passing through them, or edit joints involved in skinning, you may have to redo the IK handles or the skinning.
Viewing skeleton hierarchy You can view a skeleton’s hierarchy in the Outliner or Hypergraph. With the Hypergraph, you can arrange the display of joints in any way you like. For example, you might arrange the display so that the joint hierarchy looks like the actual structure of the skeleton.
Selecting joints and navigating the skeleton’s hierarchy You can select any joint and then use the arrow keys to navigate through the skeleton’s hierarchy. The arrow keys provide a handy way to select joints when you are editing a skeleton. You can also use these keys when you are creating joints with the Joint Tool. When selecting a joint directly, you’ll find that it is often easier to select a joint by selecting its bone. Whenever you select a joint, all the joints below it in the hierarchy are highlighted by default. They are highlighted because what you do to the selected joint can affect all the joints below the selected joint. However, only the joint you selected is currently selected. To select all of the joints below the selected joint as well, use the following MEL command: select -hi;
Because this is a command you will use frequently, you might want to create a hotkey or custom shelf button for it.
Displaying all the local axes in a limb or skeleton To display all local axes: 1
Select a joint (a limb’s parent joint, or a skeleton’s root joint).
2
To select all the joints in the hierarchy below the selected joint, enter the following MEL command: select -hi;
3
Select Display > Component Display > Local Rotation Axes. All the local axes are displayed.
Reorienting all local axes in limb or skeleton When you change the positions of joints (for instance, by using the Move Tool), the orientation of their local rotation axes are not affected. Because the local rotation axes are not affected, the axes may no longer be aligned with the bones when you change the positions of joints.
SKELETONS
CHARACTER SETUP 223
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons For instance, with the Joint Tool’s Auto Joint Orient tool setting set to xyz (the default), the X-axis of each joint’s local rotation axis will point into each joint’s bone. But if you then move (translate) a joint, the local rotation X-axis will no longer point into the bone. Consequently, after moving the joint, you need to reorient the local rotation axis so that the local rotation X-axis once again points into the bone. The fastest way to reorient joints is to go ahead and move the joints you want to move within some hierarchy (for example, a hand), and then reorient all the joints in that hierarchy using a MEL command. To reorient all local axes back to default auto orientation: 1
Select a joint (a limb’s parent joint, or a skeleton’s root joint).
2
To select all the joints in the hierarchy below the selected joint, enter a MEL command such as the following: joint -e -oj xyz -zso -ch;
All the local axes are reoriented according to the default setting for the Auto Joint Orient tool setting. (For more information on the Auto Joint Orient tool setting, see "Specifying Joint Tool’s tool settings" on page 216.) In the command, the -oj flag stands for orient joints, xyz specifies the orientation, and -zso specifies that the local scale axes also be reoriented. The -ch flag specifies that the command act on the selected joint and on all the joints below it (all the child joints) in the skeleton’s hierarchy. If you only want to reorient the selected joint, don’t include the -ch flag. Because this is a command you will use frequently, you might want to create a hotkey or custom shelf button for it.
Inserting a joint You can insert a joint into any joint chain. To insert joints, use the Insert Joint Tool (Skeleton > Insert Joint Tool). In general, inserting joints should be done before you add IK handles or do skinning. Inserting joints into joint chains with IK handles might also require you to redo the IK handles. Also, inserting joints after skinning can led to undesirable deformation effects. To insert a joint: 1
Select Skeleton > Insert Joint Tool. (Unlike the Joint Tool, the Insert Joint Tool has no tool settings.)
2
Move the cursor to the joint that you want to be the parent of the new joint.
3
While pressing the left mouse button, drag to where you want the new joint.
4
When you have finished inserting joints, press Enter or select another tool.
Removing a joint With the exception of the root joint, you can remove any joint so that the parent joint’s bone extends to the joint’s child joint. Note that you should not remove any skinned joints. To remove a joint: 1
Select the joint you want to remove. Note that you can only remove one joint at a time.
CHARACTER SETUP 224
PART 3
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons 2
Select Skeleton > Remove Joint. The joint is removed. The bone of the joint above the removed joint is extended to the joint below the removed joint.
Disconnecting joints to create new skeletons You can break up a skeleton into two skeletons by disconnecting any joint other than the root joint. The disconnected joint will become the root joint of a new skeleton. Note that if you disconnect a joint in a joint chain that has an IK handle, the IK handle will be deleted. To disconnect: 1
Select the joint you want to disconnect. This joint will become the root joint of the new skeleton.
2
Select Skeleton > Disconnect Joint. The joint is disconnected, and is the root joint of a new skeleton.
Connecting joints to combine two skeletons You can connect skeletons by combining joints or by connecting joints with a bone. You can connect two skeletons by combining the root joint of one skeleton with any joint of another skeleton except that skeleton’s root joint. The skeleton that becomes a limb of the other skeleton will change its position in the scene so that it is directly connected to the other skeleton’s joint. Alternatively, you can connect the root joint of one skeleton to any joint of another skeleton by extending a bone to the root joint from the joint of the other skeleton. The skeleton that becomes a limb of the other skeleton will not have to move. Both of these approaches involve selecting Skeleton > Connect Joint ❒. To connect skeletons by combining joints: 1
Click the root of the skeleton you want to be a limb of another skeleton.
2
On the other skeleton, select any joint other than the skeleton’s root joint. You can connect only to a non-root joint of the parent skeleton.
3
Select Skeleton > Connect Joint ❒. The Connect Joint Options window is displayed.
4
In the Connect Joint Options window, turn on the Connect Joint mode.
5
In the Connect Joint Options window, click Connect. (Alternatively, select Skeleton > Connect Joint.) Maya connects the skeletons. To connect skeletons by connecting joints with a bone:
1
Click the root of the skeleton you want to be a limb of another skeleton.
2
On the other skeleton, select any joint other than the skeleton’s root joint. You can connect only to a non-root joint of the parent skeleton.
3 SKELETONS
Select Skeleton > Connect Joint ❒.
CHARACTER SETUP 225
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons The Connect Joint Options window is displayed. 4
In the Connect Joint Options window, turn on the Parent Joint mode. Parent Joint mode connects the skeletons by creating a new bone between the selected root joint and the joint you’re connecting it to. The two skeletons do not move.
5
In the Connect Joint Options window, click Connect. (Alternatively, select Skeleton > Connect Joint.) Maya connects the skeletons with a bone. Note that connecting skeletons using Parent Joint mode is identical to the result you get by selecting Edit > Parent.
Mirroring limbs or skeletons A group of one or more connected joint chains is called a limb. You can duplicate or make mirror copies of limbs. A mirror copy is a copy that is symmetrical about a selected plane; in effect, the reflection of the original in the plane is turned into a real copy of the original, but with all the aspects of the limb mirrored accordingly. The origin of the plane is at the parent joint of the limb. Joint attributes and IK handles are mirrored as well as the joints and their bones. Mirroring is useful when you are creating the limbs for a character. For example, you can build a right arm and hand, and then create a mirrored copy of it for the left arm and hand. Mirroring affects all aspects of the creation of the left arm, including the joint limits. You don’t have to reset the joint limits so that the left arm’s joint limits will be symmetrical to the right arm’s joint limits; Maya will do it for you. You can also make a mirror copy of an entire skeleton. The procedure is the same as for creating mirror copies of limbs, except that the skeleton will be mirrored about the scene’s world origin. To mirror a limb or skeleton: 1
Select the parent joint of the limb you want to duplicate, or select the root joint if you want to mirror an entire skeleton.
2
To choose the plane for mirroring, first select Skeleton > Mirror Joint ❐ to open the Mirror Joint Options window.
3
Click the desired Mirror Across option to choose the plane in which you want the joint chain mirrored. The default is XY. If you are mirroring a limb, this indicates the XY plane whose origin is at the limb’s parent joint. If you are mirroring a skeleton, this indicates the XY plane whose origin is the scene’s world origin.
4
Set the desired Mirror Function: If you choose Behavior, the new joints have the opposite orientation of the original. The local rotation axis of each joint points in the opposite direction of its counterpart. This setting is handy for animating opposing movements in a pair of counterpart limbs. For instance, if you select a pair of ankles and use the Rotate tool on both at the same time, you can rotate the feet point symmetrically inward or outward with a single manipulation.
CHARACTER SETUP 226
PART 3
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons If you choose Orientation, the new joints to have the same orientation of the original. With this setting, you can copy animation from one limb to another and get identical behavior. For instance, if you want to animate a skier racing down a slope with legs turning in the same direction, use this setting. 5
Click Mirror in the Mirror Joint Options window, or select Skeleton > Mirror Joint. If you are mirroring a limb, the limb is mirrored across the selected plane whose origin is at the limb’s parent joint. If you are mirroring a skeleton, the skeleton is mirrored across the selected plane whose origin is the scene’s world origin.
Rerooting a skeleton You can change the hierarchical organization of a skeleton by changing which joint is the root joint. This process is called rerooting. Note that any IK handles that pass through the joint selected to be the new root joint will be deleted. Also, any animation of the skeleton’s root joint will be affected when you reroot. To reroot: 1
Click the joint where you want the new root. If you select the child of the entire joint chain, the hierarchy will be reversed. If you select a joint in the middle of the skeleton to become the new root, you will have two child joints with separate hierarchies below the root joint.
2
Select Skeleton > Reroot Skeleton.
Setting display size of all joints You can resize the display of a skeleton’s joints. Increasing the display size can make the joints and their bones easier to pick. Decreasing the display size can make other objects such as flexors easier to pick. To resize joint display: 1
Select Display > Joint Size.
2
Select from the percentages listed to resize the joints by 25%, 50%, 75%, or 100%. Alternatively, select Custom to select some other percentage with the slider in the Joint Display Scale window. The percentages are relative to the default setting is always 100% or 1.00.
Displaying joints as boxes rather than bones You can display a joint that has multiple child joints as a box rather than as interconnected bones.
SKELETONS
CHARACTER SETUP 227
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons
Boxes Bones
Hip joint Hip joint Root of spine
Root of spine
Some users find that boxes give a better representation of the relationship between joints in a multiple child-joint hierarchy. For example, in the skeletons in the prior figure, you can rotate hip joints to rotate the legs, but you cannot rotate the root of the spine to swivel the legs. The box makes this more self-evident that the bones. Note that in human characters, multiple child-joint hierarchies typically occur at the upper back, root, and possibly lower neck. To display boxes: 1
Select the joint.
2
Display the Attribute Editor.
3
For the Draw Style, select Box.
Setting and assuming preferred angles Setting the preferred angles can assure smoother motion during IK posing and animation. In a skeleton, each joint’s preferred angle indicates the preferred initial rotation of the joint during inverse kinematics (IK) posing. When you build a skeleton, you should create the joints so that they are somewhat rotated into the angles you would want them to move into during IK posing. For example, when creating a leg, you should not create the joints so that they are all in a straight line. Rather, there should be a slight bend at the knee joint. This bend will be the joint’s preferred angle for IK posing. When you’re done building a skeleton and are ready to add IK handles, set the preferred angles for the skeleton. Even after you’ve rotated some joints, you can see what the preferred angles are by telling the skeleton to assume its preferred angles. To set a skeleton’s preferred angles: 1
Select the skeleton’s root joint.
2
Select Skeleton > Set Preferred Angle.
CHARACTER SETUP 228
PART 3
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons To have a skeleton assume its preferred angles: 1
Select the skeleton’s root joint.
2
Select Skeleton > Assume Preferred Angle. To set a joint’s preferred angle:
1
Move the cursor over the joint, and press the right mouse button.
2
From the pop-up menu, select Set Preferred Angle. To have a joint assume its preferred angle:
SKELETONS
1
Move the cursor over the joint, and press the right mouse button.
2
From the pop-up menu, select Assume Preferred Angle.
CHARACTER SETUP 229
BUILDING SKELETONS | 19 Editing joint chains, limbs, and skeletons
CHARACTER SETUP 230
PART 3
20
POSING SKELETONS Posing skeletons involves the use of either forward or inverse kinematics techniques.
SKELETONS
CHARACTER SETUP 231
POSING SKELETONS | 20 Understanding skeleton posing
UNDERSTANDING SKELETON POSING
When you pose and animate a skeleton, you are specifying the skeleton’s motion. The term for the specification of motion is kinematics. Posing and animating skeletons involves two types of kinematics: forward kinematics (FK) and inverse kinematics (IK). Although the terms sound complicated, what they refer to is easy to understand. Forward kinematics is ideal for creating detailed arc motions because it requires the direct specification of each joint rotation. Inverse kinematics is ideal for creating goal-directed motion because it only requires the specification of a position and orientation that the joints in a joint chain will rotate to reach.
Forward kinematics (FK)
In forward kinematics (FK), when you pose a joint chain you rotate each joint individually. For example, if you want a joint chain to reach for a particular location in space, you have to rotate each joint individually so that the joint chain can reach the location. To do this, you would rotate the joint chain’s parent joint, then the next joint, and so on down the joint chain. When you animate a skeleton posed with forward kinematics, Maya interpolates the joint rotations starting with the root joint, then the root’s child joints, and so on down through the skeleton’s action hierarchy. Maya proceeds “forward” through the action hierarchy, starting at the root joint.
CHARACTER SETUP 232
PART 3
POSING SKELETONS | 20 Understanding skeleton posing Posing and animating skeletons with forward kinematics is an excellent approach for specifying detailed arc motions, but it can take a fair amount of time if you are animating a large, complicated skeleton. Also, forward kinematics is often not very intuitive for specifying goal-directed motion. When you think about moving your hand to some location in space, you don’t normally think about how you are going to rotate all the joints in your arm. For more information on forward kinematics (FK) posing, see "Posing with forward kinematics (FK)" on page 236.
Inverse kinematics (IK)
In inverse kinematics (IK), you can pose a joint chain based on a location in space you want the joint chain to reach. Inverse kinematics is more intuitive for goaldirected motion than forward kinematics because you can focus on the goal you want a joint chain to reach without worrying about how each joint will have to rotate. However, unlike forward kinematics, inverse kinematics requires that you use special tools for posing and animating. These tools are called IK handles and IK solvers. An IK handle is like a wire that can run through a joint chain, providing a way for you to pose the entire joint chain in one action. As you pose and animate the joint chain with the IK handle, the IK handle automatically figures out how to rotate all the joints in the joint chain by using its IK solver. The IK solver is the motor intelligence behind the IK handle. For example, if you want a joint chain to reach a particular location in space, you can move the entire chain by using the IK handle that runs through the chain. Given where you want the joint chain to reach, the IK solver figures out how to rotate all the joints in the joint chain for you by means of Maya’s inverse kinematics methods. For more information on inverse kinematics (IK) posing, see "Posing with inverse kinematics (IK)" on page 236.
SKELETONS
CHARACTER SETUP 233
POSING SKELETONS | 20 Understanding skeleton posing
IK handles and IK chains
An IK handle runs through a selected joint chain like a wire, providing you with a way to move the entire joint chain. The joint the IK handle starts at is called the start joint. The last joint in the joint chain controlled by the IK handle is called the end joint.
The start joint could be the skeleton’s root joint, or any joint in the skeleton’s action hierarchy above the end joint. The IK handle can pose all the joints in the chain, from the start joint to the end joint. A joint chain that has an IK handle is called an IK chain. IK chains are easy to use. However, some background on how they work can help you get the most out of posing and animating with inverse kinematics.
CHARACTER SETUP 234
PART 3
POSING SKELETONS | 20 Understanding skeleton posing The end of the IK handle, which is located at the end joint by default, is called the end effector. The reason the end of the IK handle is called the “end effector” is because it helps to bring about how the IK handle rotates the joints in the joint chain so that the end of the chain can reach some location in space. By telling the IK handle’s IK solver where the end of the IK handle is, the end effector provides information the IK solver needs to figure out how to rotate all the joints for you. When you are posing and animating an IK chain, you also need to tell the IK solver the position and orientation in space where you would like the end effector to move to next. That information is provided by the IK handle’s goal. When you interactively pose an IK chain, what you are really doing is moving the IK handle’s goal. The IK solver looks at where the goal is, looks at where the end effector is, and figures out how to rotate all the joints in the IK chain to get the end effector to be where the goal is. A skeleton can have as many IK handles as you think you need for posing and animating its joint chains. However, be sure you are happy with which joint is the skeleton’s root joint before you begin creating IK handles. The skeleton’s root must not be between an IK chain’s start joint and end joint. You cannot create an IK chain that includes the root joint unless that joint is the start joint. Also, if you change which joint is the root joint, you will invalidate IK chains that include the new root joint unless the joint is the start joint of an IK chain.
IK solvers and systems IK solvers provide the motor intelligence of IK handles. IK solvers figure out how to rotate all the joints in a joint chain controlled by an IK handle. Maya’s interface offers three types of solvers: •
IK Rotate plane (RP) solver
•
IK Single chain (SC) solver
•
Spline IK solver Additionally, two other IK solvers, the IK multi-chain (MC) solver and the IK Power Animator (PA) solver are available only through MEL commands. The rotate plane, single-chain, and IK spline solvers are the best choices for IK solvers. Maya’s default IK solvers are organized by an IK system that controls how Maya evaluates the solvers. For more information on using IK solvers and systems, see "Using IK solvers and systems" on page 237.
Related MEL commands MEL commands related to posing with IK handles include the following:
SKELETONS
•
ikHandle
•
ikHandleCtx
•
ikHandleDisplayScale
•
ikSolver
•
ikSplineHandleCtx
•
ikSplineManipCtx
•
ikSystem
•
ikSystemInfo
•
createNode
CHARACTER SETUP 235
POSING SKELETONS | 20 Posing with forward kinematics (FK) For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for inverse kinematics posing can include the following: •
IK handle node (default name: ikHandlen).
•
IK solver node (default name: ikSolvern).
•
IK rotate plane solver node (default name: ikRPSolver).
•
IK single chain solver node (default name: ikSCsolver).
•
IK multi-chain solver node (default name: ikMCsolver).
•
IK Power Animator solver node (default name: ikPAsolver).
•
IK two bone solver node (default name: ik2Bsolver).
•
IK system node (default name: ikSystem). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
POSING WITH FORWARD KINEMATICS (FK) Posing with forward kinematics involves moving and rotating joints directly without using any IK handles. You can move and rotate joints by selecting them and then using the Move Tool or Rotate Tool. You can also scale the selected joints and their bones with the Scale Tool. Note that moving a joint will affect that joint and any joints below it in the skeleton’s hierarchy. However, you can move only the selected joint while keeping the joints below it in place. For more information, see "Moving, rotating, or scaling a joint and its bone" on page 222.
POSING WITH INVERSE KINEMATICS (IK) Posing with inverse kinematics involves using IK handles to pose joint chains. The effect of the IK handle on the joint chain depends on the type of IK solver the IK handle is using. Maya provides three types of IK handles: the IK rotate plane handle, the IK single chain handle, and the IK spline handle. Each type of IK handle uses a different type of IK solver. An IK rotate plane handle uses an IK rotate plane solver, an IK singlechain handle uses an IK single chain solver, and an IK spline handle uses an IK spline solver. Additionally, dependency graph nodes are available for two other types of IK solvers: the IK multi-chain solver (the ikMCsolver node), and the IK Power Animator solver (the ikPAsolver node).
IK rotate plane handles and solvers For more information on using IK rotate plane handles and solvers, see Chapter 21, “Using IK Rotate Plane Handles.”
CHARACTER SETUP 236
PART 3
POSING SKELETONS | 20 Using IK solvers and systems
IK single chain handles and solvers For more information on using IK single chain handles and solvers, see Chapter 22, “Using IK Single Chain Handles.”
IK spline handles and solvers For more information on using IK spline handles and solvers, see Chapter 23, “Using IK Spline Handles.”
USING IK SOLVERS AND SYSTEMS Using IK solvers and systems includes the following: •
"Creating IK solvers" on page 237
•
"Editing IK system attributes" on page 238
•
"Disabling and enabling all IK solver nodes" on page 239
Creating IK solvers When you create joints and IK handles, you use the Joint Tool and the IK Handle Tool. By default, the Joint Tool and the IK Handle Tool offer two IK solvers: an IK rotate plane solver (the ikRPsolver node), and an IK single chain solver (the ikSCsolver node). By default, each IK rotate plane handle you create uses the same IK rotate plane solver (default name: ikRPsolver). Similarly, each IK single chain handle you create uses the same IK single chain solver (default name: ikSCsolver). Consequently, if you edit the attributes of the default ikRPsolver, all the IK rotate plane handles are affected by the editing. You might want to create different IK solvers for different IK handles so that you can fine-tune the IK solvers for certain IK handles only while not affecting other IK handles. Further, you might want to activate an IK solver type that is not available from the interface by default. For example, you might want to use the IK multi-chain (MC) solver. You can create these additional IK solvers with the createNode MEL command. To create additional IK rotate plane solvers: Enter the following MEL command: createNode ikRPsolver;
A new IK rotate plane solver node is created with the default name ikRPsolvern. This solver is available from the Joint Tool, the IK Handle Tool, and the Attribute Editor for any IK handle, in the IK Solver Attribute section. To create additional IK single chain solvers: Enter the following MEL command: createNode ikSCsolver;
A new IK single chain solver node is created with the default name ikSCsolvern. This solver is available from the Joint Tool, the IK Handle Tool, and the Attribute Editor for any IK handle, in the IK Solver Attribute section.
SKELETONS
CHARACTER SETUP 237
POSING SKELETONS | 20 Using IK solvers and systems To create IK multi-chain (MC) solvers: By default, IK multi-chain (MC) solvers are not available from the interface (for example, from the IK Handle Tool). To access an IK multi-chain solver, you first must enter the following MEL command: createNode ikMCsolver;
A new IK multi-chain solver node is created with the default name ikMCsolvern. The solver is available from the Joint Tool, the IK Handle Tool, and the Attribute Editor for any IK handle, in the IK Solver Attribute section. For more information about using the IK multi-chain solver, refer to the description of the ikMCsolver node in the online Node and Attribute Reference documentation. Note that an IK handle’s Priority and Weight attributes apply only to the IK multichain solver. The IK multi-chain solver is useful for imparting motion capture data to a skeleton, but in general is not appropriate for most animation situations. The results of the IK multi-chain solver can be difficult to predict and control. However, an example of where using the IK multi-chain solver would be appropriate is in animating the tentacles of an octopus, where many limbs are undergoing complex motions.
Editing IK system attributes Maya’s default IK system organizes Maya’s default IK solvers. The IK system controls whether all the IK handles using IK solvers in the system snap to their end effectors, whether the IK solvers are active, and the order in which Maya evaluates the solvers. To edit attributes with the Attribute Editor: 1
Select the IK system node (default name: ikSystem). The IK system node organizes all the IK solvers available for IK handles. The IK system node is downstream of the available IK solver nodes.
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: ikSystem, Node Behavior, and Extra Attributes. ikSystem The ikSystem window lists the IK solvers in the IK system. By default, the available IK solvers are the ikRPsolver (for IK rotate plane handles), the ikSCsolver (for IK single chain handles), and the ikSplineSolver (for IK spline handles). The order in which the IK solvers are listed informs you of the order in which Maya evaluates the solvers.
Global Snap
Specifies whether all the IK handles using any of the IK system’s solvers will snap back to their end effectors. Turning Global Snap off has the effect turning off each IK handle’s Snap Enable attribute. Click on or off. Default is on.
Global Solver
Specifies whether all the IK handles using any of the IK system’s solvers are active. If off, you can only use forward kinematics (FK) posing to pose the joint chains controlled by the IK handles. Click on or off. Default is on.
CHARACTER SETUP 238
PART 3
POSING SKELETONS | 20 Switching between IK and FK Node Behavior See "Editing node behavior to improve performance" on page 208. Extra Attributes (No extra attributes by default.)
Disabling and enabling all IK solver nodes You can quickly disable or enable all the IK solvers. To disable all IK solvers: Turn off Modify > Enable Nodes > IK Solvers. To enable all IK solvers: Turn on Modify > Enable Nodes > IK Solvers.
SWITCHING BETWEEN IK AND FK IK is the easiest way to position the end of a joint chain on a particular object or point in space. FK is the easiest way to animate joint chains with detailed arc motions. In any joint chain that has an IK handle, you can switch conveniently between IK and FK (or vice versa) with a smooth transition between the motions. The following menu items and options make this possible: Animate > IK/FK Switching Keys > Enable IK Solver This menu item controls whether an IK handle’s Solver Enable attribute is on or off. By default, an IK handle’s Solver Enable attribute is on, which means you can use the handle to manipulate the joint chain. If you turn off the Solver Enable attribute, you can manipulate the joint chain by rotating the joints directly. You can use IK again by turning on the Solver Enable attribute. To conveniently display whether a selected IK handle’s Solver Enable attribute is on or off, turn on Display > Heads Up Display > Animation Details. Animate > IK/FK Switching Keys > Set IK/FK Key You must use this menu item rather than Animate > Set Key when you want to key IK animation followed by FK animation (or vice versa) on the same joint chain. When you use Set IK/FK Key while an IK handle or its joint chain is selected, Maya keys all attributes of the handle and all joints in the chain. Maya does additional operations to ensure the transition between IK and FK works correctly. Animate > IK/FK Switching Keys > Connect to IK/FK You can use geometry, a group node, or some other node to manipulate an IK handle rather than the IK handle itself. For example, you can point-constrain a cone to an IK handle with the objective of using the cone as an easily selectable object for manipulating the IK handle. To do this, select the cone and then the handle, and then select Animate > IK/FK Switching Keys > Connect to IK/FK. SKELETONS
CHARACTER SETUP 239
POSING SKELETONS | 20 Switching between IK and FK Thereafter, you can select and manipulate the cone and then use Animate > IK/FK Switching Keys > Set IK/FK Key. There is no need to select the handle. Note that if you turn on Display > Heads Up Display > Animation Details while the cone is selected, the Enable State of the handle is displayed in the scene view just as if the handle were selected. Animate Key > Set Key ❒ If you turn on Set IK/FK Keys in the options window for Animate Key > Set Key ❒, you can subsequently use Animate Key > Set Key as an alternative to Animate > IK/ FK Switching Keys > Set IK/FK Key. Note that if you use Animate Key > Set Key for an object that’s not an IK handle, a joint controlled by an IK handle, or an object connected to an IK handle, the Set IK/ FK Keys option is ignored.
Procedures for switching between IK and FK Several common ways to switch between FK and IK follow: To use IK followed by FK: 1
Animate the IK animation sequence using Animate > IK/FK Switching Keys > Set IK/FK Key.
2
At the right-most frame in the Time Slider where you used Set IK/FK Key, select the IK handle and turn off Animate > IK/FK Switching Keys > Enable IK Solver.
3
Select Set IK/FK Key again.
4
Continue using Set IK/FK Key for the remaining frames of the FK animation, as desired. To use FK followed by IK:
1
At the first frame where you want to use FK, select the IK handle and turn off Animate > IK/FK Switching Keys > Enable IK Solver.
2
Select Animate > IK/FK Switching Keys > Set IK/FK Key.
3
Rotate the joints and use Set IK/FK Key as desired for the remaining frames of the FK animation.
4
At the right-most frame in the Time Slider where you used Set IK/FK Key, select the IK handle and turn on Animate > IK/FK Switching Keys > Enable IK Solver.
5
Select Animate > IK/FK Switching Keys > Set IK/FK Key.
6
Manipulate the IK handle and continue using Set IK/FK Key as desired for the remaining frames of the IK animation. See "Example of switching from FK to IK" on page 242 for a detailed example. To insert IK within FK animation (whether or not the FK is controlled by Set IK/ FK Key):
1
CHARACTER SETUP 240
At the beginning frame of the time range where you want to insert IK, select the IK handle and set a key by selecting Animate > IK/FK Switching Keys > Set IK/FK Key.
PART 3
POSING SKELETONS | 20 Switching between IK and FK 2
At the ending frame of the time range where you want to insert IK, select the IK handle and set a key by selecting Animate > IK/FK Switching Keys > Set IK/FK Key. We refer to the keys you set in the prior two steps as bounding keys, because they ensure that any keys you set between them will not spoil animation outside their range.
3
Turn on Animate > IK/FK Switching Keys > Enable IK Solver.
4
Manipulate the IK handle and use Set IK/FK Key as desired for the frames between the bounding keys. To insert FK within IK animation controlled by Set IK/FK Key:
1
At the beginning frame of the time range where you want to insert IK, select the IK handle and set a key by selecting Animate > IK/FK Switching Keys > Set IK/FK Key.
2
At the ending frame of the time range where you want to insert IK, select the IK handle and set a key by selecting Animate > IK/FK Switching Keys > Set IK/FK Key. We refer to the keys you set in the prior two steps as bounding keys. They ensure that any keys you set between them will not inadvertently spoil animation outside of their range.
3
Turn off Animate > IK/FK Switching Keys > Enable IK Solver.
4
Rotate the desired joints and use Set IK/FK Key as necessary for the frames between the bounding keys. To insert FK within IK animation not controlled by Set IK/FK Key:
1
At the first frame of the animation, select the IK handle, turn on Solver Enable, and set a key for Solver Enable.
2
At the ending frame of the time range where you want to insert IK, select the IK handle and set a key by selecting Animate > IK/FK Switching Keys > Set IK/FK Key.
3
At the beginning frame of the time range where you want to insert IK, select the IK handle and set a key by selecting Animate > IK/FK Switching Keys > Set IK/FK Key. We refer to the keys you set in the prior two steps as bounding keys. They ensure that any keys you set between them will not inadvertently spoil animation outside of their range.
4
Turn off Animate > IK/FK Switching Keys > Enable IK Solver.
5
Rotate the desired joints and use Set IK/FK Key as necessary for the frames between the bounding keys. To eliminate unexpected joint flipping after enabling the IK Solver: After FK animation, a joint chain might flip to an undesired position when you turn on Animate > IK/FK Switching Keys > Enable IK Solver. (You turn on Enable IK Solver when you want to start using IK.) To undo the joint flipping and prevent it from occurring when you turn on Enable IK Solver, do these steps:
SKELETONS
CHARACTER SETUP 241
POSING SKELETONS | 20 Switching between IK and FK 1
Undo the Enable IK Solver menu item to return the joint chain to the position it had before flipping.
2
Select the IK handle and then Skeleton > Set Preferred Angle.
3
Select Animate > IK/FK Switching Keys > Enable IK Solver.
4
Select Animate > IK/FK Switching Keys > Set IK/FK Key.
5
Continue using IK as desired.
About the Graph Editor display resulting from Set IK/FK Key When you switch between IK and FK (and vice versa), the Graph Editor displays the animation curves of an IK handle and its joints partly as solid lines and partly as dotted lines. When you display an animation curve for Translate X, Y, or Z of an IK handle, the curve is displayed as a solid line when IK Solver Enable is on. The curve is a dotted line when Solver Enable is off. In other words, the solid line show where the IK handle controls the joint chains animation. The dotted line shows where FK (keyed joint rotations) controls the animation.
Solver Enable is on
Solver Enable is off
The reverse is true for a selected joint in the handle’s joint chain. When you display an animation curve for Rotate X, Y, or Z of a joint, the curve is displayed as a solid line when IK Solver Enable is off. The curve is a dotted line when Solver Enable is on. In other words, the solid line shows where FK controls the animation. The dotted line show where IK has control.
Example of switching from FK to IK Suppose you want to animate a character’s arm motion while bowling. Your objective is to have the arm move from the wind-up position to the ball-release position, and then have the wrist move to the character’s mouth, as if he is anxious to score a strike. The arc of the arm from the wind-up position to the ball release position is easiest to create with FK. The follow-through motion of touching the mouth is easiest to create with IK.
CHARACTER SETUP 242
PART 3
POSING SKELETONS | 20 Switching between IK and FK
Wind-up position
Ball-release position
Wrist-on-mouth position
The following example shows how to do this. The example assumes you have a skeleton with an IK handle from shoulder to wrist of the right arm. To create an arm’s bowling motion: 1
Select the arm’s IK handle or any joint controlled by the handle.
2
Turn off Animate > IK/FK Switching Keys > Enable IK Solver. With this setting, you can directly rotate any joint controlled by the handle.
3
At frame 1, rotate the shoulder and elbow joints to put the arm in the wind-up position.
4
Make sure either the elbow or shoulder joint is selected, and then select Animate > IK/FK Switching Keys > Set IK/FK Key. Maya keys all joints controlled by the handle regardless of which joint of the handle is selected.
5
At frame 40, rotate the shoulder and elbow joints to put the arm in the ball-release position.
6
Select Animate > IK/FK Switching Keys > Set IK/FK Key.
7
Turn on Animate > IK/FK Switching Keys > Enable IK Solver.
8
At frame 60, drag the IK handle so that the wrist touches the mouth.
9
Select Animate > IK/FK Switching Keys > Set IK/FK Key. Note that you could have used the IK handle to move the arm to the wind-up position. If you use an IK handle for the initial pose of a joint chain, you must turn off Enable IK Solver if you thereafter want to rotate individual joints (FK) previously controlled by the handle.
SKELETONS
CHARACTER SETUP 243
POSING SKELETONS | 20 Switching between IK and FK
CHARACTER SETUP 244
PART 3
21
USING IK ROTATE PLANE HANDLES IK rotate plane handles provide a way to pose joint chains. IK rotate plane handles direct the joint rotations of all the joints in the chain, but enable you to control the overall rotation of a joint chain directly.
SKELETONS
CHARACTER SETUP 245
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles
UNDERSTANDING IK ROTATE PLANE HANDLES
The IK rotate plane handle is ideal for posing joint chains (such as arms and legs) that you would like to stay in more or less the same plane, even though that plane can rotate. For example, the shoulder, elbow, and wrist joints of an arm all stay within the same plane, but that plane rotates as the shoulder joint rotates. The rest of this section describes various features of an IK rotate plane handle. You need not understand all of these features to use IK rotate plane handles effectively; however, to get the most out of using IK rotate plane handles, you should eventually become familiar with all these features.
Start and end joints
Start joint
End joint
The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle.The start joint could be the skeleton’s root joint, or any other joint in the skeleton’s action hierarchy above the end joint. The start joint must be a ball joint. It must be free to rotate completely about all three of its local axes. The end joint is the last joint in the joint chain controlled by the IK handle.The end joint must be below the start joint in the skeleton’s action hierarchy.
CHARACTER SETUP 246
PART 3
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles
Handle position control gnomon
You can control the IK rotate plane handle’s position by moving the handle’s gnomon
You control the IK rotate plane handle’s position by selecting the IK handle’s gnomon and moving it. The joint chain moves as you move the IK handle. (Note that the term “gnomon” refers to Maya’s axial icons; for example, a locator is also a gnomon). Note that with the IK single chain handle, you can move and rotate the IK handle’s gnomon. This is because the IK single chain solver can consider both position and orientation, but the IK rotate plane solver only considers position. The difference between an IK single chain handle and an IK rotate plane handle is that the IK rotate plane handle give you direct control over orientation rather than having the orientation calculated by the IK solver. You can exercise direct control by manipulating the twist disc (see"Twist disc" on page 250) or by moving the pole vector (see "Pole vector" on page 251). When you move the IK rotate plane handle’s position, you indicate where you want the IK handle’s end effector to be.
End effector
End effector located by default at the end joint’s local rotation axis
By default, the end effector is not displayed, but it is located at the end joint’s local axis. However, if you like, you can offset the end effector’s position from the end joint. The end effector does not move from its location at the end joint (or at some offset from the end joint) during posing and animating. The end effector is parented to the parent joint of the end joint, influencing all the joints in the joint chain. To view the hierarchical relationships between the end effector and the joints, you can view the scene hierarchy with the Hypergraph. For an IK rotate plane handle, the goal of the end effector is to reach the IK handle’s position. As you move the IK rotate plane handle’s position, the IK rotate plane solver calculates how to rotate all the joints in the joint chain so that the end effector can reach the IK handle’s position.
SKELETONS
CHARACTER SETUP 247
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles The end effector tries to keep up with the IK handle’s position at all times. However, depending on the rotational limits and fully extended length of the joint chain, the end effector might not be able to reach IK handle.
Handle wire Handle wire runs through all the joints in the joint chain controlled by the IK handle
The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle. The handle wire begins at the start joint’s local axis and ends at the end effector, which is by default at the end joint’s local axis.
Handle vector Handle vector runs directly from start joint to end effector, which is at the end joint by default.
The handle vector is the line drawn from the start joint to the IK handle’s end effector. The end effector is normally located at the IK chain’s end joint.
CHARACTER SETUP 248
PART 3
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles
Rotation disc
Rotation disc
The rotation disc is located at the start joint. The rotation disc indicates how the joint chain can rotate. The rotation disc includes the joint chain plane indicator (see "Joint chain plane indicator" on page 250), the reference plane indicator (see "Reference plane indicator" on page 252), and the twist indicator (see "Twist indicator" on page 252).
Joint chain plane
Joint chain plane is the plane in which all the joints approximately lie
The joint chain plane is the plane that would best contain all the joints in the joint chain. By always containing the joints in the joint chain, the joint chain plane controls how the joint chain can twist. The joint chain plane can rotate about the handle vector. Rotating the joint chain plane about the handle vector has the effect of twisting the joint chain. The joint chain plane is not displayed, but you can infer it from where the joint chain’s joints are located. The joint chain plane’s orientation is indicated by the joint chain plane indicator displayed in the rotation disc.
SKELETONS
CHARACTER SETUP 249
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles
Joint chain plane indicator Joint chain plane indicator indicates the orientation of the joint chain plane
The plane indicator can be thought of as the shadow of the joint chain plane in the rotation disc. The plane indicator indicates the orientation of the joint chain plane relative to the reference plane.
Twist disc
Use the twist disc to change the joint chain’s orientation
The twist disc is located at the end joint. The twist disc is a manipulator for twisting the joint chain by rotating the joint chain plane.
CHARACTER SETUP 250
PART 3
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles
Reference plane
Reference plane
For the joint chain plane to rotate and twist the joint chain, the plane must rotate relative to some other plane so that the degree of twist can be measured. The plane that the joint chain plane rotates relative to is the reference plane. The difference between the two planes indicates the amount the joint chain twists. The reference plane is defined by the handle vector and the pole vector.
Pole vector Pole vector
The pole vector starts at the start joint, and with the handle vector defines the reference plane. Because moving the pole vector changes the orientation of the reference plane, moving the pole vector can also change the orientation of the joint chain directly, just as manipulating the twist disc can change the orientation of the joint chain. This is because the joint chain’s degree of orientation, or twist, is defined as the difference in orientation between the reference plane and the joint chain plane. During posing, if the handle vector and the pole vector happen to cross each other or point in exactly opposite directions, the joint chain can suddenly flip. The joint chain can suddenly flip because when the vectors cross or point in opposite directions, the orientation of the reference plane relative to the joint chain plane suddenly changes by 180 degrees. You can prevent the flipping by moving the pole vector so that the handle vector will not cross it or point in the opposite direction of it.
SKELETONS
CHARACTER SETUP 251
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane handles
Reference plane indicator Reference plane indicator
The reference plane indicator is the green dot located on the twist disc. The reference plane indicator indicates the orientation of the reference plane. You can think of the plane indicator as indicating the shadow of the reference plane in the rotation disc.
Twist indicator
Twist indicator
On the rotation disc, the green arc between the reference plane indicator and the joint chain plane indicator is the twist indicator. The twist indicator shows the orientation of the joint chain plane relative to the reference plane.
Related MEL commands MEL commands related to IK rotate plane handles include the following: •
ikHandle
•
ikHandleCtx
•
ikHandleDisplayScale
•
ikSolver For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for posing with IK rotate plane handles can include the following: •
IK handle node (default name: ikHandlen).
•
IK rotate plane solver node (default name: ikRPsolver).
CHARACTER SETUP 252
PART 3
USING IK ROTATE PLANE HANDLES | 21 Understanding IK rotate plane solver behavior For more information about these nodes, refer to the online Node and Attribute Reference documentation.
UNDERSTANDING IK ROTATE PLANE SOLVER BEHAVIOR The rotate plane solver first looks at the position (the translate x, y, and z attributes) of the goal. Next, the solver figures out how to move the position of the end effector as close to the goal’s position as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. Unlike the single chain solver, the rotate plane solver does not look at the orientation (the rotate x, y, and z attributes) of the goal. That is, the rotate plane solver figures out how to rotate the joints based on the goal’s position, but not on the goal’s orientation. The orientation of the entire joint chain can be controlled by twisting the joint chain with the twist disc. However, unlike the single chain solver, you cannot rotate the joint chain by rotating the IK handle’s goal. Joint chains that consist of between two and four joints are the easiest to pose with IK rotate plane handles. Extremely long IK chains can become awkward to pose and animate. Note that the joint chain controlled by an IK handle using a rotate plane solver cannot have any other IK handles running through any of its joints.
CREATING IK ROTATE PLANE HANDLES To create an IK handle, you use the IK Handle Tool. The characteristics of the IK handle you create depend on the IK Handle Tool’s tool settings.
Specifying IK Handle Tool’s tool settings To specify tool settings: 1
Select Skeleton > IK Handle Tool ❒.
2
The Tool Settings window is displayed.
3
Set the Tool Defaults tab’s IK Handle Options as follows: IK Handle Options
Current Solver
Specifies the IK handle’s solver. To create an IK rotate plane handle, be sure ikRPSolver is selected. Selecting ikSCSolver specifies that the IK handle be an IK single chain handle. If you want to use an IK single chain handle, see Chapter 22, “Using IK Single Chain Handles.” Default is ikRPSolver.
Autopriority
(Does not apply to IK rotate plane handles.)
Solver Enable
Specifies whether the IK solver will be on, enabling inverse kinematics (IK) posing. Default is on.
Snap Enable
Specifies whether the IK handle will snap back to the IK handle’s end effector. Default is on.
Sticky
Specifies that the IK handle will stick to its current position and orientation while you pose the skeleton with other IK handles or by translating, rotating, or scaling joints directly. Default is off.
SKELETONS
CHARACTER SETUP 253
USING IK ROTATE PLANE HANDLES | 21 Posing IK rotate plane handles Priority
(Does not apply to IK rotate plane handles.)
Weight
(Does not apply to IK rotate plane handles.)
POWeight
(Does not apply to IK rotate plane handles.) •
Click Reset Tool to reset to the default tool settings. or
•
Click Close to close the Tool Settings window. Note that you can change the tool settings whenever you are using the Joint Tool by selecting Window > Settings/Preferences > Tool Settings.
Creating an IK rotate plane handle Before you create an IK rotate plane handle, be sure to check the IK Handle Tool’s tool settings (select Skeleton > IK Handle Tool ❒). Current Solver should be set to ikRPsolver. Also, note that the start joint must be a ball joint. To create a IK rotate plane handle: 1
Select Skeleton > IK Handle Tool.
2
In the workspace, click on the joint where you want to start the IK rotate plane handle. Note that the start joint must be a ball joint: it must be free to rotate completely about all three of its local axes. Be sure the start joint has no rotational limits or locked attributes.
3
Click on the joint where you want to end the IK rotate plane handle. An IK rotate plane handle is created based on the IK Handle Tool’s previously set tool settings. Maya draws a box around the start joint if the joint is not a ball joint. For the IK handle to work properly, the start joint must be a ball joint. Check if there are any rotational limits or locked attributes that prevent the joint from rotating freely about all three of its local axes.
POSING IK ROTATE PLANE HANDLES You can pose an IK rotate plane handle as described in the following topics:
Moving the handle To move the handle: 1
Select the IK rotate plane handle (default name: ikHandlen).
2
Click the Move Tool on (default shortcut: w key).
3
In the workspace, while pressing the left or middle mouse button, move the IK handle as desired. Doing so poses the joint chain controlled by the IK handle.
Manipulating the pole vector To manipulate the pole vector: 1
CHARACTER SETUP 254
Select the IK rotate plane handle (default name: ikHandlen).
PART 3
USING IK ROTATE PLANE HANDLES | 21 Editing IK rotate plane handles 2
Click the Show Manipulator Tool on (default shortcut: t key). The IK handle’s pole vector, twist disc, and rotation disc are displayed.
3
In the workspace, while pressing the left or middle mouse button, move the pole vector as desired. Doing so poses the joint chain controlled by the IK handle. Note that as you move the pole vector, the rotation disc’s reference plane indicator (by default, a green dot along the disc) moves to reflect the movement of the pole vector. For most applications, such as controlling a character’s arm, you can fully control the action of the IK handle by manipulating the pole vector. For convenience, you can constrain the pole vector to some other object (for example, a locator) so that you can more readily control the pole vector to pose the joint chain. For more information about constraining the pole vector to some other object, see Chapter 36, “Using Pole Vector Constraints.”
Manipulating the twist disc To manipulate the twist disc: 1
Select the IK rotate plane handle (default name: ikHandlen).
2
Click the Show Manipulator Tool on (default shortcut: t key). The IK handle’s pole vector, twist disc, and rotation disc are displayed. Notice that the twist disc is blue by default.
3
Click on the twist disc. The twist disc now turns yellow by default.
4
While pressing the left or middle mouse button, rotate the twist disc as desired. The joint chain controlled by the IK handle rotates about the handle vector. Note that this action changes the value of the IK handle’s Twist channel.
Controlling joint chain flipping During posing, if the handle vector and the pole vector happen to cross each other or point in exactly opposite directions, the joint chain can suddenly flip. The joint chain can suddenly flip because when the vectors cross or point in opposite directions, the orientation of the reference plane relative to the joint chain plane suddenly changes by 180 degrees. You can prevent the flipping by moving the pole vector so that the handle vector will not cross it or point in the opposite direction of it (see "Manipulating the pole vector" on page 254).
EDITING IK ROTATE PLANE HANDLES You can edit IK rotate plane handles as described in the following topics:
Editing IK rotate plane handle channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit an IK rotate plane handle’s channels.
SKELETONS
CHARACTER SETUP 255
USING IK ROTATE PLANE HANDLES | 21 Editing IK rotate plane handles To edit channels with the Channel Box: 1
Select an IK handle (default name: ikHandlen). Note that the Channel Box lists the IK handle’s IK solver under INPUTS. An IK rotate plane handle should have the ikRPsolver listed. You can edit the IK solver attributes with the Attribute Editor. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Translate X, Y, Z
Specifies the position of the IK handle.
Rotate X, Y, Z
Specifies the orientation of the IK handle.
Scale X, Y, Z
Specifies the scaling of the IK handle. Note that the scale of the IK handle does not affect how the IK handle poses the joint chain.
Visibility
Specifies whether the IK handle is displayed. Enter on or off.
Solver Enable
Specifies whether the IK handle’s IK solver is on or off. If off, the IK handle has no effect on the joint chain; the joint chain can only be posed by forward kinematics (FK). Enter on or off.
Pole Vector X, Y, Z
Specifies the position of the pole vector’s end point. You can control the pole vector’s position by moving it directly (see "Manipulating the pole vector" on page 254).
Offset
(Does not apply to IK rotate plane handles.)
Roll
(Does not apply to IK rotate plane handles.)
Twist
Specifies the rotation of the joint chain plane relative to the reference plane. The effect of this is to rotate the joint chain controlled by the IK rotate plane handle. You can also control the rotation of the joint chain by manipulating the twist disc (see "Manipulating the twist disc" on page 255). 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing IK rotate plane handle attributes To edit attributes with the Attribute Editor: 1
Select the IK handle node (default name: ikHandlen).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Skeleton Info, IK Handle Attributes, IK Solver Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes
Translate
CHARACTER SETUP 256
Specifies the position of the IK rotate plane handle.
PART 3
USING IK ROTATE PLANE HANDLES | 21 Editing IK rotate plane handles Rotate
Specifies the rotation of the IK rotate plane handle. Note that the rotation of the handle does not affect the posing of the joint chain.
Scale
Specifies the scaling of the IK rotate plane handle. Note that the scaling of the handle does not affect the posing of the joint chain.
Shear
Specifies the shearing of the IK rotate plane handle. Note that the shearing of the handle does not affect the posing of the joint chain.
Rotate Order
Specifies the IK handle’s rotation order. For example, if the rotation order is xyz, the handle first rotates about its X-axis, then its Y-axis, and finally its Z-axis. Select xyz, yzx, zxy, xzy, yxz, zyx. Default is xyz.
Rotate Axis
Specifies the orientation of the IK handle to the orientation of the start joint’s local rotation axis.
Inherits Transform
Specifies whether the IK handle can be affected by the translation, rotation, or scaling of a parent object. Skeleton Info
Start Joint
Informs you of the name of the start joint of the joint chain controlled by the IK rotate plane handle. Click on the > icon button to get the Attribute Editor for the start joint.
End Effector
Informs you of the name of the IK handle’s end effector. Click on the > icon button to get the Attribute Editor for the end effector. If you do so, note that the end effector’s Translate X, Y, and Z attributes are locked. They are locked because the end effector is parented to the end joint of the joint chain controlled by the IK rotate plane handle. IK Handle Attributes
Snap Enable
Specifies whether the IK handle will snap back to the IK handle’s end effector. Click on or off. Default is on.
Stickiness
Specifies that the IK handle will stick to its current position while you pose the skeleton with other IK handles or by translating, rotating, or scaling joints directly. Click on or off. Default is off.
Priority
(Does not apply to IK rotate plane handles.)
Weight
(Does not apply to IK rotate plane handles.)
Po Weight
(Does not apply to IK rotate plane handles.) IK Solver Attributes
Solver Enable
Specifies whether the IK handle’s IK solver is on or off. If off, the IK handle has no effect on the joint chain. Turning Solver Enable off turns off IK posing so that you have to use forward kinematics (FK) posing. Enter on or off.
IK Solver
Specifies the IK handle’s solver. For an IK rotate plane handle, ikRPSolver should be selected. Selecting ikSCSolver specifies that the IK handle be an IK single chain handle. If you want to use an IK single chain handle, see Chapter 22, “Using IK Single Chain Handles.” Default is ikRPSolver.
Pole Vector
Specifies the position of the pole vector’s end point. You can control the pole vector’s position by moving it directly (see "Manipulating the pole vector" on page 254).
SKELETONS
CHARACTER SETUP 257
USING IK ROTATE PLANE HANDLES | 21 Editing IK rotate plane handles Twist
Specifies the rotation of the joint chain plane relative to the reference plane. The effect of this is to rotate the joint chain controlled by the IK rotate plane handle. You can also control the rotation of the joint chain by manipulating the twist disc (see "Manipulating the twist disc" on page 255). Pivots Specifies whether to display the IK handle’s rotate pivot and scale pivot. The Local Space and World Space sections specify the pivot positions in local space (relative to the IK handle) and world space. Limit Information Specifies limits on the IK handle’s translation, rotation, and scaling attributes. Select the Translate, Rotate, or Scale sections. Translate
Trans Limit X
Specifies translation limits on the IK handle’s Translate X attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Y
Specifies translation limits on the IK handle’s Translate Y attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Z
Specifies translation limits on the IK handle’s Translate Z attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Rotate
Rot Limit X
Specifies rotation limits on the IK handle’s Rotate X attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Y
Specifies rotation limits on the IK handle’s Rotate Y attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Z
Specifies rotation limits on the IK handle’s Rotate Z attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Scale
Scale Limit X
Specifies scaling limits on the IK handle’s Scale X attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Y
Specifies scaling limits on the IK handle’s Scale Y attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Z
Specifies scaling limits on the IK handle’s Scale Z attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
CHARACTER SETUP 258
PART 3
USING IK ROTATE PLANE HANDLES | 21 Editing IK rotate plane handles Display Specifies display attributes for the IK handle’s selection handle, local axis, position offset values for the selection handle, the show manipulator default, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See "Editing node behavior to improve performance" on page 208. Extra Attributes (No extra attributes by default.)
Editing IK rotate plane solver attributes To edit attributes with the Attribute Editor: 1
Select the IK rotate plane solver (default name: ikRPsolver). Note that changes to solver will affect all the IK handles that use it.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: IK Solver Attributes, Node Behavior, and Extra Attributes. IK Solver Attributes
Max Iterations
Specifies the maximum number of iterations the IK solver will take in calculating how the end effector reaches the IK handle. If the Tolerance cannot be meet after Max Iterations, the IK solver will stop. Default is 2147483647. A large value such as the default value means that the IK solver will typically stop when the Tolerance is met.
Tolerance
Specifies the precision sought by the IK solver in calculating how the end effector reaches the IK handle. Once the IK solver meets the Tolerance, the IK solver stops calculating. Default is 0.0001. Node Behavior See "Editing node behavior to improve performance" on page 208. Extra Attributes (No extra attributes by default.)
SKELETONS
CHARACTER SETUP 259
USING IK ROTATE PLANE HANDLES | 21 Deleting IK rotate plane handles
DELETING IK ROTATE PLANE HANDLES To delete an IK rotate plane handle: 1
Select the IK rotate plane handle (default name: ikHandlen).
2
Select Edit > Delete (default shortcut: Backspace key). The IK handle is deleted. However, note that the handle’s IK rotate plane solver is not deleted. The solver is still available for the other IK rotate plane handles that use it.
CHARACTER SETUP 260
PART 3
22
USING IK SINGLE CHAIN HANDLES IK single chain handles provide a way to pose joint chains. IK single chain handles direct the rotations of all the joints in the chain and the overall orientation of the joint chain.
SKELETONS
CHARACTER SETUP 261
USING IK SINGLE CHAIN HANDLES | 22 Understanding IK single chain handles
UNDERSTANDING IK SINGLE CHAIN HANDLES
The IK single chain handle is a straightforward tool for posing and animating a chain anywhere the joint chain can reach in the scene’s world space. The joint chain will tend to stay within the plane that best includes all the joint chain’s joints. Note that the IK rotate plane handle provides you with direct control over the joint chain’s orientation (see Chapter 21, “Using IK Rotate Plane Handles”), whereas the IK single chain handle uses its IK solver to calculate the joint chain orientation. The rest of this section describes various features of an IK single chain handle. You need not understand all of these features to use IK single chain handles effectively; however, to get the most out of using IK single chain handles, you should eventually become familiar with all these features.
Start and end joints Start joint End joint
The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle. The start joint could be the skeleton’s root joint or any other joint in the skeleton’s action hierarchy above the end joint. The start joint must be a ball joint. It must be free to rotate completely about all three of its local axes. The end joint is the last joint in the joint chain controlled by the IK handle. The end joint must be below the start joint in the skeleton’s action hierarchy.
CHARACTER SETUP 262
PART 3
USING IK SINGLE CHAIN HANDLES | 22 Understanding IK single chain handles
Handle position and orientation control gnomon You can control the IK single chain handle by moving or rotating the handle’s gnomon
You control the IK single chain handle’s position and orientation by selecting the IK handle’s gnomon and moving or rotating it. The joint chain moves or rotates as you move or rotate the IK handle. (Note that the term “gnomon” refers to Maya’s axial icons; for example, a locator is also a gnomon). When you move or rotate the IK single chain handle’s gnomon, you indicate where you want the IK handle’s end effector to be.
End effector End effector located by default at the end joint’s local rotation axis
By default, the end effector is not displayed, but it is located at the end joint’s local axis. However, if you like, you can offset the end effector’s position from the end joint. The end effector does not move from its location at the end joint (or at some offset from the end joint) during posing and animating. The end effector is parented to the parent joint of the end joint, influencing all the joints in the joint chain. To view the hierarchical relationships between the end effector and the joints, you can view the scene hierarchy with the Hypergraph. For an IK single chain handle, the goal of the end effector is to reach the IK handle’s position and orientation. As you move the IK single chain handle’s position, the IK single chain solver calculates how to rotate all the joints in the joint chain so that the end effector can reach the IK handle’s position and orientation. The end effector tries to keep up with the IK handle’s position at all times. However, depending on the rotational limits and fully extended length of the joint chain, the end effector might not be able to reach IK handle.
SKELETONS
CHARACTER SETUP 263
USING IK SINGLE CHAIN HANDLES | 22 Understanding IK single chain handles
Difference between IK single chain and rotate plane handles The difference between an IK single chain handle and an IK rotate plane handle is that the IK single chain handle’s end effector tries to reach the position and the orientation of its IK handle, whereas the IK rotate plane handle’s end effector only tries to reach the position of its IK handle. Because the IK rotate plane handle’s end effector only tries to reach the position, the resulting joint rotations are more predictable. To control orientation, the IK rotate plane handle provides you with special manipulators such as the twist disc. For more information about IK rotate plane handles, see Chapter 21, “Using IK Rotate Plane Handles.”
Handle wire Handle wire runs through all the joints in the joint chain controlled by the IK handle
The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle.The handle wire begins at the start joint’s local axis and by default ends at the end joint’s local axis.
Handle vector Handle vector runs directly from start joint to end effector, which is at the end joint by default.
The handle vector is the line drawn from the start joint to the IK handle.
Related MEL commands MEL commands related to IK single chain handles include the following: •
ikHandle
•
ikHandleCtx
•
ikHandleDisplayScale
•
ikSolver
CHARACTER SETUP 264
PART 3
USING IK SINGLE CHAIN HANDLES | 22 Understanding IK single chain solver behavior For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for posing with IK single chain handles can include the following: •
IK handle node (default name: ikHandlen).
•
IK single chain solver node (default name: ikSCsolver). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
UNDERSTANDING IK SINGLE CHAIN SOLVER BEHAVIOR The single chain solver first looks at the position (the translate X, Y, and Z attributes) and orientation (the rotate X, Y, and Z attributes) of the IK handle. Next, the solver figures out how to move the position and orientation of the end effector as close to the IK handle’s position and orientation as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. Joint chains that consist of between two and four joints are the easiest to pose with IK single chain handles. Extremely long IK chains can become awkward to pose and animate. For best results, a joint chain controlled by an IK handle using a single chain solver should not have any other IK handles running through any of its joints.
CREATING IK SINGLE CHAIN HANDLES To create an IK handle, you use the IK Handle Tool. The characteristics of the IK handle you create depend on the IK Handle Tool’s tool settings.
Specifying IK Handle Tool’s tool settings To specify tool settings: 1
Select Skeleton > IK Handle Tool ❒.
2
The Tool Settings window is displayed.
3
Set the Tool Defaults tab’s IK Handle Options as follows: IK Handle Options
Current Solver
Specifies which type of IK solver the IK handle will have. Selections include ikRPsolver and ikSCsolver. Select ikSCsolver to create a IK single chain handle. The ikRP solver selection is for creating IK rotate plane handles. If you want to create an IK rotate plane handle, see Chapter 21, “Using IK Rotate Plane Handles.” Default is ikRP solver.
Autopriority
Specifies whether Maya sets the IK single chain handle’s Priority automatically upon creation. If Autopriority is on, Maya assigns the IK handle’s Priority based on where the IK handle’s start joint is in the skeleton’s hierarchy. For example, if the IK handle
SKELETONS
CHARACTER SETUP 265
USING IK SINGLE CHAIN HANDLES | 22 Creating IK single chain handles starts at the root joint, the Priority is set to 1. If the IK handle starts at a joint just below the root joint in the skeleton’s hierarchy, the Priority is set to 2, and so on. Default is off. Solver Enable
Specifies whether the IK solver (specified by Current Solver) will be active upon creation. Default is on so that you can immediately pose the joint chain with the IK handle.
Snap Enable
Specifies whether the IK handle will snap back to the IK handle’s end effector. Default is on.
Sticky
Specifies that the IK handle will stick to its current position and orientation while you pose the skeleton with other IK handles or by translating, rotating, or scaling joints directly. Click on or off. Default is off.
Priority
Specifies the priority of the IK single chain handle. Useful if two or more IK single chain handles overlap, affecting some or all of the same joints. The IK handle with a Priority of 1 has first priority, and will rotate the joints first. An IK handle with a Priority of 2 has second priority, and will rotate the joints next, and so on. Default is 1. (Available only if Autopriority is off.)
Weight
(Does not apply to IK single chain handles.)
POWeight
Specifies the position/orientation weight. Controls how the end effector will favor reaching the IK handle’s position versus the IK handle’s orientation. A value of 1 specifies that the end effector will only try to reach the IK handle’s position. A value of 0 specifies that the end effector will only try to reach the IK handle’s orientation. A value of 0.5 specifies that the end effector will equally favor reaching both the position and orientation as closely as possible. Default is 1.0000. •
Click Reset Tool to reset to the default tool settings. or
•
Click Close to close the Tool Settings window. Note that you can change the tool settings whenever you are using the Joint Tool by selecting Windows > General Editors > Tool Settings, or by double-clicking on the IK Handle Tool icon.
Creating an IK single chain handle Before you create an IK single chain handle, be sure to check the IK Handle Tool’s tool settings (select Skeleton > IK Handle Tool ❒). Current Solver should be set to ikSCsolver. Note that the start joint must be a ball joint. To create an IK single chain handle: 1
Select Skeleton > IK Handle Tool.
2
In the workspace, click on the joint where you want to start the IK single chain handle. Note that the start joint must be a ball joint: it must be free to rotate completely about all three of its local axes. Be sure the start joint has no rotational limits or locked attributes.
3
Click on the joint where you want to end the IK single chain handle. An IK single chain handle is created based on the IK Handle Tool’s previously set tool settings (Current Solver should have been set to ikSCsolver).
CHARACTER SETUP 266
PART 3
USING IK SINGLE CHAIN HANDLES | 22 Posing IK single chain handles Maya draws a box around the start joint if the joint is not a ball joint. For the IK handle to work properly, the start joint must be a ball joint. Check if there are any rotational limits or locked attributes that prevent the joint from rotating freely about all three of its local axes
POSING IK SINGLE CHAIN HANDLES You can pose an IK single chain handle as described in the following topics:
Moving the handle To move the handle: 1
Select the IK single chain handle (default name: ikHandlen).
2
Click the Move Tool on (default shortcut: w key).
3
In the workspace, while pressing the left or middle mouse button, move the IK handle as desired. Doing so poses the joint chain controlled by the IK handle.
Rotating the handle To rotate the handle: 1
Select the IK single chain handle (default name: ikHandlen).
2
Click the Rotate Tool on (default shortcut: e key).
3
In the workspace, while pressing the left or middle mouse button, rotate the IK handle as desired. Doing so poses the joint chain controlled by the IK handle.
EDITING IK SINGLE CHAIN HANDLES You can edit IK single chain handles as described in the following topics:
Editing IK single chain handle channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit an IK single chain handle’s channels. To edit channels with the Channel Box: 1
Select an IK handle node (default name: ikHandlen). Note that the Channel Box lists the IK handle’s IK solver under INPUTS. An IK single chain handle should have the ikSCsolver listed. You can edit the IK solver attributes with the Attribute Editor. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Translate X, Y, Z
Specifies the position of the IK handle.
Rotate X, Y, Z
Specifies the orientation of the IK handle.
SKELETONS
CHARACTER SETUP 267
USING IK SINGLE CHAIN HANDLES | 22 Editing IK single chain handles Scale X, Y, Z
Specifies the scaling of the IK handle. Note that the scale of the IK handle does not affect how the IK handle poses the joint chain.
Visibility
Specifies whether the IK handle is displayed. Enter on or off.
Solver Enable
Specifies whether the IK handle’s IK solver is on or off. If off, the IK handle has no effect on the joint chain. Enter on or off.
Pole Vector X, Y, Z
(These channels do not apply to IK single chain handles.)
Offset
(This channel does not apply to IK single chain handles.)
Roll
(This channel does not apply to IK single chain handles.)
Twist
(This channel does not apply to IK single chain handles.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing IK single chain handle attributes To edit attributes with the Attribute Editor: 1
Select the IK handle node (default name: ikHandlen).
2
Open the Attribute Editor by selecting Windows > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Skeleton Info, IK Handle Attributes, IK Solver Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes
Translate
Specifies the position of the IK single chain handle.
Rotate
Specifies the rotation of the IK single chain handle.
Scale
Specifies the scaling of the IK single chain handle. Note that the scaling of the handle does not affect the posing of the joint chain.
Shear
Specifies the shearing of the IK single chain handle. Note that the shearing of the handle does not affect the posing of the joint chain.
Rotate Order
Specifies the IK handle’s rotation order. For example, if the rotation order is xyz, the handle first rotates about its X-axis, then its Y-axis, and finally its Z-axis. Select xyz, yzx, zxy, xzy, yxz, zyx. Default is xyz.
Rotate Axis
Specifies the orientation of the IK handle to the orientation of the start joint’s local rotation axis.
Inherits Transform
CHARACTER SETUP 268
Specifies whether the IK handle can be affected by the translation, rotation, or scaling of a parent object.
PART 3
USING IK SINGLE CHAIN HANDLES | 22 Editing IK single chain handles Skeleton Info Start Joint
Informs you of the name of the start joint of the joint chain controlled by the IK single chain handle. Click on the > icon button to get the Attribute Editor for the start joint.
End Effector
Informs you of the name of the IK handle’s end effector. Click on the > icon button to get the Attribute Editor for the end effector. If you do so, note that the end effector’s Translate X, Y, and Z attributes are locked. They are locked because the end effector is parented to the end joint of the joint chain controlled by the IK single chain handle. IK Handle Attributes
Snap Enable
Specifies whether the IK handle will snap back to the IK handle’s end effector. Click on or off. Default is on.
Stickiness
Specifies whether the IK handle is sticky. If sticky, the IK handle sticks to its current position and orientation while you pose the skeleton with other IK handles or by translating, rotating, or scaling joints directly. Click on or off. Default is off.
Priority
Specifies the priority of the IK single chain handle. Useful if two or more IK single chain handles overlap, affecting some or all of the same joints. The IK handle with a Priority of 1 has first priority, and will rotate the joints first. An IK handle with a Priority of 2 has second priority, and will rotate the joints next, and so on. Default is 1. Use slider to select values from 1 to 20. Default is 1.
Weight
(Does not apply to IK single chain handles.)
Po Weight
Specifies the position/orientation weight. The position/orientation weight controls how the end effector favors reaching the IK single chain handle’s position versus its orientation. A value of 1.000 specifies that the end effector will only try to reach the IK handle’s position. A value of 0.000 specifies that the end effector will only try to reach the IK handle’s orientation. A value of 0.500 specifies that the end effector will equally favor reaching both the position and orientation as closely as possible. Use slider to select values from 0.000 to 1.000. Default is 1.000. IK Solver Attributes
Solver Enable
Specifies whether the IK handle’s IK solver is on or off. If off, the IK handle has no effect on the joint chain. Enter on or off.
IK Solver
Specifies the IK handle’s solver. For an IK single chain handle, ikSCSolver should be selected. Selecting ikRPSolver specifies that the IK handle be an IK rotate plane handle. If you want to use an IK rotate plane handle, see Chapter 21, “Using IK Rotate Plane Handles.” Pivots Specifies whether to display the IK handle’s rotate pivot and scale pivot. The Local Space and World Space sections specify the pivot positions in local space (relative to the IK handle) and world space. Limit Information Specifies limits on the IK handle’s translation, rotation, and scaling attributes. Select the Translate, Rotate, or Scale sections.
SKELETONS
CHARACTER SETUP 269
USING IK SINGLE CHAIN HANDLES | 22 Editing IK single chain handles Translate Trans Limit X
Specifies translation limits on the IK handle’s Translate X attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Y
Specifies translation limits on the IK handle’s Translate Y attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Z
Specifies translation limits on the IK handle’s Translate Z attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Rotate
Rot Limit X
Specifies rotation limits on the IK handle’s Rotate X attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Y
Specifies rotation limits on the IK handle’s Rotate Y attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Z
Specifies rotation limits on the IK handle’s Rotate Z attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Scale
Scale Limit X
Specifies scaling limits on the IK handle’s Scale X attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Y
Specifies scaling limits on the IK handle’s Scale Y attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Z
Specifies scaling limits on the IK handle’s Scale Z attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Display Specifies display attributes for the IK handle’s selection handle, local axis, position offset values for the selection handle, the show manipulator default, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See "Editing node behavior to improve performance" on page 208. Extra Attributes (No extra attributes by default.)
Editing IK single chain solver attributes To edit attributes with the Attribute Editor: 1
CHARACTER SETUP 270
Select the IK single chain solver node (default name: ikSCsolvern). PART 3
USING IK SINGLE CHAIN HANDLES | 22 Deleting IK single chain handles 2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: IK Solver Attributes, Node Behavior, and Extra Attributes. IK Solver Attributes
Max Iterations
Specifies the maximum number of iterations the IK solver will take in calculating how the end effector reaches the IK handle. If the Tolerance cannot be meet after Max Iterations, the IK solver will stop. Default is 2147483647. A large value such as the default value means that the IK solver will typically stop when the Tolerance is met.
Tolerance
Specifies the precision sought by the IK solver in calculating how the end effector reaches the IK handle. Once the IK solver meets the Tolerance, the IK solver stops calculating. Default is 0.0001. Node Behavior See "Editing node behavior to improve performance" on page 208. Extra Attributes (No extra attributes by default.)
DELETING IK SINGLE CHAIN HANDLES To delete an IK single chain handle: 1
Select the IK single chain handle (default name: ikHandlen).
2
Select Edit > Delete (default shortcut: Backspace key). The IK handle is deleted. However, note that the handle’s IK single chain solver is not deleted. The solver is still available for the other IK single chain handles that use it.
SKELETONS
CHARACTER SETUP 271
USING IK SINGLE CHAIN HANDLES | 22 Deleting IK single chain handles
CHARACTER SETUP 272
PART 3
23
USING IK SPLINE HANDLES IK spline handles provide a way to pose joint chains with a NURBS curve.
The seven IK spline handles on this creature control its neck, back, tail, and flippers.
Plesiosaur by Matt Dougan
UNDERSTANDING IK SPLINE HANDLES You can add an IK spline handle to a joint chain to animate the motion of tails, necks, spines, tentacles, bull-whips, snakes, and similar objects. After you add the handle, Maya’s IK spline solver rotates the joints when you manipulate a curve that’s part of the handle.
Related MEL commands MEL commands related to posing with IK spline handles include the following: •
ikSplineHandleCtx
•
ikSplineManipCtx For more information about these commands, refer to the online MEL Command Reference documentation.
SKELETONS
CHARACTER SETUP 273
USING IK SPLINE HANDLES | 23 Creating IK spline handles
Dependency graph nodes The dependency graph nodes for inverse kinematics posing can include the following: •
IK solver node (default name: ikSolvern).
•
IK spline solver node (default name: ikSplineSolver).
•
IK system node (default name: ikSystem). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
CREATING IK SPLINE HANDLES You add an IK spline handle to a joint chain. To animate the joint chain, you manipulate a curve that’s part of the handle. You don’t manipulate the translation of the handle. You can also roll or twist the joint chain with convenient manipulators. The joint chain can be an independent hierarchy or part of a larger hierarchy. By default, a curve is created for you when you create an IK spline handle. Instead, you can create your own curve before you create the handle. In either case, the joint chain mimics the shape of the curve. To create an IK spline handle with a default curve and options: 1
Create a joint chain. To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
2
Select Skeleton > IK Spline Handle Tool.
3
Select the start joint for the IK handle.
4
Select the end joint for the IK handle. The IK spline handle appears on the joint chain with an automatically created curve. The joints in the chain rotate to adapt to the shape of the curve. To create an IK spline handle with your own curve and options:
1
Use modeling tools to create the curve. Create a simple curve with no sharp bends to ensure the joint chain moves smoothly when you animate the curve. If you create a curve with fewer CVs, your control of the curve’s shape and skeleton’s movement will be less precise, but you’ll be able to manipulate the curve and its joint chain easier. With fewer CVs, you spend less time selecting and dragging CVs, and you’re more likely to have a smooth curve. Start with a curve having as few CVs as necessary. Add CVs only as needed to improve control.
2
Create a joint chain. To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
3
CHARACTER SETUP 274
Select Skeleton > IK Spline Handle Tool ❐. PART 3
USING IK SPLINE HANDLES | 23 Creating IK spline handles The Tool Settings window appears. Set options as described in "Setting options before creating the IK spline handle" on page 278. Turn off Auto Create Curve. The option settings are saved for future use. 4
Select the start joint for the IK handle.
5
Select the end joint for the IK handle.
6
Select the curve. The IK spline handle appears on the joint chain. The joints in the chain rotate to adapt to the shape of the curve. If the curve is shorter than the joint chain, the extra length of the joint chain points out from the end of the curve in a straight line.
Animating the joint chain To animate the joint chain, you set keys for the appropriate attributes after you do any of these actions: •
manipulate the CVs of the curve
•
twist and roll the joint chain
•
slide the joint chain along the curve
•
translate, rotate, and scale the curve To see the effects of animating the joint chain more clearly, bind skin to the joint chain. To manipulate the CVs of the curve:
1
Select the curve. You can select the curve conveniently in the Outliner or Hypergraph. It’s helpful to display CVs and hulls as you work with CVs. With the curve selected, turn on Display > NURBS Components > CVs, and also turn on Hulls.
2
Move the CVs. Use the Move Tool on the CVs. or From the Modeling menu, select Edit Curves > Curve Editing Tool.
3
Select Animate > Set Key to set keys at the desired frames.
Tip To improve speed as you play and scrub your animation, set keys only for the CVs you animate. For instance, select the CVs, then choose Animate > Set Key. If you use the Curve Editing Tool, select Animate > Set Key ❒, turn on the Control Points option, and click the Save button. Thereafter when you choose Set Key, Maya sets keys only for the necessary CVs. To twist and roll the joint chain: 1
SKELETONS
Select the IK spline handle.
CHARACTER SETUP 275
USING IK SPLINE HANDLES | 23 Creating IK spline handles To select the handle in the workspace, drag a selection box around the end joint. The default selection priority ensures you’ll select the handle rather than the end joint. 2
Select Modify > Transformation Tools > Show Manipulator Tool. Circular manipulators appear at the start joint and end joint.
Twist manipulator
Start joint End joint
Roll manipulator
3
To roll the entire joint chain, click and rotate the circular manipulator at the start joint.
4
To twist the joint chain, click and rotate the circular manipulator at the end joint. You can also adjust twist and roll by selecting the IK handle and entering values for Roll and Twist in the Channel Box or Attribute Editor. In the Attribute Editor, expand the IK Solver Attributes section to see these attributes.
5
Set keys for the handle’s Roll and Twist attributes. If the IK handle’s Solver Enable is on, the solver doesn’t use the IK handle’s Translate, Rotate, and Scale values as it rotates joints. To slide the joint chain along the curve:
1
Select the IK handle. To select the IK handle, turn on (Select by object type) then drag a selection box around the end joint of the handle. The default selection priority ensures you’ll select the handle rather than the end joint.
2
Choose Window > Attribute Editor to display the Attribute Editor.
3
Expand the IK Solver Attributes section.
4
Turn on Root on Curve. This constrains the start joint of the IK spline handle to a position on the curve. It also provides an offset manipulator to slide the start joint along the curve.
5
Choose Modify > Transformation Tools > Show Manipulator Tool. The offset manipulator appears at the start joint.
CHARACTER SETUP 276
PART 3
USING IK SPLINE HANDLES | 23 Creating IK spline handles
Offset manipulator at the start joint
6
Drag the manipulator to slide the joint chain along the curve. If you drag the start joint to the end of the curve, the child joints move off the end of the curve in a straight line.
Offset manipulator at the end of the curve
You cannot drag the manipulator past either end of the curve. You can also enter values for Offset in the Attribute Editor to move the start joint’s offset manipulator along the curve. Try various values over 0 to get the desired position. The Offset attribute is ignored if you turn Root on Curve off. 7
Set keys for the Offset at the desired frames.
Note If you use Offset (or the offset manipulator) to animate a joint chain sliding on a curve, the start joint might flip unexpectedly. Use Offset only for small movements or when the start joint doesn’t rotate much. You can also use a motion path to prevent joint flipping. See "Preventing unwanted start joint flipping" on page 282.
SKELETONS
CHARACTER SETUP 277
USING IK SPLINE HANDLES | 23 Creating IK spline handles To translate, rotate, and scale the curve: 1
Select the curve.
2
Use the Move, Rotate, and Scale tools to translate, rotate, or scale the curve. If you created the handle with Root on Curve off, translating, rotating, and scaling the curve doesn’t translate the start joint.
3
Set keys for the appropriate Translate, Rotate, and Scale attributes.
Setting options before creating the IK spline handle This topic describes how to set IK spline handle tool options available before you create the handle. See "Tips for working with IK spline handles" on page 284 for additional information on how to use several of these options. For details on options you can set after creation, see "Setting attributes after creating the IK spline handle" on page 281. To set IK Spline Handle Tool options: 1
Select Skeleton > IK Spline Handle Tool ❐. The Tool Settings window is displayed.
2
In the Tool Settings window, set the following: Root On Curve, Auto Create Root Axis, Auto Parent Curve, Snap Curve To Root, Auto Create Curve, Auto Simplify Curve, Number of Spans, Root Twist Mode, and Twist Type.
Root On Curve If you turn this option on, the start joint of the IK spline handle is constrained to a position on the curve. You can drag an offset manipulator to slide the start joint (and its children) along the curve. If you turn this option off, you can move the start joint away from the curve. The start joint is no longer constrained to the curve. Maya ignores the Offset attribute, and no offset manipulator exists at the start joint.
You can move the start joint and its children off the curve by turning off Root on Curve.
CHARACTER SETUP 278
PART 3
USING IK SPLINE HANDLES | 23 Creating IK spline handles
Note If Root on Curve is off, the solver ignores any motion you previously keyed with Offset. Set keys with Root on Curve off or on, not a mixture of both. If Root on Curve is off and you move the start joint far enough away from the curve so that none of the joints can reach the curve, the bones point straight at the closest point on the curve. If the curve is wavy, the joints jump from closest point to closest point as you move the straightened joint chain towards parts of the curve. This is correct operation. The following figure shows a joint chain in four positions as it points towards the closest part of the curve.
You can also turn Root on Curve on or off after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window > Attribute Editor.
Auto Create Root Axis This option creates a parent transform node above the start joint in the scene hierarchy. You can avoid unexpected start joint flipping by moving and rotating this transform node rather than the start joint. See "Preventing unwanted start joint flipping" on page 282 for details. You can turn this option on only when Root on Curve is off. If you turn on Auto Create Root Axis, you must turn off Auto Parent Curve if you want to use the curve as a motion path. Otherwise, a dependency graph loop occurs, which results in the display of a warning message and incorrect handle operation. You can set Auto Create Root Axis in the Tool Options window only as you create the IK spline handle.
Auto Parent Curve If the start joint has a parent, this option makes the curve a child of that parent. The curve and joints therefore move with the transformations of the parent. If you create a handle that starts at a joint in the chain lower than the root joint of your skeleton, turn this option on so the joint chain moves with the transformations of its parent joint.
SKELETONS
CHARACTER SETUP 279
USING IK SPLINE HANDLES | 23 Creating IK spline handles You can set this option in the Tool Options window only as you create the IK spline handle.
Snap Curve To Root This option affects the handle only if you create your own curve for the handle. If this option is on when you create the handle, the start of the curve snaps to the position of the start joint. The joints in the chain rotate to adapt to the shape of the curve. If you want to move the joint chain to the curve to use the curve as a fixed path, turn this option off. Otherwise, turn this option on. You can set this option in the Tool Options window only as you create the IK spline handle.
Auto Create Curve This option creates a curve used by the IK spline handle. If you turn on Auto Create Curve and turn off Auto Simplify Curve, the curve passes through all the joints. This often creates so many CVs that the curve is unwieldy to manipulate. For this reason, consider turning on Auto Simplify Curve. If you turn on Auto Create Curve and Auto Simplify Curve, creating the handle automatically creates a simplified curve that has a shape similar to the joint chain. The higher the Number of Spans, the closer the curve matches the joint chain. The curve has a curve degree of 3 (cubic). If you turn off Auto Create Curve, you must supply a curve for the joint chain. If the joint chain is part of an existing skeleton, you’ll typically turn this option on. If you’re using a curve as a path for sliding the joint chain, you’ll typically turn this option off. You can set Auto Create Curve in the Tool Options window only as you create the IK spline handle.
Auto Simplify Curve This option sets the automatically created curve to the specified Number of Spans. The number of spans corresponds to the number of CVs in the curve. The curve has a curve degree of 3 (cubic). If you create a curve with fewer CVs, your control of the curve’s shape and skeleton’s movement will be less precise, but you’ll be able to manipulate the curve and its joint chain easier. With fewer CVs, you spend less time selecting and dragging CVs, and you’re more likely to have a smooth curve. This option works only if Auto Create Curve is on. You can set Auto Simplify Curve in the Tool Options window only as you create the IK spline handle.
Number of Spans This option specifies the number of CVs in the curve as follows:
CHARACTER SETUP 280
PART 3
USING IK SPLINE HANDLES | 23 Creating IK spline handles
Number of Spans
CVs
1
4
2
5
3
6
4
7
This option is available only if Auto Create Curve is on. You can set the Number of Spans in the Tool Options window only as you create the IK spline handle.
Root Twist Mode This option turns on Power Animator IK spline twisting. As you turn the twist manipulator at the end joint, the start joint twists slightly with the other joints. With this option off, the start joint doesn’t twist. Use the roll manipulator at the start joint to turn the start joint. You can also set this option after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window > Attribute Editor.
Twist Type This option specifies how the twist occurs in the joint chain: •
Linear twists all parts evenly.
•
Ease In twists more at the end than the start.
•
Ease Out twists more at the start than the end.
•
Ease In Out twists more at the middle than at either end. You can also set Twist Type after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window > Attribute Editor.
Setting attributes after creating the IK spline handle After you create an IK spline handle, you can specify settings for several attributes. To set attributes after creating the IK spline handle: 1
Select the IK handle.
2
Choose Window > Attribute Editor to display the Attribute Editor.
3
Expand the IK Solver Attributes section. The following attributes are displayed:
Solver Enable
SKELETONS
Turning this off disables the IK spline solver. If you’ve bound skin to the joint chain, turn this option off before returning the joint chain to the bind pose.
CHARACTER SETUP 281
USING IK SPLINE HANDLES | 23 Creating IK spline handles While this option is on, avoid moving individual joints or you might encounter unexpected joint rotations. You also cannot move or rotate the IK handle. Be aware that the IK spline solver doesn’t operate if there are joint limits on any of the joints controlled by an IK spline handle. Offset
See the following note.
Roll
See "Animating the joint chain" on page 275.
Twist
See "Animating the joint chain" on page 275.
Twist Type
See the following note.
Root on Curve
See the following note.
Root Twist Mode
See the following note.
Note Twist Type, Root on Curve, and Root Twist Mode are available when you select Skeletons > IK Spline Handle Tool ❐. In the Attribute Editor, Offset affects the joint chain only if you turn on Root on Curve. For details on these attributes, see "Setting options before creating the IK spline handle" on page 278.
Preventing unwanted start joint flipping The start joint might flip undesirably when you move or rotate a curve or its CVs in some directions or slide the joint chain along its curve. If flipping occurs, it’s likely to do so only in a small range of rotation. The flipping is a normal outcome of IK spline solver calculations. If the orientation of a joint is more than 90 spatial degrees from its zero-rotation value, it might flip unexpectedly as you rotate the curve or CVs. The zero-rotation value is where the joint’s RotateX, RotateY, and RotateZ attributes are 0 (relative to its parent joint’s coordinate system). Flipping is most pronounced near 180 degrees. Joint is at its zerorotation value.
Unwanted start joint rotation might occur in the half-spherical region. Flipping is pronounced in the conical region.
CHARACTER SETUP 282
PART 3
USING IK SPLINE HANDLES | 23 Creating IK spline handles You can prevent start joint flipping in most cases by positioning joints appropriately when you create the joint chain. When you create each joint after the start joint, position it roughly in its rest position—the average position of its entire range of motion. If you’ve positioned joints appropriately and joint flipping is still a problem, try parenting the start joint to another joint or to a transform node. See "Auto Create Root Axis" on page 279 and "Auto Parent Curve" on page 279. Unexpected start joint flipping might also occur when you animate a joint chain along its curve, for instance, when you slide a snake along a motion path. To prevent flipping in such cases, do these steps. To prevent flipping when a joint chain slides down its curve: 1
Select Skeleton > IK Spline Handle Tool ❐ to display the Tool Settings window.
2
Turn off Root on Curve, Auto Parent Curve, Auto Create Curve, and Snap Curve to Root.
3
Turn on Auto Create Root Axis.
4
Select the start joint, then the end joint, and then the curve you’ve created. This creates the IK spline handle with a parent transform node above the start joint. In a subsequent step you’ll put the node on a motion path that prevents the start joint flipping.
5
Select the parent transform node, then Shift-click the curve. To select the parent transform node, drag a selection box around the start joint.
6
Select Animate > Motion Paths > Attach to Motion Path ❐. The Attach to Path Options window appears.
7
Turn on Start/End.
8
For the Start Time and End Time, enter the frame range for the joint chain’s motion. The parent transform node and its child joint chain will move from the start of the curve to the end of the curve in the specified frame range.
9
Turn on Follow. If the curve has a 3D looping shape, you might also need to turn on Normal for the Up Direction to avoid unwanted flipping.
10 Leave other options at the default settings. 11 Click the Attach button. When you play the animation, the parent transform node and joint chain move along the curve path. The movement will likely be free of unexpected flipping. However, flipping is unavoidable in some complex paths. Note that you can still roll and twist the joint chain with the IK handle’s roll and twist manipulators for additional control.
Working with soft body curves If you change an IK spline curve to a soft body, you can add dynamic forces to change the curve’s motion. For example, you can connect turbulence to the curve to create random, erratic motion. See Using Maya: Dynamics for details. SKELETONS
CHARACTER SETUP 283
USING IK SPLINE HANDLES | 23 Tips for working with IK spline handles
TIPS FOR WORKING WITH IK SPLINE HANDLES This section provides tips for working with IK spline handles on most characters. Subsequent topics offer suggestions specific to the type of character and motion you’re creating. •
To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
•
Create a simple curve with no sharp bends to help make the joint chain move smoothly when you animate the curve. Use a small number of CVs.
•
When you add an IK spline handle to the skeleton of most creatures—including fish and snakes moving along a motion path—parent each IK spline start joint to a transform node or parent joint that’s not controlled by an IK spline handle. This makes the joint chain move with the transformations of the parent while avoiding unexpected joint flipping. See "Preventing unwanted start joint flipping" on page 282 for details. If you’re working on a character with a root joint that rotates little, for instance, a swaying tree, you don’t need to parent the start joint to a transform node or joint. The start joint can serve as the character’s root joint.
•
For a character such as a fish or snake moving along a motion path, if you create a handle that starts at a skeleton’s root, turn on Auto Create Root Axis when you create the IK spline handle. This prevents unexpected joint flipping as you animate the automatically created parent transform node along a motion path. Also turn off Auto Parent Curve. If you create a handle that starts at a joint other than the skeleton’s root, turn on Auto Parent Curve and turn off Auto Create Root Axis so the handle’s curve and start joint move with the transformations of the parent joint.
•
When you manipulate a tail or neck parented to a spine, avoid moving the first CV of the curve for the tail or neck. Move the second CV minimally, preferably only along an imaginary line extending straight out from the end of the spine. Manipulate the other CVs freely. This technique ensures that the skin flows naturally where the spine meets the tail or neck.
•
To prevent unexpected results, Maya doesn’t let you overlap the same joint with two IK spline handles.
•
Do not parent the curve to the start joint. This creates a dependency graph loop that causes the start joint to chase the curve as the curve moves. To detect such loops, use the MEL cycleCheck -all command described in the online MEL documentation.
•
Do not parent the curve to a transform node that would use that same curve as a motion path. In other words, don’t turn on Auto Create Root Axis and Auto Parent Curve if you plan to put the transform node on that curve. This creates a dependency graph loop.
Working with human skeletons Because a human spine often twists, turns, and bends, an IK spline handle is ideal for controlling it. For example, you can position the handle’s start joint one joint hierarchically below (and positionally above) the skeleton’s root joint. This causes the IK spline joint chain to move with the root’s movement without unexpected joint flipping.
CHARACTER SETUP 284
PART 3
USING IK SPLINE HANDLES | 23 Tips for working with IK spline handles
IK spline handle
IK spline handle Start joint Root joint
Zoomed view of image on left
Working with animal skeletons Because an animal’s tail, back, and neck twist and turn independently, multiple IK spline handles are ideal for controlling them. This skeleton has three IK spline handles: on the tail, back, and neck. The handles give precise control of the spine. Handle Handle Handle
Pelvic region
Here’s a close-up of the pelvic region of the preceding skeleton:
SKELETONS
CHARACTER SETUP 285
USING IK SPLINE HANDLES | 23 Tips for working with IK spline handles
Handle Handle
Close-up of previous image’s pelvic region
Note that you can use two rather than three handles for skeletons: one for the tail and one for the neck and back combined. The start joint of the tail’s handle and the start joint of the back’s handle are near the position of the skeleton’s root, but one joint below the root in the skeleton’s hierarchy. This causes the IK spline joint chains to move with the root’s movement without unexpected joint flipping. If you use this approach, turn on Auto Parent Curve when you create the handles. This ensures the curve and joints move with the transformation of the root. For most creatures, using only one handle for the tail, back, and neck won’t give you adequate control.
Working with sinuous motion on skeletons IK spline handles are useful for animating land or sea creatures that move in sinuous or undulating patterns, for example, snakes, fish, and seals. The skeleton’s root location is crucial for achieving the desired motion. To animate a creature that glides smoothly along a path without abrupt direction changes at the head or tail, put the root of the skeleton at the character’s tail end. Turn on Auto Create Root Axis to prevent unexpected joint flipping as you transform the automatically created parent transform node. Also turn off Auto Parent Curve. An example skeleton follows:
Handle
Handle
Handle
Handle
Handle The skeleton’s root is at its tail.
CHARACTER SETUP 286
PART 3
USING IK SPLINE HANDLES | 23 Tips for working with IK spline handles Though not visible in the preceding figure, a parent transform node appears hierarchically above the start joint of the handle on the spine. If the creature’s head or tail moves abruptly, put the skeleton’s root between the spine’s midpoint and tail, for instance, near the pelvic region:
Handle Handle Handle Handle Handle Handle
Handle
The root is in the pelvic region.
Handle
Handle
Handle
Handle
Close-up of previous image’s pelvic region
Each handle’s start joint in the figure is separated from the root by one joint. None of the IK spline handles pass through the root. This causes the IK spline joint chains to move with the root’s movement without unexpected joint flipping.
SKELETONS
CHARACTER SETUP 287
USING IK SPLINE HANDLES | 23 Tips for working with IK spline handles
CHARACTER SETUP 288
PART 3
24
USING IK TWO BONE HANDLES IK two bone handles are tools for posing short joint chains that consist of three joints (two bones). IK two bone handles are especially useful for setting up characters in a games development environment. Maya includes the source code for this feature (see "IK two bone solver plug-in source code" on page 306), so games developers can replicate the exact behavior of this feature in a games engine.
SKELETONS
CHARACTER SETUP 289
USING IK TWO BONE HANDLES | 24 Quick start
QUICK START
This section shows you how to create an IK two bone handle as quickly as possible. To load plug-in and create solver node: 1
In the Command Line, enter: loadPlugin ik2Bsolver;
2
In the Command Line, enter: ik2Bsolver;
To create joint chain with IK handle: 1
Select Skeleton > Joint Chain ❒.
2
In the Tool Settings window, click the Create IK Handle option on.
3
In the IK Handle Options section, set Current Solver to ik2Bsolver.
4
Close the Tool Settings window.
5
Create a two bone joint chain. After you press the Enter key, Maya creates an IK two bone handle for it automatically. You can now pose the joint chain with the IK two bone handle.
CHARACTER SETUP 290
PART 3
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles
UNDERSTANDING IK TWO BONE HANDLES
The IK two bone handle is for posing joint chains that consist of three joints (two bones). The IK two bone handle is ideal for posing joint chains that you would like to stay in more or less the same plane, even though that plane can rotate. For example, the shoulder, elbow, and wrist joints of an arm all stay within the same plane. You can create IK two bone handles for joint chains that consist of more than two bones and three joints. However, the IK handle will treat the joint chain as though it includes only two bones. The IK handle treats all the joints (and their bones) above the second to last joint (the last bone) in the chain’s hierarchy as if they formed one bone. The rest of this section describes various features of an IK two bone handle. Note that the features are similar to the features of IK rotate plane handles. You need not understand all of these features to use IK two bone handles effectively; however, to get the most out of using IK two bone handles, you should eventually become familiar with all these features.
SKELETONS
CHARACTER SETUP 291
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles
Start and end joints Start joint
End joint
The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle.The start joint could be the skeleton’s root joint, or any other joint in the skeleton’s action hierarchy above the end joint. The end joint is the last joint in the joint chain controlled by the IK handle.The end joint must be below the start joint in the skeleton’s action hierarchy.
Handle position control gnomon
You can control the IK two bone handle’s position by moving the handle’s gnomon
You control the IK two bone handle’s position by selecting the IK handle’s gnomon and moving it. The joint chain moves as you move the IK handle. (Note that the term “gnomon” refers to Maya’s axial icons; for example, a locator is also a gnomon). In addition, you can exercise control by manipulating the twist disc (see"Twist disc" on page 296) or by moving the pole vector (see "Pole vector" on page 296). When you move the IK two bone handle’s position, you indicate where you want the IK handle’s end effector to be.
CHARACTER SETUP 292
PART 3
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles
End effector
End effector located by default at the end joint’s local rotation axis
By default, the end effector is not displayed, but it is located at the end joint’s local axis. However, if you like, you can offset the end effector’s position from the end joint. The end effector is parented to the parent joint of the end joint, influencing all the joints in the joint chain. To view the hierarchical relationships between the end effector and the joints, you can view the scene hierarchy with the Hypergraph. For an IK two bone handle, the goal of the end effector is to reach the IK handle’s position. As you move the IK two bone handle’s position, the IK two bone solver calculates how to rotate the joints in the joint chain so that the end effector can reach the IK handle’s position. For a joint chain with three joints (two bones), the first and second joints are rotated. If the joint chain has more than three joints, the first and the second to last joints are rotated. The end effector tries to keep up with the IK handle’s position at all times. However, depending on the fully extended length of the joint chain, the end effector might not be able to reach IK handle.
Handle wire
Handle wire runs through all the joints in the joint chain controlled by the IK handle
SKELETONS
CHARACTER SETUP 293
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle. The handle wire begins at the start joint’s local axis and ends at the end effector, which is by default at the end joint’s local axis.
Handle vector Handle vector runs directly from start joint to end effector, which is at the end joint by default.
The handle vector is the line drawn from the start joint to the IK handle’s end effector. The end effector is normally located at the IK chain’s end joint.
Rotation disc Rotation disc
The rotation disc is located at the start joint. Orthogonal to the handle vector, the rotation disc displays indicators that show the movement of the joint chain. These indicators include the joint chain plane indicator (see "Joint chain plane indicator" on page 295), the reference plane indicator (see "Reference plane indicator" on page 297), and the twist indicator (see "Twist indicator" on page 297).
CHARACTER SETUP 294
PART 3
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles
Joint chain plane Joint chain plane is the plane in which all the joints approximately lie
The joint chain plane is the plane that contains the three joints in a three joint (two bone) chain. (If the joint chain has more than three joints, the joint chain plane is the plane that contains the first, the second to last, and the last joints.) By always containing the joints in the joint chain, the joint chain plane controls how the joint chain can twist. The joint chain plane can rotate about the handle vector. Rotating the joint chain plane about the handle vector has the effect of twisting the joint chain. The joint chain plane is not displayed, but you can infer it from where the joint chain’s joints are located. The joint chain plane’s orientation is indicated by the joint chain plane indicator displayed in the rotation disc.
Joint chain plane indicator Joint chain plane indicator indicates the orientation of the joint chain plane
The plane indicator can be thought of as the shadow of the joint chain plane in the rotation disc. The plane indicator indicates the orientation of the joint chain plane relative to the reference plane.
SKELETONS
CHARACTER SETUP 295
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles
Twist disc
Use the twist disc to change the joint chain’s orientation
The twist disc is located at the end joint. The twist disc is a manipulator for twisting the joint chain by rotating the joint chain plane.
Reference plane
Reference plane
For the joint chain plane to rotate and twist the joint chain, the plane must rotate relative to some other plane so that the degree of twist can be measured. The plane that the joint chain plane rotates relative to is the reference plane. The difference between the two planes indicates the amount the joint chain twists. The reference plane is defined by the handle vector and the pole vector.
Pole vector
Pole vector
CHARACTER SETUP 296
PART 3
USING IK TWO BONE HANDLES | 24 Understanding IK two bone handles The pole vector starts at the start joint, and with the handle vector defines the reference plane. Because moving the pole vector changes the orientation of the reference plane, moving the pole vector can also change the orientation of the joint chain directly, just as manipulating the twist disc can change the orientation of the joint chain. This is because the joint chain’s degree of orientation, or twist, is defined as the difference in orientation between the reference plane and the joint chain plane. During posing, if the handle vector and the pole vector happen to cross each other or point in exactly opposite directions, the joint chain can suddenly flip. The joint chain can suddenly flip because when the vectors cross or point in opposite directions, the orientation of the reference plane relative to the joint chain plane suddenly changes by 180 degrees. You can prevent the flipping by moving the pole vector so that the handle vector will not cross it or point in the opposite direction of it.
Reference plane indicator
Reference plane indicator
The reference plane indicator is the green dot located on the twist disc. The reference plane indicator indicates the orientation of the reference plane. You can think of the plane indicator as indicating the shadow of the reference plane in the rotation disc.
Twist indicator Twist indicator
SKELETONS
CHARACTER SETUP 297
USING IK TWO BONE HANDLES | 24 Understanding IK two bone solver behavior On the rotation disc, the green arc between the reference plane indicator and the joint chain plane indicator is the twist indicator. The twist indicator shows the orientation of the joint chain plane relative to the reference plane.
Related MEL commands You can use MEL commands to create hotkeys, custom shelf buttons, and scripts. By using MEL commands you can improve your workflow, and access more of Maya’s features. MEL commands related to IK two bone handles include the following: •
ikHandle
•
ikHandleCtx
•
ikHandleDisplayScale
•
ikSolver For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for posing with IK two bone handles can include the following: •
IK handle node (default name: ikHandlen).
•
IK two bone solver node (default name: ik2Bsolver). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
UNDERSTANDING IK TWO BONE SOLVER BEHAVIOR The two bone solver first looks at the position (the translate x, y, and z attributes) of the goal. Next, the solver figures out how to move the position of the end effector as close to the goal’s position as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. The two bone solver does not look at the orientation (the rotate x, y, and z attributes) of the goal. That is, the two bone solver figures out how to rotate the joints based on the goal’s position, but not on the goal’s orientation. The orientation of the entire joint chain can be controlled by twisting the joint chain with the twist disc. The IK two bone solver is for posing joint chains that consist of three joints (two bones). If the joint chain has more than three joints, the solver rotates only the first and second to last joints. Using the solver in a non-uniform space (where shearing effects occur) can produce unpredictable results. Note that the joint chain controlled by an IK handle using a two bone solver cannot have any other IK handles running through any of its joints. Maya includes the source code for the IK two bone solver plug-in. For more information, see "IK two bone solver plug-in source code" on page 306.
CHARACTER SETUP 298
PART 3
USING IK TWO BONE HANDLES | 24 Creating IK two bone handles
CREATING IK TWO BONE HANDLES To create an IK handle, you first need to set up the IK two bone solver. Next, you can use the IK Handle Tool to create an IK two bone handle. The characteristics of the IK handle you create depend on the IK Handle Tool’s tool settings.
Setting up the IK two bone solver To set up the IK two bone solver for use, you must load the plug-in for it (ik2Bsolver.so), and then create the solver node for it. To load the plug-in: 1
Select Window > Settings/Preferences > Plug-in Manager. The Plug-in Manager window is displayed.
2
For ik2Bsolver.so, click loaded. To have it load automatically when you start Maya, click auto load. Note that you can load the ik2Bsolver from the Command Line by entering: loadPlugin ik2Bsolver;
To create the solver node: 1
In the Command Line, enter the following: createNode ik2Bsolver -n ik2Bsolver;
Maya creates the solver node for the ik2Bsolver. Note that Maya lists the node in the Channel Box after you enter the command. Alternatively, you can enter this shorter command: ik2Bsolver;
This shorter command also ensures that the ik2Bsolver node will be recreated after you select File > New.
Specifying IK Handle Tool’s tool settings To specify tool settings: 1
Select Skeleton > IK Handle Tool ❒.
2
The Tool Settings window is displayed.
3
Set the Tool Defaults tab’s IK Handle Options as follows: IK Handle Options
Current Solver
Specifies the IK handle’s solver. To create an IK two bone handle, be sure ik2Bsolver is selected.
Autopriority
(Does not apply to IK two bone handles.)
Solver Enable
Specifies whether the IK solver will be on, enabling inverse kinematics (IK) posing. Default is on.
Snap Enable
Specifies whether the IK handle will snap back to the IK handle’s end effector. Default is on.
SKELETONS
CHARACTER SETUP 299
USING IK TWO BONE HANDLES | 24 Posing IK two bone handles Sticky
Specifies that the IK handle will stick to its current position and orientation while you pose the skeleton with other IK handles or by translating, rotating, or scaling joints directly. Default is off.
Priority
Specifies the priority of the IK handle. All IK handles with a lower number priority are solved before any IK handles with a higher numbered priority. (All handles of priority 1 are solved before any handles of priority 2 and so on.) Priorities must be greater than zero.
Weight
(Does not apply to IK two bone handles.)
POWeight
(Does not apply to IK two bone handles.) •
Click Reset Tool to reset to the default tool settings. or
•
Click Close to close the Tool Settings window. Note that you can change the tool settings whenever you are using the Joint Tool by selecting Windows > Settings/Preferences > Tool Settings.
Creating an IK two bone handle Before you create an IK single chain handle, be sure to check the IK Handle Tool’s tool settings (select Skeleton > IK Handle Tool ❒). Current Solver should be set to ik2Bsolver. To create an IK two bone handle: 1
Select Skeleton > IK Handle Tool.
2
In the workspace, click on the joint where you want to start the IK two bone handle.
3
Click on the joint where you want to end the IK two bone handle. An IK two bone handle is created based on the IK Handle Tool’s previously set tool settings (Current Solver should have been set to ik2Bsolver).
POSING IK TWO BONE HANDLES You can pose an IK two bone handle as described in the following topics:
Moving the handle To move the handle: 1
Select the IK two bone handle (default name: ikHandlen).
2
Click the Move Tool on (default shortcut: w key).
3
In the workspace, while pressing the left or middle mouse button, move the IK handle as desired. Doing so calculates the rotations of the joints controlled by the IK handle.
Manipulating the pole vector To manipulate the pole vector: 1
CHARACTER SETUP 300
Select the IK two bone handle (default name: ikHandlen).
PART 3
USING IK TWO BONE HANDLES | 24 Editing IK two bone handles 2
Click the Show Manipulator Tool on (default shortcut: t key). The IK handle’s pole vector, twist disc, and rotation disc are displayed.
3
In the workspace, while pressing the left or middle mouse button, move the pole vector as desired. Doing so calculates the rotations of the joints controlled by the IK handle. Note that as you move the pole vector, the rotation disc’s reference plane indicator (by default, a green dot along the disc) moves to reflect the movement of the pole vector. For most applications, such as controlling a character’s arm, you can fully control the action of the IK handle by manipulating the pole vector. For convenience, you can constrain the pole vector to some other object (for example, a locator) so that you can more readily control the pole vector to pose the joint chain. For more information about constraining the pole vector to some other object, see Chapter 36, “Using Pole Vector Constraints.”
Manipulating the twist disc To manipulate the twist disc: 1
Select the IK two bone handle (default name: ikHandlen).
2
Click the Show Manipulator Tool on (default shortcut: t key). The IK handle’s pole vector, twist disc, and rotation disc are displayed. Notice that the twist disc is blue by default.
3
Click on the twist disc. The twist disc now turns yellow by default.
4
While pressing the left or middle mouse button, rotate the twist disc as desired. The joint chain controlled by the IK handle rotates about the handle vector. Note that this action changes the value of the IK handle’s Twist channel.
Controlling joint chain flipping During posing, if the handle vector and the pole vector happen to cross each other or point in exactly opposite directions, the joint chain can suddenly flip. The joint chain can suddenly flip because when the vectors cross or point in opposite directions, the orientation of the reference plane relative to the joint chain plane suddenly changes by 180 degrees. You can prevent the flipping by moving the pole vector so that the handle vector will not cross it or point in the opposite direction of it (see "Manipulating the pole vector" on page 300).
EDITING IK TWO BONE HANDLES You can edit IK two bone handles as described in the following topics:
Editing IK two bone handle channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit an IK two bone handle’s channels.
SKELETONS
CHARACTER SETUP 301
USING IK TWO BONE HANDLES | 24 Editing IK two bone handles To edit channels with the Channel Box: 1
Select an IK handle (default name: ikHandlen). Note that the Channel Box lists the IK handle’s IK solver under INPUTS. An IK two bone handle should have the ik2Bsolver listed. You can edit the IK solver attributes with the Attribute Editor. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Translate X, Y, Z
Specifies the position of the IK handle.
Rotate X, Y, Z
Specifies the orientation of the IK handle.
Scale X, Y, Z
Specifies the scaling of the IK handle. Note that the scale of the IK handle does not affect how the IK handle poses the joint chain.
Visibility
Specifies whether the IK handle is displayed. Enter on or off.
Solver Enable
Specifies whether the IK handle’s IK solver is on or off. If off, the IK handle has no effect on the joint chain; the joint chain can only be posed by forward kinematics (FK). Enter on or off.
Pole Vector X, Y, Z
Specifies the position of the pole vector’s end point. You can control the pole vector’s position by moving it directly (see "Manipulating the pole vector" on page 300).
Offset
(Does not apply to IK two bone handles.)
Roll
(Does not apply to IK two bone handles.)
Twist
Specifies the rotation of the joint chain plane relative to the reference plane. The effect of this is to rotate the joint chain controlled by the IK two bone handle. You can also control the rotation of the joint chain by manipulating the twist disc (see "Manipulating the twist disc" on page 301). 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing IK two bone handle attributes To edit attributes with the Attribute Editor: 1
Select the IK handle node (default name: ikHandlen).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Skeleton Info, IK Handle Attributes, IK Solver Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes
Translate
CHARACTER SETUP 302
Specifies the position of the IK two bone handle.
PART 3
USING IK TWO BONE HANDLES | 24 Editing IK two bone handles Rotate
Specifies the rotation of the IK two bone handle. Note that the rotation of the handle does not affect the posing of the joint chain.
Scale
Specifies the scaling of the IK two bone handle. Note that the scaling of the handle does not affect the posing of the joint chain.
Shear
Specifies the shearing of the IK two bone handle. Note that the shearing of the handle does not affect the posing of the joint chain.
Rotate Order
Specifies the IK handle’s rotation order. For example, if the rotation order is xyz, the handle first rotates about its X-axis, then its Y-axis, and finally its Z-axis. Select xyz, yzx, zxy, xzy, yxz, zyx. Default is xyz.
Rotate Axis
Specifies the orientation of the IK handle to the orientation of the start joint’s local rotation axis.
Inherits Transform
Specifies whether the IK handle can be affected by the translation, rotation, or scaling of a parent object. Skeleton Info
Start Joint
Informs you of the name of the start joint of the joint chain controlled by the IK two bone handle. Click on the > icon button to get the Attribute Editor for the start joint.
End Effector
Informs you of the name of the IK handle’s end effector. Click on the > icon button to get the Attribute Editor for the end effector. If you do so, note that the end effector’s Translate X, Y, and Z attributes are locked. They are locked because the end effector is parented to the end joint of the joint chain controlled by the IK two bone handle. IK Handle Attributes
Snap Enable
Specifies whether the IK handle will snap back to the IK handle’s end effector. Click on or off. Default is on.
Stickiness
Specifies that the IK handle will stick to its current position while you pose the skeleton with other IK handles or by translating, rotating, or scaling joints directly. Click on or off. Default is off.
Priority
Specifies the priority of the IK handle. All IK handles with a lower number priority are solved before any IK handles with a higher numbered priority. (All handles of priority 1 are solved before any handles of priority 2 and so on.) Priorities must be greater than zero.
Weight
(Does not apply to IK two bone handles.)
Po Weight
(Does not apply to IK two bone handles.) IK Solver Attributes
Solver Enable
Specifies whether the IK handle’s IK solver is on or off. If off, the IK handle has no effect on the joint chain. Turning Solver Enable off turns off IK posing so that you have to use forward kinematics (FK) posing. Enter on or off.
IK Solver
Specifies the IK handle’s solver. For an IK two bone handle, ik2Bsolver should be selected.
Pole Vector
Specifies the position of the pole vector’s end point. You can control the pole vector’s position by moving it directly (see "Manipulating the pole vector" on page 300).
SKELETONS
CHARACTER SETUP 303
USING IK TWO BONE HANDLES | 24 Editing IK two bone handles Twist
Specifies the rotation of the joint chain plane relative to the reference plane. The effect of this is to rotate the joint chain controlled by the IK two bone handle. You can also control the rotation of the joint chain by manipulating the twist disc (see "Manipulating the twist disc" on page 301). Pivots Specifies whether to display the IK handle’s rotate pivot and scale pivot. The Local Space and World Space sections specify the pivot positions in local space (relative to the IK handle) and world space. Limit Information Specifies limits on the IK handle’s translation, rotation, and scaling attributes. Select the Translate, Rotate, or Scale sections. Translate
Trans Limit X
Specifies translation limits on the IK handle’s Translate X attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Y
Specifies translation limits on the IK handle’s Translate Y attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Trans Limit Z
Specifies translation limits on the IK handle’s Translate Z attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Rotate
Rot Limit X
Specifies rotation limits on the IK handle’s Rotate X attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Y
Specifies rotation limits on the IK handle’s Rotate Y attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Rot Limit Z
Specifies rotation limits on the IK handle’s Rotate Z attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit. Scale
Scale Limit X
Specifies scaling limits on the IK handle’s Scale X attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Y
Specifies scaling limits on the IK handle’s Scale Y attribute. Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
Scale Limit Z
Specifies scaling limits on the IK handle’s Scale Z attribute.Use the < and > icon buttons to give the Min or Max limits the value in the Current field. Check on or off to activate the Min or Max limit.
CHARACTER SETUP 304
PART 3
USING IK TWO BONE HANDLES | 24 Deleting IK two bone handles Display Specifies display attributes for the IK handle’s selection handle, local axis, position offset values for the selection handle, the show manipulator default, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior Provides selections for node behavior attributes, including Caching and Node State. Extra Attributes (No extra attributes by default.)
Editing IK two bone solver attributes To edit attributes with the Attribute Editor: 1
Select the IK two bone solver (default name: ik2Bsolver). Note that changes to solver will affect all the IK handles that use it.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: IK Solver Attributes, Node Behavior, and Extra Attributes. IK Solver Attributes
Max Iterations
(Does not apply to IK two bone handles.)
Tolerance
(Does not apply to IK two bone handles.) Node Behavior Provides selections for node behavior attributes, including Caching and Node State. Extra Attributes (No extra attributes by default.)
DELETING IK TWO BONE HANDLES To delete an IK two bone handle: 1
Select the IK two bone handle (default name: ikHandlen).
2
Select Edit > Delete (default shortcut: Backspace key). The IK handle is deleted. However, note that the handle’s IK two bone solver is not deleted. The solver is still available for the other IK two bone handles that use it.
SKELETONS
CHARACTER SETUP 305
USING IK TWO BONE HANDLES | 24 IK two bone solver plug-in source code
IK TWO BONE SOLVER PLUG-IN SOURCE CODE The source code for the IK two bone solver is available in the devkit directory’s ik2Bsolver directory. The source code provides an example of how you can create your own IK solver plug-in. Further, by extracting the core algorithm, you can replicate the exact behavior of the IK solver in a games engine. For more information, please read the README file in ik2Bsolver directory.
CHARACTER SETUP 306
PART 3
PART 4
SKINNING
25
INTRODUCING SKINNING Skinning is setting up a model’s deformable objects so that they can be deformed by skeletons.
UNDERSTANDING SKINNING Skinning is the process of setting up a character’s model so that it can be deformed by a skeleton. (For more information on skeletons, see Chapter 18, “Introducing Skeletons.”) You skin a model by binding a skeleton to the model. You can bind a model to a skeleton by a variety of skinning methods, including smooth skinning and rigid skinning. Smooth skinning and rigid skinning are direct skinning methods. You can also use indirect skinning methods, which combine the use of lattice or wrap deformers with either smooth or rigid skinning.
Deformable objects and skin objects During skinning, you bind a model’s deformable objects to a skeleton. After skinning, the model is called the character’s skin, and the deformable objects are called skin objects.
SKINNING
CHARACTER SETUP 309
INTRODUCING SKINNING | 25 Understanding skinning A deformable object is any object whose structure is defined by NURBS control vertices (CVs), polygonal vertices, or lattice points. NURBS curves, NURBS surfaces, polygonal surfaces (meshes), and lattice deformers are all deformable objects. A character’s model can consist of one deformable object (for example, a large polygonal surface) or of groups of deformable objects (for example, groups of NURBS surfaces). Typically, a character’s model consists of deformable objects (typically NURBS surfaces, polygonal surfaces, or both) organized in hierarchical groups. The organization reflects the structure of the character’s appearance, and should be based on how the character will be animated. For example, a NURBS model could consist of groups of NURBS surfaces that make up the character’s feet, legs, torso, arms, hands, neck, and head.
Direct skinning methods The direct skinning methods include smooth and rigid skinning.
Smooth skinning Smooth skinning provides smooth, articulated deformation effects by enabling several joints to influence the same deformable object points (CVS, vertices, or lattice points). For more information, see Chapter 26, “Smooth Skinning.”
Rigid skinning Rigid skinning provides articulated deformation effects by enabling joints to influence sets of deformable object points. For more information, see Chapter 27, “Rigid Skinning.”
Indirect skinning methods Indirect skinning methods include lattice skinning and wrap skinning.
Lattice skinning In lattice skinning, you skin the influence lattices of lattice deformers. These influence lattices in turn influence other deformable objects (for example, NURBS surfaces or polygonal meshes). An advantage of lattice skinning is that you can easily make adjustments to the deformation by tweaking influence lattice points. For more information about lattice deformers, see Chapter 5, “Using Lattice Deformers.”
Wrap skinning In wrap skinning, you skin the wrap influence objects of wrap deformers. These wrap influence objects in turn influence other deformable objects. An advantage of wrap skinning is that you can skin low-res objects and use them as the character’s low-res model, and then later introduce the high-res model and deform its objects with the low-res objects. For more information about wrap deformers, see Chapter 17, “Using Wrap Deformers.”
CHARACTER SETUP 310
PART 4
INTRODUCING SKINNING | 25 Editing skin point set memberships
Bind pose When you bind skin, Maya creates a bind pose node (default name: bindPosen) for each skeleton. For each skeleton, the bind pose node keeps track of the joints’ transformation attributes (translation, rotation, and scale) when skinning takes place. The bind pose node also keeps track of the transformation attributes of any influence objects. The bind pose node facilitate putting the skeleton back into the bind pose at any time after binding skin. The use of constraints, expressions, or IK handles with keys set can restrict going to the bind pose. If you are using constraints, expressions, or IK handles and you want to go back to the bind pose, you will need to disable the nodes that carry out these features. They can restrict going to bind pose because they can lock the attributes they affect, preventing them from being set to the bind pose values.
Double transformation effects A double transformation effect is where skin object points are subjected to the action of a joint more than once, resulting in extreme, undesirable shape changes. Double transformation effects can occur if the skin object points are also being affected by a deformer that is in turn affected by the joint’s actions. For example, if after skinning you create a cluster deformer to further control certain skin object points and then parent the cluster deformer handle to the joint that also affects the skin object points, when you move the joint the points will be affected twice over by the joint’s action. One way to remedy this is to organize the affected points into a set that is only affected by the cluster deformer, which remains parented to the joint.
EDITING SKIN POINT SET MEMBERSHIPS Skinning organizes deformable object points (CVs, vertices, or lattice points) into skin point sets. You can edit these sets in the same ways that you can edit deformer sets. For more information, see Chapter 3, “Introducing Deformers,” "Editing deformer set membership" on page 46.
CHANGING A SKINNED OBJECT’S DEFORMATION ORDER When you use skinning with one or more deformers to deform an object, the final effect of the deformations can vary depending on the order in which the deformations occur. By default, the deformations occur in the order that skin was bound and the deformers were created. The skinning or deformer algorithm node created first deforms the object first, and the algorithm node created last deforms the object last. However, you can change, or re-order, the deformation order to get the effect you want. To change skinned object’s deformation order: 1
In the scene, move the pointer to the object being deformed and press the right mouse button. A marking menu is displayed.
2
From the marking menu, select Inputs > Complete List. The List of history operations window is displayed for the selected object.
SKINNING
CHARACTER SETUP 311
INTRODUCING SKINNING | 25 Point tweaking skinned objects Note that by default smooth skinning algorithm nodes are named skinClustern, and rigid skinning algorithm nodes are named jointClustern. 3
Move the pointer over the name of the skinning or deformer algorithm node whose order you want to change. Press the middle mouse button, drag it over the name of the algorithm node you want the node to precede, and release the mouse button.
POINT TWEAKING SKINNED OBJECTS
Point tweaking skin objects is moving or setting keys on the individual skin points of a skinned object. When you tweak the points of a skinned object, Maya automatically prevents the unexpected effects that can occur when you manipulate the object. Maya does so by applying the tweaks to the object before applying any deformations to the object. When you bind skin, Maya creates tweak nodes as well as nodes for the skinned objects. In the dependency graph, Maya places the tweak nodes upstream from the nodes for the smooth skin objects so that any point tweaking is carried out before the evaluation of the smooth skin nodes or rigid skin nodes. This placement means that, by default, a skinned object’s deformation order includes point tweaking first. If you prefer, you can change the deformation order so that point tweaking does not occur first. Also, if you do some point tweaking and then want to check how the skinned object deforms without the tweaking, you can disable the tweak node.
Avoid changing the number of points after skinning You can do point tweaking on objects after skinning, but you should avoid changing the number of the object’s points (for example, CVs, vertices, or lattice points). Changing the number of points can lead to unexpected deformation effects. To change point tweaking’s deformation order: 1
In the scene, move the pointer to the skinned object and press the right mouse button. A marking menu is displayed.
CHARACTER SETUP 312
PART 4
INTRODUCING SKINNING | 25 Editing node behavior to improve performance 2
From the marking menu, select Inputs > Complete List. The List of history operations window is displayed for the selected object.
3
Move the pointer over the name of the tweak node (default name: tweakn) whose order you want to change. Press the middle mouse button, drag it over the name of the operation that is where you want point tweaking to take place, and release the mouse button. To disable a tweak node:
1
Open the tweak node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Set Node State to HasNoEffect. To enable a tweak node:
1
Open the tweak node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Set Node State to Normal.
EDITING NODE BEHAVIOR TO IMPROVE PERFORMANCE You don’t need to know about node behavior in order to do skinning effectively. If you are new to skinning, you can skip this section. However, familiarity with node behavior can provide you with more control over the performance of skinned objects. For each object in your scene, if there has been any change to its node or any of the nodes in its history (its upstream or downstream nodes), Maya will evaluate the nodes and update the display. A skinned object has more nodes in its history than an object unaffected by skinning or deformers. If you have many skinned objects in your scene, you could improve the display performance by editing the node behavior attributes of the skinned nodes.
Understanding node behavior attributes The node behavior attributes include Caching and Node State. Caching
Specifies that Maya store the results of upstream evaluations, and then provide those results to the node. This saves Maya from having to re-evaluate the upstream nodes every time the node needs the results. If there are no changes to the upstream nodes, then this setting can improve display performance with no loss of results. However, note that caching uses more memory than would otherwise be used, which could adversely affect performance. Also, if there are changes to upstream nodes, more memory is allocated and then freed during each deformation, which could also adversely affect display performance.
Node State
Set Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, WaitingHasNoEffect, or Waiting-Blocking.
Normal
Specifies that Maya evaluate and display the deformation. Maya will evaluate the node as usual. This is the default.
HasNoEffect
Specifies that Maya prevent the deformation, but display the object. Maya will evaluate the nodes in the node’s history, but not the node itself.
SKINNING
CHARACTER SETUP 313
INTRODUCING SKINNING | 25 Workflow summary Blocking
Specifies that Maya prevent the deformation, and not display the object. Maya will not report the results of any evaluations of upstream nodes to this node.
Waiting-Normal
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting(Window > Settings/Preferences > Performance Settings) is set to Demand or Release, the node will take the Normal state when you click Update or release the mouse button.
WaitingHasNoEffect
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the HasNoEffect state when you click Update or release the mouse button.
WaitingBlocking
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the Blocking state when you click Update or release the mouse button.
Editing node behavior To set node behavior: 1
Open the node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Click Caching on or off.
4
Select the Node State as Normal, HasNoEffect, or Blocking. (The Waiting-Normal, Waiting-HasNoEffect, and Waiting-Blocking states are for Maya’s internal use.)
5
Close the Attribute Editor.
WORKFLOW SUMMARY Once you’ve created a model and skeleton for your character, you’re ready to skin the model so that the skeleton’s actions can deform it. For skinning, you can either use smooth skinning or rigid skinning. For more information on smooth skinning, see Chapter 26, “Smooth Skinning.” For more information on rigid skinning, see Chapter 27, “Rigid Skinning.” You can also skin the influence lattices of lattice deformers or the wrap influence objects of wrap deformers either by smooth or rigid skinning. Skinning can be an iterative process in which you might have to edit and refine the skeleton and the model’s deformable objects to get the right skin deformation effects.
CHARACTER SETUP 314
PART 4
26
SMOOTH SKINNING Smooth skinning provides smooth, articulated deformation effects by enabling several joints to influence the same deformable object points. If you’d like to explore some examples now, see "Examples" on page 341.
SKINNING
CHARACTER SETUP 315
SMOOTH SKINNING | 26 Understanding smooth skinning
UNDERSTANDING SMOOTH SKINNING
With smooth skinning, more than one joint can influence each CV to provide smooth bending effects. You do not need to use flexors or lattice deformers.
Smooth skinning makes smooth, articulated deformation effects available immediately after you bind skin. The smoothing effects around joints are automatically set up when you bind skin. Maya provides smooth deformation effects by allowing several nearby joints to have varying influences on the same skin points (NURBS CVs, polygonal vertices, or lattice points). By default, their influence varies with distance, but you can edit or paint the skin point weighting on a joint-by-joint basis. Unlike rigid skinning, with smooth skinning you don’t have to use deformers, flexors, or edit skin point set memberships to get smooth deformation effects. The smoothing effects around joints are automatically set up when you bind. The effect of each joint on a smooth skin point depends on the joint’s proximity to the point.
Smooth skin objects and points During smooth skinning, you bind a model’s deformable objects to a skeleton. After smooth skinning, the deformable objects are called smooth skin objects (or skin objects, or skin). The points (NURBS CVs, polygonal vertices, or lattice points) of the deformable objects are then referred to as smooth skin points, or skin points. The skin points can automatically avoid the improper influence of joints that are in close proximity but are far in terms of the skeleton’s hierarchy. For example, you can avoid having to worry about hand skin points being influenced by a nearby thigh joint.
Smooth skin point weights During smooth skinning, for each smooth skin point (for example, each CV of each NURBS surface), Maya assigns a smooth skin point weight for each joint that controls the influence of that joint on each point.
CHARACTER SETUP 316
PART 4
SMOOTH SKINNING | 26 Understanding smooth skinning If you want to change the results of smooth skinning to create unique skeletal deformation effects, you can edit or paint the weights of smooth skinning at the point level (the CV, vertex, or lattice point level). Additionally, to add further deformation effects to smooth skin, you can use Maya’s deformers and smooth skin influence objects. Joints closer to a smooth skin point will have a greater influence than joints far from the skin point. The joint closest to a smooth skin point will have the greatest influence. Which joints have the next greatest influence can depend on whether you want Maya to consider the skeleton’s hierarchy during binding or to ignore the skeleton’s hierarchy during binding.
Weighting based on skeleton hierarchy If you tell Maya to consider the skeleton’s hierarchy, the joint that will have the next greatest influence will be a relative (parent or child) of the closest joint. For example, if your character’s arms are hanging down so that the forearm bones are near the hip bones, you can make sure that the skin points for the arms do not come under the influence of the hip bones. This is because the hip bones are not near the forearm bones in the skeleton’s hierarchy even though the distance between them is small. When you bind skin, you tell Maya to consider the skeleton’s hierarchy by setting the Bind Method option to Closest Joint (see "Setting smooth bind options" on page 319).
Weighting based only on joint proximity If you tell Maya to ignore the skeleton’s hierarchy (set Bind Method to Closest Distance), the next joint that will have the next greatest influence on a smooth skin point’s weight is always the next closest joint to the point. Depending on the structure of the skeleton and the placement of the model, this joint could be much higher or lower in the skeleton’s hierarchy than the closest joint. For example, if your character’s arms are hanging down so that the forearm bones are near the hip bones, the hip bones could have the second greatest influence over the skin points for the arms. This could lead an inappropriate influence on the weights of the arm’s skin points. When you bind skin, you tell Maya to ignore the skeleton’s hierarchy by setting the Bind Method option to Closest Distance (see "Setting smooth bind options" on page 319).
Weighting can be influenced by varying number of joints You can control how many of the skeleton’s joints can influence a smooth skin point’s weight. A typical value for a character would be a maximum of four or five joints that can influence a given smooth skin point. When you bind skin, you tell Maya how many joints can influence a smooth skin point by specifying the Max Influences option (see "Setting smooth bind options" on page 319).
Weighting varies based on joint distance The influence of each joint on a smooth skin point’s weight varies with the distance between the skin point and the joint.
SKINNING
CHARACTER SETUP 317
SMOOTH SKINNING | 26 Understanding smooth skinning
Note that if the joint has a bone, the influence of the joint extends along the entire bone, from the center of the joint to the end of the bone. The joint’s influence can extend to all the points near the entire length of the bone. If the joint is an end joint (has no bone), then the joint’s influence just extends forward from the center of the joint. When you bind skin, you tell Maya how the weighting varies based on joint distance by specifying the Dropoff Rate option (see "Setting smooth bind options" on page 319).
Smooth skin point sets A set of smooth skin points is created for each deformable object. The set contains all the points (NURBS CVs, polygonal vertices, or lattice points) that can be influenced by the skeleton. For more information on sets and partitions, refer to Using Maya: Essentials.
Smooth skin influence objects With smooth skinning, you can use NURBS or polygonal objects as smooth skin influence objects to further shape and control the deformation of smooth skinned objects. Such influence objects provide deformation effects in a manner similar to the wrap deformer’s wrap influence objects. You can use the influence objects to restrict deformation (for example, undesirable shoulder deformations) as well as to create deformations (for example, bulging muscles). For more information on using smooth skin influence objects, see "Using smooth skin influence objects" on page 338.
CHARACTER SETUP 318
PART 4
SMOOTH SKINNING | 26 Binding smooth skin
Related MEL commands MEL commands related to smooth skinning include the following: •
skinCluster
•
skinPercent
•
copySkinWeights For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for smooth skinning can include the following: •
For each deformable object, Maya creates a skin cluster node (default name: skinClustern).
•
A bind pose node that saves a skeleton’s bind pose (default name: bindPosen).
•
Tweak nodes that carry out point tweaking on deformable objects after skinning (default name: tweakn).
•
Smooth skin point set nodes (default name: jointnSetm).
•
Smooth skin partition node (default name: jointnskinPartition). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
BINDING SMOOTH SKIN Binding smooth skin includes setting the smooth bind options, binding skin, and then checking the binding by exercising the skeleton. If you’d like to explore an example of binding smooth skin, see "Skinning a cylinder by smooth skinning" on page 341.
Setting smooth bind options To set bind options: 1
If you also want to bind skin now, select the skeleton (or joints) and then the deformable object(s) you want to bind.
2
Select Skin > Bind Skin > Smooth Bind ❒. The Smooth Bind Skin Options window is displayed.
3 Bind to
Specify the Bind to, Bind Method, Max Influences, and Dropoff Rate options: Specifies whether to bind to an entire skeleton or only to selected joints. Selections include Complete Skeleton or Selected Joints. Complete Skeleton specifies that the selected deformable objects will be bound to the entire skeleton, from the root joint on down through the skeleton’s hierarchy, even if you have selected some joint other than the root joint. Binding by complete skeleton is the usual way to bind a character’s skin. Selected Joints specifies that the selected deformable objects will be bound to only the selected joints, not the entire skeleton.
SKINNING
CHARACTER SETUP 319
SMOOTH SKINNING | 26 Binding smooth skin Select either Complete Skeleton or Selected Joints. Default is Complete Skeleton. Specifies whether joints will influence nearby skin points based on the skeleton’s hierarchy, or only on joint proximity to skin points. Selections include Closest Joint or Closest Distance.
Bind Method
Closest Joint specifies that joint influence is based on the skeleton’s hierarchy. In character setup, you will usually want to use this binding method because it can prevent inappropriate joint influences. For example, this method can prevent a right thigh joint from influencing nearby skin points on the left thigh. Closest Distance specifies that joint influence is based only on proximity to the skin points. When binding skin, Maya ignores the hierarchy of the skeleton. In character setup, you will usually want to avoid this binding method because it can cause inappropriate joint influences. For example, this method can cause a right thigh joint to influence nearby skin points on the left thigh.
Select either Closest Joint or Closest Distance. Default is Closest Joint. With either Closest Joint or Closest Distance, you can limit the number of joints that influence nearby skin points by setting Max Influences. You can also limit the joints’ range of influence by specifying Dropoff Rate. Max Influences
Specifies the number of joints that can influence each skin point. Default is 5, which is a good choice for most characters. (You can also limit the range of joint influence by specifying the Dropoff Rate.)
Dropoff Rate
Specifies how rapidly the influence of each joint on skin points will decrease with the distance from each joint (and the joint’s bone). The greater the Dropoff Rate, the more rapid the decrease in influence with distance. The lower the Dropoff Rate, the further the influence of each joint. When you bind skin, the Dropoff Rate applies to all the selected joints. Use the slider to specify values between 0.1 and 10. You can enter values up to 100, but values between 0.1 and 10 are ideal for most situations. Default is 4, which provides good deformation effects for most characters. After binding skin, you can use the Paint Skin Weights Tool to edit the influence of joints in an intuitive manner. For more information, see "Painting smooth skin point weights" on page 327. 4
Click Bind to bind skin. or Click Save to save creation options without binding skin. or Click Reset to reset to default skin cluster options. To bind smooth skin:
1
Select the skeleton (or joints), and then select the deformable objects you want to bind.
2
Select Skin > Bind Skin > Smooth Bind. Maya binds skin using the previously set smooth bind options. For each deformable object, Maya creates a skin cluster node, making each object a smooth skin object.
CHARACTER SETUP 320
PART 4
SMOOTH SKINNING | 26 Editing smooth skin
Checking the binding Exercise the skeleton to check the smooth skin deformation effects. Rotate the skeleton’s joints to view the smooth skin’s behavior. As you exercise the skeleton, at times you might want to go back to the bind pose. For more information on going to the bind pose, see "Going to the bind pose" on page 321. As you check the binding, you may find that you want to adjust the smooth skin’s behavior.
Adjusting smooth skin behavior If you don’t like the smooth skin’s behavior, you can detach the skin, edit the skeleton or the deformable objects, set new binding options, and then bind again. Skinning can be an iterative process of checking the binding, detaching, editing the skeleton, and then binding again. For more information on detaching skin, see "Detaching smooth skin" on page 337. However, if you just want to edit the smooth bind options (for example, Max Influences and Dropoff Rate) without detaching and binding again, you can do so. For more information, see "Editing maximum influences" on page 322, and "Editing joint smooth skin attributes" on page 322. To change the smooth skinning deformation effects, you can edit the skin point weights with the Component Editor or the Paint Skin Weights Tool. As you check the binding, you can use the Paint Skin Weights Tool to view joint influences and change them by painting. This tool provides an intuitive way to modify the deformation effects. For more information, see "Painting smooth skin point weights" on page 327. Note that when you edit joint smooth skin attributes and change Dropoff attributes, you then have to have Maya recalculate the affected skin point weights. In turn, this can alter any other changes you might have made to the skin point weights. Consequently, it’s a good practice to edit the Dropoff attributes first, and then proceed to editing and painting the skin point weights. You can also control smooth skinning deformation effects with smooth skin influence objects. A smooth skin influence object can be any NURBS surface, NURBS curve, or polygonal surface (mesh). For more information, see "Using smooth skin influence objects" on page 338.
EDITING SMOOTH SKIN You can edit smooth skin as described in the following sections. Editing smooth skin can also involve using smooth skin influence objects. For more information, see "Using smooth skin influence objects" on page 338.
Going to the bind pose The bind pose is the pose that the skeleton is in when you bind skin. When you pose a character’s skeleton after skinning, the skeleton’s actions cause deformations to the skin. The only pose that does not cause deformations to the skin is the bind pose. You must return to the bind pose if you decide to bind additional objects or add additional influence objects.
SKINNING
CHARACTER SETUP 321
SMOOTH SKINNING | 26 Editing smooth skin Note that if you bound smooth skin to selected joints only, going to bind pose will nevertheless return all the joints the skeleton to the bind pose. Also, the skeleton will go to the bind pose even if it is parented to group nodes. The group nodes will not prevent going to bind pose. To go to bind pose: 1
Select the character’s skeleton.
2
Select Skin > Go to Bind Pose. The skeleton goes to the pose it had during binding.
Overcoming problems with reaching bind pose The skeleton will not be able to go to the bind pose right away if the attributes of any of its joints are locked. Typically, joint attributes can be locked by constraints, expressions, IK spline handles, or any IK handles with keys set. These features can drive the values of certain joint attributes, locking them up for exclusive use. That they do lock certain attributes is desirable because it provides for the reliable effects of these features. However, if you want to go to the bind pose, you must first disable the nodes that are locking the attributes. A quick way to do this is to disable all of the nodes by selecting Modify > Enable Nodes > Disable All. Next, select Skin > Go to Bind Pose, and then enable all nodes again by selecting Modify > Enable Nodes > Enable All.
Changing the bind pose To change the bind pose, detach the smooth skin, adjust the skeleton and deformable objects as desired, and then bind skin again.
Editing maximum influences You can change the number of joints or influence objects that can influence a skin object’s points. Note that before you bind skin, the Maximum Influences smooth bind option specifies the maximum number of joints or influence objects. To set maximum influences: 1
Select the skin object(s) whose maximum influences you want to edit.
2
Select Skin > Edit Smooth Skin > Set Max Influences.
3
In the Set Max Influences window, set Max Influences: Specifies the number of joints and influence objects that can influence each skin point. Use slider to select values from 0 to 30. Default is 5.
Max Influences
4
Click Apply to set the new value.
Editing joint smooth skin attributes When you bind smooth skin to a skeleton, Maya assigns each joint some additional attributes. Maya places these attributes in each joint’s Attribute Editor, in a section called Smooth Skin. To edit attributes with the Attribute Editor: 1
CHARACTER SETUP 322
Select a joint.
PART 4
SMOOTH SKINNING | 26 Editing smooth skin 2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
Open the Smooth Skin tab. Smooth Skin Parameters
Hold Weights
Specifies that you want to prevent the joint’s smooth skin weights from being changed indirectly, typically because of weight normalization during weight painting and editing (see “Holding smooth skin weights” on page 389). If on, Maya holds the weights to their current values. Default is off.
Dropoff
Specifies the rate at which the influence object’s influence decreases as the distance from the influence object increases. Use the slider to specify values between 0.1 and 10. You can enter values up to 100, but values between 0.1 and 10 are ideal for most situations. Default is 4.0. After setting a new Dropoff, click Update Weights to have Maya recalculate new skin point weights according to the new Dropoff value.
Update Weights
Tells Maya to calculate new skin point weights. In calculating the new weights, Maya seeks to recalculate only those skin point weights that would be affected by the change to Dropoff. If you want to go back to using the previous weights, select Edit > Undo.
Editing skin cluster channels To edit channels with the Channel Box: 1
Select a skin cluster node (default name: skinClustern). One quick way to select a skin cluster node is to select a smooth skin object, and then select the skin cluster node in its history from the Channel Box (under INPUTS). Skin cluster nodes are also part of the history of bound joints (under OUTPUTS). Each smooth skin object has its own upstream skin cluster node. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Envelope Use Components
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Default is 1. Specifies whether changes to the components of smooth skin influence objects can change their deformation effects on smooth skin objects. If Use Components is off (the default), changes to components won’t change the deformation effect. If Use Components is on, changes to components can change the deformation effect. For example, if your smooth skin influence objects are NURBS surfaces and Use Components is on, moving the influence objects’ CVs can change the deformation effect.
Components Matrix
SKINNING
Specifies that Maya can perform an influence object’s control point level (for example, CVs) deformations on skin that can change its scale. Default is on. (This channel corresponds to the Use Components Matrix attribute.)
CHARACTER SETUP 323
SMOOTH SKINNING | 26 Editing smooth skin Normalize Weights
Specifies whether the weights are normalized automatically. For more information about normalization, see “Controlling smooth skin weight normalization” on page 389. Default is on. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing skin cluster attributes To edit attributes with the Attribute Editor: 1
Select a skin cluster node (default name: skinClustern).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Smooth Skin Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Smooth Skin Attributes
Use Components
Specifies whether changes to the components of smooth skin influence objects can change their deformation effects on smooth skin objects. If Use Components is off (the default), changes to components won’t change the deformation effect. If Use Components is on, changes to components can change the deformation effect. For example, if your smooth skin influence objects are NURBS surfaces and Use Components is on, moving the influence objects’ CVs can change the deformation effect. Alternatively, if your smooth skin influence objects are polygonal surfaces (meshes), setting Use Infl Components on makes it possible for changes to individual polygons to in turn deform skin. Otherwise, with Use Infl Components off, the entire shape of the influence object influences the skin but changes to individual polygons can not influence the skin. Default is off.
Use Component Matrix Normalize Weights
Specifies that you can use a component-based influence object on a character’s skin that changes scale. Default is on. Specifies whether the weights are normalized automatically. For more information about normalization, see "Controlling smooth skin weight normalization" on page 333. Default is on. Deformer Attributes
Envelope
Specifies the deformation scale factor. Values can vary from 0 to 1. Default is 1. Node Behavior For more information, see "Editing node behavior to improve performance" on page 313.
CHARACTER SETUP 324
PART 4
SMOOTH SKINNING | 26 Editing smooth skin Extra Attributes (No extra attributes by default.)
Editing skin point weights With the Component Editor, you can directly modify the values of individual skin point weights. Note that you can also paint these weights with the Paint Skin Weights Tool. If you want to set certain skin point weights to particular values, use the Component Editor. However, if you want to shape the deformation directly and are not concerned with specific values, use the Paint Skin Weights Tool (see "Painting smooth skin point weights" on page 327). While you are editing skin point weights, you can reset the weights to their initial values at any time (see "Resetting skin point weights to default weights" on page 332). You can also prevent indirect changes to skin point weights, which can happen if Maya is normalizing the weights (see "Controlling smooth skin weight normalization" on page 333). You can edit skin point weights with the Component Editor as described in the following topics:
Querying weights To query skin point weights: 1
Select the skin points whose weights you want to edit.
2
Select Window > General Editors > Component Editor. The Component Editor is displayed. The Component Editor displays the component data for currently selected components in the workspace. By default, the Component Editor updates dynamically as you select components in the workspace. Also, as you select components in the Component Editor, the workspace updates dynamically as well.
3
Click on the Skin Clusters tab.The Skin Clusters section lists the weights assigned to CVs, vertices, or lattice points bound to a skeleton’s joints by smooth skinning.
Modifying weights To modify a skin point’s weight: 1
In the Component Editor’s spreadsheet, click the component data box you want to edit. Only the component whose box you’ve selected is now selected in the workspace.
2
Enter a new value. To modify several skin point weights at once:
SKINNING
1
In the workspace, select the points whose weights you want to edit.
2
In the Component Editor’s spreadsheet, drag through the component data boxes you want to edit.
3
Enter the value you want all the boxes to have.
CHARACTER SETUP 325
SMOOTH SKINNING | 26 Editing smooth skin To modify an entire row or column (UNIX only): 1
In the workspace, select the points whose weights you want to edit.
2
In the Component Editor’s spreadsheet, click one of the boxes in the row or column.
3
Click the row or column heading. Now all the boxes for the row or column are selected.
4
Enter a value for all the boxes in the row or column. To modify an entire row or column (Windows only):
1
In the workspace, select the points whose weights you want to edit.
2
To change all the entries of a row or column, in the Component Editor’s spreadsheet, select the row or column heading.
3
Shift select any of the boxes in that row or column.
4
Enter a new value to update the entire row or column.
Holding weights To hold skin point weights: When you are directly editing joint smooth skin influence object weights with the Component Editor, you can quickly specify whether the weights of particular joints or smooth skin influence objects can change. You can tell Maya to hold the weights (see "Holding smooth skin weights" on page 332). In the Component Editor, under the skinClusters tab, note the new Hold row. For each joint or smooth skin influence object, the value for Hold corresponds to the Hold Weights settings for the Attribute Editor’s Smooth Skin Parameters. On an individual skin point basis, the Hold settings correspond to the skinCluster node’s Lock Weights[n] attributes settings. If Hold is on, Maya holds weights at their current values when you modify the weights of other influence objects. For instance, having Hold on prevents changes because of weight normalization (see "Controlling smooth skin weight normalization" on page 333). However, you can still modify the weights by entering new values in the Component Editor.
CHARACTER SETUP 326
PART 4
SMOOTH SKINNING | 26 Editing smooth skin
Painting smooth skin point weights
You can paint skin point weights with the Paint Skin Weights Tool. The Paint Skin Weights Tool provides an intuitive way to change the deformation effects of smooth skinning. If you want to set individual skin point weights to specific values, you can use the Component Editor (see "Editing skin point weights" on page 325). While you are painting skin point weights, you can reset the weights to their initial values at any time (see "Resetting skin point weights to default weights" on page 332). To explore an example that includes painting skin point weights, see "Skinning a cylinder by smooth skinning" on page 341. Note that painting smooth skin point weights uses a different painting tool than the tool for painting rigid skin point weights. To paint smooth skin point weights: 1
Select the smooth skin objects you want to paint.
2
Go into smooth shading mode (Shading > Smooth Shade All or press the default hotkey, 5).
3
Select the Paint Skin Weights Too and open the Tool settings editor (Skin > Edit Smooth Skin > Paint Skin Weights Tool ❐).
4
Check that Color Feedback is turned on in the Display section. Color feedback helps you identify the weights on the surface by representing them as grayscale values (smaller values are darker, larger values are lighter).
Tip You can use the default hotkey Alt c to turn Color Feedback on and off outside the Tools Settings Editor.
SKINNING
CHARACTER SETUP 327
SMOOTH SKINNING | 26 Editing smooth skin 5
Select a joint. The values you paint set how much this joint influences the painted vertices relative to the other joints making up the smooth body (up to the number specified as the Max Influence in the Smooth Bind Skin Options window). There are two ways to select a joint:
•
In the Influence section of the Tool Settings editor, click the joint name in the Transform box. or
•
Right-click on the joint you want to paint to display a marking menu, then drag north and select Paint Weights. The Tool Settings editor must be open. Values with more influence appear lighter, values with less influence appear darker.
6
Select a brush, paint operation, and value and define other settings as required. See "Painting cluster weights" on page 93, noting that the settings are the same for the Paint Cluster Weights Tool.
7
Drag the brush across the skin.
Tip You can list joints Alphabetically or By Hierarchy in the Transform box. Alphabetically is best if you know the name of the joint that has the skin weights you want to paint. By Hierarchy lists joints in the same order as the Outliner. The top of the list shows the root joint of the hierarchy, while each child joint is listed below its parent. This order is useful if you are painting a single a region of the skin—The joints you need to select from the list while painting are typically next to one another.
Painting skin weights on masked vertices You can create a mask on the skin that is unaffected by any weight painting you do. When you apply brush strokes over the mask, the vertices on the masked area retain their weight, regardless of the paint weights operation. Before creating the mask you must first create the skin. For details on masking surfaces, see “Restricting an area for painting” in Using Maya: Painting. To paint creasing effects: 1
Select smooth shaded display mode (default shortcut: press 5 key).
2
Select the cylinder.
3
Select Skin > Edit Smooth Skin > Paint Skin Weights Tool ❒. (For more information, see "Painting smooth skin point weights" on page 327.)
4
In the Tool Settings window, the Influence section should be displayed.
5
Note the Transform box. The Transform box lists the names all the joints.
6
CHARACTER SETUP 328
Click on a joint name. For example, click joint3.
PART 4
SMOOTH SKINNING | 26 Editing smooth skin In the scene, the shading indicates the joint’s influence. The whiter the color, the greater the influence of the joint.
Influence of joint3.
Note how the joint’s influence fades into black as the distance from the joint increases. 7
In the Influence box, click on another joint name. For example, click joint4.
Influence of joint4.
Again, note how the joint’s influence fades into black as the distance from the joint increases. Also note how the joints gradually influence the bending and creasing. 8
SKINNING
Check the influence of one more of the joints. For example, check the influence of joint2.
CHARACTER SETUP 329
SMOOTH SKINNING | 26 Editing smooth skin
Influence of joint2.
Joint2 mainly influences the skin below the bend, but does provides some gradual influence in the bend area. Similarly, joints above the bend (for example, joint5) also gradually influence the deformation in the bend area. Now you will edit the influence of the joints to get a sharper creasing effect. You can do this by increasing how the joints nearest the bend influence the creasing, and lessening how joints further from the bend influence the creasing. 9
Use the Paint Skin Weights Tool to paint how the joints influence creasing. The brush provides an intuitive way to change the influence of the joints. Use the brush’s Add operation to increase the influence of nearby joints, and use the Scale operation to decrease the influence of further joints. Use the Smooth operation to smooth out the influences of the joints. For more information on using paint tools, see Using Maya: Painting. Try to get the creasing to look something like the following, which is closer to what you might want for an elbow deformation:
CHARACTER SETUP 330
PART 4
SMOOTH SKINNING | 26 Editing smooth skin
Painting influences of nearby joints to edit the deformation effect. You can now see the influence of joint3.
Experiment with using the brush. With just a little experimentation, you can quickly become proficient at painting the skin point weights of joints.
Mirroring smooth skin weights You can mirror smooth skin weights, either from one smooth skin object to another, or within the same smooth skin object. Mirroring smooth skin weights greatly speeds up the process of editing and fine-tuning skin deformation effects. For example, you could perfect the smooth skin weighting for a character’s right shoulder area and then simply mirror the weighting to the character’s left shoulder. Maya mirrors weights across planes defined by Maya’s global workspace axis. For the mirroring to work properly, the skin objects (or character) should be centered on the global axis, or at least aligned along the axes you want to mirror about. To mirror smooth skin weights: 1
Select the smooth skin object(s), and then select Skin > Edit Smooth Skin > Mirror Skin Weights ❒.
2
In the Mirror Skin Weights Options window, specify the following options: XY specifies mirroring weights about the global XY plane (the default).
Mirror Axis
YZ specifies mirroring weights about the global YZ plane. XZ specifies mirroring weights about the global XZ plane. Positive to Negative (+Z to -Z) specifies direction of the mirroring along the specified Mirror Axis plane.
Direction
3
Click the Mirror button.
Copying smooth skin weights You can copy smooth skin weights from one smooth skin object to another, or from one group of smooth skin objects to another.
SKINNING
CHARACTER SETUP 331
SMOOTH SKINNING | 26 Editing smooth skin For example, suppose you have created a team of very similar characters for a football game, and you’re at that point in the character setup process where you have just skinned them all and are about to paint the smooth skin weights to perfect the deformation effects. You first paint the weights of the quarterback. Next you have to paint the weights of all the other players. Instead of having to paint the players individually, you can copy what you did for the quarterback to each of the other players. You might then want to fine-tune the weights of the various other players, but by copying the weights you have still saved yourself a lot of time. You can focus on the creative challenges unique to the case of a particular character rather than on doing the same type of painting over and over again. For best results, the skeleton of the character you are copying from and the skeleton you are copying to should have the same structure. If the skeletons are similar, Maya will still try to copy the weights. However, if the skeletons are radically different, Maya may not be able to copy the weights. Also, for best results, the skeletons of each character should be in the same pose during copying. If the orientation of the joints are not similar, the copying can lack some precision, which means you may have to do some touch up painting to the results. If the skin objects have different numbers of CVs, or if the ordering of the CVs is different, the copying will intelligently take into account the differences and provide the same type of weighting. This is very useful if you want to apply the smooth skin weighting from a high-res character to a low-res version of the character. You can copy smooth skin weights between skin objects of different types: for example, you can copy from a subdivision surface to a NURBS surface or a polygonal surface. To copy smooth skin weights: 1
Select the smooth skin object (or group of objects) whose weights you want to copy, and then select the object (or group of objects) to which you want to copy the weights.
2
Select Skin > Edit Smooth Skin > Copy Skin Weights.
Resetting skin point weights to default weights While you are editing or painting the skin weights, you can reset the weights the their initial, default values at any time. To reset skin point weights: 1
Select the skin object (or specific components on the object) whose skin point weights you want to reset.
2
Select Skin > Edit Smooth Skin > Reset Weights to Default.
Holding smooth skin weights When you are changing (editing or painting) the weights of smooth skin objects, changing the weights of one object can affect the weights of other objects. This is because Maya must consider the weights of all skin objects being influenced by a particular influence object as being relative to one another. Maya does this by requiring that all the weights add up to one. When you change certain weights,
CHARACTER SETUP 332
PART 4
SMOOTH SKINNING | 26 Editing smooth skin Maya can automatically change various other weights so that the total of all the weights continues to be one. This allows Maya to know the relative influences of the weights. The process of scaling some numbers so that they all add up to one is called “normalization.” By constantly normalizing weight values, Maya keeps track of their relative influences. When changing (editing or painting) weights of smooth skin objects, it’s sometimes desirable to specify that the weights of certain objects won’t change. If you’ve perfected the weighting of a particular object, you might want to make sure that its weights are not going to undergo any normalization changes. Maya lets you “hold” the weights of particular smooth skin objects so that their values don’t change when you are editing other smooth skin objects. Note that if you hold the weights of many objects at the same time, Maya might not be able to normalize the rest of the weights properly, and you could get an error message. In general, you should not hold the weights of many objects at the same time. Typically, you would want to hold the weights of only one or two objects. However, if you don’t want to stop holding the weights of any of the objects, you can turn off weight normalization directly from Maya’s interface (see "Controlling smooth skin weight normalization" on page 333).
Controlling smooth skin weight normalization When you are changing (editing or painting) the weights of smooth skin objects, changing the weights of one object can affect the weights of other objects. This is because Maya considers the weights of all skin objects being influenced by a particular influence object as being relative to one another. Maya does this by requiring that all the weights add up to one. When you change certain weights, Maya can automatically change various other weights so that the total of all the weights continues to be one. This allows Maya to know the relative influences of the weights. The process of scaling numbers so that they all add up to one is called “normalization.” By constantly normalizing weight values, Maya keeps track of their relative influences. Maya normalizes smooth skin weights by default, but you can control whether a smooth skin object’s weights are normalized. You can disable weight normalization, and also enable it again. Also, if you’ve changed weight values with normalization disabled, and then decide to normalize them, you can do so. To disable normalization: 1
Select the smooth skin object(s) whose weights you no longer want normalized automatically.
2
Select Skin > Edit Smooth Skin > Disable Weight Normalization. Now Maya will not normalize the weights automatically. To enable normalization:
SKINNING
1
Select the smooth skin object(s) whose weights you want to be normalized automatically.
2
Select Skin > Edit Smooth Skin > Enable Weight Normalization.
CHARACTER SETUP 333
SMOOTH SKINNING | 26 Editing smooth skin Maya does not immediately normalize weights. The weights stay at their current values until you edit or paint weights, and then Maya will automatically normalize the weights. To normalize weights: 1
Select the smooth skin objects (or skin points) whose weights you want to normalize.
2
Select Skin > Edit Smooth Skin > Normalize Weights. Maya normalizes the weights.
Pruning insignificant smooth skin weights As you paint smooth skin weights, you might unintentionally create small weight values, for instance, 0.008, on many of the skin points. Maya creates small values as it normalizes total skin weight for each point to 1. The weights have no discernible effect on the skin, but they slow down processing. You can prune the small skin weights to speed up processing. To prune small skin weights: 1
Select the skin or specific skin points.
2
Select Skin > Edit Smooth Skin > Prune Small Weights ❒.
3
In the Prune Below box, set the threshold weight. The default value, 0.01 works well in most cases. Skin weights below the valued entered will be reset to 0. By default, the remaining skin weights are normalized to add up to 1. If you want to prevent normalization, select the skin object, display the skinCluster tab in the Attribute Editor, and turn off Normalize Weights.
Removing unused influences from a smooth skinned surface To enhance Maya processing speed and make the Paint Skin Weights Tool easier to use, you can disconnect joints and influence objects from a smooth skin that has all of its skin weights at 0. The Paint Skin Weights Tool becomes easier to use because the unused influences do not appear in the Influence list for the skin. For example, suppose you smooth skin a left foot stocking to a human skeleton with the default options. All joints in skeleton will be connected to the stocking as potential influences, but only the joints closest to the left foot stocking will have nonzero weights. If you select the elbow and rotate it, Maya computes the skin on the stocking to see if there are any nonzero weights. If you select the stocking and remove the unused influences, the elbow and the other zero-weighted joints will be disconnected from the stocking and performance will improve. To remove unused influences: 1
Select the skin.
2
Select Skin > Edit Smooth Skin > Remove Unused Influences.
Batch export and import of smooth skin weight maps When you smooth skin a surface, Maya creates one weight map per joint. Maya has a menu item that exports all the weight maps at once.
CHARACTER SETUP 334
PART 4
SMOOTH SKINNING | 26 Editing smooth skin
Importing to a character in another scene After you export the weight maps, you can import them to a smooth-skinned surface in another scene so that its skin deforms the same as the first surface. The surface in the second scene must have the same UV orientation as the original surface, but it can differ from the original as follows: •
It can be scaled differently but must be proportioned similarly in regions of significant deformation, typically around joints.
•
It can have a different number of spans and sections.
•
It can have a different world space position. If you export the smooth-skin weight maps from the character on the left to the smaller, pregnant sister on the right, the skin deforms the same on both. This saves you the time it would take to paint the weights on the pregnant character.
Importing back to the original character You can also import the maps back to the original surface. Examples of how this is useful follow: •
If you are roughly satisfied with the skin weights for a surface but want to experiment with different weights to enhance the look, you can export the maps to have a backup of the satisfactory version.
•
If you apply an influence object to the surface, Maya alters the weights of the smooth skinning in the region of the influence object, sometimes with undesirable results. To avoid this situation, you can export the maps, add the influence object, import the maps to the surface again, then paint weights near the influence object. This avoids the unintended automatic weight alterations. To export weight maps:
1
Select the skin. If you need to select a group of skin surfaces, select the group node.
2
Select Skin > Edit Smooth Skin > Export Skin Weight Maps ❒.
3
Set the following options and click Export. In most applications, only the Map Size X and Y options are useful. The other options are useful if you plan to use specialized map editing techniques. Most users use the default option settings. Export Value
Alpha exports alpha channel (opacity) values. Luminance exports luminance (brightness) values.
SKINNING
CHARACTER SETUP 335
SMOOTH SKINNING | 26 Editing smooth skin Map Size X, Y
Sets the width and height of the image. If the skin has 1000s of CVs or vertices, a large map will ensure the destination skin matches the original skin. However, large maps take more time to save to disk and also use more disk space. A map that is too small might cause inadvertent averaging of the alpha or luminance values. The default values 512 by 512 work well for most skins. If the skin lots of CVs or vertices, use Map Size values of 1024 by 1024. If the skin has relatively few CVs or vertices, use values 256 by 256. If you use a skin made from dozens of NURBS patches, consider using 256 by 256 to avoid wasting lots of disk space.
Keep Aspect Ratio Maintains the height to width ratio of the attribute map when you
export. Image Format
Specifies the type of image, for instance, TIFF, JPEG, and so on.
4
In the file browser that appears, specify a path and name for a folder (or directory) that will be created to hold the map files. By default, Maya puts the folder name you specify under the sourceimages folder of your current project. Click the Write button in the file browser after you enter the name for the folder.
5
Maya lists how many maps will be written to disk, and prompts whether you want to proceed. Click Yes. The operation has finished when the hourglass icon stops flashing on your screen. It might take 10 or more seconds per map. Maya puts the image files, one per joint, in the specified folder as in this example: jackie_back_root.iff jackie_jaw.iff jackie_left_ankle.iff and so on...
Maya also creates a weight map file named folder.weightMap in the same folder that contains the folder you specified (sourceimages, by default). Its contents describe the relationship between the surface and the map files. You don’t need to understand the contents of this file, but the file must be in the specified location when you import the maps. Maya uses this file when you import the images. To import weight maps: 1
Select the skin of the character to receive the maps. If you need to select a group of skin surfaces, select the group node.
2
Select Skin > Edit Smooth Skin > Import Skin Weight Maps.
3
In the file browser that appears, specify the name of the previously exported .weightMap file for the maps you want to import. To import the maps to a skin or skeleton that has a different name than the skin or skeleton from which you exported, you must open the .weightMap file with a text editor and replace the skin or skeleton names with the ones used in the scene where you import the maps.
CHARACTER SETUP 336
PART 4
SMOOTH SKINNING | 26 Editing smooth skin
Detaching smooth skin After you have bound skin, you might decide that you want to modify the skeleton, change the bind pose, or do some further modeling on the skin. To do these things you must first detach the skin from the skeleton, and then when you’re done you must bind skin again. To set detach skin options: 1
If you want to detach now, select the skin object(s) you want to detach.
2
Select Skin > Detach Skin ❒. The Detach Skin Options window is displayed. Set to Delete History, Keep History, or Bake History.
History
Delete History will detach the skin, move it to its original, undeformed shape, and delete the skin’s skin cluster nodes. Select this option if you want to bind the skin starting anew, for example, because your extensive editing of smooth skin weights gave undesirable results. Keep History will detach the skin and move it to its original, undeformed shape. It will not delete the skin’s skin cluster nodes. This is the default option. Use this option to preserve smooth skin weights when you bind skin again. This is useful, for instance, if you decide to add an extra joint to a skeleton but want to retain the existing smooth skin weights after you detach the smooth skin and bind the skin again. Bake History will detach the skin and delete its skin cluster nodes, but will not move the skin to its original, undeformed shape. The skin will maintain its current shape after detachment. This is useful, for instance, if you won’t deform the skin’s shape anymore and want to lighten the processing demands of your scene. (You might use the skin, for example, as a stationary character in the background of the scene.) (This option only applies to rigid skinning.)
Coloring
3
Click Detach to detach skin. or Click Save to save detach options without detaching skin. or Click Reset to reset to default detach skin options. To detach skin:
SKINNING
1
Select skeleton(s).
2
Select Skin > Detach Skin to detach skin with previously set detach skin options.
CHARACTER SETUP 337
SMOOTH SKINNING | 26 Using smooth skin influence objects
USING SMOOTH SKIN INFLUENCE OBJECTS
Influence objects can deform smooth skin objects by influencing the position (translation) attributes of their skin points. If you’d like to explore some examples now, see "Hand muscle bulge with influence object" on page 345 and "Using influence objects to prevent unwanted deformation" on page 348. You can add any object as an influence object so that the object’s transform attributes affect the position attributes of skin points. For example, you could use a locator as an influence object so that when you move the locator you move skin points, creating a deformation effect. If the influence object is a NURBS or polygonal surface, the skin points can be influenced by the shape of the surface. The surface can push or pull skin points that are in its vicinity, creating deformation effects that reflect the surface’s shape. When placed near the surface of the skin, these polygonal influence objects can be very useful for creating deformations that indicate the effects of moving veins, bones, tendons, or muscles. You can also create interesting effects with NURBS curves. Influence objects influence smooth skin objects in the same manner that joints can influence smooth skin objects. The Dropoff Rate, which is set as a smooth bind option, applies to the influence of influence objects as well as to the influence of joints. You can change the Dropoff Rate for each influence object. Whether a smooth skin object’s skin points can be influenced by the components of the surface (for example, the individual polygonal faces) of an influence object or the overall shape of the object depends on the skin cluster node’s Use Components attribute. If Use Components is set to on, skin points can be influenced by components (for example, individual polygonal faces). If Use Components is set to off (the default), the skin points are only influenced by the overall shape of the influence object.
CHARACTER SETUP 338
PART 4
SMOOTH SKINNING | 26 Using smooth skin influence objects
Avoid changing number of points of influence objects You should avoid changing the number of an influence object’s points (for example, CVs, vertices, or lattice points) after you add it as a smooth skin influence object. Changing the number of points can lead to unexpected deformation effects. Try to be sure you are happy with the object’s topology before you begin using deformers. You might want to save a copy of the object in case you want to do further modeling later. You can work with influence objects as described in the following topics:
Adding an influence object To set add influence options: 1
If you plan to add an influence object immediately after setting options, be sure to go to the bind pose, and position the influence object appropriately.
2
Select Skin > Edit Smooth Skin > Add Influence ❒. The Add Influence Options window is displayed.
Geometry
Click Use Geometry on if you want the influence object’s shape as well as its transform attributes (translation, rotation, and scale) to influence the skin’s shape. Click Use Geometry off if you only want the influence object’s transform attributes (translate, rotate, and scale) to influence the skin’s shape. Default is Use Geometry on.
Dropoff
Specifies the rate at which the influence of the influence object’s position drops as the distance from the influence object increases. Specify values between 0.1 and 100. Default is 4.0.
Polygon Smoothness
Specifies how accurately the smooth skin points follow a given polygonal influence object. The higher the value, the more rounded the deformation effect. Set values between 0.0 and 50.0. Default is 0.0.
NURBS Samples
Specifies the number of samples used to evaluate the influence of a NURBS influence object’s shape. The greater the number of samples, the more closely the smooth skin follows the influence object’s shape. Set values between 1 and 100. Default is 10.
Weight Holding
Specifies that you want to prevent the influence object’s weights from being changed indirectly, typically because of weight normalization during weight painting and editing (see "Holding smooth skin weights" on page 332). Instead, Maya holds the weights to the Default Weight. Default is off.
Default Weight
Specifies the default holding weight if Weight Holding is on. Default is 0.000. 3
Click Add to add the influence object now. or Click Save to save add influence options without adding influence object(s) now. or Click Reset to reset to the default add influence options.
4
SKINNING
Click Close to close the Add Influence Options window.
CHARACTER SETUP 339
SMOOTH SKINNING | 26 Using smooth skin influence objects To add an influence object: 1
Go to the bind pose.
2
Position the influence object.
3
Select the skin, skin object(s) (for example, NURBS surfaces), or skin points (NURBS CVs or polygonal vertices) that you want the object(s) to influence.
4
Also select the influence object.
5
Select Skin > Edit Smooth Skin > Add Influence to add influence object(s) with previously set add influence options. If the Use Geometry option is on (the default), Maya creates an influence object base node. In the Outliner, an influence object base node is added (default name: influenceObjectBase). Note that this is hidden by default, so you won’t see it in the scene.
Removing an influence object To remove an influence object: 1
Select the skin, skin item (for example, NURBS surfaces), or skin points that are being influenced by the object(s).
2
Select the influence object you want to remove.
3
Select Skin > Edit Smooth Skin > Remove Influence.
Editing NURBS influence object attributes When you add a NURBS smooth skin influence object, Maya assigns the object some additional attributes. Maya places these attributes in the object’s Attribute Editor, in a section called Smooth Skin. To edit attributes with the Attribute Editor: 1
Select the smooth skin influence object.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
Open the Smooth Skin tab. Smooth Skin Parameters
Dropoff
Specifies the rate at which the influence object’s influence decreases as the distance from the influence object increases. Specify values between 0.1 and 100. Default is 4.0.
NURBS Samples
Specifies the number of samples used to evaluate the influence of a NURBS influence object’s shape. The greater the number of samples, the more closely the smooth skin follows the influence object’s shape. Specify values between 1 and 100. Default is 10.
Update Weights
Tells Maya to calculate new skin point weights. In calculating the new weights, Maya seeks to recalculate only those skin point weights that would be affected by the change to Dropoff. If you want to go back to using the previous weights, select Edit > Undo.
CHARACTER SETUP 340
PART 4
SMOOTH SKINNING | 26 Examples Specifies that you want to prevent the influence object’s weights from being changed indirectly, typically because of weight normalization during weight painting and editing (see "Holding smooth skin weights" on page 332). Instead, Maya holds the weights to their current weights. Default is off.
Hold Weights
Editing polygonal influence object attributes When you add a polygonal smooth skin influence object, Maya assigns the object some additional attributes. Maya places these attributes in the object’s Attribute Editor, in a section called Smooth Skin. To edit attributes with the Attribute Editor: 1
Select the smooth skin influence object.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
Open the Smooth Skin tab. Smooth Skin Parameters
Dropoff
Specifies the rate at which the influence object’s influence decreases as the distance from the influence object increases. Set values between 0.1 and 100. Default is 4.0.
Smoothness
Specifies how accurately the smooth skin points follow a given polygonal influence object. The higher the value, the more rounded the deformation effect. Set values between 0 and 50.
Update Weights
Tells Maya to calculate new skin point weights. In calculating the new weights, Maya seeks to recalculate only those skin point weights that would be affected by the change to Dropoff. If you want to go back to using the previous weights, select Edit > Undo.
Hold Weights
Specifies that you want to prevent the influence object’s weights from being changed indirectly, typically because of weight normalization during weight painting and editing (see "Holding smooth skin weights" on page 332). Instead, Maya holds the weights to their current weights. Default is off.
EXAMPLES This section offers some examples of smooth skinning:
Skinning a cylinder by smooth skinning This example is similar to "Skinning a cylinder by rigid skinning" on page 375, so that you can compare smooth skinning with rigid skinning. To create the cylinder: •
SKINNING
Create a NURBS cylinder with the default options, except set Ratio of Height to Radius to 8, Number of Sections to 16, and number of Spans to 32.
CHARACTER SETUP 341
SMOOTH SKINNING | 26 Examples
To create the skeleton for the cylinder: •
Build a skeleton for the cylinder. Have the skeleton consist of a single joint chain with about seven joints.
Skeleton consisting of one joint chain (joint1 through joint7). Joint4 starts approximately in the center of the cylinder.
To bind by smooth skinning: 1
Select skeleton’s root joint (default name: joint1).
2
Select Skin > Bind Skin > Smooth Bind. Maya binds the cylinder to the skeleton by smooth skinning, using the default bind skin options. The cylinder is now a smooth skin object. For more information on binding smooth skin, see "Binding smooth skin" on page 319. Now you can exercise the skeleton and get immediate deformation effects appropriate for the character. To exercise skeleton:
1
CHARACTER SETUP 342
Select the joint approximately at the center of the cylinder (for instance, joint4), and rotate it about 90 degrees.
PART 4
SMOOTH SKINNING | 26 Examples
Joint4 rotated 90 degrees.
Note that smooth skinning provides a smooth deformation effect around the rotated joint. However, the creasing might be a bit too rounded for the deformation of a character’s limb. For example, if you were setting up the deformation around a character’s elbow, you might want the creasing to be a bit sharper at the inside angle of the bend, though still rounded around the rest of the joint. You can adjust the deformation effect with the Paint Skin Weights Tool. To paint creasing effects: 1
Select smooth shaded display mode (default shortcut: press 5 key).
2
Select the cylinder.
3
Select Skin > Edit Smooth Skin > Paint Skin Weights Tool ❒. (For more information, see "Painting smooth skin point weights" on page 327.)
4
In the Tool Settings window, the Skin Paint tab should be displayed.
5
Note the Influence box. The Influence box lists the names all the joints.
6
Click on a joint name. For example, click joint3. In the scene, the shading indicates the joint’s influence. The whiter the color, the greater the influence of the joint.
Influence of joint3.
SKINNING
CHARACTER SETUP 343
SMOOTH SKINNING | 26 Examples Note how the joint’s influence fades into black as the distance from the joint increases. 7
In the Influence box, click on another joint name. For example, click joint4.
Influence of joint4.
Again, note how the joint’s influence fades into black as the distance from the joint increases. Also note how the joints gradually influence the bending and creasing. 8
Check the influence of one more of the joints. For example, check the influence of joint2.
Influence of joint2.
Joint2 mainly influences the skin below the bend, but does provides some gradual influence in the bend area. Similarly, joints above the bend (for example, joint5) also gradually influence the deformation in the bend area.
CHARACTER SETUP 344
PART 4
SMOOTH SKINNING | 26 Examples Now you will edit the influence of the joints to get a sharper creasing effect. You can do this by increasing how the joints nearest the bend influence the creasing, and lessening how joints further from the bend influence the creasing. 9
Use the Paint Skin Weights Tool’s brush to paint how the joints influence creasing. The brush provides an intuitive way to change how the influence of the joints. Use the brush’s Add operation to increase the influence of nearby joints, and use the Scale operation to decrease the influence of further joints. Use the Smooth operation to smooth out the influences of the joints. For more information on using paint tools, see Using Maya: Painting. Try to get the creasing to look something like the following, which is closer to what you might want for an elbow deformation:
Painting influences of nearby joints to edit the deformation effect. You can now see the influence of joint3.
Experiment with using the brush. With just a little experimentation, you can quickly become proficient at painting the skin point weights of joints.
Hand muscle bulge with influence object Setting up hands for animation is one of the most demanding aspects of character setup. With smooth skinning, you can achieve more subtle effects by using influence objects whose actions are driven by nearby joints. When you move your thumb towards your index finger, a muscle along the side of the upper part of your hand (m. interossesus dorsalis) tends to bulge out, indicating the tension in your hand. In rigid skinning, you could use a flexor to provide bulge effects, although positioning a flexor right at where this muscle bulges could be tricky. With smooth skinning, you can use an influence object the provide the deformation. Creating a hand’s skeleton and smooth skin Suppose you have created a model for a hand. The hand consists of NURBS surfaces, with surfaces for the fingers, thumb, and palm area. Suppose you have also created a skeleton for the hand, and have just bound the NURBS surfaces to the skeleton by smooth skinning.
SKINNING
CHARACTER SETUP 345
SMOOTH SKINNING | 26 Examples
Hand with skeleton (local rotation axes displayed)
Now you could set up an influence object to create a hand muscle bulge by creating a polygonal sphere, setting the sphere as an influence object, and then linking the sphere’s scaling to the movement of the skeleton’s thumb. (For more information on smooth skin influence objects, see "Using smooth skin influence objects" on page 338.) To create the polygonal sphere for the muscle bulge: 1
Create a polygonal sphere, adjusting the scale attributes to approximate the muscle shape (for example, set Scale X to 1.5, Scale Y to 0.7, and Scale Z to 0.7).
2
Position the sphere inside hand, between thumb and index finger.
Influence object placed inside hand
Palm skin object (the smooth skinned NURBS surface that the influence object will deform)
CHARACTER SETUP 346
PART 4
SMOOTH SKINNING | 26 Examples To make the polygonal surface an influence object: 1
Select palm skin object. (This is the smooth skinned NURBS surface that the sphere will deform.)
2
Select the sphere.
3
Select Skin > Edit Smooth Skin > Add Influence. (For more information, see "Adding an influence object" on page 339.) To link the bulge to fist formation: Now you will link the rotation of the thumb joint to the scaling of the influence object (the polygonal sphere). Influence object (named pSphere1)
Thumb joint (named thumb1)
1
Open the Set Driven Key window (Animate > Set Driven Key > Set ❒).
2
Load thumb1 (the thumb joint) as driver, select rotate Z attribute, and set the attribute to 0.
3
Load pSphere1 (the influence object) as driven, select the scale Y and scale Z attributes. (Keep scale Y and scale Z at 0.7.)
4
Click Key.
5
Set thumb1’s rotate Z attribute to -40.
6
Set pSphere1’s scale Y attribute to 0.8.
7
Set pSphere1’s scale Z attribute to 1.
8
Click Key.
9
Click Close to close the editor. Testing the deformation Now when the thumb is away from the palm, the muscle will appear to be relaxed.
SKINNING
CHARACTER SETUP 347
SMOOTH SKINNING | 26 Examples
Muscle appears relaxed when thumb is reaching away from hand
But as you rotate the thumb towards the palm, the surface bulges to indicate muscle action.
Muscle appears to bulge as thumb moves towards hand
Using influence objects to prevent unwanted deformation An important use of influence objects is to prevent unwanted deformations from occurring. After smooth skinning, you may find that certain areas deform more than you would like. For example, deformations around a shoulder may be too extreme when you rotate the shoulder joint.
CHARACTER SETUP 348
PART 4
SMOOTH SKINNING | 26 Examples
Extreme deformation effect on smooth skinned shoulder
You can prevent such unwanted effects by adding an influence object whose influence counteracts the influence of other deformations. For example, you could add an influence object near the shoulder area that could counteract any extreme effects resulting from smooth skinning.
Sphere added as influence object counteracts unwanted deformation effect on smooth skinned shoulder
Note that you can use a NURBS or polygonal object of any shape. In this example, you might want to edit the sphere’s shape for more precise control over the final deformation around the shoulder. For more information on smooth skin influence objects, see "Using smooth skin influence objects" on page 338.
SKINNING
CHARACTER SETUP 349
SMOOTH SKINNING | 26 Examples
CHARACTER SETUP 350
PART 4
27
RIGID SKINNING Rigid skinning provides articulated deformation effects by enabling joints to influence sets of deformable object points. If you’d like to explore an example now, see "Example" on page 375.
SKINNING
CHARACTER SETUP 351
RIGID SKINNING | 27 Understanding rigid skinning
UNDERSTANDING RIGID SKINNING
With rigid skinning, only one joint can influence each CV. This can result in rigid bending effects unless you also use flexors or lattice deformers.
With rigid skinning, only one joint can influence each CV, vertex, or lattice point. This provides rigid deformation effects that you can smooth by using lattice deformers, cluster deformers, or flexors.
Rigid skin objects and points During rigid skinning, you bind one or more deformable objects to a skeleton. Once bound, the objects are rigid skin objects (or skin objects, or skin) whose position, orientation, and scale are controlled by the skeleton’s joints. The points (CVs, vertices, or lattice points) of the deformable objects are then referred to as rigid skin points, or skin points. Maya binds rigid skin objects to joints by means of joint cluster nodes. One way you can change the rigid skinning deformation effects is by editing joint cluster attributes (or channels).
Rigid skin point weights During rigid skinning, for each rigid skin point (for example, each CV of each NURBS surface), Maya assigns a rigid skin point weight that controls the influence of a joint on the point (for example, the CV). By default, each joint can influences the skin points of its nearest skin object equally, but you can edit the amount by which a joint can influence a skin point. The main difference between rigid skinning and smooth skinning is that in rigid skinning only one joint can influence a particular skin point (CV, vertex, or lattice point), but in smooth skinning, many joints can influence the same skin point. Because smooth skinning allows many joints to influence the same skin point, you can immediately get smoother deformation effects right after binding skin.
CHARACTER SETUP 352
PART 4
RIGID SKINNING | 27 Understanding rigid skinning
Rigid skin point sets During rigid skinning, for each joint, Maya creates a set of rigid skin points. The set contains all the points (NURBS CVs, polygonal vertices, or lattice points) that can be influenced by a particular joint. By default, the sets are organized into a partition, which means the sets can have no members in common. You can organize points into a partition of sets before you bind skin, arranging for some of the points to become rigid skin points while other points can be influenced by, for example, a cluster or lattice deformer parented to a nearby joint. Using cluster or lattice deformers with rigid skinning can be a good way to get smooth deformation effects around areas such as shoulders, and provide an alternative to using flexors (see "Flexors" on page 353). However, you must plan ahead, and carefully decide which points are going to be affected by what, or your character could suffer from double transformation effects (see "Double transformation effects" on page 311). For more information on sets and partitions, refer to Using Maya: Essentials.
Flexors
Flexors are special deformers designed for use with rigid skinning. They provide various types of deformation effects that improve and enhance the effects provided by rigid skinning. Maya includes five types of flexors:
SKINNING
•
Joint lattice flexors provide smoothing effects around joints. They are based on lattice deformers.
•
Bone lattice flexors provide smoothing and bulging effects around bones. They are based on lattice deformers.
•
Joint sculpt flexors provide rounded deformation effects around joints. They are based on sculpt deformers.
CHARACTER SETUP 353
RIGID SKINNING | 27 Binding rigid skin •
Bone sculpt flexors provide rounded deformation effects around bones. They are based on sculpt deformers.
•
Joint cluster flexors provided weighted deformation control around joints. They are based on cluster deformers. For more information on creating flexors, see "Creating flexors" on page 368.
Related MEL commands MEL commands related to rigid skinning include the following: •
bindSkin
•
bindPose
•
jointCluster
•
jointLattice
•
boneLattice For more information about these commands, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for rigid skinning can include the following: •
Joint cluster nodes that carry out the rigid skinning deformations (default name: jointClustern). When you bind rigid skin, Maya creates a joint cluster node for each joint in the bound skeleton.
•
A bind pose node that saves a skeleton’s bind pose (default name: bindPosen).
•
Tweak nodes that carry out point tweaking on deformable objects after skinning (default name: tweakn).
•
Rigid skin point set nodes (default name: jointnSetm).
•
Rigid skin partition node (default name: jointnskinPartition).
•
Joint lattice nodes for controlling the lattice points of lattice flexors (default name: jointLatticen).
•
Joint lattice flexor free-form deformation algorithm nodes (default name: jointFfdn).
•
Flexor shape nodes for organizing flexor attributes and enabling them to be driven by other attributes using Animate > Set Driven Key > Set (default name: flexorShapen). For more information about these nodes, refer to the online Node and Attribute Reference documentation.
BINDING RIGID SKIN You can set the bind skin options before you bind skin, or immediately bind skin with the current options. After you bind skin, you can check the binding and adjust the skin’s behavior.
CHARACTER SETUP 354
PART 4
RIGID SKINNING | 27 Binding rigid skin
Setting rigid bind options To set bind options: 1
If you also want to bind skin now, select the skeleton (or joints) and then the deformable object(s) you want to bind.
2
Select Skin > Bind Skin > Rigid Bind ❒.
3
The Rigid Bind Skin Options window is displayed. Specifies whether to bind to an entire skeleton or only to selected joints. Selections include Complete Skeleton or Selected Joints.
Bind to
Complete Skeleton specifies that the selected deformable objects will be bound to the entire skeleton, from the root joint on down through the skeleton’s hierarchy, even if you have selected some joint other than the root joint. Binding by complete skeleton is the usual way to bind a character’s skin. Selected Joints specifies that the selected deformable objects will be bound to only the selected joints, not the entire skeleton. Select Complete Skeleton or Selected Joints. Default is Complete Skeleton. Coloring
Specifies whether to color the joints according to the colors automatically assigned to skin point sets. Coloring joints can be helpful later when you are editing skin point set memberships. Click Color Joints on or off. Default is off.
Bind Method
Specifies whether you want to bind by closest point or by partition set. Closest Point specifies that Maya automatically organize deformable object points into skin point sets for you based on the proximity of each point to a joint. For each joint with a bone, a skin point set will be created that includes the points that are closest to the given point. The points are then identified as skin points, with each skin point being a member of only one skin point set. Maya places the skin point sets in a partition, which assures that each point can only be in one set. Finally, each set will be bound to the nearest joint. Partition Set specifies that Maya bind points that you’ve already organized into sets in a partition. You should have as many sets as you have joints. Each set will be bound to the nearest joint. If you select Partition Set, select the name of the partition you wish to bind. Select only partitions containing sets of deformable points.
Partition
Click Closest Point or Partition Set. Default is Closest Point. If you select Partition Set, a list of the currently available partitions is listed. Select the partition you want the rigid skin point sets to be in. •
Click Bind if you want to bind skin now. or
•
Click Save to save the options. or
•
Click Reset to reset to the default options. or
•
SKINNING
Click Close to close the Rigid Bind Skin Options window.
CHARACTER SETUP 355
RIGID SKINNING | 27 Editing rigid skin
Binding skin To bind skin: 1
Select one or more deformable objects, followed by a skeleton’s root joint or a limb’s parent joint.
2
Select Skin > Bind Skin > Rigid Bind. Maya binds skin using the previously set rigid bind options.
Checking the binding Exercise the skeleton to check the rigid skin deformation effects. Rotate the skeleton’s joints to view the rigid skin’s behavior. As you exercise the skeleton, at times you might want to go back to the bind pose. For more information on going to the bind pose, see "Going to the bind pose" on page 356. As you check the binding, you may find that you want to adjust the rigid skin’s behavior.
Adjusting rigid skin behavior If you don’t like the rigid skin’s behavior, you can detach the skin, edit the skeleton or the deformable objects, set new binding options, and then bind again. Skinning can be an iterative process of checking the binding, detaching, editing the skeleton, and then binding again. For more information on detaching skin, see "Detaching rigid skin" on page 366. If you just want to move, rotate, or scale certain skin objects or joints without changing the existing rigid skin point sets and rigid skin point weights, you can do so by detaching and then reattaching the skeleton, or by detaching and then reattaching selected joints only. For more information, see "Detaching and reattaching skeleton" on page 367, and "Detaching and reattaching selected joints" on page 368. To change the smooth skinning deformation effects, you can edit the rigid skin point weights with the Component Editor or the Paint Weights Tool, the same tool you can use to paint cluster deformer weights. As you check the binding, you can use the Paint Weights Tool to view the influence of each joint and change the weights by painting. This tool provides an intuitive way to modify deformation effects. For more information, see "Painting rigid skin point weights" on page 361.
EDITING RIGID SKIN Editing rigid skin is described in the following sections.
Going to the bind pose The bind pose is the pose that the skeleton is in when you bind skin. When you pose a character’s skeleton after skinning, the skeleton’s actions cause deformations to the skin. The only pose that does not cause deformations to the skin is the bind pose. You must return to the bind pose if you decide to bind additional objects or add additional influence objects.
CHARACTER SETUP 356
PART 4
RIGID SKINNING | 27 Editing rigid skin Note that if you bound smooth skin to selected joints only, going to bind pose will nevertheless return all the joints the skeleton to the bind pose. Also, the skeleton will go to the bind pose even if it is parented to group nodes. The group nodes will not prevent going to bind pose. To go to bind pose: 1
Select the character’s skeleton.
2
Select Skin > Go to Bind Pose. The skeleton goes to the pose it had during binding.
Overcoming problems with reaching the bind pose Locked attributes The skeleton will not be able to go to the bind pose right away if the attributes of any of its joints are locked. Typically, joint attributes can be locked by constraints, expressions, IK spline handles, or any IK handles with keys set. These features can drive the values of certain joint attributes, locking them up for exclusive use. That they do lock certain attributes is desirable because it provides for the reliable effects of these features. However, if you want to go to the bind pose, you must first disable the nodes that are locking the attributes. A quick way to do this is to disable all of the nodes by selecting Modify > Enable Nodes > Disable All. Next, select Skin > Go to Bind Pose, and then enable all nodes again by selecting Modify > Enable Nodes > Enable All.
Global and local bind pose To reach its bind pose, the skeleton’s root joint must reach the pose it had during binding, and all the other joints below the root joint must reach the poses they had during binding. The pose of the root joint is relative to the scene’s world space, and the poses of the other joints are relative to the joints above them in the skeleton’s hierarchy. A skeleton reaches its global bind pose when the root joint reaches its bind pose. A skeleton reaches its local bind pose when the other joints reach their bind poses. Depending on what you are doing to the joints (including constraints or expressions, for example), your skeleton might reach its local bind pose, but not its global bind pose. If you get an error message that says your skeleton could only reach its local bind pose, that means that all the joints reached their bind poses except the root joint. You then need only check the root joint for locked attributes or expressions that may be affecting it.
Changing the bind pose To change the bind pose, detach the rigid skin, adjust the skeleton and deformable objects as desired, and then bind skin again.
Editing joint cluster channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a joint cluster channels.
SKINNING
CHARACTER SETUP 357
RIGID SKINNING | 27 Editing rigid skin To edit channels with the Channel Box: 1
Select a joint cluster node (default name: jointnClustern). One quick way to select a joint cluster node is to select a rigid skin object, and then select the joint cluster node in its history from the Channel Box (under INPUTS). Alternatively, select a joint and then select the joint cluster node in its history from the Channel Box (under OUTPUTS). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Envelope
Specifies the deformation scale factor. Default is 1.
Upper Bound
Specifies percent of the length of parent bone along which the cluster weights decrease. The cluster weights decrease from the Upper Value as they approach the joint according to the Upper Dropoff Type. Default is 10.
Upper Value
Specifies the initial cluster weight value at the Upper Bound location. Default is 0.5.
Lower Bound
Specifies the percent of the length of the joint’s bone along which the cluster weights decrease. The cluster weights decrease from the Lower Value as they approach the joint according to the Lower Dropoff Type. Default is 10.
Lower Value
Specifies the initial cluster weight value at the Lower Bound location. Default is 1.
Upper Dropoff Type
Specifies how the cluster weights along the parent bone decrease as they approach the joint. Select linear (1), sine (2), exponential (3), or none (4). Default is linear.
Lower Dropoff Type
Specifies how the cluster weights along the joint’s bone decrease as they approach the joint. Select linear (1), sine (2), exponential (3), or none (4). Default is linear. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing joint cluster attributes To edit attributes with the Attribute Editor: 1
Select a skin cluster node (default name: jointClustern).
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Joint Cluster Attributes, Deformer Attributes, Node Behavior, and Extra Attributes. Joint Cluster Attributes
Upper Bound
Specifies percent of the length of parent bone along which the cluster weights decrease. The cluster weights decrease from the Upper Value as they approach the joint according to the Upper Dropoff Type. Default is 10.
Upper Value
Specifies the initial cluster weight value at the Upper Bound location. Default is 0.5.
CHARACTER SETUP 358
PART 4
RIGID SKINNING | 27 Editing rigid skin Upper Dropoff Type
Specifies how the cluster weights along the parent bone decrease as they approach the joint. Select linear (0), sine (1), exponential (2), or none (3). Default is linear.
Lower Bound
Specifies the percent of the length of the joint’s bone along which the cluster weights decrease. The cluster weights decrease from the Lower Value as they approach the joint according to the Lower Dropoff Type. Default is 10.
Lower Value
Specifies the initial cluster weight value at the Lower Bound location. Default is 1.
Lower Dropoff Type Relative Partial Resolution
Percent Resolution
Angle Interpolation
Specifies how the cluster weights along the joint’s bone decrease as they approach the joint. Select linear (0), sine (1), exponential (2), or none (3). Default is linear. Specifies that the deformation take place only when the parent of the joint cluster handle is moved, rotated, or scaled. Specifies whether Maya provides the complete deformation, or only an approximation of the deformation. Selections include full and partial. Full specifies the complete deformation. Partial specifies an approximation of the deformation, which can improve Maya’s display performance. With partial, Maya rounds down the cluster weights based on the Percent Resolution. Default is full. Specifies the increment percentage by which the joint cluster deformation resolution is rounded down. Maya uses the increment percentage to round off the skin point cluster weights to the next lowest increment. For example, with a Percent Resolution of 5.00, a skin point’s joint cluster weight of .94 would be rounded down to .90. A joint cluster weight of .46 would be rounded down to .45. Default is 5.00. (Available only if Partial Resolution is set to partial.) Specifies the interpolation direction. Use this attribute to correct undesirable discontinuities in the deformation effect when you change joint angles or weight percentages even by a small amount. The discontinuities occur when the joint cluster node is using an inappropriate interpolation direction to guide the deformation effect. To change the interpolation direction, you can set Angle Interpolation to closest, positive, or negative. By default, Angle Interpolation is closest, which provides the usual rigid skinning deformation effects. The default setting is fine for most situations, but when you encounter discontinuities you can adjust the deformation effect by selecting a positive or negative interpolation. Deformer Attributes
Envelope
Specifies the deformation scale factor. Values can vary from 0 to 1. Default is 1. Node Behavior For more information, see "Editing node behavior to improve performance" on page 313. Extra Attributes (No extra attributes by default.)
Editing rigid skin point weights With the Component Editor, you can directly modify the values of individual rigid skin point weights. SKINNING
CHARACTER SETUP 359
RIGID SKINNING | 27 Editing rigid skin To query rigid skin point weights: 1
Select the rigid skin points whose weights you want to edit.
2
Select Window > General Editors > Component Editor. The Component Editor is displayed. The Component Editor displays the component data for currently selected components in the workspace. By default, the Component Editor updates dynamically as you select components in the workspace. Also, as you select components in the Component Editor, the workspace updates dynamically as well.
3
Click on the Joint Clusters tab.The Joint Clusters section lists the weights assigned to CVs, vertices, or lattice points bound to a skeleton’s joints by rigid skinning. To modify a rigid skin point’s weight:
1
In the Component Editor’s spreadsheet, click the component data box you want to edit. Only the component whose box you’ve selected is now selected in the workspace.
2
Enter a new value. To modify several rigid skin point weights at once:
1
In the workspace, select the points whose weights you want to edit.
2
In the Component Editor’s spreadsheet, drag through the component data boxes you want to edit.
3
Enter the value you want all the boxes to have. To modify an entire row or column (UNIX only):
1
In the workspace, select the points whose weights you want to edit.
2
In the Component Editor’s spreadsheet, click one of the boxes in the row or column.
3
Click the row or column heading. Now all the boxes for the row or column are selected.
4
Enter a value for all the boxes in the row or column. To modify an entire row or column (Windows only):
1
In the workspace, select the points whose weights you want to edit.
2
To change all the entries of a row or column, in the Component Editor’s spreadsheet, select the row or column heading.
3
Shift select any of the boxes in that row or column.
4
Enter a new value to update the entire row or column.
CHARACTER SETUP 360
PART 4
RIGID SKINNING | 27 Editing rigid skin
Painting rigid skin point weights
You can paint rigid skin point weights with the Paint Cluster Weights Tool, the same tool you use to paint cluster deformer weights. For more information about the Paint Cluster Weights Tool, see "Painting cluster weights" on page 93. Note that painting rigid skin point weights uses a different painting tool than the tool for painting smooth skin point weights. To paint weights on a rigid bound skin: 1
Select the rigid skin object you want to paint weights on.
2
Go into smooth shading mode (select Shading > Smooth Shade All or press the default hotkey, 5).
3
Select Deform > Paint Cluster Weights Tool ❐.
4
Check that Color Feedback is turned on in the Display section. Color feedback helps you identify the weights on the surface by representing them as grayscale values (smaller values are darker, larger values are lighter).
Tip You can use the default hotkey Alt c to turn Color Feedback on and off outside the Tools Settings Editor. 5
Select the joint cluster you want to paint weights on. In the Paint Attributes section of the Tool Settings window, click the jointClustern.weights button and select the appropriate joint cluster weights name from the pop-up menu. Note that you can only paint weights on one cluster at a time. If you select more than one cluster, you can only paint weights on the active one (the one that provides color feedback).
SKINNING
CHARACTER SETUP 361
RIGID SKINNING | 27 Editing rigid skin If the surface has only one cluster, you can select the surface alone.
Tip If you are painting on a single surface, you can skip step 3 and select the joint cluster without opening the Tool Settings window by right-clicking the surface and selecting the appropriate joint cluster weights name from the Paint command submenu. 6
Select a brush, paint operation, and value and define other settings as required. See "Painting cluster weights" on page 93.
7
Drag the brush across the cluster.
Tip You can quickly pick weight values from one cluster and paint them on another cluster or the same cluster using hotkeys. 1
Select the cluster with the weight values you want to pick.
2
Hold down the Pick Color Mode hotkey (default hotkey: /), click on the area of the cluster with the weight you want to pick, then release the hotkey.
3
If you are painting the picked weight on the same cluster, drag the brush across the cluster. If you are painting the picked weight on another cluster, select that cluster, then drag the brush across it.
CHARACTER SETUP 362
PART 4
RIGID SKINNING | 27 Editing rigid skin
Editing rigid skin point set membership
You can directly edit rigid skin point set membership with the Edit Membership Tool. For a more intuitive approach, you can also paint rigid skin point set memberships with the Paint Set Membership Tool (see "Painting rigid skin point set membership" on page 364). Note that you can also edit rigid skin point set memberships from the Relationship Editor (Window > Relationship Editors > Deformer Sets), but this approach is less intuitive than using the Edit Membership Tool or the Paint Set Membership Tool. To edit set membership with the Edit Membership Tool: 1
Go into object selection mode (click the select by object type icon).
2
Select the joint whose set you want to edit.
3
Go into component selection mode (click the select by component type icon).
4
Select Deform > Edit Membership Tool.
5
Using the pointer, select the points whose rigid skin point set membership you want to change. The members of the rigid skin point set whose joint you selected are displayed in yellow. This set is the currently selected set. Members of other sets are displayed in the colors associated with the sets’ joints. Points displayed in dark red are not in a set.
6
To add points to the currently selected set, select them while pressing the Shift key and left mouse button, and then release the mouse button. The selected points are now displayed in yellow, indicating they are in the currently selected set.
7
SKINNING
To remove points from the currently selected set, select them while pressing the Ctrl key and the left mouse button, and then release the mouse button.
CHARACTER SETUP 363
RIGID SKINNING | 27 Editing rigid skin The selected points are now displayed in dark red, indicating they are currently not in a set. Points that are not in rigid skin point set will not be affected by the skeleton’s actions, so in general you’ll want to have all the points in a set. Of course, the points do not necessarily have to be in a rigid skin point set; they could be in, for example, a cluster deformer set whose handle is parented to some part of the skeleton’s hierarchy. 8
To add points to some other rigid skin point set, first select the rigid skin point set’s joint. The points currently in the set are displayed in yellow. Now, as before, select the points you want to add while pressing the Shift key and the left mouse button, and then release the mouse button.
Painting rigid skin point set membership
You can paint rigid skin point set membership in the same way you paint deformer set membership. (For more detailed information, see "Painting deformer set membership" on page 47.) To paint rigid skin point set membership: 1
Select the rigid skin object(s).
2
Go into smooth shading mode (default shortcut: 5 key).
3
Select Deform > Paint Set Membership Tool ❒. The SetMembership tab should be selected.
4
In the Set Membership box, select the joint set with the point memberships you want to edit.
5
Use the brush to add, transfer, or remove set memberships. For more information about painting tools, see Using Maya: Painting.
CHARACTER SETUP 364
PART 4
RIGID SKINNING | 27 Editing rigid skin To paint creasing effects: 1
Select smooth shaded display mode (default shortcut: 5 key).
2
Select the cylinder.
3
Select Deform > Paint Cluster Weights Tool ❒. (For more information, see "Painting rigid skin point weights" on page 361.)
4
In the Paint Weights section of the Tool Settings window, notice the joint1Cluster1.weights button. Click this button to list the names of all the rigid skin point clusters.
5
Select a rigid skin point cluster. For example, cluster-joint3Cluster1 > weights. In the scene, the shading indicates the weighting of each point in the set.
SKINNING
6
Select another rigid skin point cluster. For example, select cluster-joint4Cluster1 > weights.
7
Check the other rigid skin point cluster. For example, check cluster-joint2Cluster1.
CHARACTER SETUP 365
RIGID SKINNING | 27 Editing rigid skin
8
Use the Paint Cluster Weights Tool’s brush to smooth the deformation effect.
The brush provides an intuitive way to change the influence of the joints. Use the brush’s Add operation to increase the influence of nearby joints, and use the Scale operation to decrease the influence of further joints. Use the Smooth operation to smooth out the influences of the joints. Experiment with using the brush. With just a little experimentation, you can quickly become proficient at painting the skin point weights of joints. For more information on using paint tools, see Using Maya: Painting. To further smooth and deform rigid skinning, you can use flexors. For more information, see "Creating flexors" on page 368.
Detaching rigid skin After you have bound skin, you might decide that you want to modify the skeleton, change the bind pose, or do some further modeling on the skin. To do these things you must first detach the skin from the skeleton, and then when you’re done you must bind skin again. Detaching skin does not preserve the rigid skin point sets and the rigid skin point weights. If you want to preserve the rigid skin point sets, see "Detaching and reattaching skeleton" on page 367 and "Detaching and reattaching selected joints" on page 368. To set detach skin options: 1
If you want to detach now, select the skin object(s) you want to detach.
2
Select Skin > Detach Skin ❒.
CHARACTER SETUP 366
PART 4
RIGID SKINNING | 27 Editing rigid skin The Detach Skin Options window is displayed. Specifies what effect detaching skin will have on the position of rigid skin objects, and on the rigid skinning (jointCluster) nodes upstream of the objects. Selections include Delete History, Keep History, or Bake History.
History
Delete History will detach the skin, move it to its original, undeformed shape, and delete the rigid skinning (jointCluster) nodes. Keep History will detach the skin and move it to its original, undeformed shape. It will not delete the skin’s rigid skinning (jointCluster) nodes. Bake History will detach the skin and delete the skin’s rigid skinning (jointCluster) nodes, but will not move the skin to its original, undeformed shape. The skin will maintain its current shape after detachment. Specify Delete History, Keep History, or Bake History. Default is Delete History. Specifies whether to remove the joint colors assigned during binding. Click on or off. Default is on.
Coloring
3
Click Detach to detach skin. or Click Save to save detach options without detaching skin. or Click Reset to reset to default detach skin options. To detach skin:
1
Select skeleton(s).
2
Select Skin > Detach Skin to detach skin with previously set detach skin options. Unless the History detach skin option was set to Bake History, the skin objects move to their undeformed, bind pose positions. Their transform (Translate, Rotate, and Scale) attributes are unlocked. Unless the History detach skin option was set to Keep History, Maya deletes rigid skinning (jointCluster) nodes upstream of the objects.
Detaching and reattaching skeleton Detaching a skeleton from its skin objects unlocks the transform attributes of the objects so that you can reposition them. Unlike detaching skin, detaching skeletons preserves the rigid skin point sets and the rigid skin point weights. Detaching and reattaching a skeleton is especially useful if you want to move, rotate, or scale the skin objects directly while not changing which joints influence which rigid skin points. To detach skeleton: 1
Select the skeleton’s root joint, or any joint on the skeleton.
2
Select Skin > Edit Rigid Skin > Preserve Skin Groups > Detach Skeleton. The skin objects that were being influenced by the now detached skeleton move to their undeformed positions. The transform (Translate, Rotate, and Scale) attributes (or channels) of the objects are now unlocked, so you can now move, rotate, or scale the objects.
SKINNING
CHARACTER SETUP 367
RIGID SKINNING | 27 Creating flexors To reattach skeleton: 1
Select the skeleton’s root joint, or any joint on the skeleton.
2
Select Skin > Edit Rigid Skin > Preserve Skin Groups > Reattach Skeleton.
Detaching and reattaching selected joints This procedure is similar to detaching and reattaching a skeleton, except that it only applies to selected joints. Detaching selected joints from the skin objects they influence unlocks the transform attributes of the objects so that you can reposition them. Detaching selected joints preserves the rigid skin point sets and the rigid skin point weights. Detaching and reattaching selected joints is especially useful if you want to move, rotate, or scale certain skin objects directly while not changing which joints influence which rigid skin points. To detach selected joints: 1
Select the joints you want to detach.
2
Select Skin > Edit Rigid Skin > Preserve Skin Groups > Detach Selected Joints. The skin objects that were being influenced by the now detached joints move to their undeformed positions. The transform (Translate, Rotate, and Scale) attributes (or channels) of the objects are now unlocked, so you can now move, rotate, or scale the objects. To reattach selected joints:
1
Select the joints you want to reattach.
2
Select Skin > Edit Rigid Skin > Preserve Skin Groups > Reattach Selected Joints.
CREATING FLEXORS You can create five types of flexors: •
Joint lattice flexors
•
Bone lattice flexors
•
Joint sculpt flexors
•
Bone sculpt flexors
•
Joint cluster flexors
Creating all types of flexors To create flexors: 1
Put the skeleton into bind pose. You can create a flexor if the skeleton is not in its bind pose, but you might get unexpected deformation effects.
2
CHARACTER SETUP 368
If you want to create one or more joint lattice, joint sculpt, or joint cluster flexors, select the joints on which you want to create the flexors.
PART 4
RIGID SKINNING | 27 Creating flexors 3
If you want to create one or more bone lattice or bone sculpt flexors, select the bones on which you want to create the flexors. Note that by default bone lattice flexors are driven by the child joints of the joints whose bones you select for them. This is what you would usually want for most character setup situations. However, after you create the bone lattice flexors, you can assign any other joint in the skeleton to drive them (see "Reassigning bone lattice flexor joints" on page 373).
4
Select Skin > Edit Rigid Skin > Create Flexor.
5
The Create Flexor window is displayed.
Flexor Type
Specifies whether to create lattice flexors, sculpt flexors, or joint cluster flexors. Select lattice, sculpt, or joint cluster. Default is lattice.
Joints
Specifies whether to create joint lattice, joint sculpt, or joint cluster flexors at selected joints only, or at all a skeleton’s joints. Click At Selected Joint(s) or At All Joint(s). Default is At Selected Joint(s).
Bones
Specifies whether to create bone lattice or bone sculpt flexors at selected bones only, or at all bones. Click At Selected Bone(s) or At All Bone(s) to create. Default specifies no bone flexors will be created. This option does not apply to joint cluster flexors. Lattice Options If Flexor Type is lattice, specify the Lattice Options:
S, T, U Divisions
Specifies the structure of the lattice in the lattice’s local STU space. (STU space provides a special coordinate system for specifying the structure of lattices.) You can specify the lattice’s structure in terms of S, T, and U divisions. When you specify the divisions, you also specify the number of lattice points in the lattice, because the lattice points are located where the divisions meet on the lattice’s exterior. The greater the number of divisions, the greater the lattice point resolution. Though your control over the deformation increases with the number of lattice points, the performance may be affected. The default settings are S has 2 divisions, T has 5 divisions, and U has 2 divisions, which provides 20 lattice points. You can quickly change the settings by using the sliders to select values from 2 to 20.
Position the Flexor
Specifies that you want to move, rotate, or scale the lattice now, before you create the lattice flexor. This enables you to adjust the lattice before it starts having an effect on skin objects. Click Position the Flexor, and then use the Move Tool, Rotate Tool, or Scale Tool to adjust the lattice now. Sculpt Options If Flexor Type is sculpt, specify the Sculpt Options:
Max Displacement
Dropoff Distance
SKINNING
Specifies the distance that the sculpt sphere can push a skin object’s points from the sculpt sphere’s surface.Use slider to select values from 0.000 to 2.000. Default is 0.000. Specifies the sculpt sphere’s range of influence. (How the range of influence can decline is specified by Dropoff Type.) Use slider to select values from 0.000 to 20.000. Default is 0.000.
CHARACTER SETUP 369
RIGID SKINNING | 27 Editing joint lattice flexor effects Dropoff Type
Specifies how the sculpt sphere’s range of influence declines or drops off. (The range of influence is specified with the Dropoff Distance.) There are two Dropoff Types: None and Linear. Default is None.
Mode
Specifies the sculpt sphere’s deformation mode as flip, project, or stretch. Select Flip, Project, or Stretch. Default is Stretch.
Inside Mode
Specifies how the sculpt sphere influences the skin points located inside the sculpt sphere. There are two modes: Ring and Even. Ring mode pushes inside points outside of the sculpt sphere, creating a contoured, ring-like effect around the sculpt sphere. Even mode spreads the inside points all around the sculpt sphere evenly, creating a smooth, spherical effect.
Select Ring or Even. Default is Ring. Cluster Options (No options for joint cluster flexors.) •
Click Create to create flexors now. or
•
Click Close to save the options and close the window.
EDITING JOINT LATTICE FLEXOR EFFECTS You can edit joint lattice flexor effects as described in the following sections.
Manipulating the joint lattice flexor’s influence lattice You can manipulate the joint lattice flexor’s influence lattice in the same way that you can manipulate the lattice deformer’s influence lattice. You can move, rotate, or scale the lattice, or you can move, rotate, or scale lattice points.
Copying joint lattice flexors After you create a lattice flexor and adjust it, you might decide you want a similar lattice flexor elsewhere. For example, if you create a lattice flexor around a character’s left elbow joint, you might then decide to create a similar lattice flexor at the right elbow joint. You can now copy joint lattice flexors. When you copy, all of the attribute values and connections are copied. Note that you can also copy bone lattice flexors. To copy joint lattice flexors: 1
Go to the bind pose (Skin > Go to Bind Pose).
2
Select a flexor (for example, select a lattice flexor called jointFfdnLattice).
3
Select the joint where you want to have a copy of the flexor.
4
Skin > Edit Rigid Skin > Copy Flexor.
CHARACTER SETUP 370
PART 4
RIGID SKINNING | 27 Editing joint lattice flexor effects
Editing joint lattice flexor channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a joint lattice flexor’s channels. To edit channels with the Channel Box: 1
Select a joint lattice flexor node (default name: jointFlexorn). One quick way to select the flexor node is to select the flexor’s influence lattice, and then select the joint lattice flexor node in its history from the Channel Box (under SHAPES). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed by default:
Creasing
Specifies the bulging of skin points on the inside of the joint rotation. As you change Creasing, the lattice points on the inside of the joint rotation move inward or outward to change the shape of the bulge. Positive values cause the skin to bulge inward. Negative values cause the skin to tuck inward. Default is 0.
Rounding
Specifies the bulging of skin points on the outside of the joint rotation. As you change Rounding, the lattice points on the outside of the joint rotation move inward or outward to change the shape of the bulge. Positive values cause the skin to bulge outward. Negative values cause the skin to tuck inward. Default is 0.
Length In
Specifies the positions of the lattice divisions that are near the parent bone above the joint. As you change Length In, the lattice divisions along the parent bone move away from or towards the joint. This changes the extent of the effects of Creasing, Rounding, Width Left, and Width Right. Positive values spread the bulging effects up along the parent bone by moving lattice divisions away from the joint. Negative values compress the bulging effects closer to the joint by moving the lattice divisions closer to the joint. Default is 0.
Length Out
Specifies the positions of the lattice divisions that are near the joint’s child bone. As you change Length Out, the lattice divisions along the joint’s child bone move away from or towards the joint. This changes the extent of the effects of Creasing, Rounding, Width Left, and Width Right. Positive values spread the bulging effects down along the joint’s child bone by moving lattice divisions away from the joint. Negative values compress the bulging effects closer to the joint by moving the lattice divisions closer to the joint. Default is 0.
Width Left
Specifies the bulging of skin points on the left side of the joint rotation. As you change Width Left, the lattice points on the left side of the joint rotation move outward or inward to change the shape of the bulge. Positive values cause the skin to bulge outward. Negative values cause the skin to bulge inward. Default is 0.
Width Right
Specifies the bulging of skin points on the right side of the joint rotation. As you change Width Right, the lattice points on the right side of the joint rotation move outward or inward to change the shape of the bulge. Positive values cause the skin to bulge outward. Negative values cause the skin to bulge inward. Default is 0. 3
SKINNING
Click on a channel name with the left mouse button.
CHARACTER SETUP 371
RIGID SKINNING | 27 Editing bone lattice flexor effects 4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
EDITING BONE LATTICE FLEXOR EFFECTS You can edit bone lattice flexor effects by the following: •
Manipulating bone lattice flexor’s influence lattice
•
Copying bone lattice flexors
•
Editing bone lattice flexor channels
Manipulating bone lattice flexor’s influence lattice You can manipulate the bone lattice flexor’s influence lattice in the same way that you can manipulate the lattice deformer’s influence lattice. You can move, rotate, or scale the lattice, or you can move, rotate, or scale lattice points.
Copying bone lattice flexors To copy bone lattice flexors: 1
Go to the bind pose (Skin > Go to Bind Pose).
2
Select a flexor (for example, select a lattice flexor called jointFfdnLattice).
3
Select the bone where you want to have a copy of the flexor.
4
Select Skin > Edit Rigid Skin > Copy Flexor.
Editing bone lattice flexor channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a bone lattice flexor’s channels. By default, the effects specified by the bone lattice flexor channels are driven by the child joints of the joints whose bones you selected for them when you created the flexors. This is what you would usually want for most character setup situations. However, you can assign any other joint in the skeleton to drive them (see “Reassigning bone lattice flexor joints” on page 298). To edit channels with the Channel Box: 1
Select a bone lattice flexor node (default name: boneFlexorn). One quick way to select the flexor node is to select the flexor’s influence lattice, and then select the bone lattice flexor node in its history from the Channel Box (under SHAPES). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
CHARACTER SETUP 372
In the Channel Box, the following channels are listed by default:
PART 4
RIGID SKINNING | 27 Editing bone lattice flexor effects Bicep
Specifies the bulging of skin points on the inside of the child joint’s rotation. As you change Bicep, the lattice points on the inside of the joint rotation move inward or outward to change the shape of the bulge. Positive values cause the skin to bulge inward. Negative values cause the skin to tuck inward. Default is 0.
Tricep
Specifies the bulging of skin points on the outside of the child joint’s rotation. As you change Tricep, the lattice points on the outside of the joint rotation move inward or outward to change the shape of the bulge. Positive values cause the skin to bulge outward. Negative values cause the skin to tuck inward. Default is 0.
Length In
Specifies the positions of the lattice divisions that are near the bone’s joint, above the center of the bone. As you change Length In, the lattice divisions near the bone’s joint move away from or towards the bone’s center. This changes the extent of the effects of Bicep, Tricep, Width Left, and Width Right. Positive values spread the bulging effects up along the bone by moving lattice divisions away from the bone’s center. Negative values compress the bulging effects by moving the lattice divisions closer to the bone’s center. Default is 0. Note that Length In does not affect the position of the furthest lattice division.
Length Out
Specifies the positions of the lattice divisions that are near the bone’s child joint, below the center of the bone. As you change Length Out, the lattice divisions along the bone move away from or towards the center of the bone. This changes the extent of the effects of Bicep, Tricep, Width Left, and Width Right. Positive values spread the bulging effects down along the bone by moving lattice divisions away from the bone’s center. Negative values compress the bulging effects by moving the lattice divisions closer to the bone’s center. Default is 0. Note that Length Out does not affect the position of the furthest lattice division.
Width Left
Specifies the bulging of skin points on the left side of the child joint’s rotation. As you change Width Left, the lattice points on the left side of the joint rotation move outward or inward to change the shape of the bulge. Positive values cause the skin to bulge outward. Negative values cause the skin to bulge inward. Default is 0.
Width Right
Specifies the bulging of skin points on the right side of the child joint’s joint rotation. As you change Width Right, the lattice points on the right side of the joint rotation move outward or inward to change the shape of the bulge. Positive values cause the skin to bulge outward. Negative values cause the skin to bulge inward. Default is 0. 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Reassigning bone lattice flexor joints By default, the joint that drives a bone lattice flexor is the child of the bone that the flexor’s influence lattice surrounds. This makes sense for situations such as creating arm bicep muscle effects, where the rotation of the elbow joint drives a bulge deformation around the shoulder joint’s bone. In fact, it makes sense for most of the muscle deformation effects you might want for conventional human characters. However, you can have the action of the bone lattice flexor be driven by any other joint you wish. The most common situation might be where you want the rotation of the joint whose bone the influence lattice surrounds drive the bone lattice flexor. For instance, for some reason you might want to have the rotation of the shoulder joint
SKINNING
CHARACTER SETUP 373
RIGID SKINNING | 27 Editing joint or bone sculpt flexor effects drive the bulge around the shoulder joint’s bone. Keep in mind that you can have any joint drive the bone lattice flexor. For instance, you could have the rotation of a finger joint drive a bone lattice flexor around a character’s head. To reassign bone lattice flexor joints: 1
Select the bone lattice flexor’s lattice.
2
Select the joint that you want to have drive the bone lattice flexor. Note that the bone lattice flexor cannot be assigned to a bone whose joint is the skeleton’s root joint.
3
Select Skin > Edit Rigid Skin > Reassign Bone Lattice Joint. The bone lattice flexor is now driven by the joint you’ve selected. Remember that to see the effects of the bone lattice flexor, you must set the bone lattice flexor’s channels to values other than zero. For more information, see "Editing bone lattice flexor channels" on page 372.
EDITING JOINT OR BONE SCULPT FLEXOR EFFECTS You can edit joint or bone sculpt flexor effects by the following: •
Manipulating the sculpt sphere
•
Editing sculpt flexor channels
Manipulating the sculpt sphere You can directly manipulate the sculpt flexor’s sculpt sphere in the same way that you can manipulate a sculpt deformer’s sculpt sphere.
Editing sculpt flexor channels Channels are the keyable attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a bone lattice flexor’s channels. To edit channels with the Channel Box: 1
Select a bone lattice flexor node (default name: boneFlexorn). One quick way to select the flexor node is to select the flexor’s influence lattice, and then select the bone lattice flexor node in its history from the Channel Box (under SHAPES). Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Envelope Max Displacement Dropoff Distance
CHARACTER SETUP 374
In the Channel Box, the following channels are listed by default: Specifies the deformation scale factor. Default is 1. Specifies the distance that the sculpt sphere can push a skin object’s points from the sculpt sphere’s surface. Default is 0. Specifies the sculpt sphere’s range of influence. Default is 0.
PART 4
RIGID SKINNING | 27 Editing joint cluster flexor effects 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
EDITING JOINT CLUSTER FLEXOR EFFECTS You can edit joint cluster effects by using manipulators.
Editing with joint cluster flexor manipulators Cluster flexors include manipulators you can use to edit their deformation effects. A cluster flexor’s manipulators include a pair of rings. Each ring includes two manipulators: a diamond manipulator and a radial manipulator. Located at the center of the ring and along the center of a bone, the diamond manipulator controls the extent of the smoothing provided by the cluster flexor. Located on the ring, the radial manipulator controls the magnitude of the smoothing. To edit with the cluster flexor manipulators: 1
Select the cluster flexor handle (the J icon).
2
Select the Show Manipulator Tool.
3
To edit the extent of smoothing, select one of the diamond manipulators.
4
Use the left mouse button to drag the diamond manipulator towards or away from the joint. The extent of smoothing changes as you drag the manipulator. Note that the joint cluster’s Upper Bound or Lower Bound channels change as you drag. For more information on these channels, see "Editing joint cluster channels" on page 357.
5
To edit the magnitude of smoothing, select one of the radial manipulators.
6
Use the left mouse button to drag the radial manipulator towards or away from the diamond manipulator. The magnitude of smoothing changes as you drag the manipulator. Note that the joint cluster’s Upper Value or Lower Value channels change as you drag. For more information on these channels, see "Editing joint cluster channels" on page 357.
EXAMPLE Skinning a cylinder by rigid skinning This example is similar to "Skinning a cylinder by smooth skinning" on page 341, so that you can compare rigid skinning with smooth skinning. To create the cylinder: •
SKINNING
Create a NURBS cylinder with the default options, except set Ratio of Height to Radius to 8, Number of Sections to 16, and number of Spans to 32.
CHARACTER SETUP 375
RIGID SKINNING | 27 Example
To create the skeleton for the cylinder: •
Build a skeleton for the cylinder. Have the skeleton consist of a single joint chain with about seven joints.
Skeleton consisting of one joint chain (joint1 through joint7). Joint4 starts approximately in the center of the cylinder.
To bind by rigid skinning: 1
Select skeleton’s root joint (default name: joint1).
2
Select Skin > Bind Skin > Rigid Bind. Maya binds the cylinder to the skeleton by rigid skinning, using the default bind skin options. The cylinder is now a rigid skin object. For more information on binding rigid skin, see "Binding rigid skin" on page 354. Now you can exercise the skeleton and get immediate deformation effects appropriate for the character. To exercise skeleton: Select the joint approximately at the center of the cylinder (for instance, joint4), and rotate it about 90 degrees.
CHARACTER SETUP 376
PART 4
RIGID SKINNING | 27 Example
Note that rigid skinning provides a sharp deformation effect around the rotated joint. You can adjust the deformation effect with the Paint Weights Tool. To paint creasing effects: 1
Select smooth shaded display mode (default shortcut: 5 key).
2
Select the cylinder.
3
Select Deform > Paint Cluster Weights Tool ❒. (For more information, see "Painting rigid skin point weights" on page 361.)
4
In the Tool Settings window, the Weight tab should be displayed.
5
Note the Clusters box. The Clusters box lists the names all the rigid skin point sets (default names: jointnSetn).
6
Click on a rigid skin point set. For example, joint3Set1. In the scene, the shading indicates the weighting of each point in the set.
7
SKINNING
In the Clusters box, click on another rigid skin point set. For example, click joint4Set1.
CHARACTER SETUP 377
RIGID SKINNING | 27 Example
8
Check the other rigid skin point sets. For example, check joint2Set1.
9
Use the Paint Cluster Weights Tool’s brush to smooth the deformation effect.
The brush provides an intuitive way to change how the influence of the joints. Use the brush’s Add operation to increase the influence of nearby joints, and use the Scale operation to decrease the influence of further joints. Use the Smooth operation to smooth out the influences of the joints. Experiment with using the brush. With just a little experimentation, you can quickly become proficient at painting the skin point weights of joints. For more information on using paint tools, see Using Maya: Painting. To further smooth and deform rigid skinning, you can use flexors. For more information, see "Creating flexors" on page 368.
CHARACTER SETUP 378
PART 4
PART 5
CONSTRAINTS
28
INTRODUCING CONSTRAINTS Constraints enable you to constrain the position, orientation, or scale of an object to other objects. Further, with constraints you can impose specific limits on objects and automate animation processes.
UNDERSTANDING CONSTRAINTS Using constraints, you can control the position, orientation, or scale of one object based on the position, orientation, or scale of one or more “target” objects. In addition, you can impose specific limits on objects and automate animation processes. For example, if you want to quickly animate a sled sliding down a bumpy hill, you might first use a geometry constraint to constrain the sled to the surface. You could then use a normal constraint to make the sled sit flat on the surface. After you create these constraints, you key the sled’s positions at the top and bottom of the hill. The animation is then complete. Maya includes eight types of constraints for character setup and animation:
CONSTRAINTS
CHARACTER SETUP 381
INTRODUCING CONSTRAINTS | 28 Constraint node behavior •
Point constraints: Point constraints constrain an object’s position to the position of one or more objects. For more information, see “Using Point Constraints” in Chapter 29.
•
Aim constraints: Aim constraints constrain an object’s orientation so that it always aims at other objects. For more information, see “Using Aim Constraints” in Chapter 30.
•
Orient constraints: An orient constraint causes an object to follow the orientation of one or more objects. For more information, see “Using Orient Constraints” in Chapter 31.
•
Scale constraints: A scale constraint causes an object to follow the scaling of one or more objects. For more information, see “Using Scale Constraints” in Chapter 32.
•
Geometry constraints: A geometry constraint restricts an object to a NURBS surface, NURBS curve, or polygonal surface (mesh). For more information, see “Using Geometry Constraints” in Chapter 33.
•
Normal constraints: Normal constraints constrain an object’s orientation so that it aligns with the normal vectors of a NURBS or polygonal surface (mesh). “Using Normal Constraints” in Chapter 34.
•
Tangent constraints: Tangent constraints constrain an object’s orientation so that the object always points in the direction a curve. For more information, see “Using Tangent Constraints” in Chapter 35.
•
Pole vector constraints: A pole vector constraint constrains an IK rotate plane handle’s pole vector. For more information, see “Using Pole Vector Constraints” in Chapter 36. Note that other software packages use the term “animation controllers” to refer to what Maya calls constraints.
CONSTRAINT NODE BEHAVIOR You don’t need to know about constraint node behavior in order to use constraints effectively. If you are new to constraints, you can skip this section. However, familiarity with constraint node behavior can provide you with more control over constraint manipulation and performance. For each object in your scene, if there has been any change to its node or any of the nodes in its history (its upstream or downstream nodes), Maya will evaluate the nodes and update the display based on the node’s node behavior attributes. The node behavior attributes for constraint nodes can affect how constraint effects are evaluated and displayed.
Understanding node behavior attributes The node behavior attributes include Caching and Node State. Caching
CHARACTER SETUP 382
Specifies that Maya store the results of upstream evaluations, and then provide those results to the node. This saves Maya from having to re-evaluate the upstream nodes every time the node needs the results. If there are no changes to the upstream nodes, then this setting can improve display performance with no loss of results. However, note that caching uses more memory than would otherwise be used, which could adversely affect performance. Also, if there are changes to upstream nodes, more memory is allocated and then freed, which could also adversely affect display performance. PART 5
INTRODUCING CONSTRAINTS | 28 Enabling and disabling all constraint nodes Node State
Set Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, WaitingHasNoEffect, or Waiting-Blocking. (Note that for constraints the Node State attribute is available as a channel in the Channel Box.)
Normal
Specifies that Maya evaluate and display the constraint. Maya will evaluate the node as usual. This is the default.
HasNoEffect
Specifies that Maya prevent the constraint, but display the object. Maya will evaluate the nodes in the node’s history, but not the node itself.
Blocking
Specifies that Maya prevent the constraint, and not display the object. Maya will not report the results of any evaluations of upstream nodes to this node.
Waiting-Normal
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting (Window > Settings/Preferences > Performance Settings) is set to Demand or Release, the node will take the Normal state when you click Update or release the mouse button.
WaitingHasNoEffect
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the HasNoEffect state when you click Update or release the mouse button.
WaitingBlocking
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the Blocking state when you click Update or release the mouse button.
Editing node behavior To set node behavior with Attribute Editor: 1
Open the node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Click Caching on or off.
4
Select the Node State as Normal, HasNoEffect, or Blocking. (The Waiting-Normal, Waiting-HasNoEffect, and Waiting-Blocking states are for Maya’s internal use.)
5
Close the Attribute Editor. To set Node State channel with Channel Box: When editing constraint channels with the Channel Box, you can set the Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking.
ENABLING AND DISABLING ALL CONSTRAINT NODES You can quickly disable (or again enable) all the constraint nodes in a scene. Disabling all constraint nodes sets the Node State attribute of all constraint nodes to HasNoEffect. Enabling all constraint nodes sets the Node State attribute to Normal. For more information on the Node State attribute, see "Constraint node behavior" on page 382.
CONSTRAINTS
CHARACTER SETUP 383
INTRODUCING CONSTRAINTS | 28 Workflow summary To disable all constraint nodes: Turn off Modify > Enable Nodes > Constraints. To enable all constraint nodes: Turn on Modify > Enable Nodes > Constraints.
WORKFLOW SUMMARY Creating constraints can be as simple as selecting the objects you want to constrain with, selecting the object you want to constrain, and then selecting the appropriate constraint from the Constrain menu. Using constraints can become more complicated as you seek to go beyond the default options for constraints. Some constraints lock the some of the channels of constrained objects. For example, the aim constraint locks the orientation channels (Rotate X, Y, and Z) of the object it constrains. Which channels get locked dictates how you can you use more than one constraint on an object. For a given object, you can use either an aim constraint, normal constraint, or tangent constraint because each of these constraints locks the orientation channels of a constrained object. Attributes locked by constraints can also preclude the use of expressions on those attributes. If the locked attributes are on joints, those locked attributes can prevent the skeleton from returning to its bind pose.
CHARACTER SETUP 384
PART 5
29
USING POINT CONSTRAINTS With point constraints, you can constrain an object’s position to the position of one or more objects. If you want to constrain an object so that it points at other objects, use the aim constraint (see Chapter 30, “Using Aim Constraints”). Additionally, point on curve locator constraints enable you to control the shape of a NURBS curve at any point along the curve with one or more locators. Ring (torus) constrained to locator parented to cow’s ear
UNDERSTANDING POINT CONSTRAINTS A point constraint causes an object to move to and follow the position of an object, or the average position of several objects. This is useful for having an object match the motion of other objects. You can also use a point constraint to animate one object to follow a series of objects.
Constrained and target objects A constrained object is an object whose position is driven by the position of one or more target objects. The position of one or more target objects is called the target point.
CONSTRAINTS
CHARACTER SETUP 385
USING POINT CONSTRAINTS | 29 Understanding point constraints
Target point The target point is the position of the target object’s rotate pivot. If there is more than one target object, the target point is the average position of the rotate pivots of all the target objects. If you are using more than one target object, you can vary the influence of each target object on the calculation of the target point. The target point can be a weighted average of the positions of the target objects, with some target objects having more influence than others. The influence of target objects on the weighted average is specified by target object weights.
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target point. The resulting weighted average drives the constrained object’s position.
Constrained object’s position The constrained object’s position is driven by the target point. However, you can offset the constrained object’s position from the target point. Offsetting the constrained object’s position from the target point can be useful in situations where you don’t want the local axis of the constrained object to coincide exactly with the target point.
Locked channels Point constraints lock a constrained object’s position (Translate X, Y, and Z) channels.
Related MEL commands MEL commands related to point constraints include the following: •
pointConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a point constraint include the following: •
Point constraint node (default name: constrainedObject_pointConstraintn).
•
Locator node (default name: locatorn). The point on curve locator constraint uses locators (see "Using point on curve locator constraints" on page 391).
•
L east squares modifier node (default name: leastSquaresModifiern). The point on curve locator constraint uses the least squares modifier node (see "Using point on curve locator constraints" on page 391). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CHARACTER SETUP 386
PART 5
USING POINT CONSTRAINTS | 29 Creating point constraints
CREATING POINT CONSTRAINTS When creating point constraints, you can first set creation options and then create a point constraint, or you can immediately create a constraint with the current creation options.
Setting constraint options To set constraint options: 1
If you also want to create a point constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Point ❒. The Point Constraint Options window is displayed.
3
Set the constraint options: Specifies how much the position of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Weight Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create a point constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Point Constraint Options window.
Creating a point constraint To create a point constraint: 1
Select one or more target objects, followed by the object you want to constrain to them.
2
Select Constrain > Point. A point constraint is created with the current constraint options. (The Add Targets option should be on.) The constrained object’s position attributes (Translate X, Y, and Z) are now locked. Their values are now provided by the target point.
EDITING POINT CONSTRAINTS Editing point constraints is described in the following topics.
CONSTRAINTS
CHARACTER SETUP 387
USING POINT CONSTRAINTS | 29 Editing point constraints
Editing point constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The point constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed for the point constraint:
Node State
Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the target point, which drives the position of the constrained object, can be influenced by a target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing point constraint attributes To edit attributes with Attribute Editor: 1
Select the point constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Point Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the point constraint’s selection handle. Point Constraint Attributes
Constraint Offset
Offset Polarity
CHARACTER SETUP 388
Specifies an offset position (translate X, Y, and Z) for the constrained object relative to the target point. Note that the target point is the position of the target object’s rotate pivot, or the average position of the rotate pivots of the target objects. Default values are all 0. Specifies the polarity of the Constraint Offset. In effect, the Constraint Offset values are multiplied by the Offset Polarity to give the constrained object’s position. Default is 1.
PART 5
USING POINT CONSTRAINTS | 29 Editing point constraints Constraint Translate
Informs you of the constrained object’s current position. Useful to know when you are specifying the Constraint Offset and Offset Polarity. Pivots Selections for displaying the point constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See “Constraint node behavior” on page 382 in Chapter 28. Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the position of the constrained object can be influenced by the target object. •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created a point constraint, you can add more target objects for additional control over the constrained object’s position. Adding more target objects changes the target point, which changes the constrained object’s position. Adding more target objects is similar to creating point constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Point ❒. The Point Constraint Options window is displayed.
CONSTRAINTS
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects.
CHARACTER SETUP 389
USING POINT CONSTRAINTS | 29 Editing point constraints The constrained object’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
Removing target objects After you’ve created a point constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Point ❒. The Point Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s position changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the position of the constrained object can be influenced by a target object. The weights are attributes of the point constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s position. However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing point constraint channels" on page 388. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing point constraint attributes" on page 388.
Animating target object weights An interesting technique you can use with point constraints is to animate the target object weights specified by the targetObject Wn channels. You can vary the weights from 0 to any value, so that as an animation progresses different target objects can take turns driving a constrained object’s motion.
Offsetting constrained object’s position The constrained object’s position is driven by the target point, but you can offset the constrained object’s position from the target point. To do so, edit the Constraint Offset and Offset Polarity attributes with the Attribute Editor.
CHARACTER SETUP 390
PART 5
USING POINT CONSTRAINTS | 29 Deleting point constraints To offset constrained object’s position: Edit the Constraint Offset and Offset Polarity attributes as described in "Editing point constraint attributes" on page 388. By default, these attributes are not displayed as channels in the Channel Box. If you’d like to control them from the Channel Box, you can add them by using the Channel Control editor (select Window > General Editors > Channel Control.).
DELETING POINT CONSTRAINTS To delete a point constraint, delete the point constraint node. To delete a point constraint: 1
Select the point constraint node only. (Select the point constraint’s selection handle if displayed, or use the Hypergraph to select the point constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
USING POINT ON CURVE LOCATOR CONSTRAINTS You can constrain points on a NURBS curve (curve points) to locators. This is useful for deforming individual curves at specific points along the curves. By moving (translating) the locators you can change the shape of the curve without being limited to being able to move only the curve’s CVs. Also, when modeling, you could use point on curve locator constraints to connect two or more curves together so that they intersect.
Creating point on curve locator constraint To create a point on curve locator constraint: 1
Create a NURBS curve.
2
To select a curve point on the curve, right-click the curve and select Curve Point from the marking menu.
3
Click on the curve at where you would like to create the point on curve locator constraint. The curve point is displayed as a small yellow box.
4
Drag along the curve to adjust the point’s position on the curve. As you drag, you move the curve point. The curve point’s position is defined in terms of the curve’s U parameter. To set point on curve options now, see next section.
5
Select Deform > Point On Curve. Maya creates a locator at the curve point with the default point on curve options. The curve point is now constrained to the locator. For each curve, Maya creates a least squares modifier node (default name: leastSquaresModifiern).
CONSTRAINTS
CHARACTER SETUP 391
USING POINT CONSTRAINTS | 29 Using point on curve locator constraints To set point on curve options: 1
Select Deform > Point On Curve ❒.
2
In the Point On Curve Options window, set the following:
Keep Original
If on, specifies that Maya make a copy of the original curve shape (default name: lsqModCurven). Default is off.
Point Weight
Specifies how much influence the point on curve locator constraint should have on the curve’s shape relative to other point on curve locator constraints. Set values from 0.1000 (least influence) to 1.0000 (most influence). Default is 1.0000. •
Click Create to create a point on curve locator constraint. or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Point On Curve Options window.
Editing least squares modifier attributes The least squares modifier node controls how closely curve points stick to the locators. If you are using many point on curve locator constraints on a curve, or the shape of the curve is particularly complex, the curve might not always be able to stick to all of the point on curve locator constraints at the same time. To edit least squares modifier attributes with Attribute Editor: 1
Select a locator that acting as a point on curve locator constraint.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a). From the Attribute Editor, go to the least squares modifier node (default name: leastSquaresModifiern), which is downstream of the locator. (In the Channel Box, the node is listed under the locator’s OUTPUTS.)
3
The following sections make available attributes: Least Squares Modifier Attributes, Point Constraints, Node Behavior, and Extra Attributes. Least Squares Modifier Attributes
Input Nurbs Object
Informs you of the NURBS curve the least squares modifier node is affecting (for example, curveShapenOriginal). Point Constraints
pointConstraint[ n]
U
CHARACTER SETUP 392
Identifies a point on curve locator constraint. The value of n corresponds to the default locator name minus 1. For example, pointConstraint[0] corresponds to locator1. Specifies the location of the point on curve locator constraint on the NURBS curve in terms of the curve’s U parameter.
PART 5
USING POINT CONSTRAINTS | 29 Using point on curve locator constraints Weight
Specifies how much influence the point on curve locator constraint should have on the curve’s shape relative to other point on curve locator constraints. Use slider to select values from 0.100 to 1.000. Default is 1.000. (The value is initially specified by the Point Weight point on curve option.) Node Behavior See “Constraint node behavior” on page 382 in Chapter 28. Extra Attributes (No extra attributes by default.)
CONSTRAINTS
CHARACTER SETUP 393
USING POINT CONSTRAINTS | 29 Using point on curve locator constraints
CHARACTER SETUP 394
PART 5
30
USING AIM CONSTRAINTS Aim constraints constrain an object’s orientation so that it always aims at other objects. If you’d like to explore some examples now, see "Examples" on page 404.
UNDERSTANDING AIM CONSTRAINTS An aim constraint constrains an object’s orientation so that the object aims at other objects. Typical uses of the aim constraint include aiming a light or camera at an object or group of objects. In character setup, a typical use of an aim constraint is to set up a locator that controls eyeball movement.
Constrained and target objects A constrained object is an object whose orientation is driven by the position of one or more target objects. The position of the one or more target objects is called the target point.
Target point The target point is the position of the target object’s rotate pivot. If there is more than one target object, the target point is the average position of all the rotate pivots of the target objects. If you are using more than one target object, you can vary the influence of each target object on the calculation of the target point. The target point can be a weighted average of the positions of the target objects, with some target objects having more influence than others. The influence of target objects on the weighted average is specified by target object weights. Of course, you can also change the target point by moving each target object’s rotate pivot.
CONSTRAINTS
CHARACTER SETUP 395
USING AIM CONSTRAINTS | 30 Understanding aim constraints
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target point. The resulting weighted average drives the constrained object’s orientation.
Constrained object’s orientation The constrained object’s orientation is controlled by three vectors: the aim vector, the up vector, and the world up vector. These vectors are not displayed in the workspace, but you can infer their effect on the constrained object’s orientation. You do not need to understand the details of how these vectors work in order to use constraints effectively. If you are new to constraints, you can skip the rest of this section. However, if you want to exercise a high degree of control over an aim constraint, you’ll need to work with these vectors. Also, familiarity with these vectors can help you to understand how a constrained object can suddenly roll.
Aim vector The aim vector constrains the constrained object so that it always points at the target point. The aim vector starts at the constrained object’s pivot point and always points at the target point. How the object rotates to point at the target point depends on how the aim vector is defined relative to the object’s local space. For instance, by default, the aim vector is defined so that it points in the same direction as the local rotation positive X-axis. Consequently, by default, a constrained object’s local rotation positive X-axis will point at the target point. By itself, the aim vector does not completely constrain the object, because the aim vector does not control how the object might rotate about the aim vector. The orientation of the object about the aim vector is controlled by the up vector and the world up vector.
Up vector and world up vector The up vector controls the orientation of the constrained object about the aim vector. Like the aim vector, the up vector is defined relative to the constrained object’s local space. By default, the up vector tries to point in the same direction as the world up vector, which is defined relative to the scene’s world space. The up vector orients the constrained object about the aim vector by trying to align itself as closely as possible with the world up vector. When you move the target object(s), the constrained object’s aim vector moves to point at the target point, and orients the constrained object accordingly. Simultaneously, the constrained object orients itself about the aim vector as directed by the up vector. For instance, by default, the up vector is defined so that it points in the same direction as the local rotation positive Y-axis. A constrained object’s local positive Xaxis will point at the target point, as directed by the default aim vector. Simultaneously, the object’s local positive Y-axis will try to point in the same direction as the world up vector, as directed by the object’s up vector. The aim vector and up vector work together to constrain the orientation of the constrained object.
CHARACTER SETUP 396
PART 5
USING AIM CONSTRAINTS | 30 Understanding aim constraints By default, the up vector tries to stay as closely aligned with the world up vector as possible. However, you can control the role of the world up vector in a variety of ways. For example, instead of defining the world up vector relative to the workspace’s world space (the default), you can define it relative to some other object’s local space. Such an object is called a world up object.
Rolling effects In certain situations, the constrained object can rapidly rotate about its aim vector. To understand why this happens, you need to understand how aim vectors, up vectors, and world up vectors work. If you are new to constraints, you can skip this section. For more information, see the previous section, "Constrained object’s orientation" on page 396. As the aim vector approaches pointing in the same direction or the opposite direction of the up vector, the constrained object rotates more rapidly about the aim vector. When the aim vector points in exactly the same direction, or in exactly the opposite direction, the constrained object can suddenly rotate by 180 degrees about the aim vector. These rapid rotations provide rolling effects that you might want to prevent. You can prevent rolling effects by moving or animating the world up vector. For more information, see "Preventing rolling effects" on page 403.
Motion history dependence effects Motion history dependence refers to how an object can provide different motion effects in situations that are identical except that the object has been previously manipulated or animated. For instance, when you animate an object and run the animation in a loop, if the object ends up moving in slightly different ways at the same frame in each loop, the object is motion history dependent. At a certain frame, the object may be oriented differently depending on its previous orientations. In contrast, if the object moves in exactly the same way during each loop, then the object is motion history independent. Motion history dependence effects can be a problem if you want predictable motion effects. However, if you are seeking some unpredictable motion effects, you might want to take advantage of an object’s motion history dependence. In certain situations, a constrained object’s orientation can become motion history dependent. To understand why this happens, you need to be familiar with aim vectors and up vectors (see "Constrained object’s orientation" on page 396). A constrained object can become motion history dependent if you define the aim vector and the up vector to point in the same direction. For example, you might do this if you define the aim vector relative to the constrained object’s local Y-axis, but do not change the default direction of the up vector, which is also relative to the object’s local Y-axis. For more information, see "Controlling motion history dependence effects" on page 403. A constrained object can also become motion history dependent if you set the constraint’s World Up Type attribute to None. For more information, see "Editing aim constraint attributes" on page 400.
CONSTRAINTS
CHARACTER SETUP 397
USING AIM CONSTRAINTS | 30 Creating aim constraints
Locked channels Aim constraints lock a constrained object’s orientation (Rotate X, Y, and Z) channels.
Related MEL commands MEL commands related to aim constraints include the following: •
aimConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for an aim constraint include the following: •
Aim constraint node (default name: constrainedObject_aimConstraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING AIM CONSTRAINTS When creating aim constraints, you can first set creation options and then create an aim constraint, or you can immediately create a constraint with the current creation options. The default constraint options work well for constraining objects so that they aim along their local rotation positive X-axis.
Setting constraint options To set constraint options: 1
If you want to create an aim constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Aim ❒. The Aim Constraint Options window is displayed.
3
Set the constraint options:
Weight
Specifies how much the orientation of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Aim Vector
Specifies the direction of the aim vector relative to the constrained object’s local space. The aim vector will point at the target point, forcing the constrained object to orient itself accordingly. The default specifies that the object’s local rotation positive X-axis aligns with the aim vector to point at the target point (1.0000, 0.0000, 0.0000).
Up Vector
Specifies the direction of the up vector relative to the constrained object’s local space. The default specifies that the object’s local rotation positive Y-axis will align with the up vector. In turn, by default, the up vector will try to align with the world up vector. Further, by default, the world up vector will point in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000).
CHARACTER SETUP 398
PART 5
USING AIM CONSTRAINTS | 30 Editing aim constraints If you define the up vector to point in the same direction as the aim vector, the constrained object will be motion history dependent. For more information, see "Motion history dependence effects" on page 397. World Up Vector
Specifies the direction of the world up vector relative to the scene’s world space. Because Maya’s world space is “Y-up” by default, the default world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000).
Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create an aim constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Aim Constraint Options window.
Creating an aim constraint To create an aim constraint: 1
Select one or more target objects, followed by the object you want to constrain to them.
2
Select Constrain > Aim. An aim constraint is created with the current constraint options. (The Add Targets option should be on.) The constrained object’s orientation attributes (Rotate X, Y, and Z) are now locked. Their values are now provided by how the constraint object’s aim vector points at the target point.
EDITING AIM CONSTRAINTS Editing aim constraints is described in the following topics.
Editing aim constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The aim constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
CONSTRAINTS
CHARACTER SETUP 399
USING AIM CONSTRAINTS | 30 Editing aim constraints 2
In the Channel Box, the following channels are listed for the aim constraint:
Node State
Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the orientation of the constrained object can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing aim constraint attributes To edit attributes with Attribute Editor: 1
Select the aim constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Aim Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the aim constraint’s selection handle. Aim Constraint Attributes
Aim Vector
Specifies the direction of the aim vector relative to the constrained object’s local space. The aim vector points at the target point, forcing the constrained object to orient itself accordingly. The default specifies that the object’s local rotation positive X-axis aligns with the aim vector to point at the target point (1.0000, 0.0000, 0.0000).
Up Vector
Specifies the direction of the up vector relative to the constrained object’s local space. The default specifies that the object’s local rotation positive Y-axis aligns with the up vector. In turn, by default, the up vector tries to align with the world up vector. Further, by default, the world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). If you define the up vector to point in the same direction as the aim vector, the constrained object will be motion history dependent. For more information, see "Motion history dependence effects" on page 397.
World Up Vector
World Up Type
Specifies the direction of the world up vector relative to the scene’s world space. Because Maya’s world space is “Y-up” by default, the default world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). Specifies the role of the world up vector. Selections include Scene Up, Object Up, Object Rotation Up, Vector, and None. Scene Up specifies that the up vector try to align with the scene’s up axis instead of the world up vector. The world up vector is ignored.
CHARACTER SETUP 400
PART 5
USING AIM CONSTRAINTS | 30 Editing aim constraints (To specify the scene’s up axis, select Window > Settings/Preferences > Preferences. In the Settings category of the Preferences window, select Y or Z for the Up Axis of the World Coordinate System. Y is the default.) Object Up specifies that the up vector try to aim at the origin of a specified object instead of aligning with the world up vector. The world up vector is ignored. The object whose origin the up vector tries to aim at is called the world up object. You can specify the world up object with the aimConstraint MEL command (use -wuo flag). If no world up object is specified, the up vector tries to aim at the origin of the scene’s world space. Object Rotation Up specifies that the world up vector is defined relative to some object’s local space instead of the scene’s world space. The up vector tries to align with the world up vector after transforming it relative to the scene’s world space. The object whose origin the up vector tries to aim at is called the world up object. You can specify the world up object with the aimConstraint MEL command (use wuo flag). If no world up object is specified, the world up vector is defined relative to the scene’s world space. Vector specifies that the up vector tries to align with world up vector as closely as possible. The world up vector is defined relative to the scene’s world space. (This is the default.) None specifies no calculation of the constrained object’s orientation about the aim vector. The orientation continues as whatever the orientation is right before you specify None. With None selected, the constrained object becomes motion history dependent. For more information, see "Motion history dependence effects" on page 397. Select Scene Up, Object Up, Object Rotation Up, Vector, or None. Default is Vector. Constraint Rotate
Informs you of the current orientation of the constrained object.
Constraint Vector
Informs you of the current target point, which is what the aim vector aims at. Pivots Selections for displaying the constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior (For more information, see “Constraint node behavior” on page 382 in Chapter 28.)
CONSTRAINTS
CHARACTER SETUP 401
USING AIM CONSTRAINTS | 30 Editing aim constraints Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option. targetObject Wn
Specifies a target object’s weight. The weight specifies how much the orientation of the constrained object can be influenced by the target object’s position. •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created an aim constraint, you can add more target objects for additional control over the constrained object’s orientation. Adding more target objects is similar to creating aim constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Aim ❒. The Aim Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained object’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
Removing target objects After you’ve created an aim constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Aim ❒. The Aim Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s orientation changes, indicating that it is no longer constrained by the target objects you’ve just removed.
CHARACTER SETUP 402
PART 5
USING AIM CONSTRAINTS | 30 Editing aim constraints
Changing target object weights A target object’s weight specifies how much the orientation of the constrained object can be influenced by a target object. The weights are attributes of the aim constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s orientation. However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing aim constraint channels" on page 399. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing aim constraint attributes" on page 400.
Preventing rolling effects In certain situations, a constrained object can rapidly roll about its aim vector. Rolling effects can happen when the aim vector approaches or points in the same direction or in the opposite direction as the up vector. For more information, see "Rolling effects" on page 397. You can avoid rolling effects by keeping the target point clear of the world up vector’s direction. For example, if the world up vector points in the direction of the scene’s world space Y-axis (the default), you would try to avoid having the positive or negative Y-axis intersect the target point. You could move the target object(s) as needed, or perhaps change the target object weights so that the target point does not get to close to the Y-axis. However, if your animation makes such avoidances impossible, you can prevent rolling by changing or animating the world up vector. To change world up vector with Attribute Editor: Edit the World Up Vector attribute as described in "Editing aim constraint attributes" on page 400. Note that you can also use the Channel Box to edit the World Up Vector. To animate world up vector with Channel Box: You can set keys on the World Up Vector attribute by using the Channel Box. To select the World Up Vector attribute, see “Editing aim constraint channels with Channel Box” on page 25. To set keys, after you select the attribute press the right mouse button and select Key Selected.
Controlling motion history dependence effects In certain situations, a constrained object can become motion history dependent. For more information, see "Motion history dependence effects" on page 397.
CONSTRAINTS
CHARACTER SETUP 403
USING AIM CONSTRAINTS | 30 Deleting aim constraints You can control motion history dependence by making sure that the aim vector and the up vector do not point in the same direction. In they are pointing in the same direction, the best way to prevent motion history dependence is to change the up vector’s direction. You could also change the aim vector, but it’s likely that you choose the aim vector so that the object aims in a particular way. Additionally, if the aim constraint’s World Up Type is set to None, the constrained object can be motion history dependent. To change up vector or aim vector direction with Attribute Editor: Check the Aim Vector and Up Vector attributes as described in "Editing aim constraint attributes" on page 400. If they are the same, edit one of the them so that they do not both point in the same direction. To change World Up Type attribute with Attribute Editor: Check the World Up Type attribute as described in "Editing aim constraint attributes" on page 400. If set to None, the constrained object can be motion history dependent.
DELETING AIM CONSTRAINTS To delete an aim constraint, delete the aim constraint node. To delete an aim constraint: 1
Select the aim constraint node only. (Select the aim constraint’s selection handle if displayed, or use the Hypergraph to select the aim constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
EXAMPLES This section includes two examples of using aim constraints:
Aiming a sphere at a sphere To setup the two spheres: 1
Create a NURBS sphere.
2
Move the sphere some distance away from the center of the scene.
3
Create another NURBS sphere. Leave it at the scene’s origin.
4
Display the sphere’s local rotation axis (Display > Component Display > Local Rotation Axes). To create aim constraint:
1
Select the you moved sphere, and then select the sphere at the origin.
2
If you are sure that the constraint options have their default settings, select Constrain > Aim. (To be sure that you are using the defaults, select Constrain > Aim ❒. Click Reset, and then click Add/Remove.)
CHARACTER SETUP
PART 5
404
USING AIM CONSTRAINTS | 30 Examples Now you have constrained the sphere at the origin to aim at the other sphere. To use the constraint: Select the sphere you moved (nurbsSphere1), and select the Move Tool. As you move the sphere, the other sphere (nurbsSphere2) will rotate accordingly. Note how nurbsSphere2’s local rotation X-axis always points at the nurbsSphere1. Also, note how nurbsSphere2’s local rotation Y-axis always tries to point as closely as possible in the same direction as the scene’s Y-axis. By default, the aim vector causes nurbsSphere2’s local rotation X-axis to point at nurbsSphere1. Also, by default, the up vector causes nurbsSphere2’s Y-axis to align itself as closely as possible with the scene’s Y-axis.
Aiming a cone at a sphere To create sphere and cone: 1
Create a NURBS sphere.
2
Move the sphere some distance away from the scene’s origin.
3
Create a NURBS cone. To create aim constraint:
1
Select the sphere, and then select the cone.
2
Select Constrain > Aim ❒. By default, the aim vector will direct the cone to point at the sphere along its local rotation positive X-axis. However, the cone narrows along its local positive Y-axis. You could change the orientation of the cone’s local rotation axis, or you could set the aim vector to direct the cone to point along its local positive Y-axis. For now, orient the aim vector to point along the cone’s local positive Y-axis.
3
Set Aim Vector to 0.0, 1.0, 0.0. (The default is 1.0, 0.0, 0.0.) The aim vector will now point along the cone’s local positive Y-axis instead of the Xaxis. By default, the up vector points along the cone’s local positive Y-axis. If the aim vector and the up vector point in the same direction, the constrained object will be motion history dependent.To prevent this, you can change the up vector’s direction.
4
Set Up Vector to 0.0, 0.0, 1.0. The up vector will now point along the cone’s local positive Z-axis. For convenience, set the world up vector to point in the same direction relative to world space as the up vector does relative to the cone’s local space.
5
Set World Up Vector to 0.0, 0.0, 1.0.
6
Click Add/Remove.
7
Now you have constrained the cone to aim at the sphere. To use the constraint: Select the sphere, and select the Move Tool. As you move the sphere, the cone will always point at the sphere.
CONSTRAINTS
CHARACTER SETUP 405
USING AIM CONSTRAINTS | 30 Examples
CHARACTER SETUP 406
PART 5
31
USING ORIENT CONSTRAINTS An orient constraint causes an object to follow the orientation of one or more objects. The constraint does not affect the object’s position or scaling, only its orientation.
UNDERSTANDING ORIENT CONSTRAINTS An orient constraint matches the orientation of one object to one or more other objects. This constraint is useful for making several objects orient simultaneously. For example, you can make a group of characters all look in the same direction at the same time by animating one character’s head and then constraining all the other character’s heads to the head you’ve just animated.
Constrained and target objects A constrained object is an object whose position is driven by the orientation of one or more target objects. The orientation of one or more target objects is called the target orientation.
Target orientation The target orientation is the orientation (Rotate X, Y, and Z attributes) of the target object. If there is more than one target object, the target orientation is the average orientation of all the target objects. However, if you are using more than one target
CONSTRAINTS
CHARACTER SETUP 407
USING ORIENT CONSTRAINTS | 31 Creating orient constraints object, you can vary the influence of each target object on the calculation of the target orientation. The target orientation can be a weighted average of the orientations of the target objects, with some target objects having more influence than others. The influence of target objects on the weighted average is specified by target object weights.
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target orientation. The resulting weighted average drives the constrained object’s orientation.
Constrained object’s orientation The constrained object’s orientation is driven by the target orientation.
Locked channels Orient constraints lock a constrained object’s orientation (Rotate X, Y, and Z) channels.
Related MEL commands MEL commands related to orient constraints include the following: •
orientConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for an orient constraint include the following: •
Orient constraint node (default name: constrainedObject_orientConstraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING ORIENT CONSTRAINTS When creating orient constraints, you can first set creation options and then create an orient constraint, or you can immediately create a constraint with the current creation options.
Setting constraint options To set constraint options: 1
If you also want to create an orient constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Orient ❒. The Orient Constraint Options window is displayed.
3
CHARACTER SETUP 408
Set the constraint options:
PART 5
USING ORIENT CONSTRAINTS | 31 Editing orient constraints Specifies how much the position of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Weight Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create an orient constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Orient Constraint Options window.
Creating an orient constraint To create an orient constraint: 1
Select one or more target objects, followed by the object you want to constrain to them.
2
Select Constrain > Orient. An orient constraint is created with the current constraint options. (The Add Targets option should be on.) The constrained object’s orientation attributes (Rotate X, Y, and Z) are now locked. Their values are now provided by the target orientation.
EDITING ORIENT CONSTRAINTS Editing orient constraints is described in the following topics.
Editing orient constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The orient constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Node State
CONSTRAINTS
In the Channel Box, the following channels are listed for the orient constraint: Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
CHARACTER SETUP 409
USING ORIENT CONSTRAINTS | 31 Editing orient constraints targetObject Wn
Specifies a target object’s weight. The weight specifies how much the position of the constrained object can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing orient constraint attributes To edit attributes with Attribute Editor: 1
Select the orient constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Orient Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the orient constraint’s selection handle. Orient Constraint Attributes
Constraint Rotate
Informs you of the constrained object’s current orientation. Pivots Selections for displaying the orient constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See “Constraint node behavior” on page 382 in Chapter 28. Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option.
targetObject Wn
CHARACTER SETUP 410
Specifies a target object’s weight. The weight specifies how much the position of the constrained object can be influenced by the target object.
PART 5
USING ORIENT CONSTRAINTS | 31 Editing orient constraints •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created an orient constraint, you can add more target objects for additional control over the constrained object’s position. Adding more target objects is similar to creating orient constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Orient ❒. The Orient Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained object’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
Removing target objects After you’ve created an orient constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Orient ❒. The Orient Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s position changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the orientation of the constrained object can be influenced by a target object. The weights are attributes of the orient constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s orientation. CONSTRAINTS
CHARACTER SETUP 411
USING ORIENT CONSTRAINTS | 31 Deleting orient constraints However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing orient constraint channels" on page 409. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing orient constraint attributes" on page 410.
Animating target object weights An interesting technique you can use with orient constraints is to animate the target object weights specified by the targetObject Wn channels. You can vary the weights from 0 to any value, so that as an animation progresses different target objects can take turns driving a constrained object’s orientation.
DELETING ORIENT CONSTRAINTS To delete an orient constraint, delete the orient constraint node. To delete an orient constraint: 1
Select the orient constraint node only. (Select the orient constraint’s selection handle if displayed, or use the Hypergraph to select the orient constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 412
PART 5
32
USING SCALE CONSTRAINTS A scale constraint causes an object to follow the scale of one or more objects.The constraint does not affect the object’s position or orientation, only its scale.
UNDERSTANDING SCALE CONSTRAINTS A scale constraint matches the scaling of one object to one or more other objects. This constraint is useful for making several objects scale simultaneously. For example, you can make a group of characters all look in the same direction at the same time by animating one character’s head and then constraining all the other character’s heads to the head you’ve just animated.
Constrained and target objects A constrained object is an object whose scaling is driven by the scaling of one or more target objects. The scaling of one or more target objects is called the target scale.
CONSTRAINTS
CHARACTER SETUP 413
USING SCALE CONSTRAINTS | 32 Creating scale constraints
Target scale The target scale is the scaling (Scale X, Y, and Z attributes) of the target object. If there is more than one target object, the target scale is the average scaling of all the target objects. However, if you are using more than one target object, you can vary the influence of each target object on the calculation of the target scale. The target scale can be a weighted average of the scales of the target objects, with some target objects having more influence than others. The influence of target objects on the weighted average is specified by target object weights.
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target scale. The resulting weighted average drives the constrained object’s scaling.
Constrained object’s scaling The constrained object’s scaling is driven by the target scale.
Locked channels Scale constraints lock a constrained object’s scaling (Scale X, Y, and Z) channels.
Related MEL commands MEL commands related to scale constraints include the following: •
scaleConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a scale constraint include the following: •
Scale constraint node (default name: constrainedObject_scaleConstraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING SCALE CONSTRAINTS When creating scale constraints, you can first set creation options and then create a scale constraint, or you can immediately create a constraint with the current creation options.
Setting constraint options To set constraint options: 1
If you also want to create a scale constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Scale ❒. The Scale Constraint Options window is displayed.
CHARACTER SETUP 414
PART 5
USING SCALE CONSTRAINTS | 32 Editing scale constraints 3
Set the constraint options: Specifies how much the scaling of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Weight Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create a scale constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Scale Constraint Options window.
Creating a scale constraint To create a scale constraint: 1
Select one or more target objects, followed by the object you want to constrain to them.
2
Select Constrain > Scale. A scale constraint is created with the current constraint options. (The Add Targets option should be on.) The constrained object’s scale attributes (Scale X, Y, and Z) are now locked. Their values are now provided by the target’s scaling.
EDITING SCALE CONSTRAINTS Editing scale constraints is described in the following topics.
Editing scale constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The scale constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2 Node State
CONSTRAINTS
In the Channel Box, the following channels are listed for the scale constraint: Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
CHARACTER SETUP 415
USING SCALE CONSTRAINTS | 32 Editing scale constraints targetObject Wn
Specifies a target object’s weight. The weight specifies how much the scale of the constrained object can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing scale constraint attributes To edit attributes with Attribute Editor: 1
Select the scale constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Scale Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the scale constraint’s selection handle. Scale Constraint Attributes
Constraint Scale
Informs you of the constrained object’s current scaling. Pivots Selections for displaying the scale constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See “Constraint node behavior” on page 382 in Chapter 28. Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option.
targetObject Wn
CHARACTER SETUP 416
Specifies a target object’s weight. The weight specifies how much the scaling of the constrained object can be influenced by the target object.
PART 5
USING SCALE CONSTRAINTS | 32 Editing scale constraints •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created a scale constraint, you can add more target objects for additional control over the constrained object’s position. Adding more target objects is similar to creating scale constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Scale ❒. The Scale Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained object’s scaling changes, indicating that it is now constrained by the objects you’ve just added as target objects.
Removing target objects After you’ve created a scale constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Scale ❒. The Scale Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s scaling changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the scaling of the constrained object can be influenced by a target object. The weights are attributes of the scale constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s scaling. However, you CONSTRAINTS
CHARACTER SETUP 417
USING SCALE CONSTRAINTS | 32 Deleting scale constraints can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing scale constraint channels" on page 415. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing scale constraint attributes" on page 416.
Animating target object weights You can animate the target object weights specified by the targetObject Wn channels. You can vary the weights from 0 to any value, so that as an animation progresses, different target objects can take turns driving a constrained object’s scale.
DELETING SCALE CONSTRAINTS To delete a scale constraint, delete the scale constraint node. To delete a scale constraint: 1
Select the scale constraint node only. (Select the scale constraint’s selection handle if displayed, or use the Hypergraph to select the scale constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 418
PART 5
33
USING GEOMETRY CONSTRAINTS A geometry constraint restricts an object to a surface or curve.
UNDERSTANDING GEOMETRY CONSTRAINTS A geometry constraint restricts an object to a NURBS surface, NURBS curve, or polygonal surface (mesh). If you also want the constrained object to orient itself to the surface of the target object(s), use a normal constraint. For more information on normal constraints, see “Using Normal Constraints” in Chapter 34.
Constrained and target objects A constrained object is an object whose position is driven by the nearest surface location of one or more target objects. The nearest surface location of one or more target objects is called the target position.
CONSTRAINTS
CHARACTER SETUP 419
USING GEOMETRY CONSTRAINTS | 33 Understanding geometry constraints
Target point The target point is the position of the target object’s nearest surface location. If there is more than one target object, the target point is the average position of the nearest surface locations of all the target objects. If you are using more than one target object, you can vary the influence of each target object on the calculation of the target point. The target point can be a weighted average of the nearest surface locations of the target objects, with some target objects having more influence than others. The influence of target objects on the weighted average is specified by target object weights.
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target point. The resulting weighted average drives the constrained object’s position.
Constrained object’s position The constrained object’s position is driven by the target point. However, you can offset the constrained object’s position from the target point. Offsetting the constrained object’s position from the target point can be useful in situations where you don’t want the local axis of the constrained object to coincide exactly with the target point. For example, if you want to constrain a ball to a joint in a character’s hand so that the hand holds the ball, you’ll need to offset the ball from the joint. By offsetting, you can have the ball in the palm of the hand rather than centered inside the hand.
Motion history dependence Motion history dependence refers to how an object can provide different motion effects in situations that are identical except that the object has been previously manipulated or animated. For instance, when you animate an object and run the animation in a loop, if the object ends up moving in slightly different ways at the same frame in each loop, the object is motion history dependent. At a certain frame, the object may be oriented differently depending on its previous orientations. In contrast, if the object moves in exactly the same way during each loop, then the object is motion history independent. Objects constrained by geometry constraints are motion history dependent. That means that the end result of a constrained object’s animation depends on where the object started.
Locked channels Geometry constraints do not lock any of the constrained object’s position, orientation, or scale channels. This means you can easily use other constraints with the geometry constraint. For example, you could also use a normal constraint (see Chapter 34, “Using Normal Constraints”).
Related MEL commands MEL commands related to geometry constraints include the following: •
CHARACTER SETUP 420
geometryConstraint
PART 5
USING GEOMETRY CONSTRAINTS | 33 Creating geometry constraints For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a geometry constraint include the following: •
Geometry constraint node (default name: constrainedObject_geometry Constraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING GEOMETRY CONSTRAINTS When creating geometry constraints, you can first set creation options and then create a geometry constraint, or you can immediately create a constraint with the current creation options.
Setting constraint options To set constraint options: 1
If you also want to create a geometry constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Geometry ❒. The Geometry Constraint Options window is displayed.
3
Set the constraint options: Specifies how much the position of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Weight Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create a geometry constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Geometry Constraint Options window.
Creating a geometry constraint To create a geometry constraint:
CONSTRAINTS
1
Select one or more target objects, followed by the object you want to constrain to them.
2
Select Constrain > Geometry.
CHARACTER SETUP 421
USING GEOMETRY CONSTRAINTS | 33 Editing geometry constraints A geometry constraint is created with the current constraint options. (The Add Targets option should be on.)
EDITING GEOMETRY CONSTRAINTS Editing geometry constraints is described in the following topics.
Editing geometry constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The geometry constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed for the geometry constraint:
Node State
Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the position of the constrained object can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing geometry constraint attributes To edit attributes with Attribute Editor: 1
Select the geometry constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Geometry Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the geometry constraint’s selection handle. Geometry Constraint Attributes
Constraint Rotate
CHARACTER SETUP 422
Informs you of the constrained object’s current orientation.
PART 5
USING GEOMETRY CONSTRAINTS | 33 Editing geometry constraints Pivots Selections for displaying the geometry constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See “Constraint node behavior” on page 382 in Chapter 28. Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option. targetObject Wn
Specifies a target object’s weight. The weight specifies how much the position of the constrained object can be influenced by the target object. •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created a geometry constraint, you can add more target objects for additional control over the constrained object’s position. Adding more target objects is similar to creating geometry constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Geometry ❒. The Geometry Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained object’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
CONSTRAINTS
CHARACTER SETUP 423
USING GEOMETRY CONSTRAINTS | 33 Editing geometry constraints
Removing target objects After you’ve created a geometry constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Geometry ❒. The Geometry Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s position changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the position of the constrained object can be influenced by a target object. The weights are attributes of the geometry constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s position. However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing geometry constraint channels" on page 422. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing geometry constraint attributes" on page 422.
Animating target object weights An interesting technique you can use with geometry constraints is to animate the target object weights specified by the targetObject Wn channels. You can vary the weights from 0 to any value, so that as an animation progresses different target objects can take turns driving a constrained object’s position. If all the target objects have the same weight (the default), the target point is taken from the first target object you selected when you created the constraint. For instance, if all the weights are 1, the target object whose weight is specified by the constraint’s targetObject W0 channel provides the target point. You should animate the target weights so that only one target has the highest weight at any given frame. Note that objects constrained by geometry constraints are motion history dependent.
CHARACTER SETUP 424
PART 5
USING GEOMETRY CONSTRAINTS | 33 Deleting geometry constraints
Animating the constrained object In contrast with the point constraint, the geometry constraint allows you to set keys on the constrained object’s position (Translate X, Y, and Z channels). The constrained object’s position will be the point on the target object’s surface that is closest to the keyed position.
Using a point constraint with a geometry constraint You can create a point constraint for an object that is already constrained by a geometry constraint. The constrained object’s position will be the point on the target object’s surface that is closest to the point constraint’s target point. For more information on point constraints, see “Using Point Constraints” in Chapter 29.
DELETING GEOMETRY CONSTRAINTS To delete a geometry constraint, delete the geometry constraint node. To delete a geometry constraint:
CONSTRAINTS
1
Select the geometry constraint node only. (Select the geometry constraint’s selection handle if displayed, or use the Hypergraph to select the geometry constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 425
USING GEOMETRY CONSTRAINTS | 33 Deleting geometry constraints
CHARACTER SETUP 426
PART 5
34
USING NORMAL CONSTRAINTS A normal constraint constrains an object’s orientation so that it aligns with the normal vectors of a NURBS or polygonal surface (mesh).
Cone constrained to a sphere’s surface with a geometry constraint, and constrained to align with the surface’s shape with a normal constraint.
UNDERSTANDING NORMAL CONSTRAINTS A normal constraint constrains an object’s orientation so that it aligns with the normal vectors of a NURBS surface or polygonal surface (mesh). Normal constraints are useful for having an object travel across a surface that has a unique, complex shape. Without normal constraints, moving or animating the object across the surface could be tedious and time-consuming. For example, you might want to have a tear falling down along character’s face. Instead of animating the tear directly, you could constrain it to the face’s surface.
CONSTRAINTS
CHARACTER SETUP 427
USING NORMAL CONSTRAINTS | 34 Understanding normal constraints Typically, you use normal constraints with geometry constraints. For more information on geometry constraints, see “Understanding geometry constraints” in Chapter 33.
Constrained and target objects A constrained object is an object whose orientation is driven by the direction of a target vector.
Target vector The target vector, or weighted average vector, represents the normal vector at the position of the constrained object. Maya calculates the target vector as a weighted average of the nearby normal vectors on the surface or mesh.
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target vector. The resulting weighted average drives the constrained object’s orientation.
Constrained object’s orientation The constrained object’s orientation is controlled by three vectors: the aim vector, the up vector, and the world up vector. These vectors are not displayed in the workspace, but you can infer their effect on the constrained object’s orientation. You do not need to understand the details of how these vectors work in order to use constraints effectively. If you are new to constraints, you can skip the rest of this section. However, if you want to exercise a high degree of control over a normal constraint, you’ll need to work with these vectors. Also, familiarity with these vectors can help you to understand how a constrained object can suddenly roll.
Aim vector The aim vector constrains the constrained object so that it always aligns with the target vector. The aim vector starts at the constrained object’s pivot point and then aligns with the target vector. How the object rotates to align with the target vector depends on how the aim vector is defined relative to the object’s local space. For instance, by default, the aim vector is defined so that it points in the same direction as the local rotation positive X-axis. Consequently, by default, a constrained object’s local rotation positive X-axis will align with the target vector. By itself, the aim vector does not completely constrain the object, because the aim vector does not control how the object might rotate about the aim vector. The orientation of the object about the aim vector is controlled by the up vector and the world up vector.
Up vector and world up vector The up vector controls the orientation of the constrained object about the aim vector. Like the aim vector, the up vector is defined relative to the constrained object’s local space. By default, the up vector tries to point in the same direction as the world up vector, which is defined relative to the scene’s world space. The up vector orients the constrained object about the aim vector by trying to align itself as closely as possible with the world up vector.
CHARACTER SETUP 428
PART 5
USING NORMAL CONSTRAINTS | 34 Understanding normal constraints When you move the target object(s), the constrained object’s aim vector moves to align with the target vector, and orients the constrained object accordingly. Simultaneously, the constrained object orients itself about the aim vector as directed by the up vector. For instance, by default, the up vector is defined so that it points in the same direction as the local rotation positive Y-axis. A constrained object’s local positive Xaxis will align with the target vector as directed by the default aim vector. Simultaneously, the object’s local positive Y-axis will try to point in the same direction as the world up vector, as directed by the object’s up vector. The aim vector and up vector work together to constrain the orientation of the constrained object. By default, the up vector tries to stay as closely aligned with the world up vector as possible. However, you can control the role of the world up vector in a variety of ways. For example, instead of defining the world up vector relative to the workspace’s world space (the default), you can define it relative to some other object’s local space. Such an object is called a world up object.
Rolling effects In certain situations, the constrained object can rapidly rotate about its aim vector. To understand why this happens, you need to understand how aim vectors, up vectors, and world up vectors work. If you are new to constraints, you can skip this section. For more information, see the previous section, "Constrained object’s orientation" on page 428. As the aim vector approaches pointing in the same direction or the opposite direction of the up vector, the constrained object rotates more rapidly about the aim vector. When the aim vector points in exactly the same direction, or in exactly the opposite direction, the constrained object can suddenly rotate by 180 degrees about the aim vector. These rapid rotations provide rolling effects that you might want to prevent. You can prevent rolling effects by moving or animating the world up vector. For more information, see "Preventing rolling effects" on page 435.
Motion history dependence effects Motion history dependence refers to how an object can provide different motion effects in situations that are identical except that the object has been previously manipulated or animated. For instance, when you animate an object and run the animation in a loop, if the object ends up moving in slightly different ways at the same frame in each loop, the object is motion history dependent. At a certain frame, the object may be oriented differently depending on its previous orientations. In contrast, if the object moves in exactly the same way during each loop, then the object is motion history independent. Motion history dependence effects can be a problem if you want predictable motion effects. However, if you are seeking some unpredictable motion effects, you might want to take advantage of an object’s motion history dependence. In certain situations, a constrained object’s orientation can become motion history dependent. To understand why this happens, you need to be familiar with aim vectors and up vectors (see "Constrained object’s orientation" on page 428).
CONSTRAINTS
CHARACTER SETUP 429
USING NORMAL CONSTRAINTS | 34 Creating normal constraints A constrained object can become motion history dependent if you define the aim vector and the up vector to point in the same direction. For example, you might do this if you define the aim vector relative to the constrained object’s local Y-axis, but do not change the default direction of the up vector, which is also relative to the object’s local Y-axis. For more information, see "Controlling motion history dependence effects" on page 436. A constrained object can also become motion history dependent if you set the constraint’s World Up Type attribute to None. For more information, see "Editing normal constraint attributes" on page 432.
Locked channels Normal constraints lock a constrained object’s orientation (Rotate X, Y, and Z) channels.
Related MEL commands MEL commands related to normal constraints include the following: •
normalConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a normal constraint include the following: •
Normal constraint node (default name: constrainedObject_normalConstraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING NORMAL CONSTRAINTS When creating normal constraints, you can first set creation options and then create a normal constraint, or you can immediately create a constraint with the current creation options. Typically, you would want to first create a geometry constraint to constrain the object to some surface, and then create a normal constraint to constrain the object’s orientation so that it aligns with the normal vectors of the surface. The default constraint options work well for constraining objects so that they aim along their local rotation positive X-axis.
Setting constraint options To set constraint options: 1
If you want to create a normal constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Normal ❒. The Normal Constraint Options window is displayed.
3
CHARACTER SETUP 430
Set the constraint options: PART 5
USING NORMAL CONSTRAINTS | 34 Creating normal constraints Weight
Specifies how much the orientation of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Aim Vector
Specifies the direction of the aim vector relative to the constrained object’s local space. The aim vector will align with the target vector, forcing the constrained object to orient itself accordingly. The default specifies that the object’s local rotation positive X-axis aligns with the aim vector to align with the target vector (1.0000, 0.0000, 0.0000).
Up Vector
Specifies the direction of the up vector relative to the constrained object’s local space. The default specifies that the object’s local rotation positive Y-axis will align with the up vector. In turn, by default, the up vector will try to align with the world up vector. Further, by default, the world up vector will point in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). If you define the up vector to point in the same direction as the aim vector, the constrained object will be motion history dependent. For more information, see "Motion history dependence effects" on page 429.
World Up Vector
Specifies the direction of the world up vector relative to the scene’s world space. Because Maya’s world space is “Y-up” by default, the default world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000).
Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create a normal constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Normal Constraint Options window.
Creating a normal constraint To create a normal constraint: 1
Select one or more target objects, followed by the object you want to constrain to them. Note that typically you would want to first create a geometry constraint, and then create a normal constraint.
2
Select Constrain > Normal. A normal constraint is created with the current constraint options. (The Add Targets option should be on.) The constrained object’s orientation attributes (Rotate X, Y, and Z) are now locked. Their values are now provided by how the constraint object’s aim vector aligns with the target vector.
CONSTRAINTS
CHARACTER SETUP 431
USING NORMAL CONSTRAINTS | 34 Editing normal constraints
EDITING NORMAL CONSTRAINTS Editing normal constraints is described in the following topics.
Editing normal constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The normal constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed for the normal constraint:
Node State
Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the orientation of the constrained object can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing normal constraint attributes To edit attributes with Attribute Editor: 1
Select the normal constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Normal Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the normal constraint’s selection handle. Normal Constraint Attributes
Aim Vector
CHARACTER SETUP 432
Specifies the direction of the aim vector relative to the constrained object’s local space. The aim vector aligns with the target vector, forcing the constrained object to orient itself accordingly. The default specifies that the object’s local rotation positive X-axis aligns with the aim vector, which aligns with the target vector (1.0000, 0.0000, 0.0000).
PART 5
USING NORMAL CONSTRAINTS | 34 Editing normal constraints Up Vector
Specifies the direction of the up vector relative to the constrained object’s local space. The default specifies that the object’s local rotation positive Y-axis aligns with the up vector. In turn, by default, the up vector tries to align with the world up vector. Further, by default, the world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). If you define the up vector to point in the same direction as the aim vector, the constrained object will be motion history dependent. For more information, see "Motion history dependence effects" on page 429.
World Up Vector
World Up Type
Specifies the direction of the world up vector relative to the scene’s world space. Because Maya’s world space is “Y-up” by default, the default world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). Specifies the role of the world up vector. Selections include Scene Up, Object Up, Object Rotation Up, Vector, and None. Scene Up specifies that the up vector try to align with the scene’s up axis instead of the world up vector. The world up vector is ignored. (To specify the scene’s up axis, select Window > Settings/Preferences > Preferences. In the Settings category of the Preferences window, select Y or Z for the Up Axis of the World Coordinate System. Y is the default.) Object Up specifies that the up vector try to aim at the origin of a specified object instead of aligning with the world up vector. The world up vector is ignored. The object whose origin the up vector tries to aim at is called the world up object. You can specify the world up object with the aimConstraint MEL command (use -wuo flag). If no world up object is specified, the up vector tries to aim at the origin of the scene’s world space. Object Rotation Up specifies that the world up vector is defined relative to some object’s local space instead of the scene’s world space. The up vector tries to align with the world up vector after transforming it relative to the scene’s world space. The object whose origin the up vector tries to aim at is called the world up object. You can specify the world up object with the aimConstraint MEL command (use wuo flag). If no world up object is specified, the world up vector is defined relative to the scene’s world space. Vector specifies that the up vector tries to align with world up vector as closely as possible. The world up vector is defined relative to the scene’s world space. (This is the default.) None specifies no calculation of the constrained object’s orientation about the aim vector. The orientation continues as whatever the orientation is right before you specify None. With None selected, the constrained object becomes motion history dependent. For more information, see "Motion history dependence effects" on page 429. Select Scene Up, Object Up, Object Rotation Up, Vector, or None. Default is Vector.
Constraint Rotate
Informs you of the current orientation of the constrained object.
Constraint Vector
Informs you of the current target vector, which is what the aim vector aligns with.
CONSTRAINTS
CHARACTER SETUP 433
USING NORMAL CONSTRAINTS | 34 Editing normal constraints Pivots Selections for displaying the constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior (For more information, see “Constraint node behavior” on page 382 in Chapter 28.) Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option. targetObject Wn
Specifies a target object’s weight. The weight specifies how much the orientation of the constrained object can be influenced by the target object’s position. •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created a normal constraint, you can add more target objects for additional control over the constrained object’s orientation. Adding more target objects is similar to creating normal constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Normal ❒. The Normal Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained object’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
CHARACTER SETUP 434
PART 5
USING NORMAL CONSTRAINTS | 34 Editing normal constraints
Removing target objects After you’ve created a normal constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Normal ❒. The Normal Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s orientation changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the orientation of the constrained object can be influenced by a target object. The weights are attributes of the normal constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s orientation. However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing normal constraint channels" on page 432. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing normal constraint attributes" on page 432.
Preventing rolling effects In certain situations, a constrained object can rapidly roll about its aim vector. Rolling effects can happen when the aim vector approaches or points in the same direction or in the opposite direction as the up vector. For more information, see "Rolling effects" on page 429. You can avoid rolling effects by keeping the target vector clear of the world up vector’s direction. For example, if the world up vector points in the direction of the scene’s world space Y-axis (the default), you would try to avoid having the positive or negative Y-axis point in the same direction as the target vector. You could move the target object(s) as needed, or perhaps change the target object weights so that the target vector does not get to close to the Y-axis.
CONSTRAINTS
CHARACTER SETUP 435
USING NORMAL CONSTRAINTS | 34 Deleting normal constraints However, if your animation makes such avoidances impossible, you can prevent rolling by changing or animating the world up vector. To change world up vector with Attribute Editor: Edit the World Up Vector attribute as described in "Editing normal constraint attributes" on page 432. Note that you can also use the Channel Box to edit the World Up Vector. To animate world up vector with Channel Box: You can set keys on the World Up Vector attribute by using the Channel Box. To select the World Up Vector attribute, see “Editing aim constraint channels with Channel Box” on page 25. To set keys, after you select the attribute press the right mouse button and select Key Selected.
Controlling motion history dependence effects In certain situations, a constrained object can become motion history dependent. For more information, see "Motion history dependence effects" on page 429. You can control motion history dependence by making sure that the aim vector and the up vector do not point in the same direction. If they are pointing in the same direction, the best way to prevent motion history dependence is to change the up vector’s direction. You could also change the aim vector, but it’s likely that you choose the aim vector so that the object aims in a particular way. Additionally, if the normal constraint’s World Up Type is set to None, the constrained object can be motion history dependent. To change up vector or aim vector direction with Attribute Editor: Check the Aim Vector and Up Vector attributes as described in "Editing normal constraint attributes" on page 432. If they are the same, edit one of the them so that they do not both point in the same direction. To change World Up Type attribute with Attribute Editor: Check the World Up Type attribute as described in "Editing normal constraint attributes" on page 432. If set to None, the constrained object can be motion history dependent.
DELETING NORMAL CONSTRAINTS To delete a normal constraint, delete the normal constraint node. To delete a normal constraint: 1
Select the normal constraint node only. (Select the normal constraint’s selection handle if displayed, or use the Hypergraph to select the normal constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 436
PART 5
35
USING TANGENT CONSTRAINTS A tangent constraint constrains an object’s orientation so that the object always points in the direction of a curve.
Cone moving along a curve and pointing forward along the curve. Cone is constrained to curve with a geometry constraint, and constrained to point forward with a tangent constraint.
UNDERSTANDING TANGENT CONSTRAINTS Tangent constraints constrain an object’s orientation so that as an object moves along a curve, the object always points in the direction a curve. The curve provides the path of the object’s motion, and the object orients itself to point along the curve. Tangent constraints are useful for having an object follow a curve’s direction, such as a roller coaster car following the tracks. Typically, you use tangent constraints with geometry constraints. For more information on geometry constraints, see “Understanding geometry constraints” in Chapter 33.
CONSTRAINTS
CHARACTER SETUP 437
USING TANGENT CONSTRAINTS | 35 Understanding tangent constraints
Constrained and target objects A constrained object is an object whose orientation is driven by the direction of a target vector.
Target vector The target vector, or weighted average vector, represents the tangent vector along the curve at the position of the constrained object. Maya calculates the target vector as a weighted average of the curve’s nearby tangents (that is, the curve’s tangent vectors).
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target vector. The resulting weighted average drives the constrained object’s orientation.
Constrained object’s orientation The constrained object’s orientation is controlled by three vectors: the aim vector, the up vector, and the world up vector. These vectors are not displayed in the workspace, but you can infer their effect on the constrained object’s orientation. You do not need to understand the details of how these vectors work in order to use constraints effectively. If you are new to constraints, you can skip the rest of this section. However, if you want to exercise a high degree of control over a tangent constraint, you’ll need to work with these vectors. Also, familiarity with these vectors can help you to understand how a constrained object can suddenly roll.
Aim vector The aim vector constrains the constrained object so that it always aligns with the target vector. The aim vector starts at the constrained object’s pivot point and then aligns with the target vector. How the object rotates to align with the target vector depends on how the aim vector is defined relative to the object’s local space. For instance, by default, the aim vector is defined so that it points in the same direction as the local rotation positive X-axis. Consequently, by default, a constrained object’s local rotation positive X-axis will align with the target vector. By itself, the aim vector does not completely constrain the object, because the aim vector does not control how the object might rotate about the aim vector. The orientation of the object about the aim vector is controlled by the up vector and the world up vector.
Up vector and world up vector The up vector controls the orientation of the constrained object about the aim vector. Like the aim vector, the up vector is defined relative to the constrained object’s local space. By default, the up vector tries to point in the same direction as the world up vector, which is defined relative to the scene’s world space. The up vector orients the constrained object about the aim vector by trying to align itself as closely as possible with the world up vector.
CHARACTER SETUP 438
PART 5
USING TANGENT CONSTRAINTS | 35 Understanding tangent constraints When you move the target object(s), the constrained object’s aim vector moves to align with the target vector, and orients the constrained object accordingly. Simultaneously, the constrained object orients itself about the aim vector as directed by the up vector. For instance, by default, the up vector is defined so that it points in the same direction as the local rotation positive Y-axis. A constrained object’s local positive Xaxis will align with the target vector, as directed by the default aim vector. Simultaneously, the object’s local positive Y-axis will try to point in the same direction as the world up vector, as directed by the object’s up vector. The aim vector and up vector work together to constrain the orientation of the constrained object. By default, the up vector tries to stay as closely aligned with the world up vector as possible. However, you can control the role of the world up vector in a variety of ways. For example, instead of defining the world up vector relative to the workspace’s world space (the default), you can define it relative to some other object’s local space. Such an object is called a world up object.
Rolling effects In certain situations, the constrained object can rapidly rotate about its aim vector. To understand why this happens, you need to understand how aim vectors, up vectors, and world up vectors work. If you are new to constraints, you can skip this section. For more information, see the previous section, "Constrained object’s orientation" on page 438. As the aim vector approaches pointing in the same direction or the opposite direction of the up vector, the constrained object rotates more rapidly about the aim vector. When the aim vector points in exactly the same direction, or in exactly the opposite direction, the constrained object can suddenly rotate by 180 degrees about the aim vector. These rapid rotations provide rolling effects that you might want to prevent. You can prevent rolling effects by moving or animating the world up vector. For more information, see "Preventing rolling effects" on page 445.
Motion history dependence effects Motion history dependence refers to how an object can provide different motion effects in situations that are identical except that the object has been previously manipulated or animated. For instance, when you animate an object and run the animation in a loop, if the object ends up moving in slightly different ways at the same frame in each loop, the object is motion history dependent. At a certain frame, the object may be oriented differently depending on its previous orientations. In contrast, if the object moves in exactly the same way during each loop, then the object is motion history independent. Motion history dependence effects can be a problem if you want predictable motion effects. However, if you are seeking some unpredictable motion effects, you might want to take advantage of an object’s motion history dependence. In certain situations, a constrained object’s orientation can become motion history dependent. To understand why this happens, you need to be familiar with aim vectors and up vectors (see "Constrained object’s orientation" on page 438).
CONSTRAINTS
CHARACTER SETUP 439
USING TANGENT CONSTRAINTS | 35 Creating tangent constraints A constrained object can become motion history dependent if you define the aim vector and the up vector to point in the same direction. For example, you might do this if you define the aim vector relative to the constrained object’s local Y-axis, but do not change the default direction of the up vector, which is also relative to the object’s local Y-axis. For more information, see "Controlling motion history dependence effects" on page 446. A constrained object can also become motion history dependent if you set the constraint’s World Up Type attribute to None. For more information, see "Editing tangent constraint attributes" on page 442.
Locked channels Tangent constraints lock a constrained object’s orientation (Rotate X, Y, and Z) channels.
Related MEL commands MEL commands related to tangent constraints include the following: •
tangentConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for tangent constraint include the following: •
Tangent constraint node (default name: constrainedObject_tangentConstraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING TANGENT CONSTRAINTS When creating tangent constraints, you can first set creation options and then create a tangent constraint, or you can immediately create a constraint with the current creation options. Typically, you would want to first create a geometry constraint to constrain the object to some curve, and then create a tangent constraint to constrain the object’s orientation so that it aligns with the tangents of the curve. The default constraint options work well for constraining objects so that they aim along their local rotation positive X-axis.
Setting constraint options To set constraint options: 1
If you want to create a tangent constraint now, select one or more objects. The last object selected will be the constrained object.
2
Select Constrain > Tangent ❒. The Tangent Constraint Options window is displayed.
3
CHARACTER SETUP 440
Set the constraint options: PART 5
USING TANGENT CONSTRAINTS | 35 Creating tangent constraints Weight
Specifies how much the orientation of the constrained object can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Aim Vector
Specifies the direction of the aim vector relative to the constrained object’s local space. The aim vector will align with the target vector, forcing the constrained object to orient itself accordingly. The default specifies that the object’s local rotation positive X-axis aligns with the aim vector to align with the target vector (1.0000, 0.0000, 0.0000).
Up Vector
Specifies the direction of the up vector relative to the constrained object’s local space. The default specifies that the object’s local rotation positive Y-axis will align with the up vector. In turn, by default, the up vector will try to align with the world up vector. Further, by default, the world up vector will point in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). If you define the up vector to point in the same direction as the aim vector, the constrained object will be motion history dependent. For more information, see "Motion history dependence effects" on page 439.
World Up Vector
Specifies the direction of the world up vector relative to the scene’s world space. Because Maya’s world space is “Y-up” by default, the default world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000).
Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create tangent constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
Click Close to close the Tangent Constraint Options window.
Creating a tangent constraint To create a tangent constraint: 1
Select one or more target objects, followed by the object you want to constrain to them. Note that typically you would want to first create a geometry constraint, and then create a tangent constraint.
2
Select Constrain > Tangent. A tangent constraint is created with the current constraint options. (The Add Targets option should be on.) The constrained object’s orientation attributes (Rotate X, Y, and Z) are now locked. Their values are now provided by how the constraint object’s aim vector aligns with the target vector.
CONSTRAINTS
CHARACTER SETUP 441
USING TANGENT CONSTRAINTS | 35 Editing tangent constraints
EDITING TANGENT CONSTRAINTS Editing tangent constraints is described in the following topics.
Editing tangent constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained object. The tangent constraint node is in the constrained object’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed for the tangent constraint:
Node State
Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the orientation of the constrained object can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing tangent constraint attributes To edit attributes with Attribute Editor: 1
Select the tangent constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
3
The following sections make available attributes: Transform Attributes, Tangent Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the tangent constraint’s selection handle. Tangent Constraint Attributes
Aim Vector
CHARACTER SETUP 442
Specifies the direction of the aim vector relative to the constrained object’s local space. The aim vector aligns with the target vector, forcing the constrained object to orient itself accordingly. The default specifies that the object’s local rotation positive X-axis aligns with the aim vector, which aligns with the target vector (1.0000, 0.0000, 0.0000).
PART 5
USING TANGENT CONSTRAINTS | 35 Editing tangent constraints Up Vector
Specifies the direction of the up vector relative to the constrained object’s local space. The default specifies that the object’s local rotation positive Y-axis aligns with the up vector. In turn, by default, the up vector tries to align with the world up vector. Further, by default, the world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). If you define the up vector to point in the same direction as the aim vector, the constrained object will be motion history dependent. For more information, see "Motion history dependence effects" on page 439.
World Up Vector
World Up Type
Specifies the direction of the world up vector relative to the scene’s world space. Because Maya’s world space is “Y-up” by default, the default world up vector points in the direction of the world space’s positive Y-axis (0.0000, 1.0000, 0.0000). Specifies the role of the world up vector. Selections include Scene Up, Object Up, Object Rotation Up, Vector, and None. Scene Up specifies that the up vector try to align with the scene’s up axis instead of the world up vector. The world up vector is ignored. (To specify the scene’s up axis, select Window > Settings/Preferences > Preferences. In the Settings category of the Preferences window, select Y or Z for the Up Axis of the World Coordinate System. Y is the default.) Object Up specifies that the up vector try to aim at the origin of a specified object instead of aligning with the world up vector. The world up vector is ignored. The object whose origin the up vector tries to aim at is called the world up object. You can specify the world up object with the aimConstraint MEL command (use -wuo flag). If no world up object is specified, the up vector tries to aim at the origin of the scene’s world space. Object Rotation Up specifies that the world up vector is defined relative to some object’s local space instead of the scene’s world space. The up vector tries to align with the world up vector after transforming it relative to the scene’s world space. The object whose origin the up vector tries to aim at is called the world up object. You can specify the world up object with the aimConstraint MEL command (use wuo flag). If no world up object is specified, the world up vector is defined relative to the scene’s world space. Vector specifies that the up vector tries to align with world up vector as closely as possible. The world up vector is defined relative to the scene’s world space. (This is the default.) None specifies no calculation of the constrained object’s orientation about the aim vector. The orientation continues as whatever the orientation is right before you specify None. With None selected, the constrained object becomes motion history dependent. For more information, see "Motion history dependence effects" on page 439. Select Scene Up, Object Up, Object Rotation Up, Vector, or None. Default is Vector.
Constraint Rotate
Informs you of the current orientation of the constrained object.
Constraint Vector
Informs you of the current target vector, which is what the aim vector aligns with.
CONSTRAINTS
CHARACTER SETUP 443
USING TANGENT CONSTRAINTS | 35 Editing tangent constraints Pivots Selections for displaying the constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior (For more information, see “Constraint node behavior” on page 382 in Chapter 28.) Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option. targetObject Wn
Specifies a target object’s weight. The weight specifies how much the orientation of the constrained object can be influenced by the target object’s position. •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
Click Close to close the Attribute Editor.
Adding target objects After you’ve created a tangent constraint, you can add more target objects for additional control over the constrained object’s orientation. Adding more target objects is similar to creating tangent constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained object.
2
Select Constrain > Tangent ❒. The Tangent Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained object’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
CHARACTER SETUP 444
PART 5
USING TANGENT CONSTRAINTS | 35 Editing tangent constraints
Removing target objects After you’ve created a tangent constraint, you can remove any of the target objects so that the objects no longer constrain the constrained object. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained object.
2
Select Constrain > Tangent ❒. The Tangent Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained object’s orientation changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the orientation of the constrained object can be influenced by a target object. The weights are attributes of the tangent constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained object’s orientation. However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing tangent constraint channels" on page 442. To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing tangent constraint attributes" on page 442.
Preventing rolling effects In certain situations, a constrained object can rapidly roll about its aim vector. Rolling effects can happen when the aim vector approaches or points in the same direction or in the opposite direction as the up vector. For more information, see "Rolling effects" on page 439. You can avoid rolling effects by keeping the target vector clear of the world up vector’s direction. For example, if the world up vector points in the direction of the scene’s world space Y-axis (the default), you would try to avoid having the positive or negative Y-axis point in the same direction as the target vector. You could move the target object(s) as needed, or perhaps change the target object weights so that the target vector does not get to close to the Y-axis.
CONSTRAINTS
CHARACTER SETUP 445
USING TANGENT CONSTRAINTS | 35 Deleting tangent constraints However, if your animation makes such avoidances impossible, you can prevent rolling by changing or animating the world up vector. To change world up vector with Attribute Editor: Edit the World Up Vector attribute as described in "Editing tangent constraint attributes" on page 442. Note that you can also use the Channel Box to edit the World Up Vector. To animate world up vector with Channel Box: You can set keys on the World Up Vector attribute by using the Channel Box. To select the World Up Vector attribute, see “Editing aim constraint channels with Channel Box” on page 25. To set keys, after you select the attribute press the right mouse button and select Key Selected.
Controlling motion history dependence effects In certain situations, a constrained object can become motion history dependent. For more information, see "Motion history dependence effects" on page 439. You can control motion history dependence by making sure that the aim vector and the up vector do not point in the same direction. If they are pointing in the same direction, the best way to prevent motion history dependence is to change the up vector’s direction. You could also change the aim vector, but it’s likely that you choose the aim vector so that the object aims in a particular way. Additionally, if the tangent constraint’s World Up Type is set to None, the constrained object can be motion history dependent. To change up vector or aim vector direction with Attribute Editor: Check the Aim Vector and Up Vector attributes as described in "Editing tangent constraint attributes" on page 442. If they are the same, edit one of the them so that they do not both point in the same direction. To change World Up Type attribute with Attribute Editor: Check the World Up Type attribute as described in "Editing tangent constraint attributes" on page 442. If set to None, the constrained object can be motion history dependent.
DELETING TANGENT CONSTRAINTS To delete a tangent constraint, delete the tangent constraint node. To delete a tangent constraint: 1
Select the tangent constraint node only. (Select the tangent constraint’s selection handle if displayed, or use the Hypergraph to select the tangent constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 446
PART 5
36
USING POLE VECTOR CONSTRAINTS A pole vector constraint constrains an IK rotate plane handle’s pole vector.
Pole vectors constrained to locators enable you to control the pole vectors by means of the locators.
UNDERSTANDING POLE VECTOR CONSTRAINTS A pole vector constraint causes the end of a pole vector to move to and follow the position of an object, or the average position of several objects. In character setup, the pole vectors of IK rotate plane handles for arm joint chains are often constrained to locators placed behind the character.
CONSTRAINTS
CHARACTER SETUP 447
USING POLE VECTOR CONSTRAINTS | 36 Understanding pole vector constraints
In general, you will want to constrain a pole vector so that the joint chain does not unexpectedly flip when you manipulate the IK rotate plane handle. Because flipping can occur when the handle vector approaches or intersects the pole vector, you should constrain the pole vector so that the handle vector is unlikely to cross it. For more information about pole vectors and IK rotate plane handles, see Chapter 21, “Using IK Rotate Plane Handles.”
Target objects A constrained pole vector is a pole vector whose position is driven by the position of one or more target objects. The position of one or more target objects is called the target point.
Target point The target point is the position of the target object. If there is more than one target object, the target point is the average position of all the target objects. However, if you are using more than one target object, you can vary the influence of each target object on the calculation of the target point. The target point can be a weighted average of the positions of the target objects, with some target objects having more influence than others. The influence of target objects on the weighted average is specified by target object weights.
Target object weights For each target object, you can specify a target object weight that controls that object’s influence in the calculation of the target point. The resulting weighted average drives the constrained pole vector’s position.
Constrained pole vector’s end position The constrained pole vector’s end position is driven by the target point. However, you can offset the constrained pole vector’s end position from the target point. Offsetting the constrained pole vector’s end position from the target point can be useful in situations where you don’t want the local axis of the constrained pole vector to coincide exactly with the target point. Keep in mind that the IK chain controlled by the pole vector’s IK rotate plane handle rotates when the target point moves. If you move the target object, the movement of the pole vector will cause the IK chain to rotate.
Locked channels Pole vector constraints lock an IK rotate plane handle’s pole vector direction (Pole Vector X, Y, and Z) channels.
CHARACTER SETUP 448
PART 5
USING POLE VECTOR CONSTRAINTS | 36 Creating pole vector constraints
Related MEL commands MEL commands related to pole vector constraints include the following: •
poleVectorConstraint For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph nodes for a pole vector constraint include the following: •
Pole vector constraint node (default name: constrainedObject_poleVectorConstraintn). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING POLE VECTOR CONSTRAINTS When creating pole vector constraints, you can first set creation options and then create a pole vector constraint, or you can immediately create a constraint with the current creation options.
Setting constraint options To set constraint options: 1
If you also want to create a pole vector constraint now, select one or more objects, followed by the IK rotate plane handle whose pole vector you want to constrain.
2
Select Constrain > Pole Vector ❒. The Pole Vector Constraint Options window is displayed.
3
Set the constraint options: Specifies how much the constrained pole vector’s end position can be influenced by the target object(s). Use slider to select values from 0.0000 to 10.0000. Default is 1.0000.
Weight
Constraint Operation
Specifies whether to add or remove target objects. Click Add Targets to add targets, or Remove Targets to remove targets. Add Targets is the default because creating the constraint involves adding target objects. •
Click Add/Remove to create a pole vector constraint (assuming Add Targets is on). or
•
Click Save to save the constraint options. or
•
Click Reset to reset to the default constraint options. or
•
CONSTRAINTS
Click Close to close the Pole Vector Constraint Options window.
CHARACTER SETUP 449
USING POLE VECTOR CONSTRAINTS | 36 Editing pole vector constraints
Creating a pole vector constraint To create a pole vector constraint: 1
Select one or more target objects, followed by the IK rotate plane handle whose pole vector you want to constrain to them.
2
Select Constrain > Pole Vector. A pole vector constraint is created with the current constraint options. (The Add Targets option should be on.) The pole vector’s position attributes (Pole Vector X, Y, and Z) are now locked. Their values are now provided by the target point.
EDITING POLE VECTOR CONSTRAINTS Editing pole vector constraints is described in the following topics.
Editing pole vector constraint channels To edit channels with the Channel Box: 1
In the scene, select the constrained pole vector’s IK rotate plane handle. The pole vector constraint node is in the IK rotate plane handle’s history, listed and automatically selected in the Channel Box under SHAPES. Note that you can control which attributes are listed as keyable attributes (channels) in the Channel Box with the Channel Control editor (select Window > General Editors > Channel Control).
2
In the Channel Box, the following channels are listed for the pole vector constraint:
Node State
Specifies the node state. Specify Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking. Default is Normal. For more information, see “Constraint node behavior” on page 382 in Chapter 28.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the end position of the constrained pole vector can be influenced by the target object. (The n in Wn is an identifier for each target object, starting from 0.) 3
Click on a channel name with the left mouse button.
4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key gives you finer control, and pressing the Shift key gives you coarser control.
Editing pole vector constraint attributes To edit attributes with Attribute Editor: 1
Select the pole vector constraint node.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a).
CHARACTER SETUP 450
PART 5
USING POLE VECTOR CONSTRAINTS | 36 Editing pole vector constraints 3
The following sections make available attributes: Transform Attributes, Pole Vector Constraint Attributes, Pivots, Limit Information, Display, Node Behavior, and Extra Attributes. Transform Attributes Specifies transform attributes of the pole vector constraint’s selection handle. Pole Vector Constraint Attributes
Constraint Offset
Specifies an offset position (translate X, Y, and Z) for the constrained pole vector relative to the target point. Note that the target point is the position of the target object, or the average position of the target objects. Default values are all 0. Specifies the polarity of the Constraint Offset. In effect, the Constraint Offset values are multiplied by the Offset Polarity to give the constrained pole vector’s end position. Default is 1.
Offset Polarity
Constraint Translate
Informs you of the constrained pole vector’s current end position. Useful to know when you are specifying the Constraint Offset and Offset Polarity. Pivots Selections for displaying the pole vector constraint’s local rotate and scale pivots in local or world space. Limit Information (For Maya internal use only: attributes inherited from transform node.) Display Selections for selection handle display attributes, including handle display, local axis display, selection handle position (relative to current Translate X, Y, and Z attribute values), default manipulator display selections, visibility, and template. Bounding Box Information and Drawing Overrides not applicable. Node Behavior See “Constraint node behavior” on page 382 in Chapter 28. Extra Attributes Lists the weights for each target object. Their initial values are all from the weight creation option.
targetObject Wn
Specifies a target object’s weight. The weight specifies how much the position of the constrained pole vector can be influenced by the target object. •
Click Select to select the node you are now editing as the currently selected object in your scene. or
•
Click Load Attributes to load the attribute values of the currently selected node. or
•
CONSTRAINTS
Click Close to close the Attribute Editor.
CHARACTER SETUP 451
USING POLE VECTOR CONSTRAINTS | 36 Editing pole vector constraints
Adding target objects After you’ve created a pole vector constraint, you can add more target objects for additional control over the constrained pole vector’s position. Adding more target objects is similar to creating pole vector constraints. To add target objects: 1
Select one or more objects you want to add as target objects, followed by the constrained pole vector.
2
Select Constrain > Pole Vector ❒. The Pole Vector Constraint Options window is displayed.
3
Be sure that Add Targets is selected as the Constraint Operation.
4
Click Add/Remove to add the selected objects as target objects. The constrained pole vector’s position changes, indicating that it is now constrained by the objects you’ve just added as target objects.
Removing target objects After you’ve created a pole vector constraint, you can remove any of the target objects so that the objects no longer constrain the constrained pole vector. Removing target objects is similar to adding target objects. Note that when you remove a target object, you also remove any animation curves attached to the constraint object for that target object. To remove target objects: 1
Select one or more target objects, followed by the constrained pole vector’s IK rotate plane handle.
2
Select Constrain > Pole Vector ❒. The Pole Vector Constraint Options window is displayed.
3
Select Remove Targets as the Constraint Operation.
4
Click Add/Remove to remove the selected objects as target objects. The constrained pole vector’s end position changes, indicating that it is no longer constrained by the target objects you’ve just removed.
Changing target object weights A target object’s weight specifies how much the position of the constrained pole vector can be influenced by a target object. The weights are attributes of the pole vector constraint. For each target object, an attribute named targetObject Wn is included that specifies the weight of each target object. By default, the weights are set to 1, which gives each target object an equal influence over the constrained pole vector’s end position. However, you can change the weights so that some target objects can have more (or less) influence than others. You can change target object weights with the Channel Box or the Attribute Editor. To change target object weights with Channel Box: Edit the targetObject Wn channels as described in "Editing pole vector constraint channels" on page 450.
CHARACTER SETUP 452
PART 5
USING POLE VECTOR CONSTRAINTS | 36 Deleting pole vector constraints To change target object weights with Attribute Editor: Edit the targetObject Wn attributes as described in "Editing pole vector constraint attributes" on page 450.
Offsetting constrained pole vector’s end position The constrained pole vector’s end position is driven by the target point, but you can offset the end position from the target point. To do so, edit the Constraint Offset and Offset Polarity attributes with the Attribute Editor. To offset constrained pole vector’s end position: Edit the Constraint Offset and Offset Polarity attributes as described in "Editing pole vector constraint attributes" on page 450. By default, these attributes are not displayed as channels in the Channel Box. If you’d like to control them from the Channel Box, you can add them by using the Channel Control editor (select Window > General Editors > Channel Control.).
DELETING POLE VECTOR CONSTRAINTS To delete a pole vector constraint, delete the pole vector constraint node. To delete a pole vector constraint:
CONSTRAINTS
1
Select the pole vector constraint node only. (Select the point constraint’s selection handle if displayed, or use the Hypergraph to select the point constraint node.)
2
Select Edit > Delete (default shortcut: Backspace key).
CHARACTER SETUP 453
USING POLE VECTOR CONSTRAINTS | 36 Deleting pole vector constraints
CHARACTER SETUP 454
PART 5
PART 6
CHARACTER SETS
37
INTRODUCING CHARACTER SETS With character sets, you can bring together all of a character’s attributes that are essential for its animation.
Character by Jason Schleifer
UNDERSTANDING CHARACTER SETS In Maya, a character set is a node that brings together into a set all the attributes of any collection of objects that you want to animate together. The character set could be anything: a well-armed robot, an automobile, or even some seemingly unrelated collection of objects. Maya enables you to bring together all the attributes together in a character node, so you only have to select one node, the character node, when you want to animate all the various attributes. For example, suppose you have created a snowman that consists of several NURBS spheres and cylinders parented into a hierarchy, along with several IK handles and some locators that include certain attribute controls (by adding new attributes from the Attribute Editor and using Animate > Set Driven Key > Set). By selecting all these
CHARACTER SETS
CHARACTER SETUP 457
INTRODUCING CHARACTER SETS | 37 Character node behavior entities that you want to animate together and creating a character node, you bring all the attributes of these entities together. You can name the character node “snowman,” and when you select the “snowman” character node, you have immediate access to all of the snowman’s attributes that you might want to animate. All the keyable attributes (channels) relevant for animating the snowman can be immediately accessible from the Channel Box, for instance. You can then set keys all on all the channels or on just some of them. Without the character node, you would have to select and animate the various objects that make up the snowman separately. The power of character sets in Maya is that once you have created a character set, you can leverage Maya’s animation features to animate at the character level. This enables Maya to provide the kind of intuitive interaction typically associated with traditional animation techniques. With character sets, you can also take advantage of Maya’s nonlinear character animation feature, the Trax Editor. The Trax Editor takes character animation to a new, powerful level of artistic control and productivity (see Using Maya: Animation). Finally, you can build libraries of character sets that are all organized in a common manner. In summary, Maya’s character set feature brings together all of a character’s attributes that are essential for its animation. By bringing these attributes together, you can set up a character that is much easier and faster to animate. Animators can take advantage of Maya’s animation features to work on the character as a whole, and do not have to worry about the more technical details of a character’s setup.
CHARACTER NODE BEHAVIOR You don’t need to know about character node behavior in order to use character sets effectively. If you are new to character sets, you can skip this section. However, familiarity with character node behavior can provide you with more control over character manipulation and performance. For each object in your scene, if there has been any change to its node or any of the nodes in its history (its upstream or downstream nodes), Maya will evaluate the nodes and update the display based on the node’s node behavior attributes. The node behavior attributes for character nodes can affect how characters are evaluated and displayed.
Understanding node behavior attributes The node behavior attributes include Caching and Node State. Caching
Specifies that Maya store the results of upstream evaluations, and then provide those results to the node. This saves Maya from having to re-evaluate the upstream nodes every time the node needs the results. If there are no changes to the upstream nodes, then this setting can improve display performance with no loss of results. However, note that caching uses more memory than would otherwise be used, which could adversely affect performance. Also, if there are changes to upstream nodes, more memory is allocated and then freed, which could also adversely affect display performance.
Node State
Set Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, WaitingHasNoEffect, or Waiting-Blocking. (Note that the Node State attribute is available as a channel in the Channel Box.)
Normal
Specifies that Maya evaluate and display the character. Maya will evaluate the node as usual. This is the default.
CHARACTER SETUP 458
PART 6
INTRODUCING CHARACTER SETS | 37 Workflow summary HasNoEffect
Specifies that Maya prevent actions on the character set, but still display the character set. Maya will evaluate the nodes in the node’s history, but not the node itself.
Blocking
Specifies that Maya prevent actions on the character set, and not display the character set. Maya will not report the results of any evaluations of upstream nodes to this node.
Waiting-Normal
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting (Window > Settings/Preferences > Performance Settings) is set to Demand or Release, the node will take the Normal state when you click Update or release the mouse button.
WaitingHasNoEffect
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the HasNoEffect state when you click Update or release the mouse button.
WaitingBlocking
(For Maya internal use only.) Specifies that if the dependency graph evaluation refresh performance setting is set to Demand or Release, the node will take the Blocking state when you click Update or release the mouse button.
Editing node behavior To set node behavior with Attribute Editor: 1
Open the node’s Attribute Editor.
2
In the Attribute Editor, open Node Behavior.
3
Click Caching on or off.
4
Select the Node State as Normal, HasNoEffect, or Blocking. (The Waiting-Normal, Waiting-HasNoEffect, and Waiting-Blocking states are for Maya’s internal use.)
5
Close the Attribute Editor. To set Node State channel with Channel Box: When editing constraint channels with the Channel Box, you can set the Node State to Normal, HasNoEffect, Blocking, Waiting-Normal, Waiting-HasNoEffect, or Waiting-Blocking.
WORKFLOW SUMMARY Using Maya’s character set feature involves defining the character set and then animating it. Defining the character set includes creating the character set and editing its collection of attributes. Animating the character set includes setting the current character set, and then setting and editing keys. For more information on defining character sets, see Chapter 38, “Defining Character Sets.” For more information on animating character sets, see Chapter 39, “Animating Character Sets.” By setting up characters with Maya’s new character set feature, you can provide a complete, ready-to-animate character whose essential attributes are all gathered together for the animator’s convenience. Once you’ve done this, character setup is complete and animation can begin.
CHARACTER SETS
CHARACTER SETUP 459
INTRODUCING CHARACTER SETS | 37 Workflow summary
CHARACTER SETUP 460
PART 6
38
DEFINING CHARACTER SETS Defining character sets includes creating and editing character sets. Once you’ve defined your character set, you’ve completed character setup.
Character by Jason Schleifer
UNDERSTANDING CHARACTER SET DEFINITION During character setup, you create a complex, hierarchical organization of objects that provides the features of a distinct character. The character might be a character in the traditional sense (a robot, for example), or could be any collection of objects that make up something you want to animate as a distinct entity (a flying logo, for example). You can bring together all the attributes of these objects you want to animate together by defining a character set for these objects. Defining a character set provides greater convenience during animation because all the attributes are available in the same place, and also because you can leverage Maya’s animation features to act on the character rather than on various separate objects. You can also develop a hierarchy of character sets by creating subcharacter sets within a character set. With subcharacter sets, you can maintain a hierarchical relationship between a character’s various parts, while still providing character-level control over those various parts. A subcharacter is a subset of a character set.
CHARACTER SETS
CHARACTER SETUP 461
DEFINING CHARACTER SETS | 38 Creating character sets Subcharacter sets are useful for keyframing and for creating animation clips with the Trax Editor. For example, you could define the attributes of a character’s right arm as a subcharacter set because you plan to do extensive keyframe animation of the right arm as compared to other body parts. When a subcharacter set is current and you set a key, Maya keys only the subcharacter set’s attributes. When a character set is current and you set a key, Maya keys the character set’s attributes and all its subcharacter set’s attributes. If you create a clip while a subcharacter set is current, the clip contains only the keyed subcharacter set’s attributes. If you create a clip while the character is current, the clip contains all keyed attributes on the character and the subcharacter. The hierarchical relationship of a subcharacter set to its parent character set is displayed in the Outliner and in the Trax Editor. When you define a collection of objects as a Maya character set (or subcharacter set), Maya creates a character node that brings together all the various attributes that you might want to animate. These attributes are placed in a type of set, called a character set, which is by default placed in Maya’s character partition. (If you are not familiar with sets and partitions, refer to Using Maya: Essentials.) By default, Maya places all the keyable attributes of the objects into the character set. You can, however, edit the character set, adding any other attributes, or removing any attributes that you feel are not relevant to the animation of the character. Defining a character set in Maya is the process of creating the character node, and then editing it so that you are then ready to animate it.
Related MEL commands The MEL command related to character sets is the following: •
character For more information about this command, refer to the online MEL Command Reference documentation.
Dependency graph nodes The dependency graph node for a character set is the following: •
Character node, a set node that includes all the character set’s attributes (default name: charactern). For more information about this and other nodes, refer to the online Node and Attribute Reference documentation.
CREATING CHARACTER SETS When creating character sets, you can first set creation options and then create a character set, or you can immediately create a character set with the currently set creation options.
Setting creation options To set creation options: 1
CHARACTER SETUP 462
If you also want to create a character set now, select all the objects whose attributes you want to use to animate the character. PART 6
DEFINING CHARACTER SETS | 38 Creating character sets 2
Select Character > Create Character Set ❒. The options window is displayed. Specifies the name of the character set. Default name is charactern.
Name Character Set Attributes
Specifies which attributes will be included with the character set as keyable. You can choose All Keyable, From Channel Box, or All Keyable Except. Specifies that all the keyable attributes of all selected objects will be included as the character set’s attributes.
All Keyable From Channel Box
Specifies that only the currently selected channels in the Channel Box will be included with the character set.
All Keyable except
Specifies whether certain attributes will be included with the character set. This allows you to control the number of attributes included in a character set as you create the character set. This can save you time, reduce the number of attributes listed in the Channel Box, and help make your animation work more efficient. No Translate specifies that the translation attributes will be included as keyable attributes unless checked on (default is off). No Rotate specifies that the rotation attributes will be included as keyable attributes unless checked on (default is off). No Scale specifies that the scaling attributes will be excluded as keyable attributes unless checked off (default is on). No Visibility specifies that the visibility attribute will be excluded as a keyable attribute unless checked off (default is on). No Dynamic specifies that any dynamic attributes will be excluded as keyable attributes unless checked off (default is on). Specifies that all of the objects in the hierarchy below the selected objects are included in the character set. When turned off, only the selected objects are included in the character set.
Hierarchy
3
Click Create Character if you want to create a character set and close the window now. Click Apply to create and keep the window open. Click Close to close the window.
Creating a character set To create a character set: 1
Select the objects whose attributes you want to use to animate the character set.
2
Select Character > Create Character Set. A character set is created. The character node (default name: charactern) provides a set of the keyable attributes from all the selected objects. All the keyable attributes are now conveniently organized in one character set provided by the character node. You might find that you don’t need immediate access to all of the attributes in the character set. Removing some of the attributes from the character set can make the listing of channels in the Channel Box shorter and more manageable. For information on removing and adding attributes, see "Editing a character set" on page 466.
CHARACTER SETS
CHARACTER SETUP 463
DEFINING CHARACTER SETS | 38 Creating subcharacter sets To create a character set from the Relationship Editor: You can also create characters while using the Relationship Editor in Character Editing mode (select Window > Relationship Editors > Character Sets). Select the objects you want to include in the character set, and in the Relationship Editor, select Edit > Create Character Set.
Creating character sets within character sets You can create character sets within character sets. When you create a character set, you can include character sets among the objects you select before selecting Character > Create Character Set. By creating character sets within character sets, you can create a hierarchy of character sets that you want to animate together. You could also think of the character sets within character sets as subcharacter sets, aspects of a character that you might want to animate separately in certain situations.
CREATING SUBCHARACTER SETS You can create subcharacter sets within previously defined character sets. When you create a subcharacter set, Maya adds the subcharacter set to the current character set. This is useful because you can apply the power of Maya’s character animation features to parts of a character’s hierarchy. Creating subcharacter sets is similar to creating character sets: you select a character’s objects that you want to define as a subcharacter set (for example, the objects that make up the character’s face) and then select Character > Create Subcharacter Set. The creation options for subcharacters are the same as the options for creating characters (see "Creating character sets" on page 462).
EDITING CHARACTER SETS Editing character sets is described in the following topics.
Selecting character sets To select a character set: Select Character > Select Character Set Node > charactern, where charactern is the default name for a character set. The character set is selected. (Note that the objects in the character set are not selected.) To select the objects in a character set: Select Character > Select Character Set Members > charactern, where charactern is the default name for a character set. The objects that make up the character set are selected, but the character set itself is not selected.
CHARACTER SETUP 464
PART 6
DEFINING CHARACTER SETS | 38 Editing character sets To select a character set from the Relationship Editor: If using the Relationship Editor in Character Editing mode, you can select a character set so that it is currently selected in the workspace. To do so, select the character set, and then select Edit > Select Character Set.
Adding channels to a character set You can quickly add the channels (attributes) of any object to a character set. The object need not already be part of the character set. To add channels to the current character set: 1
Make sure the character set you want to add the channels to is the current character set.
2
Select the objects some or all of whose channels you want to add to the character set.
3
In the Channel Box, select the channels you want to add to the character set.
4
Select Character > Add To Character Set. Maya adds the selected channels to the current character set. To add channels to a character set using drag-and-drop in the Outliner: You can move an attribute from one character set to another. You can can similarly add to a character set any numeric attribute that’s not currently in a character set.
1
In the Outliner, display the attribute and the destination character set.
2
Use the middle mouse button to drag and drop the attribute on the character set.
Removing channels from a character set You can quickly remove the channels from a character set. To remove channels: 1
Make sure the character set you want to remove the channels from is the current character set.
2
In the Channel Box, select the channels you want to add to the character set.
3
Select Character > Remove From Character Set. Maya removes the selected channels from the current character set.
Editing character set channels Channels are the attributes displayed in the Channel Box. The Channel Box provides a convenient way to edit a character set’s channels. To edit all attributes, use the Attribute Editor (see "Editing character attributes" on page 466). To edit channels with the Channel Box:
CHARACTER SETS
1
Select a character set.
2
In the Channel Box, the character set’s channels are listed by default.
3
Click on a channel name with the left mouse button.
CHARACTER SETUP 465
DEFINING CHARACTER SETS | 38 Editing character sets 4
In your scene, press the middle mouse button and move the mouse to the left or right. By moving the mouse, you interactively change the value of the selected channel. As you move the mouse, note that pressing the Ctrl key will give you finer control, and pressing the Shift key will give you coarser control.
Editing character attributes To edit attributes with the Attribute Editor: 1
Select the character set.
2
Open the Attribute Editor by selecting Window > Attribute Editor (default shortcut: Ctrl a). Note that you can also open the Attribute Editor by double-clicking on the character set icon in the Outliner.
3
The following sections make available attributes: Character Set Attributes, Node Behavior, and Extra Attributes. Character Attributes Lists all of the attributes in the character set. To edit which attributes are in the character set, see "Editing a character set" on page 466. Node Behavior See "Character node behavior" on page 458. Extra Attributes (No extra attributes by default.)
Editing a character set Editing a character set involves adding or removing attributes from the set. By default, a character set includes all the keyable attributes of the objects included in the character. Typically, you only want to work with some of these attributes. Depending on the number and complexity of the objects included in the character, keeping all of these attributes in the character set can result in a needlessly long list of channels in the Channel Box. Consequently, after you create a character set, you may find you want to remove some of the attributes from the character set. Of course, you can later add them back to the character set. For general information about sets and partitions, see Using Maya: Essentials. Editing a character set involves using the Relationship Editor. For more information about the Relationship Editor, see Using Maya: Essentials. To view which objects are in a character set: 1
Select Window > Relationship Editors > Character Sets, or if you already have the Relationship Editor open, select its Character Editing mode option. The editor’s left column (Character Sets) lists all the character sets in your scene.
2
Select a character set so that it is highlighted.
3
From the Relationship Editor, select Edit > Select Character Set Members. The objects in the character set are now all selected in the workspace. This provides a quick way to select and view those objects. It’s useful if you just want to check which objects are part of a particular character set.
CHARACTER SETUP 466
PART 6
DEFINING CHARACTER SETS | 38 Editing character sets To remove attributes from the character set: 1
Select Window > Relationship Editors > Character Sets, or if you already have the Relationship Editor open, select its Character Editing mode option. The editor’s left column (Character Sets) lists all the character sets in your scene.
2
Select a character set so that it is highlighted.
3
Click on the + icon next to the selected character set to list all the attributes in the character set.
4
Select the attributes you want to remove from the character set so that they are highlighted in yellow. Remember that you can select items next to each other by pressing the Shift key and left mouse button, and that you can select items not next to each other by pressing the Ctrl key and left mouse button.
5
In the Relationship Editor, select Edit > Remove Highlighted Attributes. The selected attributes are removed from the character set.
6
If you’d like to return to the workspace and pose or animate the character, with the character set still selected, select Edit > Select Character Set. The Channel Box now lists the new collection of attributes in the character set. To add attributes to the character set:
1
Select Window > Relationship Editors > Character Sets, or if you already have the Relationship Editor open, select its Character Editing mode option. The editor’s left column (Character Sets) lists all the character sets in your scene; the right column (Objects) lists all the objects in your scene.
2
In the left column (Character Sets), select the character set to which you want to add attributes so that it is highlighted.
3
In the right column (Objects), select the object whose attributes you want to add to the character set.
4
Expand the object so that its attributes are listed (click the + icons next to the object’s name). The attributes currently in the selected character set are highlighted in yellow. Also, note that the names of these attributes are displayed in italics.
5
Click on the names of the attributes you want to add to the character set. The selected attributes are added to the character set.
6
If you’d like to return to the workspace and pose or animate the character, with the character set still selected, select Edit > Select Character Set. The Channel Box now lists the new collection of attributes in the character set.
Viewing and editing the character partition By default, each character set you create is placed in a default character partition. With all the character sets in the same partition, you can be sure that the attributes in one character set will not be in some other character set. To view the default character partition, you can use the Relationship Editor.
CHARACTER SETS
CHARACTER SETUP 467
DEFINING CHARACTER SETS | 38 Merging character sets You should avoid editing the character partition. Editing the character partition can lead to problems because in doing so you might unintentionally end up having attributes in more than one character set. To view the character partition: 1
If you already have the Relationship Editor open to edit character sets, change the Character Editing selection to Partition Editing. If you don’t have the Relationship Editor open, select Window > Relationship Editors > Partitions.
2
In the Relationship Editor, note the character partition (default name: characterPartition). To find out the character sets in the character partition, click on the + icon. To find out all the attributes in a character set, click on the + icon next to the character set’s icon. For more information about using the Relationship Editor, refer to Using Maya: Essentials.
MERGING CHARACTER SETS You can merge multiple character sets into a single character set without losing any clip data. To merge multiple character sets into a single character set: 1
Select the character sets. If you select a character set and one or more of its subcharacter sets, the selected subcharacter sets are merged into the top level character set. If none of the selected character sets are hierarchically related, the character sets are merged into the last selected character set.
2
Select Character > Merge Character Sets.
DELETING CHARACTER SETS To delete a character set: 1
Select the character set.
2
Select Edit > Delete (default shortcut: Backspace key). The character node is deleted. However, the objects that made up the character are not deleted. Note that if you select all of the nodes that are in a character and delete them, the character node will also be deleted. To delete a character set with the Relationship Editor: You can also delete the character set while using the Relationship Editor in Character Editing mode (select Window > Relationship Editors > Character Sets). In the Relationship Editor, select a character set, and then select Edit > Delete Highlighted Character Sets. Note that the Edit > Undo selection from Maya’s main menu applies to actions you perform in the Relationship Editor.
CHARACTER SETUP 468
PART 6
39
ANIMATING CHARACTER SETS After you’ve defined character sets, you can leverage Maya’s animation features to animate them at the character level.
Image by Cristoph Berndt
UNDERSTANDING ANIMATING CHARACTERS Defining character sets enables you to animate characters as a single entity rather than as a group of separate objects. For your convenience, all the attributes relevant for the character’s animation can be available together in one place. For example, animators can set keys and breakdowns on characters instead of on the various objects that make up a character. This enables Maya to provide animators with a
CHARACTER SETS
CHARACTER SETUP 469
ANIMATING CHARACTER SETS | 39 Setting the current character Set more intuitive approach to animating characters. Further, you can set a character as the current character set, identifying it as the character you want to focus on and animate.
SETTING THE CURRENT CHARACTER SET As you animate, you can set a character set as the current character set so that you can animate that character set only. Similar to layers, the current character set is separate from items in the selection list. This allows you to select items in your scene without changing which character set is the current character set. You can set the current character set from the Time Slider, the Character menu, or the Relationship editor. To set the current character set from Time Slider: You can quickly set any character set as the current character set as you animate. In the Time Slider, near the Timeline, note the black triangle button and the text field next to the Auto Keyframe icon. The text field displays the current character set’s name. To set another character set as the current character set, click on the triangle icon. Select the character set you want as the current character set, or access the Relationship Editor by selecting Other. To set the current character set from Character menu: You can set the current character set by selecting Character > Set Current Character Set. Select the character set you want as the current character set, or access the Relationship Editor by selecting Other. You can select character sets by selecting Character > Character Set Node > charactern (the default name of a character). To check and set current character sets from Relationship Editor: When using the Relationship Editor in Character Editing mode, you can check which character sets are current by selecting Edit > Highlight Current Character Sets. To make character sets you’ve selected in the editor as current character sets, select Edit > Make Highlighted Character Sets Current. For more information about selecting and editing character sets with the Relationship Editor, see "Selecting character sets" on page 464, and "Editing a character set" on page 466. For more information about using the Relationship Editor, refer to Using Maya: Essentials.
KEYFRAMING CHARACTER SETS As with any animatable object in Maya, you can set keys and breakdowns on character sets. For more information on animation, including setting keys and breakdowns, refer to Using Maya: Animation.
CREATING EXPRESSIONS FOR CHARACTER SETS You can create expressions for character sets, or for the objects that make up a character set. Expressions provide an excellent way to incorporate automatic or overlapping, secondary actions into a character’s behavior. For example, you could
CHARACTER SETUP 470
PART 6
ANIMATING CHARACTER SETS | 39 Using motion capture for character sets create an expression that acts on smooth skin influence objects behind a character’s chest or belly, making the character seem to breathe. For more information on expressions, refer to Using Maya: Expressions.
USING MOTION CAPTURE FOR CHARACTER SETS You can impart motion to your character sets by using motion capture data. For more information on capturing, filtering, and using motion capture data, refer to Using Maya: Animation.
CHARACTER SETS
CHARACTER SETUP 471
ANIMATING CHARACTER SETS | 39 Using motion capture for character sets
CHARACTER SETUP 472
PART 6
INDEX Add button 62 Add Holder selection 183 Add In-Between Target add option 68 Add Influence Object selection 339, 340 Add Influence Options window 339 Add Influence selection 200 Add operation Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Add option 48 Add selection 67, 69, 176 Add Targets button 389, 402, 411, 417, 423, 434, 444, 452 Add To Character Set selection 465 advanced creation options deformers 52 After placement 45 Aim Constraint Options window 398, 402 aim constraints 395 adding target objects 402 changing target object weights 403 controlling motion history dependence effects 403 creating 398 deleting 404 dependency graph nodes 398 editing 399 editing attributes 400 editing channels 399 examples 404 MEL commands 398 preventing rolling effects 403 removing target objects 402 setting creation options 398 understanding 395 Aim selection 398, 399, 402 Aim Vector attribute 400, 432, 442 Aim Vector constraint option 398, 431, 441 aim vectors 396, 428, 438 All Keyable except creation option 463 All Keyable option 463 Alphabetically 328 Amount tool setting 187
Amplitude attribute 130, 153 Amplitude channel 129, 153 Amplitude creation option 126, 150 Angle Interpolation attribute 91, 359 animating characters 469 necks, tails, spines 273 animation controllers 382 Animation Details 240 Animation menu set 31 arrow keys 223 Assume Preferred Angles selection 229 attributes 43 adding 54 channels 54 connecting 54 keyable 54 non-keyable 54 setting IK spline handle 281 Auto Create Curve 280 Root Axis 279, 286 Auto Create Curve tool setting 280 Auto Create Root Axis tool setting 279 Auto Joint Limits tool setting 217 Auto Joint Orient tool setting 216 Auto Parent Curve 286 Auto Parent Curve tool setting 279 Auto Simplify Curve 280 Auto Simplify Curve tool setting 280 Autopriority tool setting 253, 265, 299
B Bake History option 337 ball joints 213 baseOrigin attribute 63 Before placement 45
bend deformers 111 creating 112 deleting 116 dependency graph nodes 112 editing attributes 115 editing channels 114 editing deformation effects 113 manipulating handles 114 MEL commands 111 setting creation options 112 understanding 111 Bend selection 112, 113 Bicep channel 373 Bind Method option 320, 355 bind pose 311, 321, 356 changing 322, 357 global 357 going to 321, 356 local 357 problems 322, 357 Bind to option 319, 355 binding rigid skin 354 smooth skin 319 blend shape deformers 57 adding target object shapes 67 blending objects with different topologies 64 creating 59 creating new blend shape deformer 67 deleting 70 deleting a target’s object 65 dependency graph nodes 59 editing attributes 63 editing channels 62 editing deformation effects 61 matching position, rotation, and scaling of targets 64 MEL commands 58 removing target object shapes 69 saving a blend shape as a new target 66 scaling influence of all targets 64 selecting node 67 setting creation options 59 setting keys for blend shapes 66 setting target weights 65 swapping target object shapes 70 understanding 57 using the Blend Shape editor 61
ANIMATION
A
CHARACTER SETUP 473
INDEX
Blend Shape editor 61 using 61 BlendShape Add Options window 67 BlendShape Node add option 68 BlendShape Node creation option 60 BlendShape Node remove option 69 BlendShape Node swap option 70 BlendShape Options window 59 BlendShape Remove Options window 69 BlendShape Swap Options window 70 Blocking node state option 55, 208, 314 bone lattice flexors 353 bone sculpt flexors 354 bones 213 Bones creation option 369 box around the start joint 254, 267 By Hierarchy 328
C C icon 89, 188 Cache Time Range 108 Caching attribute 54, 208, 313 Changing Blend Shape editor slider orientation 62 channels 54 Character menu 37 Character menu selections Add To Character Set 465 Character Set Node 470 Create Character Set 463 Create Subcharacter Set 464 Remove From Character Set 465 Select Character Set Members 464 Set Current Character 470 character nodes 462 character partitions 462, 467 character rigging 30 Character Set Attributes options 463
CHARACTER SETUP 474
character sets 37, 457, 467 adding attributes 467 adding channels to 465 creating character sets within character sets 464 creating expressions 470 defining 461 deleting 468 dependency graph nodes 462 editing 464 editing attributes 466 editing channels 465 editing character partition 468 keyframing 470 MEL commands 462 merging 468 node behavior 458 removing attributes 467 removing channels from 465 selecting 464 setting creation options 462 understanding 457 understanding character definition 461 using motion capture 471 viewing objects in a character 466 character setup 30 features 33 characters animating 469 creating 462 setting current character 470 from Character menu 470 from Relationship Editor 470 from Time Slider 470 Check Topology creation option 60 Clamp settings Paint Cluster Weights Tool 97 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 97 Clamp Value setting Paint Cluster Weights Tool 97 Paint Jiggle Weights Tool 102 Paint Skin Weights Tool 97 cloth garment wrap influence objects 193
cluster deformers 87 controlling deformation percentage of entire cluster 102 creating 88 deleting 102 dependency graph nodes 88 editing attributes 90 editing channels 90 editing cluster deformer sets 91 editing cluster weights 92 editing deformation effects 89 manipulating the cluster handle 89 MEL commands 87 pruning cluster deformer sets 91 setting cluster relative to parent transform 102 setting creation options 88 setting location of cluster handle 102 understanding 87 using weighted nodes 102 Cluster Options window 88 Cluster selection 92 cluster weights flooding 95 mapping 95, 100 masking 95 paint operations 96 painting 93, 97, 361 Color Feedback option 47 Color Feedback setting 93, 97, 99, 327, 361 Coloring option 337, 355, 367 Complete List selection 51 Component Editor 92, 325, 359 Components Matrix channel 323 Connect Joint Options window 225 Connect Joint selection 225 Connect to IK/FK 239 Constrain menu 36 Constrain menu selections Aim 398, 399, 402 Geometry 421, 423, 424 Normal 430, 431, 434, 435 Orient 408, 409, 411 Point 387, 389, 390, 452 Pole Vector 449, 450, 452 Scale 414, 415, 417 Tangent 440, 441, 444, 445 constrained objects 385, 395, 407, 413, 419, 428, 438 Constraint Offset attribute 388, 451
INDEX
Constraint Operation constraint option 387, 399, 409, 415, 421, 431, 441, 449 Constraint Rotate attribute 401, 410, 422, 433, 443 Constraint Scale attribute 416 Constraint Translate attribute 389, 451 Constraint Vector attribute 401, 433, 443 constraints 36, 381 aim 395 basic 381 enabling and disabling all nodes 383 geometry 419 node behavior 382 normal 427 orient 407 point 385 pole vector 447 scale 413 tangent 437 understanding 381 construction history 53 deleting 53 control points 42 Copy Flexor selection 372 Copy Jiggle Disk Cache Files on Save Scene As 108 Copy Skin Weights selection 332 Creasing channel 371 Create Bend Deformer Options window 112 Create Blend Shape selection 59, 61 Create Character button 463 Create Character Set Options window 463 Create Cluster selection 88, 89 Create Flare Deformer Options window 118 Create Flexor selection 369 Create Flexor window 369 Create IK Handle tool setting 217 Create Jiggle Deformer Options window 105 Create Lattice selection 75, 76 Create Sculpt selection 161, 162 Create Sine Deformer Options window 126 Create Squash Deformer Options window 132
Create Twist Deformer Options window 144 Create Wave Deformer Options window 150 Create Wrap Deformer Options window 193 Create Wrap selection 193, 195 creating aim constraints 398 bend deformers 112 blend shape deformers 59 character sets 462 cluster deformers 88 flare deformers 118 geometry constraints 421 IK rotate plane handles 253 IK single chain handles 265 IK spline handles 274 IK two bone handles 299 jiggle deformers 105 joint chains 216 lattice deformers 74 limbs 216 normal constraints 430 orient constraints 408 parent transform with IK spline 279 point constraints 387 pole vector constraints 449 rigid skin 354 scale constraints 414 sculpt deformers 161 sine deformers 126 skeletons 216 smooth skin 319 squash deformers 132 tangent constraints 440 twist deformers 144 wave deformers 150 wire deformers 171 wrap deformers 192 wrinkle deformers 187 Crossing Effect attribute 179 Crossing Effect channel 177 Crossing Effect tool setting 172 current character set 470 Current Solver tool setting 253, 265, 299 Curvature attribute 115 Curvature channel 115 Curvature creation option 113 Curve attribute 122 curve attribute 179 Curve channel 121
Curve creation option 119 Curve Editing Tool 275 curve points 391 constraining to locators 391 curves auto-creating with IK spline handle 280 auto-simplifying with IK spline handle 280 IK spline handle 274 transforming IK handle 278 custom deformable objects 42 custom wrinkle deformers 186
D Damping 106 Default placement 45 Default Weight option 339 Deform menu 34
CHARACTER SETUP 475
INDEX
Deform menu selections Create Blend Shape 59, 61 Create Cluster 88, 89 Create Jiggle Deformer 105 Create Lattice 75, 76 Create Nonlinear Bend 112, 113 Flare 118, 119 Sine 126, 127 Squash 132, 133 Twist 144, 145 Wave 150, 151 Create Sculpt 161, 162 Create Wrap 193, 195 Edit Blend Shape Add 67, 69 Remove 69 Swap 70 Edit Lattice Remove Lattice Tweaks 80 Reset Lattice 80, 81 Reset Lattice Tweaks 81 Edit Membership Tool 47, 363 Edit Wire Add 176 Add Holder 183 Parent Base Wire 177 Remove 176, 183 Reset 177 Edit Wrap Add Influence 200 Remove Influence 200 Point On Curve 391, 392 Prune Membership Cluster 92 Lattice 81 Sculpt 165 Wire 183 Wire Dropoff Locator 180 Wire Tool 172, 173, 174 Wrinkle Tool 187, 188 deformable object points 42 deformable objects 42, 309 user-defined 42 deformation chain 44 deformation order 43 changing 50 Deformation Order creation option 52 After 45 Before 45 Default 45 Front Of Chain 46 Parallel 45 Split 45 Deformation Order tool setting 172
CHARACTER SETUP 476
deformer sets 43 deformers 34, 41 bend 111 blend shape 57 blending influences of several deformers 45 changing performance settings 51 cluster 87 deformation order placement 44 editing advanced creation options 52 editing node behavior 54 editing set membership 46 flare 117 jiggle 105 lattice 73 modeling 53 painting set membership 47 sculpt 159 setup and animation 54 showing and hiding 51 sine 125 squash 131 twist 143 wave 149 wire 167 wrap 191 wrinkle 185 Degrees of Freedom attribute 219 Degrees of Freedom tool setting 216 Delete History option 337 Delete Targets creation option 60 Demand refresh option 51 Dependency 252, 265, 298 dependency graph 43 dependency graph loops IK spline 279, 284 Detach Selected Joints selection 368 Detach Skeleton selection 367 Detach Skin Options window 337, 367 Detach Skin selection 337, 366, 367 Direction option 331 Disable Weight Normalization selection 333 Disconnect Joint selection 225 Disk Cache 107 disk cache jiggle 107
Display menu selections Hide Hide Deformers Lattices 82 Joint Size 227 Object Components Lattice Points 82 Lattice Shape 81 Local Rotation Axes 222 Show Show Deformers Lattices 82 Divisions creation option 75 double transformation effects 311, 353 downstream nodes 43 Drag refresh option 51 Dropoff attribute 130, 154, 323, 340, 341 Dropoff channel 129, 153, 196, 197 Dropoff creation option 127, 151 Dropoff Distance attribute 160, 164 Dropoff Distance channel 163, 178, 374 Dropoff Distance creation option 162, 369 Dropoff Distance tool setting 172 Dropoff option 339 Dropoff Position 153 Dropoff Rate option 320 Dropoff Type attribute 164 Dropoff Type creation option 162, 370
E Edit Membership Tool 46, 363 Edit Membership Tool selection 47, 363
INDEX
editing aim constraints 399 bend deformation effects 113 blend shape deformation effects 61 character sets 464 cluster deformation effects 89 flare deformation effects 120 geometry constraints 422 IK rotate plane handles 255 IK single chain handles 267 IK spline handles 281 IK two bone handles 301 joints 218 lattice deformation effects 76 normal constraints 432 orient constraints 409 point constraints 387 pole vector constraints 450 rigid skin 356 scale constraints 415 sculpt deformation effects 162 sine deformation effects 127 squash deformation effects 133 tangent constraints 442 twist deformation effects 145 wave deformation effects 151 wire deformation effects 175 wrinkle deformation effects 188 Enable 106 Enable IK Solver 239 Enable State displaying IK handle 240 Enable Weight Normalization selection 333 End Angle attribute 147 End Angle channel 147 End Angle creation option 144 End Effector attribute 257, 269, 303 end effectors 247, 263, 293 End Flare X attribute 122 End Flare X channel 121 End Flare X creation option 119 End Flare Z attribute 122 End Flare Z channel 121 End Flare Z creation option 119 end joints 246, 262, 292 End Smoothness attribute 136 End Smoothness channel 135 End Smoothness creation option 133 Envelope 107
Envelope attribute 64, 79, 91, 115, 122, 130, 136, 147, 154, 164, 180, 199, 324, 359 Envelope attributes for wire dropoff locators 180 Envelope channel 53, 63, 77, 90, 115, 121, 129, 135, 146, 153, 163, 177, 198, 323, 358, 374 Envelope creation option 60, 89 Envelope tool setting 172 Even mode 161 examples aiming cone at sphere 405 aiming sphere at sphere 404 deforming high-res sphere with low-res sphere 201 deforming plane with five cones 202 hand muscle bulge with influence object 345 IK two bone handle quickstart 290 influence objects preventing deformation 348 ripple animation 154 skinning a cylinder by rigid skinning 375 skinning cylinder by smooth skinning 341 spiral staircase modeling 148 wire deformer quickstart 167 Exclusive creation option 52 Exclusive Partition tool setting 172 Exclusive tool setting 172 Existing Nodes add option 68 Existing Nodes remove option 69 Existing Nodes swap option 70 Existing Partitions tool setting 172 Expand attribute 136 Expand channel 135 Expand creation option 133 Export Value 335 expressions 54 character set 470
F Factor attribute 136 Factor channel 135 Factor creation option 133
Filter button Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 fish animating with IK spline 284, 286 FK posing 236 switching to IK 239 FK to IK example of switching 242 flare deformers 117 creating 118 deleting 123 dependency graph nodes 118 editing attributes 122 editing channels 121 editing deformation effects 120 manipulating handles 120 MEL commands 117 setting creation options 118 understanding 117 Flare selection 118, 119 Flexor Type creation option 369 flexors 353, 368 bone lattice flexors 353 bone sculpt flexors 354 creating 368 editing bone lattice flexors 372 editing bone sculpt flexors 374 editing joint cluster flexors 375 editing joint lattice flexors 370 editing joint sculpt flexors 374 joint cluster flexors 354 joint lattice flexors 353 joint sculpt flexors 353 Flip mode 159, 161 flipping IK rotate plane handles 255 IK two bone handles 301 preventing IK spline start joint 282 Flood button 100 Paint Cluster Weights Tool 97 Paint Jiggle Weights Tool 102 Paint Skin Weights Tool 97 flooding clusters 95 flooding jiggle deformers 100 Force Along Normal 106 Force On Tangent 106 forward kinematics (FK) 232 Freeze Geometry attribute 79, 84, 179 Freeze Mode creation option 76
CHARACTER SETUP 477
INDEX
From Channel Box option 463 Front of Chain creation option 61 Front Of Chain placement 46
G garment 193 Geometry Constraint Options window 421, 423, 424 geometry constraints 419 adding target objects 423 animating target object weights 424 animating the constrained object 425 changing target object weights 424 creating 421 deleting 425 dependency graph nodes 421 editing 422 editing attributes 422 editing channels 422 MEL commands 420 removing target objects 424 setting constraint options 421 understanding 419 using point constraints with 425 Geometry option 339 Geometry selection 421, 423, 424 global bind pose 357 Global Snap attribute 238 Global Solver attribute 238 gnomon 263 Go to Bind Pose selection 322, 357 Grouping creation option 76, 162
H hair jiggling 105 hand 346 handle position and orientation control 263 handle position control 247, 292 handle vectors 248, 264, 294 handle wires 248, 264, 293 HasNoEffect node state option 55, 208, 313 hierarchy skeleton 215 Hierarchy creation option 463
CHARACTER SETUP 478
High Bound attribute 115, 122, 130, 136, 147 High Bound channel 115, 121, 129, 135, 147 High Bound creation option 112, 118, 126, 132, 144 hinge joints 214 history 43 construction 53 deleting 53 History option 337, 367 Hold 326 Hold Weights attribute 323 Holders tool setting 172 Horizontal slider option 62 human spines IK spline handle 284
I Ignore Transform 106, 107 IK and FK switching between 239 IK chains 234 IK Handle Tool selection 253, 254, 265, 266, 299, 300 IK handles 234 dependency graph nodes 236 difference between single chain and rotate plane 264 MEL commands 235 IK multi-chain (MC) solvers 238 IK posing 236 switching to FK 239 IK rotate plane handles 245 controlling joint chain flipping 255 creating 253 deleting 260 dependency graph nodes 252 editing 255 editing attributes 256 editing channels 255 manipulating the pole vector 254 manipulating twist disc 255 MEL commands 252 posing 254 understanding 246 IK rotate plane solver editing attributes 259 understanding behavior 253
IK single chain handles 261 creating 265 deleting 271 dependency graph nodes 265 editing 267 editing attributes 268 editing channels 267 MEL commands 264 moving 267 posing 267 rotating 267 understanding 262 IK single chain solver editing attributes 270 understanding behavior 265 IK Solver attribute 257, 269, 303 IK solvers 233, 235 creating 237 creating IK multi-chain (MC) solver 238 disabling and enabling all nodes 239 using 237 IK spline handle 273 animating sinuous motion 286 auto-creating curve 280 auto-parenting curve 279 creating 274 curve 274 dependency graph nodes 274 human spines 284 manipulating curve CVs 275, 284 MEL commands 273 motion path 283 offset 277 parenting to transform or joint 284 rolling 276 selecting 276 setting keys 275 sliding joint chain 276 snapping curve to start joint 280 soft body on curve 283 tail, back, and neck 285 tips for using 284 tool options 278 twisting 276 IK systems editing attributes 238 using 237
INDEX
IK two bone handles 289 controlling joint chain flipping 301 creating 299 deleting 305 dependency graph nodes 298 editing 301 editing attributes 302 editing channels 301 manipulating the pole vector 300 manipulating twist disc 301 MEL commands 298 posing 300 understanding 291 with more than two bones 291 IK two bone solver editing attributes 305 source code 306 understanding behavior 298 ik2Bsolver 306 Image Format 336 In-Between creation option 60 In-Between Weight add option 68 Infl Type channel 197 Inherits Transform attribute 219, 257, 268, 303 Input Nurbs Object attribute 392 Insert Joint Tool selection 224 Inside Mode attribute 164 Inside Mode creation option 161, 370 Intensity tool setting 187 intermediate objects 44, 50 displaying 50 hiding 50 inverse kinematics (IK) 232, 233
J J icon 375 jiggle deleting or disabling cache 109 disk cache 107 motion blur 107 jiggle deformers 105 creating 105 setting creation options 106 Jiggle Only After Object Stops 106 Jiggle Weight 106
jiggle weights flooding 100 mapping 100 masking 100 paint operations 101 painting 99 joint chain plane indicators 250, 295 joint chain planes 249, 295 joint chains 214 best length for IK 265 creating 216 editing 223 joint cluster flexors 354 joint cluster nodes 354 joint lattice flexors 353 Joint Orient attributes 220 joint sculpt flexors 353 Joint Tool selection 216, 218 joints 213 ball joints 213 connecting 225 dependency graph nodes 216 disconnecting 225 displaying local axis 222 editing 218 editing attributes 218 hinge joints 214 inserting 224 MEL commands 215 mirroring 226 moving, rotating, or scaling a joint and its bone 222 orienting local axis 222 removing 224 root joints 215 selecting all in hierarchy 223 setting and assuming preferred angles 228 setting display size 227 universal joints 214 Joints creation option 369
K Keep Aspect Ratio 336 Keep History option 337 Keep Original point on curve option 392 Key All button 62 Key buttons 62
L L icon 81 lattice deformers 73 assuring smooth deformation through base lattice 85 changing influence lattice resolution 81 changing lattice resolution performance settings 85 creating 74 deforming a lattice with other deformers 84 deleting 85 dependency graph nodes 74 editing attributes 78 editing channels 77 editing deformation effects 76 editing influence lattice shape attributes 79 editing influence lattice shape channels 79 editing lattice deformer sets 80 editing the base lattice 84 editing the influence lattice 77 freezing the lattice deformation mapping 82 grouping base and influence lattices 84 improving performance 85 MEL commands 74 parenting lattices to objects being deformed 84 pruning lattice deformer sets 81 resetting influence lattice points and removing tweaks 80 resting influence lattice shape and location 80 sculpting the influence lattice 82 setting creation options 75 showing and hiding all lattice deformers 82 skinning 86 toggling lattice shape handle 81 turning on or off display of lattice points 82 understanding 73 weighting lattice points to alter their influence 82 Lattice Options window 75 lattice points 42 Lattice Points selection 82 Lattice selection 81 Lattice Shape selection 81 Lattices selection 82
CHARACTER SETUP 479
INDEX
least squares modifier 392 least squares modifier attributes 392 Length In channel 371, 373 Length Out channel 371, 373 limbs 214 creating 216 editing 223 mirroring 226 Limit Influence Area creation option 194 List of paintable attributes button Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Local attribute 78 local bind pose 357 Local creation option 60 Local Divisions creation option 75 Local Influence attribute 179 Local Influence channel 178 Local Influence S attribute 78 Local Influence S channel 77 Local Influence T attribute 78 Local Influence T channel 77 Local Influence tool setting 172 Local Influence U attribute 78 Local Influence U channel 78 Local Mode creation option 75 Local Position attribute 181 Local Rotation Axes selection 222 Locator Envelope channels 178 locked attributes joints 357 Low Bound attribute 115, 122, 130, 136, 147 Low Bound channel 115, 121, 129, 135, 147 Low Bound creation option 112, 118, 126, 132, 144 Lower Bound attribute 359 Lower Bound channel 358 Lower Dropoff Type attribute 359 Lower Dropoff Type channel 358 Lower Value attribute 359 Lower Value channel 358
M Map Size X, Y 336
CHARACTER SETUP 480
mapping cluster weights 95, 100 jiggle weights 100 masked surfaces painting cluster weights 95 painting jiggle weights 100 painting skin weights 328 Max Damp Range attributes 220 Max Damp Strength attributes 220 Max Displacement attribute 164 Max Displacement channel 374 Max Displacement creation option 161, 369 Max Distance attribute 199 Max Distance channel 198 Max Distance creation option 194 Max Expand Pos attribute 136 Max Expand Position channel 135 Max Expand Position creation option 133 Max Influences option 320 Max Influences setting 322 Max Iterations attribute 259, 271, 305 Max Radius attribute 154 Max Radius channel 153 Max Radius creation option 150 Maximum Displacement attribute 160 Maximum Displacement channel 163 Maya API examples IK two bone solver (ik2Bsolver) plug-in 306 meshes 42 Min Damp Range attributes 220 Min Damp Strength attributes 220 Min Radius attribute 154 Min Radius channel 153 Min Radius creation option 150 Min/Max Value setting Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Mirror 227 Mirror Across 226 Mirror Axis option 331 Mirror button 331 Mirror Function 226 Mirror Joint 227 Mirror Joint Options window 227 Mirror Joint selection 226
Mirror Skin Weights selection 331 Mode attribute 164 Mode creation option 88, 161, 370 modeling with deformers 53 models 42, 310 modifiers 42 morph 58 morphing 58 motion capture character sets 471 motion history dependence 397, 420, 429, 439 Motion Multiplier 107 motion path IK spline handle 283 moving start joint off IK spline curve 279
N Name creation option 463 New button 62 New Partition Name creation option 52 No Dynamic option 463 Node State attribute 54, 208, 313 Node State channel 388, 400, 409, 415, 422, 432, 442, 450 nodes 43 nonlinear deformers bend 111 flare 117 sine 125 squash 131 twist 143 wave 149 Normal Constraint Options window 430, 434, 435
INDEX
normal constraints 427 adding target objects 434 changing target object weights 435 controlling motion history dependence effects 436 creating 430 deleting 436 dependency graph nodes 430 editing 432 editing attributes 432 editing channels 432 MEL commands 430 preventing rolling effects 435 removing target objects 435 setting creation options 430 understanding 427 Normal node state option 54, 208, 313 Normal selection 430, 431, 434, 435 Normalize Weights attribute 324 Normalize Weights channel 324 Normalize Weights selection 334 Number of Spans 280, 281 Number of Spans tool setting 280 NURBS control vertices (CVs) 42 NURBS curves 42 NURBS Samples attribute 340 NURBS Samples option 339 NURBS surfaces 42
O offset IK spline handle 277 Offset attribute 130, 154, 282 Offset channel 129, 153, 256, 268, 302 Offset creation option 127, 151 Offset Polarity attribute 388, 451 operation Paint Set Membership Tool 48 Orient Constraint Options window 408, 411
orient constraints 407 adding target objects 411 animating target object weights 412 changing target object weights 411 creating 408 deleting 412 dependency graph nodes 408 editing 409 editing attributes 410 editing channels 409 MEL commands 408 removing target objects 411 setting constraint options 408 understanding 407 Orient selection 408, 409, 411 Origin attribute 63, 102 Origin creation option 60, 63 Over Sample 108 overlapping IK spline handle joints 284
P Paint Cluster Weights Tool 93, 97, 361 settings 96 Paint Jiggle Weights Tool 99 paint operations Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Paint Set Membership Tool 47, 364 operations 48 options, setting 48 painting weights 47 selection 47 Paint Skin Weight Tool settings 96 Paint Skin Weights Tool 327 painting cluster weights 93, 97, 361 jiggle weights 99 set membership 47 skin weights 327 Parallel placement 45 Param attribute 179, 181 Param channel 181 Parent Base Wire selection 177 Parenting creation option 76 Partial Resolution attribute 78, 91, 359
Partition option 355 Partition To Use creation option 52 partitions 46 pelvic region positioning skeleton root in 287 Percent attribute 181 Percent attributes 179 Percent channel 181 Percent Resolution attribute 91, 359 Pick Color Mode hotkey 47, 94, 98, 100, 362 plug-ins IK two bone solver (ik2Bsolver) 306 Po Weight attribute 257, 269, 303 Point Constraint Options window 387, 389, 390 point constraints 385 adding target objects 389 animating target object weights 390 changing target object weights 390 creating 387 deleting 391 dependency graph nodes 386 editing 387 editing attributes 388 editing channels 388 MEL commands 386 offsetting constrained object’s position 390 removing target objects 390 setting constraint options 387 understanding 385 point on curve locator constraints 385, 391 creating 391 editing least squares modifier attributes 392 using 391 Point On Curve selection 391, 392 Point selection 387, 389, 390, 452 point tweaking 49 Point Weight point on curve option 392 pointConstraint attributes 392 points 42 Pole Vector attributes 257, 303 Pole Vector channels 256, 268, 302 Pole Vector Constraint Options window 449, 452
CHARACTER SETUP 481
INDEX
pole vector constraints 447 adding target objects 452 changing target object weights 452 creating 449 deleting 453 dependency graph nodes 449 editing 450 editing attributes 450 editing channels 450 MEL commands 449 offsetting pole vector’s end position 453 removing target objects 452 setting constraint options 449 understanding 447 Pole Vector selection 449, 450, 452 pole vectors 251, 296, 447 Polygon Smoothness option 339 polygonal surfaces 42 polygonal vertices 42 Position the Flexor creation option 369 Positioning creation option 75, 162 Positive to Negative (+Z to -Z) option 331 POWeight tool setting 254, 266, 300 Power Animator IK spline twisting in Maya 281 Power Animator (PA) IK PA solver 235 Preferred Angle attribute 219 Primary Visibility attribute 193 Priority attribute 257, 269, 303 Priority tool setting 254, 266, 300 Project mode 160, 161 pruning skin weights 334
R Radial Branch Amount tool setting 187 Radial Branch Depth tool setting 188 radial wrinkle deformers 186 Randomness tool setting 187 Rate 109 Reassign Bone Lattice Joint selection 374 Reattach Selected Joints selection 368
CHARACTER SETUP 482
Reattach Skeleton selection 368 reference plane indicators 252, 297 reference planes 251, 296 Refresh On options 51 Relative attribute 90, 102, 359 Relative creation option 88 Release refresh option 51 Remove From Character Set selection 465 Remove Influence Object selection 340 Remove Influence selection 200 Remove Joint selection 225 Remove Lattice Tweaks selection 80 Remove option 48 Remove selection 69, 176, 183 Remove Targets button 390, 402, 411, 417, 424, 435, 445, 452 Remove Unused Influences 334 Render Globals option 108 rendering wrap influence objects 193 Replace operation Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Reset All button 62 Reset Lattice selection 80, 81 Reset Lattice Tweaks selection 81 Reset selection 177 Reset Weights to Default selection 332 rigging 30 Rigid Bind selection 355, 356 Rigid Bind Skin Options window 355 rigid bound skins, weight painting 97, 361 rigid skin objects 352 rigid skin point sets 353 organizing before binding 353 rigid skin point weights 352 rigid skin points 352
rigid skinning 351 adjusting skin behavior 356 binding 354 changing bind pose 357 checking binding 356 creating flexors 368 dependency graph nodes 354 detaching 366 detaching selected joints 368 detaching skeleton 367 editing 356 editing bone lattice flexors 372 editing joint cluster attributes 358 editing joint cluster channels 357 editing joint cluster flexors 375 editing joint lattice flexors 370 editing joint or bone sculpt flexors 374 editing rigid skin point set memberships 363 editing rigid skin point weights 359 example 375 going to bind pose 356 MEL commands 354 overcoming bind pose problems 357 painting rigid skin point set memberships 364 reattaching selected joints 368 reattaching skeleton 367 setting rigid bind options 355 understanding 352 using cluster deformers 353 using lattice deformers 353 Ring mode 161 Roll attribute 282 Roll channel 256, 268, 302 rolling IK spline handle 276 rolling effects aim constraints 397 normal constraints 429 tangent constraints 439 root joints 215 Root on Curve 276 Root on Curve attribute 282 Root On Curve tool setting 278 Root Twist Mode 281 Root Twist Mode attribute 282 Root Twist Mode tool setting 281 Rot Limit X attribute 221, 258, 270, 304
INDEX
Rot Limit Y attribute 221, 258, 270, 304 Rot Limit Z attribute 221, 258, 270, 304 Rotate attributes 218, 257, 268, 303 Rotate Axis attribute 219, 257, 268, 303 Rotate creation option 463 Rotate Order attribute 219, 257, 268, 303 Rotate X channel 256, 302 Rotate Y channel 256, 302 Rotate Z channel 256, 302 Rotation attribute 178 Rotation channel 178 rotation discs 249, 294 Rounding channel 371
S S Divisions attribute 80 S Divisions channel 79 S, T, U Divisions creation options 369 Scale attributes 219, 257, 268, 303 Scale channels 178 Scale Compensate tool setting 217 Scale Constraint Options window 414, 417 scale constraints 413 adding target objects 417 animating target object weights 418 changing target object weights 417 creating 414 deleting 418 dependency graph nodes 414 editing 415 editing attributes 416 editing channels 415 MEL commands 414 removing target objects 417 setting constraint options 414 understanding 413 Scale creation option 463 Scale Limit X attribute 221, 258, 270, 304 Scale Limit Y attribute 221, 258, 270, 304 Scale Limit Z attribute 221, 258, 270, 304 Scale menu selection 417
Scale operation Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Scale selection 414, 415, 417 Scale X channel 256, 302 Scale Y channel 256, 302 Scale Z channel 256, 302 scaling weights 96, 101 scenes 43 sculpt deformers 159 creating 161 deleting 165 dependency graph nodes 160 editing attributes 164 editing channels 163 editing deformation effects 162 editing sculpt deformer sets 165 manipulating sculpt sphere 162 manipulating stretch origin locator 163 MEL commands 160 pruning sculpt deformer sets 165 setting creation options 161 understanding 159 Sculpt Options window 161 Sculpt selection 165 sculpt sphere 159 seals animating with IK spline 286 Segment Scale Compensate attribute 220 Select button 62 Select Character Set Node selection 464 Select Cluster Mode hotkey 97 Select Set To Modify box 48 selecting IK spline handle 276 Set Driven Key selection 54 Set IK/FK Key 239 Graph Editor display 242 Set Max Influences selection 322 Set Max Influences window 322 set membership painting 47 painting operations 48 Set Preferred Angles selection 228 Set To Modify box 48 setting keys 275 shape interp 58
Shear attributes 257, 268, 303 Shear XY channel 53 Shear XZ channel 53 Shear YZ channel 53 shearing effects 53 sine deformers 125 creating 126 deleting 130 dependency graph nodes 125 editing attributes 129 editing channels 129 editing deformation effects 127 manipulating handles 128 MEL commands 125 setting creation options 126 understanding 125 Sine selection 126, 127 sinuous motion IK spline handle 286 Skeleton menu 35 Skeleton menu selections Assume Preferred Angles 229 Connect Joint 225 Disconnect Joint 225 IK Handle Tool 253, 254, 265, 266, 299, 300 IK Spline Handle Tool 278 Insert Joint Tool 224 Joint Tool 216, 218 Mirror Joint 226 Remove Joint 225 Reroot skeleton 227 Set Preferred Angles 228
CHARACTER SETUP 483
INDEX
skeletons 35, 207 building 211 connecting joints to combine two skeletons 225 disconnecting joints to create new skeletons 225 displaying all local axes in a limb or skeleton 223 editing 223 editing node behavior 208 inserting a joint 224 MEL commands 215 mirroring 226 mirroring limbs or skeletons 226 navigating hierarchy 223 posing 231 posing with forward kinematics (FK) 236 posing with inverse kinematics (IK) 236 removing a joint 224 reorienting all local axes in limb or skeleton 223 rerooting 227 selecting joints and navigating hierarchy 223 setting and assuming preferred angles 228 setting display size of all joints 227 understanding 207 understanding construction 212 using IK rotate plane handles 245 using IK single chain handles 261 using IK two bone handles 289 viewing hierarchy 223 viewing skeleton hierarchy 223 skin 316, 352 skin cluster nodes 319 Skin menu 36
CHARACTER SETUP 484
Skin menu selections Bind Skin Rigid Bind 355, 356 Smooth Bind 319, 320 Detach Skin 337, 366, 367 Edit Rigid Skin Copy Flexor 372 Create Flexor 369 Detach Selected Joints 368 Detach Skeleton 367 Preserve Skin Groups 367, 368 Reassign Bone Lattice Joint 374 Reattach Selected Joints 368 Reattach Skeleton 368 Edit Smooth Skin Add Influence Object 339, 340 Remove Influence Object 340 Reset Weights to Default 332 Set Max Influences 322 Go to Bind Pose 322, 357 skin objects 309, 316, 352 skin points 316, 352 skin weights masking 328 paint operations 96 painting 327 pruning 334 skinning 36, 309 changing deformation order 311 editing node behavior 313 point tweaking 312 rigid 351 smooth 315 understanding 309 slider orientation Blend Shape editor 62 sliding joint chain along curve 276 Smooth Bind selection 319, 320 Smooth Bind Skin Options window 319 Smooth operation Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 smooth skin influence objects 318 smooth skin objects 316 smooth skin point sets 318
smooth skin point weights 316 smooth skin points 316 smooth skinning 315 adding influence objects 339 adjusting skin behavior 321 binding 319 changing bind pose 322 checking binding 321 controlling weight normalization 333 dependency graph nodes 319 detaching 337 editing 321 editing joint attributes 322 editing maximum influences 322 editing NURBS influence object attributes 340 editing polygonal influence object attributes 341 editing skin cluster attributes 324 editing skin cluster channels 323 editing skin point weights 325 examples 341 exporting/importing weight maps 334 going to bind pose 321 holding weights 332 MEL commands 319 mirroring weights 331 overcoming bind pose problems 322 pruning skin weights 334 removing influence objects 340 removing unused influences 334 resetting skin point weights to defaults 332 setting bind options 319 understanding 316 using influence objects 338 smoothing weights 96, 101 Smoothness attribute 341 Smoothness channel 197 snakes animating with IK spline 284, 286 Snap Curve To Root 280 Snap Curve To Root tool setting 280 Snap Enable attribute 257, 269, 303 Snap Enable tool setting 253, 266, 299
INDEX
Solver Enable attribute 257, 269, 303 IK spline handle 281 Solver Enable channel 256, 268, 302 Solver Enable tool setting 253, 266, 299 source code IK two bone solver 306 space warp 42 Specify Node add option 67 Specify Node remote option 69 Specify Node swap option 70 Split placement 45 squash deformers 131 creating 132 deleting 136 dependency graph nodes 131 editing attributes 135 editing channels 135 editing deformation effects 133 examples 137 manipulating handles 134 MEL commands 131 setting creation options 132 understanding 131 Squash selection 132, 133 Start Angle attribute 147 Start Angle channel 147 Start Angle creation option 144 Start Flare X attribute 122 Start Flare X channel 121 Start Flare X creation option 119 Start Flare Z attribute 122 Start Flare Z channel 121 Start Flare Z creation option 119 Start Joint attribute 257, 269, 303 start joint flipping in motion path 283 preventing IK spline 282 start joints 246, 262, 292 Start Smoothness attribute 136 Start Smoothness channel 135 Start Smoothness creation option 132 Start Time/End Time 108 Stickiness attribute 257, 269, 303 Sticky tool setting 253, 266, 300 Stiffness 106 Stiffness attribute 219 Stretch mode 160, 161 stretch origin locator 160
subdivision surfaces 42 Swap selection 70
T T Divisions attribute 80 T Divisions channel 79 Tangent Constraint Options window 440, 444, 445 tangent constraints 437 adding target objects 444 changing target object weights 445 controlling motion history dependence effects 446 creating 440 deleting 446 dependency graph nodes 440 editing 442 editing attributes 442 editing channels 442 MEL commands 440 preventing rolling effects 445 removing target objects 445 setting constraint options 440 understanding 437 Tangent selection 440, 441, 444, 445 tangential wrinkle deformers 186 target attributes 64 target channels 63 Target Index add option 68 Target names 62 target object weights 386, 396, 408, 414, 420, 428, 438, 448 target objects 385, 395, 407, 413, 419, 448 target orientation 407 target points 386, 395, 420, 448 target scale 414 Target Shape Options add options 68 Target Shape Options creation options 60 target vector 428, 438 Target weight boxes 62 Target weight sliders 62 targetOrigin attribute 63 Tension attribute 179 Tension channel 177 Thickness tool setting 187 Time Slider option 108
tips IK spline handle creation 284 Tolerance attribute 259, 271, 305 tool options IK spline handle 278 Tool Settings window IK Handle Tool 253, 265, 299 Joint Tool 216 Wire Tool 172 Wrinkle Tool 187 Trans Limit X attribute 221, 258, 270, 304 Trans Limit Y attribute 221, 258, 270, 304 Trans Limit Z attribute 221, 258, 270, 304 Transfer option 48 Transform box 328 transforming IK spline handle curve 278 Translate attributes 218, 256, 268, 302 Translate creation option 463 Translate X channel 256, 302 Translate Y channel 256, 302 Translate Z channel 256, 302 Tricep channel 373 tweak nodes 49 tweaking deformers 49 Twist attribute IK rotate plane handles 258 IK spline handles 282 IK two bone handles 304 Twist attributes for wire dropoff locators 179 Twist channel 256, 268, 302 twist deformers 143 creating 144 deleting 148 dependency graph nodes 143 editing attributes 147 editing channels 146 editing deformation effects 145 manipulating handles 145 MEL commands 143 setting creation options 144 understanding 143 twist discs 250, 296 twist indicators 252, 297 Twist selection 144, 145 Twist Type 281 Twist Type attribute 282
CHARACTER SETUP 485
INDEX
Twist Type tool setting 281 twisting IK spline handle 276 Type tool setting 187
U U attribute 392 U Divisions attribute 80 U Divisions channel 79 Under Sample 108 universal joints 214 Up Vector attribute 400, 433, 443 Up Vector constraint option 398, 431, 441 up vectors 396, 428, 438 Update Weights attribute 323, 340, 341 Upper Bound attribute 358 Upper Bound channel 358 Upper Dropoff Type attribute 359 Upper Dropoff Type channel 358 Upper Value attribute 358 Upper Value channel 358 upstream nodes 43 Use Component Matrix attribute 324 Use Components attribute 324 Use Components channel 323
V value range Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Paint Skin Weights Tool 96 Value Setting Paint Skin Weights Tool 96 Value setting Paint Cluster Weights Tool 96 Paint Jiggle Weights Tool 101 Vector Index setting Paint Cluster Weights Tool 97 Paint Jiggle Weights Tool 102 Paint Skin Weights Tool 97 Vertical slider option 62 Visibility channel 256, 302 Visibility creation option 463
CHARACTER SETUP 486
W Waiting-Blocking node state option 55, 208, 314 Waiting-HasNoEffect node state option 55, 208, 314 Waiting-Normal node state option 55, 208, 314 wave deformers 149 creating 150 deleting 154 dependency graph nodes 149 editing attributes 153 editing channels 152 editing deformation effects 151 manipulating handles 151 MEL commands 149 setting creation options 150 understanding 149 Wave selection 150, 151 Wavelength attribute 130, 154 Wavelength channel 129, 153 Wavelength creation option 127, 150 Weight 106 weight (W) of target object attribute 444, 451 weight (W) of target object channel 442, 450 Weight attribute 257, 269, 303, 393 Weight channels 53 Weight constraint option 387, 398, 409, 415, 421, 431, 441, 449 Weight Holding option 339 weight maps exporting/importing smooth skin 334 weight painting clusters 93 jiggle 99 rigid bound skins 97, 361 smooth bound skins 327 Weight Threshold attribute 198, 199 Weight Threshold channel 198 Weight Threshold creation option 194 Weight tool setting 254, 266, 300
weight values adding 96, 101 flooding 95, 100 replacing 96, 101 scaling 96, 101 selecting 94, 98, 100, 362 smoothing 96, 101 weighted average vector 428, 438 Weighted Node attribute 102 Width Left channel 371, 373 Width Right channel 371, 373 wire deformers 167 adding and removing holders 182 adding influence wires 176 creating 171 creating wires groups 177 creating with holders 174 creating without holders 173 deleting 183 dependency graph nodes 171 editing attributes 178 editing channels 177 editing deformation effects 175 editing effects of crossed influence wires 176 editing shape of influence wires 175 editing wire deformer sets 183 limiting wire deformation region 182 MEL commands 171 moving, rotating, and scaling deformable objects 175 pruning wire deformer sets 183 removing influence wires 176 resetting influence wires 177 smoothing jagged effects 182 specifying tool settings 172 understanding 170 using wire dropoff locators 180 Wire Dropoff Locator selection 180 Wire Locator Twist channels 178 Wire selection 183 Wire Tool selection 172, 173, 174 World creation option 60 World Up Type attribute 400, 433, 443 World Up Vector attribute 400, 433, 443 World Up Vector constraint option 399, 431, 441 world up vectors 397, 429, 439
INDEX
wrap deformers 191 adding and removing wrap influence objects 200 creating 192 creating objects to use as wrap influence objects 193 deleting 200 dependency graph nodes 192 editing attributes 199 editing channels 197 editing deformation effects 195 editing NURBS wrap influence object channels 196 editing polygonal wrap influence object channels 197 examples 201 improving performance 200 manipulating wrap influence object points 196 moving, rotating, or scaling deformed object 196 moving, rotating, or scaling wrap influence objects 195 setting creation options 193 skinning 201 understanding 191 wrap influence objects 192 rendering 193 Wrap Samples channel 197 wrinkle deformers 185 creating 187 deleting 189 dependency graph nodes 186 editing cluster deformer 189 editing deformation effects 188 editing wire deformers 189 manipulating cluster deformer handle 188 MEL commands 186 moving, rotating, and scaling influence wires 189 specifying tool settings 187 understanding 185 Wrinkle Tool selection 187, 188
Z zero rotation IK spline joint orientation 282
X XY option 331 XZ option 331
Y YZ option 331
CHARACTER SETUP 487
Constraints & Motion Capture
Constraints & Motion Capture 23 Basic Constraints
5
Understanding basic constraints Objects and targets
5
6
Why use constraints?
6
Working with constraints
7
Creating or adding targets to a constraint Removing constraint targets
8
Adjusting the target weights
8
Constraining an object’s position
7
11
Constraining an object to a point
11
Constraining an object to a surface
12
Constraining a pole vector of an IK handle Constraining an object’s orientation
13
14
Matching an object’s orientation to another object Constraining an object’s aim
15
Constraining an object to the normal of a surface Constraining an object to a tangent Controlling “up”
16
17
18
Constraining an object’s scale
19
Constraining an object’s scaling values
24 Motion Capture
19
21
Getting started with motion capture
21
Basic procedure for simple motion capture Terminology
14
21
22
Using the Device Editor
23
Learning about motion capture
24
Using Maya: Dynamics 3
Dynamics Contents Defining motion capture devices
25
Listing devices and attachments
26
Attaching attributes and commands Attaching attributes
27
Attaching commands
28
Modifying existing attachments Mapping device data
31
33
Rehearsing the motion
33
Recording the motion
33
Reviewing the motion
34
Saving files to disk
36
Using filters and resamplers Reviewing takes
39
40
Using multiple devices
41
Performing full-body motion capture Tips for full-body motion capture
4
Using Maya: Dynamics
29
30
Saving attachments Capturing motion
27
42 42
23
Basic Constraints Using basic constraints, you can control the position, orientation, or scale of one object based on the position, orientation, or scale of one or more “target” objects. In addition, you can impose specific limits on objects and automate animation processes. For example, if you want to quickly animate a sled sliding down a bumpy hill, you might first use a Geometry Constraint to constrain the sled to the surface. You could then use a Normal Constraint to make the sled sit flat on the surface. After you create these constraints, you key the sled’s positions at the top and bottom of the hill. The animation is then complete. This chapter describes how to use these constraints, including:
•
“Understanding basic constraints” on page 5
•
“Working with constraints” on page 7
•
“Constraining an object’s position” on page 11
•
“Constraining an object’s orientation” on page 14
•
“Constraining an object’s scale” on page 19
Understanding basic constraints You can constrain an object’s position, orientation, or scale to a target(s). There are eight basic constraints:
Position Point Constraint
•
Geometry Constraint
•
Pole Vector Constraint
Cons tra ints & Motion Ca pture
•
Orientation •
Orient Constraint
•
Aim Constraint
Using Maya: Animation
5
Basic Constraints Understanding basic constraints •
Normal Constraint
•
Tangent Constraint
Scale •
Scale Constraint
Objects and targets When describing constraints, we use the terms object and target, where: •
Object is the name of the transform you constrain.
•
Target is the name of the DAG node(s) to which the object is constrained.
Tip When working with constraints, always select the object last. In other words, to add, change, or remove targets, select the target, then select the constrained object.
Why use constraints? If two objects share a common DAG parent, you can use an expression or a connection to copy a set of translation, rotation, or scale values from one object to another. However, if the two objects have different parent transforms, this procedure may produce wildly different motions, as in the following example.
Example: Why constraints are useful 1
Create three objects: a sphere named s and two cones named c1 and c2.
2
Parent c1 to s.
3
Connect the translation value of c2.t to c1.t.
4
Select c2 and drag it using the Move Tool. The two cones should appear as one.
5
Rotate s by 90 degrees (on any axis).
6
Select c2 and drag it using the Move Tool. Notice that the two cones are no longer coincident.
6
Using Maya: Animation
Basic Constraints Working with constraints Since c1 and c2 are no longer parented to the same transform, this simple scheme cannot work. However, by placing a Point Constraint on c1 and selecting c2 as the target, you could then move c2 and c1 would follow regardless of the objects’ parent transforms.
Working with constraints You create all constraints in the same way, whether you are using them to control position, orientation, or scale.
The constraint work flow consists of these basic tasks: •
Creating or adding targets to a constraint
•
Removing constraint targets
•
Adjusting the target weights
Creating or adding targets to a constraint To create a constraint or add targets to an existing constraint, you first select the targets, then the constrained object, and finally the constraint type.
To create or add targets to a constraint: 1
Select the target object or objects (shift-click to select more than one target).
2
Select the object you want to constrain.
3
Select Animation→Constraint to select the constraint type. After you select a constraint type, the constrained object moves to its new constrained position or orientation. If multiple targets are used, their combined effect, in general, is the weighted average of each of their individual effects. Cons tra ints & Motion Ca pture
Tip If you cannot add a constraint by selecting the constraint type, check the option box (❐) for that constraint to be sure the Add Targets option is selected. If the specified constraint type does not already exist for the selected object, Maya creates one. If the object already has a constraint of the type specified, Maya adds the targets to it and applies the current option box settings.
Using Maya: Animation
7
Basic Constraints Working with constraints The Reset button sets the constraint operation to Add targets. However, since all option box settings are applied each time you add a target, you probably don’t want to select this unless you are creating a new constraint.
Removing constraint targets Once added, a constraint target influences the constrained object. You can end this influence by removing the target from the constraint.
To remove targets from a constraint: 1
Select the first constraint target you want to remove.
2
Shift-click to select any additional targets you want to remove.
3
Select the constrained object.
4
Use the Constraint pull-down menu to open the option box (❐) for the constraint type you want to remove targets from.
5
Select Remove Targets in the option box.
6
Click Add/Remove at the bottom of the option box.
7
Reset the option box by selecting Add Targets.
8
Click the Close button. The constrained object updates its position to reflect the target removal(s). When you remove the last constraint target, you also remove the constraint.
Note When you remove a target, it also removes any animation curves attached to the constraint for that target.
Adjusting the target weights For a constraint with multiple targets, you can control the influence of individual targets by adjusting their target weights.
To set a target weight using the Channel Box: 1
Select the constrained object. The constraint is listed in the Shapes section of the Channel Box. The target weights are listed next to the target names, as shown in the following figure.
8
Using Maya: Animation
Basic Constraints Working with constraints
The constraint is listed here. The target weights are listed here.
2
Enter values for the target weights. You can also set keys by clicking on a Target Weight box with the right mouse button.
To set a target weight using the Attribute Editor: Select the constrained object.
2
Open the Attribute Editor, Window→Attribute Editor.
3
Select the tab for the constraint.
4
Open the Extra Attributes section. The target weights are listed next to the target name, as shown in the following figure.
Using Maya: Animation
Cons tra ints & Motion Ca pture
1
9
Basic Constraints Working with constraints
The target weights are listed here.
10
Using Maya: Animation
Basic Constraints Constraining an object’s position 5
Enter values for the target weights. You can also set keys by clicking on a Target Weight box with the right mouse button.
Note Setting all target weights to 0 does not remove the constraint, but causes it to “freeze” the object.
Tip You can often get useful results using expressions to drive multiple target weights based on the value of a single dynamic attribute. For example, you could constrain an object to move from target to target by setting one weight to a value on the range (0 to 1) and setting the other to 1 minus that value.
Constraining an object’s position This section describes the various ways you can constrain an object’s position, including: •
Constraining an object to a point—the Point Constraint
•
Constraining an object to a surface—the Geometry Constraint
•
Constraining a pole vector of an IK handle—the Pole Vector Constraint
Constraining an object to a point
The object’s orientation is not affected.
To constrain an object’s position based on the target’s position: 1
Select the target object or objects. (Shift-click to select more than one target.)
2
Select the object you want to constrain.
3
From the Animation menu bar or Hotbox, select Constraint→Point. Using Maya: Animation
11
Cons tra ints & Motion Ca pture
A Point Constraint causes an object to move to and follow the position of a target object or to the average position of several target objects. This constraint is useful for having one object match the motion of another without regard for its parent transform or orientation. You can also use this constraint to animate one object to follow a series of targets by animating the constraint weight.
Basic Constraints Constraining an object’s position If you select only one object as the target, the rotate pivot point of the constrained object moves to the rotate pivot point of the target. If you select several target objects, the constrained object moves to the average of the target objects’ pivots (see “Adjusting the target weights” on page 8). Once you constrain an object, moving the target object also moves the constrained object in the same way.
Constraining an object to a surface The Geometry Constraint restricts a constrained object to a surface, curve, or mesh. Specifically, the object’s rotate pivot point is constrained to the target surface. Geometry Constraint targets can be NURBS surfaces, NURBS curves, or polygon surfaces. It is similar to creating a motion path for an object, except that the object can move freely over the surface of the target geometry. This constraint is useful for constraining an object’s location to a surface such as a floor or staircase. The constrained object’s orientation is not affected.
Tip Unlike the Point Constraint, you can set keys for the position of the geometry-constrained object (or apply a Point Constraint to it also). The object’s geometry-constrained position will be the point on the target surface, closest to the keyed (or point-constrained) position.
To constrain an object to a surface: 1
Select the target surface, curve, or mesh. (Shift-click to select more than one target.)
2
Select the object you want to constrain.
3
From the Animation menu bar or Hotbox, select Constraint→Geometry. When you move the constrained object, it is constrained to the target surface. If you move the target surface, the constrained object will follow and move to the point on the target surface closest to the object’s previous position.
12
Using Maya: Animation
Basic Constraints Constraining an object’s position If you add more than one target, the object is constrained to the target surface that has the highest weight. (See “Adjusting the target weights” on page 8.)
Notes If all the targets have the same weight, as happens when you create a Geometry Constraint, the target used is the one with the lowest index. The target index indicates the order in which you selected the targets during the constraint creation (the first target selected has the lowest index). You should animate the target weights such that only one target has the highest weight at any given frame. The Geometry Constraint is history dependent. The end result of an object’s animation depends on where the object started.
Constraining a pole vector of an IK handle The Pole Vector constraint applies only to IK handles that use the rotate plane IK solver (see “Creating IK handles” on page 238 of Chapter 12, “Posing and Animating Skeletons”). The effect is similar to the Constraining an object to a point above, except this constraint controls the location of the Pole Vector end-point. You can use constraints with inverse kinematics to create realistic character movements simply. For example, say you want to animate an inverse kinematic character riding a bicycle. You can key the rotation of pedals on the bicycle, then constrain the effector of the character’s leg skeleton to the pedal. Now the leg of your character follows the keyed rotation of the pedals, creating the illusion that the character is pedaling the bicycle. For more information on inverse kinematics, refer to the Character Animation section of this book.
To create (or add targets to) a Pole Vector Constraint: Select the first constraint target.
2
Shift-click to select any additional targets.
3
Select the handle for the pole vector you want to constrain.
4
From the Animation menu bar or Hotbox, select Constraint→Pole Vector.
Using Maya: Animation
Cons tra ints & Motion Ca pture
1
13
Basic Constraints Constraining an object’s orientation The IK chain rotates so that the Pole Vector lies at the target pivot. If you add multiple targets, the Pole Vector is placed at the weighted average of the target positions. For example, if you select two targets with the same weight, the IK chain rotates so that the Pole Vector is halfway between them.
Tip Remember, you can produce useful results by combining multiple target weights with an expression.
Constraining an object’s orientation This section describes the various ways you can constrain an object’s orientation, including: •
Matching an object’s orientation to another object—the Orient Constraint
•
Constraining an object’s aim—the Aim Constraint
•
Constraining an object to the normal of a surface—the Normal Constraint
•
Constraining an object to a tangent—the Tangent Constraint Only one of these constraints can be present on a given object, as each connects to the x, y, and z rotation attributes of the object. Aim, Normal, and Tangent Constraints have the same Aim and Up parameter options.
Matching an object’s orientation to another object The Orient Constraint matches the orientation of one object to that of a target object(s) without changing the constrained object’s location. This constraint is useful to make several objects orient in sync. For example, you can make a group of people look in the same direction at the same time by animating one head and then constraining the orientation of all the others to this head. If you select several target objects, the constrained object’s orientation is an average of their orientations.
To constrain the orientation of one object to another:
14
1
Select a target object or objects. (Shift-click to select more than one target.)
2
Select the object you want to constrain.
3
From the Animation menu bar or Hotbox, select Constraint→Orient.
Using Maya: Animation
Basic Constraints Constraining an object’s orientation If you have only one target object, the constrained object changes to the target’s orientation. If you have several targets, the constrained object changes to the targets’ average orientation (see “Adjusting the target weights” on page 8). When you rotate the target object(s), the constrained object also rotates.
Constraining an object’s aim Note The effect of multiple targets for orient constraints can be non-intuitive and is not recommended for targets that differ greatly in orientation. The Aim Constraint aligns the aim vector of one object to follow the movement of a target object or objects. The Aim Constraint is useful for lights and cameras; you can aim a light at an object or a group of objects, for example, to follow their animation.
To create (or add targets to) an Aim Constraint: 1
Select a target object or objects. (Shift-click to select more than one target.)
2
Select the object you want to constrain.
3
From the Animation menu bar or Hotbox, select Constraint→Aim→❐ to display the Aim Options window.
4
Click Add/Remove. When you move the target object, the aim vector of the constrained object (the X-axis is the default) repositions itself to aim at the target.
5
Change the vectors if you want to aim the selected axis of the constrained object. You can aim the constrained object by changing one of these vectors: Sets the aim vector—the vector in local coordinates that orients to the target. The default is the X-axis: 1.0, 0.0, 0.0.
Up Vector
Sets the local up vector—the vector in local coordinates that aligns with the world up vector. You can use the Up Vector option to control the roll of the constrained object as it moves across the up axis. The default is Y-up: 0.0, 1.0, 0.0.
Using Maya: Animation
15
Cons tra ints & Motion Ca pture
Aim Vector
Basic Constraints Constraining an object’s orientation World Up Vector Sets the world up vector—the vector in world coordinates
that the local up vector should align with. The default is yup: 0.0, 1.0, 0.0. 6
Click Close.
Constraining an object to the normal of a surface The Normal Constraint limits the orientation of an object to the normal of the constraining surface or mesh on which it travels. This constraint is useful for keeping an object perpendicular to a surface, usually when the surface is deformed, such as a ship sailing over a section of choppy water.
To constrain an object’s orientation to the normal of the surface: 1
Select the target surface or mesh.
2
Select the object you want to constrain.
3
From the Animation menu bar or Hotbox, select Constraint→Normal→❐ to display the Normal Options window.
4
Click Add/Remove. As you move the constrained object along the surface, the aim vector reorients itself to the normal of the surface.
5
Change the vectors if you want to aim the selected axes of the constrained object. You can align the axes of the constrained object to the normal using the following options: Aim Vector
Sets the aim vector—the vector in local coordinates that orients to the normal. The default is the X-axis: 1.0, 0.0, 0.0.
Up Vector
Sets the local up vector—the vector in local coordinates that aligns with the world up vector. You can use the Up Vector option to control the roll of the constrained object as it moves across the up axis. The default is Y-up: 0.0, 1.0, 0.0.
World Up Vector Sets the world up vector—the vector in world coordinates
that the local up vector should align with. The default is Yup: 0.0, 1.0, 0.0. 6
16
Click Close.
Using Maya: Animation
Basic Constraints Constraining an object’s orientation
Constraining an object to a tangent The Tangent Constraint limits the orientation of an object to the tangent of the constraining curve (path) on which it travels. This constraint is useful for having an object follow a path’s direction, such as a roller coaster car following the tracks.
To constrain an object’s orientation to the tangent of a curve: 1
Select the target curve.
2
Select the object you want to constrain.
3
From the Animation menu bar or Hotbox, select Constraint→Tangent→❐.
4
Click Add/Remove. As you move the constrained object along the surface, the aim vector reorients itself to the tangent of the curve’s surface.
5
Change the vectors if you want to aim the selected axes of the constrained object. You can align the axes of the constrained object to the tangent using the following options: Aim Vector
Sets the aim vector—the vector in local coordinates that orients to the tangent. The default is the X-axis: 1.0, 0.0, 0.0.
Up Vector
Set the local up vector—the vector in local coordinates that aligns with the world up vector. You can use the Up Vector option to control the roll of the constrained object as it moves across the up axis. The default is Y-up: 0.0, 1.0, 0.0.
World Up Vector Sets the world up vector—the vector in world coordinates
that the local up vector should align with. The default is Yup: 0.0, 1.0, 0.0. 6
Click Close. Cons tra ints & Motion Ca pture
Using Maya: Animation
17
Basic Constraints Constraining an object’s orientation
Controlling “up” Depending on the type of scene you are creating, you may want more control of the object’s orientation. For example, if you were animating a roller-coaster car along a curved and looped track, it would be useful to control the car’s Y-axis orientation (Up Vector) along each keyframe. There are several attributes that control an object’s orientation, including: •
Aim Vector
•
Up Vector
•
World Up Type
•
World Up Vector
•
World Up Object The Aim Vector, Up Vector, World Up Vector, and World Up Type attributes behave identically for the Aim, Tangent, and Normal Constraints.
Aim Vector This vector in local coordinates of the constrained object points at the target (for Aim Constraint), aligns with the normal (for Normal Constraint) or the curve tangent (for Tangent Constraint). The default value is (1.0, 0.0, 0.0).
Up Vector This is the vector in local coordinates of the constrained object that is aligned based on the World Up Type. The default value is (0.0, 1.0, 0.0).
World Up Type This parameter (available only through the command line and Attribute Editor) controls how the Up Vector is aligned. The World Up Type can have one of five values:
18
•
Scene—the Up Vector is aligned with the up-axis of the scene and the World Up Vector and World Up Object attributes are ignored.
•
Object—the Up Vector is aimed as closely as possible to the origin of the space of the World Up Object and the World Up Vector attribute is ignored.
•
Object Rotation—the World Up Vector is interpreted as being in the coordinate space of the World Up Object, transformed into world space, and the Up Vector is aligned as closely as possible to the result.
Using Maya: Animation
Basic Constraints Constraining an object’s scale •
Vector—the Up Vector is aligned with the World Up Vector as closely as possible.
•
None—no calculation is performed by the constraint, with the resulting Up Vector orientation based on the previous orientation of the constrained object.
Notes If you set the World Up Type to None, the Aim, Tangent, and Normal constraints are history dependent. The end result of an object animation depends on where the object started. If you set the Aim and Up Vectors to be collinear, Maya will interpret the World Up Type as None. The default World Up Type is “vector”.
World Up Vector This is the vector in world coordinates (if World Up Type is vector) or in the local space of the World Up Object (if World Up Type is object rotation) that the up vector should align with. The default value is (0.0, 1.0, 0.0)
World Up Object The World Up Object is the DAG object used for World Up Type “object” and “objectrotation”. The default value is no up object, which is interpreted as world space.
Constraining an object’s scale This section describes how you can constrain an object’s scale.
Constraining an object’s scaling values
To constrain an object’s scale: 1
Select the target object.
2
Select the object you want to constrain. Using Maya: Animation
19
Cons tra ints & Motion Ca pture
The Scale Constraint limits the scaling values of an object to the scaling values of the target object. This constraint is useful for scaling all objects in a hierarchy at once in accordance to the scaling changes applied to one object.
Basic Constraints Constraining an object’s scale 3
From the Animation menu bar or hotbox, select Constraint→Scale. When you scale the target object, you will also scale the constrained object with the same scaling values.
20
Using Maya: Animation
24
Motion Capture With motion capture, you record real physical motion using a motion capture device. You can use this real-life data to animate characters or objects in a scene. Motion capture lets you generate large amounts of complex motion. You must plan your motion capture animations meticulously and set them up carefully. This chapter describes how to set up and perform motion capture in Maya. It includes the following information:
•
“Getting started with motion capture” on page 21
•
“Defining motion capture devices” on page 25
•
“Listing devices and attachments” on page 26
•
“Attaching attributes and commands” on page 27
•
“Capturing motion” on page 33
•
“Using filters and resamplers” on page 39
•
“Reviewing takes” on page 40
•
“Using multiple devices” on page 41
•
“Performing full-body motion capture” on page 42
Getting started with motion capture This section provides background information on motion capture for the first-time user. Cons tra ints & Motion Ca pture
Basic procedure for simple motion capture The workflow for a simple motion capture sequence consists of a few basic steps.
To create a simple motion capture sequence: 1
Create a target geometry in Maya. Using Maya: Animation
21
Motion Capture Getting started with motion capture 2
Attach the geometry to the motion capture device.
3
Rehearse the motion for the actions that will be performed.
4
Record the motion.
5
Review the recorded motion and insert it into your scene. It takes a few additional steps to create a full-body motion capture sequence. For details, see “Performing full-body motion capture” on page 42.
Terminology Before using motion capture, you should become familiar with a few simple terms. Motion capture device
To capture motion, you use a motion capture device. The motion capture device samples motion and records it. With a motion capture device, you can achieve real-time monitoring and recording of data. Supported data-server devices in Maya will have servers provided by the device vendors. You can write your own servers for custom devices with the Maya Motion Capture Developer’s Tool Kit. In general, the mouse and keyboard are not motion capture devices.
Server
A server is a stand-alone program that communicates with a device. Maya can talk to the server to get device data. Devices that require servers are called data-server devices.
Axis
A motion capture device provides information on different axes, arranged in a hierarchy. Axes give important information such as if the data is a rotation value, a translation value, or just a number. An axis can be connected (or attached) to an attribute in a Maya scene.
Attachment
The connection between a device axis and an object’s attribute is called an attachment. The attachment “tells” the device what attribute in the scene you want to change.
Button
Some motion capture devices have buttons. A button can execute a command or act as a clutch for an axis. However, button presses cannot be recorded as motion capture data.
22
Using Maya: Animation
Motion Capture Getting started with motion capture
Using the Device Editor You use Maya’s Device Editor to control the motion capture process. To display the Device Editor, select Window → AnimationEditors → Device Editor.
Device Outliner
Device Editor tabs
The top section is the Device Outliner. The Device Outliner lists the defined devices, the device structures, and what the devices are attached to. For information on how to use the Device Outliner, see “Defining motion capture devices” on page 25.
Tab sections
The lower section provides several tabs that allow you to work with devices and manage motion capture data. •
The Attachment tab provides settings for making attachments, as described in “Attaching attributes and commands” on page 27.
Using Maya: Animation
23
Cons tra ints & Motion Ca pture
Device Outliner
Motion Capture Getting started with motion capture •
The Mapping tab provides settings for modifying attribute attachments, as described in “Changing the attachment and device mappings” on page 36.
•
The Filters tab lets you define filters and resamplers that you can use when previewing motion data or converting it to animation curves. For details, see “Using filters and resamplers” on page 39.
•
The Options tab includes miscellaneous options for writing and reading takes, as described in “Numbering takes” on page 37, “Reviewing takes” on page 40, and “Using multiple devices” on page 41.
•
The Controls tab provides the settings for rehearsing, recording, and reviewing your motion capture sequences. These procedures are described in “Capturing motion” on page 33.
Learning about motion capture To help you learn about motion capture, we’ve provided a “toy” motion capture server, the mayaClockServer program. This simple program reads the SGI system clock and outputs three rotation values, in radians: the angle of the second hand, the angle of the minute hand, and the angle of the hour hand. It does not require any special hardware. The binary is located in the /usr/aw/maya/bin directory and is called mayaClockServer. To view mayaClockServer options, enter: /usr/aw/maya/bin/mayaClockServer -h
We’ve also included an example script for using mayaClockServer. To see a demo of the clock, enter the following in the Script Editor: mayaClockDemo
The script launches mayaClockServer using the MEL system command, defines a device named “clock,” creates three analog clock hands, and connects the geometry to the clock.
Note If you’ve already defined the clock device, un-define it and flush the undo queue before running the demo script.
24
Using Maya: Animation
Motion Capture Defining motion capture devices
Defining motion capture devices Most motion capture devices are data-server devices. To use a data-server device, you need a server. For more information on using the server for a specific device, see the documentation provided by the device vendor. Some devices do not need servers. These devices are installed via the IRIX desktop. If such a device is visible to the IRIX desktop and supported by Maya, it will be listed in the Device Outliner when you start Maya. For data-server devices, use the defineDataServer command to define the device in Maya. To do this, enter the following command in Maya’s Script Editor after you start the device server: defineDataServer -device -server ;
where: •
is a unique device name. Choose one that will be easy for you to remember later.
•
is the name of the communication interface defined to talk to the server, as defined in the server setup. For example, if you started the clock device but it did not appear in the Device Editor, you would enter: defineDataServer -device clock -s mayaClockServer
To undefine a device, use this syntax. defineDataServer -device -undefine;
An important interaction exists between defining and un-defining data servers and the undo queue.
Using Maya: Animation
25
Cons tra ints & Motion Ca pture
When you undo a defineDataServer command, the connection with the dataserver device does not break until the defineDataServer command is off the undo queue. When you undo an undefine of a data server, the connection with the server does not break until the command is off the undo queue. The easiest way to remove the command from the undo queue is to use the flushUndo MEL command.
Motion Capture Listing devices and attachments
Listing devices and attachments The Device Outliner lists the devices and their attachments. Click to expand/ collapse Device Axis
This is the only way to see how devices are attached to their target attributes. Since devices are not normal Maya dependency graph nodes, they do not appear in the regular Outliner or in the Hypergraph.
Expanding device listings The devices and their attachments appear in the following order: •
The left-most items in the Device Outliner are the devices.
•
The next level shows the axes, indented to indicate their positions in the device hierarchy.
•
The final level shows the attachments between the device and an attribute.
To expand or collapse an item: Click the arrow to the left of the item.
To expand or collapse all of the item’s children: Shift-click the arrow to the left of the item.
Example: Listing the mayaClock device If you ran the mayaClockDemo MEL script, the clock name (clock) should be listed in the left column in the Device Outliner. (If it is not, follow the directions in “Defining motion capture devices” on page 25.) To show all of the device’s children, shift-click the arrow to the left of the clock name. The first level of children in the clock are the three axes: hours, minutes, and seconds.
26
Using Maya: Animation
Motion Capture Attaching attributes and commands For complex devices, an indented list of axes is displayed, each with its own children. Eventually a device listing ends with attribute attachments. The attachments describe how the device is connected to Maya attributes.
Attaching attributes and commands You use the Device Editor’s Attachment tab to create attachments. There are two types of attachments: attribute attachments and command attachments. •
An attribute attachment is a connection between an attribute and a device axis.
•
A command attachment is a command that is issued when a button is pressed.
Attaching attributes Attaching attributes to device axes Attachment tab for axis
Cons tra ints & Motion Ca pture
To attach an attribute to a device axis: 1
Select the Maya object.
2
In the Device Outliner, select the axis you want to attach.
3
Under the Attachment tab, type the name of the Maya node that has the attribute to attach in the Node box
Using Maya: Animation
27
Motion Capture Attaching attributes and commands
or click the right mouse button in the Node box to display a pop-up menu that lists all of the selected nodes and pick the node you want. 4
Type the name of the attribute in the Attribute box
or click the right mouse button in the Attribute box to display a pop-up menu that lists all of the key-able attributes for the specified node and select an attribute. 5
Specify whether you want to make the attachment per Selection or per Object. Choose Object for most motion capture purposes. When you explicitly connect the device to a target attribute, that connection will always take effect. Choose Selection if you want to make the connection only for the currently selected object. This is useful when you are interactively manipulating objects with an input device, but not for basic motion capture work. If you use the Selection mode, the Node box is ignored.
6
If a device has a button, you can specify that a button is a “clutch” that makes the connection only while the button is pressed. Select a button name using the Clutch menu. You cannot record a button press as motion capture data.
7
Click Add to make the attachment between the device axis and the attribute.
Attaching commands You can use command attachments with devices that have buttons. When you press the button, Maya executes the command associated with the button.
To attach a command to a button:
28
1
In the Device Outliner, select a button.
2
Under the Attachment tab, type the command you wish to execute in the Command box.
3
If you want the command to execute repeatedly while the button is pressed, turn on Continuous.
Using Maya: Animation
Motion Capture Attaching attributes and commands Generally, you will want to execute the command once per button press. To do this, turn Continuous off. You can also execute a command every time any button is pressed or released, or if any axis changes on a specified device. The device must have at least one button.
To attach a command to any device change: 1
In the Device Outliner, select a device with at least one button.
2
Under the Attachment tab, enter the command you want to execute whenever any button on the device is pressed or released or whenever any axis on the device changes value. To delete a command attachment or an attribute attachment, select the attachment in the Device Outliner and click Delete.
Modifying existing attachments You can also modify existing attachments using the Attachment tab.
To modify attachment mapping: 1
In the Device Outliner, select the attachment.
2
Change the attachment values.
3
Under the Attachment tab, click Update.
To delete an attachment: 1
In the Device Outliner, select the attachment.
2
Under the Attachment tab, click Delete. Remember, a single axis may have more than one attachment.
If you accidentally delete an attachment, you can always undo the deletion.
Using Maya: Animation
29
Cons tra ints & Motion Ca pture
Tip
Motion Capture Attaching attributes and commands
Mapping device data Sometimes the data coming from the device is in the wrong unit system or needs an adjustment to its scale or offset. You can modify the scale and offset values for incoming device data using the Mapping tab of the Device Editor. Mapping tab
There are two types of mappings: attachment mappings and device mappings. Both mappings affect the scale and offset of the device data. The device data is multiplied by the scale term and then the offset is added. •
Attachment mappings apply to attribute attachments. These mappings are recommended for motion capture work. You can undo them.
•
Device mappings apply to axes. You cannot undo them.
Important Using device and attachment mapping together is error-prone and may produce unintentional results.
To modify the scale or offset of your motion capture data: 1
In the Device Outliner, select the axis or attachment you want to modify. Select an axis if you want the Mapping tab to control a device mapping. Select an attachment if you want the Mapping tab to control an attachment mapping.
2
30
Under the Mapping tab, select Absolute or Relative mapping.
Using Maya: Animation
Motion Capture Attaching attributes and commands With Absolute mapping, motion is scaled and offset with respect to the origin. If you move a device a foot away from the origin, the target attribute also changes its value to be one foot away from the origin. Absolute mapping is useful for motion capture. With Relative mapping, motion is adjusted relative to the last device position, without regard to the origin. If you move a device one foot to the right, the target attribute moves one foot to the right.Relative mapping is useful for desktop input devices that always return to some resting position. 3
If you are working with device mapping, choose whether you want to apply your mapping to World space or View mode. Select World for motion capture work. If View mode is used, the device coordinates are translated into the space of the active camera.
Saving attachments Since devices are not defined as dependency graph nodes, their definitions, attachments, and mappings are not saved in Maya files. Creating an attachments script lets you reload the attribute attachments, command attachments, and mappings when you need them. This saves you having to attach the device to each of its target attributes every time you load a file. You must define the device before running the attachment script. The MEL script will remake all of the attribute attachments, command attachments, and mappings, provided the device is defined and the target attributes and nodes have the same names as they did when you saved the script.
Cons tra ints & Motion Ca pture
Using Maya: Animation
31
Motion Capture Attaching attributes and commands
Click here to save the script
To create an attribute attachments script: 1
In the Device Outliner, select the device, its axes, or its attachments.
2
Under the Controls tab, click Save Attachments.
3
Select a path and name for the attachments MEL script. Be sure you save the script in your scripts path so Maya can see it when you want to reattach your scene.
4
Click OK. The next time you load the scene, define the device, if needed, and run the attachments script from the Script Editor.
32
Using Maya: Animation
Motion Capture Capturing motion
Capturing motion For each motion to capture, there are three different phases of the capture process: rehearse, record, and review. For each of these steps, you’ll use the Device Editor’s Controls tab.
Rehearsing the motion You may wish to have the performer rehearse the motion you’re interested in before you record. During this rehearsal phase, any of the actor’s questions can be worked out to perfect the move. If the scene is not too heavy, you may be able to view the motion in real time. Any animation curves attached to the target attributes are not affected by the Rehearse mode.
To rehearse the motion: 1
Under the Controls tab, select Rehearse.
2
Select Enable Monitor to specify that the target attributes are getting live data from the device. When you switch from other phases, this step is performed automatically for all devices.
Recording the motion The settings for beginning recording are also under the Controls tab.
To record the motion: Under the Controls tab, turn on Enable Record for each device you want to record.
2
Make sure the Recording Duration box has enough recording time (in seconds) for your planned motion.
Cons tra ints & Motion Ca pture
1
We recommend you add a few more seconds to the duration and start recording before the actor begins a move. 3
Select Record.
Using Maya: Animation
33
Motion Capture Capturing motion All the record-enabled devices begin recording data, using the current time as a start time for the recording.
Tip The recording frequency is determined by the device, not by the frame rate of Maya. Once the duration is met, the recording stops and advances to the review phase. At this point, the data is not yet part of your Maya animation and is not saved to a Maya file. Data that you can preview or convert into animation curves is called a take.
Tip To stop a recording before the duration expires, select either Rehearse or Review under the Controls tab. •
Review will take you to the review mode, the same as if the duration expired.
•
Rehearse will not bring the device data into Maya.
If you accidentally chose Rehearse and want to see the motion in your scene, click the Preview or Apply Take buttons. Click Preview to create a preview version of the take; click Apply Take to make an animation curve version of the take. 4
When you are ready to convert the take to animation curves, click Apply Take.
Important If a device has a take and you select Record, that take is lost unless you first click Write Take to save it or Apply Take to convert it to animation curves.
Reviewing the motion In the review phase, Maya applies the motion data you have recorded to the target attributes. Your preview data is applied to all devices and axes that have Apply Take enabled (as indicated by Enable Apply Take). Animation curves that are attached to the target attributes are not affected at this time.
34
Using Maya: Animation
Motion Capture Capturing motion During the review phase, you can click Preview to view the take in a preview form; this does not change the data.You can also click Apply Take to convert the take to animation curves in the review phase.
Viewing a take in preview form A preview is done automatically when you enter the review phase. This lets you review the newly captured motion faster than by using Apply Take and leaves the animation curves unchanged. Preview data is not visible in the Graph Editor.
To view a take in preview form: Under the Controls tab, click Preview. When an attribute attachment is formed, a node (blendDevice) is attached to the target attribute. The blendDevice node determines whether you will view live device data (Enable Monitor) or the animation curve that is attached to the attribute. In this form, the data is stored in the blendDevice node. Playing over the recorded time range will show the newly recorded data, leaving any animation curves unchanged. If you save your scene to a Maya file, preview data is not saved as part of the scene. To save preview data, use the Write Take button (as described in “Saving files to disk” on page 36).
Note If you are doing a batch render, be sure to save the motion as animation curves (using Apply Take). Otherwise the motion will not be part of the render.
Converting a take to animation curves
Under the Controls tab, click Apply Take. When you convert the take to animation curves, the new data replaces any existing animation curves. Older data outside of the newly recorded time range still exists, but any old data within the recorded time range does not.
Using Maya: Animation
35
Cons tra ints & Motion Ca pture
To convert the take to animation curves:
Motion Capture Capturing motion When the take is converted to either preview form or animation curves, all device mappings, attachment mappings, filters, and resamplers are applied to the take data.
Changing the attachment and device mappings You can change the scale and offset values in a mapping without affecting the preview data or animation curves.
To change the attachment and device mappings on the take: 1
Change the values using the Mapping tab (as described in “Modifying existing attachments” on page 29).
2
Reapply the take by clicking Preview or Apply Take.
Saving files to disk You can write out a take as an ASCII file, then read the file back into the scene and review it later. Motion capture files use the .mov file format. This file format is called “move” in the file browser. It is not related to any movie file format. For information on the .mov file format, see the online document, Maya File Formats. Since a single scene may have dozens of motions, you probably do not want to save each move as a separate Maya file, especially after you have selected the final versions of the motion. It is much easier to save only the motion as a separate file.
To save a take to disk: 1
Under the Controls tab, click Take File. Maya will display a file browser.
2
If this is a new file, specify a path using the file browser and specify a new filename. The base filename appears in the box. From now on, if the Take box changes, the path stays the same; only the filename changes.
3
36
Once you’ve specified a valid filename, click Write Take to save the take to disk.
Using Maya: Animation
Motion Capture Capturing motion A take name is required for each device.
Note If you want to save a take every time you enter the review phase, select Write Take on Review under the Controls tab.
Freeing memory After applying the recorded data, the take data is still in a take buffer. For small takes this may not be a problem, but for large takes you may want to free this memory.
To free the take data for all devices: •
Under the Controls tab, click Clear. You cannot undo this action.
Numbering takes A particular motion may require three takes or more. Since it may be difficult to determine which take is best as you record and coming up with unique names for each version of the same move is error-prone, Maya features an easy way to number your takes. Take numbering inserts a number between the move name and its extension (by default, .mov). This number can be incremented to form a take number for that move. The take filename is constructed by inserting the value of the Number box before the extension of the name in the Take box. For example, if the Take box displays clock.mov and the Number box displays a value of 2, the file is saved as clock.002.mov.
Cons tra ints & Motion Ca pture
Using Maya: Animation
37
Motion Capture Capturing motion
To number your takes: 1
Under the Options tab, select Numbered Takes. Whenever the Take box changes, the Number box is reset to the value in Starting Take.
2
If you want to automatically increment the take number whenever a take is written, also select Auto-Increment.
3
When your motion data looks good and you want to convert it to animation curves, click the Apply Take under the Controls tab.
Viewing numbered takes (Example) Take numbering also makes it easier to view different versions. For example, if you have five versions of the clock.mov file that used take numbering, you could view them by completing the following steps:
38
1
Select clock.001.mov using the take browser (the Take File button).
2
Read the takes into the device by clicking Read Take under the Controls tab.
3
See the first take in Maya by clicking Preview or Apply Take.
4
See the second take by changing the value in the Number box to 2,then clicking Read Take and clicking Preview.
Using Maya: Animation
Motion Capture Using filters and resamplers
Using filters and resamplers You can use filters and resamplers to affect your motion capture data. Filters and resamplers let you achieve effects such as demangling Euler angles or resampling data to a specific frequency with a given kernel. You use the Filters tab to create filters and resamplers. Filters and resamplers are applied when you create a Preview, Apply Take, or Review. You cannot apply filters and resamplers while you monitor devices, only when you convert your data to animation curves using the Apply Take button or convert it to blendDevice nodes using the Preview button. A resampler may change the temporal values of the data; a filter will not. Filter settings
Use these buttons to change between active and inactive list.
Resampler settings
To create a filter or resampler:
1
Cons tra ints & Motion Ca pture
The same procedure applies to both filters and resamplers. Place the pointer in the Active or Inactive Filters (or Resamplers) list and click the right mouse button. Maya displays a list of available filters (or resamplers). 2
Select the filter (or resampler) name in the list to create it. The filter or resampler name appears in the Active or Inactive Filters list.
Using Maya: Animation
39
Motion Capture Reviewing takes 3
To view or change the attributes of a filter or resampler, double-click its name in the list. The Attribute Editor for the filter appears.
4
To move an item back and forth between the Active and Inactive lists, click its name in the list and use the << and >> buttons.
Reviewing takes It is not practical to connect a motion capture device to every machine on which you want to view captured motions. Instead, you use a virtual device. A virtual device behaves like a real device in review mode. You can make the same attachments to a virtual device as to a real device. You can read take data into a virtual device and apply it to the target attributes. Virtual devices cannot have buttons.
To define a virtual device based on a real device: 1
Select the real device in the Device Outliner. Under the Controls tab, click Save Virtual Device.
2
Select the path and specify a MEL script name. When you execute the MEL script, a virtual device is defined with the same name as the real device. If you have attachment scripts, they will work with the virtual device without any changes. You can use virtual devices to import numeric data into Maya. In many cases, you can use the movIn command. However, if you are using filters or resamplers, we recommend using a virtual device.For more information, see the documentation for the defineVirtualDevice command.
To read data into a virtual device: Reading data into a virtual device is the same as reading in data to a real device.
40
1
Under the Controls tab, click Take File.
2
Select the take using the browser that appears.
3
Click Read Take to load the take.
4
Click Preview or Apply Take to make the data visible in your animation.
Using Maya: Animation
Motion Capture Using multiple devices
To specify how Maya interprets incoming take data: Use the Options tab to set the units used in the take and time-stamping of the data. If a take has time-stamp data, turn on Time Stamps in the Read Take Options section. If you want to ignore time-stamp information, select Use Frequency in the Read Take Options section and type a value in the Frequency box, in Hertz. Since the .mov file format does not contain information about how data is to be interpreted, the order of data in the take file is important. The order of columns of data in the file must match the order of axes in the device. If you are creating a virtual device by hand, the order of definition is extremely important and must match your data. If time stamps were used with the write take, the first column of data is the time-stamp information. The take is applied with the starting time as the starting time of the recording, if time stamps were used. If you turn on Use Current Time As Apply Take Start Time under the Controls tab, Maya uses the current time as the start time for the take when you click Preview or Apply Take.
Using multiple devices You can record and work with many devices simultaneously. Use the Controls tab to set recording options for each device. To view a device’s current settings, select the device name in the Device Outliner, then select the Options tab. If you do not wish to record data for a device, turn off Enable Record in the Controls tab.
•
If you do not want to apply data to the target attributes of a device, turn off Enable Apply Take under the Controls tab.
To record multiple devices: 1
Under the Controls tab, turn on Write Take on Review.
2
Specify a take name for each device.
3
Under the Options tab, select Numbered Takes and Auto-Increment.
Using Maya: Animation
41
Cons tra ints & Motion Ca pture
•
Motion Capture Performing full-body motion capture With this method, each device automatically saves unique files for each take and you don’t have to manually change the take number and take names.
Performing full-body motion capture The most important task of any motion capture is to plan every step in advance. This is especially true for a large project.
To create a full-body motion capture: 1
Select a motion capture device.
2
Choose a method for calculating the motion. The method is device-dependent and may use inverse kinematics, forward kinematics, constraints, or a combination of the three.
3
Build a skeleton based on the actor’s proportions. If possible, digitize the actor’s joint positions with your motion capture device.
4
Attach the performance skeleton to the device.
5
Connect the performance skeleton to the character skeleton.
6
Rehearse the actions to be performed.
7
Record the motion.
8
Review the recorded motion and insert it into your scene.
Tips for full-body motion capture With full-body motion capture, carefully thought-out sensor placement and skeletal design are essential.
Using an optical system If you use an optical system, just bring the data into Maya. You will need to make a virtual device to read in the motion. See the documentation for the defineVirtualDevice command. We recommend using a single format for all of the motion you import into Maya. You can write a MEL script to define the virtual device that matches the data. With this method, you have to explicitly define the virtual device only once; other times you can run the script that calls the virtual device definition.
42
Using Maya: Animation
Motion Capture Performing full-body motion capture If no filtering is needed, try using the MEL movIn command. This does not require the construction of a virtual device. To use all of the take management functionality and filters, you must define a virtual device and make attachments to it. Since most optical systems let you solve for joint angles, you can use forward kinematics. For a skeleton constructed with the same orientation as the solved optical skeleton, just attach the device to the rotations of the joints.
Using a magnetic capture system For a magnetic capture system, connecting the sensor axes to handles of RP of MC IK solvers works well.
Tips for working with full-body motion capture data •
Work with a skeleton that has the same proportions as the actor. You can create a character based on the actor’s body. If you are using a magnetic system, you can place sensors on opposite sides of each of the actor’s joints. Record the sensor’s location at each placement. You can construct a skeleton that has joints located between opposing sensor positions. If magnetic noise is not a problem, this will produce an accurate copy of the actor’s skeleton.
•
If this is not possible or the character is dissimilar to the actor, create a skeleton based on the actor and solve for that skeleton. You can use constraints, expressions, and connections to map joint rotations and the root position from the actor skeleton to a character.
•
When you select a device using the Device Outliner, the Controls tab will show the take information for that device.
•
It is worth taking extra time to ensure that your data is as clean as possible. For option systems, this mean rigorous calibration of both the space and the actor. For magnetic systems, the freer the space of magnetic noise, the better the result. Cons tra ints & Motion Ca pture
Using Maya: Animation
43
Motion Capture Performing full-body motion capture
44
Using Maya: Animation
Index A absolute mapping 31 Active Filters list 39 Active Resamplers list 39 adding constraint objects 7 adjusting target weights 8 aim constraints 15 aim vectors 18 default values 18 Apply Take button 34, 35, 38 attachment for motion capture 22 attachment mappings 30 Attachment tab 29 attachments command 28 deleting 29 listing 26 making 27, 28 modifying 29 saving 31, 32 attachments script 31 Attachments tab 27 Attribute box 28 attributes attaching 27 Auto-Increment option 38, 41 axis 22 motion capture 22
buttons attaching 28 constraint reset 8 motion capture 22
capturing motion 33 changing device mapping 36 channel box setting target weight 8, 9 Clear button 37 clock server 26 clutch 22 commands attaching 28 attaching commands 28 constraint targets adding 7 removing 8 constraints aim 15 basic 5 basic procedure 7 IK handle 13 orientation 5, 14 point 11 pole vector 13 position 5, 11 reset button 8 scale 6, 19 surface 12 surface normal 16 tangent 17 Controls tab 32, 33, 35, 36, 37, 40 converting takes to curves 35 curves converting takes to 35 removing animation 8 tangent constraints 17
D
default values aim vectors 18 up vectors 18 world up vectos 19 device attachments saving 31, 32 device axis 22 Device Editor 23 device mappings 30, 36 Device Outliner 23, 26 devices attaching 29 listing 26 mapping 36 mappings 30 motion capture 22 multiple motion capture 41
E Enable Apply Take option 34, 41 Enable Monitor option 33 Enable Record button 41 Enable Record option 33 Euler angles 39 expressions driving multiple target weights 11
F filters motion capture 36, 39 Freeing memory motion capture 37 freeing memory motion capture 37 full-body motion capture 42
Index
B
C
data server devices 25
Using Maya: Animation
1
Index
H handler mappings 36
I IK handle constraints 13 Inactive Filters list 39 Inactive Resamplers list 39
M magnetic capture systems 43 mapping 30 absolute 31 changing 36 device 36 handler 36 relative 31 Mapping tab 36 matching orientations 14 mayaClockServer program 26 memory freeing 37 motion capturing 33 motion capture 21 basic procedure 21 device 22 file format 36 freeing memory 37 full-body procedure 42 magnetic systems 43 recording 33 rehearsing 33 saving files to disk 36 servers 22 stopping recording 34 terminology 22 .mov file format 36
2
Using Maya: Animation
multiple devices motion capture 41 multiple target weights using expressions 11 multiple targets adjusting weights 8 weighted average 7
N node 35 Node box 27 normal constraining 16 Numbered Takes option 37, 38, 41 numbering takes 37, 38
Preview button 35, 40 previewing takes 35
R Read Take button 40 Record button 33, 34 recording motion capture 33 multiple devices 41 stopping 34 Recording Duration box 33 Rehearse button 33 rehearsing motion capture 33 relative mapping 31 removing constraint objects 8 resamplers 36, 39 review phase 34
O Object option 28 objects definition 6 selection 6 offset values mapping 30, 36 optical systems 42 Options tab 41 orientation constraints 5, 14 matching another object 14 Outliner Device 23, 26
P point constraints 11 pole vector constraints 13 position constraints 5, 11
S Save Attachments button 32 Save Virtual Device button 40 saving device attachments 31, 32 saving motion capture files 36 scale constraints 6, 19 scale values mapping 30, 36 script attachments 31 device attachments 32 selecting constraint objects 6 selecting constraint targets 6 Selection option 28 servers clock 26 motion capture 22
Index
setting target weights 9 channel box 8, 9 skeletons proportions for 43 Starting Take box 38 stopping motion capture recording 34 surface constraining to a tangent 17 constraining to normal 16 constraints 12
T Take File button 40 takes converting to curves 35 definition 34 freeing data 37 numbering 37, 38 previewing 35 reviewing later 40 viewing 35 tangent constraining 17 target weights adjusting 8 setting 9 targets definition 6 selection 6 using multiple 7, 8 Terminology for motion capture 22 Time Stamps option 41
V view mode 31 Viewing takes in preview form 35 virtual devices 40, 43
W world space 31 world up objects 19 world up type aligning up vector 18 none 19 object 18 object rotation 18 scene 18 vector 18 world up vectors default values 19 Write Take button 34 Write Take on Review option 37, 41
Y Index
U
up vectors 18 controlling 17 default values 18 setting world up type 18 world 17 Use Current Time As Apply Take Start Time option 41 Use Frequency option 41
Y-axis orientation 17
up vector aim 17
Using Maya: Animation
3
Customizing Maya
Customizing Maya 1 Using the Tool Shelf and Marking Menus What are shelves?
7
Working With Shelves Modifying Shelves
8
11
Saving Shelves
12
Creating Shelves
12
Displaying hidden Shelves Deleting Shelves
15
15
Renaming Shelves
16
Reordering the shelves
17
Changing the image of an icon Changing the label of an icon Removing a tool or action icon
19 21 22
Adding or changing an overlay label Customizing action MEL code Customizing a marking menu Creating a Marking menu Editing a marking menu
23
24
26
27 32
Assigning a marking menu to a hotkey
41
Associating a MEL script with a menu item Adding sub-menus
2 Preferences Selecting options
7
44
46
49 50 Using Maya: Basics 3
Overview Contents Setting Maya preferences Displaying Maya views
50 51
Toggling Maya display options Setting General Preferences General options
51
54
Select options
56
Display options
58
Manipulator options
62
Modeling options
64
Animation options
65
Kinematics options Units options
67
68
Selecting different packages Open Maya options Setting UI preferences
Shelf options
70
71
Window options
72 74
Layout options
75
Panels options
76
Miscellaneous options Customizing the UI
78
80
Color Preferences
81
General color preference Active color preference Using the Color Chooser
Using Maya: Basics
84 87
90
Color Chooser options
4
51
92
69
Overview Contents
3 Working with UI Editors Specifying tool settings Duplicating a tool
97
Assigning panels
100
95
Renaming and deleting panels Renaming a panel Deleting a panel Creating a new panel Panel layouts
95
101
102 104
104
106
Creating a layout
108
Deleting a layout
110
Scene independent layouts
111
Associating a layout with a scene Maintaining history
111
113
Installing and removing plug-ins Unloading a plug-in
115
119
Using Maya: Basics 5
Overview Contents
6
Using Maya: Basics
4
Using the Tool Shelf and Marking Menus This chapter contains details about the shelf and marking menus. The first section describes how to create, delete, and rename a shelf. It also contains information on changing an icon’s name and image, and removing a tool or action icon from a shelf.
The following topics are described in this chapter: •
“What are shelves?” on page 79
•
“Working With Shelves” on page 80
•
“Modifying Shelves” on page 83
•
“Customizing a marking menu” on page 98
•
“Creating a Marking menu” on page 99
•
“Editing a marking menu” on page 104
What are shelves? Shelves are user customizable areas to hold your most used actions and tools. The actions and tools are represented by icons on the shelf. Each shelf has a tab with its name on it. To display a Shelf, click its tab. Maya comes with two default shelves, Shelf1 and Shelf2. These can be renamed, modified, deleted and new ones created. Shelves are located directly under the status bar in the Maya window. Modeling shelf
CV Curve Tool
Using Maya: Basics
79
Customizing Maya
The second section explains marking menus and how to use them. Marking menus are an innovative way of selecting various menu items by drawing a unique shape with the mouse.
Using the Tool Shelf and Marking Menus Working With Shelves By creating a number of shelves you can organize groups of commonly used actions together. For example, you could create Modelling, Animation and Rendering shelves and assign the CV Curve Tool to the Modeling shelf. The next time you are working in modeling and need the tool, click the modeling tab and select the tool icon.
Working With Shelves When you add a tool or action icon to a shelf, you work more efficiently because all the necessary tools are right in front of you. You do not have to try and find them in the main menu. Tools are dragged to the shelf from the Minibar beside the shelf, while actions can be dragged from menu items or from the Script Editor. In the following examples, a ‘move relative’ action, the Add Points Tool and the cylinder action are added to the Modeling shelf. Removing, copying and moving items between shelves are also described.
To add an action from the Script Editor 1
Select Windows→ General Editors→ Script Editor.... The Script Editor window will appear.
2
Select Modeling.
3
Select Primitives→ Create NURBS→ Sphere. A sphere will appear at the origin.
4
Select the Move Tool from the Minibar.
5
Click-drag on one of the manipulator arrows. The sphere moves. The command move -r 5.315 0 0; (with your own coordinates), appears in the upper pane of the Script Editor.
6
Click-drag to select the command text in the upper pane of the Script Editor.
7
Using the middle mouse button, click-drag the selected text to the shelf and release. This puts a MEL icon on the shelf. When clicked, the icon executes the “move -r 5.315 0 0;” command again.
8
Move the mouse over the icon. The command appears in the Feedback line at the bottom of the window.
9
Click on the icon. The sphere moves.
To add a tool from the Minibar: 1
80
Select Modeling.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Working With Shelves 2
Select Curves → Add Points Tool. Maya puts the tool’s icon on the Minibar. Minibar
Add Points Tool icon
3
Using the middle mouse button, click-drag the Add Points Tool to the shelf.
Customizing Maya
This will place a new Add Points Tool icon on the shelf. To use the Add Points Tool tool, select its icon from the shelf.
To add an action from a menu: 1
Select Modeling.
2
Select Primitives → Create NURBS.
3
Press Ctrl-Shift-Alt, then select Cylinder. Maya places the cylinder icon on the shelf.
Cylinder action icon
To create a cylinder, select its icon from the shelf.
Warning You cannot drag a tool or an action from a view menu to a shelf. For more information on view menus, see “View menus” on page 19.
To remove an item from the shelf. 1
Position the pointer over the icon, then press the middle mouse button.
Using Maya: Basics
81
Using the Tool Shelf and Marking Menus Working With Shelves 2
Click-drag the icon to the garbage can.
Maya removes the tool or action icon from the shelf tab.
To move an item between shelf tabs. 1
Position the pointer over the icon, then press the middle mouse button.
2
Click-drag the icon to the tab of the shelf you want the icon to be on. The icon will be removed from the current shelf.
3
Click on the shelf tab that you dropped the icon on. The icon will be visible on the new shelf.
To copy an existing item on the shelf. 1
Position the pointer over the icon that you want to copy, then press the Ctrl key.
2
Using the middle mouse button click-drag the icon to its new position. A copy of the icon will appear on the shelf.
Tools vs. actions Tools are identified by the tool designation (for example, the Add Points Tool). When you select a tool, Maya issues a prompt in the help line.
The prompt instructs you on how to use the tool. When you are finished, press the Enter key. Maya then returns you to the last QWERT tool you were using. You can use the Y key to go back into that tool or the G key to repeat the action. When a tool on the shelf is selected it will maintain a highlighted border around it just like tools in the Minibar. When you use an action, you make your selection first, then choose the action. To find out what object/component types are required to complete an action, you move the pointer over the menu item and read the instruction
82
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves in the help line. For example, when you select Primitives → Create NURBS → Cylinder, Maya displays a prompt informing you what you can do with that action.
Note
Modifying Shelves A Shelf Editor is provided to assist you to customize your shelves to your liking. The Shelf Editor is available by selecting Options → Customize UI → Shelves. You can use the shelf editor to perform a variety of tasks, including: •
Saving shelves to disk. For more information, see “Saving Shelves” on page 84.
•
Deleting a shelf. For more information, see “Deleting Shelves” on page 87.
•
Renaming a shelf. For more information, see “Renaming Shelves” on page 88.
•
Reordering shelves. For more information, see “Reordering the shelves” on page 89.
•
Changing the icon representing a tool or action. For more information, see “Changing the image of an icon” on page 91.
•
Assigning a new label to an icon. For more information, see “Changing the label of an icon” on page 93.
•
Removing icons from a shelf. For more information, see “Removing a tool or action icon” on page 94.
•
Changing the MEL command(s) associated with an icon.
Using Maya: Basics
83
Customizing Maya
When a tool is dragged from to the shelf from the Minibar a copy of the tool is made. If a menu item that selects a tool is placed on the shelf with Ctrl-Alt-Shift selection then a copy of a tool is not put on the shelf, only an action that invokes the original tool. A tool copy can have different settings from the tool in the Minibar. Tool settings can be set in the Tool Settings Window by double clicking on the tool icon or selecting Windows→ General Editors→ Tool Settings.
Using the Tool Shelf and Marking Menus Modifying Shelves
Saving Shelves A preference controls when shelves are saved in Maya. See the Shelf Tab in the interface preference window, available from Options → UI Preferences.... This preference lets you specify whether the shelf will be saved automatically when a file is saved and when you quit, or if the shelf is to be saved to disk only when it is explicitly requested. Changes made to the shelf with the Shelf Editor will be saved depending upon your preference setting and which button you select to close the window; Save All Shelves or Close.The default preference setting is to save your shelves whenever you save a file and when you quit the application. Save All Shelves
Saves all changes and writes information to the maya/prefs/shelves directory immediately regardless of your preference setting.
Close
Accepts your changes, but does not write them to the disk immediately. If your preference is to save shelf changes only when explicitly requested, then the changes will stay in effect only for the current session. Otherwise your changes will be saved the next time you save a file or quit the application.
Creating Shelves In addition to using the default Shelves, you can create custom Shelves. For example, you could create a shelf named IK or Kinematics to contain the tools you typically use with Inverse Kinematics. In the following example, a new shelf, Kinematics, is added.
To create a shelf: 1
84
Select Options → Customize UI → Shelves. The following window appears:
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves
Customizing Maya
Shelves
Click the Shelves tab to display existing shelves.
Shelf Contents
Click the Shelf Contents tab to display the contents of a specific shelf.
Edit Commands
Click the Edit Commands tab to view and edit the MEL code associated with a tool or action. For more information, see “Customizing action MEL code” on page 96.
Label
Displays a brief description of the tool. This description appears below the icon in the icon or text modes. For more information, see “Changing the label of an icon” on page 93.
Overlay Label
Enter a label for the icon. This text appears on top of the icon to distinguish it from other items that use the same icon. For more information, see “Adding or changing an overlay label” on page 95. 2
Click the Shelves tab. Maya displays the names of all existing shelves. Select New Shelf. Maya displays a default name for the new shelf in the Name box and puts a new tab in the shelf.
Using Maya: Basics
85
Using the Tool Shelf and Marking Menus Modifying Shelves
Default name for new shelf
Default name for new shelf
3
Double-click in the Name box or press the Tab key to select the Name box.
4
Enter Kinematics, then press Enter. Maya adds the name of the new shelf to the Shelf Editor and the Maya window.
Name of the new shelf
5
86
Click Save All Shelves or Close.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves
Warning If you select Close, your changes will not be saved immediately, although they may be saved when you exit Maya. This depends on the setting specified in Options → UI Preferences → Shelf. For more information, see “Saving Shelves” on page 84.
Displaying hidden Shelves There is no limit to the number of Shelves you can create. However, if you do create a lot of shelves, Maya cannot display them all at the same time.
Deleting Shelves Use Delete Shelf, if you want to remove a shelf from Maya. You do not have to delete any of the associated icons before deleting the shelf.
Warning You cannot undelete a shelf. Maya retains the shelf information in the file/ prefs/shelves/shelf_NAME.mel.deleted. If you want to restore a deleted shelf, rename the file to shelf_NAME.mel, then restart Maya.
To delete a shelf: 1
Select Options → Customize UI → Shelves.
2
Select Shelves. Maya displays all existing shelves.
3
Choose the shelf you want to delete, then select Delete Shelf. The following prompt appears:
Using Maya: Basics
87
Customizing Maya
Click here to display hidden shelves
Using the Tool Shelf and Marking Menus Modifying Shelves 4
Select OK. Maya removes the shelf from the list of existing shelves and the Maya window.
Renaming Shelves You can change the name of a shelf to assign more meaningful names to it. In the following example, the Animation shelf is renamed Dynamics.
To rename a shelf: 1
Select Options → Customize UI → Shelves.
2
Select Shelves, then the shelf you want to rename. Maya displays the name of the selected shelf in the Name box.
Click here to select shelf
Name of shelf appears here
88
3
In the Name box, double-click on the name of the shelf, (or Tab to the Name box).
4
Change the name, then press Enter. Maya displays the new name in the list of existing shelves and in the Maya window.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves
New name for the Animation shelf
Customizing Maya
5
Select Save All Shelves or Close.
Reordering the shelves You can reorder the shelves that you use frequently. This is especially helpful if you have more shelves than Maya can display. In the following example, the Rendering shelf is moved so that it appears as the first shelf in the Maya window.
To reorder the shelves: 1
Select Options → Customize UI → Shelves.
2
Select Shelves. Maya displays all available shelves in the order they appear in the Maya window.
Using Maya: Basics
89
Using the Tool Shelf and Marking Menus Modifying Shelves
3
90
Select Rendering, then click the Move Up button until the selected shelf appears at the top of the list.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves 4
The Rendering shelf now appears in the list of existing shelves and in the Maya window. Select Save All Shelves or Close.
Changing the image of an icon You can assign a new image to the tool to more accurately reflect what the tool is used for. You can also do this for a MEL command. In the following example, the icon associated with the Curves with CV tool is changed.
To change an icon’s image: Select Options → Customize UI → Shelves. The following window appears:
Description of icon
Tool’s icon
2
Click the Shelves tab, then the shelf containing the tool you want to change. Maya displays all associated icons in the Maya window for that shelf.
3
Click the Shelf Contents tab.
4
Select the description of the icon you want to change, then click the Change Image button. The following window appears:
Using Maya: Basics
91
Customizing Maya
1
Using the Tool Shelf and Marking Menus Modifying Shelves
Click here to select another directory containing icons
Click here to select an icon
5
Select a new icon description, then click Apply. Maya changes the appearance of the icon on the Shelf Editor, Pixmap Selector, and Shelf.
6
If you want to change the appearance of the icon, click Modify. The Xpaint window appears.
Note Maya disables the Modify button if you select an.xpm file that is write protected. If you select a modifiable file, the button is enabled. Xpaint is an unsupported software package. For information on using this product, see the appropriate user’s manual.
92
7
Click Done.
8
Click Save All Shelves or Close.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves
Changing the label of an icon You can change the label of a tool or action icon if you: •
want to make it more indicative of the function it performs.
•
have changed the options and want to change the name to reflect changes. For example, if you modify a copy of the sphere action so that it now creates a hemisphere, you can change both the name and the icon to reflect this change.
Note
In the following example, a sphere action’s MEL code has been changed so it now produces half a sphere. The name is changed to reflect the new functionality.
To change an icon’s label: 1
Select Options → Customize UI → Shelves.
2
Select Shelves, then select the shelf containing the icon you want to rename. Maya displays all associated icons in the Maya window for that shelf.
3
Click Shelf Contents, then click Sphere.
Using Maya: Basics
93
Customizing Maya
Before you start, select Options → UI Preferences → Shelf. Click Icon/Text Below. This displays descriptive text appears the icon.
Using the Tool Shelf and Marking Menus Modifying Shelves 4
Enter the new name of the icon in the Label box, then press Enter. Maya changes the name of the tool in the Shelves window and on the Modeling shelf.
New name of the Sphere action
Note If you want to change the overlay label of the tool, see “Adding or changing an overlay label” on page 95. 5
Click Save All Shelves. If you point to the renamed icon, Maya displays the new name on the Help Line.
Removing a tool or action icon There are two ways you can delete an icon. You can middle mouse button click-drag items to the garbage can directly on the shelf or you can use the Shelf Editor.
Using the Shelf Editor to remove an icon: 1
94
Select Options → Customize UI → Shelves.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves 2
Select Shelves, then select the shelf containing the tool you want to delete. Maya displays all associated icons for that shelf.
3
Select Shelf Contents.
4
Select the description of the icon you want to delete, then click Delete Item. Maya removes the icon from the shelf.
Adding or changing an overlay label Maya uses families of icons to represent related tools and actions. Individualized icons are distinguished using the overlay label.
Hide Selection
With the Shelf editor, you can assign a different overlay label to a tool or action. In the following example, the Overlay Label for the New Scene tool is changed.
To assign an overlay label to an icon: 1
Select Options → Customize UI → Shelves.
2
Select Shelves, then select the shelf containing the tool you want to rename. Maya displays all associated icons in the Maya window for that shelf.
3
Select Shelf Contents, then select a tool (in this example, Extrude).
Using Maya: Basics
95
Customizing Maya
General Preferences
Using the Tool Shelf and Marking Menus Modifying Shelves 4
Enter the label in the Overlay Label box, then press Enter. Maya changes the overlay label in the Shelf.
Note If you want to change the Label, see “Changing the label of an icon” on page 93. 5
Click Save All Shelves.
Customizing action MEL code All actions placed on the shelf consist of a single or a series of MEL commands. These commands can be changed to change the behavior of the action. In a previous example we placed a “move relative” command on the shelf. In the following example the MEL code for that command will be modified to change its behavior.
To modify an action’s MEL code: 1
Open the Script Editor by selecting Window→ General Editors→ Script Editor.
2
In the lower pane type in the command: move -r 5 0 0;
96
3
Select the text and with the middle mouse button, click-drag it to the shelf.
4
Select Options → Customize UI → Shelves.
5
Select the “move -r 5 0 0;” item at the bottom of the scrolling list.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Modifying Shelves
Customizing Maya
6
Select Edit Commands. The command appears in the text area.
7
Change the “5” in the command to “-5”.
8
Press the keyboard Enter key. When the icon for this action is clicked, objects will be automatically moved in the opposite direction.
9
Select Save All Shelves or Close. Using Maya: Basics
97
Using the Tool Shelf and Marking Menus Customizing a marking menu
Customizing a marking menu You can use the marking menu editor to: •
Create a marking menu. For more information, see “Creating a Marking menu” on page 99.
•
Edit an existing marking menu. For more information, see “Adding submenus” on page 118.
•
Attach a marking menu to a hotkey. For more information, see “Assigning a marking menu to a hotkey” on page 113. A marking menu has a radial portion and an overflow portion. The radial portion consists of one to eight menu items arranged in a circle.
Each menu item represents a command you have installed to that particular marking menu. By using the marking menu editor, you can add, change, or delete a menu item or command. The overflow portion (or linear portion) has one or more menu items. The overflow items are arranged in a column below the radial items.
Submenu item
Marking menus can be hierarchial. In other words, any menu item can have a sub-menu.
98
Using Maya: Basics
Using the Tool Shelf and Marking Menus Creating a Marking menu
Click-drag here
Note
Creating a Marking menu You can put the following items into a marking menu: •
Text that has been selected in the script editor (also known as the Command window). For more information, see “Associating a MEL script with a menu item” on page 116.
•
Icons from the Shelf (both tools and actions). For more information, see “Removing a tool or action icon” on page 94.
•
Select, Translate, Rotate, Scale, and ShowManips tools from the minibar. Use the Marking Menus Options window to create a marking menu. You can assign a zone, a mouse button in the Hotbox, or a particular hotkey to the marking menu. You can also edit the default marking menus shipped with Maya. The Hotbox can support a different menu for each mouse button in each of the Hotbox’s five zones. You can create 3 menus per zone, for a total of 15 marking menus (3 menus x 5 zones). This gives you approximately 120 commands (3 menus x 5 zones x 8 commands). In addition, by exporting a marking menu to the Hotkey editor, you can use many more customized marking menus. In the following example, a marking menu is created and associated with the South zone and the middle mouse button. The marking menu includes the Add Points, Rotate, and Move Tools.
Using Maya: Basics
99
Customizing Maya
Each menu and sub-menu can contain a maximum of 38 menu items.
Using the Tool Shelf and Marking Menus Creating a Marking menu
To create a marking menu: 1
Select Options → Customize UI → Marking Menus. The following window appears: Marking menu defaults
Zone
Associated mouse buttons
Establishing settings You can specify whether the marking menu is linked to the Hotbox or the Hotkey editor.
Specifying a Hotbox region Select the Hotbox zone that the marking menu occupies - North, South, East, West, or Center. You can select only one region for the marking menu to appear in.
Selecting a mouse button Select the mouse button used to display the marking menu - Left, Middle, or Right. You can select one, two, or three of the mouse buttons. 1
100
Select Create Marking Menus. The following window appears:
Using Maya: Basics
Using the Tool Shelf and Marking Menus Creating a Marking menu
Place tool or action icons here
Customizing Maya
Enter name of the marking menu
2
To add the Add Points tool, select (from the Modeling menu set) Curves → Add Points Tool. The tool moves to the minibar.
3
Using the middle mouse button, click-drag the Add Points Tool to the marking menu.
Hint You can add an action from a shelf to a marking menu. For more information, see “Removing a tool or action icon” on page 94. For information on how to associate text from a MEL script into a marking menu, see “Associating a MEL script with a menu item” on page 116.
Using Maya: Basics
101
Using the Tool Shelf and Marking Menus Creating a Marking menu
4
Repeat steps 3 and 4 for the Rotate and Move tools.
Tips To delete an icon, place the pointer on the icon and press the right mouse button. For more information, see “To delete a menu item:” on page 105. If you want to create a sub-menu, see “Adding sub-menus” on page 118. This is useful if you want to increase the number of menu items you can access from a marking menu. 5
Enter the name of the new menu in the Menu Name box.
Enter name of the new menu here Click here to test the position of the tool
102
Using Maya: Basics
Using the Tool Shelf and Marking Menus Creating a Marking menu
Click here to change the tool’s options
If you want to move the position of the tool, click-drag on the icon with the middle-mouse button to the new position.
If a tool has an option box, you can make changes to the options. For more information, see “Specifying tool settings” on page 167. 6
If you are satisfied with the tool’s position in the marking menu, click Save Changes.
7
To assign the marking menu to the Hotbox, select Hotbox from the Hotbox box. To assign the marking menu to the South zone, click the South button. To assign the marking menu to the middle mouse button, click the middle mouse button toggle. Click here to select the Hotbox
Click here
Using Maya: Basics
103
Customizing Maya
Hint
Using the Tool Shelf and Marking Menus Editing a marking menu To make sure the new menu works, press and hold the Spacebar, then click the middle mouse button in the South zone. 8
Click Apply Settings, then Close.
Editing a marking menu Each icon in the Edit Marking Menu window corresponds to a menu item in a marking menu.
Use the Edit Marking Menu Options window, to add, edit, or delete individual menu items in a marking menu. You can also add sub-menus to add more tools and actions to the marking menu. In the following example, the Feedback Line is deleted.
104
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
Customizing Maya
To delete a menu item: 1
Select Options → Customize UI → Marking Menus.
2
Select Hotbox East, then Edit Marking Menu. The following window appears:
Using Maya: Basics
105
Using the Tool Shelf and Marking Menus Editing a marking menu
3
Position the cursor on the menu icon you want to delete.
4
Using the right mouse button, click-drag from the menu item’s icon to the cascading menu.
Click-drag from here...
... to here to delete the icon
106
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
5
Select Save or Close.
1
Position the cursor on the menu icon you want to edit.
2
Using the right mouse button, click-drag from the menu item’s icon to the cascading menu.
Click-drag from here... ... to here to here to edit an icon
The following window appears:
Using Maya: Basics
107
Customizing Maya
To edit a menu item:
Using the Tool Shelf and Marking Menus Editing a marking menu
Label
108
Enter the name of the marking menu item.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu Icon Filename
Enter the name of the icon file. For more information, see Using MEL.
Command(s)
Enter the MEL script used as the command for the menu item. Setting Optional Properties Use these options to specify if a checkbox or a toggle appears beside the marking menu item.
Specifies that a check box appears beside a marking menu item.
Radio Button
Specifies that a toggle appears beside a marking menu item.
Neither
Specifies that nothing appears.
Option Box
Click this box if you want to change a tool’s options. For more information, see “Specifying tool settings” on page 167.
Note If you place a tool or action that does not have an options window, you must use MEL code to create the box. Once the box is created, you must write MEL code to invoke the option window. Option Box Command(s)
Enter the MEL script to use as the command for the menu item’s option box. 3
Click Save and Close or Close.
To delete a marking menu: 1
Select Options → Customize UI → Marking Menus. The Marking Menus Options window appears.
2
Select the marking menu, then click Delete Marking Menu.
Using Maya: Basics
109
Customizing Maya
Check Box
Using the Tool Shelf and Marking Menus Editing a marking menu
Click here...
... then here to delete a marking menu
The following window appears:
3
If you want to delete the marking menu but keep a backup copy of it, select Create Backup. Maya stores the backup file in maya/script with a file extension of .bak. For information on how to recover the marking menu, see “To restore a marking menu backup:” on page 111. If you want to delete the marking menu without creating a backup file, click Do Not Backup.
110
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
Warning If you select Do Not Backup, Maya deletes the marking menu. You cannot recover it. Maya removes the marking menu from the Marking Menus window. 4
Click Close.
To restore a marking menu backup:
In the following example, the backup file menu_Menu01.mel.bak is renamed menu_Menu01.mel, then reloaded into the Marking Menu editor.
Note You must exit Maya before recovering a deleted marking menu. 1
Open a UNIX shell or window, then go to the maya/script file directory.
Back-up marking menu file
2
Rename the file named menu_Menu01.mel.bak to menu_Menu01.mel.
3
Start Restart.
4
Select Options → Customize UI → Marking Menus. The following message appears:
Using Maya: Basics
111
Customizing Maya
After you delete a marking menu, Maya creates a backup copy, renames it with a.bak file extension, and stores it in the maya/script file directory. To recover the marking menu, rename the file, then reload it as the system default.
Using the Tool Shelf and Marking Menus Editing a marking menu
5
Click Load Menus. The Marking Menu window appears.
Recovered marking menu file
Note Because Maya does not recover the mouse button assignment, you will have to re-assign a mouse button to the recovered marking menu.
112
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
Assigning a marking menu to a hotkey In addition to adding or customizing marking menus in the Hotbox, you can assign a marking menu to a specific hotkey. Each time you press the hotkey and the left mouse button, the associated marking menu appears. For example, the q key is associated with the Select marking menu.
A marking menu/hotkey combination will not work in a tear-off window. In the following example, the Menu01 marking menu is assigned to Alt-b. When you press the hotkey, Maya displays the following marking menu:
To assign a hotkey to a marking menu: 1
Select Options → Customize UI → Marking Menus.
2
Select Menu01, then open the Use Marking Menu in pull-down menu.
Using Maya: Basics
113
Customizing Maya
Tip
Using the Tool Shelf and Marking Menus Editing a marking menu
Click here to select the Hotkey Editor
3
Click Apply Settings. Maya displays the following message in the window: The Marking Menu will be available for editing in the Hotkey Editor.
114
4
Select Options → Customize UI → Hotkeys. The Hotkeys window appears.
5
Scroll down to the bottom of the window.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
Select Menu01
6
Select Menu01 (Press), then enter b in the Key field.
Note Press is the default setting for Action. If you try to map a marking menu to a key already in use, Maya warns you that the key is in use, and asks you if you want to overwrite it.
Using Maya: Basics
115
Customizing Maya
Menu01 appears as Press and Release commands. You must map both Press and Release for this marking menu.
Using the Tool Shelf and Marking Menus Editing a marking menu To overwrite the current mapping, click Yes.
Warning If you decide you want to use the hotkey and marking menu combination that you just overwrote, recreate it using a different key combination. 7
Select Alt, then click Apply New Settings.
8
Select Menu01 (Release), then enter b in the Key box.
9
Select Alt, then Release.
10 Select Apply New Settings.
To use the hotkey, press Alt + b, then the left mouse button.
Associating a MEL script with a menu item If you have written a script to perform a particular task, you can associate it with a menu item in a marking menu. In the following example script, Maya creates a cylinder, then moves, scales, and rotates it.
To associate a script with an menu item:
116
1
Select Options → Customize UI → Marking Menus.
2
Click Edit Marking Menu.
3
Open the Script Editor.
4
With the left mouse button, highlight the MEL script you want to associate with a marking menu.
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
Press and hold the middle mouse button over the highlighted text. An icon appears.
6
Using the middle mouse button, drag the icon to the marking menu’s menu item in the Edit Marking Menu window.
Icon representing the MEL script
7
Use the Edit function to assign a label for the menu item. For more information, see “Adding sub-menus” on page 118.
Using Maya: Basics
117
Customizing Maya
5
Using the Tool Shelf and Marking Menus Editing a marking menu
Adding sub-menus Like the main pull-down menus, menu items in a marking menu can have sub-menus. These sub-menus let you add extra tools and actions to a marking menu.
Note If you create a sub-menus under an overflow menu item, the sub-menus cannot contain any radial items. In the following illustration, there are four menu items associated with one sub-menus.
Adding a sub-menu: In the following example, a sub-menu is associated with the Revolve icon.
118
1
Select Options → Customize UI → Marking Menus.
2
To create a marking menu, select Create Marking Menu. To edit an existing marking menu, select Edit Marking Menu.
3
Position the cursor on the Revolve icon, then press the right mouse button. The following cascading menu appears:
Using Maya: Basics
Using the Tool Shelf and Marking Menus Editing a marking menu
Click here
4
Select Pop-up Submenu. The Revolve icon changes shape indicating that a sub-menu is associated with it. The following windows appears: Customizing Maya
Rotate icon changed to this icon
5
Using the middle mouse button, click-drag the tools or actions to the Submenu Editor.
6
Close the Submenu Editor window.
7
To test the submenu, click in the Click Here to Test field. Using Maya: Basics
119
Using the Tool Shelf and Marking Menus Editing a marking menu
Click-drag here to test the sub-menu
8
120
Click Save Changes.
Using Maya: Basics
5
Preferences In Maya, you can customize the way you work by setting preferences to suit your needs. For example, you can change general color definitions, the way Maya displays the Shelf, menu bars, and panels, or how manipulators display. Maya can look and feel almost any way you need it to. The following topics are described in this chapter: “Selecting options” on page 122
•
“Setting General Preferences” on page 123
•
“General options” on page 126
•
“Select options” on page 128
•
“Display options” on page 130
•
“Manipulator options” on page 134
•
“Modeling options” on page 136
•
“Animation options” on page 137
•
“Kinematics options” on page 139
•
“Units options” on page 140
•
“Selecting different packages” on page 141
•
“Setting UI preferences” on page 143
•
“Open Maya options” on page 142
•
“Setting UI preferences” on page 143
•
“Window options” on page 144
•
“Shelf options” on page 146
•
“Layout options” on page 147
•
“Panels options” on page 148
•
“Miscellaneous options” on page 150
•
“Customizing the UI” on page 152
•
“Color Preferences” on page 153
Customizing Maya
•
Using Maya: Basics
121
Preferences Selecting options
Selecting options Use the Options menu toggles and windows to tailor Maya to your particular requirements. From the main menu bar, click Options to display the Options menu.
Setting Maya preferences The Options menu gives you access to the various windows in which you can change Maya preferences. Click a menu item to display the windows or the triangle to open the cascading menu.
122
•
General Preferences — Displays the General Preferences window. For more information, see “Setting General Preferences” on page 123.
•
UI Preferences — Displays the UI Preferences window. For more information, see “Setting UI preferences” on page 143.
•
Customize UI — Opens a cascading menu, which lets you edit individual user interface components such as hotkeys, color, marking menus, shelves and panels. For more information, see “Customizing the UI” on page 152.
•
Save Preferences — Saves current preferences to the userPrefs.mel file. You can save preferences explicitly or automatically when you exit Maya. For more information, see “Setting the Startup State” on page 126.
Using Maya: Basics
Preferences Setting General Preferences
Displaying Maya views Select the following to quickly enable or disable the display of Maya views. •
Show Only Viewing Panes — Select this option to display only the active views.
•
Show All Panes — Select this option to increase the size of your work surface. Maya enables every option listed on the menu and updates the display.
Toggling Maya display options
Tip Each time you toggle or select an option, Maya removes the Options menu. To keep the menu displayed, click on the dotted line at the top of the cascading menu. For more information on tearing-off a window, see “Displaying menus as separate windows” on page 6.
Setting General Preferences Use the General Preferences window to specify basic features such as the startup state, the undo queue, file compression, parameters for MEL, and the up axis.
To set general preferences: Select Options → General Preferences to open the following options window.
Using Maya: Basics
123
Customizing Maya
Use the Options menu toggles to toggle items such as the Status Line or the Shelf on or off. Click the box beside the option name and Maya updates the display. A check mark indicates that the option is on.
Preferences Setting General Preferences
Selecting a tab Click on a tab to open a specific section of the window.
124
•
General — Use these options to control general system preferences. For more information, see “General options” on page 126.
•
Select — These options let you control selection options on modifiers. You can also edit the default selection priorities of Maya objects and components. For more information, see “Select options” on page 128.
•
Display — Use these options to control the display of your Maya workspace and NURBS and polygonal geometry. For more information, see “Display options” on page 130.
•
Manipulator — Use this option to specify the manipulator display. For more information, see “Manipulator options” on page 134.
•
Modeling — These options lets you set modeling facets and tangents. For more information, see “Modeling options” on page 136.
•
Animation — Use these options to set animation options including playback range, key framing, looping, playback speed, and scene updating. For more information, see “Animation options” on page 137.
Using Maya: Basics
Preferences Setting General Preferences •
Kinematics — These options let you specify joint and IK handle sizes. For more information, see “Kinematics options” on page 139.
•
Units — These options let you specify modeling and animation units. For more information, see “Units options” on page 140.
•
Packages — Use these options to disable or enable various software packages. For more information, see “Selecting different packages” on page 141.
•
OpenMaya — These options let you set loading options for plug-ins. For more information, see “Open Maya options” on page 142.
Note
Displaying hidden tabs When you first open the General Preferences window, not all of the tabs display. To display hidden tabs, either enlarge the window, or click on the layered tabs at the beginning or end of the row. The complete list of tabs displays in a pop-up menu.
Click to display available tabs.
Select the tab you want from the pop-up menu (in this case, Units). Depending on the window size, it re-adjusts the row to display in the order of the pop-up menu. Using Maya: Basics
125
Customizing Maya
For information on the Refresh, Save, Revert to Saved, and Close buttons, see “Saving and restoring window options” on page 11.
Preferences Setting General Preferences
Setting the Startup State Most sections in the preference windows include Save on Quit and Save Explicitly buttons. If you select the Save on quit button, the preferences for the selected tab are updated and saved whenever you quit Maya. If you select the Save Explicitly button, the preferences are updated and saved only when you select the Options → Save Preferences menu item.
General options The General tab opens a section of the General Preferences window that lets you set general system preferences.
To set General options: Select Options → General Preferences → General. The following options window appears:
126
Using Maya: Basics
Preferences Setting General Preferences
Customizing Maya
Specifying Undo options Undo lets you reverse the last action you performed. For more information, see “Undoing an action” on page 317. Undo
Determines whether you can undo an operation. The default is On.
Queue
Determines whether or not the undo operation is unlimited. The default is Finite. If Finite is selected, you can enter a number in the Queue Size box to determine the number of times you can perform undo operations. If Infinite is selected, there is virtually no limit to the numbers of undo you can perform. Be careful, though, because you can run out of memory.
Specifying the size of the queue Queue Size
If Finite is the selected Queue setting, you can enter the number of times that you can perform an undo operation. The higher the number, the more memory is used. The default is 10.
Using Maya: Basics
127
Preferences Setting General Preferences
Setting the Compression Mode File compression lets you reduce the size of a large file so that it does not occupy so much space on your hard drive. On File Save
Use Compressed to save files in compressed mode. Use Uncompressed to save files uncompressed mode. Use As Is to keep files in their original compression mode. This saves compressed files as compressed and uncompressed files as uncompressed. As Is is the default.
Specifying the World Coordinate System This option determines the orientation of the object or scene. For more information, see “Orienting the XYZ system” on page 56. Up Axis
Sets the axis to Y or Z. The default is Y. See “Orienting the XYZ system” on page 56 for more information about the Y and Z axis.
Select options The Select options let you control selection options on modifiers. You can also edit the default selection priorities of Maya objects and components.
To set Select options: Select Options → General Preferences → Select. The following options window appears:
128
Using Maya: Basics
Preferences Setting General Preferences
Customizing Maya
Specifying a Modifier Modifiers control Maya selection operations. They work with masks to control what is displayed when you select items. You can select one or more of the following: Single Marquee Select
Selects the first object in a hierarchy.
Affects Active
If you change from object to component pick mode, the selected object is not affected. This option lets you select objects and components at the same time. This is toggled on by default.
Ignore Selection Priority
Treats all objects with the same priority. The selection order does not matter. This is toggled on by default. For more information, see “Specifying priorities” on page 130.
Click Drag Select
Lets you perform one-step click-dragging with the transformation tools. For example, you can move one object using the Move Tool, then click on a second object and the Move Tool displays. This means you do not have to select the object and then the Move Tool again — you can keep using the Move Tool on any subsequent selected object.
Allow Highlight Select
Highlights components when you switch from object to component pick mode. This is toggled on by default. Using Maya: Basics
129
Preferences Setting General Preferences
Specifying priorities You can specify a selection priority for objects and components. For example, NURBS curves have a higher selection priority than surfaces by default. This means that Maya will select the NURBS curve before the surface when you select geometry that contains both NURBS curves and surfaces.
To change a priority: 1
Click to highlight an item from the Priority scroll list.
1. Scroll to select the item you want to prioritize.
3. Enter the priority number. 2. Select Custom.
2
Select Custom from the PreSets pop-up menu.
3
Enter a number for the selected Priority item in the PreSets box.
Display options Display options include a diverse range of selections that determine how your Maya workspace appears. You can also set options for NURBS and polygonal geometry display.
130
Using Maya: Basics
Preferences Setting General Preferences
To set Display options: Select Options → General Preferences → Display. The following options window appears:
Customizing Maya
Specifying View options Fast Interaction
Improves the performance by instructing Maya to display fewer geometric entities, (such as polygons). Click to toggle this option on or off. Off is the default setting.
Using Maya: Basics
131
Preferences Setting General Preferences Displays one or both of the XYZ coordinates. If you disable both choices, no XYZ coordinates appear.
Axes
View Axis displays the XYZ coordinates in the bottom left corner of the view. This is the default. Origin Axis displays the XYZ coordinates at coordinates 0 0 0. Grid Plane
Displays or hides the grid plane. The grid is a 2D plane that represents 3D dimensions in the view. It is useful when you want to animate motion relative to a solid surface. Select Hide to hide it if it is in the way.
Note This setting overrides Display → Grid. For more information, see “Setting the grid” on page 255. Active Object Pivots
You can specify whether to turn the display of pivot points on or off. For more information on pivots, see “Changing the scale pivot” on page 299.
Affected Highlighting
Turns affected highlighting display on or off. An object associated with or affected by a selected object is highlighted in a different color. For example, it can show a driver and driven objects.
Note You can edit this highlight color by using the menu path Options → Customize UI → Colors → Active → General → Active Affected. Wireframe on Shaded
These options are used to specify whether a wireframe will appear on a shaded item. Full displays normal resolution. This is the default. Reduced displays fewer wires. None displays no wires. Performance is enhanced if you select None.
Specifying NURBS options New Curves / New Surfaces
These settings let you determine which components display when you create a new curve or surface. Edit Points displays edit points on curves or surfaces. Hulls displays the hulls of curves or surfaces. CVs displays the CVs on curves or surfaces.
132
Using Maya: Basics
Preferences Setting General Preferences
Note These options work only on new curves or surfaces, not existing items. Controls the smoothness of an object in a view. It also affects the rendering of newly created surfaces. Enter a value or use the slider. The range is from 0 to 64. The higher the value, the smoother the surface.
Curve Divisions
Controls the smoothness of a curve in a view. Enter a value or use the slider. The range is from 1 to 128. The higher the value, the smoother the curve.
Shaded Divisions
Controls the smoothness of the smooth shaded object (if Shading → Smooth Shade All or Smooth Shade Selected Items is selected from the Views menu in a view).The greater the number, the smoother the smooth shaded object in your view. Enter a value or use the slider. The range is from 1 to 64.
Specifying Polygons options Vertices
Use Display to toggle the display of vertices on or off. Use Normals to turn the display of vertex normals on or off. When Backculling is toggled on, vertices become invisible in areas where the normal is pointing away from the camera.
Edges
If set to Standard, all edges are the same (hard or soft). If Soft/Hard is selected, soft edges are displayed as dotted lines, and hard edges as solid lines. Select Only Hard to show hard edges only (makes soft invisible).
Highlight
If Border Edges is toggled on, outside edges display thicker to make them more visible for certain operations. If Texture Border is toggled on, a thick border is displayed to highlight the area a texture affects per polygon or per vertex.
Border Width
Enter a value or use the slider to specify the width of the polygon border. The range is from 1 to 10.
Facets
If Centers is toggled on, Maya draws a small square to indicate the facet center. Toggle Normals on to show the normals at the center of each polygon. Toggle Triangles on to show all polygons as triangles for display
Using Maya: Basics
133
Customizing Maya
Surface Divisions
Preferences Setting General Preferences Normals Size
Enter a value or use the slider to specify the display size of the normals. The range is from 1 to 10.
Backface Culling
Select one of the following items to specify the display for backface culling. If set to Off, no backface culling occurs. This is the default. When On is selected, surfaces become invisible in areas where the normal is pointing away from the camera. If Keep Wire is selected, the wireframe outline is displayed, but any areas where the normal is pointing away from the camera are hidden. If Keep Hard Edges is selected, backface culling is set only for soft edges.See Using Maya: Modeling for more information on polygonal modeling.
Manipulator options Use the Manipulator options to determine the manipulator size. For more information on manipulators, see Chapter 11, “Transforming Objects.”
To set Manipulator options:
134
1
Select Options → General Preferences → Manipulator. The following options window appears:
2
Enter a value or use the slider to change any of the following manipulator sizes.
Using Maya: Basics
Preferences Setting General Preferences Specifies the size of the manipulators. The range is from 0.10 to 10.00. The default is 10.00.
Handle Size
Specifies the size of the handle. The range is from 4 to 100.
Line Size
Specifies the line thickness size of the rings of the rotate manipulator.
Line Pick Size
Determines the line thickness used when picking the rotate manipulator rings. The pick size should be the same as line size, so you can identify which handle will be picked by the size of the ring.
Using Maya: Basics
Customizing Maya
Global Scale
135
Preferences Setting General Preferences Previous State Size
Controls the size of the points drawn for a previous feedback. For example, for the Move Tool, an axis is drawn to indicate the previous position, with square points at the end of the axes. This controls the size of the squares. Rotate and scale manipulators also have previous state feedback. This type of feedback is shown only when you drag; it disappears as soon as you release the mouse.
Modeling options Use the Modeling options to control modeling tolerances and polygon facets.
To set Modeling options: Select Options → General Preferences → Modeling. The following options window appears:
Specifying the Tolerance The Tolerance value determines the degree of accuracy that is maintained between the original and fit (or interpolated) curves. This setting applies globally to Maya. You can change it on a case-by-case basis. Positional
The degree of accuracy between the actual position of the original and interpolated curves.
Tangential
The degree of accuracy required to determine if two NURBS objects are to be made tangent continuous across a shared edge or point.
136
Using Maya: Basics
Preferences Setting General Preferences Center
Selects polygonal facets at their center. In other words, you must marqueeselect the marker at the center of the facet to select the entire facet.
Whole facet
Selects the entire facet. You can click anywhere on the facet, even any facet edge, to select it. See Using Maya: Modeling for more information on polygonal modeling.
Animation options For more in-depth information about the Animation Preferences, see Using Maya: Animation.
Select Options → General Preferences → Animation. The following options window appears:
Using Maya: Basics
137
Customizing Maya
To set Animation options:
Preferences Setting General Preferences
Setting Animation Controls Time Slider
Specifies the range of times to use as your time playback range.
Range Slider
Displays the entire range of times available.
Height
Adjusts the height of the time slider. This helps with sound synching (as a soundtrack can be displayed in the time slider.) Select 1x for the default size, 2x to double the size of the slider, and 4x to increase the size four times.
Key Ticks
Keyframe ticks show the location of keys along the time slider. Select None to turn the key tick display off, Active to display only active keys, or Channel Box to display only those keys in the Channel Box.
Options
You can toggle one or more of the following options on or off. The Timecode toggle is used to change the default display of times to video standard timecode. The Snapping toggles lets you turns key snapping on or off. When on, the time indicator shows integer values only. When working with sound, turn on Repeat Sound to repeat a sound at the current time. You must hold the mouse button down in the Time Slider. For more information on using sound with Maya, see Using Maya: Animation.
Setting Playback options Update View
Specifies whether Maya plays back an animation in All modeling views or only the active view. The default is Active.
Looping
Specifies how you want Maya to playback an animation. Select Once to play an animation once, then stop. Select Oscillate to play an animation forwards and backwards continuously. Select Continuous to play an animation continuously. This is the default setting.
Playback Speed
The items in this pop-up menu are used to specify an exact frame rate for play back. Select Free to display all the frames of your animation. Each frame is updated completely before proceeding to the next one. This rate reflects your system’s ability to draw your animation on screen and is not necessarily a real time playback mode.
138
Using Maya: Basics
Preferences Setting General Preferences Select Normal to play your animation in real time. Some frames may be dropped (not displayed), to execute this in real time. This depends on your system’s capabilities, the complexity of your scenes, and the display mode for the playback. Select Half to play back at exactly half the speed of real time. Select Twice to play back at twice real time speed. Select Other to enable the Other box and enter an exact ratio of playback rate to real time.
Specifying Performance Options When you edit animation curves in complex scenes, you may want to delay or turn scene updates off. If you select None, changes made in the Animation editors are not reflected in the scene until the Transport Controls are used or the Current Time indicator is moved. If you select Delayed, changes made in the Animation Editors are not reflected in the scene until the mouse editing action is completed by releasing the button. If you select Interactive, scenes update as changes are made to the keys and curves in the Editors. Interactive is the default setting.
Kinematics options In Inverse Kinematics (IK), you can pose a joint chain based on where you want the joint chain to reach. With IK, you can focus on the goal you want a joint chain to reach without worrying about how each joint will have to rotate. IK uses special tools called handles for posing and solvers for animating. For more information about IK, see Using Maya: Animation.
To set Kinematics options: Select Options → General Preferences → Kinematics. The following options window appears:
Using Maya: Basics
139
Customizing Maya
Model Updates
Preferences Setting General Preferences
Joint Size
Enter a value or use the slider to change the display size of skeleton joint size. The range is from 0.01 to 5.0.
IK Handle Size
Enter a value or use the slider to change the display size of IK handles. The range is from 0.01 to 5.0.
Units options You can specify modeling and animation units from this options window.
To set the Units options: Select Options → General Preferences → Units. The following options window appears:
Setting Working Units Select an item from the following pop-up menus. When you change the setting, Maya updates the display.
140
Using Maya: Basics
Preferences Setting General Preferences Linear
Sets the unit of measure for measurements that use linear values. For example, moving and scaling using linear values. The default unit for measuring linear values is centimeter.
Angular
Sets the unit of measure for measurements that use an angular value. For example, rotating uses an angular value. The default unit for measuring angular values is degree.
Time
Sets the time measurement of the Time Slider. The default for measuring time is Film 24fps (24 frames per second).
Selecting different packages
However, you can use up a lot of RAM (Random Access Memory) and increase the start-up time. To avoid this, you can disable one or more of the packages. You can still load a disabled package “on demand” by selecting it from the main menu bar.
Disabling packages based on tasks You can also disable various packages based on the specific tasks you are performing. For example, if you only Rendering, you can improve system response time by disabling Dynamics. In the following example, all of the packages have been enabled and Rendering is disabled.
Note If you enable or disable a package, you must exit Maya and restart the software for the changes to take effect.
To enable or disable a package: 1
Select Options → General Preferences → Packages. The following options window appears:
Using Maya: Basics
141
Customizing Maya
Maya is made up of a number of different software packages. Each time that you start Maya, the software loads all the available licensed packages.
Preferences Setting General Preferences
2
Click on the packages you want to disable (in this example, Rendering).
3
Click the Save button.
4
Exit Maya, then restart the software for the changes to take effect.
Open Maya options Open Maya is an advanced feature that relates to the Plug-in Manager. For more information, see “Installing and removing plug-ins” on page 187.
To load an option: Select Options → General Preferences → OpenMaya. The following options window appears:
Setting Loading options Lazy Binding
142
Use Lazy Binding to turn off the resolution before Maya loads the plug-in. Symbols are resolved on demand.
Using Maya: Basics
Preferences Setting UI preferences When loading a plug-in, Bind Now tries to resolve all of the symbols (or sub-routines) so the sub-routines code can communicate with each other. This is the default.
Bind Now
If the symbols are not resolved, an error message is displayed. If this happens, select Lazy Binding.
Setting UI preferences Use the UI Preferences to configure the user interface as you like it.
To select a UI Preference: Customizing Maya
Select Options → UI Preferences. The following window appears:
Selecting a tab Click on a tab to open a specific section of the window. •
Windows — Control general window preferences. See “Window options” on page 144 for details.
Using Maya: Basics
143
Preferences Setting UI preferences •
Shelf — Set the appearance of the Shelf on start-up. See “Shelf options” on page 146 for details.
•
Layouts — Specify which components you want to display when you start Maya. See “Layout options” on page 147 for details.
•
Panels — Specify what panels are displayed and to configure the view on subsequent start-ups. See “Panels options” on page 148 for details.
•
Misc — Set other UI options, such as how to read help, and which text editor to use when creating expressions. See “Miscellaneous options” on page 150 for details.
Window options The Main Window options let you specify the size of both the main window and the Script Editor.
To set Windows preferences: Select Options → UI Preferences → Windows. The following options window appears:
144
Using Maya: Basics
Preferences Setting UI preferences
Specifying the size of the Maya window Top Left Corner
Specifies the start-up location of the top left corner of the main Maya window.
Width Height
Specifies the start-up width and height of the main Maya window.
Show Title Bar
Specifies whether the title bar appears. Main title bar
Customizing Maya
Show Main Menubar
Specifies whether the main menu bar appears.
Main menu bar
Specifying the size of the Script Editor The Script Editor is used to write MEL scripts. Top Left Corner
Describes the start-up location of the top left corner of the main Maya window.
Width Height
Describes the start-up width and height of the main Maya window.
Show Title Bar
Specifies whether the title bar appears. Title bar
Specifying Other Window Positions Turn Remember on if you want Maya to remember the last positions for all windows, if closed and re-opened. If off, the default is the center of screen. Using Maya: Basics
145
Preferences Setting UI preferences
Shelf options Use the Shelf options window to specify the appearance of the Shelf on startup.
To set a shelf preference: Select Options → UI Preferences → Shelf. The following options window appears:
Specifying the appearance of the shelf Icon Style
You can specify how the text and icons appear on the shelf. To display descriptive text below the icon, select Icon/Text Below.
To display the descriptive text beside the icon, select Icon/Text Beside.
To display only the icon, select Icon Only.
146
Using Maya: Basics
Preferences Setting UI preferences
Specifying shelf contents To save all changes when you exit the program, select Save on Quit.
Save When
If you select Save on Request, Maya saves all changes when you select Save Changes or Save. To save shelves immediately, click Save Shelves Now.
The Layout options window lets you specify the components you want to appear when you start Maya. You can specify the components to appear on either start-up or while you are working.
Note The setting in the Layout options window override the selections you make from the cascading menu.
To set a layout: 1
Select Options → UI Preferences → Layout. The following options window appears:
Click here to enable the component
Using Maya: Basics
147
Customizing Maya
Layout options
Preferences Setting UI preferences 2
If you want a component displayed in the Maya main window, turn it on.
3
Click Save.
Panels options To set a panel preference: Select Options → UI Preferences → Panels. The following options window appears:
Showing menu bars Each view has a sub-menu displaying View, Shading, Lighting, Show, and Panels. If you do not want to see the sub-menu, disable Show Menu Bars. The default is on.
Specifying a configuration for a new scene This lets you specify the view configuration for the next time you open a new scene. The next time you select File → New Scene, Maya opens the new scene with the view configuration you specified.
148
Using Maya: Basics
Preferences Setting UI preferences
Click-drag here
Customizing Maya
You can edit any of the displayed panel configurations. For more information, see “Creating a layout” on page 180. New File
To use the selected panel configuration, select Use Specified. To use the current panel configuration when creating a new file, select use existing.
Open File
To read the panel configuration from the selected scene file, select Use Saved. To use the current panel configuration when opening a file, select Ignore Saved.
Save File
To save the panel configuration with the scene file, select Always Save. If you do not want to save the panel configuration with the scene file, select Never Save.
Tip For the changes to take effect, make sure you select Save.
Using Maya: Basics
149
Preferences Setting UI preferences
Miscellaneous options The Misc options window lets you select a number of other UI options, such as how to read help, and which text editor to use when creating expressions.
To set a Miscellaneous preference: Select Options → UI Preferences → Misc. The following options window appears:
Selecting Help Browser options Window Selection
You can use the existing help browser window or create a new one.
Window Visibility
Specifies whether the Netscape window appears when you select Help → Help. The default is enabled.
Specifying the UI Mode You can specify what function sets appear when you start Maya. Use the UI Mode pull-down menu to make your selection. Animation is the default.
150
Using Maya: Basics
Preferences Setting UI preferences
Click-drag here
Customizing Maya
Selecting an expression editor Expression editors let you edit animation expression text. Use the Expressions Editor pull-down menu to select an editor.
If you select Other, the following window appears:
Using Maya: Basics
151
Preferences Customizing the UI
Specifying the Command Line focus Turn on Hold Focus if you want the cursor to stay in the Command Line after you press Enter. Otherwise, the cursor returns to the current window.
Customizing the UI You can customize the Maya user interface to meet your work requirements. You can create a hotkey, change an object’s color, or create a marking menu, shelf, or a panel.
To customize the UI: Click Options → Customize UI. The following cascading menu appears.
152
Using Maya: Basics
Preferences Customizing the UI Hotkeys—Displays the Hotkey Editor to let you create and edit your own hotkey combinations. For more information, see “Hotkeys and marking menus” on page 24.
•
Colors—Displays the Colors window to let you specify the color of various components of Maya, including the Hypergraph and the Multilister. For more information, see “Color Preferences” on page 153.
•
Marking Menus—Displays the Marking Menu Editor to let you edit the Marking Menu. For more information, see “Marking menus” on page 22.
•
Shelves—Displays the Shelves window to let you create and edit shelves. For more information, see “Using the Tool Shelf and Marking Menus” on page 79.
•
Panels—Displays the Panels window to let you create and edit your own panels. For more information, see “Assigning panels” on page 172.
Color Preferences If you do not like the default colors assigned to various Maya components, use the Color Chooser to change them. This is helpful if you want to make certain components stand out from a scene or object.
Tip Use the lighter colors for active components and darker colors for inactive components.
Using the tabs The Colors window is made up of three tabs: General, Active, and Inactive. Each tab has a number of sections, each containing a series of components. These components allow you change the default colors.
Using Maya: Basics
153
Customizing Maya
•
Preferences Customizing the UI
General
The General tab lets you change the default colors in the following areas or tools: •
3D Views
•
User Defined
•
Animation
•
Multilister
•
Hypergraph
•
Outliner Active—Use the Active tab to set the colors for a selected object.
154
Using Maya: Basics
Preferences Customizing the UI
Customizing Maya
The Active tab lets you change the default colors in the following areas or tools: •
General
•
Objects
•
Components
•
Deformers
•
Manipulators
•
Animation Inactive—Use the Inactive tab to set the colors for objects that are not selected.
Using Maya: Basics
155
Preferences Customizing the UI
The Inactive tab lets you change the default colors in the following areas or tools: •
General
•
Modeling
•
Objects
•
Components
•
Deformers
•
Animation
General color preference In the following example, the colors for the Background, Selected, and Label components of the Hypergraph are changed.
To set a general color: 1
156
Select Options → Customize UI → Colors. The following options window appears.
Using Maya: Basics
Preferences Customizing the UI
Click here to display the Hypergraph
Customizing Maya
2
Click Hypergraph. The following options window appears:
Using Maya: Basics
157
Preferences Customizing the UI
Click-drag the slider to change the color
Double-click here to display the Color Chooser
3
158
Using the slider bars, make changes to the color for the Background. Maya changes the color when you click on the background.
Using Maya: Basics
Preferences Customizing the UI
Tip If you want to make finer changes to a color, double-click the color to display the color chooser. For more information, see “Using the Color Chooser” on page 162. 4
Repeat for the Selected and Label components.
5
Click Save.
Active color preference
Note You can also follow this procedure to change the color of components in the Inactive tab. Before you set an color preference, make sure you have created two or three objects.
To set a an active color: 1
Select an object. Maya treats this as the active object.
2
Select Options → Customize UI → Colors.
3
Select Active. The following window appears:
Using Maya: Basics
159
Customizing Maya
In the following example, the color for the Lead Object component will be changed.
Preferences Customizing the UI
Click here
4
160
Click the triangle beside General. The following section opens:
Using Maya: Basics
Preferences Customizing the UI
5
Click-drag on the slider bar. When you release the left mouse button, Maya changes the color of the active object. When you select another object, it also appears in the new color.
Tip If you want to fine-tune the associated color for a component, see “Using the Color Chooser” on page 162. 6
Click Save.
To return to factory settings If you have made changes to the color settings for a tool and want to return back to the original factory settings, select Edit → Reset to Factory. This restores all settings back to their original settings.
Using Maya: Basics
161
Customizing Maya
Click-drag here with the left mouse button
Preferences Using the Color Chooser
Click-drag here
Using the Color Chooser You can assign a color from a palette to individual components. The General tab does not have a index palette associated with it because not all colors use the color palette. However, if you want to access the Color Chooser window, double-click on a color. Both the Active and Inactive tabs have a color palette that lets you change the color of an existing color selection. If you click on a color that does not appear in the Index Palette, the Color Chooser appears.
opening the color chooser To display the color chooser you can either: •
double-click on a function in the General tab or
•
double-click on the palette bar that appears with the Active and Inactive tabs
To open the color chooser from a General component: Double-click on a component’s color.
162
Using Maya: Basics
Preferences Using the Color Chooser
Double-click here to display the Color Chooser
1
Select the function. Maya matches the existing color to one that most closely resembles it on the index palette. ...then double-click here
Click here
2
Double-click on the corresponding color on the Index Palette. The color chooser window appears. Using Maya: Basics
163
Customizing Maya
To open the color chooser from the Active or Inactive tab:
Preferences Using the Color Chooser
Color Chooser options The Color Chooser lets you fine-tune a color for any component listed in either the General, Active, or Inactive tab.
Current Color
The color selected from the Colors window.
Stored Color
The color you selected. Black is the default color.
Hue
Corresponds to the pure colors of the rainbow, such as yellow, blue, and green. HSV (Hue, Saturation, Value) and RGB are both valid methods for defining colors.
Saturation
The amount of white mixed with the hue to set the intensity of the color.
Value
The amount of black mixed with the hue to make it darker.
Red
The amount of red mixed with the new color.
164
Using Maya: Basics
Preferences Using the Color Chooser Green
The amount of green mixed with the new color.
Blue
The amount of blue mixed with the new color.
Alpha
A grayscale mask generally used to add transparency to an image. The darker the area of the alpha image, the more transparent that area will be.
To change a color 1
Select a new color. It automatically becomes the current color.
2
Press the down arrow. Maya stores the current color as the stored color.
Customizing Maya
Using Maya: Basics
165
Preferences Using the Color Chooser
166
Using Maya: Basics
6
Working with UI Editors This chapter provides details on working with Tool Settings, the Panel Editor, and the Plug-in Manager. The following topics are described in this chapter: “Specifying tool settings” on page 167
•
“Duplicating a tool” on page 169
•
“Assigning panels” on page 172
•
“Renaming and deleting panels” on page 173
•
“Creating a new panel” on page 176
•
“Panel layouts” on page 178
•
“Creating a layout” on page 180
•
“Maintaining history” on page 185
•
“Installing and removing plug-ins” on page 187
Customizing Maya
•
Specifying tool settings Tool settings determine how the tool behaves while you are using it. For example, if you are using the EP Curve Tool, you can specify whether the knot spacing is uniform or chord length. You can open the Tool Settings window in three ways: •
if the tool is represented by an icon on the Minibar, double-click on it with the left mouse button
•
if the tool is in a menu, click the check box (❐) located beside the tool
•
select Window → General Editors → Tool Settings. In the following example, the settings for the CV Curve Tool are changed.
To change the settings for the CV Curve Tool: 1
Select Curves. The following menu appears:
Using Maya: Basics
167
Working with UI Editors Specifying tool settings
Click here
2
168
Click the options box (❐) beside the CV Curve Tool. The following options window appears:
Using Maya: Basics
Working with UI Editors Duplicating a tool 3
Make changes to the tool’s settings, then select Close. To return to the tool’s default settings, select Reset Tool. To change the options for another tool, select the tool from the main menu or the minibar.
4
Select Close.
Duplicating a tool You can have two tools with the same name, but with different tool settings. For example, you can have two versions of the Particle Tool. Customizing Maya
Tip You cannot change the name of the tool in the Tool Settings window. If you want to change the name of the tool, see “Changing the label of an icon” on page 93. To remove an icon from a shelf, click-drag it to the garbage can.
To duplicate a tool: 1
Select the shelf that will contain the new versions of the tool.
2
Select the tool that you want to duplicate. In this example, the CV Curves Tool from the Curves menu is used.
3
Click on CV Curves Tool. Maya places the CV Curve Tool’s icon in the minibar. CV Curve Tool icon
4
Using the middle mouse button, click-drag the icon to the shelf.
Using Maya: Basics
169
Working with UI Editors Duplicating a tool
Maya-assigned name of the copy
5
Select Window → General Editors → Tool Settings. Maya displays the following window.
This window displays the current settings of the first CV Curve Tool. 6
170
Click the first CV Curve Tool icon, then change the tool settings.
Using Maya: Basics
Working with UI Editors Duplicating a tool
Customizing Maya
7
Click the second CV Curve Tool icon, then change the tool settings.
To test whether Maya saved the settings for each tool, click on each icon. Maya displays the settings for each tool in the Tool Settings window. 8
Click Close.
Using Maya: Basics
171
Working with UI Editors Assigning panels
Note When a tool is dragged to the Shelf from the Minibar, a copy of the tool is made. If a menu item that selects a tool is placed on the shelf with Ctrl-AltShift selection, a copy of a tool is not put on the Shelf. Only an action that invokes the original tool is put on the Shelf.
Assigning panels A panel is a collection of interface display elements that can be relocated within the panes in the main window, or torn off, so it can exist in its own window. Panels can consist of a single element such as a camera view in a Modeling panel or multiple elements such as the Multilister, which has many buttons and tabs. Panels also have their own menu bars for menus specific to their solutions. You can display the Panel Editor two ways: •
Select Options → Custom UI → Panel
•
Select Panels → Panel Editor
To display the Panel Editor: 1
Select Panels → Panel Editor. Panels is the default tab when you open the Panel Editor.
2
172
The following window appears:
Using Maya: Basics
Working with UI Editors Renaming and deleting panels
Customizing Maya
By selecting the appropriate tab, you can perform various tasks. •
Panels—Displays existing panels you can rename or delete. For more information, see “Renaming and deleting panels” on page 173.
•
New Panel—Displays the types of panels that you can create. For more information, see “Creating a new panel” on page 176.
•
Layouts—Displays existing panel layouts. For more information, see “Creating a layout” on page 180.
•
Edit Layouts—Displays the current panel layout. For more information, see “Panel layouts” on page 178.
•
History—Displays the history of the panels you used. For more information, see “Maintaining history” on page 185.
Renaming and deleting panels Using the Panels tab, you can: •
Rename a panel. For more information, see “Renaming a panel” on page 174.
•
Delete a panel. For more information, see “Deleting a panel” on page 176.
Using Maya: Basics
173
Working with UI Editors Renaming and deleting panels
Renaming a panel Use the Panel Editor window to rename or delete an existing panel.
To rename a panel: 1
Select Panels → Panel Editor.
2
Select the panel you want to rename.
Tip You cannot rename the Top, Side, Front, or Persp view panels.
Type the new name of the view here
3
Type the new name in the Label box, then press Enter. Maya changes the name of the panel in the list of existing panels.
Tip When you rename a view’s name in the Label box, you are renaming the panel, not copying it.
174
Using Maya: Basics
Working with UI Editors Renaming and deleting panels
4
To make sure that the renamed panel appears in the list of available panels, select Panels → Panel.
Click-drag here
New name of the view
Using Maya: Basics
175
Customizing Maya
New name of the view
Working with UI Editors Creating a new panel
Deleting a panel Use Delete to delete a panel you do not need anymore. Once you have deleted a panel, there is no way to undelete it.
To delete a panel: 1
Select Panels → Panel Editor.
2
Select the panel you want to delete, then select Delete. The following window appears:
Click here to cancel the deletion
3
To confirm the deletion, click OK. Maya removes the panel from the display.
Creating a new panel Sometimes your object or scene is too big to fit in a window. When this happens you can create a second panel. For example, if you create a skeleton and want to use the Outliner to look at two different parts of the object at the same time, you can create a second Outliner. Since the Outliner cannot display all of the nodes of the skeleton, creating a second Outliner lets you view different parts of the object.
To create a new panel:
176
1
Select Panels → Panel Editor.
2
Click the New Panel tab. The following window appears:
Using Maya: Basics
Working with UI Editors Creating a new panel
If you have more than one view open, select the view where you want the new panel to appear.
4
Select Outliner Panel, then click Make New Panel. Maya creates a new panel and displays it over the selected view. It places the name of the new panel in the Panels tab.
Using Maya: Basics
177
Customizing Maya
3
Working with UI Editors Panel layouts
You cannot copy all panels. For example, only one HyperGraph panel is allowed. If you try to copy a panel that cannot be copied, Maya displays a message. 5
To view the original Outliner, select Windows → Outliner. Both Outliner windows now appear in the view. You can now make changes to the Outliners so they display different information about the scene. To delete a panel, see “Deleting a panel” on page 176.
Panel layouts You may find that you will often work with groups of panels at the same time. For example, when rendering, you might want to work with the Multilister, RenderView and a perspective view. When editing models, you might want the Outliner and a perspective view. Panel layouts provide these kinds of configurations. A number of predefined layouts are provided in Maya, but you can also create your own. See “Creating a layout” on page 180 You can select these different panel layouts in a number of ways:
178
Using Maya: Basics
Working with UI Editors Panel layouts •
Selecting Window → Saved Layouts will show a menu with a list of panel layouts.
•
Selecting Panels→ Saved Layouts from the panel menus will also show a menu with a list of panel layouts.
•
Panel layouts can be selected from the Panel Editor.
Selecting a panel layout. Select Panels→ Panel Editor...
2
Select the Layouts tab
3
Selecting any item from the list applies that panel layout to the main window. Try a few of them. Some panels will take a moment to load the first time they are used.
4
To return to the original panel layout select Current Layout from the list.
To add a layout to a shelf: 1
Select a shelf.
2
In Layouts, select the new layout, then click Add to Shelf.
Description of new layout
Layout added to the Shelf
To add a name to the layout (if it displays as a MEL file), see “Adding or changing an overlay label” on page 95.
Using Maya: Basics
179
Customizing Maya
1
Working with UI Editors Creating a layout
Creating a layout By default, any new panel layouts that you create are saved with your preference file, so they can be used with any of your scene files. You can also create panel layouts that specify more information about the exact state of their panels. These layouts are saved with the scene file and will only be available with that specific scene. See “Associating a layout with a scene” on page 183. This example shows how to create a panel with the Outliner, Multilister, and RenderView in it.
To create a layout: 1
From Panels → Panel Editor then the Layouts tab, select the Single Perspective View then select the New Layout button.
2
Tab to the Name box and rename the layout “Outl/Render/Multi”
3
Select the Edit Layouts tab. The following appears:
Maya displays two additional sub-tabs:
180
•
Configurations lets you change the configuration and proportions of the views in your window.
•
Contents lets you change which panels appear in which views.
Using Maya: Basics
Working with UI Editors Creating a layout 4
From the option menu choose the Configuration required (in this case, 3 Right Split) and resize the small panes in the dialog to the correct panel ratios. The main window will change to reflect your changes.
Customizing Maya
Click-drag here to change the width of the display.
Click-drag here to change the height of the display
5
Select the Contents tab.
Using Maya: Basics
181
Working with UI Editors Creating a layout
Click here to display available panel types
6
From the Select Panel by Type option menus select the Outliner, Render Window and Multilister panels for panes 1, 2, and 3 respectively.
7
Select the Layouts tab.
8
Select some other layout, such as Single Perspective View. The main window will change to show only the perspective view.
9
Select Outl/Render/Multi. Your new panel layout is displayed in the main window. Your layout also appears in the Panels→ Saved Layouts menu.
Deleting a layout At some point you may have created layouts that you no longer need or discover that you would like to remove layouts that you never use. The following explains how to delete a panel layout.
To delete a layout: 1
182
In Options→Customize UI→Panels... Layouts tab, select the layout you want to delete, then select Delete. The following window appears:
Using Maya: Basics
Working with UI Editors Creating a layout
2
Click OK to remove the layout.
3
To remove the layout icon on the shelf, click-drag the icon to the garbage can.
When you delete a layout, you only delete the named panel configuration, not the constituent panels.
Scene independent layouts Using the Contents tab to specify the panels for your layout as in the above example you can choose to make the layout either scene independent or associate the layout with a scene. Scene independent layouts are more general and will be available for all of your scenes. Their contents are defined by panel types. If you have multiple panels of the same type in a scene it is not certain which you will get when you select your layout. This is not a problem in most cases but if you are working in a particular scene a great deal it might be worth the time to develop layouts that can be saved with the scene.
Associating a layout with a scene This option in the Contents tab means that this panel layout will only be usable with the current scene. The advantage of this option is that the layout can contain state information about the panels that it contains. You can also specify a particular panel if you have more than one of the same type. As an example, we will create two different layouts that are associated with a scene to illustrate this.
Using Maya: Basics
183
Customizing Maya
Note
Working with UI Editors Creating a layout
Note If you want to look through cameras other than the built-in persp, top, front, side cameras then create another model panel for use in your panel layout. The layouts Top View, Front View, Side View, Persp View will always try to use their respective built-in cameras.
To associate a layout with a scene:
184
1
Open the Panel Editor by selecting Options→ Customize UI→ Panels...
2
From the New Panel tab, create a new model panel and name it “Extra View,” and two new cameras; camera1 and camera2 from the Primitives→ Create Camera menu.
3
Select Persp/Outliner from the Layouts tab.
4
In the Layouts tab, click New Layout.
5
Select Edit Layouts→ Contents, then click Associate with Scene.
6
Select Extra View as the second panel.
7
In the Outliner panel menus, select Show Shapes, Show Attributes and Rotate Filter. In the Extra View menus, select Bounding Box and look through camera one.
8
In the Contents tab, make sure Fix State is checked for both panels and press Update for each. This will save the current panel states with the layout.
Using Maya: Basics
Working with UI Editors Maintaining history
Recreates the current state when the layout is selected.
Update
Capture the current state. 9
Customizing Maya
Fix State
In the Layouts tab, select New Layout.
10 Select Edit Layouts→ Contents, then click Associate with Scene. 11 In the Outliner panel menus, deselect Show Shapes and Show Attributes. In the Extra View menus, select Smooth shade all and look through camera2. 12 In the Contents tab, make sure Fix State is checked for both panels and press Update. 13 Create some primitives such as a sphere and a cone. 14 In the Layouts tab, change between your two new layouts and notice how the states of the panels change.
Maintaining history Maya keeps a record of panel layout changes. This lets you step forward or back through each view. This is helpful if you are flipping back and forth between two layouts and cannot remember their names.
Using Maya: Basics
185
Working with UI Editors Maintaining history
To display panel history: 1
Select Panels → Panel Editor.
2
Select the History tab. The following window appears:
Maintaining history History Depth
Specifies the number of configurations stored in the history.
Wrap History
If on, Maya returns you to the first view or the most recent view configuration when you reach the end of recorded history.
To clear history: To delete the record of all the panels you have used, select Clear History.
To step through the panel layouts: To step back through the panel layouts, select Panels → Layouts → Previous Arrangement. To step forward through the panel layouts, select Panels → Layouts → Next Arrangement.
186
Using Maya: Basics
Working with UI Editors Installing and removing plug-ins
Installing and removing plug-ins A plug-in is a module that can be loaded into Maya on start-up to extend the abilities of the application. New features can be added that have the same look and feel as common Maya features. You can customize the application for a specific job through the creation or purchase of specialty add-ons. Some features that can be added through plug-ins are: file translators
•
tools
•
objects (nodes)
•
MEL commands
•
device drivers The Plug-in Manager determines which plug-ins are loaded into Maya. If you have a plug-in that you use frequently, you can make sure it is always there. The Plug-in Manager automatically scans all the directories in the plug-in path when you first open it and lists available plug-in features for you.
To install a plug-in: 1
Select Window → General Editors → Plug-in Manager. The following window appears:
Using Maya: Basics
187
Customizing Maya
•
Working with UI Editors Installing and removing plug-ins
Click here to load the plug-in
Click here to enable the auto load feature loaded
Loads the plug-in for the current Maya session.
auto loaded
Loads the plug-in for the next time you start Maya. 2
To load a plug-in, select the box beside the name of the plug-in.
Tip If you want to view information about a particular plug-in, you must first load it.
188
Using Maya: Basics
Working with UI Editors Installing and removing plug-ins
Click here to display information on the plug-in
Customizing Maya
Information on the plug-in
Plug-in information Maya displays the following information on a selected plug-in: Name
The name of the plug-in.
Path
The location of the file.
Vendor
The manufacturer of the plug-in.
Plug-in Version
The version number of the plug-in.
For API Version
Indicates the version of the Maya API (Application Programmer Interface) that the plug-in was compiled for.
Using Maya: Basics
189
Working with UI Editors Installing and removing plug-ins
Tip You cannot load a plug-in for any version of Maya that predates the version it was compiled for. Auto Load
Indicates whether the plug-in has been marked for auto load.
Is Loaded
Indicates whether the plug-in is loaded.
Plug-in Features
Displays a list of the features added by the plug-in. 1
To display additional plug-ins, click the triangle to open the Other Registered Plug-ins section.
To browse available plug-ins: 1
Select Window → General Editors → Plug-in Manager.
2
Select Browse. The following window appears:
Selects a file format for reading the plug-in.
Read As
3
190
Select a plug-in, then click Load Plug-in. For more information, see “Creating a new project” on page 199.
Using Maya: Basics
Working with UI Editors Installing and removing plug-ins
Unloading a plug-in You can unload a plug-in when you finish with it, and you may want to reclaim the memory it was using (maybe you were just experimenting with it to see how it worked). If you are developing a plug-in, unload it so the source code can be changed, the plug-in recompiled, and then reloaded.
Removing references to the plug-in
If you force the unload of a plug-in while it is in use, you cannot reload node plug-ins. Existing nodes in the scene must be converted to “Unknown” nodes. When you reload plug-ins, you cannot change the type of these existing nodes. If you try to unload a plug-in while it is in use, a warning message will appear. You can then cancel the unload or force it.
Using Maya: Basics
191
Customizing Maya
Before you can unload a plug-in, you must first remove all references to it from the Maya scene. Along with deleting nodes from the scene that are defined in plug-ins, it is also necessary to flush references to deleted nodes and executed commands from the undo queue. Even though the artifacts are no longer in the scene, they are still around so as to be available for undo purposes.
Working with UI Editors Installing and removing plug-ins
192
Using Maya: Basics
Index
Axes display option 60 axis set up axis to Y or Z 56
A B Backculling polygonal vertex display option 61 backface culling 62 backup marking menu 39 Bind Now Open Maya option 71 Border Edges polygonal highlight option 61 browse plug-ins 118
C Center polygon facet preference 65 Centers polygonal facet display option 61 changes panel history 113 changing color preferences 81 color tabs 81 Hypergraph colors 86 icon 19 icon label 21 overlay label 23 panel layouts 106 tool settings 95 Channel Box Key Ticks, animation control option 66
Using Maya: Modeling
Index
action 22 adding from menu 9 actions vs tools 10 Active Key Ticks, animation control option 66 Active Object Pivots display option 60 active selection color of 87 adding menu action 9 sub-menus 46 adding a tool from Minibar 8 adding actions to shelf 8 adding tools to shelf 8 Affected Highlighting 60 Affects Active 57 Allow Highlight Select 57 Angular units setting 69 Animation Controls 66 animation options set general preferences for 52 animation units, specify 53 As Is file save 56 assigning panels 100
choosing color 90 Click Drag Select 57 color active selection 87 color chooser 90 color tabs changing 81 colors changing preferences 81 component to object mode select in both modes 57 Compressed save files as 56 configuration on startup 76 configurations tab of panel 108 contents of shelves 75 contents tab of panel 108 Continuous playback animation 66 copy to shelf 10 creating layouts 108 marking menus 27 panels 104 shelves 12 Curve Divisions 61 Custom set selection priority 58 customize UI 80 Customize UI 50 customizing marking menu 26 MEL commands 24
121
Index
CV curve tool options 96 CVs display on new curves, surfaces 60
D Delayed animation update option 67 delete from shelf 9 layouts 110 marking menu 37 menu item 33 panels 101, 104 plug-ins 115, 119 shelves 15 tool or action 22 deleting 22 Display polygonal vertex display option 61 Display options general preferences 59 duplicating tools 97
E edit menu item 35 Edit Points display on new curves, surfaces 60 editing marking menus 32 shelves 11 editor panel 100
122
Using Maya: Modeling
expression editor setting 79
F factory settings return to 89 Fast Interaction view display option 59 Finite Undo queue 55 Free playback speed 66 Full displays normal wireframe resolution 60
G General 54 General Preferences 50 Animation 52 Display 52 General 52 Kinematics 53 Manipulator 52 Modeling 52 OpenMaya 53 Packages 53 Select 52 Units 53 general system preferences 52 Global Scale manipulator size 63 Grid Plane display option 60 show or hide 60
H Half playback speed 67 Handle Size manipulator size 63 Height animation control option 66 set for time slider 66 help browser options 78 hidden shelves 15 hidden tabs, display 53 highlighting display turn on or off 60 history of panel changes 113 Hotkey Editor 42 hotkeys marking menus 41 Hulls display on new curves, surfaces 60 Hypergraph changing colors 86
I icon changing 19 changing label 21 icon label 13 icon style of shelves 74 Ignore Selection Priority ignore selection order 57 IK Handle Size change 68 IK handle size, specify 53 independent layouts 111
Index
Infinite Undo queue 55 information about plug-ins 117 install plug-ins 115 Interactive animation update option 67
J Joint Size change 68 specify 53
K Keep Hard Edges polygon backface culling option 62 Keep Wire polygon backface culling option 62 Key Ticks animation control option 66
L
M manipulator display set general options for 52 Manipulator options 62 marking menu deleting 37 marking menus and MEL 44 creating 27 customizing 26 editing 32 key conflict 43 restoring backup 39 setting hotkeys 41 Maya factory settings of 89 Hypergraph 86 shelves 7 startup configuration 76
Maya options Customize UI 50 General Preferences 50 Save preferences 50 setting 50 UI Preferences 50 Maya workspace set general display options 52 MEL and marking menus 44 MEL commands customizing 24 menu adding an action from 9 menu item deleting 33 editing 35 menus showing on views 76 sub-menus 46 Minibar adding a tool from 8 miscellaneous options 78 Model Updates performance options 67 modeling facets set general preferences for 52 modeling units, specify 53 modifiers set selection option 57 specifying 57 moving between shelves 10
Index
label icon overlay 13 of icon 13 layout with associated scene 111 layout options on startup 75
layouts adding to shelves 107 creating 108 deleting 110 independent 111 of panels 106 Lazy Binding Open Maya option 70 Line Pick Size manipulator size 63 Line Size manipulator size 63 Linear units setting 69 loading options 53 Looping playback option 66
N New Curves display options 60 New Surfaces display options 60
Using Maya: Modeling
123
Index
None animation update option 67 Key Ticks, animation control option 66 Normal playback speed 67 Normals polygonal facet display option 61 polygonal vertex display option 61 NURBS options 60
O object to component mode select in both modes 57 On File Save save compressed files 56 save files in original compression mode 56 save uncompressed files 56 Once playback animation 66 Only Hard polygonal edge display option 61 opening hotkey editor 42 OpenMaya 53 Options animation control option 66 options layout 75 miscellaneous 78 of CV curve tool 96 of help browser 78 of panels 76 Options menu 50 Oscillate playback animation 66
124
Using Maya: Modeling
Other playback speed 67 overlay icon label 13 overlay label changing 23
P panel contents tab 108 panel configurations tab 108 Panel Editor 100 panel layouts changing 106 panels assigning 100 creating 104 deleting 101, 104 history of 113 options of 76 renaming 101, 102 Performance Options for animation 67 pivot point turn display of on or off 60 playback update view 66 Playback options 66 Playback Speed 66 plug-ins browsing 118 information about 117 installing 115 removing 115 removing references to 119 polygon diaply option Backface Culling 62
polygon display option Border Width 61 Edges 61 Facets 61 Highlight 61 Normals Size 62 Vertices 61 Positional tolerance preference 64 preferences changing colors 81 Previous State Size manipulator size option 64 priorities set selection 58 Priority set custom selection mode 58
Q Queue for Undo 55 Queue Size set finite undo 55 quit Maya save preferences on quit 54
R Range Slider animation control option 66 Reduced displays fewer wireframes 60 references removing plug-ins 119 rename panels 101, 102 renaming shelves 16 reordering shelves 17
Index
Repeat Sound animation control option 66 reset defaults 89 restoring backup marking menus 39
S
T Tangential tolerance preference 64 tangents set general preferences for 52 Texture Border polygonal highlight option 61
Time Slider animation control option 66 Time units set for Time Slider 69 Timecode animation control option 66 Tolerance 64 tool deleting 22 tool settings changing 95 tools duplicating 97 vs actions 10 Top Left Corner 73 Triangles polygonal facet display option 61 Twice playback speed 67
U UI customizing 80 UI mode setting 78 UI Preferences 50 UI, customize 50 Uncompressed save files as 56 Undo 55 Up Axis 56 update animation delay 67 interactively 67 none 67 Update View playback option 66
Using Maya: Modeling
Index
Save Explicitly 54 with Save Preferences 54 Save on Quit 54 Save Preferences 50 saving shelves 12 saving shelves 12 scene independent layouts 111 with associated layout 111 Select options 56 selection options on modifiers 52 setting expression editor 79 shelf options 74 UI mode 78 settings of tool 95 Shaded Divisions 61 shelf adding actions and tools 8 copying to 10 deleting 15 deleting from 9 shelf appearance 74 Shelf Contents 13 Shelf Editor 11 Shelves default 7
shelves adding layouts 107 contents of 75 creating 12 hidden 15 icon style 74 moving between 10 renaming 16 reordering 17 setting options 74 Show All Panes 51 Show Main Menubar 73 Show Only Viewing Panes 51 Show Title Bar 73 Single Marquee Select 57 Snapping animation control option 66 Soft/Hard polygonal edge display option 61 software packages disable, enable 53 Standard polygonal edge diaply option 61 Startup State 54 sub-menus adding 46 Surface Divisions 61 system preferences, set 52
125
Index
V View Axis display at bottom left 60 View options 59 views Show All Panes 51 Show Only Viewing Panes 51 showing menus 76
W Whole facet polygon facet preference 65 Width Height 73 Wireframe on Shaded display options 60 World Coordinate System setting 56
X XYZ coordinates display at origin 60 display options 60
126
Using Maya: Modeling
Basic Deformers
Contents Basic Deformers 15 Understanding Basic Deformers Modeling the geometry Sculpt deformer
9
Lattice deformer
10
Wire deformer Cluster deformer
8
11 12
Blend shape deformer Wrinkles
7
13
14
16 Using Sculpt Deformers Understanding sculpt deformers Creating a sculpt deformer
15 15
17
Specifying the effects of sculpt deformers
17
Where to find sculpt attribute information Deformation modes
18
19
Changing strength and range of deformation Positioning the influence objects at creation Grouping the influence objects at creation
17 Using Lattice Deformers Understanding lattice deformers Creating a lattice deformer
25 28 28
29 29
32
Working with base lattices
32 Using Maya: Animation
3
Contents Specifying the effects of lattice deformers
33
Where to find lattice attribute information Changing the lattice’s resolution
35
Changing the display of lattices Changing the region of effect Deforming the geometry
38
Resetting the lattice
38
Resetting the lattice points
34
36 37
38
Grouping the base and deformed lattices Parenting the lattice to the geometry Setting the initial position
39
39
40
Maintaining geometry mapping
40
Increasing lattice deformer performance Animating with lattices
40
41
Binding a lattice to a skeleton
41
Binding a lattice and other geometry to a skeleton Deforming a lattice with other deformers
18 Using Wire Deformers Understanding wire deformers Creating a wire deformer Adjusting the influence
42
43 43
48 50
Adding new wires to a deformer Removing wires from a deformer
51 51
Specifying the effects of wire deformers
51
Where to find wire attribute information Limiting the region of deformation
53
54
Controlling the effect where wires cross Affecting the shape of the deformation Varying the deformation percentage
4
Using Maya: Animation
57 59
61
42
Contents Correcting jagged geometry
65
19 Using Cluster Deformers
67
Understanding cluster deformers Creating a cluster deformer
67
68
Editing cluster point percentages
68
Specifying the effects of cluster deformers
69
Where to find cluster attribute information
70
Setting the cluster relative to parent transform
71
Controlling the deformation percentage of the entire cluster Weighted nodes
72
Setting location of cluster handle
72
Improving cluster redraw performance
72
20 Using Blend Shape Deformers Understanding blend shapes Creating a blend shape
73
74
74
Using the Blend Shape Editor Setting target weights
75
76
Settings keys for blend shapes
78
Saving a blend shape as a new target Selecting a blend shape node
78
79
Creating a blend shape node from the Blend Shape Editor Setting blend shape options
79
80
Scaling the influence of all targets
80
Matching the position, rotation, and scale of targets Chaining targets
71
81
82
Blending objects with different topologies Deleting a target’s geometry
82
84
Choosing the blend shape deformation order
85 Using Maya: Animation
5
Contents Editing which targets are in a blend shape Adding a target to a blend shape
86
86
Swapping targets in a blend shape
87
Removing a target’s influence on a blend shape
21 Using Wrinkles
89
Understanding wrinkles Creating a wrinkle
89
90
Specifying the effects of wrinkles
91
Where to find wrinkle option information Wrinkle Type option Amount option
91
92
Thickness option
92
Randomness option Intensity option
92
92
Radial Branch Amount option Radial Branch Depth option
22 Advanced Topics Deformer architecture
92 93
95 95
Viewing intermediate objects
96
Setting the deformation order option Setting the exclusive option Editing the deformation set Pruning deformations Improving performance
6
Using Maya: Animation
98 99
97 98
96
91
88
15
Understanding Basic Deformers Deformers apply deformations on geometries. Maya includes two types of deformers: basic deformers and high-level deformers called flexors. Basic deformers include the following: the sculpt deformer, the lattice deformer, the wire deformer, the cluster deformer, and the blend shape deformer. Additionally, wrinkles, which combine wire and cluster deformers, are included with the basic deformers. The high-level deformers called flexors work in conjunction with Maya’s skeletal animation tools; for information on flexors, see Using Maya: Animation, Character Animation. This document, Using Maya: Animation, Basic Deformers, describes how to use the basic deformers and wrinkles. This chapter presents an overview on basic deformers. To use basic deformers, you need to understand the following: “Modeling the geometry” on page 336
•
“Sculpt deformer” on page 337
•
“Lattice deformer” on page 338
•
“Wire deformer” on page 339
•
“Cluster deformer” on page 340
•
“Blend shape deformer” on page 341
•
“Wrinkles” on page 342
Basic Deformers
•
Note To use the basic deformers this document describes, be sure you have Maya’s Animation menu selected.
Using Maya: Animation
335
Understanding Basic Deformers Modeling the geometry
Modeling the geometry Modeling is the process of creating geometry. You can use Maya to model geometry, or you can import geometry into Maya. In Maya, a geometry can be a non-uniform rational B-spline (NURBS) or polygonal geometry. The geometry you plan to deform can be any combination of objects (NURBS curves or surfaces, polygons, or lattices) or selected components of objects such as NURBS control vertices (CVs) or polygonal vertices.
336
Using Maya: Animation
Understanding Basic Deformers Sculpt deformer
Sculpt deformer A sculpt deformer provides a way to create rounded deformations on a geometry.
Sculpt deformer The sculpt deformer influences the geometry’s shape by means of the sculpt deformer’s sculpt object, which is a spherical object you can manipulate to create various kinds of rounded deformations.
Using Maya: Animation
Basic Deformers
For more information on sculpt deformers, see Chapter 16, “Using Sculpt Deformers.”
337
Understanding Basic Deformers Lattice deformer
Lattice deformer A lattice deformer includes a lattice whose lattice points you can manipulate to deform a geometry within the lattice.
Lattice deformer The lattice deformer influences the geometry by means of a deformed lattice and a base lattice. You can manipulate the deformed lattice to create the deformation. The base lattice, which is invisible by default, represents the deformed lattice’s initial state. The geometry is deformed based on the differences between the deformed lattice and the base lattice. The deformations normally take place only when the geometry is positioned within the base lattice. For more information on lattice deformers, see Chapter 17, “Using Lattice Deformers.”
338
Using Maya: Animation
Understanding Basic Deformers Wire deformer
Wire deformer A wire deformer includes one or more wires that you can manipulate to change the shape of a geometry.
Wire deformer
For more information on using wire deformers, see Chapter 18, “Using Wire Deformers.”
Using Maya: Animation
339
Basic Deformers
The wire deformer influences the geometry by means of one or more pairs of influence wires and base wires. The influence wires are curves that you create, select to be influence wires, and then manipulate to produce deformations. The base wires, which are invisible by default, represent the initial state of the influence wires. The geometry shape changes based on the differences between the base wires and the influence wires.
Understanding Basic Deformers Cluster deformer
Cluster deformer A cluster deformer applies a transformation to a set of a geometry’s points (for example, a set of NURBS CVs, polygonal vertices, or lattice points). You can specify the extent each point can be transformed by assigning each point a weight value that indicates what percentage of the transformation will be applied to that point. You can specify a unique weight value for each point in the set.
Cluster deformer The cluster deformer influences the geometry by means of a cluster handle and weight values that you assign to the geometry’s points (either NURBS CVs or polygonal vertices). The cluster handle appears as the letter “C.” You can position, rotate, and scale the cluster handle to create deformation effects. You use the Set Editor to assign weight values to points. For more information on using cluster deformers, see Chapter 19, “Using Cluster Deformers.”
340
Using Maya: Animation
Understanding Basic Deformers Blend shape deformer
Blend shape deformer A blend shape deformer allows you to blend multiple shapes together. This deformer is typically used for animating facial expressions.
Blend shape deformer effects The blend shape deformer influences a geometry by means of a base shape and various target shapes. Basic Deformers
For more information on blend shape deformers, see Chapter 20, “Using Blend Shape Deformers.”
Using Maya: Animation
341
Understanding Basic Deformers Wrinkles
Wrinkles A wrinkle is a combination of a cluster deformer with one or more wire deformers. Wrinkles are useful for creating detailed wrinkling effects on the surface of a geometry.
Wrinkle (combination of a cluster deformer with wire deformers) For more information on wrinkles, see Chapter 21, “Using Wrinkles.”
342
Using Maya: Animation
16
Using Sculpt Deformers A sculpt deformer uses a sphere as a tool to deform geometry. The geometry near the sphere maps onto it; as you move the sphere, the geometry is pulled or pushed along. This chapter has the following topics:
•
“Understanding sculpt deformers” on page 343
•
“Creating a sculpt deformer” on page 345
•
“Specifying the effects of sculpt deformers” on page 345
Understanding sculpt deformers Use sculpt deformers to bulge or dent specific areas of geometry. To control the amount and shape of the bulge or dent, you move, scale, and change attributes of the scuplt deformer’s sculpt object, a sphere. Basic Deformers
Sculpt deformer deforming plane geometry As with many deformers, the position of the influence objects determines how the geometry is deformed. You can cause the geometry to be undeformed by moving the sculpt object, a locator specifying the origin of the deformation, or both out of the range of influence.
Using Maya: Animation
343
Using Sculpt Deformers Understanding sculpt deformers
Locator (selected) The following figure uses five sculpt deformers on a sphere (the display of the sculpt objects are toggled off using Display→Hide→Hide Deformers→Sculpt Objects).
Sculpting a sphere using several sculpt deformers
344
Using Maya: Animation
Using Sculpt Deformers Creating a sculpt deformer
Creating a sculpt deformer To create a sculpt deformer: 1
Select the geometry you want to deform.
2
To change properties of the sculpt object before you create it, select Deformations→Sculpt-❐. The Sculpt Options window is displayed. See “Specifying the effects of sculpt deformers” on page 345 for descriptions of the options.
3
Select Deformations→Sculpt or, if you’ve opened the Sculpt Options window, click Create in that window. Maya creates a sculpt object (and a locator, if you use stretch mode).
4
If you’re using stretch mode, move the locator to the position that you want the stretch or bulge to start from. This is generally inside or on the opposite of the geometry from the sculpt object. Move the sculpt object to deform the geometry.
Specifying the effects of sculpt deformers
To set sculpt deformer creation options: Select Deformations→Sculpt-❐ to display the Sculpt Options window. The settings in this window apply to all sculpt deformers you create subsequently.
To edit sculpt deformer attributes: Select the sculpt object and choose Window→Attribute Editor to open the Attribute Editor. The sculpt attributes are displayed in the tab having the name of the sculpt deformer. By default, the name is sculptn, where n is an integer.
Using Maya: Animation
345
Basic Deformers
You can specify the effects of the sculpt deformation in the Sculpt Options window before you create a sculpt deformer, or in the Attribute Editor for individual sculpt deformers after you create them.
Using Sculpt Deformers Specifying the effects of sculpt deformers
Where to find sculpt attribute information To set sculpt deformer attributes you use the Attribute Editor. The following figure shows some of the sculpt deformer’s attributes:
The Attribute Editor with sculpt object selected
346
Using Maya: Animation
Using Sculpt Deformers Specifying the effects of sculpt deformers To find information on each sculpt deformer attribute, see the following: Mode
“Deformation modes” on page 347
Inside Mode
“Deformation modes” on page 347
Max Displacement
“Changing strength and range of deformation” on page 353
Dropoff Type
“Changing strength and range of deformation” on page 353
Dropoff Distance
“Changing strength and range of deformation” on page 353
Positioning
“Positioning the influence objects at creation” on page 356
Grouping
“Grouping the influence objects at creation” on page 356
Node Behavior
“Improving performance” on page 427
Deformation modes Sculpt deformer modes You can put the sculpt object in one of three modes: stretch mode, flip mode, or project mode.
Stretch mode In stretch mode, as you move the sculpt object away from the geometry, the affected surface of the geometry stretches or bulges to stay with the sculpt object. The stretch direction extends from the point marked by the locator to the surface of the sculpt object.
Using Maya: Animation
347
Basic Deformers
This section describes the sculpt deformer modes and inside modes.
Using Sculpt Deformers Specifying the effects of sculpt deformers
Sculpt deformer in stretch mode When you create a sculpt deformer in stretch mode, an influence object, the locator (or sculpt origin), is created with the sculpt object. The position of the sculpt object in relation to the influence object affects the deformation. You can select and move the locator as you do any object, or parent it to the sculpt object and move them in combination. Depending on the effect you want to create, you could also parent the locator to some other object in the animation. The following two figures illustrate the effect of moving the locator (the sculpt origin).
Sculpt deformer’s locator (sculpt origin)
348
Using Maya: Animation
Using Sculpt Deformers Specifying the effects of sculpt deformers
Sculpt deformer’s locator (sculpt origin) at new location
Flip mode A sculpt deformer in flip mode has an implicit locator in the center of the sculpt object. When the sculpt object/locator is near the geometry, deformation occurs. This mode is called flip mode because as the center of the sculpt object passes through the surface, the deformed surface flips to the other side of the sculpt object. Basic Deformers
Sculpt deformer in flip mode
Using Maya: Animation
349
Using Sculpt Deformers Specifying the effects of sculpt deformers
Project mode In project mode the sculpt deformer projects the geometry onto the surface of the sculpt object. The extent to which the projection takes place depends on the sculpt deformer’s Dropoff Distance. The following three figures illustrate a sculpt deformer shaping a plane with a minimum Dropoff Distance, an intermediate Dropoff Distance, and a maximum Dropoff Distance. At the maximum Dropoff Distance, the plane is projected completely onto the sculpt object.
Sculpt deformer over plane (minimum Dropoff Distance)
Sculpt deformer over plane (intermediate Dropoff Distance)
350
Using Maya: Animation
Using Sculpt Deformers Specifying the effects of sculpt deformers
Sculpt deformer over plane (maximum Dropoff Distance) While the Dropoff Distance specifies the extent of the projection directly onto the sculpt object, the Maximum Displacement specifies whether the projection takes place directly onto the sculpt object, inside the sculpt object, or outside of the sculpt object.
Using Maya: Animation
351
Basic Deformers
With a Maximum Displacement of 1.0, the projection takes place on the surface of the sculpt object. This is the effect you would usually want to achieve with project mode. However, by changing the Maximum Displacement you can displace the projection from the surface of the sculpt object. With a Maximum Displacement between 0 and 1.0, the projection takes place within the sculpt object. With a Maximum Displacement greater than 1.0, the projection takes place outside of the surface of the sculpt object. Finally, with a Maximum Displacement of 0, the geometry is projected into the center of the sculpt object. Finally, with a Maximum Displacement of less than 0, the projected geometry turns inside out as it is projected through the center of the sculpt object.
Using Sculpt Deformers Specifying the effects of sculpt deformers
Inside modes To control how the deformation occurs for points of the geometry that are within the sculpt object’s diameter, use the Inside Mode setting in the Attribute Editor. Set the inside mode to Ring to push the points outside the sculpt object to produce a contour-like ring of points around the sculpt object. Set the inside mode to Even to spread the affected points as smoothly as possible across the sculpt object’s surface. The default is Even.
Inside modes (left to right): even and ring
352
Using Maya: Animation
Using Sculpt Deformers Specifying the effects of sculpt deformers
Changing strength and range of deformation You can change the strength and range of the sculpt deformation: •
The strength of repulsion of the sculpt object on the geometry determines how far the geometry is pushed away from the sculpt object. This distance is in the local space of the sphere is therefore affected by the scaling of the sphere.
•
The range of the sculpt object’s effect defines how wide the deformer’s field of influence is, and how abruptly it deforms the affected area.
Strength of repulsion Using the Max Displacement attribute, you can change the strength of the sculpt object’s repulsion of the geometry so that the geometry is affected to a greater or lesser extent. This controls how strong the deformer’s effect is, not how much of the geometry is affected. The repulsion is the maximum distance, in linear units, that the sculpt object moves a point on the geometry from the surface of the sphere.
Basic Deformers
Max Displacement (left to right): 0.5, 3, 10
Using Maya: Animation
353
Using Sculpt Deformers Specifying the effects of sculpt deformers
Range and type of effect Based on the distance of the points from the sculpt object, you can control how much of the geometry is affected (using the Dropoff Distance attribute), and how gradually or quickly the attraction pulls points (using the Dropoff Type attribute). There are two dropoff types: •
None gives sudden discontinuity: the sculpt object deforms the geometry at 100% until the dropoff distance is reached, at which point the deformation is 0%.
•
Linear gives a smooth dropoff: the deformation effect drops linearly from 100% at the geometry’s surface to 0% at the dropoff distance.
Dropoff types (left to right): None and Linear
354
Using Maya: Animation
Using Sculpt Deformers Specifying the effects of sculpt deformers
Basic Deformers
Dropoff Distance values of 2 and 5 (dropoff type is linear)
Using Maya: Animation
355
Using Sculpt Deformers Specifying the effects of sculpt deformers
Positioning the influence objects at creation When you create a sculpt deformation, you can center the sculpt object in the geometry or create it at the origin. Use the Center Within Selection option to control where the sculpt object (and for stretch mode, the locator) is created. The Center Within Selection attribute is available only in the Sculpt Options window. Choose Deformations→Sculpt-❐ to display the that window.
Grouping the influence objects at creation When you create a sculpt deformation in stretch mode, you can group the sculpt object with the locator. Use the Group Sculptor With Locator optionto group the two influence objects. The Group Sculptor With Locator attribute is available only in the Sculpt Options window. Choose Deformations→Sculpt-❐ to display that window.
356
Using Maya: Animation
17
Using Lattice Deformers A lattice deformer surrounds a geometry with a lattice that you can use to change the geometry’s shape. When the geometry is within the lattice, the geometry changes shape in response to how you manipulate the lattice. This chapter has the following topics:
•
“Understanding lattice deformers” on page 357
•
“Creating a lattice deformer” on page 360
•
“Specifying the effects of lattice deformers” on page 361
•
“Deforming the geometry” on page 366
•
“Animating with lattices” on page 369
Understanding lattice deformers
The deformed lattice is a visible box whose lattice points you manipulate to deform the geometry.
Deformed lattice with lattice points selected
Using Maya: Animation
357
Basic Deformers
Use lattices deformers when you want to smoothly stretch or squash large sections of geometry. Lattice deformations use a base lattice and a deformed lattice to control the deformation.
Using Lattice Deformers Understanding lattice deformers The base lattice is a box (usually invisible) that contains the geometry you want to deform. The base lattice serves as a reference for how strongly each lattice point on the deformed lattice influences each component of the geometry. Move the geometry out of the base lattice, and the geometry becomes undeformed (unless freeze geometry is turned on).
Base lattice (selected) You can animate the movement of the geometry into and out of the base lattice: like a ghost squeezing through a keyhole, the geometry’s shape changes based on the deformation of the closest points of the lattice.
Cylinder geometry entering a lattice deformer
358
Using Maya: Animation
Using Lattice Deformers Understanding lattice deformers
Cylinder geometry passing through a lattice deformer
The lattice deformer maps the volume of space within the base lattice into the volume defined by the deformed lattice. For example, if you scale up the deformed lattice with respect to the base lattice, your geometry grows; if you scale down the deformed lattice, the geometry shrinks. In many situations, you group the base lattice and the deformed lattice together. This makes it easy to move them in unison, which is useful when you want the lattice deformation to occur relative to some other transformation space. For example, suppose you have an antenna on a car, and you want the antenna to whip back and forth as the car veers from side to side. You can parent the base and deformed lattices together under the car’s transform node so both get carried along the car’s path, and then deform the antenna with the deformed lattice relative to that transformation.
Using Maya: Animation
359
Basic Deformers
Cylinder geometry exiting a lattice deformer
Using Lattice Deformers Creating a lattice deformer
Creating a lattice deformer This section describes how to create a lattice and how to work with base lattices.
To create a lattice deformer: 1
Select the geometry for which you want to create a lattice.
2
To set lattice creation options before you create the lattice, select Deformations→Lattice-❐. The Lattice Options window is displayed.
3
Select Deformations→Lattice or, if you’ve opened the Lattice Options window, click Create in the window. The lattice appears on the object you selected. If you select part of an object to which to apply the lattice (by choosing components), only the selected components appear within the lattice.
4
To manipulate the lattice’s control vertices, turn on Component Type button).
5
Select and move a point or points on the lattice.
(the Select by
As the points on the lattice move, so does the geometry.
Note If you are animating the geometry through the base lattice and want a smooth transition, leave the outermost slices of the lattice undeformed where the geometry enters and leaves the base lattice. If you don’t, the geometry jumps to the lattice as it enters.
Working with base lattices The base lattice is visible only when it’s selected. You can translate, rotate, or scale a base lattice, but you cannot manipulate individual control vertices as you can with the deformed lattice. Since the base lattice is rarely visible, it’s easy to forget the effect it has on the geometry. There are two important considerations to keep in mind when working with lattices:
360
Using Maya: Animation
Using Lattice Deformers Specifying the effects of lattice deformers •
The original, undeformed geometry must be inside the base lattice to be affected by the deformed lattice. If you move the geometry and don’t have the base lattice parented to it, the deformed lattice no longer has an effect on the geometry.
•
If you are moving the geometry through the deformed lattice, you must have the base lattice within the deformed lattice. For example, if you have a deformed lattice to the side of a character, but the invisible base lattice mistakenly in front, when the character walks straight ahead, it reaches the base lattice and pours through the deformed lattice on the side.
To manipulate the base lattice: •
In the Outliner (open by selecting Window→Outliner), click on the name of the base lattice. The base lattice is visible only when selected.
Specifying the effects of lattice deformers You can specify the effect of the lattice deformation in the Lattice Options window before you create a lattice deformer, or in the Attribute Editor for individual lattice deformers after you create them. Basic Deformers
To set lattice deformer creation options: Select Deformations→Lattice-❐ to display the Lattice Options window. The settings in the window apply to all lattice deformers you create subsequently.
To edit lattice deformer attributes: Select the lattice and choose Window→Attribute Editor to open the Attribute Editor. The latice attributes are displayed in the tab having the name of the lattice deformer. By default, the name is ffdn, where n is an integer.
Using Maya: Animation
361
Using Lattice Deformers Specifying the effects of lattice deformers
Where to find lattice attribute information To set lattice deformer attributes you use the Attribute Editor. The following figure shows some of the lattice deformer’s attributes:
The Attribute Editor with lattice selected
362
Using Maya: Animation
Using Lattice Deformers Specifying the effects of lattice deformers To find information on each lattice deformer attribute, see the following: Divisions
“Changing the lattice’s resolution” on page 363
Parenting
“Parenting the lattice to the geometry” on page 367
Freeze Mode
“Maintaining geometry mapping” on page 368
Use Partial Resolution
“Increasing lattice deformer performance” on page 368
Changing the lattice’s resolution To deform the geometry by a finer or coarser resolution, you can change the number of lattice points. Using the Divisions attribute, you can increase or decrease the divisions along S, T, and U (the X-, Y-, and Z-axis, respectively, if the lattice were in the default position at the origin).
You gain no resolution in the deformation by having more lattice points in the lattice than points on the geometry. The resolution is limited by the spacing of points across the geometry. Note that if you’ve moved the points, you have to reset the points before changing the resolution. You can reset the lattice by choosing Deformations→Edit Lattice→Reset Lattice. However, you cannot change the resolution of a lattice if the lattice points have been moved from their reset position or the lattice has history. If you want to change the number of divisions on a lattice whose points have been moved, choose Deformations→Edit Lattice→Reset Lattice Tweaks, and then change the divisions of the lattice. If you want to change the divisions on a lattice with history, find the upstream lattice shape and change its divisions. You can find the upstream lattice by selecting the lattice and looking in the attribute editor tabs for the original lattice shape, which will typically share the same base name as the downstream lattice appended by the letter “Orig.”
Using Maya: Animation
363
Basic Deformers
The caveat, of course, is that the greater the number of divisions, the more calculations Maya has to do to deform the geometry and the slower the performance. For ways to speed up the performance to counteract the effect of a high-resolution lattice, see “Improving performance” on page 427.
Using Lattice Deformers Specifying the effects of lattice deformers
Lattice with default divisions of 2, 5, 2 (left) and 4, 4, 4 (right)
Changing the display of lattices Lattices have a special reduced display mode that lets you toggle them to appear as the letter L to reduce screen clutter. In the “L” mode, you can select the lattice with by selecting the “L” icon. When selected, the lattice itself appears.
To toggle the reduced display mode: Choose Display→Object Components→Lattice Shape. The lattice toggles on and off.
Changing the region of effect By default when you create a lattice, each lattice point affects only nearby geometry components. This is Local Mode. If you turn Local Mode off, every point on the lattice has an effect on every component of the geometry in the deformation set. Lattice points farther away from a particular point have less effect than close lattice points, but all lattice points have some effect. Local Mode is faster and allows you finer control of the deformation as you manipulate the lattice points, since the proximity of the lattice points has more effect on the geometry.
364
Using Maya: Animation
Using Lattice Deformers Specifying the effects of lattice deformers In Local Mode, you can set the area of lattice points that affect the geometry with the Local Influence (S, T, U) attributes.
Lattice with Local Mode turned on (left) and turned off (right)
Basic Deformers
Using Maya: Animation
365
Using Lattice Deformers Deforming the geometry
Deforming the geometry Deforming a geometry involves manipulating the relationships among the base lattice, the deformed lattice, and the geometry. These manipulations include the following: •
Resetting the lattice
•
Resetting the lattice points
•
Grouping the base and deformed lattices
•
Parenting the lattice to the geometry
•
Setting the initial position
•
Maintaining geometry mapping
•
Increasing lattice deformer performance
Resetting the lattice You can reset the deformed lattice to return it to the location and shape of the base lattice. Use Reset Lattice to clear all adjustments you have made to the deformed lattice. Use this when you want to: •
start over with the deformation
•
rotate, scale, or translate the base lattice and the deformed lattice together, from their initial positions
•
parent the base lattice at the center of the deformed lattice, before manipulating the lattice. (See the discussion on moving geometry through the lattice in “Working with base lattices” on page 360.)
To reset the lattice: Select Deformations→Edit Lattice→Reset Lattice.
Resetting the lattice points You can reset the lattice points to their original positions. This is similar to reset lattice, but it does not modify the transformation on the lattice shape itself, only the transformation of the lattice points. Use this when you want to change the number of divisions on the lattice or start over with the deformation.
366
Using Maya: Animation
Using Lattice Deformers Deforming the geometry
To reset the lattice points Select Deformations→Edit Lattice→Reset Lattice Tweaks.
Grouping the base and deformed lattices To move the base lattice and the deformed lattice together, you can group them. Group the lattices when you are moving the lattice to deform a stationary geometry. For example, suppose you wanted to slam a fish bowl on a character’s head so that the head then conforms to the shape of the bowl. To do this, you could use a lattice deformer to shape a geometry for the fishbowl and a geometry for the head. You could then group the base lattice and deformed lattice, parent them to the fishbowl geometry, and move them all away from the head. When you move them away, the head will return to its normal shape, but when you move them back the head will take the shape of the fishbowl.
To group the deformed lattice and the base lattice: 1
Select the deformed lattice and base lattice.
2
Select Edit→Group.
Parenting the lattice to the geometry You can parent the lattice and base lattice to the geometry to move the geometry and keep it deformed. For example, if your character’s squashed hat is deformed with a lattice, parent the lattice to the hat and the base lattice so the hat stays deformed as it moves.
To parent the lattice to the geometry: You can parent the lattice to the geometry in two ways, depending on when you’re parenting: •
After you create the lattice, open the Outliner (select Windows→Outliner) and drag and drop the lattice onto the geometry using the middle mouse button. An alternate way is to select the lattice, then the geometry, and choose Edit→Parent.
Using Maya: Animation
367
Basic Deformers
If you have grouped the base lattice and the deformed lattice, a simple way to select the two lattices in the scene (without opening the Outliner) is to select the deformed lattice and press the Up Arrow key to get the lattice transform node.
Using Lattice Deformers Deforming the geometry •
Before you create the lattice, open the Lattice Options window (select Deformations→Lattice-❐) and turn on the option called Autoparent to Selection.
Setting the initial position Most often, you probably want the lattice centered around the geometry it’s deforming. As you deform the lattice, you want to see immediately the effect on the geometry. If you transform the lattice, the geometry transforms as well. At other times, you may want the geometry to be generally unaffected by the lattice, deforming only when it moves into the influence of the base lattice. For example, you can create a ghost (the geometry) that squeezes through a keyhole-shaped deformer and then pops out on the other side and resumes the original ghost shape. The Center Around Selection toggle in the Lattice Options window determines where the lattice is created. When checked, Center Around Selection creates a lattice around the object. If more than one object is in the object list, the lattice is centered around the group. When Center Around Selection is toggled off, the lattice is created at the origin with a default size.
Maintaining geometry mapping You can freeze the relationship between the deformed lattice and the base lattice so that subsequent translations, rotations, and scales of the deformed lattice with respect to the base lattice have no effect on the deformation. Freeze Geometry Mapping remembers the mapping of the geometry from the base lattice to the deformed lattice. Use Freeze Geometry Mapping when you layer deformations so that subsequent changes in the geometry shape do not prevent the lattice’s deformations from being considered.
Increasing lattice deformer performance You can improve redraw performance when you don’t need to see the deformation you created (for example, if you’re working on another part of the scene). Reduce the accuracy of the deformation by changing the Use Partial Resolution attribute in the Attribute Editor from full to partial.
368
Using Maya: Animation
Using Lattice Deformers Animating with lattices When you set the Use Partial Resolution attribute to partial, you can adjust the error tolerated in the deformation calculation. A tolerance of 0 means you want full accuracy; the maximum value of 0.1 decreases the accuracy significantly.
Note If you have set the accuracy to partial, set the accuracy of each deformer to full before you render the scene if you want to render the deformation most accurately. Additionally, note that you can edit the performance settings for lattices (and all the other deformers) with the Performance Settings editor (Choose Window→General Editors→Performance Settings... .)
Animating with lattices You can combine lattices with other Maya features for some creative effects. For example, try: Binding a lattice to a skeleton
•
Binding a lattice and other geometry to a skeleton
•
Deforming a lattice with other deformers
Binding a lattice to a skeleton Conventionally, you bind geometry to a skeleton, then add high-level deformers call flexors on the joints or bones to affect the geometry when the joints are articulated. Usually you spend some time adjusting these deformers to produce a realistic effect. For some purposes, putting a lattice on a geometry first, then binding the lattice to the skeleton produces a smooth deformation at a joint with little effort. This works especially well if you are bending one joint of many, such as for a tail. The lattice bound to the skeleton produces a smooth deformation over many joints, whereas putting a lattice flexor on a joint affects only the area between the joint and its neighboring two joints.
Using Maya: Animation
369
Basic Deformers
•
Using Lattice Deformers Animating with lattices
Geometry bound to skeleton (left) and lattice bound to skeleton(right)
Binding a lattice and other geometry to a skeleton You can select both lattice and other, nonoverlapping geometry to bind to the same skeleton. For example, you can bind a lattice that’s deforming a torso, but bind the geometry itself for the legs and arms of a character. This type of skinning can give you effects in body rotations that encompass a wider, more realistic range of the body with little manipulation on your part.
Deforming a lattice with other deformers You can deform any deformed lattice just as you can deform a geometry with other deformers. For example, you can put a sculpt or cluster deformer on a lattice, and deform the lattice shape.
370
Using Maya: Animation
18
Using Wire Deformers Wire deformers use curves you create as a tool to pull or push geometry. You can set up the curves to follow the contours of the geometry. When you move the curves, the surrounding geometry is pulled along. This chapter has the following topics:
•
“Understanding wire deformers” on page 371
•
“Creating a wire deformer” on page 376
•
“Specifying the effects of wire deformers” on page 379
•
“Correcting jagged geometry” on page 393
Understanding wire deformers
Wire deformer animating eyebrow action Using Maya: Animation
371
Basic Deformers
With a wire deformer, you can deform geometry with free-form curves. You create the curves and select them as the wire deformer’s wires. You can then deform surfaces by manipulating the wires to create dynamic effects. The following figure illustrates how a wire deformer can animate an eyebrow:
Using Wire Deformers Understanding wire deformers Wire deformers include one or more wires you can manipulate to shape a geometry. Here is a plane that has been deformed by a wire deformer that consisted of several wires:
Wire deformer with several wires Base wires, a wire deformer’s secondary influence objects, are duplicate curves that Maya creates when you assign the curve to be a wire deformer. The base wire acts as an anchor to the wires: the deformation occurs on the geometry in a straight line from the base wire to the wire deformer.
372
Using Maya: Animation
Using Wire Deformers Understanding wire deformers Base wires are hidden by default. You can display them by selecting them in the Outliner and choosing Display→Show Selection.
Base wire acts as anchor to wire deformer
Depending on whether the base wire is parented to the influence wire, you could create a wave effect or a stretching effect.
Using Maya: Animation
373
Basic Deformers
If you want to limit the region of a wire’s effects, you can create curves called holders. Holders let you create a deformation up to the point of the holder, regardless of the dropoff applied to the wire. They also limit the region of the deformer’s effect by blocking deformation beyond the holder. As with any curve, you can move a holder or change its shape.
Using Wire Deformers Understanding wire deformers
Wire deformer creating wave effect The wire deformer creates the wave in the geometry based on the manipulation of the deformer’s influence wire. The influence wire, which you can manipulate directly, is the curve located above the geometry. The base wire is located below the influence wire. The differences between the influence wire and the base wire determine the deformation. With the base wire parented to the influence wire, positioning the influence wire causes a wave to ripple through the geometry.
Curve with base wire parented to curve
374
Using Maya: Animation
Using Wire Deformers Understanding wire deformers However, if the base wire is not parented to the influence wire, positioning the curve stretches the geometry between the influence wire and the base wire.
Curve without base wire parented to curve
Basic Deformers
Using Maya: Animation
375
Using Wire Deformers Creating a wire deformer
Creating a wire deformer This section describes the basic steps of creating and working with wire deformers. Setting attributes and using more advance features like dropoff locators is described in “Specifying the effects of wire deformers” on page 379.
To create a wire deformer with no holders: 1
Create a curve or curves on or near the surface you want to deform. The curve does not have to be on the surface, but it should be in close proximity. You can create several curves to deform your selection and others to act as holders.
2
To change properties of the wire deformer before you create it, select Deformations→Wire Tool-❐. The Wire Options window is displayed. See “Specifying the effects of wire deformers” on page 379 for descriptions of the options.
3
Select Deformations→Wire Tool.
4
Select the geometry you want to deform and press the Enter key. The prompt line leads you through the selection process.
5
Select all curves you want to use as wires. If the only curves on the geometry’s surface are ones you want to use as wires, you can simply drag a box over the geometry and curves. The wire tool selects and highlights only the curves.
6
Press the Enter key. You can lift the wires off the surface individually or in a group to deform the surface.
376
Using Maya: Animation
Using Wire Deformers Creating a wire deformer You can modify the curves of the wire deformer the same way you modify any curve, by toggling on (the Select by Component Type button) and using the transform manipulators to move the points.
Note If a wire does not deform the surface when you transform it, the initial curve may not have been close enough to the surface. To move its initial position, simply move the base wire (see the procedure, “To select the base wire:” on page 378).
To create a wire deformer with holders: 1
Create a curve or curves on or near the surface you want to deform. The curve does not have to be on the surface, but it should be in close proximity. You can create several curves to deform your selection and others to act as holders.
2
To change properties of the wire deformer before you create it, select Deformations→Wire Tool-❐. The Wire Options window is displayed. See “Specifying the effects of wire deformers” on page 379 for descriptions of the options. Turn Holders on in the Wire Options menu
4
Select Deformations→Wire Tool.
5
Select the geometry you want to deform and press the Enter key.
Basic Deformers
3
The prompt line leads you through the selection process. 6
If you are not creating holders, select all curves to use as wires and press Enter. Pressing Enter completes the creation of the wire deformer. You can lift the wires off the surface individually or in a group to deform the surface.
7
Select one curve to use as the wire associated with a particular holder and press Enter.
8
Select the curve to use as the holder for that wire and press the Enter key. If you have no holder for this wire, click off all surfaces to select nothing and press Enter.
9
Continue steps 6 and 8 until you have chosen each curve and its associate holder. Using Maya: Animation
377
Using Wire Deformers Creating a wire deformer You can associated a holder with more than one curve. To do so, pick one curve, press Enter, then select the holder, and press Enter. Pick the next curve, press Enter, then select the holder again, and press Enter. Continue this process for as many curves as you’d like to associate with the holder. 10 To finish the process, click away from all objects to select nothing and press Enter one more time. The final Enter indicates that you have finished the process. You can lift the wires off the surface individually or in a group to deform the surface. You can modify the curves of the wire deformer the same way you modify any curve, by toggling on (the Select by Component Type button) and using the transform tools to move the points.
Adjusting the influence The base wire influences the deformation as you pull the wire away from the geometry. In several cases, you may want to work with the base wire: •
to change the angle of the pull by transforming the base wire
•
to animate a wave motion through the geometry by moving the base wires in tandem with the primary wires
•
to bring the influence of the deformer closer to the surface if you see no result after transforming a newly created deformer The base wire is invisible by default. The following procedure describes how to make it visible so you can work with it.
To select the base wire: 1
Open the Outliner window by selecting Window→Outliner.
2
Select the base wire in the Outliner window.
3
Make it visible by choosing Display→Show→Show Selection. Now you can see it to transform it, parent it to the deformer, group it, or modify it. Keep the base wire in close proximity to the geometry or the surface will not be deformed.
4
378
You can hide the base wire again by selecting it and using Display→Hide→Hide Selection.
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers
Adding new wires to a deformer You can add wires to a deformer after you have created the deformer. You might want to do this if you forgot to include a particular curve or if you decide to change the effect of the deformer.
To add another wire to the deformer: 1
Select the curves you want to add to the deformer.
2
Shift-click on any wire in the deformer to indicate which deformer you want to add the curves to.
3
Choose Deformations→Wire Edit→Add to add the curves. The wires are added to the deformer set and base wires are created automatically.
Removing wires from a deformer You can delete wires from a deformer. You might want to do this if you have selected curves when you created the deformer that don’t belong, or have decided against keeping certain wires in the set.
1
Select the wires you want to remove.
2
Choose Deformations→Wire Edit→Remove to remove the wires.
Basic Deformers
To remove wires from the deformer:
The wire is removed from the deformer set; the curve remains.
Specifying the effects of wire deformers You can specify the following effects of wire deformers: •
the percentage of deformation—by individual curve in the deformer, by wire deformer as a whole, or by sections you mark on individual curve
•
the effect where curves cross—for all curves within a deformer
•
the shape of the deformation—for each curve or, in a different way, for the deformer as a whole You can set a wire deformer’s options before you create it, or edit its attributes after it has been created.
Using Maya: Animation
379
Using Wire Deformers Specifying the effects of wire deformers
To set wire deformer creation options: •
Select Deformations→Wire Tool-❐ to display the Wire Options window. The settings in the window apply to all wire deformers you create subsequently.
To edit wire deformer attributes: Select any wire on the deformer and choose Window→Attribute Editor to open the Attribute Editor.The wire attributes are displayed in the tab having the name of the wire deformer. By default, the name is wiren, where n is an integer.
380
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers
Where to find wire attribute information To set wire deformer attributes you use the Attribute Editor. The following figure shows some of the wire deformer’s attributes:
Basic Deformers
The Attribute Editor with wire deformer selected
Using Maya: Animation
381
Using Wire Deformers Specifying the effects of wire deformers To find information on each wire deformer attribute, see the following: Holders (Wire
“Limiting the region of deformation” on page 382
Options window only) Envelope
“Varying the deformation percentage” on page 389
Rotation
“Affecting the shape of the deformation” on page 387
Crossing Effect
“Controlling the effect where wires cross” on page 385
Local Influence
“Controlling the effect where wires cross” on page 385
Scale
“Affecting the shape of the deformation” on page 387
Dropoff Distance
“Affecting the shape of the deformation” on page 387
Locators (Param, “Varying the deformation percentage” on page 389 Percent, Envelope) Node Behavior
“Improving performance” on page 427
Limiting the region of deformation To prevent a region of the surface from deforming, you can use holders, edit the set of points affected by the wire deformer, or prune the deformation set. A holder is a curve that limits the region of the effect of the wire deformer. The surface deforms only between the holder and the wire deformer. You set specific curves to be holders when you create the wire deformer. With a holder, you can limit the deformation effects provided by a single influence wire. To limit a wire deformer’s entire region of deformation, you can edit the set of points affected by the deformer or prune the deformation set. To edit the set of points affected by the wire deformer, you select individual control vertices or points and add or delete them from the deformation set any time after you create the wire deformer.
382
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers To prune the deformation set, you perform a single-step pruning operation to permanently remove all unaffected points or control vertices from the deformation set.
Note You can also vary or limit the amount of deformation along the wire. See “Varying the dropoff and envelope along a curve” on page 390 for details. This section describes how to use holders. To edit or prune the deformation set, see Chapter 22, “Advanced Topics.”
Using holders If you want to limit the region of a wire’s effects, you can create curves called holders. Holders create deformation up to the point of the holder, regardless of the dropoff applied to the wire. They also define the region of the deformation. As with any curve, you can move a holder or change its shape.
Basic Deformers
Using Maya: Animation
383
Using Wire Deformers Specifying the effects of wire deformers
Influence wire Holder
Influence wire
Wire deformer with (top) and without (bottom) holder
To create a wire deformer with holders: For instructions on creating holders, see “To create a wire deformer with no holders:” on page 376.
Note Holders restrict the deformation to the geometry’s control vertices between the holder and the primary influence wire. If your geometry has a low number of spans, those control vertices may influence the geometry outside the holder as well, and you may see some deformation outside the holder.
384
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers
Controlling the effect where wires cross When two wires cross each other, you can determine whether the resulting deformation adds the effects of each wire or smooths the deformation using the Crossing Effect attribute. If the wires are at different distances from the geometry, you can control which wire influences the deformation more by using the Local Influence attribute. This section describes these two attributes.
Note Crossing Effect and Local Influence have an effect only on wires in the same deformer.
Crossing effect In regions where two wires cross, the crossing effect is the effect of the meeting of the wires on the deformation. In this sliding scale, 0 smooths the effect of the two wires and the maximum value of 1 adds the deformations of the wires. Use the Crossing Effect attribute to control the deformation of the crossing point of wires. Basic Deformers
Crossing effect values of 0 (left) and 1 (right)
Using Maya: Animation
385
Using Wire Deformers Specifying the effects of wire deformers
Local influence When more than one wire is influencing the same area of geometry, use the Local Influence attribute to control how tightly bound the geometry is to the closest wire. The greater the local influence, the more the surface around each wire attempts to stay with the wire. The local influence effect is visible when curves are at different distances from the geometry.
Local influence values of 0 (top) and 1 (bottom)
386
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers
Affecting the shape of the deformation You can determine how much of the surface is affected by the wire deformer by changing the Dropoff Distance attribute. The Scale attribute determines the shape of the deformation along the wire. The Rotation attribute determines the amount of shear tangency. This section describes these three attributes.
Dropoff Distance Use the Dropoff Distance attribute to set the region of influence around the wire. As the Dropoff Distance value increases, more surface components are affected by the deformation.
Basic Deformers
Dropoff distance values of 5 (left) and 1 (right)
Using Maya: Animation
387
Using Wire Deformers Specifying the effects of wire deformers
Scale While dropoff controls how much geometry is affected, the Scale attribute controls the strength of the wire’s attraction to the geometry it does affect. The scale value scales the geometry radially around the wire, while modulating the scaling by the dropoff.
Scale of 5 (left) and scale of 0 (right)
388
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers
Rotation If you plan to rotate the wire deformer, you can set the Rotation attribute according to the amount of shear or tangency you want for the deforming geometry.
You set the rotation for the wire deformer as a whole, not for individual curves on the deformer.
Varying the deformation percentage You can change how much effect the wires have on the geometry through two percentage settings: •
Envelope—controls the global scale of deformation (how much deformation as a percentage of the translation of the wire)
•
Dropoff—uses locators along individual wires to change the dropoff of how far the deformation effect reaches along sections of a wire This section describes these two ways of varying the percentage of the deformation.
Using Maya: Animation
389
Basic Deformers
Cone deformed with rotated wire deformer with rotations of 0 (shear) and 1 (tangent)
Using Wire Deformers Specifying the effects of wire deformers
Deforming geometry by setting envelope value You can deform the geometry less than the full movement of the wire deformer. The Envelope value is the percentage of deformation that gets applied to the geometry being deformed.
Envelope values of 1.0 (left) and 0.5 (right) This effect is useful when animating the deformation. For example, in using Set Driven Key you may have the movement of the deformer locked to the transformation of a driver (a controlling object); you can deform the geometry a percentage of the movement of the driver.
Varying the dropoff and envelope along a curve You can change the amount of deformation at specific points along a wire by using dropoff locators. These locators allow you to assign different dropoff values to different parts of a wire. You can move locators along the wire, place several on one wire, and scale them to increase or decrease their effect.
390
Using Maya: Animation
Using Wire Deformers Specifying the effects of wire deformers
Basic Deformers
Dropoff locators and their values Three attributes control the effect of these locators on a curve: •
Param—controls the locator’s position on the curve. (You can also move the locators directly.)
Using Maya: Animation
391
Using Wire Deformers Specifying the effects of wire deformers •
Percent—controls the effect the locator has on the wire’s dropoff. The wire itself has two implicit locators at each end with an effect of 1.0; other locators have an effect relative to the implicit locators.
•
Envelope—controls the percentage of deformation at the locator that gets applied to the geometry being deformed
To create a dropoff effect: 1
Create a wire deformer. See the instructions “To create a wire deformer with no holders:” on page 376 or “To create a wire deformer with holders:” on page 377.
2
Turn on
(the Select by Component Type button).
3
Turn on the pick mask for edit points by clicking Component Type: Parm Points button).
4
Set a locator along the curve by clicking on the curve and dragging.
(the Select by
A small, filled box indicates the position of the locator.
locator
5
Select Deformations→Wire Dropoff Locator to set the locator as a dropoff locator.
6
To create more locators, repeat steps 4 and 5. You can move locators with
7
(the Move manipulator).
To modify locator attributes, select the wire and choose Window→Attribute Editor to open the Attribute Editor. You may need to choose the wire node from the tabs to display the wire attributes rather than the curve transform node.
•
392
Open the triangle on the Locator heading and modify the Param, Percent, and Envelope values.
Using Maya: Animation
Using Wire Deformers Correcting jagged geometry
Correcting jagged geometry You may encounter a problem when you use wire deformations in which the deformed part of the geometry’s surface has a jagged or wavy edge. This occurs on NURBs surfaces, most often when you place wires at a diagonal across the control vertices and the spacing of control vertices is too large compared to the dropoff distance. In other words, you need more control vertices to support the dropoff value.
To smooth the wavy pattern, increase the dropoff or increase the detail of the surface. In general, the spacing of a geometry’s points should be at least as twice as dense as the Dropoff Distance value.
Using Maya: Animation
393
Basic Deformers
Aliasing problem with diagonal placement of wire
Using Wire Deformers Correcting jagged geometry
394
Using Maya: Animation
19
Using Cluster Deformers A cluster deformer creates a set whose members consist of selected points (NURBS CVs, polygonal vertices, or lattice points). You assign a percentage weight to each point, indicating how much you want each point to be affected by any translation, rotation, or scale of the cluster set. When you transform the cluster, the points are transformed according to the percentages you have specified. This chapter has the following topics:
•
“Understanding cluster deformers” on page 395
•
“Creating a cluster deformer” on page 396
•
“Specifying the effects of cluster deformers” on page 397
Understanding cluster deformers
Use clusters when you want to affect geometry in different amounts by one or more transformations. For example, you can create a cluster for a door so that when it is slammed, the middle bows slightly.
Using Maya: Animation
395
Basic Deformers
A cluster deformer applies a transformation to a geometry’s points (NURBS CVs, polygonal vertices, or lattice points) in such a way that you can adjust the percentage that each point is affected by the transformation.
Using Cluster Deformers Creating a cluster deformer
Creating a cluster deformer To create a cluster deformer: 1
Select the geometry you want to put in the cluster set.
2
To change properties of the cluster before you create it, select Deformations→Cluster-❐ to display the Cluster Options window.
3
Select Deformations→Cluster or click Create in the Cluster Options window. A cluster and its cluster handle are created. Maya identifies cluster handle with the letter C.
Editing cluster point percentages After you create the cluster, set up the percentages based on the amount that you want the points or control vertices to be affected. For some cases, you may set one percentage for the whole object. For example, a stick on moving water, in which the cluster handle is set to move at 50% the transformation of the water. At other times, you may want some parts of the geometry to be affected more or less than other parts. For example, you could have a scene with waving trees, where the treetops are affected the most, the trunk near the ground affected at 0%.
To edit cluster point percentages: Use the Set Editor to edit the percentages of cluster points. See the Maya manual Using Maya: Basics for information on using the Set Editor.
396
Using Maya: Animation
Using Cluster Deformers Specifying the effects of cluster deformers
Specifying the effects of cluster deformers You can change the effect of the cluster deformation in the Cluster Options window before you create a cluster deformer or in the Attribute Editor for individual cluster deformers after you create them.
To set cluster deformer creation options: Select Deformations→Cluster-❐ to display the Cluster Options window. The settings in the option window apply to all cluster deformers you create subsequently.
To edit cluster deformer attributes: Select the cluster handle and choose Window→Attribute Editor to open the Attribute Editor. Bringing up the Attribute Editor after selecting the cluster handle will load tabs for the cluster, the cluster handle, and the cluster handle shape. Most of the cluster attributes are displayed in the tab having the name of the cluster deformer. By default, the name is clustern, where n is an integer. Other attributes are listed in the tab for the cluster handle shape (named clusternHandleShape). Basic Deformers
Using Maya: Animation
397
Using Cluster Deformers Specifying the effects of cluster deformers
Where to find cluster attribute information To set cluster deformer attributes you use the Attribute Editor. Note that you can access cluster attributes from the Attribute Editor’s clustern and clusternHandleShape tabs (where n is an integer).
The Attribute Editor for a cluster deformer
398
Using Maya: Animation
Using Cluster Deformers Specifying the effects of cluster deformers To find information on each attribute, see the following: Mode: Relative
“Setting the cluster relative to parent transform” on page 399
Envelope
“Controlling the deformation percentage of the entire cluster” on page 399
Use Partial Resolution
“Improving cluster redraw performance” on page 400
Percent Resolution
“Improving cluster redraw performance” on page 400
Weighted Node
“Weighted nodes” on page 400
Origin
“Setting location of cluster handle” on page 400
Node Behavior
“Improving performance” on page 427
Setting the cluster relative to parent transform
For example, if you parent the cluster handle to a wrist joint and turn on its Relative attribute, you can rotate the shoulder without the cluster affecting the skin around the wrist, even though the wrist’s position changes. When you move the wrist itself, the cluster deforms the geometry as desired.
Controlling the deformation percentage of the entire cluster You can control the percentage of deformation for the entire cluster by setting the Envelope attribute. Use this as a simple equivalent to scaling the percentages of all the cluster points by the same amount. If you set the Envelope percentage and also percentages for individual cluster points, both percentages are taken into effect when transforming the cluster points.
Using Maya: Animation
399
Basic Deformers
Using the Relative attribute, you can set the cluster deformation to be active only when the direct parent of the cluster handle is transformed. This lets you create effects where a hierarchy of parent objects do not all affect the cluster deformation.
Using Cluster Deformers Specifying the effects of cluster deformers
Weighted nodes You can use another object for the cluster handle, the movement of which controls the cluster. Specify the object you want to use in the cluster handle shape node, under the Weighted Node attribute.
Setting location of cluster handle You can control the placement of the cluster handle (displayed as a “C”) by specifying the location of the cluster handle’s origin. To do so, from the clusternHandleShape tab of the Attribute editor, set the Origin attribute. The Origin attribute includes fields for X-axis, Y-axis, and Z-axis values.
Improving cluster redraw performance You can improve redraw performance by choosing an increment to which the cluster percentages are rounded. Use this when you don’t need full resolution of the cluster deformation (for example, if you’re working on another part of the scene and need only an approximation of the cluster deformation). If you have set the Use Partial Resolution attribute to partial, you can adjust the increment by which the cluster percentage is calculated. The Percent Resolution attribute rounds off the percentage to the next lowest increment. For example, at a Percent Resolution value of 5.00, the percentage you’ve set for any control vertex is rounded down to the lower 5% increment. A cluster percentage specified at 94 in the Set Editor is calculated as if it were 90% and one at 46% is calculated as 45%. Set Use Partial Resolution to full when you want an exactly accurate display of the cluster deformation.
Note If you have set the accuracy to partial, set the accuracy of each deformer to full before you render the scene if you want to render the deformation to render most accurately. See “Improving performance” on page 427 for performance options for all deformers.
400
Using Maya: Animation
20
Using Blend Shape Deformers The blend shape deformer lets you change the shape of one object into another. For instance, you can animate a human head mutating into a monster head, a mountain changing into a logo, or a stern face breaking into a laugh.
Basic Deformers
This chapter has the following topics: •
“Understanding blend shapes” on page 402
•
“Creating a blend shape” on page 402
•
“Using the Blend Shape Editor” on page 403
•
“Setting blend shape options” on page 408
•
“Editing which targets are in a blend shape” on page 414
Using Maya: Animation
401
Using Blend Shape Deformers Understanding blend shapes
Understanding blend shapes The blend shape deformer combines objects you’ve modeled previously. The object you start with is the base shape. An object the base shape blends into is a target shape. The resulting new object is the blend shape. The blend shape can be: •
one of several targets
•
a weighted mix of targets
•
animated through each target one at a time
•
a blend of targets that are objects in a hierarchy If you use more than one target, you can later use the Blend Shape Editor to combine the weight of their influence on the blend shape. You can also animate the base through each target sequentially. A few rules govern the objects you use as base and targets:
•
Blend NURBS objects or polygonal objects, not a mix of the two.
•
If your Origin is local and you duplicate your base to create a target, change the target’s shape by manipulating the CVs or vertices rather than its transform node attributes. Otherwise, blending the shape won’t have effect. For example, if the target is simply a rotated duplicate of the base, blending the shape won’t have any effect.
•
If the base and each target doesn’t have the same number of CVs, turn off Check Topology in the Blend Shape Options window.
Creating a blend shape You can create a blend shape after you’ve modeled a base and target(s) that meet the qualifications in the previous section.
To create a blend shape: 1
Select all targets. The order of selection for targets determines the order of sliders in the Blend Shape editor. If inbetweening mode is on, the order of selection of targets determines the order of progression between the inbetween shapes.
2
402
Shift-click to select the base.
Using Maya: Animation
Using Blend Shape Deformers Using the Blend Shape Editor You must select the base last. When selected last, it turns a different color than the other shapes—green by default. 3
Select Deformations→Blend Shape-❐. The Blend Shape Options window appears. Set the options as described in “Setting blend shape options” on page 408. Your option choices are saved for future use. To use the option settings last present in the Blend Shape Options window, you can instead choose Deformations→Blend Shape. This creates the blend shape without displaying the Blend Shape Options window.
4
In the Blend Shape Options window, click Create. This creates a blend shape node with the name blendShape1 or something similar. The node lets you use sliders to blend the base into the targets. The blend shape node’s name and sliders are visible when you open the Blend Shape Editor.
5
To alter a target’s influence on the base, use the Blend Shape Editor as described in the following section.
Using the Blend Shape Editor Basic Deformers
After you create a blend shape, use the Blend Shape Editor to deform and animate it into a weighted combination of targets.
To display the Blend Shape Editor: Select Window→Animation Editors→Blend Shape. Here’s an example display of the Blend Shape Editor with four targets for facial animation:
Using Maya: Animation
403
Using Blend Shape Deformers Using the Blend Shape Editor
Blend shape node name
Target sliders Targets
Though this example shows sliders for one blend shape, the Blend Shape Editor includes groups of sliders for each blend shape you create in your scene. Scroll or expand the Blend Shape Editor as necessary to see all sliders.
Setting target weights To set the influence of targets on the blend shape, you adjust each target’s weight slider. Each target’s name is in a box under the slider. If the entire name of a target doesn’t fit inside a box, drag left or right inside the box to see the undisplayed part. You can move each slider from 0 to 1. A setting of 0 means the target has no effect on the base. A setting of 1 makes the base identical to the target unless other targets also affect the base. You can enter values beyond the slider range in the weight boxes below the sliders. A value above 1 exaggerates the target’s influence. Negative values move the base in a direction opposite the target components. To reset all sliders to 0, click Reset All.
404
Using Maya: Animation
Using Blend Shape Deformers Using the Blend Shape Editor
With the target slider set to 0, the base doesn’t change shape.
With the target slider set to 1, the base becomes the target’s shape.
Basic Deformers
With the target slider set to -1, the base becomes the target’s mirror shape.
To adjust weight sliders: In the Blend Shape Editor, drag the slider or enter a value in the weight box.
or 1
Select the blend shape node.
2
Select Window→Attribute Editor.
3
Open the Weight section and drag the slider or enter a value in the weight box. Using Maya: Animation
405
Using Blend Shape Deformers Using the Blend Shape Editor
Settings keys for blend shapes In the Blend Shape Editor, you can set keys for the blend shape settings by: •
keying all sliders at the current settings
•
keying an individual target slider at 1. All others become 0, regardless of the displayed values Key all sliders at the current settings when the blend shape is a mixture of target settings. A key is set for the current value of each target at the current animation frame. Key an individual target at 1 if you want to animate targets without blending. For example, suppose each target is a mouth in a different phonetic position. Use this technique to animate the base as the targets successively, but not blended.
To key all target values: 1
Adjust the sliders to create the desired blend shape.
2
In Maya’s Time Slider, click the frame where you want to set the key.
3
In the Blend Shape Editor, click the Key All button. This sets keys for all targets at their current settings.
To key an individual target to 1: 1
In Maya’s Time Slider, click the frame where you want to set the key.
2
Set the target slider to 1.
3
In the Blend Shape Editor, click the Key button below the target. This keys the specified target to 1 and all others to 0. Maya does not use the values displayed in the unkeyed sliders.
Saving a blend shape as a new target After you create a blend shape from a mix of slider settings, you can save the shape as a new target for the base. After creating the new target, you can drag a single slider to deform the base object to that target.
To save a blend shape as a new target: 1
406
Set the target sliders to deform the base object.
Using Maya: Animation
Using Blend Shape Deformers Using the Blend Shape Editor 2
Select the base.
3
Click Add in the Blend Shape Editor. Maya creates a new target at the same location as the base. A slider for the target appears in the Blend Shape Editor. Move the new target away from the base. If in local mode, you can modify the target’s shape, for instance, by transforming its CVs or vertices. Use the new target slider to deform the base to the target.
Selecting a blend shape node When you create a blend shape, a blend shape node appears in the scene’s dependency graph upstream of the base object’s shape node. This node uses the target slider weight settings to create the blend shape from the base. The blend shape node name appears in the Blend Shape Editor above and to the left of the associated target sliders. To display the animation keys of weights in the Time Slider, Graph Editor, and the Dope Sheet, you must select the blend shape node.
To select a blend shape node:
Creating a blend shape node from the Blend Shape Editor You can create a blend shape node from the Blend Shape Editor instead of with Deformations→Blend Shape-❐. The new blend shape node gets chained sequentially by default. (If you want to put one blend shape node in conjunction with another one, change the deformer placement to parallel.)
To create a new blend shape from the Blend Shape Editor: 1
Select all targets.
2
Shift-click to select the base. You must select the base last.
3
Click New in the Blend Shape Editor. The new blend shape node and slider(s) appear in the Blend Shape Editor.
Using Maya: Animation
407
Basic Deformers
Click the Select button for the blend shape node in the Blend Shape editor.
Using Blend Shape Deformers Setting blend shape options
Setting blend shape options You can set blend shape options in the following locations: •
Blend Shape Options window—before you create a blend shape
•
Attribute Editor—for some attributes after you create a blend shape
•
Deformations→Blend Shape Edit—for attributes when you add a target to an existing blend shape. See “Editing which targets are in a blend shape” on page 414. The following table lists each option and page where it’s described. Origin
“Matching the position, rotation, and scale of targets” on page 408
Delete Targets
“Deleting a target’s geometry” on page 412
Deformation Order
“Choosing the blend shape deformation order” on page 413
Exclusive (Partition)
“Choosing the blend shape deformation order” on page 413
Scaling the influence of all targets You can scale the effect of all targets on the base with the Envelope setting. Valid values are from -2 to 2. A value of 2 doubles the effect of every target slider. A value of 0.5 decreases the effect by half. A negative value inverts the effect. If the cumulative effect of several targets deforms the base more than you want, try scaling down their effect by setting Envelope to a value between 0 and 1. You can set this option in two places: •
Blend Shape Options window—before creation only
•
Attribute Editor—when the Blend Shape node is selected
Matching the position, rotation, and scale of targets You can choose whether or not to move, scale, and rotate the base to the position, scale, and rotation of the targets.
408
Using Maya: Animation
Using Blend Shape Deformers Setting blend shape options Set Origin to one of the following: •
Local—changes the base to the targets, but without altering the base’s position, rotation, and scale. For facial animation, work in local space so the object being deformed doesn’t move to the target’s position. This most useful when you want your targets separated spatially so you can see them all but you don’t want the targets to be factored into the deformation.
•
World—changes the base to the shape, position, rotation, and scale of the targets. A value of 1 with one target makes the base copy both the target’s shape and location. The following figure contrasts the effect of Local and World settings. Each cone is blended into a single target. The targets are identical. Before blend shape Base
Target
After blend shape Local blend shape World blend shape
Note that the Attribute Editor displays an additional user option setting for Origin. This specifies that two attributes named baseOrigin and targetOrigin are used for the origin. See the online description for the MEL blendShape command for details on these attributes. You can set these attributes with a MEL setAttr command.
Using Maya: Animation
409
Basic Deformers
You can set Origin in the Blend Shape Options window before creation. You can also set it in the Attribute Editor when the Blend Shape node is selected.
Using Blend Shape Deformers Setting blend shape options
Chaining targets You can chain targets together so that dragging a single slider from 0 to 1 deforms the base through a sequence of targets. You might use this, for example, if you have one target face that shows a frown and another that shows a smile. By chaining the targets together, you can smoothly transition from a frown to a smile by using one slider. The value of the slider and the number of targets determine which target influences the base. With two targets, for example, dragging the slider blends the base into the first target from 0 to 0.5. From 0.5 to 1, the base changes from the first target to the second target. With three targets, dragging the slider blends the base into the first target from 0 to 0.333. From 0.333 to 0.667, the base blends from the first target to the second target. From 0.667 to 1, the base blends from the second target to the third target.
To chain targets: 1
Shift-click to select the targets in the sequence that you want to deform the base.
2
Shift-click to select the base. You must select the base last.
3
Select Deformations→Blend Shape-❐ to open the Blend Shape Options window.
4
In the Blend Shape Options window, turn on In-between and click Create.
Blending objects with different topologies You can blend shapes with the same or different number of CVs (or vertices). Before you create the blend shape, set Check Topology in the Blend Shape Options window as follows:
410
•
On—blends only objects with the same number of CVs. An error message is displayed if the objects have different numbers of CVs.
•
Off—blends objects with different numbers of CVs.
Using Maya: Animation
Using Blend Shape Deformers Setting blend shape options
With Check Topology off, the base changes into the target even if it has a different number of CVs. The blend shape is shown with slider weight 0.5.
Base
Target
If the objects have the same number of CVs but the CV order is different, Maya blends the shapes whether Check Topology is on or off. However, the position of base CVs will be transformed to the position of the target CVs. This change might cause the object to blend in a way you hadn’t expected. To ensure a smooth transition between base and target, make sure the order of CVs in both objects is the same.
To blend hierarchies, you must select the parent of the target hierarchy (or hierarchies) first and the parent of the base hierarchy last before creating the blend shape. The parent of each must be a transform. Each child in the base blends into its corresponding child in the target. The order of children in the Outliner (and Hypergraph) determines which children blend. In the following Outliner display, StandardBalls and WarpedBalls are group nodes. Each has three balls. If you blend StandardBalls into WarpedBalls, the three balls are blended based on their order in the Outliner.
Using Maya: Animation
411
Basic Deformers
In addition to blending individual objects, you can blend hierarchies of objects. Make sure both hierarchies have the same number of children and parenting relationships.
Using Blend Shape Deformers Setting blend shape options
Blue lines indicate which objects blend.
If necessary, use the Outliner to change the order of objects in the hierarchies. A common blend shape technique is to create duplicates of a base, deform the duplicates, then use them as targets. For example, you might make several copies of a face then alter the copies to create a smiling face, a frowning face, a crying face, and so on. If you use this technique, turn on Check Topology before creating the blend shape. This checks that the base and target hierarchy shapes have the same number of CVs. If the CVs are different and Check Topology is off, you might see, for instance, an eye blending into the nose. If Check Topology is on, the members of the hierarchies must have corresponding numbers of CVs.
Deleting a target’s geometry After you create a blend shape, you can delete the target geometry to free up memory and so improve the speed of Maya. When you delete a target, the blend shape node keeps the target deformations in memory and the target slider deforms the base as if the target remained. The geometry is removed. You save the most memory when you have complex targets that have only a few components that have moved slightly from the base. For complex targets that have many components moved from the base, you save the least memory. Don’t delete the targets if you want to modify their shapes or remove them from the blend shape. Remember that when you modify targets, Maya updates the resulting blend shape.
412
Using Maya: Animation
Using Blend Shape Deformers Setting blend shape options You can delete the geometry manually from your scene, or you can have Maya delete the targets when you create the blend shape.
To delete the geometry: Turn on Delete Targets in the Blend Shape Options window before you create the blend shape.
or Select and delete the target in the workspace or Outliner.
Choosing the blend shape deformation order You can choose the order in which the blend shape deformation is applied to an object deformed by additional deformers.
To choose deformation order: In the Advanced tab of the Blend Shape Options window, choose the order from the Deformation Order menu. The Before and Parallel options are often useful with blend shapes. Other choices are rarely used.
Parallel adds the effect of the blend shape and other deformers. For more information on the choosing the deformation order, see “Setting the deformation order option” on page 424.
Note The Advanced tab of the Blend Shape Options window also has an Exclusive option. If you turn this option on, Maya puts the blend shape CVs or vertices in an exclusive partition. Because Maya automatically creates appropriate partitions for you when you create blend shapes, you won’t typically use this option. For details on partitions, see “Understanding Partitions” in Using Maya: Hypergraph, Sets & Expressions.
Using Maya: Animation
413
Basic Deformers
Before is the Default option. It specifies that blend shape deformation occurs before other deformations.
Using Blend Shape Deformers Editing which targets are in a blend shape
Editing which targets are in a blend shape You can add, remove, or swap a blend shape’s targets. These actions let you alter the blend shape after its creation.
Adding a target to a blend shape You can add targets after you’ve created a blend shape. You might want to do this, for instance, to add more phonetic positions for a talking head you’re animating.
To add targets from the workspace: 1
Select the new target(s) and, last, the base of the blend shape.
2
Select Deformations→Blend Shape Edit→Add. Maya adds the target (or targets) to the blend shape. This creates a new slider in the Blend Shape Editor. The option settings are the same as the ones last present in Deformations→Blend Shape Edit→Add-❐.
To add targets from the Options window: 1
Select the base.
2
Select Deformations→Blend Shape Edit→Add-❐. The Blend Shape Add Options window appears.
414
3
If using multiple blendShape nodes on a given base shape, be sure to turn on Specify Node.
4
If using multiple blendShape nodes on a given base shape, be sure to enter the name of the blend shape node to which you want to add the target. (Use the Existing Nodes list to view the available nodes.)
5
You can set the remaining window options as described in “Setting blend shape options” on page 408. Your choices are saved for future use.
6
Click Apply.
Using Maya: Animation
Using Blend Shape Deformers Editing which targets are in a blend shape Maya adds the target to the blend shape. This creates a new slider in the Blend Shape Editor.
Note If you need to use many targets that are complex geometric shapes, you’ll use less memory and improve Maya speed if you add targets to the blend shape one at a time with the following procedure. (delete and add) Selecting all targets before creating the blend shape uses more memory.
Swapping targets in a blend shape You can swap two targets in a chain to rearrange the order of the blending as you drag the slider from 0 to 1. You can also swap unchained targets to move the sliders used most often next to each other.
To swap targets from the workspace: 1
Shift-select the two targets in any order.
2
Select Deformations→Blend Shape Edit→Swap.
1
Select one of the targets.
2
Select Deformations→Blend Shape Edit→Swap-❐. The Blend Shape Add Options window appears.
3
If using multiple blendShape nodes on a given base shape, be sure to turn on Specify Node.
4
If using multiple blendShape nodes on a given base shape, be sure to enter the name of the blend shape node to which you want to add the target. (Use the Existing Nodes list to view the available nodes.)
5
You can set the remaining window options as described in “Setting blend shape options” on page 408. Your choices are saved for future use. Note that Maya doesn’t use the Target Weight value in this window.
6
Click Apply. The targets are swapped.
Using Maya: Animation
415
Basic Deformers
To swap targets from the Options window:
Using Blend Shape Deformers Editing which targets are in a blend shape
Removing a target’s influence on a blend shape You can remove targets from a blend shape node. This deletes the target’s influence on the blend shape but doesn’t delete the target geometry from the scene. Note that the MEL command for removing targets is as follows: blendShape -e -rm -t .
To remove a target’s influence from the workspace: 1
Select the target.
2
Select Deformations→Blend Shape Edit→Remove.
To remove a target’s influence from the Options window: 1
Select Deformations→Blend Shape Edit→Remove-❐. The Blend Shape Add Options window appears.
2
Turn on Specify Node.
3
Enter the name of the blend shape node you want to remove the target from.
or Select the name from the Existing Nodes menu. 4
Turn on Specify Target.
5
In the Target Position text box, enter the target’s name. Don’t set the other options in the window. They are irrelevant when removing targets.
6
Click Apply. Maya removes the target’s influence from the blend shape.
416
Using Maya: Animation
21
Using Wrinkles A wrinke is combination of a cluster deformer with one or more wire deformers. The combination provides a cluster of wires you can use to deform a geometry. You can move the entire cluster of wires, or select individual wires to deform the surface. The effect is that of creating wrinkles in the geometry. This chapter has the following topics:
•
“Understanding wrinkles” on page 417
•
“Creating a wrinkle” on page 418
•
“Specifying the effects of wrinkles” on page 419
Understanding wrinkles Basic Deformers
Wrinkles are high-level tools that consist of a cluster deformer and one or more wire deformers.
For wrinkling a single NURBS surface, you can use three types of wrinkles: radial wrinkles, tangential wrinkles, and custom wrinkles. Radial wrinkles combine wires that branch from a central point, like spokes on a wheel. Tangential wrinkles combine wires that are roughly parallel. With custom wrinkles, you can combine wires you have created in the fashion that best
Using Maya: Animation
417
Using Wrinkles Creating a wrinkle suits the effect you would like to make. You can also use custom wrinkles for wrinkling many NURBS surfaces, as well as for wrinkling one or more polygonal surfaces or lattices. Note that because a wrinkle is a combination of a cluster with one or more wires, animating a wrinkle involves animating the attributes of the cluster and the wires and not attributes of the wrinkle itself.
Creating a wrinkle To create a wrinkle: 1
Select the geometry that you want to wrinkle.
2
To set the options of the wrinkle tool before you create it, select Deformations→Wrinkle Tool-❐. The Wrinkle Options window is displayed. See “Specifying the effects of wrinkles” on page 419 for descriptions of the options.
3
Set the options as described in “Specifying the effects of wrinkles.” A UV region of the surface is highlighted, allowing you to shape a wire cluster to use to deform the geometry.
4
Using the middle mouse button, shape the UV region. Scale it using the circle in the middle of each side; rotate it using the corners; and move it using the dot in the middle of the UV region.
5
Press Enter when the UV region fits the area of the geometry you want to deform. The letter “C” indicates the presence of the wrinkle’s cluster handle.
6
Using any transform tool, move the cluster handle (indicated by the letter “C”) to affect the surface. To move individual wires in the cluster, first select them using the Outliner window (use the wires under the cluster handle) and display them using Display→Show Selected. You can manipulate each wire as you do for the basic wire deformer: you can add locators, for example, or move the base wires.
418
Using Maya: Animation
Using Wrinkles Specifying the effects of wrinkles
Specifying the effects of wrinkles You can specify the effects of wrinkles by setting the wrinkle options before you create the wrinkle, and by editing the attributes of the wrinkle’s cluster deformer or wire deformers after you have created the wrinkle.
To set wrinkle creation options: Select Deformations→Wrinkle Tool-❐ to display the Tool Settings window. The settings in the window apply to all wrinkles you create subsequently.
To edit wrinkle attributes: To edit the wrinkle’s cluster deformer, see “Specifying the effects of cluster deformers” on page 397. To edit the wrinkle’s wire deformers, see “Specifying the effects of wire deformers” on page 379.
Where to find wrinkle option information To set the wrinkle options, use the Tool Settings window (select Deformations→Wrinkle Tool-❐).
Wrinkle Type
See “Wrinkle Type option” on page 419
Amount
See “Amount option” on page 420
Thickness
See “Thickness option” on page 420
Randomness
See “Randomness option” on page 420
Intensity
See “Intensity option” on page 420
Radial Branch Amount
See “Radial Branch Amount option” on page 420
Radial Branch Depth
See “Radial Branch Depth option” on page 421
Basic Deformers
To find information on wrinkle options, see the following:
Wrinkle Type option Wrinkle Type is the type of wrinkle that is created. There are three styles: tangential, radial, and custom. Tangential creates a number of parallel wires. Radial creates wires radiating outwards like spokes on a wheel. Custom Using Maya: Animation
419
Using Wrinkles Specifying the effects of wrinkles allows you to use wires you select to create your own wrinkle deformer. Note that because of the projection technique used to generate the wire curves, the tangential and radial types can only be applied to a single NURBS surface.
Amount option Amount is the number of parent wires in the wrinkle deformer (that is, disregarding branching wires). Applies to wrinkle deformers of the tangential and radial wrinkle type.
Thickness option Thickness specifies the surface dropoff (the area affected by each wire).
Randomness option Randomness specifies how close the wrinkle deformer conforms to the parameters set, in number of wrinkles, intensity, radial branch count and radial depth. The greater the number, the more randomness in the parameters.
Intensity option Intensity specifies the sharpness of the creases created by the wires. The minimum intensity of 0 specifies that the creases be smoothly defined, with the effect of rounding the creases. The maximum intensity of 1 specified that the creases be sharply defined, like steep ridges or valleys. For example, with an intensity of 0, the effect of a radial wrinkle deformer lifting away from a surface would be like that of a rising hill. With an intensity of 1, the effect of a radial deformer lifting away from a surface would be like sharply defined ridges.
Radial Branch Amount option Radial Branch Amount is the number of branches off each parent wire on the wrinkle deformer. This option is used only in Radial method.
420
Using Maya: Animation
Using Wrinkles Specifying the effects of wrinkles
Radial Branch Depth option Radial Branch Depth is the depth of the wire hierarchy (the number of levels of child branches off each wire). This option is used only in Radial method. Increasing the radial branch depth exponentially increases the number of wires.
Basic Deformers
Using Maya: Animation
421
Using Wrinkles Specifying the effects of wrinkles
422
Using Maya: Animation
22
Advanced Topics This chapter includes the following advanced topics:
•
“Deformer architecture” on page 423
•
“Viewing intermediate objects” on page 424
•
“Setting the deformation order option” on page 424
•
“Setting the exclusive option” on page 425
•
“Editing the deformation set” on page 426
•
“Pruning deformations” on page 426
•
“Improving performance” on page 427
Deformer architecture •
a deformer algorithm node Deformer
Algorithm node
sculpt deformer
sculpt
lattice deformer
ffd
wire deformer
wire
cluster deformer
cluster
blend shape deformer
blendShape
wrinkle
cluster and wire(s)
•
one or more influence objects either created for the deformation or already in the scene, now used for the deformation
•
a set (defines the geometry components being deformed)
Using Maya: Animation
423
Basic Deformers
When you create a deformer, Maya creates several dependency graph nodes and connects them to the selected shape. These nodes are as follows:
Advanced Topics Viewing intermediate objects By default, the deformer’s algorithm node is placed in the construction history of all objects that are selected. (See “Setting the deformation order option” on page 424 for information on changing the placement order.) If the object has no history, Maya creates a copy of the object and places it before the algorithm node. The copies, which are called intermediate objects, are hidden by default. (See “Viewing intermediate objects” on page 424 for information on displaying and hiding intermediate objects.)
Viewing intermediate objects After a deformation has taken place you can view the geometry prior to the deformation. A geometry prior to a deformation is called an intermediate object. Maya does not display intermediate objects by default.
To display intermediate objects: 1
Select the geometry being deformed.
2
Choose Deformations→Display Intermediate Objects.
To hide intermediate objects: 1
Select the geometry being deformed
2
Choose Deformations→Hide Intermediate Objects.
Setting the deformation order option All the basic deformers include the Deformation Order option. The deformer placement option is used to control the placement of the new deformer node within the dependency graph history of the selected shape. Doing so can allow you to customize the graph at creation time. For example, you might want to add a blend shape (blendShape node) in parallel to a cluster deformation.
To set the deformation order:
424
1
Display the options window for the tool you want to use to create a deformer. (For example, to display the Lattice Options window, choose Deformations→Lattice-❐.)
2
In the options menu, select the Advanced tab.
Using Maya: Animation
Advanced Topics Setting the exclusive option 3
From Deformation Order, you can choose Default, Before, After, Split, or Parallel. With Default, in most situations, the default deformer is placed immediately upstream in the graph in the history of the selected shape. With Before, the deformer is placed in the history of the selected shape. With After, the deformer is placed in the future of the selected shape. If the selected shape has no nodes in its future, a copy of the shape will be made, and placed downstream from the deformer. Split is the same as After, except that a copy of the shape will be made and placed downstream from the new deformer even if the selected shape has nodes in its future. With Parallel, the new deformer is added in parallel with any existing deformations on the shape.
Setting the exclusive option
Setting the exclusive option is particularly useful for creating two mutually exclusive clusters.
To create two mutually exclusive clusters: 1
Select the points that you want to be deformed by the first cluster.
2
Choose Deformations→Cluster-❐.
3
In the Cluster Option window, select the Advanced tab.
4
Click the box marked Exclusive.
5
Type in a name for your exclusive partition in the box marked “Exclusive Partition”. Since you are creating a new partition, you will not use the “Existing Partitions” menu.
6
In the Cluster Option window, click Create.
Using Maya: Animation
425
Basic Deformers
The exclusive option helps you to create non-overlapping deformations by ensuring that the sets belonging to each deformer are mutually exclusive. The mutual exclusivity of the deformers is accomplished by placing the deformer’s sets into a partition. The partition guarantees that the sets will continue to be mutually exclusive even if you edit the membership of the sets.
Advanced Topics Editing the deformation set 7
Select the points that you want to be deformed by the second cluster. If you accidentally select some points shared by the first cluster, they will automatically be removed from the first cluster at creation time in order to maintain mutual exclusivity.
8
If your cluster option window is not still open, open it up and go to the advanced tab. Make sure that the exclusive option is still selected, and select the name of your cluster partition from the “Existing Partitions” menu.
9
In the Cluster Option window, click Create.
10 When you are done creating the exclusive clusters, you probably want to reset the options in the option window to restore the standard options for the next time you create clusters.
Editing the deformation set To edit the deformation set: When you create a deformer, Maya puts the geometry you select in a set that is acted upon by the deformer. You can edit this set to change its membership. 1
Select the Component Mode icon to choose component mode.
2
Select the deformer node to select the deformation set.
3
Choose Deformations→Edit Membership Tool.
4
Use Shift-left mouse button and Ctrl-left mouse button to add or subtract from the deformation group. The control vertices change color to indicate whether they’re in the group or not: all members of the sculpt deformer group are the same color.
Pruning deformations You can remove unaffected points from the deformation set based on its current configuration of the deformation's attributes. Use this to avoid unnecessary calculations for points that are not being affected by the deformation.
To prune the deformation set: 1
426
Select the geometry from which you want to prune the deformation.
Using Maya: Animation
Advanced Topics Improving performance 2
Select Deformations→Prune Membership and from the cascading menu, select the deformer whose set you want to prune.
Note The pruning operation considers only the current position of each component in the undeformed and deformed versions of the geometry affected by the specified deformation. If you have animated attributes of your deformation, the pruning operation is performed based only on the current attribute values. This means that components that are potentially affected at other frames of your animation might get pruned out if they are unaffected at the current frame. Since a typical blend shape operation has weights of 0.0 for some target shapes at any point in time, this operation is especially dangerous when applied to blend shape deformations. For this reason, there is no menu item provided to prune membership for blend shape deformers. (You can still use this function through the command line.)
Improving performance
Disabling deformation effects You can turn off a deformer’s effect completely when you want fast redrawing and you do not need to see the deformation. There are three node states that let you control the visibility of the deformation: •
Normal—perform the deformation as usual
•
Has No Effect—display the geometry undeformed
•
Blocking—hide the geometry completely
Using Maya: Animation
427
Basic Deformers
When drawing deformed geometry, Maya has to do more calculations than on undeformed geometry, causing slower redrawing. You can speed up the redraw rate by disabling deformation effects. Additionally, you can edit Maya’s performance settings for deformers from the Perfomance Settings editor.
Advanced Topics Improving performance
To block deformation effects: Use the Node State option from history or from Attribute Editor.
Note For the deformation to appear in the rendered scene, you must reset the mode to Normal before rendering.
Editing performance settings You can edit Maya’s performance settings for deformers with the Performance Settings editor.
To edit performance settings:
428
1
Choose Window→General Editors→Performance Settings... .
2
Edit the settings in the Deformers panel.
Using Maya: Animation
Index
A adding targets blending shapes 86 animating blend shape sliders 78 facial expressions 82 lattice deformer transition 32
B base lattices 30 base shapes blending shapes 74 base wires 46 Blend Shape Editor 75 Blend Shape Options window 75
blending shapes 13, 73 adding targets 86 base shapes 74 blend shape node 75 by hierarchy 83 chaining targets 82 checking topology 82 creating 74 deformation order 85 deleting geometry 84 different numbers of vertices 82 Envelope 80 exclusive partition use 85 keying sliders 78 moving base to target 81 Origin 81 removing targets 88 rules for object choice 74 saving as new target 78 selecting blend shape nodes 79 setting options 80 sliders 76 swapping targets 87 target shapes 74 using duplicates 84 viewing intermediate objects 96
C chaining blend shape targets 82
cluster deformers 12, 67 creating 68 creating two mutually exclusive 97 Deformation Order 96 editing attributes 69 editing cluster point percentages 68 Envelope 71 Origin 72 Percent Resolution 72 Relative 71 setting creation options 69 Use Partial Resolution 72 viewing intermediate objects 96 Weighted Node 72 Cluster Options window 69
D
Using Maya: Modeling
101
Index
Deformation Order 96 blending shapes 85 deformers 7 architecture 95 basic deformers 7 blend shape deformers 13 cluster deformers 12 depedency graph nodes 95 editing deformation set 98 high-level deformers 7 improving performance 99 intermediate objects 96 lattice deformers 10 prunning the deformation set 98 sculpt deformers 9 wire deformers 11 wrinkles 14 deleting target geometry of blend shape 84
Index
E
L
R
Envelope blending shapes 80 wire deformers 62 Exclusive blending shapes 85
lattice deformers 10, 29 binding to skeleton 41 Center Around Selection 40 creating 32 Deformation Order 96 deforming 42 Divisions 35 editing attributes 33 Freeze Geometry Mapping 40 grouping base and deformed lattices 39 Local Mode 37 Locator 15 parenting lattice to geometry 39 resetting 38 resetting lattice points 39 resetting lattice tweaks 39 setting creation options 33 Use Partial Resolution 40 viewing intermediate objects 96 Lattice Options window 33 Locator lattice deformers 15
rearranging blend shape targets 87 removing blend shape targets 88
F facial expressions animating 82 flexors 7
H hierarchies blending 83
I influence wires 46 intermediate objects displaying 96 hiding 96
M moving base to target in blend shape 81
O Origin blending shapes 81 lattice deformers 15
102
Using Maya: Modeling
S saving blend shape as new target 78 scaling blend shape influence 80 sculpt deformers 9, 15 Center Within Selection 28 creating 17 Deformation Order 96 Dropoff Distance 26 Dropoff Type 26 editing attributes 17 Group Sculptor With Locator 28 grouping influence objects 28 Inside Mode 24 Max Displacement 25 Mode 19 positioning influence objects 28 setting creation options 17 viewing intermediate objects 96 Sculpt Options window 17 selecting blend shape nodes 79
T target shapes blending shapes 74, 76 using duplicates 84
Index
W wire deformers 11, 43 adding wires 51 correcting jagged geometry 65 creating with holders 49 creating with no holders 48 Dropoff Distance 59 dropoff locators 62 editing attributes 52 Envelope 62 Holders 54 removing wires 51 Rotation 61 Scale 60 setting creation options 52 viewing intermediate objects 96 Wire Options window 52 wrinkles 14, 89 Amount 92 creating 90 Deformation Order 96 editing attributes 91 Intensity 92 Radial Branch Amount 92 Radial Branch Depth 93 Randomness 92 setting creation options 91 Thickness 92 Wrinkle Type 91
Index
Using Maya: Modeling
103
Index
104
Using Maya: Modeling
Expressions
Expressions 3 Introducing Expressions About expressions
12
Where you create expressions
4 Quick Start
11
13
15
Preparing for the examples
15
Creating a simple expression
17
Controlling multiple attributes of an object Controlling attributes in two objects Controlling attributes conditionally Notes on the predefined time variable
5 Expression Syntax Expressions and MEL
32 43
46 47
49
Static attributes
49
Dynamic attributes
49
Custom attributes Attribute names
50 51
Data types of attributes
51
Assigning a value to an attribute Variables
28
45
Elements of an expression Attributes
23
55
56
Data types of variables Predefined variables Custom variables
57 57
59
Using Maya: Hypergraph, Sets & Expressions
3
Expressions Contents Constants
62
Arithmetic, logic, and relational operators Arithmetic operators
63
Relational operators
65
Logical operators Operator precedence
67 68
Conditional statements if statements
69
69
if-else statements
70
else if statements
71
General syntax rules
73
Comments in expressions Programming features
75
75
Notes for C programmers
75
Expression language keywords Flow control statements Flow control errors String usage
63
76
77
88
90
Shortcut assignment operators
91
Shortcut increment and decrement operators Arrays
93
Boolean symbolic constants Common expression errors
95
Error message format
95
Common error messages
6 Editing Expressions Finding expressions
97
99
99
Finding by expression name Finding by selected object
4
95
100 101
Using Maya: Hypergraph, Sets & Expressions
92
Expressions Contents Finding by item type
102
Using the Selection list
103
Filtering attributes from the Selection list Editing an expression in the text field Deleting and copying text
104
105
105
Clearing the expression text field
106
Reloading an expression’s previous contents Editing an expression with a text editor
106
Using an editor listed in the Editor menu
107
Using an editor not listed in the Editor menu Changing an editor’s operation settings Selecting an editor for default startup Creating a new expression Deleting an expression
106
109
110 110
111
112
Using attribute names in expressions
112
Using attribute name abbreviations
113
Omitting an object name in expressions
115
Combining the abbreviation techniques
116
7 Beyond the Basics
117
How often an expression executes
118
Using custom attributes in expressions
118
Displaying attribute and variable contents Reproducing randomness
123
123
Speeding expression execution
127
Reducing redundant expression execution
130
Removing an attribute from an expression
131
Disconnecting an attribute
132
Displaying disconnected attributes in expressions
132
Connecting an attribute to a symbolic placeholder
135
Using Maya: Hypergraph, Sets & Expressions
5
Expressions Contents Renaming an object
136
Executing MEL commands in an expression Understanding path names
137
140
Understanding unexpected attribute values Values after rewinding Increment operations
141
141 142
Data type conversions
143
8 Particle Expressions
147
Understanding particle expressions
148
Understanding creation expression execution Setting the dynamics start frame
149
Setting attributes for initial state usage Writing creation expressions
149 150
150
Understanding runtime expression execution Writing runtime expressions
152
153
Working with particle attributes
159
Adding dynamic attributes
159
Understanding per particle and per object attributes Understanding initial state attributes
160
162
Example of assigning to a dynamic per particle attribute Example of assigning to a dynamic per object attribute Assigning to a custom attribute
Using creation expression values in a runtime expression Working with position, velocity, and acceleration 178
Working with emitted particles Working with collisions
6
183
183
Working with specific particles
167
169
Assigning to a particle array attribute of different length
Working with color
164
189
Using Maya: Hypergraph, Sets & Expressions
175
172 174
Expressions Contents Assigning to vectors and vector arrays List of particle shape attributes
9 Functions
193
196
203
Understanding functions Function syntax
205
206
Data types
208
Understanding function examples in this chapter Limit functions
209
abs
209
ceil
210
floor clamp
210 211
min
212
max
212
sign
212
trunc
213
Exponential functions exp
214
log
214
log10
215
sqrt
215
Trigonometric functions cosd sin sind tan tand
214
214
pow
cos
208
216
216 218 219 224 224 225
Using Maya: Hypergraph, Sets & Expressions
7
Expressions Contents acos
225
acosd
226
asin
226
asind
226
atan
227
atand
227
atan2
227
atan2d
228
hypot
228
Vector functions
229
angle
229
cross
230
dot
231
mag rot
231 232
unit
233
Conversion functions
234
deg_to_rad
234
rad_to_deg
234
hsv_to_rgb
235
rgb_to_hsv
235
Array functions clear
236
236
size
237
sort
237
Random number functions gauss
239
noise
241
dnoise rand
242 243
sphrand
8
239
244
Using Maya: Hypergraph, Sets & Expressions
Expressions Contents seed
246
Curve functions linstep
249 249
smoothstep hermite
254
General commands eval
259
print
261
system
252 259
263
Other functions and commands
264
Using Maya: Hypergraph, Sets & Expressions
9
Expressions Contents
10
Using Maya: Hypergraph, Sets & Expressions
3
Introducing Expressions Expressions are instructions you type to control an object attribute over time. An attribute is a characteristic of an object, for instance, X scale, Y translate, visibility, and so on. Though you can create an expression to animate attributes for any purpose, they’re ideal for attributes that change incrementally, randomly, or rhythmically over time.
An expression gives the manta ray’s wings a fluid, rhythmic motion.
Expressions
Eric Saindon
Expressions are also useful for linking attributes between different objects— where a change in one attribute alters the behavior of the other. For instance, you can make the rotation of a tire dependent on the forward or backward movement of a car. This chapter has the following topics: •
“About expressions” on page 12
•
“Where you create expressions” on page 13
Using Maya: Hypergraph, Sets & Expressions
11
Introducing Expressions About expressions
About expressions Expressions offer an alternative to difficult keyframing tasks. In keyframing, you set the values of attributes at selected keyframes in the animation, and Maya interpolates the action between the keyframes. With expressions, you write a formula, then Maya performs the action as the animation plays. Expressions are often as simple as a few words or lines. In the following example expressions, note the variation in length and detail (rather than their purpose).
Example Ball.translateX = Cube.translateX + 4;
Example if (frame == 1) Cone.scaleY = 1; else { Cone.scaleY = (0.25 + sin(time)) * 3; print(Cone.scaleY + "\n"); }
Though many expressions look like math or a programming language, you don’t need to be a mathematician or programmer to learn how to use them. If you’re fond of programming, expressions offer unlimited animation techniques that would challenge the skill of keyframing experts. You can use an expression to animate any keyable, unlocked object attribute for any frame range. You can also use an expression to control per particle or per object attributes. Per particle attributes control each particle of an object individually. Per object attributes control all particles of an object collectively. You cannot apply an expression to an attribute already animated with any of these techniques:
12
•
keys
•
set driven key
•
constraint
•
motion path
Using Maya: Hypergraph, Sets & Expressions
Introducing Expressions Where you create expressions •
another expression
•
any other direct connection If you do so, you’ll see an error message in the Script Editor and the Command Line’s response area. Though you can’t control a single attribute with two of the preceding techniques, you can control one attribute with keyframes, another with an expression, another with a constraint, and so on. Also, you can use a single expression to assign values to several attributes of one or more objects.
Where you create expressions You create and edit an expression in the Expression Editor. There are several ways to start the Expression Editor: From the main menu bar or Hotbox, choose Window→Expression Editor.
•
From the Channel Box, click the right mouse button in an attribute text field and select Expressions.
•
From the Attribute Editor, click the right mouse button in an attribute text field and select Create New Expression, Edit Expression, or Expression Editor. You cannot start the Expression Editor from every attribute text field in the Channel Box and Attribute Editor. Use Window→Expression Editor if necessary.
Using Maya: Hypergraph, Sets & Expressions
13
Expressions
•
Introducing Expressions Where you create expressions The Expression Editor follows:
Expression text field
The expression text field expands as you type text, so you can write expressions of unlimited length. You can also edit expressions with a text editor such as jot by selecting it from the Editor pull-down menu above the text field.
14
Using Maya: Hypergraph, Sets & Expressions
4
Quick Start The easiest way to learn about expressions is to work through examples. For this reason, we provide the following introductory lessons. Expressions that control particle attributes are more complex than for other objects. For examples, see Chapter 8, “Particle Expressions.”
You can use an expression to link attributes in different objects—so a change in one attribute alters the behavior of the other.
Expressions
In this chapter, you’ll learn about the following topics: •
“Creating a simple expression” on page 17
•
“Controlling multiple attributes of an object” on page 23
•
“Controlling attributes in two objects” on page 28
•
“Controlling attributes conditionally” on page 32
•
“Notes on the predefined time variable” on page 43
Preparing for the examples A few preparatory steps will simplify your understanding of the examples in this chapter. Before starting the examples, do these steps:
To prepare for the examples: 1
Select Options→General Preferences. Using Maya: Hypergraph, Sets & Expressions
15
Quick Start Preparing for the examples The General Preferences window appears. Drag either side of the General Preferences window to expand its width. You must do this to display the Units tab in the window. 2
Click the Units tab.
3
In the Units tab, make sure Time is set to Film (24 fps). This makes your animation play at the default rate of 24 frames per second.
4
In the General Preferences window, choose the Animation tab.
5
Enter 0 for the starting frame of the Time Slider and the Range Slider, and enter 300 for the ending frame of the Time Slider and Range Slider.
Important For the lessons to work correctly, you must enter 0 for the starting frame of the Time Slider and Range Slider. Press your keyboard’s Enter key after each entry. Rewind the animation to frame 0. After doing the lessons, read “Notes on the predefined time variable” on page 43 for details on why the lessons require the starting frame to be 0. Specifying a range of 300 frames gives ample time to see the effects you’ll create in the examples. 6
In the General Preferences window, click Save and Close.
7
At the top edge of the workspace, select Shading→Smooth Shade All to display all objects you create in the scene with smooth shading. This will enhance the look of the objects you create in the examples.
8
16
From the menu bar, choose Window→Expression Editor to display the Expression Editor.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 9
Make sure these default Expression Editor menu options are selected: Select Filter→By Object/Attribute Name Object Filter→Selected Objects Attribute Filter→All “Finding expressions” in Chapter 6 gives details on these options.
Creating a simple expression The following steps show how to control an attribute of a single object. An attribute is a characteristic of an object, for example, X scale, Y scale, X rotation, and so on. In this example, you’ll learn how to stretch a sphere along its Y-axis by controlling its scaleY attribute as the animation plays.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. This creates a NURBS sphere with an X scale, Y scale, and Z scale of 1. In the Channel Box or elsewhere, name the sphere Ball.
3
Select Display→NURBS Smoothness→Fine to set Ball’s display smoothness to fine resolution. Maya displays the object with extra polygons to make it look smoother in the workspace. This doesn’t affect the underlying model’s geometry. It alters only its display.
4
Rewind the animation to frame 0.
Using Maya: Hypergraph, Sets & Expressions
17
Expressions
2
Quick Start Creating a simple expression
To create the expression: 1
Make sure Ball is selected.
2
Choose Window→Expression Editor to display the Expression Editor. The selected object’s name, Ball, is highlighted in the Objects list of the Expression Editor.
3
Enter ScaleBallHeight in the Expression Name box. Entering an expression name lets you find the expression easily in a later work session if you decide to alter it. Use alphabetical and numerical characters for expression names. If you use space characters or special characters such as a hyphen (-), Maya deletes them or replaces them with an underscore character (_) after you finish creating the expression.
4
Notice the Attributes list. It displays Ball’s keyable, unlocked attributes—the attributes you’ll most likely want to animate with an expression. Use the scroll bar to see the entire list.
5
Enter this expression in the expression text field:
Ball.scaleY = time + 1;
Enter the expression with the same upper and lowercase spelling shown. Entries in the expression field are type case sensitive. The semicolon (;) signifies the end of the expression statement. Each statement in an expression must end with a semicolon. The only exception is when the expression has a single statement. An error message appears in the Script Editor and Command Line’s response area if the expression has incorrect syntax or typing mistakes. Edit text the same way you edit other text fields in Maya.
18
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 6
Click Create to compile the expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. Clicking this button also executes the expression for the current frame. The expression sets Ball’s scaleY attribute to the value of time + 1. Ball.scaleY is the full name of the attribute. A period separates the name of the object and attribute. You must spell them with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. See “Using attribute names in expressions” in Chapter 6 for more details. The word time is a predefined variable in Maya that updates as an animation plays. It contains the elapsed number of seconds from the first frame to the current frame. The value increases with the increasing frame number. At the default animation playback rate of 24 frames per second, time has these values, rounded to four decimal places: Time (seconds)
0
0
1
0.0417
2
0.0833
3
0.125
24
1.0
240
10.0
Expressions
Frame
If you ever need to change the playback rate, you can do so by choosing Options→General Preferences. Expand the General Preferences window, display the Units folder, and choose the desired rate from the Time menu. Regardless of what animation playback rate you choose, you can find the time elapsed in the animation at any frame with this formula:
frame time = --------------rate For example, if the frame rate is 24 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.25. Using Maya: Hypergraph, Sets & Expressions
19
Quick Start Creating a simple expression If the frame rate is 30 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 30, which equals 0.0333. At frame 6, elapsed time is 6 divided by 30, which equals 0.2.
To see the result of the expression: 1
Rewind and play the animation. Ball’s scaleY attribute increases as the time increases: Frame
Time (seconds)
Ball.scaleY (time + 1)
0
0
1
1
0.0417
1.0417
2
0.0833
1.0833
3
0.125
1.125
24
1.0
2.0
240
10.0
11.0
Maya executes the expression each frame. This causes the object size to scale along its Y-axis, stretching its height during playback.
The scaling is smooth because the geometry stretches in synch with the small time increments of the animation playback.
20
Using Maya: Hypergraph, Sets & Expressions
Quick Start Creating a simple expression 2
Stop and rewind the animation. Rewinding the animation returns Ball to its original shape. This occurs because the expression executes with time equal to 0. The value of time + 1 is 1, the original scaleY value of Ball.
3
Play the animation. This repeats the increasing scale.
4
Stop and rewind the animation.
5
Close the Expression Editor window. This complete the steps to creating an expression. To further your understanding of expressions, we’ve included the following steps to show how to edit the expression you just completed.
To edit the expression: Suppose you decide that Ball scales too quickly as the animation plays. You can change the expression to see how the animation looks when you scale Ball half as fast. 1
Choose Window→Expression Editor to display the Expression Editor again. You can find the expression you created earlier by: remembering the name of the expression
•
remembering the name of the object and attribute you controlled with the expression
•
examining each expression in the scene that’s controlled by an expression In this example, you’ll find the expression ScaleBallHeight by its name. See Chapter 6, “Editing Expressions” for details on the other methods.
2
Choose Select Filter→By Expression Name.
3
Click ScaleBallHeight in the Expressions list. The expression appears in the expression text field.
Using Maya: Hypergraph, Sets & Expressions
21
Expressions
•
Quick Start Creating a simple expression
Ball.scaleY = time + 1;
4
Change the previous expression to this: Ball.scaleY = time/2 + 1;
Use the same editing techniques you use with other text fields in Maya. By dividing time by 2, you’ll make the Y scaling increase half as fast as with the previous version of the expression. 5
Click Edit to compile the modified expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. After being compiled, the expression executes for the current frame. Clicking the Edit button does the same action as clicking the Create button. The Create button exists only for new expressions. The Edit button replaces the Create button when you display an existing expression.
To see the result of the edited expression: 1
Play the animation. Ball scales its Y dimension half as fast as with the previous expression contents.
2
Stop and rewind the animation. Feel free to experiment with other values in the expression. This concludes the first example. Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
22
name an expression and type it in the expression text field
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object •
compile an expression to a form Maya can execute
•
work with the predefined variable time
•
find an expression you previously created
•
modify an expression
Controlling multiple attributes of an object You can use a single expression to control two or more attributes of an object. In the following steps, you’ll use an expression to increase the X, Y, and Z scale attributes of a sphere as the animation plays.
Expressions
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. This creates a NURBS sphere with an X scale, Y scale, and Z scale of 1.
2
In the Channel Box or elsewhere, name the sphere Planet.
3
Select Display→NURBS Smoothness→Fine to set the Planet’s display smoothness to fine resolution.
4
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
5
Rewind the animation to frame 0.
To create the expression: 1
Select the Planet object. Planet becomes the selected object in the Expression Editor.
2
In the Expression Editor, enter ScalePlanet in the Expression Name box. Using Maya: Hypergraph, Sets & Expressions
23
Quick Start Controlling multiple attributes of an object This names the expression so you can find it more easily later. 3
Enter these statements in the expression text field:
The expression has three statements. Each statement sets an attribute to the value of the predefined variable time. 4
Click Create to compile the expression. An error message appears in the Script Editor and Command Line’s response area if the expression has incorrect syntax. Planet disappears because clicking Create also executes the expression at the current frame after compiling. At frame 0, time is 0, so the value of the scaleX, scaleY, and scaleZ attributes becomes 0. Planet has no size, so it disappears.
To see the result of the expression: 1
Play the animation. The expression executes each frame, so Planet grows quickly as the animation plays.
24
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object
Because animation playback increases time, the value of Planet’s scaleX, scaleY, and scaleZ attributes increase at the rate of the increasing time. The object increases its scale until the last frame of the Time Slider plays. 2
Stop and rewind the animation. The following two series of steps show how to see the same result with other methods.
To see the result by linking attribute values: 1
Change the expression to this: Expressions
Planet.scaleX = time; Planet.scaleY = Planet.scaleX; Planet.scaleZ = Planet.scaleX;
2
Click Edit to compile the expression.
3
Play the animation. The expression works the same as the previous one. The first statement sets Planet.scaleX to the value of time. The second statement sets Planet.scaleY to the value of Planet.scaleX. Because you’ve set Planet.scaleX to the value of time, Planet.scaleY also has the value of time. You’re simply transferring one attribute’s value to another. The third statement also sets Planet.scaleZ to the value of the attribute Planet.scaleX.
Using Maya: Hypergraph, Sets & Expressions
25
Quick Start Controlling multiple attributes of an object The advantage of this expression is that if you assign a different value to Planet.scaleX in the first statement, the second and third statements automatically receive the new value. In other words, you’ve linked Planet.scaleY and Planet.scaleZ to the value of Planet.scaleX—whatever its value is. 4
Stop and rewind the animation.
5
In the first statement of the expression, divide time by 5 as follows: Planet.scaleX = time/5; Planet.scaleY = Planet.scaleX; Planet.scaleZ = Planet.scaleX;
6
Click Edit to compile the expression.
7
Play the animation. Planet increases its scale attributes one-fifth as fast of the previous expression. By assigning the value of Planet.scaleX to Planet.scaleY and Planet.scaleZ, Planet.scaleY and Planet.scaleZ were automatically assigned the value time/ 5 in the second and third statements.
8
Stop and rewind the animation. You can get the same result using a variable in an expression.
To see the results using a variable: 1
Change the expression to this: float $increment; $increment = time/5; Planet.scaleX = $increment; Planet.scaleY = $increment; Planet.scaleZ = $increment;
The expression has the same result as the previous one. The first statement defines a variable named $increment to be used as storage for the value of a time increment. You define it as a floating point number—a number that can have a decimal point. The second statement assigns $increment the value of time divided by 5. As the animation plays and the time increases each frame, the value of $increment increases by the value of time divided by 5. The $increment therefore increases in smaller units than time increases.
26
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling multiple attributes of an object The next three statements assign the contents of $increment to the three scale attributes of Planet. The scale attributes therefore receive the value of time divided by 5 each frame. This makes the object increase uniformly in scale slowly as the animation plays. 2
Click Edit.
3
Play the animation. The result is the same as with the previous expression
4
Stop and rewind the animation. You can make a change to the variable assignment in the second statement without altering the other statements.
To modify the variable: 1
Change the expression to this: float $increment; $increment = time * 2; Planet.scaleX = $increment; Planet.scaleY = $increment; Planet.scaleZ = $increment;
Click Edit.
3
Play the animation. Because you assigned time * 2 to the variable $increment, the expression sets all three attributes to the value of time * 2 as the animation plays. This makes the three scale attributes increase at a rate twice as fast as would occur if you assigned them the value of time alone.
4
Stop and rewind the animation. This concludes the example. Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
link multiple attributes of the same object with a single expression
•
use a variable you defined in an expression
•
modify a single assignment to an attribute without changing other statements
Using Maya: Hypergraph, Sets & Expressions
27
Expressions
2
Quick Start Controlling attributes in two objects
Controlling attributes in two objects You can write an expression to control attributes in two or more objects. In the following steps, you’ll create a cylinder and cone, then rotate each around its local X-axis as the animation plays. In other words, each object will spin around in place.
To see an object’s local rotation axes, select the object, then choose Display→Object Components→Local Rotation Axes.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Cone.
2
In the Channel Box or elsewhere, name it Cone.
3
Choose Primitives→Create NURBS→Cylinder from the Modeling menu.
4
In the Channel Box or elsewhere, name the cylinder Can. The exact translation and scale of Cone and Can is unimportant in this example. Give them roughly the same translation and scale as in the above figure.
5
Select both objects, then choose Display→NURBS Smoothness→Fine. This sets the display smoothness of both objects to fine resolution.
28
6
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
7
Rewind the animation to frame 0.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes in two objects
To create the expression: 1
Select Can. To control attributes in both objects, you can select either object to write the expression. In fact, any object or node in a scene can be selected when you write an expression to control an object other than a particle object. For details on creating expressions to control particles, see Chapter 8, “Particle Expressions.”
2
In the Expression Editor, enter RotCanAndCone in the Expression Name box. This names the expression so you can find it more easily later.
3
Enter this expression: Can.rotateX = time * 10; Cone.rotateX = time * 10;
This assigns Can’s rotateX attribute and Cone’s rotateX attribute to the value of time multiplied by 10. 4
Click Create to compile the expression.
To see the results: 1
Play the animation. Expressions
Each object rotates around its local X-axis by the degree value resulting from time * 10. After 1 second, for example, the rotateX attribute of each object is one degree times 10, or 10 degrees. After 2 seconds, it’s 2 degrees times 10, or 20 degrees. Maya works in degree angle units, by default. You can change the angular units to radians by choosing Options→General Preferences and displaying the Units folder.
Using Maya: Hypergraph, Sets & Expressions
29
Quick Start Controlling attributes in two objects With the animation playing at 24 frames per second, each object’s rotateX attribute has these values: Frame
Time
Can.rotateX (degrees)
0
0
0
1
0.0417
0.417
2
0.0833
0.833
3
0.125
1.25
24
1.0
10
240
10.0
100
The values in this chapter are rounded to four significant digits. The actual values might have many more digits. To see the degree value of Can.rotateX at different frames, select Can, display the Channel Box, and stop the animation at selected frames. The Channel Box updates its values after you stop the animation. To see the degree value of Cone.rotateX at different frames, select Cone instead of Can. The Channel Box displays values for the selected object. 2
Stop and rewind the animation. You can edit the expression to make Can rotate slower than Cone.
To get different results: 1
Change to the expression to this: Can.rotateX = time * 5; Cone.rotateX = time * 10;
2
Click Edit to compile the expression.
3
Play the animation. Can rotates half as fast as Cone as the animation plays.
30
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes in two objects
4
Stop and rewind the animation.
5
Close the Expression Editor window. This concludes the example. This example showed how to write a single expression to control attributes of two different objects. However, you could have written two expressions, one that rotates Can and one that rotates Cone. The advantage of creating separate expressions is that you’ll have two expression names, each presumably named after the object and attribute you’re controlling. Having two expression names makes it easier to find the expression that controls the desired attribute.
Before starting the next example, delete the scene and create a new scene.
Summary In this lesson, you learned how to: •
control rotateX attributes in two objects using the same expression
•
increase the rotation of each object in synch with animation time
•
rotate one object at half the speed of the other object
Using Maya: Hypergraph, Sets & Expressions
31
Expressions
The advantage of using a single expression to control the attributes is that all statements are in a single expression. You don’t need to edit two expressions.
Quick Start Controlling attributes conditionally
Controlling attributes conditionally You can write an expression that takes different actions depending on the value of attributes or variables it examines as an animation plays. In the following steps, you’ll increase the scale of a sphere for the first two seconds of animation, then stop scaling and move it in a global Y-axis direction for the remainder of the animation.
To prepare the scene: 1
From the Modeling menu, choose Primitives→Create NURBS→Sphere. By default, this creates a NURBS sphere at the origin with an X scale, Y scale, and Z scale of 1.
2
From the Channel Box or elsewhere, name the sphere Balloon.
3
Select Display→NURBS Smoothness→Fine to set Balloon’s display smoothness to fine resolution.
4
Display the Expression Editor and select Select Filter→By Object/Attribute Name.
5
Rewind the animation to frame 0.
To create the expression: 1
Select Balloon.
2
In the Expression Editor, enter RisingBalloon in the Expression Name box.
3
Enter this expression: if (time < 2) Balloon.scaleY = time;
This expression is an if statement. The if keyword causes the expression to make a decision based on a comparison of two or more items. In this case, the expression compares the value of time to the value 2.
32
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally
Important When you compare the value of time to a number in an expression, Maya interprets time as seconds rather than milliseconds, minutes, or any other unit of time. In the example, Maya interprets 2 as 2 seconds. The expression checks whether the value of time is less than two seconds. If so, it does the assignment Balloon.scaleY = time. If time is not less than two seconds, the assignment doesn’t occur. Notice the indentation of Balloon.scaleY = time under if (time < 2). Maya ignores all indentation, extra spaces, and blank lines between statements. We used the indentation to make the expression easier to read. You could have also written the expression as follows: if (time < 2) Balloon.scaleY = time;
This isn’t as easy to read. Consistent, organized spacing is a good habit to develop. This book shows examples of good spacing style. 4
Click Create to compile the expression. Balloon flattens. Expressions
The expression executes when you click the Create button. Because the animation is at frame 0, animation time is 0. Because time is less than 2, Maya sets Balloon.scaleY equal to the value of time, which equals 0. A scaleY value of 0 flattens the object in the Y dimension. 5
Play the animation. The flattened Balloon’s scale increases along its Y-axis. It inflates as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
33
Quick Start Controlling attributes conditionally
At 2 seconds, Balloon stops inflating. An expression executes each frame as an animation plays. The if statement sets the scaleY attribute of Balloon to the value of time each frame when the time is less than 2. When time equals 2 or more, the if condition is no longer true. The statement that follows it, Balloon.scaleY = time, no longer executes. The value of the scaleY attribute stays at the last value it had before time became 2, specifically, 1.9583. At 2 seconds of animation time and every moment thereafter, scaleY continues to be 1.9583. Recall that this example uses a frame rate of 24 frames/second. The time and Balloon.scaleY have these values at various frames: Frame
Time (seconds)
Balloon.scaleY (time)
0
0
0
1
0.0417
0.0417
2
0.0833
0.0833
3
0.125
0.125
24
1.0
1.0
47
1.96
1.9583
48
2.0
1.9583
49
2.04
1.9583
The if statement’s condition, (time < 2), is a comparison. The condition must be surrounded by parentheses to isolate it from assignment that follows it.
34
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally The < in the condition is a relational operator. A relational operator tests how one value relates to another. In the example, the < tested whether time is less than 2. Besides the < operator shown in this example, there are several other relational operators such as >, >=, ==, and so on. See “Arithmetic, logic, and relational operators” in Chapter 5. 6
Stop and rewind the animation. Balloon flattens again because the scaleY attribute becomes 0 when you rewind the animation. Time is 0, so scaleY is 0. You can make Balloon rise after it inflates by adding a second if statement to the expression.
To add another if statement to the expression: 1
Change the expression to this: if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time;
Click Edit to compile the expression.
3
Play the animation. Balloon inflates for 2 seconds. After 2 seconds, Balloon stops inflating and its position skips from a Y-axis position of 0 to 2. You’ll eliminate the motion skip in a later step. The second if statement increases the translateY position of Balloon after the animation time rises above two seconds. The >= symbols mean greater than or equal to. Whenever time is greater than or equal to 2, the expression assigns Balloon’s translateY the value of time. The translateY value therefore increases for the rest of your animation’s playback range. Notice that a semicolon ends each statement. Forgetting a semicolon after each statement causes a syntax error, and the changes you’ve made to the expression won’t take effect.
Using Maya: Hypergraph, Sets & Expressions
35
Expressions
2
Quick Start Controlling attributes conditionally
Important Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might make you believe your editing changes took effect. 4
Stop and rewind the animation. Balloon flattens but doesn’t return to the origin. (If Balloon has risen out of view, adjust your camera to see it.)
Balloon doesn’t return to the origin because the expression doesn’t assign Balloon a starting point for the beginning of the animation. 5
To make Balloon return to the origin, change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time;
The new first statement sets Balloon.translateY to 0 whenever time equals 0. The == symbols mean is equal to. In conditional statements, be careful to type == rather than =. The = symbol means assign the value to.
36
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally Note that you can put the three statements in any order in this example. When Maya plays each frame, it executes each statement in the expression in the order listed. In this example, the statements work independently, so their order doesn’t matter. We put the statements in the order of time execution because it’s easier to see the logic of the expression. If you ever need to change the expression, you’ll be able to grasp the expression’s actions more quickly. 6
Click Edit.
7
Stop and rewind the animation again. The flattened Balloon returns to its correct position at the origin.
8
Play the animation. Balloon inflates for two seconds, then rises. Expressions
As mentioned before, Balloon skips from Y-axis position 0 to 2 after two seconds of animation play. You can eliminate the skipping and make Balloon rise smoothly from the origin.
To eliminate the motion skip: 1
Stop and rewind the animation.
2
Change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; if (time >= 2) Balloon.translateY = time - 2;
3
Click Edit.
4
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
37
Quick Start Controlling attributes conditionally Balloon inflates for 2 seconds, then rises slowly with time from its position at the origin. When time is greater than or equal to 2, the translateY position of Balloon becomes 2 minus 2, which is 0. As time increases beyond 2 seconds, the translateY position increases in the same increments that time increases.
5
Stop and rewind the animation. The expression achieved the desired result, but it’s more complicated than necessary. You can use an if-else statement to make the statement more compact and easier to read.
To use an else statement instead of multiple if statements: 1
Change the expression to this: if (time == 0) Balloon.translateY = 0; if (time < 2) Balloon.scaleY = time; else Balloon.translateY = time - 2;
2
Click Edit.
3
Play the animation. The else keyword sets Balloon.translateY to time - 2 when (time < 2) is false. In English terms, the combination of the if and else statements says, “If time is less than two seconds, set Balloon.scaleY to the value of time. Otherwise (when time is greater than or equal to two seconds), set Balloon.translateY to time minus two.”
38
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally At any instant in the animation’s playback, either Balloon.scaleY = time executes or Balloon.translateY = time - 2 executes. Under no circumstances can they both execute. The else statement executes only when the if condition that precedes it is false. Note that we added a blank line between the first if statement and the if-else statement combination. This has no effect on the execution of the statements. We put it there to emphasize that the two if statements are unrelated. The first if statement executes whenever time equals 0. It is unrelated to the if-else statements. Using else statements instead of multiple if statements makes an expression simpler to read. If you use an if-else construction instead of a lengthy list of if statements, you’ll also improve the execution speed of the expression. This improves your animation’s playback and rendering speed. Either expression is valid. If using the if-else construction seems confusing, stick with multiple if statements. You can accomplish most expression animation tasks with several if statements strung after one another. 4
Stop and rewind the animation. You can refine the expression to make it even easier to read. Expressions
To make the expression easier to read: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time; } else Balloon.translateY = time - 2;
We removed this statement from the previous version of the expression: if (time == 0) Balloon.translateY = 0;
In its place, we put the statement Balloon.scaleY = time in a segment enclosed by the braces { and }. Maya evaluates both the statements between the braces if the condition (time < 2) is true. 2
Click Edit. Using Maya: Hypergraph, Sets & Expressions
39
Quick Start Controlling attributes conditionally 3
Play the animation. The animation plays exactly as before with the new expression. When the animation time is less than two seconds, not only does Maya set Balloon.scaleY to time, it sets Balloon.translateY to 0. Balloon has a position at the origin until the animation time is greater than or equal to 2 seconds. Setting Ball.translateY to 0 here instead of in a separate if statement makes the expression easier to read and comprehend. As in the previous version of the expression, if time is greater than or equal to 2, Maya executes the else statement. Note that you can put multiple statements between braces for an else statement, just as you do for an if statement.
4
Stop and rewind the animation. You can further refine the animation’s appearance by expanding Balloon more slowly.
To slow Balloon’s expansion: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2;
Only one statement is different, Balloon.scaleY = time * 0.6. The asterisk (*) multiplies time by 0.6.
40
2
Click Edit.
3
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
Quick Start Controlling attributes conditionally
The scaleY attribute increases at 60% of the value of time, so Balloon expands slower during playback. (The number 0.6 equals 60%.) By the time Balloon starts to rise, it has expanded to the size of a typical balloon. How do you know whether to multiply time by 0.6 or some other number? You don’t. In cases like this, you need to experiment. For example, you might multiply by various percentages such as 0.2, 0.5, 0.75, and finally 0.6. The 0.6 creates a life-like balloon shape at two seconds. 4
Stop and rewind the animation. You can further refine Balloon’s appearance by eliminating the flattened Balloon that appears at the origin when you rewind the animation. You can also scale Balloon at different rates along each of its three axes. Expressions
To further refine Balloon’s appearance: 1
Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; Balloon.scaleX = time * 0.5; Balloon.scaleZ = time * 0.5; } else Balloon.translateY = time - 2;
2
Click Edit. Balloon disappears from view because its scale attributes are 0. The scaleX, scaleY, and scaleZ attributes are 0 at frame 0 because time is 0. Any number multiplied by 0 is 0.
3
Play the animation. Using Maya: Hypergraph, Sets & Expressions
41
Quick Start Controlling attributes conditionally As time increases, the value of Balloon’s scale attributes increase. Because the expression sets scaleX and scaleZ to 50% of the value of time, these dimensions scale slower than scaleY, which is set to 60% of the value of time. Balloon scales faster in height than in width or depth. This is true for many real balloons.
4
Stop and rewind the animation. This concludes the example.
Summary Using an expression is a combination of logic and experimentation. Problem solving starts with breaking a task into smaller problems you can solve and later refine. In this lesson, you learned how to:
42
•
control an attribute conditionally with an if statement
•
use good spacing and indentation for expressions
•
use relational operators such as <, <=, and ==
•
use multiple if statements to control different conditions
•
use an if-else statement in place of multiple if statements to make an expression easier to read and comprehend
•
refine an expression with a combination of analysis and experimentation
Using Maya: Hypergraph, Sets & Expressions
Quick Start Notes on the predefined time variable In the preceding examples we didn’t include comments in expressions because we explained them line by line. When you write your own expressions, include comments with statements to help document how the expression works. This will help you or someone else understand how your expression works later if the need to enhance it arises. See “Comments in expressions” in Chapter 5.
Notes on the predefined time variable The lessons in this chapter use a starting frame number of 0. In your work, you’ll typically create an animation with a starting frame number of 1. Because the examples use Maya’s default frame rate of 24 frames per second, time is 0.0417 at frame 1. Because of this small offset from 0, the examples would have required more steps and instructions to work with frame 1 as the starting frame. For instance, in the first example of the chapter, suppose you set the starting frame of the animation to 1. The expression in the example follows: Ball.scaleY = time + 1;
This discrepancy means the Ball scaleY is larger than its scaleX and scaleZ attributes in the first frame of the animation. Though the difference is not substantial in this example, other cases might be more significant. To start your animation at frame 1 and get the same result as the example, you can subtract 0.0417 from the attribute: Ball.scaleY = (time - 0.0417) + 1;
When you rewind the animation, the expression sets Ball’s scaleY value to (0.0417 - 0.0417) + 1. This equals 1, its original scaleY value. When you use the predefined time variable, be aware of the starting frame number and the associated time value.
Using Maya: Hypergraph, Sets & Expressions
43
Expressions
If you rewind the animation, the expression executes and sets the initial value of Ball’s scaleY attribute to time + 1, which equals 0.0417 + 1, or 1.0417. Because Ball’s scaleY attribute was 1 when you created it, rewinding the animation sets scaleY to a value 0.0417 larger than its initial value.
Quick Start Notes on the predefined time variable After doing the lessons in this chapter, remember to change your Time Slider’s starting frame, ending frame, and frame rate to the desired values when you start other projects. To do this, select Options→General Preferences and display the appropriate tabs in the General Preferences window.
44
Using Maya: Hypergraph, Sets & Expressions
5
Expression Syntax Expressions use the syntax of the Maya Embedded Language (MEL). Though MEL is a scripting language, you’ll find the syntax easy to learn even if you’ve never programmed. Mastering the rules of syntax is essential to writing expressions without errors.
Tristan Ikuta
This chapter describes the following topics: •
“Expressions and MEL” on page 46
•
“Elements of an expression” on page 47
•
“Attributes” on page 49
•
“Variables” on page 56
•
“Constants” on page 62
•
“Arithmetic, logic, and relational operators” on page 63
•
“Operator precedence” on page 68
•
“Conditional statements” on page 69
•
“General syntax rules” on page 73
•
“Comments in expressions” on page 75 Using Maya: Hypergraph, Sets & Expressions
45
Expressions
You can use an expression to rotate each child joint based on the root joint’s keyframed rotation.
Expression Syntax Expressions and MEL •
“Programming features” on page 75
•
“Common expression errors” on page 95
Expressions and MEL Expressions have a different purpose from MEL commands and MEL scripts. You enter a MEL command to do a single action, for example, to create a sphere. A MEL script is a list of commands you create to do a sequence of actions, for instance, create a wall-shaped object and apply a brick texture to it. Because you store a MEL script in a file on disk, you can run a script in different scenes and different work sessions, whether today or next year. An expression animates one or more attributes over time in a single scene. By default, an expression executes each frame as an animation plays. After you create an expression, it executes whenever you play the animation— including when you play the animation after saving, closing, and reopening the scene. A MEL command or script is not part of a scene after you execute it. You must execute it again to repeat the action. Sometimes it’s useful to exectute MEL commands and scripts in expressions. See “Executing MEL commands in an expression” on page 137 for details. Action
Typical use
MEL command
Does one action
MEL script
Does several actions
Expression
Animates attribute values as an animation plays
The following pages describe expression syntax elements such as arithmetic operators you can use to set and compare attributes. If you have trouble understanding the syntax descriptions, refer to a C programming guide for beginners. Except for attribute names, the syntax elements have the same definitions as their counterparts in C. Attribute names do not exist in C. If you’re familiar with a programming language such as C, Pascal, or Basic, be sure to see “Programming features” on page 75.
46
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Elements of an expression
Elements of an expression An expression is made of one or more statements. Statements follow the rules of algebra, so they’ll seem familiar if you’ve studied math. Each statement has several elements as in the following example: Assignment operator Arithmetic operator Attribute name
Function Constant
Ball.rotateZ = sin(time) + 6;
Terminator
Statement Variable
Detailed explanations follow the summary definitions: Attribute name The name of the attribute set by the statement. In the
example, Ball.rotateZ is the attribute name of the rotateZ attribute of an object named Ball. Assignment operator
A special word that you provide with an entry called an argument. In this example, the argument is time. Based on the value of the argument, Maya does a calculation for the function and returns a new value or takes some other action. In the example, the function sin(time) returns the sine of the value of time, which evaluates to a number between -1 and 1. Maya has many convenient built-in functions and commands that do math calculations, conversions, and so on. See Chapter 9 for details.
Using Maya: Hypergraph, Sets & Expressions
47
Expressions
Function
The = to the right of an attribute name. This symbol assigns the attribute the result of the statement on the right side of =. In the example, Ball.rotateZ receives the value of the statement sin(time) + 6. (Ignore what this assignment does; it’s for illustration only.) You can also use = to assign a value to a variable.
Expression Syntax Elements of an expression A variable is a symbolic name that stands for a changing value. You can assign a value to a variable or read a variable’s value. The variable time is a predefined Maya variable that contains the animation time at the current frame. You can read but not set the value of time.
Variable
Arithmetic, logic, or relational operator An operation such as + or < (less than). Constant
An unchanging number, for example, 6.1 or 90.
Terminator
A semicolon (;) that marks the end of a statement. An expression can have an unlimited number of statements. You must end each statement with a semicolon.
Each expression usually has an attribute name, assignment operator (=), expression value assigned to the attribute, and a statement terminator (;). Other elements are optional.
Example Here’s an expression with the fewest elements possible: Value assigned
Ball.scaleY = 5;
The expression has an attribute, assignment operator (=), value assigned to the attribute, and a statement terminator (;). The expression sets Ball’s Y scale to 5 grid units. When you play the animation, Ball’s Y scale stays fixed at 5 regardless of the Y scale value you gave it when you created it.
48
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes
Attributes An attribute is a characteristic of an object or other item in a scene. There are many ways to set attributes in Maya—with the Attribute Editor, Channel Box, menu selections, and of course, expressions. You can set attributes to control virtually anything in your animation. There are three types of attributes you work with in Maya: •
static
•
dynamic
•
custom Static and dynamic attributes have a predefined purpose. They are standard attributes Maya provides for objects and items that make up a scene. Custom attributes are attributes you define for an object.
Static attributes Static attributes are attributes an object has by default. They exist the moment you create the object and throughout its lifetime.
Expressions
For example, the transform node of a NURBS sphere has static attributes scaleX, scaleY, scaleZ, rotateX, and so on. You can set the values of these attributes with the Attribute Editor, Channel Box, expressions, and other techniques after you create the object.
Dynamic attributes Dynamic attributes have predefined names and purposes, but Maya adds them to an object in response to your user interface selections. For example, suppose you create a particle object and display its particle shape folder in the Attribute Editor. If you click one of the following buttons in the Add Dynamic Attributes section of the Attribute Editor, Maya adds a dynamic attribute to the node:
Clicking the General button lets you add a custom attribute (see the next topic). Clicking any of the other buttons lets you add one or more dynamic attributes with names that are the same or similar to the button name. Using Maya: Hypergraph, Sets & Expressions
49
Expression Syntax Attributes An object has no dynamic attributes unless your actions cause Maya to add them to the object. By adding only required attributes, Maya runs faster. When you add a dynamic attribute to an object, the attribute appears in the Attribute editor for the selected object or node.
Note Because soft body geometry is a particle shape node coupled with geometry, a soft body has the same static and dynamic attributes as a particle object.
Custom attributes Custom attributes are attributes you optionally add from the New folder of the Add Attribute window.
50
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes Such attributes have no direct effect on any characteristic of an object. They’re often used to control a combination of other attributes. You might also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes. When you add a custom attribute to an object, it appears in the Attribute Editor and Channel Box for the object or node. Though custom attributes are dynamically added to an object, we refer to them as custom to distinguish them from the built-in dynamic attributes. See “Assigning to a custom attribute” in Chapter 8 for details on how to add and use a custom attribute.
Attribute names Static, dynamic, and custom attributes follow the same naming conventions and represent the same types of data. A full attribute name has this format: object.attribute where object is the name of the object node, and attribute is the name of the attribute. A period (.) separates the name of the object and attribute.
See “Using attribute names in expressions” in Chapter 6 for more details.
Example Ball.scaleY
Data types of attributes Each attribute has a data type that specifies the type of values you can use to control it in an expression. This is true for static, dynamic, and custom attributes.
Using Maya: Hypergraph, Sets & Expressions
51
Expressions
You must spell the object and attribute name with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. You cannot spell attribute names with the common English spellings shown in the Attribute Editor or by default in the Channel Box.
Expression Syntax Attributes Attributes you’ll work with in expressions have these data types: Data type
Meaning
Example attribute
Example data
float
floating point numbers
Balloon.scaleY
-2.3333333333
integer
signed whole numbers
Ball.sections
16
Boolean
on or off selection
Ball.visibility
on
The most common attribute data type is floating point. In mathematics, floating point numbers are also called real numbers. Often, such numbers have a decimal point. Booleans are also common data types in attributes. Integer data types are rarely used. Particle shape nodes have these additional attribute data types: Data type
Meaning
Example attribute
Example data
vector array
array of vectors
FireShape.position
<<3.2, 7.7, 9.1>> <<4.5, 9.2, 3.1>> <<3.8, 4.4, 2.1>>
float array
array of floating point numbers
FireShape.lifespan
1.333 1.666 2.333 1.333
Note Scientists often refer to a vector as a quantity that specifies both a magnitude and direction. In Maya, a vector is simply a related group of three floating point numbers that set an attribute or variable.
52
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes Vector array data types are useful for animating position, velocity, acceleration, color, and other particle attributes made of three components. Float array attributes are useful for setting lifespan, opacity, and other particle attributes that have a single number value. Attributes having a vector array or float array data type are also called per particle attributes. See Chapter 8 for details on working with particle attributes. If you have programming experience, note that for vector array data types, Maya represents the specified attribute for each particle of the object with a single element of an array. Each element is made of three floating point numbers. In a float array, Maya represents the specified attribute for each particle with a vector array element that’s a floating point number.
Note In expressions, you must type a vector in double angle brackets (<< >>). For example, type <<3,0,5>> for a vector having 3, 0, and 5 as its left, middle, and right component.
Data types of static and dynamic attributes
Using Maya: Hypergraph, Sets & Expressions
Expressions
Static and dynamic attributes have predefined data types. To learn the attribute’s data type, select the node containing it. In the Attribute Editor, find the attribute name and examine its data format.
53
Expression Syntax Attributes Here’s an example display of attributes with floating point, Boolean, and integer data types:
Floating point
Boolean Integer
A floating point attribute shows a value that includes a decimal point. Most numerical attributes in Maya are floating point. A Boolean attribute has a checkbox or other user interface item for turning it on or off. An integer attribute has no decimal point. Integer attributes are rare in Maya. The data type of an attribute limits what type of value you can enter for the attribute in the Attribute Editor and in expressions. For example, because a directional light’s Depth Map Filter Size attribute is an integer, you cannot enter a decimal point in its text entry box or assign it a decimal quantity in an expression. For a floating point attribute, you can omit the decimal point. The Attribute Editor automatically inserts a decimal point in the attribute’s text field after you press the Enter key. For example, if you type 3 for a floating point entry, the Attribute Editor replaces 3 with 3.0000.
54
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Attributes An expression also automatically converts an integer to a floating point value when appropriate. See “Data type conversions” in Chapter 7 for details. Only particle objects, not geometric objects, have vector array and float array attributes. The static vector array attributes for particle objects are position, velocity, and acceleration. These are also called per particle attributes because you can set the attribute for each particle to different values. Maya has other attribute data types that are irrelevant to the use of expressions. For example, Maya has a matrix data type that is useful only in MEL scripting and API programming.
Data types of custom attributes When you add a custom attribute to an object with Modify→Add Attribute, you choose whether its data type is floating point, integer, Boolean, or vector. Vector attributes are commonly used with particle shape nodes.
Assigning a value to an attribute You assign a value to an attribute using the = assignment operator. Static and dynamic attributes have data types established by Maya. You do not define their data type.
You can assign a value to any attribute. If the attribute is dynamic or custom, though, you must add the attribute to the object before you can assign it a value in an expression. Become familiar with the purpose of an attribute by working with it in the Attribute Editor, Channel Box, or other parts of Maya before assigning it a value in an expression. It’s best to know the behavior you can expect from the attribute in case you write your expression incorrectly.
Note For rigid bodies, you can read but not write the velocity, angularVelocity, and force attributes.
Using Maya: Hypergraph, Sets & Expressions
55
Expressions
Because you choose the data type of custom attributes when you add them with Modify→Add Attribute, you do not define their data type either.
Expression Syntax Variables
Assigning to a float or integer attribute An assignment operation is a statement, so you must terminate it with a semicolon (;).
Examples Cone.scaleY = 5.3;
This assigns 5.3 to the floating point scaleY attribute of Cone. Ball.translateY = time;
This assigns the value of time to the floating point translateY attribute of Ball. Ball.scaleX = Ball.scaleY = Ball.scaleZ = 2;
This assigns 2 to the floating point scaleX, scaleY, and scaleZ attributes of Ball. As the example shows, you can use an assignment operator several times in a statement to set multiple attributes to the same value.
Assigning to a vector attribute You can assign values to all three components of a vector attribute, or just to a single component. See “Assigning to vectors and vector arrays” in Chapter 8 for details on assigning values to vector attributes. Only particle shape nodes have vector attributes. Note that you cannot assign a vector to three related scalar attributes such as scaleX, scaleY, and scaleZ. For example, you can’t do this: Ball.scale = <<1,2,0>>;
You must assign to each attribute separately: Ball.scaleX = 1; Ball.scaleY = 2; Ball.scaleZ = 0;
Variables A variable is a symbolic name that stands for a constant or changing value. There are two types of variables, predefined and custom. Maya creates and maintains predefined variables. Custom variables are variables you can create to store data in an expression.
56
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables Keep in mind that attributes, not variables, set object and component behavior in Maya. You can use variables to as temporary storage for working with the attributes.
Data types of variables Variables can be one of these types of data: Data type
Meaning
Examples
Defining keyword
float
floating point numbers
392.6, -0.667
float
integer
signed whole numbers
10, -5, 0
int
vector
vector made of three floating point numbers
<<3.2, 7.7, 9.1>>
vector
string
one or more characters
“What’s up, chief?”
string
The most common data type of variables is floating point. Integer data types are rarely used. Booleans are commonly used in attributes, but not allowed in variables. Vector variables are useful in expressions for particle shape attributes.
For a custom variable you create in an expression, you must declare the data type as described in “Custom variables” on page 59.
Predefined variables Maya maintains values in two predefined variables as an animation plays: Variable
Contents
Data type
frame
number of frames the animation has played
float
time
time in seconds the animation has played
float
Using Maya: Hypergraph, Sets & Expressions
57
Expressions
Animators with programming experience sometimes use string variables. Quote marks (" ") are required with strings. See “String usage” on page 90 for details.
Expression Syntax Variables Your expressions can read, but not set, the value of time and frame. These variables are floating point values that are useful for animating an attribute as an animation plays. The time updates as an animation plays. It contains the elapsed number of seconds from the first frame to the current frame. The value increases with the increasing frame number. At the default animation playback rate of 24 frames per second, time has these values, rounded to four decimal places: Frame
Time (seconds)
0
0
1
0.0417
2
0.0833
3
0.125
24
1.0
240
10.0
If you need to change the playback rate, choose Options→General Preferences. Expand the General Preferences window, display the Units folder, and choose the desired rate from the Time menu. Regardless of what animation playback rate you choose, you can find the time elapsed in the animation at any frame with this formula:
frame time = --------------rate For example, if the frame rate is 24 frames/second, and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.25. If the frame rate is 30 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 30, which equals 0.0333. At frame 6, elapsed time is 6 divided by 30, which equals 0.2.
58
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables There’s an advantage to writing an expression using the value of time rather than frame: You won’t need to modify your expression if you change your animation’s frame rate. Note that time is always 0 at frame 0. As each frame plays, the time increases in increments resulting from the frame rate. It’s impossible to set time to a value other than 0 at frame 0. If you set Maya’s frame range to begin at a negative number, time has a negative value.
Examples Ball.translateY = time/2;
This sets the Ball’s Y translation equal to the value of time divided by 2 as the animation plays. This make the Ball move in a Y direction as the animation time increases. Ball.scaleY = frame/2;
This sets the Ball’s Y scale equal to the value of frame divided by 2 as the animation plays. The Ball scales along its Y axis as the animation frame number increases.
Custom variables
Though programming languages use such variables abundantly, you might not need to use them at all in many expressions.
Declaring variables Each custom variable name must begin with a dollar sign character ($). After the $, you can use alphabetical, numerical, and underscore characters. You cannot include spaces in the names. Variable names are type case sensitive. In other words, $temp is a different variable name than $Temp.
Using Maya: Hypergraph, Sets & Expressions
59
Expressions
You can declare and use variables to store a constant or changing value. These work like their counterparts in programming languages and spreadsheet programs.
Expression Syntax Variables
Examples float $object_height;
This declares $object_height as a floating point variable. int $counter;
This declares $counter as an integer. vector $top_velocity;
This declares $top_position as a vector variable.
Assigning a value to an integer or float variable To assign a value to a variable, you use = as an assignment operator. An assignment operation is a statement, so you must end it with a semicolon (;).
Examples float $counter = 5.3;
This declares a floating point variable named $counter and gives it an initial value of 5.3. $height = 6;
This declares a floating point variable named $height and gives it an initial value of 6. This example shows you can skip declaring the variable’s data type. When you assign a variable a value, Maya assumes the variable is floating point unless you specify a different data type. $pi = 3.1415927; $twist = $pi;
These statements show you can assign the value of one variable to another variable. The first statement assigns 3.1415927 to $pi. The second statement assigns the contents of $pi, 3.1415927, to $twist.
60
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Variables
Important If you misspell an existing declared variable name and assign it a value, a syntax error won’t be generated for the undeclared variable. Because Maya automatically provides a data type for an undeclared variable if it’s on the left side of the assignment operator, the misspelled variable will be interpreted as a newly added variable. Undeclared variables on the right side of the assignment operator do generate error messages. Check spellings of variables if your expression isn’t working as expected. In the following example, the misspelling in the final statement generates an error but not the misspelling in the statement before it: int $start; int $end; int $interrupt; $starrrt = 1; $end = $interrupppt;
Assigning a value to a vector variable You can assign values to all three components of a vector variable, or just to a single component. Expressions
See “Assigning to vectors and vector arrays” in Chapter 8 for details on assigning values to vector variables. Such variables are useful for working with particle shape node attributes.
Using custom variables globally Typically, you’ll use variables within a single expression. If you want to create and maintain a custom variable in one expression, but use it in another expression, you must declare it as a global variable.
Example global float $counter;
You can thereafter set or read the value of this variable in any other expression in the scene. If you create a variable with the same name in two expressions, the two variables are separate and unrelated. For example, suppose you create a variable named $timer in two expressions. Assigning a value to one of the $timer variables has no effect on the other’s value. Using Maya: Hypergraph, Sets & Expressions
61
Expression Syntax Constants If you declare and initialize a global variable in a single statement, you can initialize it to a numerical constant or string only.
Examples global float $counter = 3;
This initializes $counter to 3. global float $counter = time;
This causes an error because time is a variable. If you declare and initialize a global variable in a single statement, the statement executes only when Maya compiles the expression. Maya compiles an expression when you click the Create or Edit button in the Expression Editor, or when you open a scene containing a previously created expression.
Example global float $counter = 3; print($counter+"\n"); $counter = 1000; print($counter+"\n");
When Maya compiles the expression, it sets $counter to 3, prints 3, sets $counter to 1000, then prints 1000. During playback, each execution of the expression skips the first statement, so $counter never receives the value 3. The expression prints 1000, sets $counter to 1000 again, and prints 1000 again.
Constants A constant is an unchanging number or variable.
Examples Ball.translateY = 6.1.
This statement sets Ball’s translateY attribute to the constant number 6.1. float $pi = 3.1415927; Ball.rotateY = $pi;
These statements set the value of Ball’s rotateY attribute to the value of the variable $pi. The variable $pi represents the constant 3.1415927.
62
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators
Arithmetic, logic, and relational operators You can use the following operator symbols to add, subtract, multiply, compare, and do other actions to variables and attributes.
Arithmetic operators Symbol
Meaning
Used with these data types
+
plus
integer, float, vector, string
-
minus or negation
integer, float, vector
*
for integers and floats: multiply for vectors: dot product
integer, float, vector
/
divided by
integer, float
%
remainder of division
integer, float
Integers and floats
Examples Car.translateX = time / 2.0;
This moves the Car in an X direction as the time increases in the animation. By dividing time by 2.0, you move the object half as fast as if you used time alone. Car.translateX = 7 % 3;
This assigns Car.translateX the value 1, the remainder of 7 divided by 3. The number 7 divided by 3 equals 2 with a remainder of 1. Car.translateX = 8.8 % 4.2;
This assigns Car.translateX the value 0.4, the remainder of 8.8 divided by 4.2. The number 8.8 divided by 4.2 equals 2 with a remainder of 0.4. Car.translateX = 0.5 % 3;
Using Maya: Hypergraph, Sets & Expressions
63
Expressions
For integer and floating point attributes and variables, the above arithmetic operators work according to the rules of basic math. Note that the modulus operator (%) calculates the remainder of division.
Expression Syntax Arithmetic, logic, and relational operators This assigns Car.translateX the value 0.5, the remainder of 0.5 divided by 3. The number 0.5 divided by 3 equals 0, with a remainder of 0.5.
Vectors For operations between vector attributes and variables, the * operator performs the dot product. The dot product multiplies corresponding components of each vector, then adds the components to create a single floating point number result. For + and - operators, each component of one vector is operated on by its counterpart component in the other vector. For operations between a vector and an integer or floating point number, each component of the vector is operated on by the integer or floating point number.
Examples Suppose you’ve initialized these vectors: vector $A = <<1,2,3>>; vector $B = <<2,3,4>>; vector $C; float $myfloat;
You then use the following statements (in different expressions, not in sequential order): $C = $A + $B;
This assigns $C the value << 3, 5, 7>>. $C = $B - $A;
This assigns $C the value <<1, 1, 1>>. $myfloat = $A * $B;
This assigns $myfloat the value (1*2) + (2*3) + (3*4), which equals 20. Multiplying two vectors gives the dot product of the vectors. $C = 3 * $A;
This assigns $C the value <<3, 6, 9>>. Each component of the vector is multiplied by 3 to create a vector result.
64
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators
Strings For details on how to use the + operator with strings, see “String usage” on page 90.
Note Maya handles integer and Boolean attributes in an expression mathematically as floating point numbers. After the expression executes, Maya converts the floating point number to the proper data type. If your expression does arithmetic on an integer or Boolean attribute and you display the attribute’s contents in the Script Editor, you’ll see floating point values. After the expression executes, Maya assigns an appropriate integer or Boolean value to the attributes you set in the expression text field. Maya handles integer and Boolean variables within an expression mathematically as integer and Boolean data types.
Relational operators You’ll often use relational operators to compare the value of variables and attributes in conditional statements. See “Conditional statements” on page 69. Meaning
Used with these data types
<
less than
integer, float, vector
>
greater than
integer, float, vector
==
equal to
integer, float, vector
!=
not equal to
integer, float, vector
>=
greater than or equal to
integer, float, vector
<=
less than or equal to
integer, float, vector
Expressions
Symbol
Integers and floats For integer and floating point attributes and variables, the above relational operators work according to the rules of algebra.
Using Maya: Hypergraph, Sets & Expressions
65
Expression Syntax Arithmetic, logic, and relational operators
Examples if (time > 10) Sphere.translateX = 3;
When the animation time is greater than 10 seconds of play, the expression sets the Sphere’s translateX attribute to 3. It stays fixed in this position thereafter. See “Conditional statements” on page 69 for details on the if condition in this and following examples. if (Ball.scaleY == 3) Cone.scaleY = 6;
If Ball’s scaleY attribute is equal to 3, Maya sets Cone’s scaleY attribute to 6.
Important Be careful to type == rather than = for the equal to operator. For example, suppose you type if (Ball.scaleY = 3) in the previous example. Rather than test whether Ball.scaleY is equal to 3, the statement assigns 3 to Ball.scaleY. Maya evaluates the assignment statement Ball.scaleY = 3 as a true condition, so it executes Cone.scaleY = 6. This statement doesn’t cause an error message, but it gives unintended results.
Vectors If you use the == or != operators between two vector attributes or variables, Maya compares the corresponding components of each vector. In contrast, the >, >=, <, and <= operators compare the magnitude of two vectors. Use this formula to calculate a vector’s magnitude: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components of the vector.
Examples vector $A = <<1,2,3>>; vector $B = <<1,2,3>>; if ($A == $B) Sphere.translateX = 3;
66
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Arithmetic, logic, and relational operators This expression sets Sphere’s translateX attribute to 3, because vector $A is equal to $B. $A’s left component, 1, is compared to $B’s left component, also 1. $A’s 2 is compared to $B’s 2, and $A’s 3 is compared $B’s 3. vector $A = <<0,4,0>>; vector $B = <<1,0,0>>; if ($A > $B) Sphere.translateX = 3;
This expression sets Sphere’s translateX attribute to 3, because the magnitude of vector $A is greater than vector $B. The magnitude of $A is: 2
2
2
0 +4 +0 =
2
4 = 4
The magnitude of $B is: 2
2
2
1 +0 +0 =
2
1 = 1
Logical operators
Symbol
Meaning
||
or
&&
and
Expressions
You use logical operators with the relational operators described in the previous topic. Logical operators are often part of conditional statements. See “Conditional statements” on page 69.
Example 1 if ((time > 5) && (time < 10)) Ball.scaleZ = time;
This sets Ball’s scaleZ attribute to the value of time only when the animation time is greater than 5 and less than 10 seconds.
Using Maya: Hypergraph, Sets & Expressions
67
Expression Syntax Operator precedence Notice that each condition is grouped in parentheses, and the pair of conditions are enclosed again in parentheses. If you use multiple conditions with logical operators, you must enclose all the conditions in parentheses for the if statement. If you omit the outer pair of parentheses as in the following example, an error message occurs: if (time > 5) && (time < 10) Ball.scaleZ = time;
Example 2 if ((Ball.translateX < 5) || (Ball.translateY > 10)) Ball.scaleZ = time;
This sets Ball’s scaleZ attribute to the value of time in either of two conditions: when Ball’s translateX attribute is less than 5 or greater than 10.
Operator precedence The precedence of operators in expressions follows: Highest
() [] ! ++ - * / % ^
+
Lowest
-
< <= > >= == != && || = += -= *= /=
This figure includes operators used mainly by individuals experienced in programming. See “Programming features” on page 75 for details. In the figure, operators on the same row have equal precedence. If a statement has two or more operators from the same row, the operator furthest to the left is evaluated first. The parentheses at the top of the figure are for grouping a condition or elements of a statement. As shown in a following example, parentheses are useful for altering the order of operator evaluation.
68
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Conditional statements
Examples Ball.scaleY = 8 + 2 * 4;
This assigns Ball.scaleY the value 16. Ball.scaleY = (8 + 2) * 4;
This assigns Ball.scaleY the value 40. Ball.scaleY = 8 + 6 - 4;
This assigns Ball.scaleY the value 10. The + executes first because it’s further to the left in the statement than the -.
Conditional statements Conditional statements set one attribute or variable based on the condition of another attribute or variable. For example, you might increase the scale of a balloon after frame 48 plays. The if and if-else statements are the most commonly used conditional statements in expressions. You’ll often use relational and logical operators in conditional statements. See page 65 and page 67 for details. Expressions
If you have programming experience, be aware you can use loop and flow control statements such as while and for. See “Programming features” on page 75.
if statements The if conditional statement has this format: if ( condition ) statement;
If condition is true, statement executes.
Example if (time > 3) Ball.scaleY = 2;
This sets the scale of Ball’s scaleY attribute to 2 after the animation plays three seconds.
Using Maya: Hypergraph, Sets & Expressions
69
Expression Syntax Conditional statements
if-else statements The if-else conditional statement has the following format: if ( condition ) statement1; else statement2;
If condition is true, statement1 executes. Otherwise statement2 executes.
Example 1: Simple if-else statement if (time > 3) Ball.scaleY = 2; else Ball.scaleY = 1;
This sets Ball’s scaleY attribute to 2 if animation time is greater than 3 seconds. If animation time is less than 3, scaleY is set to 1. You can use more than one statement after a condition with this format: if ( condition ) { statement; statement; } else { statement; statement; }
Notice you must enclose the multiple statements between braces ({ }).
Example 2: Braces in if-else statement if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else { Balloon.translateY = time - 2; Balloon.scaleY = 1; }
70
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Conditional statements If the animation time is less than 2 seconds, the expression sets Balloon’s translateY attribute to 0, and sets its scaleY attribute to the value of time multiplied by 0.6. If animation time is greater than or equal to 2 seconds, the expression sets Balloon’s translateY attribute to time minus 2, and sets its scaleY attribute to 1.
Important You cannot set the same attribute in two different expressions. If you try to do so, an error message results and your second expression has no effect.
else if statements The else if statement works with the if-else conditional statement and has this format: if (condition1 ) statement1; else if ( condition2 ) statement2;
If condition1 is true, statement1 executes and the else if statement after it is skipped.
You can add an else condition to the previous format as follows: if (condition1 ) statement1; else if ( condition2 ) statement2; else statement3;
If neither condition is true, statement3 executes.
Using Maya: Hypergraph, Sets & Expressions
71
Expressions
If condition1 is false, the else if statement executes. If condition2 is true, statement2 executes. If neither condition is true, neither statement executes.
Expression Syntax Conditional statements
Example if (time < 3) Ball.scaleY = else if ((time >= 3) Ball.scaleY = else Ball.scaleY =
1; && (time =< 6)) 2; 3;
This sets Ball’s scaleY attribute to 1 if animation time is less than 3 seconds. If animation time is between 3 and 6 seconds, scaleY is 2. Otherwise, when time is greater than 6 seconds, scaleY is 3. Note that you can add multiple else if statements and multiple statements within braces ({ }) using this format: if (condition1 ) { statement; statement; } else if ( condition2 ) { statement; statement; } else if ( condition3 ) { statement; statement; } else if ( condition4 ) { statement; statement; } else { statement; statement; }
72
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax General syntax rules
General syntax rules Use these guidelines to avoid syntax errors while writing expressions: •
Terminate each statement in an expression with a semicolon (;). Here’s an example expression with two statements: if (time < 3) nurbsSphere1.translateX = time/2; else nurbsSphere1.translateX = time*3;
A semicolon marks the end of each statement. •
Enclose each conditional item in an expression within parentheses. In the preceding example, (time < 3) is a conditional item enclosed in parentheses.
•
Match each opening parenthesis with a closing parenthesis. For example, this statement causes an error: Ball.rotateZ = deg_to_rad(-6 * (floor(time));
If you look closely, you’ll see that there are three opening parentheses, but only two closing parentheses. The next statement causes no error: Ball.rotateZ = deg_to_rad(-6 * (floor(time)));
•
Expressions
There are three matching closing parentheses for the three opening parentheses. When you use { and } as opening and closing braces, make sure you use them in matching pairs: if (time > 3) { Ball.rotateZ = deg_to_rad(-6 * (floor(time)); Ball.rotateY = Ball.rotateZ * 3; }
•
Enclose a vector in double angle brackets as in this example: <<3,4,8>>
Spaces before and after the numbers and commas are optional. •
Begin any variable you use with a dollar sign ($), and do not to use spaces or special characters other than underscores in the name. Here’s an acceptable example: float $my_Rotate; $my_Rotate = 3.14;
Using Maya: Hypergraph, Sets & Expressions
73
Expression Syntax General syntax rules •
In conditional statements, be careful to type == rather than = for the equal to operator. The = symbol means assign the value. For example, make sure you type: if (Ball.scaleY == 3) Cone.scaleY = 6;
instead of this: if (Ball.scaleY = 3) Cone.scaleY = 6;
•
You can use as many spaces, tab characters, and blank lines as you like when separating words, operators, or statements. Maya ignores white space in an expression. For example, suppose you’ve written this expression: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2;
Though the following expression has different spacing and is unpleasant to read, Maya interprets the expression the same as the previous one. if(time<2){Balloon.translateY=0; Balloon.scaleY=time*0.6;} else Balloon.translateY=time-2;
You must include at least one space between any two keywords, variables, or attribute names (or combination of these). So a space is required after the else keyword but in no other place in this expression. To simplify spacing considerations, remember to put at least one space before and after a keyword, variable, operator, attribute, assignment operator, and so on. Consistent use of white space makes expressions easier to read. Examples throughout this chapter show examples of good spacing style.
74
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Comments in expressions
Comments in expressions Add comments to your expressions to explain the purpose of each statement within. You’ll appreciate this later if you need to modify the expression. Maya ignores comments.
To add a comment to the right of a one-line statement: Enter two forward slashes (//) at the end of the statement, then enter the comment: Ball.translateX = time; // Moves ball in X dir. with time
To write a multi-line comment: Enter two forward slashes (//) before the comment: // This is an example of a // comment spanning two lines.
Programming features Expressions
The following topics describe programming features available in expressions. Discussion is brief and assumes you’re familiar with programming. Most of the syntax features described work like their C counterparts.
Notes for C programmers Some important differences between expression and C syntax follow: •
A C program consists of one or more functions, each containing multiple statements. An expression is simply a single block of statements. You don’t declare main( ) or your own functions in an expression. You also don’t include the C standard library of functions. You will, though, sometimes include a built-in Maya function such as sin( ) to accomplish time-saving tasks. See Chapter 9, “Functions,” for details.
•
After you type an expression in the Expression Editor, clicking the Create or Edit button compiles the expression.
•
The first character of variables must be a dollar sign ($).
•
ANSI C has 32 keywords. The expression language has less, as listed in the following topic. Using Maya: Hypergraph, Sets & Expressions
75
Expression Syntax Programming features •
Maya’s integer data type has the same numerical range as ANSI C’s integer data type, -2,147,483,648 to 2,147,483,648.
•
Maya’s float data type has the same numerical range as ANSI C’s double data type.
Expression language keywords The expression language keywords follow:
Data type keywords int
float
vector
string
matrix
on
off
true
false
in
Boolean constant keywords yes
no
Flow control keywords if
else
for
while
do
break
continue
default
switch
case
source
catch
alias
Other keywords global
return
proc
The return, proc, and matrix keywords are useful for writing MEL scripts, not for expressions. Other keywords above are described throughout this chapter. Type keywords in lowercase letters exactly as shown. Do not name a custom attribute with any of these keywords.
76
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Flow control statements Besides the if and if-else statements described previously, you can control the flow of statement execution with while, do, for, break, continue, and ?: instructions. These work like their C language counterparts. You’ll often use logical and relational operators in conditional statements. See page 65 and page 67 for details.
Important Using a while, do, or for loop incorrectly might halt Maya. See “Flow control errors” on page 88 for details.
while A while loop has this format: while ( condition ) { statement; statement; ... }
Example float $test = 0; while ($test < 5) { print("$test equals: " +$test+"\n"); $test = $test + 1; }
Using Maya: Hypergraph, Sets & Expressions
77
Expressions
Use condition to compare variable, attribute, or constant values. If condition is true, Maya executes each statement between braces. Maya then evaluates condition again. If true, it executes each statement again. This cycle continues until condition is false, whereupon execution resumes with the statement after the loop.
Expression Syntax Programming features This expression displays the following lines in the Script Editor: $test $test $test $test $test
equals: equals: equals: equals: equals:
0 1 2 3 4
These lines are followed by a status message similar to this: expression -e -s "" -o Ball -an 1 Expr
This message indicates that a MEL command executed when you clicked the Create or Edit button in the Expression Editor. Specifically, an expression command executed. This is unrelated to the exact statements in the expression.
do A do loop has this format: do
{ statement; statement; ... }
while (condition);
Here Maya executes each statement between braces, then evaluates condition. The condition compares variable, attribute, or constant values. If condition is true, each statement executes again. The loop terminates when condition is false. In contrast to a while loop, a do loop executes the statements in the loop at least once. It tests the termination condition after the loop. A while loop tests the termination condition before executing the statements in the loop.
Example float $test = 0; do
{ print("$test equals: " +$test+"\n"); $test = $test + 1; } while ($test < 5);
78
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features This expression displays the following lines in the Script Editor: $test $test $test $test $test
equals: equals: equals: equals: equals:
0 1 2 3 4
for A for loop has this format: for (initialization; condition; change of condition) { statement; statement; ... }
A for loop evaluates the termination condition before executing each statement. The condition compares variable, attribute, or constant values.
Example float $i;
Expressions
for ($i = 0; $i < 5; $i = $i + 1) { print("$i equals: " +$i+"\n"); }
This expression displays the following lines in the Script Editor: $i $i $i $i $i
equals: equals: equals: equals: equals:
0 1 2 3 4
break The break instruction exits a loop from any point within its body, bypassing the normal termination at the loop’s beginning or end. Expression execution resumes at the next statement after the loop. You can use a break instruction with a while, do, or for loop.
Using Maya: Hypergraph, Sets & Expressions
79
Expression Syntax Programming features
Example float $f = 0; while( $f < 10 ) { print("$f equals: "+$f+"\n"); if ( $f > 5 ) break; $f = $f + 1; }
This expression displays the following lines in the Script Editor: $f $f $f $f $f $f $f
equals: equals: equals: equals: equals: equals: equals:
0 1 2 3 4 5 6
Suppose the example didn’t have this statement: if ($f > 5) break;
The loop would execute ten times and display the numbers 0 through 9. The break statement terminates the loop after $f is greater than 5. So the expression displays only numbers 0 through 6.
continue The continue instruction works inside loops. It forces the next iteration of the loop to occur, skipping any statements between itself and the loop’s test condition. The condition compares variable, attribute, or constant values.
80
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example float $f = 0; for( $f = 0; $f < 10; $f = $f + 1) { print("$f equals: "+$f+"\n"); if( $f > 5 ) continue; print(" got here.\n"); }
This expression displays the following lines in the Script Editor: 0 here. 1 here. 2 here. 3 here. 4 here. 5 here. 6 7 8 9
Expressions
$f equals: got $f equals: got $f equals: got $f equals: got $f equals: got $f equals: got $f equals: $f equals: $f equals: $f equals:
Suppose the example didn’t have this statement: if( $f > 5 ) continue;
The loop would display got here after each line of $f equals: n. Maya ignores the continue instruction until $f increases to a value greater than 5. When $f becomes 6 or greater, the continue instruction executes and skips the remaining statement in the loop, so got here isn’t printed.
for-in The for-in loop is a specialized for loop that simplifies manipulation of all elements of an array. A for-in loop with an array element variable lets you omit the initialization, condition, and change of condition components of a for loop. Using Maya: Hypergraph, Sets & Expressions
81
Expression Syntax Programming features The for-in loop has this format: for (array-element in array) { statement; statement; ... }
Example string $carType[3] = {"Porsche", "Ferrari", "Fiesta"}; string $car; for ($car in $carType) { print("I want a new "); print($car + ".\n"); }
The expression displays this in the Script Editor: I want a new Porsche. I want a new Ferrari. I want a new Fiesta.
The loop executes three times, once for each array element in $carType. The first loop execution copies array element $carType[0] into $car, then prints, “I want a new Porsche.” Array element $carType[0] is Porsche. The second loop execution copies $carType[1] into $car, then prints the second line shown. The third execution copies $carType[2] into $car, then prints the third line shown. When the for-in statement finishes reading all array elements, the loop terminates.
82
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
switch A switch instruction executes one of several groups of statements based on a control value. The control value can be a variable value or an attribute other than an array (per particle) attribute. The format follows:
The switch executes with a variable control-value. If the variable contents match value1, value2, or another value in the switch, the statements under the associated case statement execute. The control-value can be an int, float, string, or vector. Be careful if you use a float control-value. Because of the way floating point arithmetic rounds numerals, a case value might fail to match a control-value as you expect. A break statement within a switch causes execution to skip subsequent case statement groups within the switch instruction.
Using Maya: Hypergraph, Sets & Expressions
83
Expressions
switch (control-value) { case value1: statement; statement; ... break; case value2: statement; statement; ... break; case value3: statement; statement; ... break; ... default: statement; statement; ... break; }
Expression Syntax Programming features
Example 1: Break statement within a switch int $sway = rand(3); switch ($sway) { case 0: print("Case 0\n"); // Executes if $sway = 0 break; case 1: print("Case 1\n"); // Executes if $sway = 1 break; case 2: while (rand(10) < 7)// These statements print("I say!\n");// execute only print("Case 2\n");// if $sway = 2 break; }
When the expression executes a few times, it might display this random selection of entries in the Script Editor: Case 0 Case 1 I say! I say! I say! Case 2 Case 0 Case 1
The last case instruction in a switch doesn’t need a break statement because the switch is finished. Still, it’s best to add the break statement to avoid future problems that might result from adding other cases to the switch. For details on the purpose of rand(3), see “rand” on page 243.
84
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example 2: Omitted break statement within a switch The following expression omits a break statement to make the switch continue execution after the first case: int $argo = rand(2); switch ($argo) { case 0: print("Food\n"); // Runs if $argo is 0. case 1: print("Fight\n");// Runs if $argo is 0 or 1. break; }
When the expression executes a few times, it might display this random selection of entries in the Script Editor: Fight Fight Fight Food Fight Food
Whenever Food appears, Fight also appears after it. Fight can appear without Food being displayed.
int $argo = rand(4); switch ($argo) { case 0: case 1: print("Food\n"); // Runs if $argo is 0 or 1 case 2: case 3: print("Fight\n");// Runs if $argo is 2 or 3 break; }
This works like the preceding expression, except that a match of 0 or 1 displays Food and Fight, and a match of 2 or 3 displays Fight.
Using Maya: Hypergraph, Sets & Expressions
85
Expressions
Note that you can make more than one case statement execute the same statements:
Expression Syntax Programming features
Example You can use the default keyword to make a block of statements execute when none of the case values match the control value label. Generally, you put this label after all the case statements, though you can put it anywhere in the switch statement. If the switch has no default label and none of the case values match the control value, the switch does nothing. vector $mgb = <<1,1,0>>; switch ($mgb) { case <<0,1,1>>: print("Who?\n");// Runs if $mgb is <<0,1,1>> break; case <<1,0,1>>: print("What?\n");//Runs if $mgb is <<1,0,1>> break; default: print("Why?\n"); // Executes if $mgb is not break; // <<0,1,1>> or <<1,0,1>> }
The expression executes the default case, which displays the following line in the Script Editor: Why?
?: operator The ?: operator lets you write a shorthand if-else statement to set an attribute or variable in one statement. Because of its cryptic appearance, many programming style experts suggest not using it. Here’s its format: attribute = condition? statement1: statement2;
The condition compares variable, attribute, or constant values. If condition is true, Maya evaluates statement1 and assigns its value to attribute. (You can also assign the statement’s value to a variable.) Maya evaluates either statement1 or statement2, never both. You can optionally enclose statement1 and statement2 in parentheses to make the expression easier to read.
86
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Example Balloon.scaleY = (time < 2) ? time / 2: time * 2;
This statement sets Balloon’s scaleY attribute to time divided by 2 if time is less than 2, and time multiplied by 2 if time is greater than or equal to 2. This causes the scaleY attribute to increase slower for the first two seconds than after two seconds. This is the same as the following if-else statement: if (time < 2) Balloon.scaleY = time / 2; else Balloon.scaleY = time * 2;
Use this format because it’s easier to read.
Important If you use an integer value as statement1 and a floating point value as statement2, the ?: operator truncates the floating point value of statement2 to an integer. In the expression Balloon.scaleY = (time < 2) ? 0: time;, for example, 0 is an integer, and time is a floating point value. When time is 2 seconds or more, Maya sets Balloon’s scaleY attribute to the integer value of time.
If you have problems using the ?: operator, use an if-else statement instead.
! operator You can use the not logical operator (!) with integer, float, and vector data types. For vector values, ! is true only when the vector magnitude is 0. A vector’s magnitude is the value resulting from this equation: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components of the vector.
Using Maya: Hypergraph, Sets & Expressions
87
Expressions
Because Maya sets scaleY to the integer value of time (without the decimal part), scaleY jumps in one-second increments at time 2, 3, 4, and so on.
Expression Syntax Programming features
Examples if (!$count) Ball.scaleY = 2;
The !$count condition is true only if $count is 0. If true, Ball.scaleY is set to 2. vector $myvector = <<0,0,0>>; if (!$myvector) Ball.scaleY = 2;
Because the magnitude of $myvector is 0, the !$myvector condition is true and Ball.scaleY is set to 2.
Flow control errors The following topics describe solutions to common mistakes in expression flow control statements.
Modifying variable values in test conditions If you use a while, do, or for loop in an expression, remember to change the variable or attribute being tested in the test condition of the loop. Failing to do so can halt Maya operation.
Example 1 Suppose you create an object named Balloon and decide to use a while loop to increase its Y scaling after three seconds of animation play. while (time > 3) Balloon.scaleY = time;
Though you might think this expression sets Balloon’s scaleY attribute to the increasing value of time after the animation time exceeds 3 seconds, it actually halts Maya operation as soon as time exceeds 3. At that moment, the while condition is true, so the while loop statement Balloon.scaleY = time executes repeatedly and endlessly. Even though a statement sets an attribute within an expression, Maya updates the attribute only after the expression finishes executing. Because the expression never finishes executing, Maya halts. Unless you change Balloon.scaleY within the while loop to a value less than or equal to 3, the statement executes infinitely.
88
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features To get the desired result without halting Maya, use this expression: if (time > 3) Balloon.scaleY = time;
Example 2 Suppose you create objects named Cone and Ball, then use a while statement to link the Ball’s translateY attribute to the Cone’s translateY attribute: while (Cone.translateY > 0) Ball.translateY = Cone.translateY;
At first glance, the expression seems to set Ball’s translateY position to the value of the Cone’s translateY position whenever Cone’s translateY is greater than 0. In fact, the expression halts Maya as soon as you translate the Cone to a Y position greater than 0. At that moment, the while condition is true, so the while loop statement Ball.translateY = Cone.translateY executes endlessly. Nothing you do in the user interface can change the Cone’s translateY position. It stays at translateY value of 0. Unless you change Cone.translateY within the while loop to a value less than or equal to 0, the statement executes infinitely.
if (Cone.translateY > 0) Ball.translateY = Cone.translateY;
Comparing floating point values to 0 with == If you use the == operator to compare a floating point variable or attribute to 0, your expression might not work correctly. This typically occurs when you assume the value returned by a built-in function such as cosd will be exactly 0.
Example float $x = cosd(90); if ($x == 0) print("This equals 0.\n"); else print("This doesn’t equal 0.\n");
Using Maya: Hypergraph, Sets & Expressions
89
Expressions
To get the desired result without halting Maya, use this expression:
Expression Syntax Programming features The expression displays the following text: This doesn’t equal 0.
Though the cosine of 90 degrees is mathematically 0, the cosd(90) function returns the value 6.123e-17, which is extremely close to 0 but not exactly equal. Though the number for practical purposes is the same as 0, it’s stored in the computer as a fractional quantity above 0 because of the way computers handle floating point numbers. To fix the problem, compare the values as in this expression: float $x = cosd(90); if (($x > -0.0001) && ($x < 0.0001)) print("This equals 0.\n"); else print("This doesn’t equal 0.\n");
The expression displays the following text: This equals 0.
By checking that $x is between -0.0001 and 0.0001, the appropriate print statement executes. The value returned by cosd(90) is so close to 0 that it’s within the small range specified in the if statement’s numerical comparison.
String usage A string is a sequence of alphabetical, numerical, and special characters. You can display strings in the Script Editor, for example, to check the contents of attributes or variables. You can also create strings in the Expression Editor to execute MEL commands in an expression. See Chapter 7 for details. Guidelines for using strings follow: •
Enclose a literal string with double quotes as in this example: print("asteroid2");
This displays the following text: asteroid2
•
You can use the + operator to concatenate strings as in this example: print("Ball’s scaleY attribute equals: " + Ball.scaleY);
90
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features This displays the following text: Ball’s scaleY attribute equals: 0.3333333333
•
The following table lists how Maya converts data types if you use arithmetic operators with strings in an expression. Arithmetic operation
Resulting data type
string operator integer
string
string operator float
string
string operator vector
string
For example, suppose you type the following statement: print("Hi there, "+007);
This displays the following text: Hi there, 007
•
If you’re familiar with C programming, be aware you can assign a string to a vector as in these examples: vector $i = (vector) "<<1,2,3>>";
Expressions
vector $i = vector ("<<1,2,3>>");
•
You can execute a MEL command in an expression statement. See “Executing MEL commands in an expression” in Chapter 7.
Shortcut assignment operators You can use shorthand assignment operators to save typing time compared to their longhand counterparts. In place of a statement like this: $height = $height + 3;
You can use this statement: $height += 3;
Using Maya: Hypergraph, Sets & Expressions
91
Expression Syntax Programming features The following table shows the shorthand operators and the valid data types for each. The shorthand operators work like their counterparts in C. Symbol
Data type
+=
integer, float, vector, string
-=
integer, float, vector
/=
integer, float, vector
*=
integer, float, vector
%=
integer, float
Do not insert a space between the operator and =.
Example $counter += 1;
This adds 1 to $counter each time the statement executes.
Shortcut increment and decrement operators You can use the ++ and -- shortcut increment and decrement operators to increase or decrease floating point and integer variables by 1. The following table shows the shortcut syntax and its equivalent expanded syntax: Shortcut syntax
Expanded syntax
++variable;
variable = variable + 1;
--variable;
variable = variable - 1;
variable++;
variable = variable + 1;
variable--;
variable = variable - 1;
When the increment or decrement operator precedes the variable, the increment or decrement occurs before the statement executes. When the operator follows the variable, the increment or decrement occurs after the statement executes.
92
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Programming features
Examples float float $crab $crab $crab
$eel = 32.3; $crab = $eel++; = $eel--; = --$eel; = ++$eel;
// // // //
$crab $crab $crab $crab
= = = =
32.3; 33.3; 31.3; 32.3;
$eel $eel $eel $eel
= = = =
33.3; 32.3; 31.3; 32.3;
Important To avoid unexpected results, do not use more than one shortcut increment or decrement operator on the same variable in the same statement. The evaluation order of the operators is unpredictable.
Arrays You can create arrays of float, vector, integer, or string values. You can clear an array using a clear function. You can find the size of an array with the size function. See “Array functions” in Chapter 9 for details.
Expressions
When you assign a value in an array, Maya reserves memory for all elements less than that number. This means you can exceed the capacity of your computer with a single array declaration. For example, do not use a statement like this: $newarray[12312323123] = 1;
Examples: Defining an array float $myarray[]; vector $myposition[]; int $p[];
Note that an array expands its size automatically as you assign values to its elements. You don’t need to declare its size. If your array assignment exceeds the size of the array, the array expands to that size. If you reference an element of the array beyond the array size, a 0 is returned. Suppose you include these statements in an expression: int $p []; $p[1500] = 3; $p[2000] = 5;
Using Maya: Hypergraph, Sets & Expressions
93
Expression Syntax Programming features The second statement makes the array contain 1501 elements and assigns element 1500 the value 3. The third statement expands the array to 2001 elements and assigns element 2000 the value 5.
Example: Initializing and printing an array’s contents float $fa[]; print("$fa size: "+size($fa)+"\n"); for( $i = 0; $i < 10; $i = $i + 1) { $fa[$i] = $i; print($fa[$i]+"\n"); } print("fa size: "+size($fa)+"\n");
This expression displays the following: $fa size: 0 0 1 2 3 4 5 6 7 8 9 $fa size: 10
The first statement creates an array of floating point variables named $fa[ ]. The next statement displays the size of the array, which has 0 elements after its definition. The for loop executes the statements between the braces 10 times, once for each increment of $i from 0 to 9. The first statement between the braces ({ }) initializes and sets the value of one element of the array. Array element $fa[0] is set to floating point value 0, element $fa[1] is set to 1, element $fa[2] is set to 2, and so on. The print statement between the braces displays the value of each element of the array after you initialize it. In other words, the Script Editor displays 0 through 9.
94
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Common expression errors The for loop stops executing after $i becomes equal to 10. Then the final print statement displays the number of elements of the initialized array, 10. The array increased in size as you assigned values to its elements.
Boolean symbolic constants You can use the symbolic constants on, true, or yes for the Boolean numeric value 1. You can use off, false, or no to represent 0. Be aware that on, true, and yes are equal only to 1. They aren’t equal to nonzero values.
Example if (Monster.visibility == on) Lance.scaleY = time / 3;
This causes Lance’s scaleY attribute to increase only if Monster’s visibility attribute is on. The on represents 1. print(3 + on);
This displays 4 in the Script Editor. Again, on represents the value 1.
Common expression errors
Logic errors are mistakes in your reasoning that cause unexpected animation results. The syntax of your expression is valid, but errors in your logic prevent Maya from doing what you intended. In the worst cases, Maya might halt operation because your statements lock it into a permanent loop. Because Maya can’t detect logic errors, it can’t display error messages. As such, these errors are harder to find and require more analysis to solve. To resolve logic errors, it’s often helpful to display the contents of relevant attributes and variables. See “Displaying attribute and variable contents” in Chapter 7.
Error message format A syntax error displays one or more messages in the Script Editor.
Using Maya: Hypergraph, Sets & Expressions
95
Expressions
There are two types of errors you can make when writing expressions: syntax errors and logic errors. Syntax errors include mistakes in spelling, incomplete attribute names, omitted semicolons, and other oversights that prevent the expression from compiling and executing. For syntax errors, Maya explains the error in a message to the Script Editor.
Expression Syntax Common expression errors
You’ll often need to scroll or increase the size of the Script Editor to see an entire message. When the Script Editor displays a syntax error, the response area of the Command Line displays the same error with a red background.
Command line’s response area turns red if error occurs
If an expression executes a valid statement after the erring statement, the error message with the red background flashes briefly. You won’t notice it unless you’re looking directly at it and have quick eyes. The best way to know when an error has occurred is to look for a new message prefixed by // Error: in the Script Editor.
96
Using Maya: Hypergraph, Sets & Expressions
Expression Syntax Common expression errors Before clicking the Create or Edit button to create an expression, you might want to select Edit→Clear History in the Script Editor to remove previous messages in the window. This makes it easier to see when a new error message appears.
Common error messages Here are some common syntax errors and their explanations: Attribute not found or variable missing '$': Ball.goof.
You misspelled an attribute name, the attribute doesn’t exist in the scene, or you forgot to prefix a variable name with $. Attribute of a particle object can only be used with dynExpression command: particleShape1.position
You used a particle array attribute in the expression, but a particle shape node is not the Selected Object in the Expression Editor. A particle shape node must be selected to use particle array attributes. A particle array attribute is also called a per particle attribute. Attribute already controlled by an expression, keyframe, or other connection: Balloon.tx.
•
set driven key
•
constraint
•
motion path
•
another expression
•
any other direct connection More than one attribute name matches. Must use unique path name: Ball.tx.
You used an object.attribute name that exists in two or more parent objects. Two objects in a scene can have the same object name if they have different parent objects. For example, a scene might have a child of GroupA named Ball.tx and a different child of GroupB named Ball.tx. If you write a statement such as “Ball.tx = time;”, Maya won’t know which Ball.tx to set.
Using Maya: Hypergraph, Sets & Expressions
97
Expressions
You tried to set the value of an attribute that has already been set by one of these techniques:
Expression Syntax Common expression errors To eliminate the error in this example, you must enter the full pathname of the attribute as GroupA|Ball.tx. The pipe symbol (|) specifies that the object to its left is the parent of the object on the right. Cannot set 'time' or 'frame'
You can read the value of the predefined time and frame variables, but you cannot set them. Attributes must be of float, integer, or boolean types: Ball.worldMatrix
You tried to set or read the value of an attribute that was a string or matrix type. For instance, you might have tried to use an attribute named translate rather than translateX, translateY, or translateZ attribute. In the error message above, worldMatrix is an attribute that exists for transforms, but you can’t use it. It’s for Maya’s internal use. Cannot divide by zero
You tried to divide by an attribute or variable that equals 0. This typically happens in an expression statement that divides by an object’s translateX, translateY, or translateZ attribute when the Snap to grids button is on and you drag the object to past the X-, Y- or Z-axis. When Snap to grids is on, the translateX, translateY, or translateZ attribute becomes exactly equal to 0 at the point where you drag the object across the axis. To prevent this error, turn Snap to grids off. With snapping off, the attribute is unlikely to become exactly 0 as you drag across the axis.
Note If you compile an expression for a particle shape node and see the same error message once for each particle in the object, it’s likely that some attribute name, variable, or function is undefined or misspelled.
98
Using Maya: Hypergraph, Sets & Expressions
6
Editing Expressions The Expression Editor offers convenient techniques for editing the text of expressions. There are filters that help you search for expressions you previously created, as well as techniques for entering and modifying the text of an expression.
You can edit an expression directly in the text box or with a text editor such as vi.
This chapter describes the following topics: “Finding expressions” on page 99
•
“Editing an expression in the text field” on page 105
•
“Editing an expression with a text editor” on page 106
•
“Creating a new expression” on page 111
•
“Deleting an expression” on page 112
•
“Using attribute names in expressions” on page 112
Expressions
•
Finding expressions After you’ve created an expression, you might decide later to alter it to create a different animation result. To edit an expression, you display it in the Expression Editor. The following sections describe how to find and display an expression for editing.
Using Maya: Hypergraph, Sets & Expressions
99
Editing Expressions Finding expressions
Finding by expression name To find an expression, you can choose from a list of all expressions in the scene.
To search for an expression by name: 1
From the Expression Editor, choose Select Filter→By Expression Name. An Expressions list appears in the Expression Editor. This list shows all expressions created for the scene.
List of expressions
2
Click the expression in the list. The expression contents appear in the expression text field. If you don’t remember the name of the expression, click each name on the list until the desired expression appears in the expression text field.
Note For a particle shape node, you can create a creation expression, a runtime expression, or both. Both expressions are listed under a single name—the name of the particle shape node. You can’t name or rename such expressions. To find such expressions, look for the particle shape node’s name in the Expressions list. Click the appropriate Runtime or Creation checkbox to display the desired expression.
100
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Finding expressions
Finding by selected object If you can’t remember the name you gave an expression, you can find it by selecting the affected object. For a nonparticle shape node, you can also select an affected attribute from the Attributes list to narrow the search for the expression.
To search for an expression by object and attribute name: 1
Select the object or other node in the Outliner, Hypergraph, or workspace.
2
Choose Select Filter→By Object/Attribute Name in the Expression Editor. This is the default search setting for the Expression Editor.
3
Choose Object Filter→Selected Objects. The selected object’s name and appropriate attributes appear in the window.
Object name Object’s attributes
For an object other than a particle shape node, click the name of the attribute controlled by the expression. If you’ve forgotten the name of the attribute controlled by the expression, choose Attribute Filter→Connected to Expressions. The Attributes list displays only the attributes controlled by expressions for the selected object. Click each attribute in the Attributes list until you see the desired expression in the expression text field. You can’t write a different expression for each attribute of a particle shape as you can for other types of objects. Because you can write only one creation expression and one runtime expression per particle shape, you don’t need to select an attribute from the Expression Editor’s Attributes list. See “Understanding particle expressions” on page 148 for details on particle expressions.
Using Maya: Hypergraph, Sets & Expressions
101
Expressions
4
Editing Expressions Finding expressions
Note The Attributes list shows only unlocked, keyable attributes. You can choose whether an attribute is keyable or locked with View→Object→ Editors→Channel Control. To write an expression for any nonkeyable attribute not shown in the list, enter object.attribute name in the Selected Obj & Attr text box.
Finding by item type You can find an expression based on the type of object or item the expression affects. For example, if you can’t remember an expression’s name but remember you applied it to a shader node, you can narrow your search to expressions that control shader nodes in the scene.
To search for an expression by item type: 1
In the Expression Editor, choose Select Filter→By Object/Attribute Name.
2
From the Object Filter menu, select the type of object or item the expression affects.
3
Choose Attribute Filter→Connected to Expressions.
4
Select the affected object or item from the Objects list.
5
Select the affected attribute from the Attributes list. The expression that controls the attribute appears in the expression text field.
Example Suppose you’ve written an expression that controls the rotateZ attribute of a spotlight transform node named Searchlight. Do this to find the expression: 1
Choose Select Filter→By Object/Attribute name.
2
Select Object Filter→Transforms. Note that you don’t select Object Filter→Lights in this example. The rotateZ attribute is an attribute of a light’s transform node, not of the light object itself.
102
3
Choose Attribute Filter→Connected to Expressions.
4
Select the object Searchlight from the Objects list.
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Finding expressions 5
Click rotateZ from the Attributes list. The expression appears in the expression text field.
Using the Selection list The Expression Editor displays a Selection list by default. This list displays either a list of objects and attributes, or a list of expressions you’ve created. To display the list of objects and attributes, choose Select Filter→By Object/ Attribute Name. This is the default display. To display the list of expressions you’ve created in the scene, choose Select Filter→By Expression Name.
Selection list triangle
Expressions list
Expressions
Using the Objects and Attributes list The objects listed in the Objects list depend on which entry you’ve selected from the Object Filter menu. If you select Object Filter→Lights, for instance, all lights in the scene appear in the list. The appropriate attributes of the object selected in the Objects list appear in the Attributes list. For example, if spotLightShape1 is selected in the Objects list, the attributes of spotLightShape1 appear in the list. When searching for an expression to edit, you can click an object and attribute from this list to find and display an expression that affects the chosen attribute. You can edit the displayed expression in the expression text field.
Using Maya: Hypergraph, Sets & Expressions
103
Editing Expressions Finding expressions For a particle shape node, you don’t need to select an attribute from the Attributes list. You can create only one creation expression and one runtime expression per particle shape node. The same expression appears for each attribute. When you create a new expression, you can click an object from this list to choose the default object to which the expression applies. When you select the default object in the Expression Editor, you can skip omit the object name and period that’s part of a full attribute name (see “Omitting an object name in expressions” on page 115.)
Using the Expressions list The Expressions list shows all expressions you’ve created in the scene. When searching for an expression to edit, click an expression from this list to display and edit its contents.
Hiding the Selection list You can hide the Selection list to lessen clutter in the window. To do so, click the triangle next to Selection (see previous figure). This triangle collapses and expands the list.
Filtering attributes from the Selection list If a selected object has several attributes controlled by expressions but you’re not sure which attributes, you can select a filter to list only attributes controlled by an expression.
To filter attributes from the Attributes list: 1
Select the object containing the attributes.
2
Choose Select Filter→By Object/Attribute Name.
3
Choose Object Filter→Selected Objects.
4
Choose Attribute Filter→Connected to Expressions. Only the object’s attributes controlled by expressions appear in the Attributes list. To see all attributes you can control with an expression again, choose Attribute Filter→All.
104
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression in the text field
Editing an expression in the text field The Expression Editor provides techniques for deleting and copying text in the expression text field. There are also techniques for clearing and restoring the text of an expression.
Expression text field
Important
Deleting and copying text To delete text: 1
Drag the mouse to select the text.
2
Press your keyboard’s Backspace key to delete it.
To copy and paste text: 1
Drag the mouse to select the text to be copied.
2
At the point in the text where you want to copy the text, click with the middle mouse button. This technique takes a little practice. If you find this frustrating, you might prefer using a text editor native to your operating system, for example, vi or jot. See “Editing an expression with a text editor” on page 106.
Using Maya: Hypergraph, Sets & Expressions
105
Expressions
If you close the Expression Editor window without successfully compiling an expression with the Create or Edit button, Maya discards any editing changes you’ve made to the expression.
Editing Expressions Editing an expression with a text editor
Clearing the expression text field You can erase the entire expression text field by clicking a button rather than dragging and deleting text.
To clear the expression text field: Click the Clear button.
Important To erase an expression and make sure its previous contents no longer control an attribute, click the Edit button after clicking the Clear button.
Reloading an expression’s previous contents Clicking the Create or Edit button compiles an expression. If you’ve made an editing change and haven’t yet clicked the Edit button, you can reload the previous expression if you don’t like the results.
To reload the expression: Click the Reload button. This restores the expression to the contents last present when you clicked the Create or Edit button.
Editing an expression with a text editor From the Expression Editor, you can start a text editor such as vi to create and edit an expression. Text editors have features useful for editing big expressions. When you start the text editor for an expression, you can edit only that expression with that instance of the text editor. However, you can start the text editor once for each of several expressions if you want to examine or edit several expressions at the same time. Once you start a text editor for an expression, the Expression Editor’s text field dims to indicate you can’t work there while the text editor runs. You can, though, work in the expression text field for another expression.
106
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression with a text editor There is no file on disk you can edit independently of the Expression Editor. When you use the text editor through the Expression Editor, you’re working with a temporary file that’s linked to the expression stored in the scene. You can, however, read an independent text file containing expression text into the temporary file. If you save an expression without specifying a filename, Maya reads the saved expression and stores it with the scene. You’ll see it dimmed in the expression text field while you’re working with the text editor. When you close the text editor, the expression text field entry no longer is dim. The text expression field becomes active after you close the text editor. If you quit the text editor without saving the expression, Maya does nothing. Because the expression hasn’t changed, Maya’s copy of the expression doesn’t need to change either.
Tip You can use a text editor to save an expression to a filename in the directory of your choice. This gives you a way to archive an expression you want to use in a different scene.
Using an editor listed in the Editor menu Expressions
By default, you can start one of these editors from the Editor menu in the Expressions Editor: •
jot
•
vi
•
vim
•
xemacs To run a different editor, see “Using an editor not listed in the Editor menu” on page 109.
To start an editor listed in the menu: 1
From the Editor pull-down menu in the Expression Editor, select an editor.
2
Double-click an object name, expression name, or attribute name from the Selection list.
Using Maya: Hypergraph, Sets & Expressions
107
Editing Expressions Editing an expression with a text editor The editor appears. An example display of vi follows:
The editor’s title bar shows a filename that’s temporarily created while you work on the expression. When you write or save the file, its contents are copied to the Maya scene containing the expression. The expression text field is inactive while the text editor is open. You can optionally close the Expression Editor window. If you single-click the name of an object, attribute, or expression, the text editor doesn’t appear. You can single-click to browse the contents in the expression text field without opening a text editor. If you double-click an attribute that’s already been assigned a value in an expression, the expression that controls that attribute appears in the text editor. For nonparticle expressions, you can assign to any attribute in the scene, not just to the double-clicked attribute. In fact, you don’t even need to work with the double-clicked attribute at all. If you double-click an attribute that has not yet been assigned a value, the text editor appears with no contents. If you double-click that attribute again, a new instance of the editor appears. After you assign a value to an attribute in an expression, you can start the editor only once for the attribute.
108
3
Create or edit the expression with the editor.
4
Save the file.
5
Confirm that the Expression Editor detected no syntax errors.
6
Quit the editor.
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Editing an expression with a text editor
Note If you’ve created a UNIX command alias for jot, vi, vim, or xemacs, the Expression Editor tries to launch this command. If the arguments provided in the command alias are unusable by the Expression Editor, the editor might operate unexpectedly or fail to launch. Avoid using an alias to customize your editor’s operation settings. Do the steps in “Changing an editor’s operation settings” on page 110.
Using an editor not listed in the Editor menu If your workstation has a text editor that’s not listed in the Editor menu, you can use it after doing a few preliminary UNIX system administration tasks.
To start an unlisted editor: 1
In your UNIX .cshrc file, set the WINEDITOR environment variable to specify the desired editor and options. See “Changing an editor’s operation settings” on page 110 for examples. You can choose any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor).
2
Log out and log into your user account.
3
Restart Maya.
4
Choose Other from the Editor pull-down menu.
5
Double-click an object name, expression name, or attribute name from the Selection list. The editor appears.
6
Create or edit the expression with the editor.
7
Save the file.
8
Confirm that the Expression Editor detected no syntax errors.
9
Quit the editor.
Using Maya: Hypergraph, Sets & Expressions
109
Expressions
If the editor normally appears in the shell where you launched it, you must make the WINEDITOR setting display the editor in a shell.
Editing Expressions Editing an expression with a text editor
Changing an editor’s operation settings Maya launches the editors listed in the Editor menu with default operation settings. You can change the operation settings with a few preliminary system administration tasks.
To change an editor’s operation settings: 1
Set the WINEDITOR environment variable to specify the desired editor options. You can choose any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor). For example, jot requires the option -f, vim requires -g -f, and xemacs requires the option -nw. An example of setting WINEDITOR for vi follows: setenv WINEDITOR “xwsh -name mayaEditor -e vi”
An example for vim follows: setenv WINEDITOR “xwsh -geometry 80x57+350+130 -bg 97 -e vim”
2
Log out and log into your user account.
3
Restart Maya.
4
Choose Other from the Editor pull-down menu.
5
Double-click an object name, expression name, or attribute name from the Selection list. The editor appears.
6
Create or edit the expression with the editor.
7
Save the file.
8
Confirm that the Expression Editor detected no syntax errors.
9
Quit the editor.
Selecting an editor for default startup You can make an external text editor start by default each time you start a text editor.
110
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Creating a new expression
To start an editor by default: 1
Choose Options→UI Preferences.
2
In the UI Preferences window, click the Misc folder.
3
Choose the editor in the Expression Editor menu. To choose an editor specified with the WINEDITOR environment variable, select Other.
4
Click Save Changes to close the window.
5
In the Expression Editor, double-click an object name, expression name, or attribute name from the Selection list. The editor appears. The next time you start the Expression Editor, the editor’s name appears in the Editor pull-down menu by default. If you’ve chosen different text editors in UI Preferences and the Editor menu, the one chosen in UI Preferences appears.
Important If you’ve specified a text editor through Options→UI Preferences or with the Expression Editor’s Editor menu, starting the Expression Editor from the Channel Box or Attribute Editor displays the text editor instead of the Expression Editor.
Creating a new expression You can create a new expression after you’ve been editing an existing one.
To create a new expression: 1
Make sure you click the Create or Edit button to compile the existing expression.
2
Choose Select Filter→By Expression Name.
3
Click the New Expression button. This clears the Expression Name box and expression text field so you can create a new expression.
Using Maya: Hypergraph, Sets & Expressions
111
Expressions
Note the text editor appears when you click the New Expression button.
Editing Expressions Deleting an expression When you create the expression, the Expression Editor associates the object name with the expression. This means you can narrow your search for the expression using the object’s name in addition to the expression name. You do not need to select an attribute in the Attributes list. You can associate the expression with an object only. For a particle shape node, you don’t need to select an attribute, as you can create only one creation expression and one runtime expression per particle shape. For nonparticle shape objects, you can create one expression per attribute.
Deleting an expression If you want to stop an expression from controlling attributes, you can delete the expression.
To delete an expression: 1
Display it in the Expression Editor.
2
Click the Delete button.
Using attribute names in expressions A full attribute name has this format: object.attribute where object is the name of the object node and attribute is the name of the attribute. A period separates the name of the object and attribute. Object and attribute names are case-sensitive. You must spell them with uppercase and lowercase letters as they appear in the Expression Editor’s Objects and Attributes lists. You cannot spell attribute names with the common English spellings shown in the Attribute Editor or by default in the Channel Box. The following topics show how you can abbreviate attribute names to save typing time.
112
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Using attribute names in expressions
Using attribute name abbreviations You can use an abbreviation in place of any full attribute name in the expression text field.
Example In place of this: Ball.translateY = time;
you can type this: Ball.ty = time;
Each attribute has at least one acceptable abbreviation. Here are some commonly used attribute name abbreviations for several types of object transform nodes: Abbreviation
translateX
tx
translateY
ty
translateZ
tz
rotateX
rx
rotateY
ry
rotateZ
rz
scaleX
sx
scaleY
sy
scaleZ
sz
visibility
v
Expressions
Long name
To see the abbreviations for attributes that can be keyframed: 1
Select the object or item containing the desired attributes.
2
Turn on Options→Channel Box to display the Channel Box.
Using Maya: Hypergraph, Sets & Expressions
113
Editing Expressions Using attribute names in expressions Common English equivalents for the long attribute names appear in the Channel Box by default. These names are different than the names you must use in the expression text field. If you use the long attribute name, use the name that appears in the Attributes list of the Expression Editor. Do not use the common English language equivalents displayed in the Channel Box.
Use either attribute long names or abbreviated names in expressions
Do not use these common English names
3
From the Channels menu at the top of the Channel Box, select Channel Names→Short. The abbreviated attribute names replace the common English attribute names in the Channel Box.
114
Using Maya: Hypergraph, Sets & Expressions
Editing Expressions Using attribute names in expressions
To see abbreviations for other attributes: Execute this MEL command in the Script Editor: listAttr -sn objectname
where objectname is the name of the object or other node.
Note After you click Create or Edit to compile an expression, Maya converts all attribute abbreviations in the expression to the full attribute name.
Omitting an object name in expressions If you select an object as the Default Object in the Expression Editor, you can omit the object name and period that’s part of a full attribute name.
Example Suppose you’ve selected Ball as the Default Object. In place of this: Ball.translateY = time;
you can type this: Expressions
translateY = time;
Maya interprets translateY as belonging to Ball, the object listed in the Default Object text box of the Expression Editor.
To make an object the Default Object: Enter the object’s name in the Default Object text box. By default, the selected object is also the default object. You can omit the object name only for attributes of the object in the Default Object text box. The Default Object text box is dim when a particle shape node is the selected object in the Expression Editor. Because a particle shape node’s attributes can be controlled by only one creation expression and one runtime expression, the particle shape node is always the default object when it is the selected object.
Using Maya: Hypergraph, Sets & Expressions
115
Editing Expressions Using attribute names in expressions
Combining the abbreviation techniques You can combine the abbreviation techniques mentioned in the two previous topics to minimize typing.
Example Suppose you’ve selected Ball as the Default Object. In place of this: Ball.translateY = time;
you can type this: ty = time;
Maya interprets ty as being the translateY attribute of Ball, the object listed in the Default Object text box of the Expression Editor. Attributes of other objects must be spelled out with the full object and attribute name.
116
Using Maya: Hypergraph, Sets & Expressions
7
Beyond the Basics This chapter describes advanced concepts for writing expressions. Unless otherwise noted, the topics within apply to expressions for attributes of all objects, including particles. For additional details on working with particles, see Chapter 8, “Particle Expressions.”
Rob Tesdahl
This chapter describes the following topics: •
“How often an expression executes” on page 118
•
“Using custom attributes in expressions” on page 118
•
“Displaying attribute and variable contents” on page 123
•
“Reproducing randomness” on page 123
•
“Speeding expression execution” on page 127
•
“Reducing redundant expression execution” on page 130
•
“Removing an attribute from an expression” on page 131
•
“Disconnecting an attribute” on page 132 Using Maya: Hypergraph, Sets & Expressions
117
Expressions
The falling cube is a soft body with goal and springs. As its points move below the floor, an expression assigns them a goal weight of 0. The cube appears to melt as it passes through the floor.
Beyond the Basics How often an expression executes •
“Renaming an object” on page 136
•
“Executing MEL commands in an expression” on page 137
•
“Understanding path names” on page 140
•
“Understanding unexpected attribute values” on page 141
How often an expression executes After you’ve typed an expression in the Expression Editor, you click the Create or Edit button to compile the expression. Compiling the expression checks it for syntax errors and converts it to a form Maya can execute when you rewind or play the animation. After being compiled, the expression executes for the current frame. When you select an object other than a particle shape node, the Expression Editor displays an Always Evaluate checkbox that affects when an expression executes. If you select a particle shape node, the Expression Editor dims this checkbox. For details on particle shape node expressions, see Chapter 8, “Particle Expressions”). Generally an expression executes whenever the current animation time or frame changes. For example, an expression executes when you rewind or play the animation. The expression executes once for each time the animation frame or time changes. An expression also generally executes when your interaction with Maya makes use of an attribute in the expression. For example, if your expression assigns a sphere’s translateX attribute to another attribute and you move the sphere in an X-axis direction, the expression executes upon each increment of the sphere’s movement. Occasionally, it’s useful to turn off Always Evaluate to diminish redundant expression execution and speed Maya operation. Before doing this, it’s best to understand the subtle details of expression execution. See “Reducing redundant expression execution” on page 130 for details.
Using custom attributes in expressions It’s often helpful to add a custom attribute to an object and use it in an expression. You can use a custom attribute to control a combination of other attributes. You can also use a custom attribute as a variable—a place to store a value temporarily to be read by other attributes.
118
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Using custom attributes in expressions Custom attributes have no direct effect on any characteristic of an object. See “Assigning to a custom attribute” in Chapter 8 for details on how to add and use a custom attribute with particles.
Example Suppose you’ve given a NURBS sphere named Planet a circular, orbiting motion in the XY plane with this expression: Planet.tx = sin(time); Planet.ty = cos(time);
Expressions
Planet orbits the origin at a radius of 1 unit. In the following steps, you’ll create a custom attribute named distance to increase the radius of Planet’s orbit over time.
Note The small balls in the preceding figure show the circular path of Planet. They’re in the figure only to help you visualize the motion. They aren’t part of the animation or expression.
To add a custom attribute to alter the orbit: 1
Select Planet.
2
Choose Modify→Add Attribute.
Using Maya: Hypergraph, Sets & Expressions
119
Beyond the Basics Using custom attributes in expressions
3
In the Add Attribute window, enter distance in the Attribute Name text box.
4
Make sure Make attribute keyable is on.
5
Set Data Type to Float, and Attribute Type to Scalar.
6
Set Minimum to 1, Maximum to 10, and Default to 4. Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value displayed for the attribute. An expression isn’t bound by the Minimum and Maximum values. The attribute receives whatever value you assign it in the expression. The expression can read the Default value or any other value you set in the Attribute Editor or Channel Box.
7
120
Click Add to add the attribute, then close the Add Attribute window.
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Using custom attributes in expressions The distance attribute appears in the Attributes list of the Expression Editor for Planet. You can now set or read the value of the attribute in any expression. 8
Edit the expression to this: Planet.tx = distance * sin(time); Planet.ty = distance * cos(time);
Multiplying the sin(time) and the cos(time) by the distance attribute makes Planet circle the origin at a distance specified by the value of the distance attribute. See Chapter 9 for details on the sin and cos functions.
You can make the expression control the distance attribute over time. 9
Edit the expression to this: distance = time; Planet.tx = distance * sin(time); Planet.ty = distance * cos(time);
By setting distance to the value of time, Planet’s orbiting distance increases as playback time increases. Planet moves in a steady outward spiral as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
121
Expressions
Because you gave the distance attribute a default value of 4 when you added it to Planet, playing the animation makes Planet circle the origin at a distance of 4 grid units from the origin.
Beyond the Basics Using custom attributes in expressions
Instead of using an expression to control distance, you can keyframe its value over time. For example, by keyframing a distance value of 1 at frame 1 and a value of 10 at frame 200, Planet moves in a steady outbound spiral as you play the 200 frames. Planet’s distance increases in a linear interpolation from 1 to 10 as the animation plays. You can animate the distance attribute with keyframes or with an expression, not with both.
Tip If an expression controls an attribute and you want to control it with keyframes instead, delete all statements that assign values to the attribute, then click the Edit button. Use the Channel Box to reset the attribute’s value to an initial value, then set keyframes as desired. If keyframes control an attribute and you want to control it with an expression instead, click the attribute’s text box in the Channel Box, then choose Channels→Delete Selected. Assign values to the attribute name in an expression as desired.
122
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Displaying attribute and variable contents
Displaying attribute and variable contents The predefined print( ) function displays attribute contents, variable contents, and other strings in the Script Editor. This is often helpful for debugging an expression. See “print” on page 261 for more details. Note that for a nonparticle expression consisting of only print statements, Always Evaluate must be on in the Expression Editor for the expression to execute.
Reproducing randomness If you execute the rand, sphrand, and gauss functions repeatedly in an expression, Maya returns a sequence of random numbers. (See “Random number functions” on page 239 for details on these functions.) Each time you rewind and play your animation, the sequence of random numbers is different. Often, you’ll want to generate a sequence of random numbers that repeats each time your animation plays. For instance, suppose you use the rand function to assign a random radius to each particle in a stream of emitted particles rendered as Spheres. By default, Maya gives the particles a different sequence of random radius values each time your animation plays.
Important When you set a seed value in an expression or MEL script, the seed value affects the rand, sphrand, and gauss functions in other expressions and MEL scripts. Such functions are affected by this seed value in all scenes you open subsequently in the current work session. This seed value is unrelated to the Seed option available through Settings→Dynamics Controller in the Dynamics menus. The seed function therefore doesn’t affect randomness created with dynamics.
Using Maya: Hypergraph, Sets & Expressions
123
Expressions
To create the same radius values each time the animation plays, you can use the seed function in an expression before the rand, sphrand, or gauss functions execute. There’s no need to execute the seed function more than once per animation unless you need to generate several different repeating sequences of random numbers as your animation plays.
Beyond the Basics Reproducing randomness
Example Suppose you use the rand function to position several marbles at random translateX positions in your scene at frame 1: if (frame == 1) { marble1.tx marble2.tx marble3.tx marble4.tx }
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
The rand(-10,10) returns a random number between -10 and 10 each time it executes. When you rewind the animation to frame 1, Maya might assign these values to the translateX attributes of the marbles:
124
Attribute
Value
marble1.tx
2.922
marble2.tx
5.963
marble3.tx
-4.819
marble4.tx
7.186
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Reproducing randomness The next time you rewind the animation to frame 1, each marble’s translateX attribute receives a different random value. Maya might assign these values: Attribute
Value
marble1.tx
-3.972
marble2.tx
9.108
marble3.tx
-7.244
marble4.tx
-3.065
You can use the seed function to keep the sequence of random values returned by the rand function consistent when you rewind the animation. if (frame == 1) { seed(10); marble1.tx marble2.tx marble3.tx marble4.tx }
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
By setting the seed value to an arbitrary number, for instance, 10, the subsequent executions of the rand function return a repeating sequence of random numbers.
Using Maya: Hypergraph, Sets & Expressions
125
Expressions
You might prefer the marbles’ translateX values to stay the same when you rewind, for instance, so you can composite the marbles correctly among a foggy backdrop.
Beyond the Basics Reproducing randomness When you rewind the animation the first time, Maya might assign these values to the translateX attributes of the marbles: Attribute
Value
marble1.tx
8.020
marble2.tx
-2.973
marble3.tx
-7.709
marble4.tx
0.741
Each time you rewind the animation thereafter, Maya assigns these same values to the translateX attributes of the marbles. The marbles don’t move. Each time a statement sets the seed value to 10, the subsequent executions of the rand function return numbers from the sequence starting at the beginning number. In other words, resetting the seed value to 10 restarts the random number generation process to the first value in the sequence. Suppose you alter the expression to this: if (frame == 1) { seed(10); } marble1.tx marble2.tx marble3.tx marble4.tx
= = = =
rand(-10,10); rand(-10,10); rand(-10,10); rand(-10,10);
When you rewind the animation to frame 1, the expression sets the seed to 10. Maya assigns values to the marbles’ translateX attributes as in the previous expression.
126
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Speeding expression execution Because the expression doesn’t set the seed value in frames other than frame 1, playing the animation causes the rand function to return a new, yet repeating, sequence of random numbers each frame. If you play the animation several times, the translateX values will constantly change during animation, but the sequence of values will be identical each time you play the animation. You can assign the seed a different value to generate a different sequence of returned values. See “seed” on page 246 for details.
Speeding expression execution Maya does calculations internally in centimeters, radians, and seconds. A radian is an angular unit commonly used in mathematics. It equals 180 degrees divided by pi, or roughly 57.3 degrees. When you assign a number to an attribute whose value is a measurement unit, the expression interprets the number, by default, as the appropriate unit selected in the Units folder of the General Preferences window. By default, the Units folder selections are centimeters, degrees, and seconds. If a measurement unit you’ve chosen in the Units folder differs from the corresponding internal unit, Maya converts the number to the appropriate internal unit to do the assignment. Expressions
Example Suppose you’ve selected degrees from the Angular menu in the Units folder. You then write this expression for an object named Ball: Ball.rotateZ = 10;
Maya reads the 10 as being 10 degrees, then converts the value to the appropriate number of radians to make the assignment to Ball’s rotateZ attribute. The conversion happens automatically. From your standpoint, Maya is simply rotating Ball 10 degrees. In nonparticle expressions, these automatic conversions affect Maya performance. Because the expression executes slower, Maya slows when you play, rewind, or otherwise change the animation time. Saving, opening, and other file operations on the scene containing the expression are also slower. To boost Maya performance, you can turn off conversion to internal units. If you do so, you must convert units in expression statements.
Using Maya: Hypergraph, Sets & Expressions
127
Beyond the Basics Speeding expression execution
To speed expression execution: 1
Display the Expression Editor.
2
Choose one of these Convert Units options: None
Converts no units. You must assign values to attributes as centimeters, radians, or seconds, as appropriate. Execution is fastest with this option.
Angular Only
Converts angular units, but no others. You must assign values to attributes as centimeters, seconds, and degrees, as appropriate. (This assumes you’re using the default degree setting in the Units folder. If you’ve selected radians, you must enter radians.) If you’re confused by converting degrees to radians, select this option. Execution is fast with this option—unless the expression has many angular values.
To return to default conversions: 1
Display the Expression Editor.
2
For the Convert Units option, choose All. This lets you enter all measurement numbers in the same units specified in the Units preference settings. Execution is slowest with this selection, but expression writing is simplest. You can set a different conversion option for each expression.
Example Suppose, in the Units folder, you’ve set Linear units to millimeters and Angular units to degrees. You then write the following expression: Ball.translateX = 5; Ball.rotateZ = 10;
All causes Maya to read 5 as millimeters and 10 as degrees. None causes Maya to read 5 as centimeters and 10 as radians. Angular causes Maya to read 5 as centimeters and 10 as degrees.
To convert units in an expression statement: You must convert the units mathematically in a statement.
128
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Speeding expression execution
Examples Suppose, in the Units folder, you’ve set Linear units to millimeters and Angular units to degrees. In the Expression Editor you set the Convert Units option to None and enter this expression: Ball.translateX = 5; Ball.rotateZ = 10;
None causes Maya to read 5 as centimeters and 10 as radians, which is not the result you’re seeking. To assign 5 millimeters to Ball’s translateX attribute, you must convert 5 to the appropriate number of centimeters. To assign 10 degrees to Ball’s rotateZ attribute, you must convert 10 to the appropriate number of radians. The following statements do this: Ball.translateX = 5.0 / 10.0; Ball.rotateZ = 10.0 / 57.3;
There are 10 millimeters per centimeter. In other words, a millimeter is a centimeter divided by 10. So 5 millimeters equals 5 centimeters divided by 10. You therefore use the operation 5.0 / 10.0.
When you divide floating point attributes or variables, enter the floating point value 5.0 for an even number such as 5. This ensures that the division works as expected. For more details, see the note in “Using mixed data types with arithmetic operators” on page 145. There are 57.3 degrees per radian. In other words, a degree is a radian divided by 57.3. So 10 degrees equals 10 radians divided by 57.3. You therefore use the value 10.0 / 57.3. If you need a more precise conversion to radians, divide a degree by 57.29578 instead of 57.3. You can instead use the deg_to_rad function as follows: Ball.rotateZ = deg_to_rad(10.0);
The deg_to_rad function converts 10.0 degrees to a precise radian equivalent. See “deg_to_rad” on page 234 for details.
Using Maya: Hypergraph, Sets & Expressions
129
Expressions
Important
Beyond the Basics Reducing redundant expression execution Turning off unit conversion affects only expressions. It doesn’t affect other Maya commands, options, or displays. For instance, the preceding example expression assigns centimeters to translateX and radians to rotateZ. The Channel Box still displays values for these attributes in millimeters and degrees. It displays values in whatever units you choose in the Units folder of the General Preferences window. Note that you can’t turn off unit conversion for particle shape node expressions. Maya handles unit conversion differently for such expressions with little impact on performance.
Reducing redundant expression execution If your expression has redundant statement calculations, you can turn off Always Evaluate to speed up scrubbing and playback of your animation. To understand when this feature is useful, you must understand the subtle details of expression execution. An expression generally executes whenever the animation time changes. An expression also executes whenever an attribute that’s read by the expression changes value, and either of the following two actions occurs: •
Some other node in Maya uses the value of an attribute the expression writes to. For example, a deformer or shader uses its value.
•
Maya needs the value of an attribute to which it writes in order to redraw the workspace contents. In this context, the predefined variables time and frame are also considered attributes the expression reads. Suppose you write an expression that moves a NURBS sphere along the Yaxis at twice the current value of its X-axis translation: nurbsSphere1.translateY = 2 * nurbsSphere1.translateX;
If you use the Move tool in the workspace to drag the sphere in an X-axis direction, Maya executes the expression for each incremental change to the translateX attribute as you drag. Dragging the sphere in the X direction changes the value of the translateX attribute in the expression. As you drag the sphere and Maya updates the workspace display, the value of the translateY attribute changes in the expression. This makes the expression execute.
130
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Removing an attribute from an expression If you turn Always Evaluate off, an expression won’t execute if it contains only print function statements, variable assignments, or assignments that do not read attribute values.
Example global float $BallHeight = 5; print($BallHeight+"\n"); nurbsSphere1.tx = rand(1); print(nurbsSphere1.tx+"\n");
The first statement declares and assigns a value to the variable $BallHeight, which is not an attribute. The next statement prints the $BallHeight but assigns no value to an attribute. The next statement assigns an attribute a value, but the value is generated by the random number function rand. This function doesn’t read an attribute value. For details on the rand function, see “rand” on page 243. The last statement reads and prints the value of an attribute, but doesn’t assign a value to an attribute. None of these actions causes the expression to execute when Always Evaluate is off.
For most animations, expressions execute regardless of whether Always Evaluate is on. If in doubt, leave it on.
Removing an attribute from an expression If you do any of the following actions, an expression no longer sets or reads an attribute: •
Delete all occurrences of the attribute name in the expression.
•
Convert to comments all statements that use the attribute name in the expression.
•
Delete the expression that contains the attribute. Following these actions, the attribute keeps its value from the last time the expression executed and set its value.
Using Maya: Hypergraph, Sets & Expressions
131
Expressions
Always Evaluate affects only the expression you’re creating or editing. You can turn it on for one expression and off for another.
Beyond the Basics Disconnecting an attribute The attribute doesn’t return to the value it had before the expression set it. To return the attribute to its original value, use the Channel Box or Attribute Editor to set the attribute.
Disconnecting an attribute If you disconnect an attribute from an expression, the expression no longer reads or set its value. You might want to disconnect an attribute, for example, so you can keyframe the attribute rather than control it with an expression. These actions disconnect an attribute from an expression: •
Delete from the scene an object with an attribute that exists in the expression.
•
Use the Window→General Editors→Connection Editor to disconnect the attribute from the expression.
•
Use the MEL disconnectAttr command.
•
Use the MEL choice command.
Tip The MEL choice command lets you control an attribute alternately with two or more techniques in different frames. For example, you can keyframe an attribute for frames 1-48, control it with an expression for frames 48-96, and control it with a motion path for subsequent frames.
Displaying disconnected attributes in expressions The Expression Editor displays a disconnected attribute with a symbolic placeholder representing the attribute’s former existence in the expression.
Example Suppose your scene has two objects, Ball and Cone, and you’ve written this expression: Ball.translateX = Cone.translateX; Ball.translateY = Cone.translateY; Ball.translateZ = Cone.translateZ;
132
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Disconnecting an attribute If you delete Cone from the scene, Cone.translateX, Cone.translateY, and Cone.translateZ attributes no longer exist for the expression to read and assign to Ball’s translateX, translateY, and translateZ attributes. If you display the expression again, it appears as follows: Ball.translateX = .I[0]; Ball.translateY = .I[1]; Ball.translateZ = .I[2];
The .I[0], .I[1], and .I[2] characters indicate you’ve disconnected Cone’s translate attributes from the expression. These symbols represent placeholders for the former use of the attributes in the expression. The .I means the placeholder represents an input to the expression. An input to an expression is an attribute with a value the expression reads for assignment to another attribute or variable. The number in brackets indicates the order in the expression the attribute was read. For example, .I[0] indicates the input is the first attribute read in the expression, .I[1] indicates the input is the second attribute read, and .I[2] indicates the input is the third attribute read.
Note that if you disconnect an attribute from an expression but the attribute still exists in the scene, the attribute keeps its value from the last time the expression executed and set its value.
Example Suppose you’ve written these statements among others: Ball.translateX = Cone.translateX; Ball.translateY = Cone.translateY; Ball.translateZ = Cone.translateZ;
If you delete Ball from the scene, Ball.translateX, Ball.translateY, and Ball.translateZ attributes no longer exist. The expression can no longer assign Cone’s translateX, translateY, and translateZ values to the corresponding Ball attributes.
Using Maya: Hypergraph, Sets & Expressions
133
Expressions
A floating point or integer attribute placeholder has a value of 0. A particle shape node’s vector attribute placeholder has a value of <<0,0,0>>. In the example, the placeholders .I[0], .I[1], and I[2] have the value 0. When the expression executes, it assigns Ball.translateX, Ball.translateY, and Ball.translateZ the value 0.
Beyond the Basics Disconnecting an attribute Symbolic placeholders replace Ball attributes in the expression. If you display the expression again, the statements appear as follows: .O[0] = Cone.translateX; .O[1] = Cone.translateY; .O[2] = Cone.translateZ;
Note If an expression assigns values to the attributes of only one object, deleting the object deletes the expression also. If your expression assigns values to attributes of several object attributes, deleting all those objects deletes the expression. To avoid deleting the expression in the preceding example, you would need have some statement that sets an attribute of an object other than the deleted Ball. For example, you might include this statement: Cone.visibility = 1;
The .O[0] characters indicate you’ve disconnected the attribute Ball.translateY from the expression. The .O indicates that the placeholder represents an output from the expression. An output from an expression is an attribute assigned a value by the expression. The number in brackets, for example, [0], indicates the order in which the attribute was assigned a value in the expression. Because Ball.translateX was the first output from the expression, the expression replaces it with .O[0]. The expression replaces Ball.translateY and Ball.translateZ with .O[1] and .O[2] because they were the second and third outputs from the expression. When the expression executes, it continues to assign values to the placeholder, though the placeholder has no effect on any object or component of scene. The expression assigns the placeholders .O[0], .O[1], and .O[2] the value of Cone.translateX, Cone.translateY, and Cone.translateZ, but these placeholders don’t control anything in the scene. The statements have no effect.
134
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Disconnecting an attribute
Connecting an attribute to a symbolic placeholder After you’ve disconnected an attribute from an expression, a symbolic placeholder replaces it in the expression as described in the preceding topic. You can replace the placeholder with the attribute of your choice. The most obvious way to do this is to type the desired attribute name in every occurrence of the symbolic placeholder in the expression. If you have a lengthy expression that has lots of symbolic placeholders, you can use a single MEL connectAttr command to connect the new attribute to all occurrences of the same symbolic placeholder. You can also use Window→General Editors→Connection Editor.
Example 1 Suppose you have these statements among others in an expression named HorseController: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; BrownHorse.translateX = Car.translateX;
Deleting the Car and reloading the expression shows this:
.I[0] is the symbolic placeholder for what was the Car.translateX attribute. You can connect a different attribute to this placeholder to assign its contents to the translateX attributes of WhiteHorse, BlackHorse, and BrownHorse. Suppose you want to control these attributes with the translateX attribute of an object named Cow. You can enter the following MEL command at the Command Line: connectAttr Cow.tx HorseController.input[0]
This command connects the attribute Cow.tx to the expression’s input[0]. The expression is named HorseController. The input[0] is abbreviated as .I[0] in the expression. You can see the spelled-out input name input[0] in the Graph→Up and Downstream Connections display of the Hypergraph. Reloading the expression shows the new attribute connection: WhiteHorse.translateX = Cow.translateX; BlackHorse.translateX = Cow.translateX; BrownHorse.translateX = Cow.translateX;
Using Maya: Hypergraph, Sets & Expressions
135
Expressions
WhiteHorse.translateX = .I[0]; BlackHorse.translateX = .I[0]; BrownHorse.translateX = .I[0];
Beyond the Basics Renaming an object
Example 2 You can also reconnect an expression’s output with the connectAttr command. Suppose you have these statements among others in an expression named HorseController: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; BrownHorse.translateX = Car.translateX;
Deleting the BrownHorse object and reloading the expression displays this: WhiteHorse.translateX = Car.translateX; BlackHorse.translateX = Car.translateX; .O[2] = Car.translateX;
.O[2] is the symbolic placeholder for what was the BrownHorse.translateX attribute. It received the placeholder .O[2] because it’s the third output from the expression. (The first and second outputs from the expression are .O[0] and .O[1] .) You can connect a different object attribute to this placeholder to control it with the value in Car.translateX, as shown in the third statement. Suppose you want to control the attribute of a new object named RedHorse.translateX with the Car.translateX value. You can enter the following MEL command in the Command Line: connectAttr HorseController.output[2] RedHorse.tx
This command connects the HorseController expression’s output[2] to the attribute RedHorse.tx. The output[2] is abbreviated .O[2] in the expression. Reloading the expression shows the new attribute connection: WhiteHorse.translateX = Cow.translateX; BlackHorse.translateX = Cow.translateX; RedHorse.translateX = Cow.translateX;
Renaming an object If you rename an object whose attributes were used in an expression, the Expression Editor continues to read or set the attributes. Maya doesn’t disconnect the attribute from the expression. The Expression Editor converts to the new name of the object the next time you click the Reload button in the Expression Editor.
136
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Executing MEL commands in an expression
Note When you reload an expression, the Expression Editor converts any short attribute names to their long attribute name equivalents. For example, if you originally type the attribute name Ball.ty, reloading the expression renames it as Ball.translateY.
Executing MEL commands in an expression You can execute MEL commands and procedures in an expression. However, if you make or break connections or add or delete nodes, your scene might malfunction. Rewinding your animation does not undo MEL command execution in an expression. For instance, if your expression executes MEL commands to create a pair of spheres, rewinding doesn’t delete the spheres. Moreover, playing the scene again creates another pair of spheres. Though you can usually undo executed MEL commands by selecting Edit→Undo repeatedly, this might not work if your scene is malfunctioning.
You can execute MEL commands in an expression with several techniques: •
MEL command alone in a statement
•
MEL command within left-hand single quote marks
•
MEL command used as an argument to an eval function
•
MEL procedure call to a procedure in a MEL script The following topics explain the techniques. See Using MEL for details on MEL.
Using a MEL command alone in a statement The simplest way to use a MEL command in an expression is to type it in a statement exactly as you would in the Script Editor or in a MEL script.
Example select -cl;
Using Maya: Hypergraph, Sets & Expressions
137
Expressions
When you execute a command from the Command Line, status information appears in the Script Editor and the Command Line’s response area. This information is not displayed when a command executes in an expression.
Beyond the Basics Executing MEL commands in an expression This example shows the use of a MEL command alone. The statement executes exactly as it would in the Script Editor, except no command output appears in the Script Editor.
Using a MEL command within single quote marks If you enclose a command within left-hand single quote marks (‘), Maya returns command output where the command is in the statement. You can assign this output to a variable to, for example, display it in the Script Editor.
Example string $a[]; $a = ‘ls -lights‘; print($a);
The first statement defines an array named $a. The second statement executes the MEL command within quotes, then assigns the command’s output to array $a. The third statement displays the contents of $a to the Script Editor as follows: ambientLightShape1 directionalLightShape1
Using a MEL command with the eval function Using a MEL command with the eval function has an advantage over the previous two techniques: you can build a command from a string.
Example string $mycommand = "sphere"; eval($mycommand+" -r 5");
The first statement assigns the string sphere to the variable $mycommand. The second statement appends -r 5 to sphere and executes the complete command sphere -r 5. This creates a sphere with a radius of 5 grid units. See “eval” on page 259 for more details.
Using a MEL procedure in an expression You can execute a MEL procedure in an expression by entering the procedure name in a statement.
138
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Executing MEL commands in an expression
To execute a MEL procedure: 1
Give the script the same filename as the procedure it contains, but with the extension .mel. For example, if your procedure name is randspot( ), name your script file randspot.mel.
2
Put the script file in your Maya scripts directory.
3
Declare the procedure as global in the script file as in this example: global proc string randspot()
4
In an expression statement, use a statement that calls the procedure. You can use the statement within left-hand single quote marks with an eval function, or alone as in this example: randspot();
A complete example of calling a MEL procedure from an expression follow:
Example Suppose, in your Maya scripts directory, you’ve created a MEL script file named randspot.mel with the following contents:
Expressions
global proc string randspot() { string $mycommand; if (rand(2) < 1) $mycommand = "particle -p "+ sphrand(10); else $mycommand = "sphere -p "+ sphrand(10); return $mycommand; }
Further suppose you’ve created this expression: string $randcommand = randspot(); eval($randcommand);
When you rewind or play a frame in the animation, the expression executes. The first expression statement executes the randspot procedure in the randspot.mel script file. In the randspot procedure, the rand(2) part of the ifelse statement generates a random floating point value between 0 and 2, then compares its value to 1. For details on the rand function, see “rand” on page 243. Using Maya: Hypergraph, Sets & Expressions
139
Beyond the Basics Understanding path names If the rand(2) function returns a value less than 1, the if statement assigns a MEL command string such as particle -p -1.356 5.983 8.458 to $mycommand. The + sphrand(10) part of the statement appends to sphere -p the three floating point components of a randomly generated vector. Though sphrand(10) returns a vector, Maya converts the vector to a string upon assigning it to the string $mycommand. For details on the sphrand function, see “sphrand” on page 244. The converted string contains no double angle brackets or commas, but does contain a space character between the floating point components. A space between the floating point components is required syntax for the MEL particle command as used above. If the rand(2) function returns a value greater than 1, $mycommand receives a MEL command string such as sphere -p 4.926 -2.589 1.274. The procedure finishes executing and passes the value of $mycommand back to the expression’s calling procedure randspot( ). This assigns the command string to the variable $randcommand. The eval function executes the command string in $randcommand. For example, if the statement executes particle -p -1.356 5.983 8.458, it creates a particle with coordinates <<1.356, 5.983, 8.458>>. The expression executes each frame and creates a new particle or sphere at a random location within a spherical radius of 10 units from the origin.
Understanding path names If two objects in a scene have different parents, they can have the same object name. If you refer to an attribute of such an object in an expression, you must use a more complete name that includes the object’s path name. An object’s path name has this format: pathname|objectname.attributename where pathname is the parent node’s name, objectname is the object’s name, and attributename is the attribute’s name of the attribute. A pipe symbol (|) symbol divides the pathname from the object name. Don’t type spaces before or after the | symbol.
140
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values For example, a scene might have a child of GroupA named Ball.tx and a different child of GroupB named Ball.tx. If you write this statement: Ball.tx = time;
Maya generates an error because it doesn’t know which Ball.tx to set. To eliminate the error, you must enter the pathname of the attribute as in this example: GroupA|Ball.tx = time;
The | symbol between GroupA and Ball.tx indicates that the object to the left of the symbol is the parent of the object to its right. Use no spaces before or after the | symbol.
Understanding unexpected attribute values As you work with expressions, you’ll sometimes see attribute values you didn’t expect. The following topics describe a few common causes of confusion.
Important
Values after rewinding When you rewind a scene, an expression executes with the last settings made for attribute values. This sometimes gives unexpected results.
Example Ball.tx = $distance; $distance = time;
Assume for this example you’ve set the starting frame of the animation to frame 0. The first statement sets Ball.tx to the variable $distance. The second statement sets $distance to the value of time.
Using Maya: Hypergraph, Sets & Expressions
141
Expressions
Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might lead you to believe your editing changes took effect.
Beyond the Basics Understanding unexpected attribute values When you play the animation, Ball moves along the X-axis with the increase in time. Ball’s X-axis position is 4 grid units, for example, when animation time equals 4 seconds. When you rewind the animation, Ball’s position along the X-axis doesn’t return to 0 as you might assume. The previous execution of the expression at time equals 4 set the $distance variable to 4. So rewinding sets Ball.tx to 4, then sets the value of $distance to 0, the value of time upon rewinding. If you rewind again, Ball’s position along the X-axis returns to 0 as desired. Because the previous execution of the expression upon rewinding set the $distance to 0, the expression now correctly sets Ball.tx to 0. To fix this problem, reverse the order of the statements and compile the expression: $distance = time; Ball.tx = $distance;
After you play and rewind the expression, the first statement executes and assigns the time to $distance. The next statement assigns Ball.tx the value of $distance, which the first statement set to the value of time. Because $distance is set to 0 as the first statement after rewinding, Ball returns to the desired translateX position.
Increment operations If you increment an attribute or variable during animation, you might be confused by its behavior.
Example Ball.ty = 0; Ball.ty = Ball.ty + 1;
Ball’s translateY position stays at 1 unit along the Y-axis. Ball’s translateY position doesn’t increase by 1 each frame as the animation plays.
Example Ball.ty = Ball.ty + 1;
Ball’s translateY position increases by 1 each frame as you play the animation. When you rewind the animation, translateY increases by 1 again.
142
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values When you play the animation again, the translateY position increases by 1 each frame. If you rewind the animation or drag the current time indicator, the translateY position continues to move up the Y-axis. The attribute never returns to its original position. To return Ball to a starting position each time you rewind, you must initialize the attribute to a starting value. For example, you could use the following expression: Ball.ty = Ball.ty + 1; if (frame == 1) Ball.translateY = 0;
This returns Ball to a Y position of 0 when you rewind to frame 1. When you drag the current time indicator, though, Ball doesn’t return to its Y position of 0. The if statement resets the value of translateY to 0 only when frame 1 plays. Frame 1 is the default frame that plays when you rewind an animation. You would need to use a different frame number in the if statement if you’ve set your animation to start at a different frame.
Data type conversions
The following topics describe the conversions that occur in such instances. Understanding these details might help you troubleshoot unexpected attribute and variable values. Unless you have programming experience, don’t intentionally convert data types. You might be confused by unexpected attribute and variable values.
Assigning to a floating point attribute or variable If you assign a vector to a floating point attribute or variable, Maya converts the vector to a floating point value according to this equation: 2
2
x +y +z
2
The x, y, and z numbers in the formula represent the three components in the vector. The resulting value is the magnitude of the vector.
Using Maya: Hypergraph, Sets & Expressions
143
Expressions
Maya is flexible in its handling of data types. If you do assignment or arithmetic operations between two different data types, Maya converts data type as necessary and doesn’t report a syntax error.
Beyond the Basics Understanding unexpected attribute values
Example Ball.scaleY = <<1,2,0>>;
Maya assigns the floating point scaleY attribute the converted vector: 2
2
2
1 +2 +0 =
5 = 2.236
If you assign an integer to a floating point attribute or variable, Maya makes no conversion. None is necessary.
Example Ball.scaleY = 1;
Maya assigns the value 1 to Ball.scaleY.
Assigning to an integer attribute or variable If you assign a floating point value to an integer attribute or variable, Maya deletes the decimal part of the number. If you assign a vector to an integer attribute or variable, Maya converts the vector to an integer using the square root equation in the previous topic. However, it deletes the decimal component of the result.
Example int $pi = 3.14;
Maya assigns the integer variable $pi the value 3. int $temp = <<1,2,0>>;
Maya assigns the integer variable $temp this vector value: 2
2
2
1 +2 +0 =
5 = 2.236 ≈ 2
It deletes the decimal component .2360607. The $temp variable receives the truncated value 2.
144
Using Maya: Hypergraph, Sets & Expressions
Beyond the Basics Understanding unexpected attribute values
Assigning to a vector attribute or variable If you assign an integer or floating point value to a vector attribute or variable, Maya puts the integer or floating point value into each component of the vector.
Example vector $speed = 1.34;
Because $speed is a vector, Maya assigns it <<1.34,1.34,1.34>>.
Using mixed data types with arithmetic operators The following table lists how Maya converts data types when you use arithmetic operators between different types in an expression. Operation
Resulting data type
integer operator float
float
integer operator vector
vector
vector operator float
vector
Suppose you multiply a vector variable named $velocity by a floating point number 0.5 as follows: $race = $velocity * 0.5;
If $velocity is <<2,3,0>> when the preceding expression executes, the $race variable is assigned the resulting vector value <<1,1.5,0>>.
Using Maya: Hypergraph, Sets & Expressions
145
Expressions
Example
Beyond the Basics Understanding unexpected attribute values
Important When Maya does arithmetic operations on literal constants and variables without a declared data type, it guesses the data type based on the values present. In the statement Ball.scaleY = 1/3;, for example, Maya treats 1 and 3 as integers because they have no decimal points. The expression divides integer 1 by integer 3. The integer result is 0 with a remainder of 1. Maya discards the remainder. Because Ball.scaleY is a floating point attribute, Maya converts the integer 0 result to floating point 0 (which is the same value), then assigns it to Ball.scaleY. To get the intended result of 1/3, you must type Ball.scaleY = 1.0/3.0; Maya treats 1.0 and 3.0 as floating point numbers because they have decimal points. The number 1.0 divided by 3.0 results in 0.33333333333.
146
Using Maya: Hypergraph, Sets & Expressions
8
Particle Expressions Particle expressions are more complex than other types of expressions. For example, you can write an expression to control all particles in an object the same way, or you can control each particle differently. Execution of expressions differs for particles than for other types of objects. To become proficient with particle expressions takes more study than for other expressions, but the resulting effects are worth the effort. This chapter guides you through the intricacies of working with particle expressions.
Claude Macri
This chapter has the following topics: •
“Understanding particle expressions” on page 148
•
“Understanding creation expression execution” on page 149
•
“Writing creation expressions” on page 150
•
“Understanding runtime expression execution” on page 152
•
“Writing runtime expressions” on page 153
•
“Working with particle attributes” on page 159
•
“Assigning to vectors and vector arrays” on page 193
•
“List of particle shape attributes” on page 196 Using Maya: Hypergraph, Sets & Expressions
147
Expressions
An expression moves a particle emitter in a corkscrew pattern and changes the color of trailing emitted particles as they age. The particles are displayed as Spheres render type.
Particle Expressions Understanding particle expressions
Understanding particle expressions If you select a particle shape node, the Creation and Runtime buttons in the Expression Editor are no longer dim and you can select them.
Buttons lit for particle shapes
These buttons let you write two types of expressions: creation and runtime. You can use both types for any attribute of a particle shape node. Though the details of execution are subtle, a creation expression generally executes when you rewind an animation or when a particle is emitted. A runtime expression typically executes for each frame other than the rewind frame or the frame in which a particle is emitted. By default, either type of expression executes once for each particle in the object. Creation and runtime expressions don’t execute at the same time. The age of each particle in the object determines whether a runtime expression or creation expression executes. Execution details are in “Understanding creation expression execution” on page 149 and “Understanding runtime expression execution” on page 152. The Default Object, Always Evaluate, and Convert Units options become dim when you select a particle shape node, and you can’t use them. Default Object is dim because a particle shape node’s attributes can be controlled by only one creation expression and one runtime expression. The particle shape node is always the default object when it’s the selected object. Always Evaluate is dim for particle shape node expressions because it has no effect on particle shape node expressions. See “How often an expression executes” in Chapter 7 for details on the checkbox.
148
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Understanding creation expression execution Convert Units is not selectable because you can’t alter how Maya handles unit conversions for particle shape node expressions. See “Speeding expression execution” on page 127 for details on how Maya converts units for other types of expressions.
Important You can’t write a different expression for each particle shape attribute as you can for other types of objects. Because you can write only one creation expression per particle shape, you don’t need to select an attribute from the Expression Editor’s Attributes list.
Understanding creation expression execution For a particle you create with the Particle Tool, a creation expression executes when you rewind the animation. For an emitted particle, a creation expression executes in the frame where the particle is emitted. However, there are exceptions to these rules as described in the following topics. Note that rewinding an animation two or more times in succession without playing the animation doesn’t execute a creation expression. Because no attribute value changes when you rewind several times in succession, the expression doesn’t execute.
Setting the dynamics start frame A creation expression executes once for each particle whose age is 0 when Maya evaluates dynamics. Maya evaluates dynamics whenever the animation time changes and it’s greater than or equal to the dynamics Start Frame setting—frame 1 by default. The Start Frame specifies when dynamic calculations begin for your animation. This option is available through Settings→Dynamics Controller, in the Extra Attributes section of the Attribute Editor. The animation time changes when you rewind, play, or otherwise change the current frame displayed. An emitted particle’s age is 0 in the frame where it’s emitted.
Using Maya: Hypergraph, Sets & Expressions
149
Expressions
You might also notice that all expressions in your scene are compiled and executed each time you open the scene. This occurs for architectural reasons and is unimportant to your work with expressions.
Particle Expressions Writing creation expressions Particles created with the Particle Tool have an age of 0 on and before the Start Frame. With the default animation frame range and Start Frame, rewinding an animation to frame 1 returns such particles to age 0. If you set the Time Slider’s start frame higher than the dynamics Start Frame, be aware that rewinding the animation might cause the age of particles to be greater than 0. If this occurs, the creation rule for the particles won’t execute.
Tip You can set options in the Attribute Editor to display the age of an object’s particles in the workspace. Set the particle shape’s Render Type to Numeric, click Add Attributes For Current Render Type, and enter age in the Attribute Name box. The age appears next to each particle. You can also examine the age of an object’s particles by entering print(age+“\n”) in a particle expression. See “print” on page 261.
Setting attributes for initial state usage If, at some frame, you’ve saved a particle shape’s attributes for its initial state, rewinding an animation does not return the age of the particles to 0. Suppose you’ve created a particle grid having an opacity attribute that fades gradually as the animation plays. You stop the animation at some frame where you decide the grid’s opacity looks good as a starting point for the animation. You then choose Settings→Initial State→Set For Current to cause the current value of the object’s attributes—including age—to become the initial state values. If you rewind the animation, the age of the particles in the grid is equal to age at the time you chose Set For Current. The age of the particles therefore is not equal to 0 when you rewind the scene. See “Understanding initial state attributes” on page 162 for more details on initial state attributes.
Writing creation expressions A creation expression is useful for attributes that don’t need to change during animation. For example, you might want all particles in an object to have a single velocity for the duration of an animation.
150
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing creation expressions A creation expression is also useful for initializing an attribute’s value for the first frame before a runtime expression takes control of the attribute value in subsequent frames. See “Writing runtime expressions” on page 153 for an example of the interaction between a runtime and creation expression.
Example Suppose you’ve used the Particle Tool to place a collection of particles in the workspace. You then create the following creation expression to control their velocity: particleShape1.velocity = <<0,1,0>>;
Important To use an expression to control particle attributes, make sure the selected object in the Expression Editor is a particle shape node, not the transform node of the particle object. If a particle object’s transform node is selected rather than the particle shape node, move the mouse pointer to the workspace and press your keyboard’s down arrow. This selects the particle shape node.
Using Maya: Hypergraph, Sets & Expressions
151
Expressions
All the particles move in a Y-axis direction at one grid unit per second as the animation plays.
Particle Expressions Understanding runtime expression execution
Understanding runtime expression execution For a particle you’ve created with the Particle Tool, a runtime expression typically executes in each frame after the frame that appears upon rewinding. For an emitted particle, a runtime expression typically executes in each frame after the first one where the particle was emitted. More specifically, a runtime expression executes once for each particle whose age is greater than 0, each time Maya evaluates dynamics. Maya evaluates dynamics whenever the Time Slider time changes and the time is greater than or equal to the dynamics Start Frame. To set the dynamics Start Frame, select Settings→Dynamics Controller from the Dynamics menu bar. Time changes when you rewind, play, or otherwise change the current frame displayed. A runtime expression executes once per oversample level per frame as you play or otherwise change the animation time. For example, if the oversample level is 4, Maya executes a particle shape expression four times per frame for each particle in the object. Use Settings→Dynamics Controller from the Dynamics menu to set the Oversample Level. Maya’s default setting is 1. In addition to executing when animation time changes, a runtime expression executes when the value of an attribute it reads changes, and when either of these actions occurs for an attribute the expression writes to: •
Some other node in Maya uses its value.
•
Maya needs the value to redraw the workspace contents. In this context, the predefined variables time and frame are also considered attributes the expression reads.
Important There are no creation expressions for nodes other than particle shape nodes. Such objects have only one type of expression. (It’s similar to a runtime expression.) For a particle shape node, you can write only one runtime expression for all its attributes. You don’t need to select an attribute from the Attributes list. You can create only one runtime expression per particle shape.
152
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Writing runtime expressions A runtime expression controls an attribute as an animation plays. Maya updates any attribute that’s assigned a value in a runtime expression each time the expression executes. This typically occurs once per frame. If an attribute is not set by a runtime expression, the attribute uses the creation expression value for subsequent frames of the animation.
Example Suppose you’ve created a grid of particles, then create this runtime expression for its velocity attribute: particleShape1.velocity = <<0,1,0>>;
The expression moves the grid of particles up at 1 grid unit per second as the animation plays.
Using Maya: Hypergraph, Sets & Expressions
Expressions
Constant upward velocity
153
Particle Expressions Writing runtime expressions
Note To make the illustrations of particles easier to see in this and other chapters, we show them as small, shaded spheres rather than points.
To display particles as spheres: 1
Select the particle shape node.
2
In the Attribute Editor’s Render Attributes section, choose Spheres for the Render Type.
3
Click the Current Render Type button next to Add Attributes For. A Radius slider appears below the button.
4
Adjust the Radius to set the size of the spheres.
5
Turn on Shading→Smooth Shade All (at the upper left of the workspace).
With the default frame rate of 24 frames/second, the particles move 1/24 of a grid unit each frame. With the default oversampling level of 1, the runtime expression executes once per frame. Maya calculates the runtime expression once for each particle of an object. Because the expression sets the velocity to <<0,1,0>> each frame, the expression executes redundantly. This expression would therefore be more appropriate for a creation expression. However, either type of expression has the same effect in this example.
Example Suppose you’ve created a grid of particles, and your animation’s starting frame number is 0. You create this runtime expression for its velocity attribute: particleShape1.velocity = <<0,time,0>>;
The expression increases the Y component of velocity with the increasing value of time as the animation plays. This makes all particles in the grid rise with increasing velocity as the time increases. An increasing velocity is the same as acceleration.
154
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Increasing upward velocity
You need to use the statement in a runtime expression rather than a creation expression, because you’re increasing a value in the assignment each frame. Using the statement in a creation expression would instead set the velocity to a constant value <<0,0,0>>, because time equals 0 when the creation expression executes for the particle grid.
Example The previous examples gave all particles the same value for the velocity attribute. You can instead give each particle a different value for an attribute. Expressions
Suppose you’ve created a grid of 121 particles.
Suppose further you create this runtime expression for its acceleration attribute: particleShape1.acceleration = sphrand(2);
Using Maya: Hypergraph, Sets & Expressions
155
Particle Expressions Writing runtime expressions The expression executes once for each of the 121 particles each time the runtime expression executes. The sphrand(2) function provides a vector whose randomly selected components reside within an imaginary sphere centered at the origin and with a radius of 2. Each particle receives a different vector value. For details on the sphrand function, see “sphrand” in Chapter 9. Because each particle receives a different random vector for its acceleration each frame, the particles accelerate individually in a constantly changing direction and rate as the scene plays. This gives the acceleration abrupt changes in direction.
Important To give particles a constant acceleration, assign the acceleration attribute a constant value in a runtime expression rather than in a creation expression. Maya simulates the physics of acceleration. It initializes acceleration to <<0,0,0>> before each frame, or if the oversample level is greater than 1, before each timestep. If the oversample level is 2, there are 2 timesteps per frame. If the oversample level is 3, there are 3 timesteps per frame, and so on.
156
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Writing runtime expressions
Example Suppose you’ve set your animation’s starting frame to 0, and you’ve used the Particle Tool to place a single particle at the origin:
You then create a runtime expression to control its position: particleShape1.position = <<3,time,0>>;
When you play the animation, the runtime expression takes control of the attribute. In the first frame that plays, the particle jumps to <<3, time, 0>>. At the default frame rate of 24 frames/second, the position is <<3, 0.0417, 0>>, because the value of time is 0.0417. Expressions
Using Maya: Hypergraph, Sets & Expressions
157
Particle Expressions Writing runtime expressions Each subsequent frame moves the particle upward at a rate set by the incrementing value of time.
When you stop and rewind the animation, the particle moves back to the origin, the particle’s original position when you created it with the Particle Tool. When you created the particle, Maya stored its original position in an internally maintained initial state attribute named position0. For details, see “Understanding initial state attributes” on page 162. Because the attribute has no creation expression controlling its value, Maya sets the attribute to its initial state position0 value of <<0,0,0>>. To prevent the particle from jumping back to the origin after rewinding, you can write a creation expression that’s the same as the runtime expression: particleShape1.position = <<3,time,0>>;
When you rewind the animation, the particle moves to position <<3,time,0>>. Because time is 0 at frame 0, the particle starts at position <<3,0,0>> when you rewind the animation. In the second and following frames, it moves upward synchronized with the increasing value of time. Though this example showed how to initialize the position attribute with a creation expression, you could have gotten almost the same result by saving the object’s current attribute values for initial state usage:
To save the current attributes for initial state usage: 1
Select the particle shape node.
2
Advance the animation to frame 1. Here the position of the particle is <<3, 0.0417, 0>>.
3
158
Select Settings→Initial State→Set for Current.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes When you rewind the animation, Maya positions the object at the initial state setting of its position attribute. This setting is <<3, 0.0417, 0>> because you selected Set for Current while the position was equal to <<3, 0.0417, 0>>.
Working with particle attributes When you create a particle object, it has two types of static attributes: •
attributes for its transform node
•
attributes for its particle shape node These attribute are permanently part of a particle object. You typically won’t work with the static attributes that are part of its transform node, for example, scaleX, translateX, and so on. These attributes control the position and orientation of the transform node of the entire particle object, not the position and orientation of the individual particles. You’ll instead work with the static attributes of the particle shape node, for example, position, velocity, acceleration, and age. These attributes appear in the Attributes list of the Expression Editor’s when you choose Object Filter→Dynamics→Particles for the selected particle object.
Adding dynamic attributes
When you add a dynamic attribute to an object, the attribute names appear in the Expression Editor’s Attributes list.
Note See “List of particle shape attributes” on page 196 for attributes you can use with particle objects.
Using Maya: Hypergraph, Sets & Expressions
159
Expressions
You also use expressions to control dynamic and custom attributes you add to a particle shape node. See “Attributes” in Chapter 5 for details on the differences between static, dynamic, and custom attributes. See “Assigning to a custom attribute” on page 169 for details on working with custom attributes.
Particle Expressions Working with particle attributes
Understanding per particle and per object attributes You can dynamically add two types of attributes to a particle shape node: •
per particle
•
per object A per particle attribute lets you set the value of the attribute individually for each particle of the object. A per object attribute lets you set the attribute value for all particles of the object collectively with a single value. For example, a per particle opacityPP attribute lets you set a unique opacity value for each particle of an object. With a per object opacity attribute, you must give all particles of the object the same opacity. A per particle attribute holds the attribute values for each particle in the object. For example, though there is only one opacityPP attribute in a particle object, the attribute holds the value for each particle’s opacity value. The attribute holds the values in an array. In simple terms, an array is a list. Though per particle attributes are best for creating complex effects, you can’t keyframe them. You can keyframe per object attributes. You can add per particle or per object attributes for opacity, color, lifespan, and other effects. For a particle shape node attribute, you can tell whether it’s a per particle or per object attribute by examining the Attribute Editor’s particle shape folder. All per particle attributes appear in the Per Particle (Array) Attributes section of the folder. The per object attributes appear elsewhere in the folder. Most appear above the Per Particle (Array) Attributes section, for example, in the Particle Attributes and Render Attributes sections. For many dynamically added attributes, you can also tell whether they are per particle or per object by their names in the Expression Editor. If a name ends with PP, it’s per particle. Otherwise, it’s usually per object. Note that position, velocity, and acceleration are per particle attributes, though their names don’t end with PP.
160
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes The most common way to create dynamic per object or per particle attributes for a particle shape is by clicking one of the following buttons in the Add Dynamic Attributes section of the Attribute Editor:
For example, if you click the Opacity button, a window appears and lets you choose whether to add the opacity characteristic as a per object attribute or a per particle attribute. If you choose per particle, the Attributes list of the Expression Editor displays a new attribute for the selected particle shape node: opacityPP. If you choose per object, an opacity attribute is displayed instead. For attributes other than lifespan, if you add both a per particle attribute and a per object attribute for a characteristic, the per particle attribute takes precedence. For instance, if you add opacity and opacityPP, the opacityPP attribute controls the opacity of the particles of the specified object. When you click Lifespan and add both a per particle and per object attribute, Maya adds an additional attribute named useLifspanPP that lets you choose whether lifespanPP or lifespan controls the characteristic.
If you click the Goal button in the Add Dynamic Attributes section of the Attribute Editor, Maya adds a per object attribute and a per particle attribute. The attributes are named goal and goalPP. Neither attribute has precedence. Maya multiplies the value of the per object goal attribute by the per particle goalPP attribute to create the final goal effect for each particle.
Using Maya: Hypergraph, Sets & Expressions
161
Expressions
By default, the Attribute Editor setting of useLifespanPP is on, so the lifespanPP attribute control the characteristic. If you turn useLifespanPP off in the Attribute Editor, lifespan controls the characteristic.
Particle Expressions Working with particle attributes
Important You can use per particle attributes only in particle expressions. You can use per object attributes in particle or nonparticle expressions. If you use a runtime expression to read or write a per object attribute of a particle object with many particles, you can speed up expression execution by reading or writing the attribute in a nonparticle expression. Nonparticle expressions execute only once per object. Particle expressions execute once for each particle in the object. Because reading or writing a per object attribute more than once per frame is redundant, you can save processing time by working with them in nonparticle expressions.
Understanding initial state attributes For all static per particle attributes, Maya keeps a corresponding attribute with a name ending in 0. For example, the static attributes position, velocity, and acceleration have counterparts position0, velocity0, and acceleration0. An attribute name that ends in 0 holds the initial state value of the attribute. When you save a particle object’s current attribute values for initial state usage, Maya assigns those values to the initial state attributes. To save a particle object’s attribute values for initial state usage, use either of these commands: •
Settings→Initial State→Set for Current This saves all per particle attribute values for the selected particle shape node or rigid body.
•
Settings→Initial State→Set for All Dynamic This saves all per particle attribute values for all dynamic objects in the scene—in other words, all particle shape nodes and rigid bodies. When you dynamically add a per particle attribute by clicking one of the buttons in the Add Dynamic Attributes section of the Attribute Editor, Maya also adds a corresponding initial state attribute with name ending in 0. For example, when you click the Lifespan button in the Attribute Editor, Maya adds lifespanPP0. Though an initial state attribute doesn’t appear in the Expression Editor, you can read its value to retrieve the initial state.
162
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes When you use the Add Attribute window to add a custom per particle (array) attribute to a particle shape, you must choose whether you want to add it with Add Initial State Attribute on or off. If you choose on, Maya creates a corresponding initial state attribute for the added attribute. If you choose off, Maya doesn’t create a corresponding initial state attribute for the added attribute. Without this corresponding attribute, you can’t save a particle object’s current attribute values for initial state usage. You must write a creation expression if you decide to initialize the custom attribute’s value upon rewinding the animation.
Note A per particle attribute is called an array attribute in the Add Attribute window. The two terms have the same meaning. See “Assigning to a custom attribute” on page 169 for details. You can see whether a custom attribute was added with Add Initial State Attribute on or off by using the MEL listAttributes command. (See the online MEL documentation for details.)
When you add a custom attribute to a particle shape, do not end the name with a 0 character. You’ll subvert Maya’s naming scheme for the initial state attribute associated with an attribute. For any attribute, if you don’t initialize its value with a creation expression or save its value for initial state usage, Maya gives the attribute a default value at the animation’s first frame. It typically assigns the attribute the value 0 or <<0,0,0>>, as appropriate for the data type. In other cases, for instance, opacityPP and opacity, Maya assigns the attribute a default value of 1. If you know you’re going to write a creation expression for a custom attribute, you can set Add Initial State Attribute off when you add the attribute. Otherwise, set Add Initial State Attribute on whenever you add a custom attribute. When a creation expression assigns a value to an attribute, the value overrides the attribute’s initial state value for all particles whose age is 0.
Using Maya: Hypergraph, Sets & Expressions
163
Expressions
You might want to read the value of an initial state attribute in an expression, for instance, to use its original (rewind) value for some calculation. If you assign a value to an initial state attribute. Maya will overwrite the value if you save the attribute value for initial state usage.
Particle Expressions Working with particle attributes
Example of assigning to a dynamic per particle attribute Suppose you’ve used the Particle tool to create a small number of particles named Bubbles:
The following steps show how to assign a different lifespanPP value for each of the particles to make them disappear as the scene plays.
To use a per particle lifespanPP attribute: 1
Select the particle shape node for Bubbles in the Outliner or Hypergraph.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Lifespan button. A window appears that prompts you to choose whether to add the attribute per object or per particle.
3
Select Add Per Particle Attribute, then click the Add Attribute button. This adds a lifespanPP attribute to the particle shape node for Bubbles. You can set this attribute to give each particle a different value for how long it lives.
4
Select Bubble’s particle shape node in the Expression Editor.
5
Turn on Creation in the Expression Editor.
6
Create the following expression: BubblesShape1.lifespanPP = rand(5); print("Hello\n");
7
164
Play the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Because lifespanPP is a per particle attribute and the object’s particle shape node is selected in the Expression Editor, the expression does an execution loop of both statements once for each particle in the object. Because the expression is a creation expression, it executes after the expression compiles. It also executes when you rewind the animation after playing it. For each of the particles, the first statement assigns the lifespanPP attribute a random floating point number between 0 and 5. The rand function returns a different random number each time it executes, so each particle has a different lifespanPP value between 0 and 5. For details on the rand function, see chapter 9, “Functions.” The second statement displays Hello in the Script Editor, once for each particle. The creation expression gives each particle a random lifespanPP of less than 5 seconds. The particles disappear from the scene at random times between 0 and 5 seconds of scene play. (Maya gives particles created with the Particle tool an age of 0 in the first frame of the animation.)
Expressions
Particles remaining after three seconds, with creation expression for lifespanPP.
When you rewind the animation, the particles reappear in the scene. Playing the scene again makes them disappear at random times within 5 seconds.
Using Maya: Hypergraph, Sets & Expressions
165
Particle Expressions Working with particle attributes It’s important that you use a creation expression for this effect. If you were to use a runtime expression, the particles would disappear more quickly as the animation plays, and Hello would appear 100 times each frame. The reason for this is subtle: In each frame, a runtime expression would assign a different random value between 0 and 5 seconds to the lifespanPP of each particle. The expression would likely assign one or more of the particles a lifespanPP near 0. Meanwhile, the age of each particle increases from 0 at the first frame of play. Maya checks the age of each particle every frame. If the age is greater than the lifespanPP value, Maya removes the particle. Because the expression would reassign new random lifespanPP values to each remaining particle in each frame, the new assignments would likely give a few particles a lifespanPP that’s less than their current age value. Maya deletes such particles. This causes the object’s particles to disappear quickly from the scene.
Particles remaining after one second, with runtime expression for lifespanPP.
166
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Example of assigning to a dynamic per object attribute Suppose you’ve used the Particle tool to create the same Bubbles particle object described in the previous topic.
The following steps show how to give the particles a single lifespan. All particles disappear at the same time when you play the scene.
To use a per object lifespan attribute: Select the particle shape node for Bubbles in the Outliner or Hypergraph.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Lifespan button. A window appears that prompts you to choose whether to add the attribute per object or per particle.
3
Select Add Per Object Attribute, then click the Add Attribute button. This adds the lifespan attribute to the particle shape node for Bubbles.
4
In the Expression Editor, turn on Creation.
5
Create this creation expression: BubblesShape1.lifespan = 1.33; print("Hello\n");
Because this is a creation expression, it executes after the expression compiles. It also executes when you rewind the animation after playing it.
Using Maya: Hypergraph, Sets & Expressions
167
Expressions
1
Particle Expressions Working with particle attributes For each of the 100 particles, the first statement assigns the lifespan attribute the value 1.33. The second statement displays Hello in the Script Editor once for each particle. 6
Play the animation. Because all particles have a lifespan of 1.33, they disappear from the scene after 1.33 seconds of animation play. When you rewind the animation, the particles reappear in the scene. Playing the scene again makes them disappear again after 1.33 seconds.
1.32 seconds of animation
1.33 seconds of animation
If you had put the preceding statements in a runtime expression, the particles would still disappear in 1.33 seconds. The expression would assign a lifespan of 1.33 seconds to all 100 particles redundantly each frame. The age of the particles is 0 in the first frame of their creation. (Maya gives particles created with the Particle tool an age of 0 in the first frame of the animation.) Reassigning lifespan 1.33 each frame has no effect on the age of the particles. Their age increases from the first frame regardless of the lifespan value. Note that, unlike particles created with the Particle Tool, the age of emitted particles starts in the frame where they’re emitted.
168
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Assigning to a custom attribute You can add a custom attribute to a particle shape node and control its value in an expression.
To add a custom attribute: 1
Select the object’s particle shape node rather than its transform node. Use the Hypergraph or Outliner to select the shape node.
2
Choose Modify→Add Attribute. or In the Add Dynamic Attributes section of the Attribute Editor, click the General button. The Add Attribute window appears:
Expressions
3
Enter a name for the attribute in the Attribute Name box.
Using Maya: Hypergraph, Sets & Expressions
169
Particle Expressions Working with particle attributes 4
Make sure Make attribute keyable is on.
5
Select one of the following data types:
6
•
Vector
Creates a vector attribute consisting of three floating point values.
Float
Creates a floating point attribute.
Integer
Creates an integer attribute.
Boolean
Creates an attribute consisting of an on/off toggle.
Select one of the following attribute types: Scalar
Creates a per object attribute that you can set to a single value that applies to every particle in the object. A vector scalar is considered a single value with three numbers.
Array
Creates a per particle attribute. You can set this type of attribute to different values for each particle.
If you select Scalar, you can specify Minimum, Maximum, and Default values for a Float or Integer attribute. Minimum and Maximum set the lowest and highest values you can enter for the attribute in the Attribute Editor or Channel Box. Default sets the default value displayed for the attribute. Because you’re going to control the attribute’s value with an expression, you might want to skip entering values for these options. An expression isn’t bound by the Minimum and Maximum values. The attribute receives whatever value you assign it in the expression. The expression can read the attribute’s Default value or any other value you give it in the Attribute Editor or Channel Box. When you select Scalar, you can’t create a counterpart initial state attribute by turning on Add Initial State Attribute.
•
If you select Array, you can also create a counterpart initial state attribute by turning on Add Initial State Attribute. See “Understanding initial state attributes” on page 162 for details. You can’t set Minimum, Maximum, or Default values for an Array attribute.
7
170
Click Add if you want to add more attributes. Click OK to add the attribute and close the Add Attribute window.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes The new attribute appears under the Dynamic Attributes section of the Attribute Editor.
To assign values to a custom attribute: You can assign values to a custom attribute with the same techniques you use to assign values to static or dynamic attributes.
Example Suppose you’ve created a 100-particle object named sunspot, and you add to its particle shape node a vector per object attribute named glow. You assign the glow attribute a vector value in a creation expression as follows: sunspotShape1.glow = <<3,0,0>>; print(sunspotShape1.glow + "\n");
When you rewind the animation, the glow attribute of sunspotShape1 receives the value <<3,0,0>>. The print statement displays the values in the Script Editor.
Example
float $randomNumber = rand(1); sunspotShape1.heat = <<$randomNumber,0,0>>; print(sunspotShape1.heat + "\n");
When you rewind the animation, the expression loops through 100 executions, once for each particle. The first statement sets the $randomNumber variable to a random number between 0 and 1. The next statement assigns a vector to the heat attribute of a single particle. The left component of the vector assigned to heat is a different random number each time the statement executes. The middle and right components are always 0. One particle might have the value <<0.57, 0, 0>>, another <<0.32, 0, 0>>, another <<0.98, 0, 0>>, and so on. The print statement displays the values in the Script Editor.
Using Maya: Hypergraph, Sets & Expressions
171
Expressions
Suppose you add a vector per particle attribute named heat to the 100particle sunspot shape node. You can give each particle a different value as in this creation expression:
Particle Expressions Working with particle attributes
Note If you add a custom vector attribute to an object, Maya displays the attribute in the Attribute Editor, but you can’t enter its value there. You must enter a value for it in an expression or with the Component Editor available from the Attribute Editor.
Assigning to a particle array attribute of different length You can assign the array attribute of one particle shape node to another node having a different number of particles. The assignment is affected by which node you select in the Object Selection list in the Expression Editor. The number of particles in the selected particle shape node sets the number of statement executions, and, therefore, affects the assignment.
Example Suppose your scene contains an object named ThreePts made of three particles and an object named TwoPts made of two particles. The three particles in ThreePts are at these positions: -5 0 0 -4 0 0 -3 0 0
The two particles in TwoPts are at these positions: 5 0 0 6 0 0
172
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Suppose you write this runtime expression with TwoPtsShape2 selected in the Object Selection list: ThreePtsShape1.position = TwoPtsShape2.position; print(ThreePtsShape1.position+"\n");
In the first frame of runtime expression execution, this assigns the position attribute of TwoPts to the position attribute of ThreePts. In other words, the expression repositions the three particles to the position of the two particles. Because you selected TwoPtsShape1 in the Object Selection list, the expression will execute once for each of its two particles. When you play the scene, the runtime expression executes. The first particle of ThreePts now is at the position of the first particle of TwoPts. The second particle of ThreePts is at the position of the second particle of TwoPts. The third particle of ThreePts doesn’t change position. The expression executes only twice each frame. In summary, the particles in ThreePts are at these positions: 5 0 0 6 0 0 -3 0 0
Expressions
Suppose you write the preceding runtime expression instead with ThreePtsShape1 selected in the Object Selection list. Again, the expression repositions the three particles to the position of the two particles. Because you selected ThreePtsShape1 in the Object Selection list, the expression executes once for each of its three particles. When you play the scene, the runtime expression executes. The first particle of ThreePts moves to the position of the first particle of TwoPts. The second particle of ThreePts moves to the position of the second particle of TwoPts. Using Maya: Hypergraph, Sets & Expressions
173
Particle Expressions Working with particle attributes Because TwoPts lacks a third particle, the third particle of ThreePts is repositioned at the position of the first particle of TwoPts. You can’t see this in the workspace because the particles are in the exact same position. The three particles in ThreePts are at these positions: 5 0 0 6 0 0 5 0 0
As this example shows, the assignment statement executes three times. When it runs out of counterpart particles to assign to, it loops around and assigns to the previous particles. It starts with the first particle in the object, and continues through the other particles. For example, suppose you create a five-particle object named FivePts with the Particle Tool, and position the particles somewhere in the workspace. Suppose further you select the particle shape node of FivePts in the Expression Editor, then make this assignment in a runtime expression: FivePtsShape1.position = TwoPtsShape2.position;
The five particles move to these positions as soon as the runtime expression executes for the first time: 5 6 5 6 5
0 0 0 0 0
0 0 0 0 0
Using creation expression values in a runtime expression A runtime expression can’t read a variable you’ve defined in a creation expression unless you define the variable as global. However, you can create a custom attribute, assign it a value in a creation expression, then read or write its value in a runtime expression.
174
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes For example, suppose you assign a particle object’s position to a variable named $oldposition in a creation expression: vector $oldposition = particleShape1.position;
The runtime expression for the same particle shape node can’t read the contents of the $oldposition variable. To solve this problem, you can create an attribute for the object, assign it a value in the creation expression, then use the attribute value in a runtime expression. For example, suppose you create an attribute named oldpos, and assign it the following position in a creation expression: particleShape1.oldpos = particleShape1.position;
You can read the value of particleShape1.oldpos in a runtime expression. Note that you don’t need to create an attribute to hold the object’s initial position. The initial position already exists in its initial state attribute named position0. This attribute doesn’t appear in the Expression Editor’s Attributes List.
Working with position, velocity, and acceleration
Unless you have a solid grasp of physics, avoid setting a combination of the position, velocity, and acceleration attributes. To give a smooth, random motion to particles with a runtime expression, use a random number function such as sphrand to assign random numbers to the particle shape’s acceleration attribute. A change in acceleration always gives smooth motion no matter how abruptly its value changes. To give a jittery random motion to particles with a runtime expression, use a random number function such as sphrand to assign random numbers to the particle shape’s velocity or position attributes. See “Random number functions” on page 239 for details on how to use random number functions. If an expression and a dynamic field control an object’s position, velocity, or acceleration, Maya calculates the expression’s effect first, then adds the field’s effect.
Using Maya: Hypergraph, Sets & Expressions
175
Expressions
To create various types of particle motion, you can assign vector values to the position, velocity, or acceleration attribute. See “Writing runtime expressions” on page 153 for examples of working with these attributes.
Particle Expressions Working with particle attributes
Example Suppose a particle drops under the influence of a gravity field with default gravity options. Gravity accelerates the particle at 9.8 units per second per second down the Y-axis. In other words, the default acceleration of gravity is <<0,-9.8,0>>. Suppose further you write the following runtime expression for the particle: velocity = velocity + <<1,0,0>>;
As each frame plays, Maya first calculates the particle’s velocity from the expression statement. The velocity increases 1 unit per second in an X-axis direction. Maya then adds the gravitational acceleration to the velocity. Maya uses the combined result to compute the particle’s position. Of course, you won’t see this calculation process. The frame displays the particle in the appropriate position after all computation. Note that the expression adds the constant <<1,0,0>> to the particle’s velocity each frame as the animation plays. This makes the particle move with increasing velocity in an X direction as the time increases. An increasing velocity is the same as acceleration. The ball represents the particle’s position after several frames. The white squares represent the particle’s position as time increases.
Gravity alone
176
Using Maya: Hypergraph, Sets & Expressions
Gravity in combination with velocity = velocity + <<1,0,0>>
Particle Expressions Working with particle attributes The acceleration attribute works differently than the position or velocity attributes in an important way. Maya initializes its value to <<0,0,0>> before each frame. If the oversample level is greater than 1, this initialization occurs before each timestep.
Example Suppose you write the following runtime expression for a five-particle object unaffected by gravity: acceleration = acceleration + <<0,1,0>>;
Rather than adding <<0,1,0>> to the acceleration value each frame, acceleration remains a constant <<0,1,0>> for each of the particles. This happens because Maya initializes the value of acceleration to <<0,0,0>> before each frame. Suppose you connect the particle object to gravity with default settings. The acceleration of the particle becomes <<0,1,0>> plus <<0,-9.8,0>>, which equals <<0,-8.8,0>>. The acceleration assigned in the expression slows the downward acceleration of the gravity. Suppose you change the previous expression to this: acceleration = acceleration + sphrand(3);
acceleration = sphrand(3);
As each frame plays, Maya first calculates each particle’s acceleration from the expression statement. Each particle receives the result of the sphrand(3) function. The sphrand(3) function provides a vector whose randomly selected components reside within a spherical region centered at the origin with radius 3. Each particle receives a different vector value. Finally, Maya adds gravity’s acceleration to the expression acceleration resulting from sphrand(3). The frame displays each particle in the resulting position. Because of the random values resulting from the expression, each particle has an acceleration that differs slightly from gravity in direction and magnitude. Because the sphrand(3) function executes for each particle each frame, the acceleration of each particle varies each frame.
Using Maya: Hypergraph, Sets & Expressions
177
Expressions
Because Maya sets acceleration to <<0,0,0>> before each frame, the statement has the same result as the following statement:
Particle Expressions Working with particle attributes
Gravity in combination with acceleration = sphrand(3)
Position at rewind
Gravity alone (shown for comparison) Position after one second
This example shows that you can take advantage of the additive effect of fields and the acceleration attribute to create custom field effects.
Tip You can turn off the effect of all fields on a particle shape node attribute by setting its dynamicsWeight attribute to 0.
Working with color Coloring particles is a fundamental task for expression writers. As the techniques for coloring particles are easiest to learn by example, we provide the following lesson.
Example Suppose you’ve used the Particle tool to create a randomly positioned collection of particles named Bubbles. You can use a creation expression to give the particles a constant color during animation play.
178
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
To give the particles a constant color: 1
Select the particle shape node for Bubbles in the Hypergraph or Outliner. To write an expression to color particles, you must dynamically add the attribute that lets you color them.
2
In the Add Dynamic Attributes section of the Attribute Editor, click the Color button.
3
Select Add Per Particle Attribute, then click the Add Attribute button. This adds an rgbPP attribute to the particle shape node for Bubbles. Because you’re adding this attribute as a per particle attribute, you can give each particle a different color.
4
Choose Shading→Smooth Shade All. This step is necessary to make the correct particle color appear when you assign the rgbPP attribute a value in an expression.
5
In the Expression Editor, select Bubble’s particle shape node.
6
Turn on Creation in the Expression Editor. Because you’ll give the particles a color that doesn’t change during the animation, you use a creation expression.
7
Enter this expression: BubblesShape1.rgbPP = <<1,0,0>>;
Using Maya: Hypergraph, Sets & Expressions
179
Expressions
A window appears that prompts you to choose whether to add the attribute per object, per particle, or connected to a shader.
Particle Expressions Working with particle attributes When you click the Create button in the Expression Editor, Maya checks the syntax of the expression. Assuming you made no typing errors, the expression executes once for each of the 100 particles. The expression colors all particles in the object red. The double angle brackets << and >> enclose a vector that sets the red, green, and blue components of the rgbPP attribute to 1, 0, and 0. In the RGB color scheme, this gives the object a red color. 8
Play the animation. Because the expression is a creation expression, it executes when you rewind the animation. The particles remain red for entire animation because the red color is never changed by a runtime expression.
Tip See the online version of this documentation for colored illustrations. The following steps show how to give the particles a randomly changing color as the animation plays.
To give the particles a randomly changing color: 1
With BubblesShape1 selected in the Expression Editor, turn on Runtime.
2
Enter this runtime expression: BubblesShape1.rgbPP = sphrand(1);
180
3
Click the Create button to compile the expression.
4
Rewind the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Because the creation expression executes when you rewind, the particles are red. 5
Play the animation. The runtime expression takes control of the rgbPP attribute. Because rgbPP is a per particle attribute, the runtime expression executes for each particle in the object each frame. For each particle, the expression assigns the rgbPP attribute the output from the execution of the sphrand function with an argument of 1. The sphrand function assigns each particle’s rgbPP color a random vector. The vector represents a random point in a spherical region of radius 1. The left, middle, and right rgbPP color components have a value no less than -1 and no greater than 1. Values less than 0 are treated as 0. The sphrand function returns a different random vector each execution. So each particle has a different random rgbPP value, and therefore, a different color. The color of each particle changes each frame.
You can slow the change of colors to create a flashing Christmas light effect. The following steps make the particles change colors every second of animation.
To slow the change of color: 1
Change the runtime expression to this: if ((frame % 24) == 0) BubblesShape1.rgbPP = sphrand(1);
Using Maya: Hypergraph, Sets & Expressions
181
Expressions
If you rendered the animation and played it back at 24 frames per second, you would have trouble seeing the color of a particle in any instant because the color changes so quickly.
Particle Expressions Working with particle attributes This expression uses the modulus operator (%) to control when the rgbPP attribute of the particles receives a random color. The modulus operator returns the remainder after division. For example, 24 divided by 24 returns 0, but 25 divided by 24 returns 1. (Dividing 25 by 24 equals 1 with a remainder of 1.) If the value of frame divided by 24 is equal to any number with a remainder of 0, the assignment to BubblesShape1.rgbPP occurs. In other words, the assignment occurs when frame equals 24, 48, 72, and so on. At an animation rate of 24 frames/second, the assignment happens once each second.
Important Avoid using the modulus operator with floating point values. Because of number rounding in floating point division, you won’t likely get a return value of exactly 0 with the modulus operator. Instead use an integer value when possible. 2
Rewind and play the animation. When you rewind the animation, the particles turn red because the creation expression executes. When the animation plays, the particles receive a random color once each second.
1 second
2 seconds
3 seconds
Note that you can change the red rewind color to random colors by changing the creation expression to this: BubblesShape1.rgbPP = sphrand(1);
This is the same expression as the runtime expression.
182
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Working with emitted particles If you make an object emit particles, you can write a creation or runtime expression for attributes of the emitted particles. For example, you can assign the emitted particles a value for lifespan, opacity, and color.
To write an expression for emitted particles: 1
Create the emitter.
2
Add the desired dynamic attribute to the emitter shape node.
3
Select the shape node of the emitted particles in the Expression Editor, then write the expression to control the attribute.
Example Suppose you’ve created an emitter and added a per particle lifespanPP attribute to it. The following creation expression gives the emitted particles a lifespan of 2 seconds: particleShape1.lifespanPP = 2;
Each particle disappears two seconds after it’s emitted.
Important Expressions
Avoid assigning a per particle attribute to another object’s per particle attribute if the particles of either object die. As particles die, the order of expression evaluation changes for the object’s particles. This causes unexpected results. You can, though, assign from one attribute to another in the same object with dying particles. The array indexes of the different attributes are in synch with each other. For example, don’t write an expression like this: emittedShape1.lifespanPP = 2; emittedShape1.rgbPP = otherParticleShape2.rgbPP
Working with collisions If you make a particle object collide with an object, you can write an expression to trigger expression statements after the collision. For example, you can change the color, opacity, or lifespan of the colliding particles.
Using Maya: Hypergraph, Sets & Expressions
183
Particle Expressions Working with particle attributes
To prepare for writing the expression: 1
Select the particle shape node of the particles in the Outliner or Hypergraph.
2
Select Settings→Particle Collision Events from the Dynamics menu bar. The Particle Events window appears.
3
Click Create Event. This adds an event attribute to the selected particle shape node. The Expression Editor displays the added event attribute in the Attributes list. Close the Particle Events window.
To write the expression: 1
Select the particle shape node of the emitted particles.
2
Write the runtime or creation expression using the value of any of these attributes of the emitted particle’s shape node: Long name
Short name
event
Description
Data Type
Contains the number of times each particle in the object has hit something (on a per particle basis).
float array
eventCount
evc
Total number of events that have occurred for all particles of the object.
integer
eventTest
evt
True if an event has occurred since the last time an expression or MEL getAttr command read the eventTest value.
boolean
The eventCount and eventTest are static attributes. A particle shape node has them as soon as you create the particle object. Though they don’t appear in the Expression Editor, you can use their values in an expression. You must first create the event attribute as described previously.
184
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Example Suppose you’ve created a five-particle object named Peas that falls with gravity and collides with a plane.
You can make the particles turn red when the first particle hits the plane. Select PeasShape1 in the Outliner or Hypergraph.
2
From the Dynamics menu bar, select Settings→Particle Collision Events.
3
In the Particle Events window, click Create Event, then close the window. This adds an event attribute to PeasShape1.
4
In the Add Dynamic Attributes section of the Attribute Editor, click Color. The Particle Color window appears.
5
Select Add Per Particle Attribute, then click Add Attribute. This adds a per particle attribute named rgbPP. This attribute controls the red, green, and blue color scheme of each particle. The particles turn black after you add the rgbPP attribute. Adding the rgbPP attribute turns off the default coloring of the particles and gives them a value of <<0,0,0>>.
6
Choose Shading→Smooth Shade All. This step is necessary to make the correct particle color appear when you assign the rgbPP attribute a value in an expression.
Using Maya: Hypergraph, Sets & Expressions
185
Expressions
1
Particle Expressions Working with particle attributes 7
With PeasShape1 selected in the Expression Editor, create this runtime expression: if (event == 1) rgbPP = <<1,0,0>>; else if (event == 2) rgbPP = <<0,1,0>>; else if (event >= 3) rgbPP = <<0,0,1>>; else rgbPP = <<1,1,1>>;
8
Rewind the animation. Upon rewind, the particles are black. The particles have the default black rgbPP color because no creation expression exists for the object.
9
Play the animation. The particles fall toward the plane. The runtime expression executes as each frame plays. The event attribute is a per particle attribute. This isn’t obvious because its name doesn’t have PP as the last two characters. Because event holds a running count of collisions for each particle, event contains 0 for each particle until the first collision with the plane. Until the first collision occurs, the final else statement executes: else rgbPP = <<1,1,1>>;
This statement executes because event doesn’t equal 1, 2, 3, or a number greater than 3. The vector <<1,1,1>> in the RGB color scheme represents the color white. When the first particle of PeaShape1 hits the plane, Maya sets the event attribute for that particle to 1. This triggers execution of the first assignment, which sets the colliding particle’s rgbPP value to <<1,0,0>>. In the RGB color scheme, this vector value represents red. (When red equals 1, green equals 0, and blue equals 0, the resulting color is red.)
186
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes
Red particle after collision
Tip See the online version of this documentation for colored illustrations. Note that the value of the event attribute reflects the collision count in the frame after each collision. For example, if a particle collides with the plane in frame 10, event is updated in frame 11. Expressions
When the other particles hit the plane for the first time, they also turn red after they collide.
A particle stays red until it collides with the plane for the second time, when event equals 2. After a second collision, the particle turns green.
Using Maya: Hypergraph, Sets & Expressions
187
Particle Expressions Working with particle attributes After a third collision, when event is equal to or greater than 3, a particle turns blue. Each particle stays blue for all subsequent collisions as the animation plays.
10 Rewind the animation. The particles turn black again because they receive the default rgbPP value <<0,0,0>>. When you play the animation again, the particles turn white, red, green, and blue in the same sequence as before. You can refine the animation by giving the particles a color other than black for the frame that appears upon rewinding. For example, you can give the particles a white color upon rewinding with two techniques: •
Write this creation rule for PeasShape1: rgbPP = <<1,1,1>>;
This statement executes for each particle in the object, so they all receive the same white color when you rewind the scene. •
Select PeasShape1, rewind the animation, and play one frame.
11 Choose Settings→Initial State→Set for Current. This saves all PeasShape1 attribute values from the current frame for the initial state of the attributes. The current value for rgbPP will be used when you rewind the animation. Because you played the second frame of the animation, this saves the white color of the particles at that frame for use upon rewinding the animation.
188
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes Note that Set for Current saves all attribute values, including position, velocity, acceleration, and so on. In cases where you have several changing attribute values during playback, Set for Current might save undesired attribute values in addition to the desired ones. In such cases, use a creation expression.
Working with specific particles A per particle attribute holds the attribute values for each of an object’s particles. For example, the rgbPP attribute holds the value for each particle’s rgbPP value. Each particle has a unique numerical particle identifier. A particle’s identifier is stored in a per particle particleId attribute for the particle object. As you create the particles of a particle object, Maya assigns each particle a particleId in sequential order starting at 0. For example, suppose you use the Particle tool to create a five-particle object by clicking positions in the workspace. The first click of the mouse creates a particle with particleId 0, the second click creates a particle with particleId 1, the third click creates a particle with particleId 2, and so on.
You can assign per particle attribute values to specific particles using the particleId attribute.
Example Suppose you’ve used the Particle tool to create a grid of eight particles named ColorGrid. In the Attribute Editor, you’ve set the Render Type of the particles to Spheres. You’ve chosen Shading→Smooth Shade All to display the particles with shading.
Using Maya: Hypergraph, Sets & Expressions
189
Expressions
When an emitter emits particles, Maya assigns particleId numbers in sequential order starting with the first particle emitted. The first emitted particle has particleId 0, the second has particleId 1, the third has particleId 2, and so on.
Particle Expressions Working with particle attributes
You can give the particles different colors based on their particleId.
To color the particles based on particleId: 1
Select the ColorGrid.
2
In the Add Dynamic Attributes section of the Attribute Editor, click Color. The Particle Color window appears.
3
Select Add Per Particle Attribute, then click Add Attribute. This adds a per particle attribute named rgbPP, which controls the red, green, and blue color scheme of each particle. The particles turn black after you add the rgbPP attribute. Adding the rgbPP attribute turns off the default coloring of the particles and gives them a value of <<0,0,0>>.
4
In the Attribute Editor, choose Numeric from the Render Type menu. The particleId of each particle is displayed instead of spheres:
190
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Working with particle attributes 5
With ColorGridShape1 selected in the Expression Editor, enter this creation expression: if (particleId <= 2) rgbPP = <<1,0,0>>; else if ((particleId > 2) && (particleId < 6)) rgbPP = <<1,1,1>>; else rgbPP = <<0,0,1>>;
The creation expression executes whenever you rewind the animation. The particles don’t show the color assignments yet. The Numeric particle render type ignores color assignments to rgbPP. 6
In the Attribute Editor, set Render Type of the particles to Spheres again. The left, middle, and right columns of particles are red, white, and blue:
Expressions
The expression’s first statement assigns a red color to all particles whose particleId is less than or equal to 2. The value <<1,0,0>> is red in the RGB color scheme. The second statement assigns a white color to all particles whose particleId is greater than 2 and less than 6. The value <<1,1,1>> is white in the RGB color scheme. The third statement assigns a blue color to all particles that don’t meet the conditions in the prior two statements. In other words, all particles whose particleId is greater than or equal to 6 become blue. The value <<0,0,1>> is blue in the RGB color scheme. The following steps show another common way to control an attribute based on the particleId attribute.
Using Maya: Hypergraph, Sets & Expressions
191
Particle Expressions Working with particle attributes
To color half the particles red, and half the particles blue: 1
Enter the following runtime expression: if ((particleId % 2) == 0) rgbPP = <<1,0,0>>; else rgbPP = <<0,0,1>>;
2
Play the scene. The runtime expression executes each frame as the animation plays. Half the particles are blue, half are red.
The first statement uses a modulus operator (%) to calculate the remainder of dividing a particleId by 2. It then compares the remainder to 0. If the remainder equals 0, the statement assigns the particle a red color. The value <<1,0,0>> is red. The second statement assigns a particle a blue color if the remainder of the modulus operation doesn’t equal 0. The value <<0,0,1>> is blue. For example, dividing particleId 0 by 2 equals 0 with remainder 0. Because the remainder is 0, the particle having particleId 0 receives a red color. Dividing particleId 1 by 2 equals 0 with remainder 1. Because the remainder is 1, the particle having particleId 1 receives a blue color. Dividing particleId 2 by 2 equals 1 with remainder 0. With remainder 0, the particle having particleId 1 receives a blue color. The expression executes for each particle in the object. The result is that even-numbered particleIds become red, odd numbered particles become blue. 3
192
Rewind the animation.
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Assigning to vectors and vector arrays The creation expression executes. The particles become red, white, and blue as described for the previous expression. 4
Play the animation. The runtime expression executes each frame. The particles are red and blue as the animation plays.
Note to programmers You cannot assign values to individual particles with the array index notation commonly used in programming languages. For example, suppose you’ve created an opacityPP attribute for an object made of three particles. You can’t assign values as in this example: opacityPP[0] = 0.3; opacityPP[1] = 0.5; opacityPP[2] = 1;
Assigning to vectors and vector arrays
Expressions
Previous topics in this chapter show general techniques for working with vector array attributes. Vector array attributes are also called per particle attributes. Subtle details of assigning to vector and vector array attributes and variables follow.
Assigning to a vector variable You can assign a literal vector value or another vector variable to a vector variable. Enclose a literal vector value in double angle brackets.
Examples vector $top_velocity = <<2,2,5>>;
This assigns the vector $top_velocity the value <<2,2,5>>. vector $temp; vector $temp = $top_velocity;
This assigns the value of vector variable $top_velocity to the vector variable $temp.
Using Maya: Hypergraph, Sets & Expressions
193
Particle Expressions Assigning to vectors and vector arrays
Using the vector component operator with variables You can use a vector component operator (.) to read a component of a vector variable or vector array variable. Format
Meaning
$variable.x
left component
$variable.y
middle component
$variable.z
right component
Examples float $temp; vector $myvector = <<1,2,3>>; float $temp = $myvector.z;
This assigns the right component of $myvector, 3, to the floating point variable $temp. Suppose you have a vector initialized as follows: vector $myvector = <<1,2,3>>;
To replace the right component of $myvector, 3, with a new value such as 7, use this technique to preserve the other two components: $myvector = <<$myvector.x,$myvector.y,7>>;
This statement is incorrect: $myvector.z = 3;
An error occurs. A statement can read, but not directly assign, a component of a vector variable.
Assigning to a vector array attribute component An expression can neither read nor assign a component of a vector or vector array attribute. The following example shows a technique for working around this limitation. For details on working with color attributes, see “Working with color” on page 178.
194
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions Assigning to vectors and vector arrays
Example Suppose you have 100-particle Cloud of randomly positioned particles. CloudShape1.position = sphrand(1); vector $pos = CloudShape1.position; CloudShape1.rgbPP = <<0,$pos.y,0>>;
The three statements execute once for each particle in Cloud. The first statement gives a particle a random position within a spherical region of radius 1. The sphrand(1) function gives the X, Y, and Z position components a value no less than -1 and no greater than 1. The second statement assigns a particle’s position to a vector variable $pos. The third statement assigns an RGB color to a particle’s rgbPP attribute. The left, middle, and right vector components of CloudShape1.rgbPP represent red, green, and blue components of the RGB color scheme. The third statement therefore assigns 0 (no color) to the red and blue components of a particle’s colorRGB. It gives a particle’s green component the value of its Y coordinate position.
This colors the particles from black to green, depending on the position.
Increasingly green
Using Maya: Hypergraph, Sets & Expressions
195
Expressions
Because a value of 0 or less results in a 0 green value, a particle is black if it’s below the XZ plane. If a particle’s Y coordinate position is above the XZ plane, it has a green component varying from nearly 0 to a fully saturated green.
Particle Expressions List of particle shape attributes
Example particleShape1.rgbPP = <<1,0,CloudShape1.position.z>>;
This causes an error. Maya interprets CloudShape1.position.z as being an attribute named z of an object named CloudShape1.position. You can get the intended result with these statements: vector $temp = CloudShape1.position; particleShape1.rgbPP = <<1,0,$temp.z>>;
The first statement reads all three components of vector attribute CloudShape1.position and assigns it to the vector variable $temp. The second statement reads the value of the right component of $temp, which contains the right component of CloudShape1.position. It then assigns this component to the right component of particleShape1.rgbPP.
Example particleShape1.rgbPP.y = 1;
This also causes an error. You can’t assign a value to a vector array attribute component.
List of particle shape attributes The following table describes the static and dynamic attributes that affect particle shape nodes on a per object or per particle basis. Note the following: •
Attributes you can read but not write are marked with an asterisk (*).
•
Empty boxes in the Render Type column indicate the render type is irrelevant to the attribute’s usage.
•
You can read and write per particle attributes only in particle expressions. See Using Maya: Dynamics for more details on the attributes.
196
Using Maya: Hypergraph, Sets & Expressions
Particle Expressions List of particle shape attributes
Description
Per particle
Render Type
acceleration (acc)
Sets acceleration.
yes
vector array
age* (ag)
Contains number of seconds each particle has existed in scene.
yes
float array
attributeName
Specifies name of attribute whose value is displayed at particle positions.
Numeric
string
betterIllumination
Toggles increased self shadowing.
Cloud
boolean
colorAccum
Toggles additive display effect for RGB and opacity of overlapping particles for this object.
MultiPoint MultiStreak Points Streak
boolean
colorBlue
Sets blue component of RGB color.
float
colorGreen
Sets green component of RGB color.
colorRed
Sets red component of RGB color.
Blobby Surface Cloud MultiPoint MultiStreak Points Sphere Sprite Streak
conserve (con)
Sets amount of momentum conservation.
float
count* (cnt)
Contains number of particles in object.
integer
depthSort (ds)
Toggles depth sorting of particles for rendering.
MultiPoint MultiStreak Points Streak Sprite
Data Type
Expressions
Attribute long name (and short name)
float float
boolean
Using Maya: Hypergraph, Sets & Expressions
197
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
dynamicsWeight (dw)
Scales effect of dynamic fields and collisions on particle object.
event*
Contains number of times each particle in the object has hit something.
eventCount* (evc)
Contains total number of events that have occurred for all particles of the object.
integer
eventTest* (evt)
Contains 1 if an event has occurred on the object since last time an expression or MEL getAttr command read the eventTest value.
boolean
goalPP
Sets how much the particles try to follow goal on a per particle basis.
goalWeight (gw)
Sets how much the particles try to follow goal.
incandescence
Sets glow color.
incandescencePP
Sets glow color.
inheritFactor (inh)
Sets fraction of velocity inherited from the emitter of this particle object.
float
isDynamic (isd)
Toggles dynamics for object.
boolean
lifespan
Sets when all particles die.
float
198
Using Maya: Hypergraph, Sets & Expressions
Per particle
Render Type
Data Type
float
yes
float array
yes
float array
float
yes
Cloud
vector
Cloud
vector array
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
Per particle
Render Type
Data Type
lifespanPP
Sets when particles die on a per particle basis.
yes
levelOfDetail (lod)
Scales number of particles that can be emitted into the object.
lineWidth
Sets width of particle.
mass
Specifies physical mass of particles. As mass increases, the effect of dynamic forces change.
maxCount (mxc)
Sets maximum number of particles that can be emitted into this object.
multiCount
Sets number of points you want displayed for each particle. This number applies to each particle in the object.
MultiPoint Point
float
multiRadius
Sets radius of spherical region in which particles are randomly distributed.
MultiPoint MultiStreak
float
normalDir
Sets direction of normal for particles. Used with useLighting.
MultiPoint MultiStreak Points Streak
integer (1-3)
float array float
MultiStreak Streak yes
float float array
integer
Expressions
Using Maya: Hypergraph, Sets & Expressions
199
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
opacity
Sets amount of transparency.
opacityPP
Sets amount of transparency.
particleId* (id)
Contains id number of each particle.
pointSize
Sets size of particle points.
position (pos)
Sets position.
radius
Sets radius size of all particles.
Blobby Surface Cloud Sphere
float
radius0
Sets starting point radius for tube render type.
Tube
float
radius1
Sets ending point radius for tube render type.
Tube
float
radiusPP
Sets radius size on a per particle basis.
Blobby Surface Cloud Sphere
float array
200
Using Maya: Hypergraph, Sets & Expressions
Per particle
Render Type
Data Type
MultiPoint MultiStreak Points Streak Sphere Blobby Surface Cloud Sprite
float
yes
MultiPoint MultiStreak Points Streak Sphere Cloud Sprite
float array
yes
Numeric
float array
MultiPoint, Numeric Points
float
yes
yes
vector array
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
primaryVisibility (rea)
Per particle
Data Type
Toggles whether surface will be rendered by software renderer.
Cloud Blobby Surface Tube
boolean
visibleInReflections (rrl)
Toggles whether object is visible in reflections.
Cloud Blobby Surface Tube
boolean
visibleInRefractions (rrr)
Toggles whether object is visible in refractions.
Cloud Blobby Surface Tube
boolean
castsShadows (rsh)
Toggles whether object casts shadows.
Cloud Blobby Surface Tube
boolean
rgbPP
Sets color.
MultiPoint MultiStreak Points Sphere Sprite Streak
vector array
selectedOnly
Toggles display of id numbers for selected particles.
Numeric
boolean
spriteNum
Sets image number index for image sequence.
Sprite
integer
spriteNumPP
Sets image number index for image sequence.
Sprite
integer array
spriteScaleX
Sets X-axis image scale.
Sprite
float
spriteScaleXPP
Sets X-axis image scale.
Sprite
float array
spriteScaleY
Sets Y-axis image scale.
Sprite
float
spriteScaleYPP
Sets Y-axis image scale.
Sprite
float array
spriteTwist
Sets image’s rotation angle.
Sprite
float
yes
yes
yes
yes
Using Maya: Hypergraph, Sets & Expressions
Expressions
Render Type
201
Particle Expressions List of particle shape attributes
Attribute long name (and short name)
Description
Per particle
Render Type
Data Type
spriteTwistPP
Sets image’s rotation angle.
yes
Sprite
float array
surfaceShading
Sets level of shading.
Cloud
float
tailFade
Sets opacity of tail fade.
MultiStreak Streak
float
tailSize
Sets length of tail.
MultiStreak Streak Tube
float
threshold
Sets distance between particles at which lofting occurs.
Blobby Surface Cloud
float
useLighting
Toggles whether scene lighting lights up particles.
MultiPoint MultiStreak Points Sprite Streak
boolean
velocity (vel)
Sets velocity.
202
Using Maya: Hypergraph, Sets & Expressions
yes
vector array
9
Functions In expressions, you can use built-in operations called functions to create motion, particle positioning, and other effects. This chapter explains the most commonly used functions and a few useful MEL commands. A hermite function shaped the lightning’s soft body geometry, dnoise animated its turbulence, and sphrand enhanced its randomness.
Expressions
Matt Baer
For easy reference, this chapter groups functions by their purpose. For example, all math functions are grouped in the same section. To find out about:
See page:
Understanding functions
205
Function syntax
206
Limit functions abs ceil floor clamp min max sign trunc
209 210 210 210 211 212 212 212 213 Using Maya: Hypergraph, Sets & Expressions
203
Functions
204
To find out about:
See page:
Exponential functions exp log log10 pow sqrt
214 214 214 214 215 215
Trigonometric functions cos cosd sin sind tan tand acos acosd asin asind atan atand atan2 atan2d hypot
216 216 218 219 224 224 225 225 226 226 226 227 227 227 228 228
Vector functions angle cross dot mag rot unit
229 230 230 231 231 232 233
Conversion functions hsv_to_rgb rgb_to_hsv deg_to_rad rad_to_deg
234 235 235 234 234
Using Maya: Hypergraph, Sets & Expressions
Functions Understanding functions
See page:
Array functions clear size sort
236 236 237 237
Random number functions gauss noise dnoise rand sphrand seed
239 239 241 242 243 244 246
Curve functions linstep smoothstep hermite
249 249 252 254
General commands eval print system
259 259 261 263
Other functions and commands
264
Expressions
To find out about:
Understanding functions A function generates a value where it occurs in an expression statement. It takes action based on parameters called arguments that you enclose in parentheses next to the function name.
Example Suppose you have an object named Star whose translateX attribute is set with this expression statement: Star.translateX = rand(10);
In this statement, the rand function has the argument 10. With this argument, the function generates a randomly selected floating point number between 0 and 10 each time the statement executes. For example, translateX Using Maya: Hypergraph, Sets & Expressions
205
Functions Function syntax might be assigned 6.5409 the first time the statement executes, 3.2974 the second time, 8.7389 the third time, and so on. This causes Star to jump to random points from 0 to 10 units away from the X-axis as the scene plays. Though functions can be more or less complicated than this example, they all have at least one argument and generate one value. Note that a function is part of an expression statement. They don’t stand alone in an expression. Many functions do mathematical operations. For example, the sin function generates the sine of a specified angle. Though we often provide explanatory figures and details, we assume you’re familiar with the mathematical purpose of such functions. For details on the math behind such functions, see a more elementary reference. Note that the following functions are important to learn if you want to go beyond the basics of expression writing: •
sin or sind
•
linstep
•
smoothstep
•
hermite
•
noise
•
dnoise
•
rand
•
sphrand
•
print
Function syntax To help you quickly reference different functions, this chapter includes a syntax format statement for each function. The format follows: datatype
function(datatype argument)
function is the name of the function. datatype to the left of an argument indicates the data type of the argument. argument is a parameter you type with the function. datatype to the left of the function name indicates the data type returned when the function executes.
206
Using Maya: Hypergraph, Sets & Expressions
Functions Function syntax Note that for either datatype, you don’t type a value. The datatype tells you the type of data you must enter or the data type returned by the executed function. The data types are in small type size for easy identification in the syntax definitions.
Example 1 int
abs(int number)
float
abs(float number)
vector abs(vector number)
The function name is abs, which returns the absolute value of the number of your choice. The absolute value of a number is the number without its positive or negative sign. This example shows the abs function has three formats. Each version requires an argument with a different data type and returns a value with a different data type. The first version indicates that you can type an integer argument, and the function returns an integer result. For example, abs(-3) returns 3.
The third version indicates you can type a vector, and the function returns a vector. For example abs(<<3, -6.3, -2>>) returns <<3, 6.3, 2>>.
Example 2 Many functions have only one format, for example, the deg_to_rad function: float
deg_to_rad( float degrees )
This function returns the radian equivalent of to a degree value. It expects a floating point argument and returns a floating point number. Note that Maya ignores spaces between components of functions. For example, the functions in each of these expressions work the same: rotateY = deg_to_rad (45); rotateY = deg_to_rad(45); rotateY = deg_to_rad( 45 );
Using Maya: Hypergraph, Sets & Expressions
207
Expressions
The second version indicates that you can type a floating point argument, and the function returns a floating point result. For instance, abs(-7.54) returns 7.54.
Functions Function syntax
Data types In many cases, entering a data type other than the type expected by a function causes an error and prevents the expression from executing. For example, if you enter a vector argument where a floating point number is expected, an error occurs. For a function argument that expects a floating point number, however, you can instead type an integer—a number without a decimal point. Maya converts an integer to a floating point number in arithmetic operations. If an error occurs when you create an expression, check that you’re using the appropriate data types for all arguments.
Notes In this book, examples of floating point return values show no more than three digits to the right of the decimal point. If you display the contents of an attribute or variable in the Script Editor, you’ll see as many as 10 digits to the right of the decimal point. For instance, an example might show a return value as 3.539 rather than the precise value 3.538654390. The examples round up such numbers for ease of reading. Note also that converting radians to degrees and vice versa results in rounding errors. For example, converting a radian value might result in 89.99999996 degrees rather than 90.0 degrees.
Understanding function examples in this chapter Most function examples in this chapter show the use of the function outside of an expression statement. This makes the examples less cluttered and easier to read. For instance, the first example for the abs function on page 209 is: abs(-1)
This returns the value 1 where it occurs in an expression statement. For a function to have effect, you must use it within an expression that assigns a value to an attribute or variable.
208
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions
Examples Ball.scaleY = abs(-1);
This statement assigns Ball.scaleY the value returned by the abs(-1) function. If you use a function in an expression statement and do not assign the returned value to an attribute, the statement has no effect. abs(-1);
Returns 1, but doesn’t assign it to an attribute. This has the same result as the following meaningless statement: 1;
In some function examples in this chapter, the function’s purpose is easier to understand in the context of an expression. In such cases, we show examples of the function in an expression.
Limit functions The limit functions are math functions that impose limits on numbers.
abs
int
Expressions
Returns the absolute value of number. The absolute value of an integer or floating point number is the number without its positive or negative sign. The absolute value of a vector is a vector with components stripped of negative signs. abs(int number)
float
abs(float number)
vector
abs(vector number)
number is the number for which you want the absolute value.
Examples abs(-1)
Returns the value 1. abs(1)
Returns the value 1.
Using Maya: Hypergraph, Sets & Expressions
209
Functions Limit functions abs(<<-1,-2.43,555>>)
Returns <<1, 2.43, 555>>. abs(Ball.translateY)
If Ball.translateY contains -20, this returns 20.
ceil Returns a number rounded to the smallest integer value greater than or equal to a floating point number. float
ceil(float number)
number is the number you want to round.
Examples ceil(2.344)
Returns 3. ceil(3.0)
Returns 3. ceil(Rock.scaleY)
If Rock.scaleY contains -2.82, this returns -2.
floor Returns a number rounded to the largest integer less than or equal to a floating point number. float
floor(float number)
number is the number you want to round.
Examples floor(2.344)
Returns 2. floor(3.0)
Returns 3.
210
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions floor(Head.height)
If Head.height is -2.8, this returns -3.
clamp Returns a number within a range. You can use the clamp function to confine an increasing, decreasing, or randomly changing number to a range of values. float
clamp(float minnumber, float maxnumber, float parameter)
minnumber and maxnumber specify the range of the returned value. parameter is an attribute or variable whose value you want to clamp within the range. If parameter is within the numerical range of minnumber and maxnumber, the function returns the value of parameter. If parameter is greater than the range, the function returns the maxnumber. If parameter is less than the range, the function returns the minnumber.
Examples clamp(4,6,22)
clamp(4,6,2)
Returns 4, because 2 is less than 4, the minimum number of the range. clamp(4,6,5)
Returns 5, because it’s within the range. Ball.scaleY = clamp(0,3,time);
Returns a value between 0 and 3 each time the expression executes. When you rewind the animation to frame 1, the above expression executes and Ball’s scaleY attribute receives the value of time—a number slightly above 0. The clamp function returns the value of time because time is within the range 0 to 3. When you play the animation, time increments slightly with each frame. The expression executes with each frame and Ball’s scaleY attribute receives the value of time until time exceeds 3. When time exceeds 3, the clamp function returns the value 3. Using Maya: Hypergraph, Sets & Expressions
211
Expressions
Returns 6, because 22 is greater than 6, the maximum number of the range.
Functions Limit functions
min Returns the lesser of two floating point numbers. float
min( float number, float number)
number is a number you want to compare.
Examples min(7.2,-3.2)
Returns -3.2. Desk.height = -2; Lamp.height = 9; $Mylight = min(Desk.height,Lamp.height);
Sets $Mylight to -2.
max Returns the larger of two floating point numbers. float
max(float number, float number)
number is a number you want to compare.
Examples max(7.2,-3.2)
Returns 7.2. Desk.height = -2; Lamp.height = 9; $Mylight = max(Desk.height,Lamp.height);
Sets $Mylight to 9.
sign Returns one of three values representing the sign of a number. Returns -1 if the number is negative, 1 if positive, 0 if 0. float
sign( float number )
number is the number whose sign you want to determine.
212
Using Maya: Hypergraph, Sets & Expressions
Functions Limit functions
Examples sign(-9.63)
Returns -1. sign(0)
Returns 0. sign(10)
Returns 1. sign(Ball.translateX)
If Ball.translateX is 5, this returns 1.
trunc Returns the whole number part of a floating point number. float
trunc(float number)
number is the number you want to truncate.
Examples trunc(2.344)
Expressions
Returns 2. trunc(0.3)
Returns 0. trunc(-2.82)
Returns -2. trunc(time)
If time equals 3.1234, this returns 3.
Using Maya: Hypergraph, Sets & Expressions
213
Functions Exponential functions
Exponential functions The following functions work with exponential values.
exp Returns e raised to the power of a number, enumber. The predefined variable e is the base of the natural logarithm, which is 2.718. float
exp(float number)
number is the exponent to which you want to raise e.
Examples exp(1)
Returns 2.718, the value of e. exp(2)
Returns 7.389, the value of e2.
log Returns the natural logarithm of a number, logenumber. The natural logarithm uses the constant e, which is 2.718. float
log(float number)
number is the positive number for which you want the natural logarithm.
Examples log(10)
Returns 2.303. log(2.718282845904)
Returns 1.000.
log10 Returns the log base 10 of a number. float
log10(float number)
number is the positive number for which you want the log base 10.
214
Using Maya: Hypergraph, Sets & Expressions
Functions Exponential functions
Examples log10(100)
Returns 2. log10(10)
Returns 1.
pow Returns a base number raised to an exponent. float
pow(float base, float exponent )
base is the base number you want to raise to the exponent. A negative base number with a decimal component causes an error message. exponent is the exponent.
Examples pow(2,3)
Returns 8. pow(-2,3)
Expressions
Returns -8. pow(2,-3)
Returns 0.125.
sqrt Returns the square root of a positive number. float
sqrt(float number)
number is the positive number of which you want the square root. A negative number displays an error message.
Examples sqrt(16)
Returns 4.
Using Maya: Hypergraph, Sets & Expressions
215
Functions Trigonometric functions sqrt($side)
If $side is 25, this returns 5.
Trigonometric functions The following functions return trigonometric values. Each function has two formats that let you choose the type of angular unit you work with: degrees or radians. For example, the cos function expects an argument in radians, while cosd expects an argument in degrees. A radian equals 180 degrees divided by pi, or roughly 57.3 degrees. Note that pi equals 3.1415927, which is also 180 degrees.
cos Returns the cosine of an angle specified in radians. float
cos(float number)
number is the angle, in radians, whose cosine you want. For any right triangle, the cosine of an angle is the following ratio:
adjacent B cos θ = ------------------------------ = ---hypotenuse C Y
Y
C
θ
A
θ
B B
X
X
A C
If θ is less than 1/2 pi radians and more than 3/2 pi radians (from 270 to 90 degrees), cos θ is a value between 0 and 1.
216
Using Maya: Hypergraph, Sets & Expressions
If θ is between 1/2 pi radians and 3/2 pi radians (90 to 270 degrees), cos θ is a value between 0 and -1.
Functions Trigonometric functions The cosine ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the cosine of the measure of the angle. The cosine ratio is a value between -1 and 1. With a steadily increasing or decreasing argument, the cos function returns steadily increasing or decreasing values between 1 and -1. This is useful for creating rhythmic, oscillating changes in attribute values. The cos function works like the sin function except its return values are 90 degrees, or pi/2, out of phase. See page 219 for ideas on how to use the cyclical characteristics of the sin and cos functions.
Example 1 cos(1)
Returns 0.5403, the cosine of 1 radian.
Example 2 To animate the motion of Ball in a cosine wave pattern, use this expression:
Ball starts at the origin and moves in the X direction at a rate set by the incrementing animation time. Its Y translation moves cyclically up and down according to the return values of the cos function. The cos function uses translateX, and therefore indirectly, time, as its argument. As time increases from 0 to 6.283 seconds, the cos function returns values that change in fine increments from 1 to -1 and back to 1. The value 6.283 is 2 times the value of pi. As time increases beyond 6.283 seconds, the same cycle repeats for each span of 6.283 seconds.
Using Maya: Hypergraph, Sets & Expressions
217
Expressions
Ball.translateX = time; Ball.translateY = cos(Ball.translateX);
Functions Trigonometric functions
Ball.translateY = cos(Ball.translateX);
time = 6.283 (2 * pi seconds)
Compare the same expression using the sin function: Ball.translateY = sin(Ball.translateX);
time = 6.283 (2 * pi seconds)
The cosine curve is 1.571 (pi/2) seconds ahead of (or behind) the sine curve, and vice versa.
cosd Returns the cosine of an angle specified in degrees. float
cosd(float number)
number is the angle, in degrees, whose cosine you want. For more details on the cosd function, see the cos function in the preceding topic. The cosd and cos functions do the same operation, but cosd requires its argument in degree measurement units.
218
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Example cosd(45)
Returns 0.707, the cosine of 45 degrees.
sin Returns the sine of an angle specified in radians. float
sin(float number)
number is the angle, in radians, whose sine you want. For any right triangle, the sine of an angle is the following ratio:
opposite A sin θ = ------------------------------ = ---hypotenuse C Y
Y
C A
θ
θ
B
X
A C
If θ is from 0 to pi radians (0 to 180 degrees), sin θ is a value between 0 and 1.
If θ is from pi to 2 pi radians (180 to 360 degrees), sin θ is a value between 0 and -1.
The sine ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the sine of the measure of the angle. The sine ratio is a value between -1 and 1. With a steadily increasing or decreasing argument, the sin function returns steadily increasing or decreasing values between -1 and 1. This is useful for creating rhythmic, oscillating changes in attribute values. Using Maya: Hypergraph, Sets & Expressions
219
Expressions
X
B
Functions Trigonometric functions For example, you can use the sin function to manipulate: •
an object’s translate attributes to create snake-like motion
•
a body’s scale attributes to create a breathing cycle
•
a particle object’s opacity or color attributes to cycle a color or opacity pattern
Example 1 float $pi = 3.1415927; sin($pi/2)
Returns 1, the sine of pi/2 radians.
Example 2 Ball.translateY = sin(Ball.translateX);
This statement sets Ball’s translateY attribute equal to the sine of its translateX attribute. If you drag Ball along the X-axis, Ball’s translateY position moves up and down in a cyclical pattern:
Example 3 To animate Ball to the path of the preceding example, use this expression: Ball.translateX = time; Ball.translateY = sin(Ball.translateX);
220
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions Ball starts at the origin and moves in the X direction at a rate set by the incrementing animation time. Its Y translation moves cyclically up and down according to the return values of the sin function. The sin function uses translateX, and therefore indirectly, time, as its argument. As time increases from 0 to 6.283 seconds, the sin function returns values that change in fine increments from 0 to 1 to -1 to 0. The value 6.283 is 2 times the value of pi. The resulting motion resembles a horizontal S-shape:
time = 6.283 (2 * pi seconds)
As time increases beyond 6.283 seconds, the same S-shaped cycle repeats for each span of 6.283 seconds.
This expression animates Ball with larger up and down swings: Ball.translateX = time; Ball.translateY = sin(Ball.translateX) * 2;
By multiplying sin(Ball.translateX) by a number greater than 1, you increase the amplitude of the sine wave pattern. The amplitude is half the distance between the minium and maximum values of the wave.
Amplitude
Using Maya: Hypergraph, Sets & Expressions
221
Expressions
Example 4
Functions Trigonometric functions You can decrease the amplitude of the sine wave by multiplying by a number less than 1, for example, 0.5.
Example 5 This expression increases how often the sine wave completes a cycle: Ball.translateX = time; Ball.translateY = sin(Ball.translateX * 2);
By multiplying Ball.translateX by a number greater than 1, you increase the frequency of the sine wave pattern. The frequency is how long it takes the wave to make a complete cycle.
Frequency
You can decrease the frequency of the sine wave by multiplying by a number less than 1, for example, 0.5. This number is known as a frequency multiplier because it multiplies (or divides) the frequency of the sine pattern.
Example 6 This expression offsets the wave pattern higher up the Y-axis: Ball.translateX = time; Ball.translateY = sin(Ball.translateX) + 2;
By adding 2 to sin(Ball.translateX), the wave pattern starts further up the Yaxis. You can, of course, also subtract a number to offset the wave pattern lower on the Y-axis.
222
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Offset of 2
Example 7 The following expression sets a frequency multiplier, amplitude, and offset of a sine pattern in a single statement: Ball.translateX = time; Ball.translateY = (sin(Ball.translateX * 2) * 2) + 2;
Expressions
The following diagram shows which values set the frequency multiplier, amplitude, and offset. Frequency multiplier Amplitude Offset Ball.translateY = (sin(Ball.translateX * 2) * 2) + 2;
A general equation showing the factors you can use to create a sine wave pattern follows: attribute = (sin(frequency * frequency multiplier) * amplitude) + offset;
Using Maya: Hypergraph, Sets & Expressions
223
Functions Trigonometric functions
sind Returns the sine of an angle specified in degrees. float
sind(float number)
number is the angle, in degrees, whose sine you want. For more details on how to use the sind function, see the sin function in the preceding topic. The sind and sin functions do the same operation, but sind requires its argument in degree measurement units.
Example sind(90)
Returns 1, the sine of 90 degrees.
tan Returns the tangent of an angle specified in radians. float
tan(float number)
number is the angle, in radians, whose tangent you want. For any right triangle, the tangent of an acute angle is the following ratio:
opposite A tan θ = ----------------------- = --adjacent B Y
Y
C
θ
A
θ
B B
X
X
A C
224
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions The ratio depends only on the size of the angle and not on the size of the triangle. This constant ratio is called the tangent of the measure of the angle.
Example tan(1)
Returns 1.557.
tand Returns the tangent of an angle specified in degrees. float
tand(float number)
number is the angle, in degrees, whose tangent you want. For more details on the tand function, see the tan function in the preceding topic. The tand and tan functions do the same operation, but tand requires its argument in degree measurement units.
Example tand(45)
Returns roughly 1, the tangent of 45 degrees.
Returns the radian value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to pi. float
acos(float number)
number is the cosine of the angle, and must be from -1 to 1.
Example acos(1)
Returns 0. acos(-0.5)
Returns 2.0944 radians.
Using Maya: Hypergraph, Sets & Expressions
225
Expressions
acos
Functions Trigonometric functions
acosd Returns the degree value of the arc cosine of a number. The arc cosine is the angle whose cosine is the specified number. The returned value is from 0 to 180. float
acosd(float number)
number is the cosine of the angle, and must be from -1 to 1.
Example acosd(1)
Returns 0 degrees. acosd(-0.5)
Returns 120 degrees.
asin Returns the radian value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -pi/2 to pi/2. float
asin(float number)
number is the sine of the angle, and must be from -1 to 1.
Example asin(0.5)
Returns 0.525 radians.
asind Returns the degree value of the arc sine of a number. The arc sine is the angle whose sine is the specified number. The returned value is from -90 to 90. float
asind(float number)
number is the sine of the angle, and must be from -1 to 1.
226
Using Maya: Hypergraph, Sets & Expressions
Functions Trigonometric functions
Example asind(0.5))
Returns 30 degrees.
atan Returns the radian value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -pi/2 to pi/2. float
atan(float number)
number is the tangent of the angle and can be any value.
Example atan(1)
Returns 0.785.
atand
float
atand(float number)
number is the tangent of the angle and can be any value.
Example atand(1)
Returns 45 degrees.
atan2 Returns the radian value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in radians, from -pi to pi, excluding -pi. float
atan2(float Y, float X )
X is the X coordinate of the point. Using Maya: Hypergraph, Sets & Expressions
227
Expressions
Returns the degree value of the arc tangent of a number. The arc tangent is the angle whose tangent is the specified number. The returned value is from -90 to 90.
Functions Trigonometric functions Y is the Y coordinate of the point.
Example atan2(1,1)
Returns 0.785 radians.
atan2d Returns the degree value of the arc tangent of specified X and Y coordinates. The arc tangent is the angle from the X-axis to a line passing through the origin and a point with coordinates X,Y. The returned angle is in degrees, from -180 to 180, excluding -180. float
atan2d(float Y, float X )
X is the X coordinate of the point. Y is the Y coordinate of the point.
Example atan2d(1,1)
Returns 45 degrees.
hypot Returns the magnitude of two-dimensional vector from the origin to a point with coordinates X, Y. Y
hypot
(X,Y) X
228
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions As shown in the preceding figure, the hypot function returns the radius of a circle whose center is at one end of a right triangle’s hypotenuse and perimeter is at the other end of the hypotenuse. The following equation gives the magnitude of the vector: 2
x +y float
2
hypot(float x, float y)
X is the X coordinate of the point. Y is the Y coordinate of the point.
Example hypot(3,4)
Returns 5.
Vector functions Expressions
The following functions do operations with vectors. The functions take vector arguments and return floating point numbers or vectors.
angle Returns the radian angle between two vectors. Vector1
Angle
Vector2
float
angle( vector vector1, vector vector2)
vector1 is one of the vectors.
Using Maya: Hypergraph, Sets & Expressions
229
Functions Vector functions vector2 is the other vector. The returned angle is the shortest angle between the two vectors. The measurement is always less than 180 degrees.
Example angle(<<2,-1,1>>,<<1,1,2>>)
Returns 1.0472 radians, which equals 60 degrees.
cross Returns the cross product of two vectors. For two vectors, the cross product returns the vector that’s normal to the plane defined by the two vectors. Vector1
Vector2
Cross product
vector
cross(vector vector1, vector vector2)
If the cross product is 0, the two vectors are parallel or colinear. If one or both vectors are <<0,0,0>>, the cross product returns <<0,0,0>>. vector1 is one of the vectors. vector2 is the other vector.
Example cross(<<1,2,-2>>,<<3,0,1>>)
Returns <<2, -7, -6>>.
230
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions
dot Returns the floating point dot product of two vectors. The dot product takes two vectors as arguments and returns a scalar value. float
dot(vector vector1, vector vector2)
If the dot product returns 0, the two vectors are perpendicular. vector1 is one of the vectors. vector2 is the other vector.
Example dot(<<1,2,-2>>,<<3,0,1>>)
Returns 1. The dot product of this example is (1 * 3) + (2*0) + (-2*1), which equals 1.
mag Returns the magnitude of a vector. This is the length of the vector. Y-axis
X
Expressions
Z
<> Y X-axis
Z-axis Magnitude float
mag(vector vector)
vector is the vector whose magnitude you want.
Using Maya: Hypergraph, Sets & Expressions
231
Functions Vector functions The mag function converts a vector into a floating point number using the following formula. 2
2
x +y +z
2
Example mag(<<7,8,9>>)
Returns 13.928. 2
2
2
7 + 8 + 9 = 13.928
rot Returns a vector that represents the position of a point after it’s rotated a specified number of radians about a specified axis. Rotation is counterclockwise as viewed downward from the axis end position. Position of point before rotation Angle Position of point after rotation
Axis
vector
rot(vector point, vector axis, float angle )
point is the position of a point in the world coordinate system. axis is the axis around which the point rotates. The axis is a line that passes through the origin and the specified axis position. angle is the number of radians the point rotates.
232
Using Maya: Hypergraph, Sets & Expressions
Functions Vector functions
Example 1 rot(<<3,3,0>>,<<1,0,0>>,0.5)
Returns <<3, 2.633, 1.438>>. This is a vector representing the position of point <<3,3,0>> after rotating it 0.5 radians around the axis represented by <<1,0,0>>.
Example 2 particleShape1.position = rot(position,<<0,1,0>>,0.1);
Suppose your scene has a single-particle object at position <<4,6,0>>, and you wrote the above runtime expression for its particle shape node. When you play the scene, the particle rotates in a circular pattern around the Y-axis (the axis represented by <<0,1,0>>). In each frame, the particle’s position rotates 0.1 radian, roughly 5.7 degrees. Motion Particle
Expressions
unit Returns the unit vector corresponding to a vector. The unit vector has the same direction as the specified vector, but with a magnitude of 1. vector
unit( vector vector)
vector is the vector whose unit vector you want.
Example unit(<<1,1,1>>)
Returns <<0.577, 0.577, 0.577>>. Using Maya: Hypergraph, Sets & Expressions
233
Functions Conversion functions
Y <<1, 1, 1>> <<0.577, 0.577, 0.577>>
X Z Unit vector (magnitude = 1)
Conversion functions The following functions convert color scheme values or angle measurements.
deg_to_rad Returns the radian equivalent of a degree value. One radian equals roughly 57.29578 degrees. float
deg_to_rad( float degrees )
degrees is the degree angle you want to convert to radians.
Example deg_to_rad(90)
Returns 1.571, which is the same as pi/2.
rad_to_deg Returns the degree equivalent of a radian value. One radian equals roughly 57.29578 degrees. float
rad_to_deg(float radians)
radians is the radian angle you want to convert to degrees.
234
Using Maya: Hypergraph, Sets & Expressions
Functions Conversion functions
Examples rad_to_deg(1)
Returns 57.296. float $pi = 3.1415927; rad_to_deg($pi)
Returns 180.
hsv_to_rgb Converts an HSV vector to an RGB vector. vector
hsv_to_rgb(vector hsv)
hsv is a vector representing the hue, saturation, and value components.
Example hsv_to_rgb(<<1,0.5,0.6>>)
Returns <<0.6, 0.3, 0.3>>.
Tip
In the window’s hexagonal color wheel, drag the pointer to a color of interest. The edit boxes in the window list the color’s values for hue, saturation, and value—and their counterpart red, green, and blue values. Note, however, that the Hue value in the Color Chooser has a range of 0 to 360, while the H component of an HSV vector has a corresponding proportional range of 0 to 1. When you launch the Color Chooser by entering colorEditor, it’s useful only for learning about color. You can’t use it to change the color of objects in your scene.
rgb_to_hsv Converts an RGB vector to an HSV vector.
Using Maya: Hypergraph, Sets & Expressions
235
Expressions
To see the relationship between HSV and RGB color components, enter the MEL command colorEditor at the Command Line. This displays the Color Chooser window.
Functions Array functions vector
rgb_to_hsv(vector rgb)
rgb is a vector representing the red, green, and blue components.
Example rgb_to_hsv(<<0.6,0.6, 0.6>>)
Returns <<0, 0, 0.6>>.
Array functions The following functions work with integer, floating point, and vector arrays. If you need more information, see a reference book on the C programming language.
clear Empties the array’s contents, freeing all memory reserved for the array. After you clear an array, its size is 0. When you no longer need to use an array, use the clear function to free memory. int
clear(array array)
array is the name of the array you want to clear. The clear function returns 1 if the function succeeds, 0 if it fails. The return value is not typically used in expressions.
Example int $myInts[] = {1,2,3,4,5,6}; print("size of $myInts is: "+size($myInts)+"\n"); clear($myInts); print("size of $myInts is: "+size($myInts)+"\n");
The third statement above clears the array $myInts. The second and fourth statements display the following text in the Script Editor: size of $myInts is: 6 size of $myInts is: 0
236
Using Maya: Hypergraph, Sets & Expressions
Functions Array functions
size Returns the number of elements in an array or the number of characters in a string. int
size(array array)
int
size(string string)
array is the name of the array whose size you want. string is the string whose number of characters you want.
Example 1 string $s = "Hello"; $stringlen = size($s);
The size($s) function returns 5, then the statement assigns 5 to $stringlen.
Example 2 int $myInts[] = {1,2,3,4,5,6}; $numInts = size($myInts);
The size($myInts) function returns 6, then the statement assigns 6 to $numInts.
Returns an array sorted in alphabetical or ascending numerical order. The returned array has the same number and type of elements as the original array. array sort(array array)
array is the name of the array to be sorted.
Example 1 int $myInts[] = {3,6,1,4,2,5}; int $afterSorting[] = sort($myInts); print("After sorting, the array contains:\n"); for ($i = 0; $i < 6; $i = $i + 1) { print($afterSorting[$i]+"\n"); }
Using Maya: Hypergraph, Sets & Expressions
237
Expressions
sort
Functions Array functions The sort function sorts the elements of $myInts in ascending order. The following appears in the Script Editor: After sorting, the array contains: 1 2 3 4 5 6
Example 2 string $myName[] = {"Peewee","Michael","Kennedy"}; string $afterSorting[] = sort($myName); print("After sorting, the array contains:\n"); for ($i = 0; $i < 3; $i = $i + 1) { print($afterSorting[$i]+"\n"); }
The sort function sorts the elements of $myName in alphabetical order. The following appears in the Script Editor: After sorting, the array contains: Kennedy Michael Peewee
238
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
Random number functions The following functions generate random numbers. Random numbers are useful when you want the position, motion, or color of an object’s particles or vertices to have a random appearance.
gauss Returns a random floating point number or vector. The number returned falls within a Gaussian (bell curve) distribution with mean value 0. float
gauss(float stdDev)
vector
gauss(float XstdDev, float YstdDev)
vector
gauss(vector stdDevVector)
stdDev specifies the value at which one standard deviation occurs along the distribution. This gives a one-dimensional Gaussian distribution. XstdDev and YstdDev specify the values for one standard deviation. This gives a two-dimensional Gaussian distribution in the XY plane. The right component of the vector returned is 0. stdDevVector specifies the vector component values for one standard deviation. This gives a three-dimensional distribution.
Example gauss(5)
Returns a random floating point value such as 0.239.
Using Maya: Hypergraph, Sets & Expressions
239
Expressions
To control the random values returned by this function, see “seed” on page 246.
Functions Random number functions If you were to execute gauss(5) repeatedly and chart the values returned, they would occur roughly with this frequency: Mean One standard deviation
About 2/3 of returned values will be within one standard deviation.
Number of occurrences
0
-5
5
Value returned
If you were to execute gauss(2) repeatedly, return values would occur with this frequency: Mean One standard deviation
About 2/3 of returned values will be within one standard deviation.
Number of occurrences
-2
0
Value returned
240
Using Maya: Hypergraph, Sets & Expressions
2
Functions Random number functions
noise Returns a random number from -1 to 1 according to a Perlin noise field generator. float
noise(float number)
float
noise(float xnum, float ynum)
float
noise(vector vector)
number specifies a number that generates a random number. This gives a one-dimensional distribution of return values. xnum and ynum specify numbers for generating a random number. This gives a two-dimensional distribution of return values. vector specifies a vector for generating a random number. This gives a threedimensional distribution of return values. If you execute this function with the same argument value repeatedly, the function returns the same random value each time it executes. If you execute this function with an argument value that steadily increases or decreases in fine increments over time, the function returns random values that increase and decrease over time.
noise(time)
Returns a value between -1 and 1 each time the expression executes as an animation plays. Because time increases in fine increments, the values returned increase and decrease in smooth, yet random, patterns. If you were to chart the values returned over a period of time, they might occur as in this figure:
1 Return value 0 -1 noise(time) as animation plays
Using Maya: Hypergraph, Sets & Expressions
241
Expressions
Example 1
Functions Random number functions
Example 2 noise(frame)
Returns a value between -1 and 1 each time the expression executes as an animation plays. Because frame increases in larger increments, the values returned increase and decrease in rougher patterns. If you were to chart the values returned over a period of time, they might occur as in this figure:
1 Return value 0 -1 noise(frame) as animation plays
The value returned by noise(frame) and noise(time) is the same when frame contains the same number as time. For example, when frame equals 10, noise(frame) returns the same value that noise(time) returns when time is 10.
dnoise Returns a vector with each component containing a random number from -1 to 1. It works like the noise function except it expects and returns a vector argument. The returned vector represents the gradient of the noise field in three dimensions. vector
dnoise(vector argument)
argument specifies a vector for generating a random number. This gives a three-dimensional distribution of return values. See the noise function for more details on dnoise operation.
Example dnoise(<<10,20,-30>>)
Returns <<-0.185, 0.441, 0.686>>.
242
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
rand Returns a random floating point number or vector within a range of your choice. float
rand(float maxnumber)
float
rand(float minnumber, float maxnumber)
vector
rand(vector maxvector)
vector
rand(vector minvector, vector maxvector)
maxnumber specifies the maximum number returned (in the first syntax format listed above). The minimum number returned is 0. In other words, the returned value will be a random number between 0 and maxnumber. minnumber and maxnumber specify the minimum and maximum numbers returned. maxvector specifies the maximum value for each component of the vector returned. The minimum value is 0. Each component returned is a different random number. minvector and maxvector specify the minimum and maximum value for each component of the vector returned.
Example 1 rand(5)
Returns a random floating point number between 0 and 5, for example, 3.539.
Example 2 rand(-1,1)
Returns a random floating point number between -1 and 1, for example, 0.452.
Using Maya: Hypergraph, Sets & Expressions
243
Expressions
To control the random values returned by this function, see “seed” on page 246.
Functions Random number functions If you were to execute rand(-1,1) repeatedly as an animation plays, its return values might occur as in this figure:
1 Return value 0 -1 rand(1,-1) as animation plays
Example 3 rand(<<1,1,1>>)
Returns a random vector in which each component is between 0 and 1, for example, <<0.532, 0.984, 0.399>>.
Example 4 rand(<<1,1,1>>,<<100,200,300>>)
Returns a random vector in which the left component is between 1 and 100, the middle component is between 1 and 200, and the right component is between 1 and 300. An example is <<81.234, 49.095, 166.048>>.
sphrand Returns a random vector value that exists within a spherical or ellipsoidal region of your choice. An ellipsoid is a sphere scaled along its X-, Y- or Zaxes. vector
sphrand(float radius)
vector
sphrand(vector vector)
radius is the radius of a sphere in which the returned vector exists. vector is the radius of an ellipsoid along the X-, Y-, and Z-axis. To control the random values returned by this function, see “seed” on page 246.
244
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions
Example 1 sphrand(1)
Returns a vector whose randomly selected coordinates reside within an imaginary sphere centered at the origin and with a radius of 1. An example returned vector is <<0.444, -0.427, 0.764>>.
Outer boundary of returned value Origin
1
radius
Example 2 sphrand(<<2,1,1>>)
Radius in Z 1
2
Radius in X
1
Outer bound of returned value Radius in Y
To create a particle ellipsoid: You can use the sphrand function, for example, to create a cluster of 500 particles randomly positioned within an ellipsoid having a radius of 2 in the X-axis, 1 in the Y-axis, and 1 in the Z-axis. Using Maya: Hypergraph, Sets & Expressions
245
Expressions
Returns a vector whose coordinates reside within an ellipsoid centered at the origin and with a radius of 2 along the X-axis, 1 along the Y-axis, and 1 along the Z-axis.
Functions Random number functions 1
Select Particles→Particle Tool-❒.
2
Enter 500 for Number of Particles, and 1 for Maximum Radius.
3
Click the mouse somewhere in the workspace to position the particles.
4
Select the particle shape node of the particle object in the Expression Editor.
5
Turn on Creation.
6
Enter this expression: position = sphrand(<<2,1,1>>);
Maya executes the expression once for each particle. It gives each particle a different random position around the origin within the ellipsoid specified by <<2,1,1>>.
seed Sets a seed value the gauss, rand, and sphrand functions use to generate random numbers. If you assign a value to the seed then execute the gauss, rand, or sphrand function repeatedly, an identical sequence of random numbers is generated. For clarification, see the example below and “Reproducing randomness” on page 123. int
seed(int number)
number sets an arbitrary number to be used as the seed value.
Example Suppose you create a NURBS sphere named Ball then enter this expression: Ball.translateX = rand(5);
246
Using Maya: Hypergraph, Sets & Expressions
Functions Random number functions When you rewind the animation, Ball’s translateX attribute receives a random value between 0 and 5, for example, 1.392. When you play the animation, the translateX attribute receives a different random value between 0 and 5 each frame. When you rewind the animation again, the translateX attribute receives a value that’s different from the value it received the first time you rewound, for example, 3.223. When you play the animation again, the translateX attribute receives a value each frame that’s different from the values it received the first time you played the animation. In short, every time the rand(5) executes, it gives a different random value. Suppose you change the expression to this: if (frame == 1) seed(1); Ball.translateX = rand(5);
Rewinding the scene to frame 1 executes the seed(1) function. It then assigns translateX a random value between 0 and 5, for example, 4.501. When you play the animation, the rand(5) function executes each frame and returns a different value. Example returned values follow: Value
1
4.501
2
3.863
3
3.202
4
3.735
5
2.726
6
0.101
Expressions
Frame
Each time you rewind and play the animation, translateX receives the same sequence of random values. For different seed values, the sequence of numbers returned will differ. You can’t predict the values in the number sequence based on the value of the seed.
Using Maya: Hypergraph, Sets & Expressions
247
Functions Random number functions Suppose you change the expression to this: if (frame == 1) seed(500); Ball.translateX = rand(5);
The rand(5) function returns these values as you rewind and play the animation: Frame
Value
1
4.725
2
2.628
3
0.189
4
0.004
5
4.834
6
0.775
By changing the seed function’s value, you change the sequence of random numbers generated. A common mistake while using the seed function follows: seed(1); Ball.translateX = rand(5);
When you rewind the animation, Ball’s translateX attribute receives the value 4.501. When you play the animation, the translateX attribute receives 4.501 each time the expression executes. Because you assign a value (1) to the seed before each execution of rand(5), you initialize the random number sequence. The rand(5) function therefore returns the first value of the number sequence each time it executes.
Important When you set a seed value in an expression or MEL script, the seed value affects the rand, sphrand, and gauss functions in other expressions and MEL scripts. Such functions are affected by this seed value in all scenes you open subsequently in the current work session.
248
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Curve functions The step functions let you make smooth, incrementing transitions between values.
linstep Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. This function lets you increase an attribute such as opacity from 0 to 1 linearly over a time range. float
linstep(float start, float end, float parameter)
start and end specifies the minimum and maximum values. parameter is the value you want to use to generate the proportional number. If parameter is less than start, linstep returns 0. If parameter is greater than end, linstep returns 1.
Example Suppose you’ve used the Particle Tool to create a collection of particles named Cloud: Expressions
Suppose further you’ve added a dyamic per object opacity attribute to Cloud (see “Working with particle attributes” in Chapter 8). You then write this runtime expression for Cloud’s particle shape node: CloudShape1.opacity = linstep(0,5,age);
Using Maya: Hypergraph, Sets & Expressions
249
Functions Curve functions This expression increases the per object opacity attribute of CloudShape1 in equal steps from 0 to 1 for the first 5 seconds of the object’s existence. Because you created the object with the Particle Tool, the particles existence begins in the first frame of the animation. All particles in the object fade in from transparent to opaque for the first 5 seconds of animation. At the first frame that plays, the age of the particles is 0, so the linstep function returns 0 for the opacity. An opacity of 0 is transparent. In each subsequent frame, the linstep function returns a proportionally larger opacity value. When the age of the object reaches 5, the linstep function returns 1 for the opacity. An opacity of 1 is 100% opaque. When the age exceeds 5, the linstep function returns 1. The opacity stays 100% opaque. Here are some values returned for the object’s opacity:
250
Age
Opacity
0.0417
0.0083
0.0833
0.0166
0.125
0.025
0.1667
0.0333
0.2083
0.0417
2.5
0.5
1.0
0.2
3.75
0.75
5
1
5.041
1
5.083
1
10
1
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions As the table shows, the opacity increases in linear increments for the first 5 seconds of the object’s age. At the midpoint of the specified 0 to 5 second age range, the opacity is 0.5. At 3/4 of the way between 0 and 5 seconds, the opacity is 0.75. At 5 seconds of the object’s age, opacity is 1. After 5 seconds, the opacity stays at 1. 1
opacity
0
5 age (in seconds)
Suppose you edit the runtime expression as follows: CloudShape1.opacity = linstep(5,10,age);
This increases the opacity attribute linearly from 0 to 1 as the object’s age increases from 5 to 10 seconds. Expressions
1
opacity
0
5 age (in seconds)
10
Suppose you edit the runtime expression as follows: particleShape1.opacity = 1-linstep(0,5,age);
This decreases the opacity attribute linearly from 1 to 0 for the first 5 seconds of the object’s age. Subtracting linstep(0,5,age) from 1 causes the opacity to fade out rather than fade in.
Using Maya: Hypergraph, Sets & Expressions
251
Functions Curve functions
1
opacity
0
5 age (in seconds)
smoothstep Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. The smoothstep function lets you increase an attribute such as opacity from 0 to 1 gradually, but nonlinearly, over a time range. The smoothstep function works like the linstep function, except it increases values more quickly near the middle values between the minimum and maximum value. The function uses hermite interpolation between minimum and maximum values. float
smoothstep(float start, float end, float parameter)
start and end specifies the minimum and maximum values. parameter is the value you want to use to generate the smoothstep number. If parameter is less than start, linstep returns 0. If parameter is greater than end, linstep returns 1.
252
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions The following figure compares values returned by smoothstep and linstep over time: parameter
smoothstep
start
linstep
end
Example Suppose you’ve used the Particle Tool to create a collection of particles named Cloud: Expressions
Suppose also you’ve added a dynamic per object opacity attribute to Cloud (see “Working with particle attributes” in Chapter 8). You then write this runtime expression for Cloud’s particle shape node: CloudShape1.opacity = smoothstep(0,5,age);
Using Maya: Hypergraph, Sets & Expressions
253
Functions Curve functions This increases the opacity attribute of CloudShape1 in steps from 0 to 1 for the first 5 seconds of the object’s age. This makes the object fade in from transparent to opaque. The fade in and fade out of the opacity occurs more quickly around 2.5, the midpoint between 0 and 5. 1
opacity
0
5 age (in seconds)
See the linstep function for details on similar examples.
hermite Returns values along a hermite curve. You can use the hermite function, for instance, to move a particle object’s position smoothly along a curve. As the examples in the following pages show, you can create various curve shapes by altering the arguments to the hermite function. vector float
hermite(vector start, vector end, vector tan1, vector tan2, float parameter)
hermite(float start, float end, float tan1, float tan2, float parameter)
start is the start point of the curve. end is the end point of the curve. tan1 is the tangent vector that guides the direction and shape of the curve as it leaves the start point of the curve. The vector’s position starts at the start point of the curve. tan2 is the tangent vector that guides the direction and shape of the curve as it approaches the end point of the curve. The vector’s position starts at the end point of the curve. parameter is an floating point value between 0 and 1, for example, the value returned by a linstep function. In the second format, the arguments and return values work in a single dimension.
254
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Example 1 Suppose you create an object named dust made of one particle at the origin. To guide its motion along a short upward-bound curve for the first four seconds of animation, you can write the following runtime expression: dust.position = hermite(<<0,0,0>>,<<2,2,0>>, <<3,0,0>>, <<0,3,0>>, linstep(0,4,time));
When you play the animation, the particle moves from the start point <0,0,0> along a curve to the end point <2,2,0>. The tangent vector <3,0,0> sets the curve’s direction and shape as it leaves the start point. The tangent vector <0,3,0> sets the curve’s direction and shape as it approaches the end point. From zero to four seconds of animation play, the particle moves along the curve as defined by the linstep function. (See page 249 for details on linstep.) The function arguments and resulting path of the object follow: Y
tan2 = <<0,3,0>>
Expressions
end = <<2,2,0>>
Object’s path
start = <<0,0,0>>
tan1 = <<3,0,0>>
X
Example 2 Suppose you change the third argument of the previous example expression to <<6,0,0>>: dust.position = hermite(<<0,0,0>>,<<2,2,0>>, <<6,0,0>>, <<0,3,0>>, linstep(0,4,time));
Using Maya: Hypergraph, Sets & Expressions
255
Functions Curve functions The slope of the path curve steepens because of the longer tan1 vector: Y
tan2 = <<0,3,0>>
end = <<2,2,0>>
Object’s path X start = <<0,0,0>>
tan1 = <<6,0,0>>
Example 3 The following expression moves dust in an S pattern: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,3,0>>, <<0,3,0>>, linstep(0,4,time)); Y
tan1 = <<0,3,0>>
tan2 = <<0,3,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
The tan1 vector <<0,3,0>> sets the direction of the curve from the start point to a positive Y direction. The tan2 vector <<0,3,0>> sets the direction of the curve to a positive Y direction as it approaches the end point. Values between the start and end point curves are interpolated to form an S pattern.
256
Using Maya: Hypergraph, Sets & Expressions
Functions Curve functions
Example 4 Suppose you change the fourth argument of the previous example expression to <<0,-3,0>>: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,3,0>>, <<0,-3,0>>, linstep(0,4,time));
The dust particle moves in a pattern resembling a half-circle: Y
tan1 = <<0,3,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
Expressions
tan2 = <<0,-3,0>>
The tan1 vector <<0,3,0>> sets the direction of the curve from the start point to a positive Y direction. The tan2 vector <<0,-3,0>> sets the direction of the curve to a negative Y direction as it approaches the end point.
Example 5 Suppose you change the third argument of the preceding example to <<0,10,0>>: dust.position = hermite(<<0,0,0>>,<<2,0,0>>, <<0,10,0>>, <<0,-3,0>>, linstep(0,4,time));
Using Maya: Hypergraph, Sets & Expressions
257
Functions Curve functions
Y tan1 = <<0,10,0>>
X start = <<0,0,0>>
end = <<2,0,0>>
tan2 = <<0,-3,0>>
Because of the longer tan1 vector, the slope of the path curve steepens as it rises from the start point. Because the tan2 vector has a smaller Y magnitude than the Y magnitude of the tan1 vector, the slope of the path curve is flatter as it approaches the end point. The curve’s rise in the Y direction is greater than the previous example because the magnitude of tan1’s Y component is larger (10 instead of 3).
258
Using Maya: Hypergraph, Sets & Expressions
Functions General commands
General commands The following functions do various actions in Maya.
eval Executes a MEL command. string
eval(string command)
command is either a command string enclosed in quote marks or a string variable containing a command. The returned value contains command output returned by the command’s execution.
Example 1 eval("select -cl")
Executes the command select -cl, which deselects all objects in the scene. Though the return value is not used in this example, it contains the command output.
Example 2
The first statement assigns the command string select -cl to the string variable $cmd. The second statement executes the contents of $cmd, which is the command select -cl.
Example 3 string $mycommand = "sphere"; eval($mycommand+"-r 5");
The first statement assigns the string sphere to the variable $mycommand. The second statement appends -r 5 to the string sphere and executes the complete command sphere -r 5. This creates a sphere with a radius of 5 grid units.
Using Maya: Hypergraph, Sets & Expressions
259
Expressions
string $cmd = "select -cl"; eval($cmd);
Functions General commands
Example 4 string $a[]; $a = eval("ls -lights"); print($a);
The first statement defines an array of strings named $a. The second statement executes the MEL command ls -lights, then assigns the command’s output to array $a. The third statement displays the contents of $a to the Script Editor as follows: ambientLightShape1 directionalLightShape1
Note that each line of command output appears on a new line. Each command output line is an array element. Maya formats array output with each array element on a new line.
Example 5 Suppose you’ve created a MEL script file named bunk.mel in your Maya scripts directory and it contains this procedure: global proc string bunk() { string $fog; if (rand(2) < 1) $fog = "particle"; else $fog = "sphere"; return $fog; }
Further suppose you create this expression: string $name = bunk(); eval($name); print($name);
The first expression statement executes the bunk() procedure in the bunk.mel script file. In the bunk procedure, the if-else statement generates a random floating point value between 0 and 2, then compares its value to 1. If the value is less than 1, the statement assigns the MEL command string particle to $fog. If the value is greater than 1, $fog receives the command string sphere.
260
Using Maya: Hypergraph, Sets & Expressions
Functions General commands The procedure finishes executing and passes the value of $fog back to the calling procedure, bunk() in the expression. This assigns the command string to the variable $name. The eval function executes the command string stored in the $name. For example, the statement might execute particle, which creates a particle at the origin of the workspace. The fourth statement displays the contents of $name, for example, particle. The expression executes each frame and creates a new particle or sphere.
print Displays text in the Script Editor. You can use this function to display the contents of attributes and variables. This is helpful for debugging an expression. print(string text) print(vector number) print(float number) print(int number) print(array number)
number is a number without the quote marks. Numerical arguments display as strings. There is no returned value for this function. Note the following display considerations. •
You can format displayed text with standard C language escape characters. For example, you can create a new line with “\n” or a tab character with “\t” in the argument.
•
Displaying a floating point value shows the number with up to 10 digits to the right of the decimal point, for example 0.3333333333.
•
Insignificant 0 digits are truncated from floating point numbers. For example, floating point number 2.0 is displayed as 2.
Using Maya: Hypergraph, Sets & Expressions
261
Expressions
text is either a string enclosed in quote marks or an attribute name or string variable containing text.
Functions General commands •
A vector appears with a space separating components and no double angle brackets. Each vector component has a floating point value with up to 10 digits to the right of the decimal point. For example, a vector <<1.518876356, 0, -1.290387446>> appears in the Script Editor as this: 1.518876356 0 -1.290387446
•
Arrays are formatted with each array element on a new line.
•
You can use the + operator to join two strings in an argument: "text1" + "text2"
This is displayed as: text1text2
•
You can also append a number to a string: "text" + 1
This is displayed as: text1
•
You cannot use the + operator with a string array.
•
If you assign a string to a variable that’s not a string data type, the following text appears if you display the variable: Variable data type
String assignment
Data displayed
float
"3.14"
3.14
int
"3.14"
3
vector
"3.14"
3.14 0 0
float
"pi is 3.14"
0, error message
As shown in the last row of the table, if a variable is assigned a string that starts with a nonnumerical character, Maya converts the string to 0. •
262
For a nonparticle expression consisting of only print statements, Always Evaluate must be on in the Expression Editor for the expression to execute.
Using Maya: Hypergraph, Sets & Expressions
Functions General commands
Examples print(time); print("\n");
The first statement displays the value of time. The second statement displays a new-line character after the value of time, so the time appears on a separate line in the Script Editor. float $f = 3.14159; print($f);
Displays the floating point number 3.14159. string $s = "Hello There"; print($s);
Displays the string Hello There. vector $v; $v = <<1.2,2.3,3.4>>; print($v);
Displays the vector as 1.2 2.3 3.4. string $a[]; $a = eval("ls -lights"); print($a+" are the lights in my scene.\n");
Expressions
The print function causes an error message because you cannot use the + operator with a string array.
system Passes a UNIX command to the shell where you launched Maya. int
system( string command)
command is either a command string enclosed in quote marks or a string variable containing a command. The returned value is the output resulting from the command’s execution.
Example string $cmdout; $cmdout = system("date"); print($cmdout+"\n");
Using Maya: Hypergraph, Sets & Expressions
263
Functions Other functions and commands Executes the UNIX date command, which outputs your workstation’s date and time to the $cmdout variable. The final statement displays the date in the Script Editor.
Other functions and commands In addition to the functions described in this chapter, you might find the following less commonly used functions and administration commands helpful. For details on usage, see the MEL online documentation. General
Math
Curve
String
File
alias
acosh
besselj0
gmatch
fopen
catch
asinh
besselj1
match
fclose
chdir
atanh
besseljn
size
fflush
env
constrainValue
besselyn
strcmp
popen
error
erf
substitute
pclose
exists
erfc
substring
fprint
getenv
expm1
tokenize
frewind
getpid
fmod
tolower
feof
gmatch
gamma
toupper
fgetline
putenv
log1p
pwd
fwrite
source
fread
trace
filetest
warning whatIs
264
fgetword
Using Maya: Hypergraph, Sets & Expressions
Index Symbols
abbreviating attribute names 112, 116 abs function 209 absolute value 209 acceleration 197 acceleration attribute assigning constant value to 156 assigning with runtime expression 155 changing value randomly 156 field’s effect on 175 initialization to zero 177 working with 175 acos function 225, 226 Add Attribute window 50, 120, 169 Add Dynamic Attributes 49, 161 Add Initial State Attribute checkbox 163, 170 adding custom attributes 119, 169 age 197 age of particles at rewind 150 how to examine 150 runtime expression execution and 152 when created with Particle tool 168 alias UNIX command avoiding use with text editor 109 Always Evaluate 130 Always Evaluate checkbox 118 amplitude of sin function 221 angle function 229
angular units conversion of 128 degrees 29, 127 radians 29, 127 arc cosine 225, 226 arc sine 226 arc tangent 227, 228 arguments in functions 205 arithmetic operators 63 array (per particle) attributes 163 assigning to array of different length 172 array functions 236 array indexes invalid assigment to 193 Array option for per particle attributes 170 arrays 93 clearing contents of 236 display format 262 element assignment 95 example initialization and usage 93 exceeding memory capacity of 93 expansion of 93 invalid assignment to indexes 193 obtaining size of 237 sorting 237 asin function 226 assigning to attributes 55 to int or float variables 60 to specific particles 189 to vector attributes 56 to vector components 193, 194 to vector variables 61 vector to three scalar attributes 56 assignment operator 47
Using Maya: Hypergraph, Sets & Expressions
265
Index
! 87 - 63 -- 92 != 65, 66 $ 59, 73 % 63, 182 %= 92 && 67 * 63 *= 92 + 63 ++ 92 += 92 / 63 // 75 /= 92 < 65 << >> 53, 73, 180, 193 <= 65 -= 92 = 47, 55 == 65, 66, 74 > 65 >= 65 ?: 86 \n 261 { } 39, 70, 72, 73 | 140 || 67
A
Index
atan function 227 atan2 function 227 atan2d function 228 atand function 227 attribute names renaming as short names 137 attributeName 197
266
attributes abbreviating names 112, 116 assigning conditionally 32 assigning to 55 assigning to multiple 13, 23 assigning to multiple objects 13, 28 connecting to symbolic placeholders 135 custom 50 data types 51 deleting from expressions 131 disconnecting from expressions 132 displayed in Attributes list 18 displaying contents of 123 displaying disconnected 132 dynamic 49 eliminating expression control of 122 full name 51 initial state 158, 162 linking 11, 15, 26 long names 114 name syntax 47 not selecting for particle shape node 112 particle shape node 159 per object 12, 160 per particle 12, 160 reading in expressions 133 removing from expressions 131 seeing abbreviations of 113, 115 static 49 unexpected values 141 Attributes list 103
Using Maya: Hypergraph, Sets & Expressions
B base number raised to exponent 215 bell curve function 239 betterIllumination 197 blank lines in expressions 74 Booleans 52 handling as floating point 65 symbolic constants 95 braces 72 in statements 39, 40 matching pairs of 73 brackets double angle 53, 73, 180, 193 break instruction 79
C C language escape characters 261 syntax in expressions 75 case sensitivity in variable names 59 castsShadows 201 ceil function 210 centimeters 127 Channel Box displaying attribute values in 30 choice command 132 circular motion of NURBS sphere 119 clamp function 211 clear function 236 clearing an expression 106 array contents 236
Index
conversion of angular units only 128 of data types 143, 144 of user selected units 127 conversion functions 234 converting degrees to radians 129 measurement units 128 statements to comments 131 copying text in expressions 105 cos function 216 comparison with sin function 218 cosd function 218 cosine 216, 217, 218 cosine wave pattern animating a ball 217 count 197 Create button 22 Create Event 184 creating new expressions 111 creation expressions 148 assigning to rgbPP 179 dynamics start frame 149 example assignment to lifespan 165, 167 example assignment to lifespanPP 164 execution for emitted particles 149 how often execution occurs 148 using values in runtime expressions 174 when to use 150 cross function 230 cross product of two vectors 230 curve functions 249
custom attributes 50 adding to an object 119 adding to particle shape node 169 assigning to 169 examples of assignment 171 when to use 118 custom variables 59 declaring 59 using globally 61 cyclical pattern with sin function 220
D data types attribute 53 Boolean 52 conversion during assignment 143, 144 conversion of displayed strings 262 conversion with arithmetic operators 145 data entry limitations 54 float array 52 floating point 52 functions 208 integers 52 matrix 55 vector array 52 debugging expressions with print function 261 decimal deletion in data type conversion 144 decimal precision in display 261 declaring variables 59 default object in Expression Editor 104 making an object the 115 defining variables 26 deg_to_rad function 234
Using Maya: Hypergraph, Sets & Expressions
267
Index
collision example of controlling color resulting from 185 working with particles 183 color Christmas light effect with particles 181 giving object constant color 179 giving particles randomly changing color 180 understanding RGB and HSV 235 working with 178 colorAccum 197 colorBlue 197 colorEditor 235 colorGreen 197 colorRed 197 comments converting statements to 131 in expressions 75 compiling an expression 19, 62, 118 conditional assignment to attributes 32 conditional statements 69 else-if 71 if 34, 69 if-else 70 confining numerical range 211 connectAttr command 135 connecting an attribute 135 Connection Editor 132, 135 conserve 197 constants 62 Boolean 95 continue instruction 80 controlling flow in statements 77
Index
degrees 29 converting to radians 129, 234 deleting attribute names 131 expressions 112, 134 text from expressions 105 depthSort 197 discarded remainders in data type conversions 146 disconnectAttr command 132 disconnecting an attribute 132 displaying attribute contents 123 disconnected attributes 132 text 261 variable contents 123 dnoise function 242 do loop 78 dollar sign ($) in variable names 59, 73 dot function 231 dot product 231 dot product operator 64 double angle brackets 53, 73, 180, 193 dynamic attributes 49 adding to object 49, 50, 161 dynamic per object attribute example assignment to lifespan 167 dynamic per particle attribute example assignment to lifespanPP 164 dynamics changing start frame 149 how often Maya evaluates 149, 152 Dynamics Controller 149, 152 dynamicsWeight 198 dynamicsWeight attribute 178
268
E e raised to power 214 Edit button 22 editing expressions in text field 99, 105 else keyword 38 else-if statements 71 emitted particles age of 149 assigning lifespanPP for 183 creation expression execution and 149 working with 183 English common names for attributes 114 equal to (==) operator 36 errors common expression 95 comparing floats with the == operator 89 from wrong data types in functions 208 in flow control statements 88 logic 95 message format of 95 syntax 36, 73, 95 where they appear 96 eval function 259 event 198 event attribute 184 when collision count increases 187 eventCount 198 eventCount attribute 184 eventTest 198 eventTest attribute 184 examining two or more expressions 106
Using Maya: Hypergraph, Sets & Expressions
executing MEL commands in expressions 137 MEL commands with eval function 259 MEL procedures in expressions 139 nonparticle expressions 118 UNIX commands in expressions 263 execution slow expression 127 exp function 214 exponential functions 214 Expression Editor starting 13
Index
slow execution of 127 speeding execution of 127 text field 14 tutorials 15 type case sensitivity 18 when unusable 12 Expressions list 100, 104
F fading opacity 249, 253 fields influence on expression 175 turning off effect in an expression 178 filtering attributes by connected attribute 104 from Expression Editor 104 filtering expressions 99 finding expressions by connected attribute 101 by expression name 100 by item type 102 by selected object 101 float 52, 57 float arrays data type 52 floating point 52 floor function 210 flow control errors 88 flow control statements 77 for loop 79 for-in loop 81 forward slashes (//) for comments 75 frame 0 reason for using in examples 43 frame playback rate 16, 58 frame variable 57 frequency multiplier of sin function 222
frequency of sin function 222 full attribute name 51 functions 47 arguments in 47, 205, 206 array 236 as expression elements 47 complete list of 203 conversion 234 curve 249 data type of arguments 206 data type of returned values 206 essential for advanced expression writing 206 format of 206 introduction to 203 limit 209 others in online documentation 264 random number 123, 239 spaces in 207 trigonometric 216 understanding book examples 208 vector 229
G gauss function 239 Gaussian distribution 239 General button 49 general commands 259 global procedures declaring 139 global variables 61 declaring 62 initializing 62 goal attribute 161 Goal button 161 goalPP 198 goalPP attribute 161
Using Maya: Hypergraph, Sets & Expressions
Index
expressions advantage of separate 31 advantage of single 31 comments in 75 common errors 95 comparison with MEL scripts 46 compiling 19 copying text 105 creating 13 creating new 111 creation 148 default object 104 deleting 112, 131 deleting text in 105 displaying connected attributes only 104 editing in text field 99 editing with text editor 106 elements of 46, 47 eliminating control of attributes 122 erasing 106 examining two or more 106 execution for nonparticle shapes 118 field’s influence on 175 filtering 99 finding 100, 101, 102 for particles 147 input to 133, 135 keywords 76 names for particle shape node 100 naming conventions 18 output from 134, 136 programming features 75 redundant execution 130, 154 reloading 106 required elements of 48 runtime 148 runtime execution 152 saving to file 107
269
Index
goalWeight 198 gravity field acceleration’s effect on 177
H half-circle creating motion with hermite function 257 hermite function 254 HSV conversion to RGB 235 hsv_to_rgb function 235 hypot function 229
I if statements 32, 34, 69 if-else abbreviation 86 if-else statements 38, 39, 70 incandescence 198 incandescencePP 198 increment operations and unexpected values 142 inheritFactor 198 initial state attributes 158, 162, 163 creation expression execution 150 naming convention 163 saving values for 158 input to expressions 135 integers 52, 57 handling as floating point 65 internal conversion of units 127 isDynamic 198
jot text editor 107
K keyframes eliminating expression to use 122 keywords in expressions 76
L levelOfDetail 199 lifespan 198 lifespan attribute 161 example assignment in creation expression 167 Lifespan button 161 lifespanPP 199 lifespanPP attribute 161, 164 assigning for emitted particles 183 limit functions 209 lineWidth 199 linking attributes 11, 15, 26 linstep function 249 comparison with smoothstep 253 listAttributes MEL command 163 log base 10 214 log function 214 logic errors 95 logical operators 67 && 67 || 67 long attribute names 114 looping errors 88
J joining text in strings 262
270
Using Maya: Hypergraph, Sets & Expressions
M mag function 231 magnitude of a vector 67, 231 mass 199 matrix data type 55 max function 212 maxCount 199 measurement units 127 MEL commands 45, 46 executing with eval function 259 using alone in statements 137 using with eval function 138 using within single quotes 138 MEL procedures using in expressions 138 MEL scripts 46 millimeters 128 min function 212 mixed data types using with arithmetic operators 145 modulus operator (%) 63, 182, 192 risk of using with floats 182 motion creating jittery 175 creating smooth, random 175 multiCount 199 multiRadius 199
N natural logarithm 214 new line characters in print statement 261
Index
noise function 241 returned values with frame argument 242 returned values with time argument 241 normalDir 199 not (!) operator 87 number sequences generating consistently random 125 numeric render type 190
O object names omitting in expressions 115 path of 140 Objects list 103 offset with sin function 222 omitting object names in expressions 115 online function documentation 264 opacity 200 opacity attribute 161 fading over time 249, 253 Opacity button 161 opacityPP 200 opacityPP attribute 161
operators arithmetic 48, 63 assigning values to 36 dot product 64 equal to 36, 65 greater than 65 greater than or equal to 65 less than 35, 65 less than or equal to 65 logical 48, 67 not equal to 65 precedence 68 relational 48, 65 shortcut assignment 91 shortcut increment and decrement 92 order of statements 37 output from expression 134, 136 oversample level 152, 156
P parentheses matching pairs of 73 use in conditionals 68, 73 particle array attributes assigning to different lengths 172 particle attributes list of 196 Particle Collision Events 184 particleId 200 particleId attribute 189
Using Maya: Hypergraph, Sets & Expressions
271
Index
particles age of 150 assigning to specific 189 attribute data types 52 expressions for 147 moving position with hermite function 254 selecting shape node 148 shape node attributes 159 transform node attributes 159 using sphrand to create ellipsoid of 245 working with collisions 183 path names of objects 140 per object attributes 12, 160 keyframing 160 naming conventions 160 scalar option 170 per particle attributes 12, 53, 160 Array option 170 assigning to individual particles 189 how to distinguish 160 naming conventions 160 Perlin noise field 241 playback rate 58 pointSize 200 position 200 position attribute assigning with creation expression 158 assigning with runtime expression 157 field’s effect on 175 working with 175 pow function 215 precedence of operators 68 precision of float display 261 predefined variables 57 frame 57 time 57 primaryVisibility 201
Index
print function 261 programming features 75
R radians 29, 127 angle between two vectors 229 converting to degrees 234 radius 200 radius0 200 radius1 200 radiusPP 200 rand function 140, 243 rand functions 123 random lifespan of particles 165 random number functions 123, 239 random numbers making return values consistent 124 redundant expressions 130 relational operators 65 reloading expressions 106 removing an attribute 131 renaming an object 136 render type numeric 190 rewinding effect on creation expressions 149 unexpected values 141 RGB conversion to HSV 235 rgb_to_hsv function 235 rgbPP 201 rgbPP attribute example use of 179 rotate function 232
272
rotating object around its axis 28 point’s position 232 rounding errors from converting radians to degrees 208 rounding numbers 210 rules of syntax 73 runtime expressions 148, 153 assigning rgbPP in 181 how often execution occurs 148, 152
S saving an expression 107 saving attribute values for initial state 158, 188 Scalar option for per object attributes 170 scale multiplying by percentage 41 slowing increase of 21, 26 Script Editor error display 96 scripting with MEL 45 scripts directory 139 seed function 246 making consistent random values 125 selectedOnly 201 Selection list 103, 104 semicolon terminator 18, 48, 73 Set for All Dynamic 162 Set For Current 150 Set for Current 158, 162, 188 shaded spheres how rendered in examples 154
Using Maya: Hypergraph, Sets & Expressions
short attribute names renaming as long names 137 shortcut operators assignment 91 increment and decrement 92 sign function 212 sin function 219 equation for various uses of 223 sind function 224 sine 219, 224 size function 237 Smooth Shade All 154 smooth shading setting all objects to 16 smoothly increasing opacity 250 smoothstep function 252 comparison with linstep 253 soft body attributes in common with particles 50 spaces in expressions 74 in functions 207 specific particles assigning to 189 speeding expression execution 127, 128 spheres how shaded in examples 154 sphrand function 123, 140, 156, 177, 244 use with random color 181 spriteNum 201 spriteNumPP 201 spriteScaleX 201 spriteScaleXPP 201 spriteScaleY 201 spriteScaleYPP 201 spriteTwist 201 spriteTwistPP 202
Index
sqrt function 215 square root 215 S-shaped cycle sin function and 221 S-shaped motion creating with hermite function 256 standard deviation with Gaussian values 239 starting the Expression Editor 13 statements between { } 70 order of 37 static attributes 49 strings 57, 90 assigning to a vector 91 concatenating with + 90 data type conversion 91, 262 joining 262 syntax rules 90 surfaceShading 202 switch instruction 83 symbolic placeholders 132, 134 syntax errors 36, 73, 95 rules 73 system function 263
T
U unexpected values after incrementing 142 after rewinding 141 in mixed data type division 146 of attributes 141, 143
unit function 233 unit vector 233 units internal conversion of 127, 128 UNIX commands executing from expressions 263 useLifspanPP attribute 161 useLighting 202
V variables 56 as expression element 48 assigning to vector 61 data type of 57 declaring 59 defining 26 displaying contents 123 predefined 57 unexpected values 143 vector functions 229 vectors 57 assigning to component of array attribute 194 assigning to variable 193 component operator 194 data type 52 definition 52 dot product 231 format in print function output 262 formula for magnitude 67, 231 magnitude of 2D 228 random vectors with sphrand 244 velocity 202
Using Maya: Hypergraph, Sets & Expressions
273
Index
tab characters in expressions 74 tailFade 202 tailSize 202 tan function 224 tand function 225 tangent 224, 225 terminator statement 73
text editor changing operation settings 110 quitting 107 selecting 107 selecting default startup 110 using on expression 106 using unlisted 109 valid options 109 threshold 202 time changing 152 default use of seconds 33 definition 57 dividing by 27 multiplying by 27 negative value of 59 predefined variable 19 relationship to frame 59 value at different frames 19 Time Slider setting start and end range 16 timesteps 156 transform nodes not used for particle expressions 151 trigonometric functions 216 trunc function 213 truncating insignificant numbers 213, 261 tutorials for expressions 15
Index
velocity attribute assigning with creation expression 150 assigning with runtime expression 153, 154 field’s effect on 175 working with 175 vi text editor 107 vim text editor 107 visibleInReflections 201 visibleInRefractions 201
W while loop 77 white space in expressions 74 WINEDITOR setting 109, 110
X xemacs text editor 107
274
Using Maya: Hypergraph, Sets & Expressions
Maya F/X
™
Maya F/X adds tightly integrated soft-body dynamics and particle systems to Maya ™ for world class animation and visual effects.
Maya F/X an
ADVANCED MODULE for MAYA the next-generation 3D software for creating high quality character animation & visual effects
Sparks fly as swords cross in battle. A low flying fighter jet causes a wake in the ocean. A character's belly jiggles as he walks. Audiences are not easily fooled. They have an extraordinary knack for noticing effects that don't act naturally. And once this happens, the suspension of disbelief begins to crumble. With Maya F/X, artists can easily turn any geometry into a deformable (soft) body while applying such natural forces as gravity, turbulence, or vortices to govern interaction. Plus, artists can add perfectly integrated 3D particle effects for astonishingly real results.
Responsive Sof t Body Objects A whip strikes its victim. A handkerchief falls gently and settles over a hat. A trampoline bounces and ripples as a gymnast performs. With Maya F/X, flexible objects come alive with controllable and animatable levels of elasticity. Now artists can create characters and objects that behave naturally and interact realistically with their environment.
Melting lantern using soft body lattices and procedural rendering effects.
Integrated 3D Particle Effects Sparks fly from a welding torch, bounce off the floor, and turn a cooler shade of red. Light trails appear as an enthusiastic child waves a sparkler on Halloween night. Smoke billows out from a lamp and turns into a genie.
Explosion particles in this scene actually push rigid body planks outward. The planks themselves
More Tools for
3 D M i n d s
are emitting particle flames.
Maya F/X combines soft body dynamics with particle systems to create stunning atmospheric, explosive, liquid and pyrotechnic effects. Artists can emit particles from, or collide them with, any polygon, NURBS, or lattice object. In addition, chain reactions from particle system collisions can result in secondary particle effects, particle extinction or can trigger any animation procedure. IMAGE CREDITS: Front: C. Ford Back: K. Lombardi, C. Gossett, J. Schleifer, C. Ford and M. Kitchen
T E C H N I C A L Fa c t s & F e a t u r e s ARCHITECTURE
SOFT BODIES
Maya F/X is fully integrated with other Maya features.
Maya F/X lets you create flexible soft body objects
High Performance
mits rapid rendering of many particle effects. • Controls are provided in Maya to limit evaluation of display of certain nodes to speed playback if needed. • Complete simulations can be cached for realtime playback.
HARDWARE PA RT I C L E R E N D E R I N G
Easily simulate smoke, fire, clouds, sparklers, liquid and other classic particle effects
Second generation particle rendering based upon industryleading Dynamation™ software
Fields
Speed
• Apply a variety of fields to soft bodies
• High speed, production quality rendering ®
including gravity, wind, radial, turbulence, drag, vortices and others. • The combination of dynamics with particle motion allows for creation of truly believable atmospheric, explosive and other natural effects.
Flexible Creation
• Many simulations can be viewed in real-time. • Unique hardware rendering technology per-
I N T E G R AT E D PA RT I C L E S YS T E M
• Create soft bodies from many object types including construction curves, regular geometry, and lattices so your models respond as flexible, not rigid objects. • Easy simulation of flexible objects such as flowing capes, waving seaweed, dangling ribbons, or soft organic surfaces.
Emitter Support
Tight Integration
• Point, directional, and surface emitters let you emit particles from NURBS, polygons, lattices - or even emit particles from other particles (including upon particle collision). • Particles can inherit speed from animated deforming surfaces (like shaking rain off an umbrella).
• Achieves the highest level of dynamic effects
Interaction with Rigid Bodies
• Particles can push rigid bodies, such as a plastic ball in a fountain. • Emit particles from a rigid body. • Particle sparks can be triggered from rigid bodies scraping past each other.
Stable, Scaleable Solution
• The underlying dynamics engine produces repeatable and highly stable solutions which do not vibrate at the conclusion of the simulation. • Dynamics engine is able to correctly compute collisions on hundreds of objects, not just a simple bowling ball hitting a bowling pin.
Integration with Animation System
• Apply a variety of forces to soft bodies
Goal Weighting
including gravity, wind, turbulence, drag, vortices and others. The same fields and interaction techniques for controlling particles also work on both soft and rigid body geometry.
gradually take the shape of a Goal Object for effects like ocean mist forming a ghost ship.
Secondary Animation
Collisions
• Collide with any NURBS and polygonal
• Integration with the keyframe animation system allows for creation of secondary animation effects like muscle jiggle from a walk sequence or a floppy hat that responds automatically to head movement.
• Soft bodies can collide with other objects for effects like a soft body handkerchief falling to rest over a crystal ball, or a solid ball bouncing off a soft mattress.
MEL Support
• Soft bodies can have internal springs
MEL Support
with attributes including stiffness, damping, rest length and end weights. Springs interact directly with both dynamic and non-dynamic objects.
Goal Objects
• Soft bodies can deform to gradually achieve the shape of a Goal Object, with goal weighting control.
UNITED STATES FIELD OFFICES Fax: 770.393.2705 Fax: 617.270.0608 Fax: 847.397.6067 Fax: 972.789.2951 Fax: 937.258.7449 Fax: 248.737.3506 Fax: 713.780.9296 Fax: 310.914.1580 Fax: 612.339.5939 Fax: 212.563.9418 Fax: 415.596.7002 Fax: 206.667.9049 Fax: 703.227.8595
objects in the scene. Particles can collide with animating deforming surfaces. • Drive procedural animations such as melting or exploding objects via collision events.
• Extend the particle system to meet
Artisan Support
Tel: 770.393.1881 Tel: 617.270.0606 Tel: 847.397.5280 Tel: 972.789.2950 Tel: 937.258.7441 Tel: 248.737.3500 Tel: 713.780.9292 Tel: 310.914.1566 Tel: 612.339.5820 Tel: 212.268.4900 Tel: 415.596.7000 Tel: 206.287.5600 Tel: 703.631.4800
• Goal weighting lets a particle system
Collision Support
Springs
ATLANTA BOSTON CHICAGO DALLAS DAYTON DETROIT HOUSTON LOS ANGELES MINNEAPOLIS NEW YORK SAN FRANCISCO SEATTLE WASHINGTON
fade, tail size, normal direction plus multicount and multi-radius.
Quality
• Display mode controls include texturing,
line smoothing, geometry masking.
• Supports color accumulation and lighting. • Anti-aliasing with edge-smoothing control. • Motion blur supported using hardware
accumulation buffer.
Sprite Rendering
• Sprite rendering is supported with full
control over sprite number, scale and twist.
• Ideal for animating systems like popping
popcorn or falling snow.
sion-based control over particle attributes, motion and dynamics. Artists can parent emitters to objects which are animated in other ways (motion capture, path etc.).
• Animations from the dynamics system can be manipulated in the Graph Editor just like any other animation parameter. In addition, dynamic motion can be blended with conventionally animated data.
• Use Maya Artisan's natural brush interface to quickly and easily assign dynamics properties such as gravity, particle effects, goal weights, mass etc.
Streaks
• Control over streak rendering such as tail
• Allows either keyframe control or expres-
Fields
• MEL can be used to extend Maya F/X's particle system, or to create complex animations which are impossible to keyframe.
hardware rendered frames.
Motion Blur
using common underlying dynamics engine for richly coordinated rigid body, soft body, and particle simulations.
Intrinsic Motion Curve Support
of particle effects based upon OpenGL .
• Integrated playback utility for review of
production needs using MEL to create libraries of effects. • Many particle attributes including position, velocity, acceleration, lifespan, color, and opacity. • Per-particle expressions are supported, letting you animate any individual particle's attributes; for example, color, opacity, or radius.
I NTER NA TI O NA L F I EL D O F F I C ES AUSTRALIA BELGIUM FRANCE GERMANY HONG KONG ITALY JAPAN LATIN AMERICA MALAYSIA SINGAPORE UNITED KINGDOM
Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel:
61.2.9956.3819 32.9.266.1212 33.1.44.92.81.60 49.89.31.70.20 852.2519.4412 39.39.605.8272 81.3.3470.8282 1.305.919.8200 60.3.209.4703 65.435.0458 44.1494.441.273
Fax: 61.2.9437.6574 Fax: 32.9.266.1210 Fax: 33.1.44.92.81.61 Fax: 49.89.31.70.2199 Fax: 852.2827.4227 Fax: 39.39.605.8281 Fax: 81.3.3470.8288 Fax: 1.305.919.8300 Fax: 60.3.209.4705 Fax: 65.536.8502 Fax: 44.1494.449.289
SOFTWARE PA RT I C L E R E N D E R I N G Film quality rendering for clouds and other visual effects Cloud Rendering
• Cloud rendering controls include
radius, surface shading level, density, and threshold. • Cloud shaders cast shadows and appear in reflections.
Tube Rendering
• Rendering controls include tube radius
for each end of the tube, tail size.
• Simulate hair, grass, or fur. Blobby Rendering
• Simulate liquids or semi-fluid objects with
controls over threshold and radius.
• Use standard shaders with textures, trans-
parency, and reflections.
G L O B A L H E A D Q U A RT E RS 210 King Street East Toronto Ontario Canada M5A 1J7 TOLL FREE: TEL: FAX: E-MAIL: WEB:
800.447.2542 416.362.9181 416.369.6140 [email protected] www.aw.sgi.com
© 1998 Alias|Wavefront, a division of Silicon Graphics Limited, all rights reserved. Alias|Wavefront, Maya, the Maya logo, Tools For 3D Minds, Maya Artisan, Maya F/X and Dynamation are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Silicon Graphics and OpenGL are registered trademarks of Silicon Graphics, Inc. All other trademarks mentioned herein belong to their respective owners.
Assistant Online - Maya/How Tos
Alias|Wavefront / Assistant Online / Maya / How Tos
How-to's are step-by-step tutorials that are designed to help you learn more about Maya. While some lessons let you start from scratch, other lessons may provide a start file for you to begin with. Note - These files may not perform as expected. Always back up your work before using any files downloaded from this website. These how-to's have been updated to work in Maya 2.5. However, unless otherwise noted, they will also work in Maya 2.0. Maya how-to's are available in the following categories: Animation How to Model a Flexo Maya 2.5 Complete How to Build and Animate an Iris Maya 2.5 Complete How to Pick Up an Object Maya 2.5 Complete How to Animate an Accurate Clock Maya 2.5 Complete How to Animate an Extrusion Maya 2.5 Complete How to Animate the Aiming of a Spotlight Maya 2.5 Complete How to Animate a Rolling Cube Maya 2.5 Complete How to Animate with Flow (Object) Maya 2.5 Complete How to Animate with Flow (Curve) Maya 2.5 Complete Character How to Create SoftBodies in Character Maya 1.5 FX Animation How to Blend Facial Poses Maya 2.5 Complete Compositing How to Composite Hardware and Software Rendered Images NEW! How to Composite using zDepth Maps How to change the default event colors How to create a Composer undo How to Extract Images from a Movie How to fake 3D shadows How to Glow Highlights How to layer an unpre-multiplied image How to Manage your macros How to set up Maya renders for Compositing Dynamics - Particle http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/index.html (1 of 3) [3/7/2000 13:35:40]
Maya Fusion Lite Composer 5.0 Composer 5.0 Composer 5.0 Maya Fusion Lite Composer 5.0 Composer 5.0 Composer 5.0 Composer 5.0 Composer 5.0
Assistant Online - Maya/How Tos
How to Create a Ring of Fire Maya 2.5 Complete How to use Particles to Drive Rigid Bodies Maya 2.5 Complete How to Create an Exploding Fireball Maya 2.5 Complete Dynamics - Rigid Body How to Animate a Chain Link Maya 2.5 Complete How to Create a Newton's Pendulum Maya 2.5 Complete Dynamics - Soft Body How to Animate a Melting Object Maya 2.5 Complete How to Create an Inflating Balloon Maya 2.5 Complete How to animate a Gelatin cube Maya 2.5 Complete How to Create a Waving Flag Maya 2.5 Complete How to Create Footprints Maya 2.5 Complete Games - NEW! How to Prelight a Scene Maya 2.5 Builder Maya Fur How to Comb Fur Maya 2.5 Unlimited MEL How to use attrCollection.mel Script Maya 2.5 Unlimited How to use an "relocateTexturesWin" Maya 2 Complete How to use an Assistant Online MEL Maya 2.5 Complete Script Hot to use QTVR.mel Script Maya 2.5 Complete Miscellaneous Learning Maya 2.5 Addendum (PDF 128k) Maya 2.5 Complete Modeling How to Build a Spiral Staircase Maya 2.5 Complete How to Build a Polygonal Gear Maya 2.5 Complete How to Use bevelCaps.mel Script Maya 2.5 Complete How to Use NURBS Booleans Maya 2.5 Unlimited How to Create Square Surfaces Maya 2.5 Unlimited Paint Effects - NEW! How to Create a Tree using PaintFX NEW! Maya 2.5 Complete Rendering How to Make Natural Clouds Maya 2.5 Complete How to Animate Texture Files Maya 2.5 Complete How to Create a Ball Env Reflection Map Maya 2.5 Complete How to Create Camera Cuts Maya 2.5 Complete How to Create a Double-sided shader Maya 2.5 Complete How to Create a Ghost Shader Maya 2.5 Complete How to Create a Light GOBO with Barn Doors Maya 2.5 Complete How to Create a Realistic Sky with EnvSky Maya 2.5 Complete How to Create Realistic Shadows with EnvSky Maya 2.5 Complete How to Create Realistic Glass Maya 2.5 Complete How to Create a Soft Spotlight Maya 2.5 Complete How to Combine Bump and Displacement Maya 2.5 Complete Maps How to Make a Cartoon Shader Maya 2.5 Complete
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/index.html (2 of 3) [3/7/2000 13:35:40]
Assistant Online - Maya/How Tos
How to Make Water Ripple Technical Overview on Aliasing Artifacts Technical Overview of Maya Software Rendering How to Set up Reflections and Refractions How to Share Texture Nodes How-to Set Up Depth of Field
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/index.html (3 of 3) [3/7/2000 13:35:40]
Maya 2.5 Complete Maya 1.5 Base Maya 1.5 Base Maya 2.5 Complete Maya 2.5 Complete Maya 2.5 Complete
Assistant Online - Maya/How Tos/Animation/Flexo
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Flexo
HOW TO MODEL A FLEXO WITH MAYA
[email protected]
by Lluís Llobera Trias - Quod/IDEP Spain Maya Complete Animation This is a tutorial to create and make fully operative, with Maya, a flexo-type arm like those used to hold lights. You will work with expressions, driven keys, pivot position, and Click to view larger version constraints. You will also learn to add attributes and work with the Graph Editor. The point of this exercise is to create a series of arms that rotate properly together when the main arm of the flexo does. Note: throughout the tutorial, you are told how to create a 5-arm flexo; however, all the pictures contained in this document show a 10-arm flexo. In fact, there's no arm limit as long as you follow the method correctly.
STEP ONE In "extensible" arms such as these, you get the same element repeated a number of times. Therefore it is very important that the first arm created has some kind of a solid structure. You are going to create a cylinder grouped twice with itself, positioning the pivot for every node in a proper position.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/index.html (1 of 6) [3/7/2000 13:35:53]
Assistant Online - Maya/How Tos/Animation/Flexo ●
●
Create a NURBS cylinder and name it "c_i", for "inferior constraint". Go to the Channel Box and set its Y scale to 10, and its Z scale to 0.4. Enter "Insert" to edit the Pivot Point position, then go to the Numerical Input Line, which is a white space just above the Channel Box. Enter the values 0 -10 0.
You should see that the pivot has moved at the bottom of the cylinder. Enter "Insert" again to go back to object editing mode. Group the cylinder with itself, and name the new group "c_s", for "superior constraint". Now follow the previous steps to position its pivot point at the top of the cylinder (that's 0 10 0). Group the node c_s with itself, and name the new group "SUP_01". Now you can rotate the node SUP_01 45 degrees in the Z axis. You have successfully created the first arm of the flexo. STEP TWO Enter Edit->Duplicate-> Options and reset the values. Duplicate the node SUP_01 and name its copy INF_01. In the Channel Box, set its Z translation to 1. Now you are going to create an expression to make this new node rotate every time that the superior arm does. Check that INF_01 is still selected, and go to Window->Expression Editor. Name the new expression "inf_rotate", and enter in the expressions area INF_01.rz = 180 - SUP_01.rz ; Click on "Create". From now on, every time that the SUP_01 rotates in the Z axis, the INF_01 will rotate also. Check it if you want. After you have, set the Z rotation for the SUP_01 to 45 again -- the whole exercise will assume this as its value. Since the arms of the flexo are alternated, you will now have to move the pivot points of the c_i and c_s nodes of the SUP_01 and INF_01 arms in an absolute Z translation of 0.5. To achieve this, the easiest procedure is to select each of the sub-nodes, click "Insert" and, in the Numeric Input Line, enter . . 0.5
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/index.html (2 of 6) [3/7/2000 13:35:53]
Assistant Online - Maya/How Tos/Animation/Flexo
You will have to repeat this operation for each of the sub-nodes. STEP THREE Select SUP_01 and INF_01 and then select Edit-> Duplicate-> Options. Set the number of copies to 4 and click on the "Duplicate Input Connections" box. When you click on "Duplicate", Maya will create four new superior cylinders, called SUP_02 to SUP_05, and four inferior cylinders which are named INF_02 to INF_05. Select in the Outliner the nodes SUP_02 and INF_02, and set them to an X translate of 14 units. Pick the next two nodes, move them to 28, and so on. Now look what happens when you rotate the SUP_01 : only the inferior arms rotate with it. This is because only INF_01 had the expression applied, and therefore the superior arms aren't aware of what is going on. STEP FOUR Select the nodes SUP_02 to SUP_05 and (in the Animation menu) select Animate-> Set Driven Key-> Set-> Options. The Set Driven Key window will pop up (from now on, we will call it SDK). In the "Driven" frame you'll see the four nodes you have just selected. In any orthographic window select the SUP_01 and, returning to the SDK, click on "Load Driver" to place it in the "Driver" frame. Click on the "Rotate Z" next to the Driver frame (it'll get dark), and select the four nodes in the Driver. Click on their "Rotate Z". Now click on "Key" to set the first connection. Select the SUP_01 node and set its Z rotation to 60 degrees. After that, select the SUP_02 to SUP_05 nodes and rotate them to 60 in Z as well. In the SDK window, set the second connection by clicking on "Key". Close the SDK.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/index.html (3 of 6) [3/7/2000 13:35:53]
Assistant Online - Maya/How Tos/Animation/Flexo
Look what you have now: the superior arms only seem to work properly when the Z rotation of SUP_01 is between 45 and 60 degrees. Let us fix this. Select the nodes SUP_02 to SUP_05 and go to Window-> Animation Editors-> Graph Editor. Press the "f" key to execute a "frame all"; a blue curve will appear in the right window. Select it (all of it, including its beginning and end) and enter : Curves -> Pre Infinity -> Cycle with Offset Curves -> Post Infinity -> Cycle with Offset Close the Graph Editor. Now all the arms rotate correctly. STEP FIVE Using the Outliner or the Hypergraph, add constraints from certain nodes to the other ones. This is the formula to do it: ● Select the node c_i from SUP_0x, then the node c_s from INF_0(x+1). ● Select Constraints-> Point. You also have to do it the other way around, i.e.: select the node c_i from INF_0x, then the node c_s from SUP_0(x+1) and select Constraints-> Point. For example, the first step is to select c_i from SUP_01 and c_s from INF_02 and constraint them. Then, pick the c_i from INF_01 and the c_s from SUP_02 and constraint them too. Continue until you have no arms left.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/index.html (4 of 6) [3/7/2000 13:35:53]
Assistant Online - Maya/How Tos/Animation/Flexo
STEP SIX You should now have the flexo working correctly. But having to depend on the Z rotation for SUP_01 is time consuming, and inefficient. Now we will create a new node with an attribute to get it to work. ● Select all the nodes (Right Click and "select all" is the easiest way) and group them. ● Name the group "FLEXO". ● Enter "Insert" to edit its pivot point position. ● Go to the Numeric Input Line and enter: . 15 . Select Display-> Objects Components-> Selection Handles. From now on, you'll be able to select the whole object by clicking on this handle. Now select Modify-> Add Attribute. Name the new attribute "Length", enter 0 for its minimum value, 100 for the maximum, and 50 as default value. Select the node SUP_01, and select Animate -> Set Driven Key -> Set -> Options. Load the node FLEXO as the driver. Select the attribute "Length" next to the Driver frame, and the Z rotation from the Driven frame. Press Enter. Set the "Length" Value to 0, and the Z rotation for SUP_01 to 0. Click on "Key". Now set "Length" to 100 and the Z rotation for the SUP_01 to 90. "Key" it again. CONCLUSION Well then you have just finished building the flexo! Now it's up to you to add details, such as the joints (which should be constrained to the nodes c_i from the arms), etc.
Click to view larger version Here's the final file for you to download. You can open it with any version of Maya. flexo.ma (~270k)
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/index.html (5 of 6) [3/7/2000 13:35:53]
Assistant Online - Maya/How Tos/Animation/Flexo Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/index.html (6 of 6) [3/7/2000 13:35:53]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/img/img009b.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flexo/img/img009b.jpg [3/7/2000 13:35:57]
Assistant Online - Maya/How Tos/Animation/Iris
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Iris
HOW TO BUILD AN IRIS
By Alan Harris
Maya Complete Animation In this lesson, you will learn how to build an iris and use Set Driven Key to animate it opening and closing. To achieve this, you will create a locator and add an attribute called Shutter. This Play Movie [321 k] attribute will range from 0 to 10. 10 equals the iris in closed the position. STEP ONE Set the Grid Options to default settings. Create two Nurbs circles at the origin -- one 10 units and the other 5 units. Template them to use as guides. ● Create a closed CV Curve as shown. ● Duplicate the curve and translate in Y to -0.2 ● Select the top curve and select Surfaces > Planar. ● Select the top curve and the bottom curve and select Surfaces > Loft. ● Delete the curves or delete history on the surfaces.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/iris/index.html (1 of 4) [3/7/2000 13:37:58]
Assistant Online - Maya/How Tos/Animation/Iris
STEP TWO You will need to group these surfaces twice to get two different pivot points. One for creating the subsequent shutters and the other for the local rotation. ● Select the two surfaces. ● Select Edit > Group and rename this node localPivot. ● Select the node localPivot, then select Edit > Group again and rename this node centerPivot. This node should be at the origin. You will now change the location of the localPivot. ● Select the localPivot node. ● Press Insert on the keyboard to modify the pivot point. ● In the top view, Move the pivot to the corner of the shutter piece as shown. ● Press Insert again when finished. STEP THREE You will now be duplicating surfaces to create the other pieces. ● Select the centerPivot node. ● Select Edit > Duplicate - Options and set the following: Rotate Y to 30; Translate Y to 0.1; Number of Copies to 11 ● Press Duplicate.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/iris/index.html (2 of 4) [3/7/2000 13:37:58]
Assistant Online - Maya/How Tos/Animation/Iris
STEP FOUR You will be creating a Locator with an attribute called shutter to control the opening and closing of the iris. ● Select Create > Locator. ● Select Modify > Add Attribute... and set the following: Attribute name to shutter; Minimum to 0; Maximum to 10 ● Press OK. STEP FIVE The Locator now needs a connection to the rotation attribute of the local pivot. To achieve this connection, you will use Set Driven Key . ● Select all twelve of the localPivot nodes. ● Select Animate > Set Driven Key > Set - Options. ● With the localPivots selected, press Load Driven. ● Highlight all the localPivots in the left column. ● In the right column of the Driven section, highlight rotate Y. You will now load the Locator as the Driver. ● Select the Locator. ● Press Load Driver. ● Highlight the locator in the left column. ● In the right column of the Driver section, highlight shutter In this next step you will be setting the keys. ● Press Key. This will set a key for the shutter value of 0 when the iris is fully open. ● In the Channel Box, set the shutter value to 10. ● Select all the localPivot nodes. ● Highlight the Rotate Y attribute name in the Channel Box. ● Use the virtual slider with the MMB in the workspace by click- dragging to the left until the iris is closed. ● Press Key. Test the Set Driven Key by selecting the Locator and entering different values or by using the virtual slider.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/iris/index.html (3 of 4) [3/7/2000 13:37:58]
Assistant Online - Maya/How Tos/Animation/Iris
CONCLUSION You should now have the shutter attribute controlling the animation of the iris. Experiment with different curve shapes and amount of shutters. You can also experiment with different translate offsets when duplicating the shutters.
Play Movie [321 k]
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/iris/index.html (4 of 4) [3/7/2000 13:37:58]
Assistant Online - Maya/How Tos/Animation/Pick Up Object
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Pick Up Object
HOW TO PICK UP AN OBJECT
by Robert Magee
Maya Complete Animation In this lesson, you will learn how to make an Inverse Kinematic arm pick up an object and place it on a table. This will involve constraining the IK handle to two Locators then animating the constraint weights to switch the hand between locators.
Play Movie [224 k]
The key to this lesson is that you will animate the object first then constrain the arm to match that movement. This ensures that the object's movement is exactly what you want before you even have to consider the character picking it up. STEP ONE Create a polygonal cube. Scale it to create a tabletop. In the front view, place it on the ground along the X axis. Rename the cube's transform node to table. Create a NURBS cylinder. Scale it so that it is a little taller. Place it on the ground near the origin. This will be the object that will get lifted up onto the table. Rename the cylinder's transform node to glass.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/pickUp/index.html (1 of 6) [3/7/2000 13:38:18]
Assistant Online - Maya/How Tos/Animation/Pick Up Object
STEP TWO In the front view, place three Joints to create a simple arm that will pick up the glass and place it on the table. Add an IK handle that runs from the root joint to the end joint of the skeleton. STEP THREE Create two Locators. Place one to the left of the glass and name it glassLocator. This locator will drive the arm when it is picking up the glass. Place the second locator up above the glass and name it freeLocator. This locator will drive the arm when it is not picking up anything. STEP FOUR In the Hypergraph window, parent the glass node to the glassLocator node. Now any animation you apply to the locator will also affect the cylinder.
STEP FIVE Select the two locators and then the IK handle. Make sure that the IK handle is selected last. Select Constrain -> Point to constrain the handle to both locators at once. It will constrain to a point half way between the two locators.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/pickUp/index.html (2 of 6) [3/7/2000 13:38:18]
Assistant Online - Maya/How Tos/Animation/Pick Up Object
If you Select and Move the freeLocator, you will see that the IK handle updates so that it always places itself halfway between the two locators. Both locators have been constrained using the same weighting, so the IK handle is trying to point at both constraints equally, The result is that the IK Handle is positioned at an equal distance between the two locators. STEP SIX Select the IK handle. In the shapes section of the Channel box, you will find the ikHandle1_pointConstraint1 shape node. It contains two key attributes: ● glassLocatorW0 which is the weighting of the glass locator; and ● freeLocatorW1 which is the weighting of the other locator. Set the glassLocatorW0 attribute to 0. Now the IK handle will move to the freeLocator since it has the strongest weighting. If you Select and Move the freeLocator, you will see that the IK handle now follows this locator entirely, because you have told it not to point at the glassLocator at all. STEP SEVEN You will now animate the glass so that it is positioned exactly where you need it. Create a CV curve from the glassLocator upward to the top of the table. This will be used as a motion path for animating the movement of the glass. You could also simply set keys on the glass, but using a motion path offers another way to animate it.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/pickUp/index.html (3 of 6) [3/7/2000 13:38:18]
Assistant Online - Maya/How Tos/Animation/Pick Up Object
STEP EIGHT Select the glassLocator and then the new curve. Select Animate -> Paths -> Attach to Path - options. Set the Time Range to Start/End then set the Start Time to 20 and the End Time to 50. Make sure that Follow is turned Off. Click Attach. Now the glass will animate along the path between frames 20 and 50. If you don't like how the path is working or if the glass is not sitting on the table properly at frame 50, you can edit the shape of the curve using its CVs. STEP NINE Now you can animate the freeLocator. Use the following positions to key this node: Go to frame 1. Place the freeLocator to the left of the glass. Press Shift w to set keys for the translation attributes. STEP TEN Go to frame 20. Place the freeLocator at the start point of the motion path curve. Again, press Shift w to set keys for the translation attributes.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/pickUp/index.html (4 of 6) [3/7/2000 13:38:18]
Assistant Online - Maya/How Tos/Animation/Pick Up Object
STEP ELEVEN Go to frame 50. Place the freeLocator at the end point of the glass motion path. Set keys for the translation attributes.
STEP TWELVE Go to frame 80. Place the freeLocator at the left of the table in open space. Set keys for the translation attributes. Now if you playback the animation, you will see Play Movie [254 k] that the hand moves up to the table and back but it does not work properly with the glass between frames 20 and 50. STEP THIRTEEN Go to frame 1. Open the Animation Preferences Window. Change the Default Out Tangent to Stepped. This will ensure that the next few keys set on these attributes will jump to a new value at each Play Movie [254 k] keyframe, rather than make a gradual transition between values from one keyframe to the next. Select the IK handle. Highlight the glassLocatorW0 and freeLocatorW1 attributes on the Constraint shape node. With your right mouse button select Key Selected. Go to frame 20. Set glassLocatorW0 to 1 and freeLocatorW1 to 0. Highlight the glassLocatorW0 and freeLocatorW1 attributes on the Constraint shape node. With your right mouse button select Key Selected. This switches the weighting of the http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/pickUp/index.html (5 of 6) [3/7/2000 13:38:18]
Assistant Online - Maya/How Tos/Animation/Pick Up Object
constraints so that the arm is focused on the glassLocator during this time. Go to frame 50. Set glassLocatorW0 to 0 and freeLocatorW1 to 1. Again Key Selected for the two attributes. This will ensure that the hand "lets go" of the glass after frame 50. When you playback the scene this time, you will see that the arm follows the glass between frames 20 and 50. CONCLUSION This animation is the result of constraining the arm to different Locators, then using the constraint weight to switch between them. You could add more objects if you wanted, then animate their weights in a similar manner. In the completed animation shown at the start of this lesson, another related technique was used. An extra joint was added to the skeleton and then the second last joint was orient-constrained to the two locators, so that if the glass to rotated then so would the hand. The weighting of the second constraint was then connected to the weighting of the first constraint so that the animation of the weights could be shared. To see the final scene, download the pickup_final.ma file and load it into Maya. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/pickUp/index.html (6 of 6) [3/7/2000 13:38:18]
Assistant Online - Maya/How Tos/Animation/Accurate Clock
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Accurate Clock
HOW TO ANIMATE AN ACCURATE CLOCK
By Robert Magee
Maya Complete Animation In this lesson, you will learn how to animate the hands of a clock using a series of expressions which reference Maya's internal time variable. You will also use attributes that allow you to set the Play Movie [~576kb] start time in hours, minutes and seconds for the animation. This clock can then be added to any scene and the hands will animate automatically based on the chosen time units. STEP ONE Select Create > NURBS Primitives > Circle. Rotate and Scale the circle to the size that you need and place it on the ground . Select the circle then select Surfaces -> Planar to create a planar trimmed surface for the face of the clock. Delete History on the surface and the original circle curve. Rename the surface as face.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/clock/index.html (1 of 6) [3/7/2000 13:39:09]
Assistant Online - Maya/How Tos/Animation/Accurate Clock
STEP TWO Select Create -> Polygon Primitives -> Plane. Scale and Move the plane to create a marker for the hours. Place it along the Z axis near the top. Move it up a little along the Y axis to raise it from the face of the clock. Delete History on the polygon shape. STEP THREE Select the polygon shape and choose the Rotate tool. Press the Insert key then use grid snap to snap the pivot point back to the origin. Select Edit -> Duplicate options. Set the Y Rotation to 30 and Number of Copies to 11. Press Duplicate. You now have 12 markers for the hours of the clock. You can increase the size of the markers at three, six, nine and twelve o'clock or you can delete the markers at these points and add numbers. STEP FOUR Select Create -> Polygon Primitives -> Cube. Rename the cube as hourHand. Press F8 to go into component mode then reshape the vertices to get the look that you desire. Make sure that the shape is pointing up along the Z axis. Note: By reshaping the hand at the component level, you ensure that the shape's transform pivot remains at the origin. Delete History on the polygon shape.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/clock/index.html (2 of 6) [3/7/2000 13:39:09]
Assistant Online - Maya/How Tos/Animation/Accurate Clock
STEP FIVE Select Edit -> Duplicate options. Press the reset button then press Duplicate. Move the shape up along the Y axis then reshape it using component mode to make this hand longer. Rename the new cube as minuteHand. Repeat these steps to create a third, thinner cube and name it secondHand. STEP SIX Select all of the pieces of your clock then select Edit -> Group. Rename the group node to clock. With the clock node selected, select Modify -> Add Attribute... then add the following three attributes to the clock node: Attribute name: startHour Data Type: Integer Minimum: 0 Maximum: 12 Default: 0 Attribute name: startMinute Data Type: Integer Minimum: 0 Maximum: 60 Default: 0 Attribute name: startSecond Data Type: Integer Minimum: 0 Maximum: 60 Default: 0 These attributes will be used later in the expressions to set up the time at the start of your animation.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/clock/index.html (3 of 6) [3/7/2000 13:39:09]
Assistant Online - Maya/How Tos/Animation/Accurate Clock
STEP SEVEN Select the secondHand polyCube. In the Channel box, click on its rotateY attribute. With your right mouse button select Expressions. This will bring up the Expression editor. Enter the following expression: $direction = -1; $degreePer = 6; $start = clock.startSecond; secondHand.rotateY = $direction * $degreePer * ($start + time);
The $direction variable sets the rotation direction to clockwise. The $degreePer variable sets how many degrees your want the hand to rotate per second. (360 degrees / 60 seconds = 6). The $start variable adds the clock.startSecond attribute to time. The time portion of the expression represents the actual time, measured in seconds. Note: Later you will learn that by measuring time in seconds instead of frames, you can change time units and the clock will still work accurately in your animation. STEP EIGHT Add the following expression to the minuteHand polyCube: $direction = -1; $degreePer = 6; $start = clock.startMinute; $adjust = clock.startSecond; $convert = 60; minuteHand.rotateY = $direction * $degreePer * ($start + (time + $adjust)/$convert);
The $direction variable again sets the rotation direction to clockwise. The $degreePer variable sets how many degrees your want the hand to rotate per minute. (360 degrees / 60 minutes = 6). The $start variable adds the clock.startMinute attribute to time. The time portion of the expression represents the actual time, measured in seconds. In this expression time is advanced using clock.secondStart since the start position of the second hand has an affect on where the minute hand will start. Since time and clock.secondStart are measured in seconds, they must be converted to minutes using the $convert variable which is set to 60.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/clock/index.html (4 of 6) [3/7/2000 13:39:09]
Assistant Online - Maya/How Tos/Animation/Accurate Clock
STEP NINE Add the following expression to the hourHand polyCube: $direction = -1; $degreePer = 30; $start = clock.startHour; $adjust = clock.startMinute; $convert1 = 60; $convert2 = 3600; hourHand.rotateY = $direction * $degreePer * ($start + $adjust/$convert1 + time/$convert2);
The $degreePer variable sets how many degrees your want the hand to rotate over a twelve hour period. (360 degrees / 12 hours = 30). The $start variable adds the clock.hourStart attribute to time. The time portion of the expression represents the actual time, measured in seconds. In this expression time is advanced using clock.startMinute since the start position of the minute hand has an affect on where the hour hand will start. Since time is measured in seconds, it is converted to hours using a value of 60, and since clock.startMinute is measured in minutes, it is converted to hours using a value of 3600. STEP TEN To view time moving accurately, set your time slider range to a value of about 480. Since Maya's default time unit is set to Film which is 24 frames per second, 480 frames should make the second hand on the clock move for 20 seconds. Because this is such a short time, you will barely see the minute and hour hands moving. If you set the frame range much higher than you can scroll to see the minute and hour hand moving. Don't forget that you can select the clock node and set the starting positions for the three hands using the secondStart, minuteStart and hourStart attributes. This way your clock animation could start at any time such as 4:15 and 35 seconds instead of always at midnight. Note: If you open up the General Preferences, you can click on the Animation tab then under Animation Controls you can turn Timecode to On under Options. This will show you time as well as frames.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/clock/index.html (5 of 6) [3/7/2000 13:39:09]
Assistant Online - Maya/How Tos/Animation/Accurate Clock
CONCLUSION You now have a time piece that will work accurately in any animation. Even if you change your time units [In General Preferences -> Units] to another value such as NTSC (30fps), the use of time in the expression ensures that your clock will adjust itself accordingly.
Play Movie [~576kb]
Shift-click to download a completed scene file: clock_final.ma Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/clock/index.html (6 of 6) [3/7/2000 13:39:09]
Assistant Online - Maya/How Tos/Animation/Extrusion
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Extrusion
HOW TO ANIMATE AN EXTRUSION
by Robert Magee
Maya Complete Animation
In this lesson, you will learn how to animate a profile extruding along a curve. This will involve the Extrude tool's partial curve option to generate extra history nodes Play Movie [256 k] called subCurve nodes. These nodes will allow you to then animate the history of the extrusion along the path. STEP ONE Create a primitive circle at the origin. Rotate by 90 degrees around the Z axis. This will act as the profile of the extrusion. Create a NURBS curve that starts at the origin. This will be used as the path of the extrusion. Make sure that the first two CVs lie directly on the X axis. This ensures that this curve is normal to the circle, making the extrusion easier to control. Continue the curve as desired. You may also want to edit some of the CVs to reshape the curve in 3D. Be sure not to edit the first two CVs.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/extrude/index.html (1 of 3) [3/7/2000 13:40:16]
Assistant Online - Maya/How Tos/Animation/Extrusion
STEP TWO Select the circle first and then the path curve. Select Surfaces -> Extrude options. In this window, set the Curve Range to Partial. Click Extrude. This will generate the surface with two extra history nodes. You can see the two nodes in the input section of the channel box. The two subCurve input nodes allow you to only use part of the original profile and path curves in the creation of the surface. One of the subCurves [subCurve1] controls how much of the profile curve is extruded along the path. The other subCurve [subCurve2] controls the length of the extrusion. STEP THREE Click on subCurve2 in the channel box. You can now edit the Max Value attribute in the channel box or you can use the Show Manipulator tool. If you use the Show Manipulator tool, you get two markers for the Min and Max value attributes for the node. By dragging on the Max value manipulator, you can change the position of the extrusion along the path. Note: In the case of this extrusion, the Min value attribute creates unpredictable results. It is recommended that you use the Max value for animating. For other types of surfaces that use subcurve nodes, the Min Value attribute can give more predictable results. STEP FOUR To animate the extrusion, you can now set keys on the Max value attribute. Set the Max value to 0 at frame 1 then set it to 1.0 at frame 50. Playback the scene. You will watch the extrusion animate along the path.
Play Movie [176 k]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/extrude/index.html (2 of 3) [3/7/2000 13:40:16]
Assistant Online - Maya/How Tos/Animation/Extrusion
CONCLUSION The extra history nodes generated by the Partial Curve option make it easy to animate the extrusion of the circle along the path. The manipulation of the subCurve node attributes lets you edit and animate the history of the Play Movie [176 k] shape.The Partial Curve option can be used to add subCurve history nodes to several modeling tools such as loft and revolve. Shown here is a revolved surface animated along its profile curve. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/extrude/index.html (3 of 3) [3/7/2000 13:40:16]
Assistant Online - Maya/How Tos/Animation/Aim Spotlight
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Aim Spotlight
HOW TO ANIMATE THE AIMING OF A SPOTLIGHT Maya Complete Animation
by Robert Magee
In this lesson, you will learn how to animate what a spotlight "looks at" while it animates. When you use the Show Manipulator tool with a selected spotlight, it appears as if you could select and set Play Movie [~544kb] keys on the "look at" point of the light. In fact, this point is not represented by a node and therefore you cannot key it. Instead you will need to apply an Aim Constraint to the light so that it always points at another objects such as a locator. STEP ONE Create a spotlight. Use the Show Manipulator tool to place the eye point of the manipulator in the back corner of the working grid and the look at point near the origin.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/spotlight_aim/index.html (1 of 3) [3/7/2000 13:40:37]
Assistant Online - Maya/How Tos/Animation/Aim Spotlight
STEP TWO Create a Locator. Move the locator to the front of the working grid. This locator will be used as the target for the spotlight
STEP THREE Select the Locator and then the Spotlight. Make sure the light is the last object selected since it will be the aiming object. From the Animation menu set, select Constrain -> Aim - options. Set the aim vector values to 0, 0, -1 then press the Add/Remove button. Since spotlights are created with their local X axis pointing out the back of the light, you needed a value of -1 to aim the light properly. Now the light is aiming at the Locator. You can now use the Locator to animate and control the aiming of the light. STEP FOUR You can now animate the Locator in one of many ways including the following: ● Set keys on the Locator ● Assign the Locator to a motion path ● Parent or point constrain the Locator to an existing character or object CONCLUSION You can now easily control the aiming of your spotlight using the Locator as a target. You could also leave the target stationary and animate the light itself. http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/spotlight_aim/index.html (2 of 3) [3/7/2000 13:40:37]
Assistant Online - Maya/How Tos/Animation/Aim Spotlight
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/spotlight_aim/index.html (3 of 3) [3/7/2000 13:40:37]
Assistant Online - Maya/How Tos/Animation/Rollling Cube
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Rolling Cube
HOW TO ANIMATE A ROLLING CUBE
By Alan Harris
Maya Complete Animation One of the many powerful features of Maya is the ability to animate the location and properties of an object’s pivot point. In this lesson, you will use the animatable properties of a primitive cube’s pivot point to animate it rolling Play Movie [~480kb] on its edges. This process will involve the use of the Channel Control window to make certain attributes keyable. Once they are keyable, they will be available in the Channel Box for you to set keys and edit their value. In this lesson, you will also use the Graph Editor to refine the animation curves to get exactly the kind of motion that you need. STEP ONE Place a primitive poly cube into the scene and scale it to 2, 2 and 2. Select the Move tool. Place the front of the cube at 0 along the Z axis. Press the Insert key to go into edit mode then move the pivot point to the middle of the cube’s front edge. You may want to use grid snapping to help you position the pivot.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/index.html (1 of 4) [3/7/2000 13:41:06]
Assistant Online - Maya/How Tos/Animation/Rollling Cube
STEP TWO Now press the Insert key to return to the Move tool then move the cube to the origin. Select Display -> Object Components -> Local Rotation Axes and Rotate Pivots. These icons will help you visualize these components as you begin animating the pivot. STEP THREE Select Window -> General Editors -> Channel Control and select the following non-keyable attributes: Rotate Pivot Translate X Rotate Pivot Translate Y Rotate Pivot X Rotate Pivot Y
Click to view larger version
Use the Move button to make them keyable attributes. They will now appear in the Channel Box. STEP FOUR With the cube selected, set a linear key for Z rotation at frame 1. Go to frame 10 then Rotate the cube by -90 in Z and set another key. STEP FIVE Return to frame 1. Select the Rotate Pivot Translate X, Rotate Pivot Translate Y, Rotate Pivot X, and Rotate Pivot Y in the Channel Box then use your RMB to choose Key Selected.
Click to view larger version
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/index.html (2 of 4) [3/7/2000 13:41:06]
Assistant Online - Maya/How Tos/Animation/Rollling Cube
STEP SIX Go to frame 10. Open the Attribute editor and open up the Pivots -> World Space section. Set World Rotate X Pivot to 2. You should notice that the pivot moves to the front of the cube. Now you can continue rotating the cube. In the Channel Box, set a key for the Rotate Pivot Translate X, Rotate Pivot Translate Y, Rotate Pivot X, and Rotate Pivot Y channels. Editing the World Rotate Pivot in the Attribute Editor affects these four attributes therefore they must all be keyed. STEP SEVEN Go to frame 20. Set another linear key frame for a Z rotation of -180. Set the World Rotate Pivot to 4 then set keys for the four pivot channels in the Attribute editor. If desired, keep rotating the cube and moving the pivot using the steps outlined above. If you playback the animation at this point, the roll of the cube will not seem correct. You need to change the animation curve tangents for the pivot attributes. STEP EIGHT The incorrect motion is because the pivot point needs to stay in one location for 10 frames then jump to its new location. Open the Graph Editor. Select the four pivot action curves and Click to view larger version then select Tangents -> Stepped. This will create the desired results. Playback the scene.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/index.html (3 of 4) [3/7/2000 13:41:06]
Assistant Online - Maya/How Tos/Animation/Rollling Cube
CONCLUSION Learning how to animate the pivot location on an object demonstrates how there are hidden attributes on your Maya objects that can be used to create interesting results. Since all attributes in Maya can be turned into keyable attributes, the possibilities can enhance how you animate your scenes. If you would like to see this cube animate like gelatin, you may want to complete the How to animate a Gelatin cube lesson. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/index.html (4 of 4) [3/7/2000 13:41:06]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/img/cubeRoll_03_lg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/img/cubeRoll_03_lg.gif [3/7/2000 13:41:12]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/img/cubeRoll_05_lg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/img/cubeRoll_05_lg.gif [3/7/2000 13:41:17]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/img/cubeRoll_08_lg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/cubeRoll/img/cubeRoll_08_lg.gif [3/7/2000 13:41:29]
Assistant Online - Maya/How Tos/Dynamics/Gelatin Cube
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Gelatin Cube
HOW TO ANIMATE A GELATIN CUBE MAYA Soft Body Dynamics The Soft Body dynamics in Maya allow you to give surfaces a more organic quality as they animate. Using the cube from the How to Animate a Rolling cube lesson, you can use Soft Body dynamics to create the rolling Gelatin cube.
by Alan Harris
Play Movie [~480kb]
This process will start with the creation of a Soft Body cube that uses the original cube as a goal. The soft body will therefore follow the first cube while colliding with the ground and jiggling along with a turbulence field that you will add to the scene. Once all the pieces have been connected, you will have your animated dessert. STEP ONE Select the polycube from the How to Animate a Rolling cube lesson. Click on the polyCube Input node in the Channel box then increase the Subdivisions along X, Y and Z to 6. When you create a soft body object for the cube, every vertex on the cube will be matched by a particle on the soft body. If you want more jiggle then you may want to set this value higher than 6.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/gelatinRoll/index.html (1 of 4) [3/7/2000 13:41:56]
Assistant Online - Maya/How Tos/Dynamics/Gelatin Cube
STEP TWO Go to the Dynamics menu set and select Bodies -> Create Soft Body - options, and set the following: ● Create Options to Duplicate, Make Copy Soft; ● Hide Non-Soft Object to On; ● Make Non-Soft a Goal Weight to 0.66. Press Create. Rename copyOfCube1 to Geletan. Rename pCube1 to GeletanGoal. These settings will create a soft body object that uses the original cube as a goal. Each particle will try to match the position of the vertices on the cube with a 0.66 rate of accuracy. This less than perfect accuracy will help create the follow through in the gelatin. STEP THREE Click on the Play button to see the soft body rotate across the screen. Because the soft body has nothing to collide with it seems to float. Now you will create a rigid body floor surface for the soft body to collide with. STEP FOUR Create a poly plane and scale it out. Increase the Uand V patches. Set its Translate Y value to -0.1. This makes sure that the gelatin and the floor are not touching initially. Go to Dynamics -> Bodies -> Create Passive Rigid Body options. Set Particle Collision to On. Click Create. If you playback the scene right now, you won’t see any collisions. This is because the collision of the particles and the floor have not yet been connected.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/gelatinRoll/index.html (2 of 4) [3/7/2000 13:41:56]
Assistant Online - Maya/How Tos/Dynamics/Gelatin Cube
STEP FIVE Select Window -> Animation Editors -> Dynamic Relationlships... In this window, click on the Gelatin surface then set the Modes to Collisions. Click on pPlane1 to connect the collisions of the particles to the soft body particles. When working with particle collisions, you will find that you often have to manually connect the rigid bodies and the particles in this manner. STEP SIX Playback the scene to view the collision of the soft body with the ground. The particles are being pushed back as they collide with the plane. Now you want to add some more motion to the Gelatin surface. STEP SEVEN Select the Gelatin soft body object. Select Fields -> Create Turbulence. In the Channel box, change the Magnitude to 60. This will make the Gelatin jiggle a little more as it moves. Again select the Gelatin soft body. Select Bodies -> Create Springs -> options. Set Creation Methods, to Min/Max, then set the Max Distance to 1.0. Click Create. The springs will help preserve the volume of the soft body as it animates. Springs also provide a sort of internal structure to a soft body as it animates.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/gelatinRoll/index.html (3 of 4) [3/7/2000 13:41:56]
Assistant Online - Maya/How Tos/Dynamics/Gelatin Cube
STEP EIGHT Playback the scene. The Gelatin surface now bounces and jiggles in a recognizable manner. You may want to create a Shading group to give the soft body a semi-transparent Gelatin-like surface then render the scene. CONCLUSION To animate all the jiggling of the resulting Soft Body cube using traditional deformation techniques would have been very difficult. The advantages of using Soft Body dynamics become clear as you see the subtle movement in the surface. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/gelatinRoll/index.html (4 of 4) [3/7/2000 13:41:56]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/gelatinRoll/img/gelatin_lg_05.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/gelatinRoll/img/gelatin_lg_05.gif [3/7/2000 13:42:06]
Assistant Online - Maya/How Tos/Animation/Flow Object
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Flow Object
HOW TO ANIMATE WITH FLOW (OBJECT)
by Alan Opler
MAYA Complete Animation To animate an object along a path you would use Attach to path. To deform the object to the shape of the path curve, you would need to use Flow. In this lesson, you will Play Movie [~576kb] learn how to assign an object to a path using the Flow's Object option. The Object option applies a Lattice to your object that animates along the path with the object. As the Lattice deforms to the path, so does your object. STEP ONE In a Y-up environment, create an object (this lesson uses a fish) so that it’s profile runs along the Y-axis. After building the object, group it to itself twice and name the top node of the hierarchy Fish, and the second node, rotateFish. Next, build a curve that will be used as the path curve.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_object/index.html (1 of 4) [3/7/2000 13:42:15]
Assistant Online - Maya/How Tos/Animation/Flow Object
STEP TWO Select the top node of the fish. Select Display -> Object Components -> Local Rotation Axes. This will display the local axes of the fish. This will help you determine the follow attributes for the fish in the next step. STEP THREE With the fish's top node already selected, press the shift key, then pick the curve. Note: The curve must be chosen last for Attach to Path to work properly. Select Animate -> Paths -> Attach to Path - options. Set Time Range to Start/End. Set the Start and End frames to 1 and 120 (respectively). Set Follow to On. This reveals axis options for the Front and Up axes for the fish. You now need to determine which of the object’s local axes you want to use as the front of the object as it moves down the path. The fish’s head is what will travel down the path first. Since the fish is pointing up along its local Y axis, this will be its Front Axis. You will want the fin on the fish’s back to be on the top. It runs along the local Z Axis. Therefore the Z-Axis will be the Up-Axis for the path. Click on the Attach button. Playback the animation. The fish moves along the path based on the location of its pivot point.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_object/index.html (2 of 4) [3/7/2000 13:42:15]
Assistant Online - Maya/How Tos/Animation/Flow Object
STEP FOUR Now the Flow option will be added to allow the object to deform to the shape of the curve as it moves along the path. Move the Time Slider back to frame 1. Select the top node of the fish. Select Animate -> Paths -> Flow Path Object -> options. Set Lattice Around to Object. Use Divisions of 5, 2, 2. Click on the Flow button. A Lattice is added to the fish. Play back the animation once again. Note - One situation to be aware of, when assigning the Lattice to the object: the Lattice Base may not be an exact fit. This can produce some undesirable effects. If this is the case with your object, simply open the Hypergraph, select the Lattice Base node and scale it up. This permits every part of the fish to fit within the Base when it moving along the path, allowing it to deform properly. STEP FIVE You may find that the deformation is not precise enough. Since the fish is a long narrow object, the number of Divisions can be increased to create smoother deformations along the path curve during the animation. Select the Lattice. In the Channel Box, under the ffd1LatticeShape node, increase the T Divisions value to 10-15. CONCLUSION You now know how to animate an object along a path using Flow to create deformations. Secondary animation can be added to the object even after the Flow option has been applied. At the beginning of this lesson you grouped the fish to itself twice and applied the Motion to the top node. Now, you can select the second node in the hierarchy. You can have the fish rotate as it moves along the path by animating the X rotation channel in the Channel Box. To see how to animate using Flow's Curve option, complete the http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_object/index.html (3 of 4) [3/7/2000 13:42:15]
Assistant Online - Maya/How Tos/Animation/Flow Object
How to animate with Flow (Curve) lesson. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_object/index.html (4 of 4) [3/7/2000 13:42:15]
Assistant Online - Maya/How Tos/Animation/Flow Curve
Alias|Wavefront / Assistant Online / Maya / How Tos / Animation / Flow Curve
HOW TO ANIMATE WITH FLOW (CURVE)
by Alan Opler
MAYA Complete Animation To animate an object along a path you would use Attach to path. To deform the object to the shape of the path curve, you would need to use Flow. In this lesson, you will Play Movie [~576kb] learn how to assign an object to a path using the Flow's Curve option. The curve option applies a Lattice along the complete length of the curve that is deforming. At one point along the curve, you will pinch the lattice points to make the object squeeze through a tight spot. STEP ONE In a Y-up environment, create an object (a fish) so that its profile runs along the Y-axis. After building the object, group it to itself twice and name the top node of the hierarchy Fish, and the second node, rotateFish. Next, build a curve that will be used as the path curve.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_curve/index.html (1 of 4) [3/7/2000 13:42:26]
Assistant Online - Maya/How Tos/Animation/Flow Curve
STEP TWO Select the top node of the fish. Select Display -> Object Components -> Local Rotation Axes. This will display the local axes of the fish. This will help you determine the follow attributes for the fish in the next step. STEP THREE With the fish's top node already selected, press the shift key, then pick the curve. Note: The curve must be chosen last for Attach to Path to work properly. Select Paths -> Attach to Path - options. Set Time Range to Start/End. Set the Start and End frames to 1 and 120 (respectively). Set Follow to On. This reveals axis options for the Front and Up axes for the fish. You now need to determine which of the objects local axes you want to use as the front of the object as it moves down the path. The fish’s head is what will travel down the path first. Since the fish is pointing up along its local Y axis, this will be its Front Axis. You will want the fin on the fish’s back to be on the top. It runs along the local Z Axis. Therefore the Z-Axis will be the Up-Axis for the path. Click on the Attach button. Playback the animation. The fish moves along the path based on the location of its pivot point.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_curve/index.html (2 of 4) [3/7/2000 13:42:26]
Assistant Online - Maya/How Tos/Animation/Flow Curve
STEP FOUR Now the Flow option will be added to allow the object to deform to the shape of the curve as it moves along the path. Move the Time Slider back to frame 1. Select the top node of the fish. Select Animate -> Paths -> Flow Path Object -> options. Set Lattice Around to Curve. Use Divisions of 10, 2, 2. Click on the Flow button. A Lattice is added to the fish that extends for the length of the curve. Play back the animation once again. Note - One situation to be aware of, when assigning the Lattice to the object: the Lattice Base may not be an exact fit. This can produce some undesirable effects. If this is the case with your object, simply open the Hypergraph, select the Lattice Base node and scale it up. This permits every part of the fish to fit within the Base when it moving along the path, allowing it to deform properly. STEP FIVE You may find that the deformation is not precise enough. Since the fish is a long narrow object, the number of Divisions can be increased to create smoother deformations along the path curve during the animation. Select the Lattice. In the Channel Box, under the ffd1LatticeShape node, increase the T Divisions value to 40.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_curve/index.html (3 of 4) [3/7/2000 13:42:26]
Assistant Online - Maya/How Tos/Animation/Flow Curve
STEP SIX By using the Curve option, you can create a keyhole effect by scaling down the Lattice points. Press F8 to go into component mode. Select a group of Lattice Points along the path. Scale them down in all axes. When the fish passes through these points, it will shrink in size to fit through the scaled down section of the Lattice. Note - If you are not getting the proper deformation as your object passes through the scaled down lattice, you may need to increase the number of spans on your object. CONCLUSION You now know how to animate an object along a path using Flow to create deformations. Secondary animation can be added to the object even after the Flow option has been applied. At the beginning of this lesson you grouped the fish to itself twice and applied the Motion to the top node. Now, you can select the second node in the hierarchy. You can have the fish rotate as it moves along the path by animating the X rotation channel in the Channel Box. To see how to animate using Flow's Object option, complete the How to animate with Flow (Object) lesson. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/animation/flow_curve/index.html (4 of 4) [3/7/2000 13:42:26]
Assistant Online - Maya/How Tos/Character/Soft Bodies
Alias|Wavefront / Assistant Online / Maya / How Tos / Character / Soft Bodies
CREATING SOFTBODIES IN CHARACTER ANIMATION MAYA Complete Character
by Tom Kluyskens
This lesson will demonstrate how to use softbodies for character animation purposes. You will also learn to use a lot of other tools and Maya features, too. The purpose of this project is to explore Maya's possibilities to automate subtle secondary skin and body motion on animated characters. We'll also see how to control this motion.
Click to view larger image
Play Movie (2.3Mb)
The three parts of the lesson include: ● SoftBody IK Splines
●
SoftBodies and their goal weight ● Spline IK ● SoftBody Spline How to control the SoftBody Spline
●
Clusters ● BlendShapes ● Collisions and forces SoftBody Skin
●
●
● ●
How to convert The lag problem
Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/index.html (1 of 2) [3/7/2000 13:42:39]
Assistant Online - Maya/How Tos/Character/Soft Bodies
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/index.html (2 of 2) [3/7/2000 13:42:39]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/img/GLKstill1.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/img/GLKstill1.jpg [3/7/2000 13:42:43]
Assistant Online - Maya/How Tos/Character/Soft Bodies
Alias|Wavefront / Assistant Online / Maya / How Tos / Character / Soft Bodies
PART ONE: SoftBody IK Splines MAYA Complete Character
by Tom Kluyskens
The challenge with SoftBodies, and Dynamics in general, is to keep a high level of control over them. Often the Dynamic elements in the scene are totally at mercy of the forces that act on that scene. Particles have a life of their own, which is partly what we want, because they create natural looking motion. The question now is how to keep the SoftBody Particles under control, while keeping their natural motion intact. STEP ONE ●
Click on softanimTut.zip (NT), or softanimTut.tar (IRIX) to get the scenes for the whole tutorial. or
Click on AWIC1.mb to get the scene for this part only
Play Movie (188k) Select GLK's body, and select Bodies -> Create Soft Body (option box). Press Reset, enable Goal Weight (0.5), disable Hide Original Geometry and press Create. This function creates a duplicate geometry, and converts that duplicate to a SoftBody, which is attracted to the original geometry. A SoftBody is a piece of geometry in which the CVs are replaced by Particles, which are dynamic objects influenced by forces like gravity, wind and inertia. The original geometry and its CVs are the Target Geometry of the SoftBody and its particles. Each particle is attracted to the http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_1.html (1 of 4) [3/7/2000 13:43:37]
Assistant Online - Maya/How Tos/Character/Soft Bodies
corresponding CV of the original object. You can easily check this by transforming (moving, deforming,...) the original geometry, and hitting play. Try also to animate the original geometry. Modify the goal weight and conserve attributes of the SoftBody to see the effect those parameters have. Conserve is the degree to which the SoftBody Particles keep their speed (their inertia). You will notice that a goal weight of 1 makes the SoftBody follow the original without lag, while a goal weight of 0 makes the particles really lazy... STEP TWO How to make the head softer than the rest of the body : Set the goal weight to 1. Hide the original geometry. Select the particles of the head. You can select particles by pressing F8, and setting the selection mask to particles only.
Play Movie (640k)
Open the Attribute editor, then do goalPP (with RMB) -> Component Editor. Set Component Value on .5, and Set Attribute. Hit play. Now the head lags behind, while the body sticks to the original object. STEP THREE Download AWIC1end.mb to get the finalized scene for this part. Now set the goal weight on .5 and hit play. Now the head and the body lag again, but the head more than the body.
Play Movie (620k)
Note: The softBody goal weight is actually a multiplication factor to the individual particle goal weights. In the above example, the resulting goal weight of the body is 1 * .5, and that of the head .5 * .5 = .25 .
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_1.html (2 of 4) [3/7/2000 13:43:37]
Assistant Online - Maya/How Tos/Character/Soft Bodies
STEP FOUR Download AWIC2.mb to get the scene for this part This GLK model is already entirely skinned, and has handles on the hands and elbows. The handles are grouped to a neck bone, so the arms follow the deformations of the spine. The eye is parented to a head bone. ● Select Shading -> Shade Options -> X-Ray mode. ● Select Skeletons -> IK Spline Handle Tool. ● Press Reset Tool, disable Auto Simplify Curve and Auto Parent Curve. Click on the root joint, then on a neck joint. The Spline curve is created through all the bones. Simplifying the curve with the Auto Simplify option reduces the amount of CVs to the number indicated, but may move your joints at creation. Moving the curve, will now move all the joints connected to it. Because (in this example) the curve also controls the root joint, moving the curve will move the whole body with it. That's also the reason why we did not use the Auto Parent Curve. Deforming the curve will now deform the spine. Try moving some CVs of the curve. We will see more ways to deform and control the spine curve later on. Select the Spline IK Handle, and try out some parameters, like Offset Roll and Twist. All these parameters can have their use in an animation, but especially Twist is a 'natural' deformation of the spine, and very useful in animation. You can set the type of twist in the Attribute Editor. Watch how arms and eye rotate with the body. Also watch how the head follows the motion of the neck joint at the end of the spine curve. STEP FIVE Download AWIC3.mb to get the scene for this part . The translation of the spline curve has been animated in this scene. This also animates the global body movement, because the root joint is controlled by the spline curve. Now, we want to combine both tools explained above : Spline IK and SoftBodies:
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_1.html (3 of 4) [3/7/2000 13:43:37]
Assistant Online - Maya/How Tos/Character/Soft Bodies
Using the same SoftBody options as above, convert the spline curve to a SoftBody. The joints are now controlled by the SoftBody curve ('SoftBody Spline'), which is in turn attracted to (and thus controlled by) the original, still animated spline curve. Play and watch how the whole body lags behind the original spline curve, and 'wobbles' around it. It is now possible to set the individual particle goal weights to make some parts of the spine 'looser' than others. Typically, leave the base particles on weight 1, so they follow the root joint perfectly, and lower the upper goal weights : the closer to the head, the lower the goal weight (to a minimum of .4 or so). Download AWIC3end.mb to get the finalized scene for this part To learn how to control the SoftBody spline, continue to Part 2 Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_1.html (4 of 4) [3/7/2000 13:43:37]
Assistant Online - Maya/How Tos/Character/Soft Bodies
Alias|Wavefront / Assistant Online / Maya / How Tos / Character / Soft Bodies
PART TWO: How to Control the SoftBody Spline MAYA Complete Character
by Tom Kluyskens
Goal Weight is a first level control over these particles, which we discussed earlier. Three second-level techniques will be discussed here ● Clusters ● Blend Shapes ● Forces and Collisions The latter technique acts directly on the particles, while the two first methods act on the SoftBody's original target geometry. STEP ONE Download AWIC4.mb to get the scene for this part Toggle Show -> Joints and Surfaces OFF, so that you can concentrate on the spline. The curve you see is the original curve, not the SoftBody curve. Go into Component Mode (F8), and select a CV of the spline curve. Then select Deformations ->Cluster. A cluster is created on the CV of the curve. Do the same on all CVs. You can take groups of CVs, if you don't want as much control clusters as there are CVs. Move one or more clusters, hit play, and watch the body update as the SoftBody and skeleton take the form of the deformed spline curve. The clusters can be animated, and offer a much easier control than through the CVs themselves. Download AWIC4end.mb to get the finalized scene for this part.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_2.html (1 of 5) [3/7/2000 13:49:12]
Assistant Online - Maya/How Tos/Character/Soft Bodies
STEP TWO Select the spline curve, then select Edit -> Duplicate -> Reset and Duplicate. Move the duplicated curve away from the body. Select the duplicated curve and the spline curve, and select Deformations -> Blend Shape -> Reset and Create. This duplicated curve is now a target to the spline curve (which is in turn a target to the SoftBody Spline). This technique makes sense only if you deform the duplicated curve. If you select Window -> Animation Editors -> Blend Shapes, you will see a slider controlling the degree to which the spline blends into the duplicated curve. You can also control this attribute in the Channel Box when the spline curve is selected. Animate this blend value to convey the deformation to the actual spine and body of GLK. STEP THREE Download AWIC4endB.mb You can 'cascade' these blenders to have a whole database of spine positions, like can be seen in this finalized file. In this file, select the black cross behind GLK. This will pop up the custom controls in the Channel Box ● Main Body Blend ● F, B, L, R Bow ● Custom Spine. On the far left of GLK you can see the five first-level target curves for GLK's spine : F, B, L and R, and a fifth custom' curve which you can freely deform to put the spine in positions that cannot be achieved using a combination of F, B, L or R. These five curves serve as targets for the one curve right to them. In its turn, this curve is a target to the actual spine of GLK. It's a visual aid, because the actual spine curve is hidden in GLK's body. The Main Body Blend controls the blend factor between these two curves.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_2.html (2 of 5) [3/7/2000 13:49:12]
Assistant Online - Maya/How Tos/Character/Soft Bodies
STEP FOUR Download AWIC5.mb to get the scene for this part This scene contains a further developed GLK, with SoftBody Splines in his 'legs', too. It also contains objects (floor, ball) which will control GLK's body through collision with the SoftBody Particles on the splines. Hit play to get an idea of the motion. Hide the skeleton, by selecting Show -> Joints, and go into X-Ray mode. You should now see some blown-up square particles (of the SoftBody Splines) along the 'legs' and spine. We want to make those particles collide with objects of GLK's environment. First, make the plane a collision object. Select it, and then select Particles -> Add Collisions, with Resilience on 0 and Friction .5. Resilience is the normal velocity change of a particle bouncing on the surface, Friction is the velocity reduction factor tangent to the surface. ● In the Outliner, select RMB -> Show Shapes, and open up the sphere geometry. You will find a cube parented to it. ● Select Particles -> Add Collisions, with Resilience on 0 and Friction .5 . We will use that cube (which is slightly bigger than the sphere) as actual collision object for the sphere, so that at collision with the neck particles, the ball doesn't penetrate the neck geometry. STEP FIVE Download AWIC5end.mb to get the finalized scene for this part Now we still have to tell Maya which particles are going to collide with which objects. That's exactly the functionality of the Window -> Animation Editors -> Dynamic Relationships panel. In the panel's left side, open the all_SoftSplines transform, and select the body_Spline. Check Collisions on at the right side. You should see the planet and the cube geometry. Click on the cube only to enable collision, as we won't collide the spine with the planet floor. Do the same for the Foot and tail splines, but this time connect them to the planet, not to the sphere. The message is to avoid enabling unneeded collisions, because they will slow down the scene playback and rendering. Playback, and see how the collisions affect GLK's body geometry in a natural way.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_2.html (3 of 5) [3/7/2000 13:49:12]
Assistant Online - Maya/How Tos/Character/Soft Bodies
STEP SIX Download AWIC5endB.mb to get the finalized scene for this part Play this file until frame 60 or so, delete the ball, select all_HardSplines in the Outliner, and remove the animation on it. Select the Rotate channels in the Channel Box, and then ● select RMB -> Break Connections. ● And then Settings -> Initial State -> Set for all Dynamic. This will freeze the particles in their current position. You can now rewind. Select the little black cross behind GLK. Custom added attributes will appear in the Channel Box. ● The Stiffness attributes control the Goal Weights of the spine and 'feet' of the SoftBody Splines ● The Twist controls the spine's twisting motion ● The Gravity Pull is connected to the Magnitude of a previously created Gravity Field.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_2.html (4 of 5) [3/7/2000 13:49:12]
Assistant Online - Maya/How Tos/Character/Soft Bodies
This gravity force is connected to the 'feet' of GLK. Set the Gravity Pull to 200, and play. See how the lifted feet come down a little, because of the gravity pulling on them. The resulting position is an equilibrium between two forces: gravity, and goal weight. Lower the Feet Stiffness (the goal weight of the feet particles), and the feet will come down even more. Try connecting the gravity to the spine particles too, to see the effect. To learn about the SoftBody Skin, continue to Part 3 Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_2.html (5 of 5) [3/7/2000 13:49:12]
Assistant Online - Maya/How Tos/Character/Soft Bodies
Alias|Wavefront / Assistant Online / Maya / How Tos / Character / Soft Bodies
PART THREE: SoftBody Skin MAYA Complete Character
by Tom Kluyskens
The above techniques never converted actual skin to SoftBody, but rather were a SoftBody conversion of underlying curves, with relatively very few CVs or vertices. This makes the dynamic SoftBody simulation and playback relatively faster. In some situations however, effects can only be achieved by converting the skin itself, or a part of it, to a SoftBody. STEP ONE Download AWIC6.mb to get the scene for this part. In this scene, the eye is a particle collision object. Play to see the animation. ● Select GLK's skin, and make it a SoftBody with goal weight .5, hiding the original target geometry. ● In the Dynamic Relationship panel, connect the SoftBody particles to the eye collision object. Play it to see the effect (it may be slow). Animate the spine curve to see the effect of the whole SoftBody on GLK's body motion. Again, you can edit the individual particle goal weights (manually or with Artisan) to stiffen or loosen parts of the body skin. Adding Springs to the SoftBody may make the effect even more realistic and interesting (but slower). Download AWIC6end.mb to get the finalized scene for this part . http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_3.html (1 of 2) [3/7/2000 13:59:35]
Assistant Online - Maya/How Tos/Character/Soft Bodies
STEP TWO Download AWIC7.mb to get the scene for this part. This file contains GLK with a combination of both above techniques : a SoftBody Spline, and a SoftBody skin. Look how the skin 'lags' one frame behind, even when both goal weights are 1. That is because the SoftBody skin is controlled by a SoftBody spline. The dynamics solver calculates only one layer of SoftBody animation per frame. You will notice the same problem in the final file, too, where a layered SoftBody Spline was used for the head. In some situations (where the animation is too fast, for example), layered softbodies will become unusable. A workaround is to bake the first layer of Softbodies with the bakeSoft.mel script. This seems to be solved in Maya 2.0 CONCLUSION Download AWICfinal.mb to get the finalized scene with animation and shading. Click here for the final animation. (shift-click to save it on disk)
Play Movie (2.3 Mb) Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/part_3.html (2 of 2) [3/7/2000 13:59:35]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/img/GLKstill4.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/character/soft_body/img/GLKstill4.jpg (1 of 2) [3/7/2000 13:59:44]
Assistant Online - Maya/How Tos/Dynamics/Balloon
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Balloon
HOW TO CREATE AN INFLATING BALLOON
by Bob Gundu
MAYA Complete Particle Dynamics In this lesson, you will learn how to use particle dynamics and lattice deformers to animate a balloon being inflated. This will be accomplished by converting a lattice into a soft body and emitting it from a particle emitter.
Play Movie [~189kb]
STEP ONE Create a profile curve for the balloon off the Y-axis. Revolve the curve to create the surface.
STEP TWO With the balloon selected, select Deform -> Create Lattice -> Options. Set the Divisions to the following: S = 3, T = 3, U=3 Set Grouping to on. Press Create.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/balloon/ (1 of 5) [3/7/2000 14:25:08]
Assistant Online - Maya/How Tos/Dynamics/Balloon
STEP THREE You will now make the lattice a soft body. ● Select ffd1Lattice. ● Select Bodies -> Create Soft Body -Options, and set the following: Hide Non-Soft Object to On Make Non-Soft a Goal to On Weight to .6 ● Press Create. ● Open the Attribute Editor for ffd1LatticeParticleShape and expand the Soft Body Attributes section. Set Enforce Count from History to Off. STEP FOUR The particles are emitted in a systematic order corresponding to the numbering of the lattice points or CV's. The current orientation of the lattice will result in the balloon being inflated from left to right. You would rather have it inflate from the bottom to top. It is for this reason you will rotate the lattice 90° around the X-axis. ● Select ffd1Base, copyOfffd1Lattice, ffd1Base1, and fd1Lattice. ● Rotate X to 90 degrees. Ensure the balloon is fully enclosed within the lattice. Scale the selected nodes if needed.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/balloon/ (2 of 5) [3/7/2000 14:25:08]
Assistant Online - Maya/How Tos/Dynamics/Balloon
STEP FIVE You are now going to create an emitter and connect it to the soft body. ● Select Particles -> Create Emitter. ● Move the emitter to the base of the balloon. ● In the Outliner delete the particle shape node that is created by default with the emitter. ● Open the Dynamic Relationships editor and set Modes to Emitters. ● Select ffd1LatticeParticle and connect it to emitter1. STEP SIX ●
●
●
●
●
Select the ffd1LatticeParticle. In the Attribute Editor, add a Per Object Lifespan attribute. Select the emitter and set the Rate to 0. Set the Playback Range to 70 and play the animation until the balloon disappears. Select Solvers -> Initial State -> Set For All Dynamic.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/balloon/ (3 of 5) [3/7/2000 14:25:08]
Assistant Online - Maya/How Tos/Dynamics/Balloon
STEP SEVEN ●
●
Set the emitter Rate to 100 and the ffd1LatticeParticle Lifespan to 5. Go back to frame 1 and playback the animation.
CONCLUSION You now have a balloon being inflated from a point. The main concept here is that when an object is converted to a soft body, the CV's or lattice points are converted to particles, and therefore are able to be emitted from a particle emitter. Tips: ●
●
●
●
Increasing the density of the lattice requires a higher emitter rate. Decreasing the Goal Weight will require a smaller emitter rate You can emit the same object from more than one emitter. You can attach several deformers to the same object.
Quick Clips: Two Lattices [~158k] An example of using two lattices on the same object. Simply select half the CV's on the balloon and apply the lattice. Do the same for the other half and rotate direction of lattice. Two Emitters [~158k] This example uses two emitters to emit geometry. One is placed at the bottom and the other in the center of the balloon. Experiment with having different emitter rates for each emitter. Emitting Geometry [~158k] This example is shows geometry instead of a lattice being emitted. Experiment with changing the surface direction of the object for different effects. Default Lattice [~158k] This is to demonstrate the order of emission of the lattice points when using default position of the lattice. For clarity, the lattice is much denser than in the tutorial. In the tutorial the lattice was rotated 90 degrees to emit from the bottom up. balloon.ma [~68k] This is the final project file you may download for comparison.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/balloon/ (4 of 5) [3/7/2000 14:25:08]
Assistant Online - Maya/How Tos/Dynamics/Balloon Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/balloon/ (5 of 5) [3/7/2000 14:25:08]
Assistant Online - Maya/How Tos/Dynamics/Chain Link
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Chain Link
HOW TO ANIMATE A CHAIN LINK
By Robert Magee
MAYA Complete Rigid Body Dynamics In this lesson, you will learn how to use Rigid Dynamics to animate a chain of links. To animate the chain link, you will use a nail constrain and a gravity field.
Play Movie [~704 Kb]
STEP ONE Create a polygonal Torus primitive. Edit the polyTorus input node in the channel box. Be sure to set the Subdivisions so that the Subdivisions in the X direction are about 40 and in the Y direction 15. Scale XYZ to 2, and the Section Radius to 0.1. STEP TWO Make five duplicates of the link. Move and Rotate the links to form a chain. Move all of the links so that the edge of the first link is at the origin.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/chain_link/ (1 of 2) [3/7/2000 14:25:38]
Assistant Online - Maya/How Tos/Dynamics/Chain Link
STEP THREE Select all of the chains then select Fields -> Create Gravity. This turns all the links into rigid bodies and connects them to a gravity field. Next select the first link then select Bodies -> Create Constraint. This places a nail dynamics constraint at the origin. STEP FOUR Set your playback range to 300 frames then play back the simulation.
Play Movie [~704 Kb] CONCLUSION This was a very simple example of how to use rigid body dynamics. If the objects had been more complex, these high resolution links could be parented to new low resolutions links. These low resolution models would be used in the dynamic simulation to increase interactive performance. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/chain_link/ (2 of 2) [3/7/2000 14:25:38]
Assistant Online - Maya/How Tos/Dynamics/Ring of Fire
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Ring of Fire
by Paul Anand
HOW TO CREATE A RING OF FIRE MAYA Complete Particles This lesson teaches you how to create a ring of fire using a particle runtime expression. This expression, combined with some keyframes, will help define the emission of the particles into a ring shape.
Play movie [~483kb]
At the end of the lesson, you will apply a particle cloud shading group to define the look of the ring. STEP ONE Select Particles -> Create Emitter. In either the Attribute editor or the Channel box, change the Emitter Type to Omni. Playback the simulation then stop after a few frames. Select the particles. Select Window -> Attribute Editor. In the Per Particle (Array) Attributes section, click on the velocity field with your right mouse button. Choose RunTime Expression from the pop-up menu. Enter the following in the expression box: /* Put Velocity before manipulation in $getVel */ vector $getVel = velocity; /* Zero out the Y velocity and put the resulting Vector in $newVel */ vector $newVel = <<$getVel.x,0,$getVel.z>>;
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireRing/ (1 of 3) [3/7/2000 14:25:45]
Assistant Online - Maya/How Tos/Dynamics/Ring of Fire
/* Get the magnitude of the original velocity */ float $initMag = mag($getVel); /* Get the magnitude of the new velocity */ float $aftMag = mag($newVel); /* Set the new velocity to have same magnitude as original */ $newVel = ($newVel / $aftMag) * $initMag; /* Apply our new velocity to the particles */ velocity = $newVel;
Click Create. Playback to see the results. The particles are emitted along the X and Z axes but not along Y. STEP TWO You will now set keys on the rate of emission to form the inner and outer surface of the ring. Go to frame 1. Select the Emitter. In the Channel box, set the Speed to 2 and the Rate to 1000. Now select the Rate attribute then click with your right mouse button and select Key Selected. Go to frame 30. Set the Rate to 100. Set another key. Go to frame 31. Set the Rate to 0. Set another key. Playback the results. Now the emission is defined by the keys and the particles form a ring. STEP THREE Now that you have the motion, you can set the render type. You will use a pre-built particle cloud shading network to create the effect. Shift-click to download FireCloud.ma into your current project's Textures directory, or use the 'Show Me' button on the FireCloud shader page. Select the particles. In the Attribute editor, go to the Render Attributes section and change the Render Type to Cloud. Select File -> Import and load the file called FireCloud.ma. http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireRing/ (2 of 3) [3/7/2000 14:25:45]
Assistant Online - Maya/How Tos/Dynamics/Ring of Fire
Open the Hypershade. With the particles selected, select FireCloud.ma in the Hypershade with the Right Mouse Button select Assign Material to Selection. STEP FOUR Add a light to the scene to illuminate the particles. You can now add other objects to the scene such as the water surface shown here. Use the batch render to render the scene with Animation set to On.
Play movie [~483kb]
CONCLUSION Particle runtime expressions let you control various particle attributes to help you control their emission. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireRing/ (3 of 3) [3/7/2000 14:25:45]
Assistant Online - Maya/How Tos/Dynamics/Fireball
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Fireball
HOW TO CREATE AN EXPLODING FIREBALL by Chris Ford MAYA Complete Particles This lesson teaches you how to create the fireball from an explosion. The lesson also talks about techniques for the Hardware and Software rendering of fire effects. You will start by generating all the Play Hardware movie [~240kb] particles used in the Play Software movie [~240kb] explosion in the first 30 frames of the animation. These particles will be exploded at high speed into the surrounding atmosphere, which you will simulate using a Drag field. A Turbulence field is used to create eddies and swirls in the expanding fireball, and a reversed Gravity field is used to give the explosion particles buoyancy. To complete this lesson, you should be familiar with the Hardware Render buffer, and basic Software particle rendering. STEP ONE Select Particles -> Create Emitter. In either the Attribute editor or the Channel box, change the Emitter Type to Omni and the Speed to 25. Playback the simulation then stop after a few frames. Select the particles. In the Attribute editor, change the Render Type to MultiStreak. Again playback the scene. You now have a few particles emitting at a constant rate. You want the particles to explode
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireball/ (1 of 6) [3/7/2000 14:25:57]
Assistant Online - Maya/How Tos/Dynamics/Fireball
then fade. You will need to animate the emitter's Rate attribute. STEP TWO Make your playback range go from frame 1 to frame 50 Select the emiitter. Go to frame 1. Set the Rate to 0 and select Key selected from the Channel box menu. Go to frame 30 and set a second key. Go to frame 3. Set the Rate to a high value such as 10000 and select Key selected from the Channel box menu. Playback the scene. The particles are now exploding but they are not reacting in a natural manner. You now need to add some fields to give the explosion a more complex motion. STEP THREE Select the particles then select Fields -> Create Turbulence. This will shake up the particles as they emit. Set the field's Magnitude to 100, Frequency to 100, and Attenuation to 0. Again, select the particles then select Fields -> Create Drag. Set the drag's Magnitude to 5 and Use Max Distance to Off. The drag will be used to simulate the reaction of the explosion to the atmosphere. Again, select the particles then select Fields -> Create Gravity. Set the Magnitude to 20 and the Direction to 0,1,0. This field is aiming away from the ground so that it will pull the particles up in a gaseous manner. Playback the scene. The motion of the particles is more interesting but they need some color. Over the next few steps, you will apply lifespan, opacity, and color attributes to the explosion particles, and take a look at them animating with Hardware shading turned on. Tip: By making sure that the particles are selected when you create a field, they will be automatically connected to the field. Tip: When creating Fields, always assume that the Attenuation attribute should be 0. http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireball/ (2 of 6) [3/7/2000 14:25:57]
Assistant Online - Maya/How Tos/Dynamics/Fireball
STEP FOUR Select particles and open the Attribute Editor. Go to the Add Dynamic Attributes tab, and click on Lifespan, Opacity and Color. Choose Add PerParticle attributes for all of the options. Click with your RMB on the lifespanPP field, and select Runtime Expression.... This will open the expression editor where you will the following expression: particleShape1.lifespanPP = rand(.5,4);
This expression makes the particles disappear or "die" at different rates by randomly assigning each particle a lifespan somewhere between .5 (min. value) and 4 (max. value). Playback the simulation. If the particles die too soon, click with your RMB on the lifespanPP field and select Runtime Expression.... Adjust the expression's min. and max. values to set the desired range for how long the particles will "live" before they "die". Click the Edit button, then click the Close button and playback the results. STEP FIVE Click with your RMB on the rgbPP field, and select Create Ramp. Edit Ramp with three colors: a flame yellow, flame Red, and Black. Click with your RMB on the OpacityPP field, and select Create Ramp. Press 6 on the keyboard to hardware shade the particles, and Playback. Now you see the particles start out yellow then turn red and black. You can edit the parts of the ramp to control when the different colors kick in. If you are happy with the motion and the look of the particles, you can now choose to complete the rendering as a hardware rendering or use software rendering. Both options are outlined below:
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireball/ (3 of 6) [3/7/2000 14:25:57]
Assistant Online - Maya/How Tos/Dynamics/Fireball
Hardware render The hardware render buffer can be used to render out your explosion using the following steps: ● In the Attribute Editor, in the Render Attributes section, set the Depth Sort to On. ● Click on Add Attributes for: Current Render Type. This adds new attributes to the particle. ● Increase the Line Width to 2, Multi Count to 25, and Multi Radius to 0.75.
Play Hardware movie [~240kb]
Select Window -> Rendering Editors -> Hardware Render Buffer to test a sequence. Use a Multi Pass Rendering setting of 5 to get a softer effect. Use the Hardware render Buffer flipbooks to preview the dynamics of the scene. You can now composite the explosion into other scenes using a compositing package like Maya Composer or Maya Fusion. Tip: Do not use any Color Accumulation, since this attribute tends to burn out the center of an explosion effect.
Software render You can generate very realistic rendered fireballs with software particle rendering using the Particle Cloud Shader. The following items tell you how to create an explosion shader. ● Select the explosion particles and, in the Attribute Editor, change Render Type to Cloud (s/w). Turn Depth Sort to On.
Play Software movie [~240kb]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireball/ (4 of 6) [3/7/2000 14:25:57]
Assistant Online - Maya/How Tos/Dynamics/Fireball ●
●
Go to the Add Dynamic Attributes section, and click the General Tab. Open the Particle tab and select and add radiusPP from the list of Particle attributes. Click with your RMB on radiusPP and create this Creation Expression: radiusPP = rand(0.1, 0.75);
This will randomise within the specified random number limits, the radius of each particle cloud shader on a per-particle basis. If you do not do this, then the fireball will render in a very regular manner. Select Window -> Hypershade. Select Create -> Create Render Node..., and under Volumetric Materials, choose a Particle Cloud material. You will notice that the Color ramps you made for rgbPP are already in the Hypershade. Double-click on the new Particle Cloud material node. Drag and drop the rgb color ramp onto the Map... button opposite Life Color . Connected to the ramp in the Hypershade Utilities section, is the Particle Age Mapper. You can increase this to speed up the rate with which the particles change color as they age. Map a 3D texture SolidFractal into the transparency of the Particle Cloud shader. Select the explosion particles in the modeling view and assign the particle shader. Add a light to illuminate the fireball. Select Render -> Render into New Window. CONCLUSION You now have two particle effects to help you explore the differences between hardware and software rendered particles. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireball/ (5 of 6) [3/7/2000 14:25:57]
Assistant Online - Maya/How Tos/Dynamics/Fireball
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/fireball/ (6 of 6) [3/7/2000 14:25:57]
Assistant Online - Maya/How Tos/Dynamics/Flag
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Flag
HOW TO CREATE A FLAG USING SOFT BODIES
by Steve Christov
Maya Complete Soft Body particles In this lesson you will learn how to create a flag by turning a NURBS plane into a soft body. You will then use the Artisan tools to paint Goal weights to on the soft body particles to allow the cloth to react to forces such as wind and turbulence.
Play Movie[~480kb]
STEP ONE Create a simple sphere and a cylinder and scale these out to become your flagpole. In the menu bar select Create-NURBS Primitives > Plane-Options. Change the U and V patches to 12. Scale the plane to get a shape of a rectangle. Set Rotate X to 90 and Move it to resemble a flag hanging off a flag pole. Press F8 to go into Component Mode. In your top view select every other CV and move them up slightly. Now select the other CVs and move them down slightly to create a ripple surface. Press F8 to return to Object Mode.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/ (1 of 4) [3/7/2000 14:26:12]
Assistant Online - Maya/How Tos/Dynamics/Flag
STEP TWO You will now convert your Plane to a soft body. Select the surface and in your dynamics menu click on Bodies > Create Soft Body-Options.
Click here to view larger image
In the option box set the following: ● Creation Options to Duplicate, ● Make Copy Soft to On ● Hide Non-Soft Object to On ● Make Non-Soft a Goal to On. ● Goal weight to 1.0.
STEP THREE With nothing selected, select Dynamics > Fields > Gravity , Turbulence and Air Select and Move the Air Field to an area behind the flag.
Click here to view larger image Select and Move the Turbulence Field up to the middle of the flag. Select Window > Relationship Editor > Dynamic Relationships. Scroll down to select copyOfnurbsPlane, highlight the fields in the right hand window. With the copyOfnurbsPlane still selected, Click on the Bodies > Create Springs > Options. Set the Max distance to 1.0, and set the Wire Walk Length to 3. Click on Create. Playback your scene. While these forces are connected and acting on the softbody, you are not getting any results. This is because of the fact that when you created the soft body you assigned a goal weight of 1, which results in the soft body always achieving its goal of maintaining it's original shape. You will need to adjust goal weights of the individual particles so that the soft body will not always achieve its goal. For this you will use the Artisan brushes to tweak the goal weights of the soft body to get a realistic flag.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/ (2 of 4) [3/7/2000 14:26:12]
Assistant Online - Maya/How Tos/Dynamics/Flag
STEP FOUR With your mouse over the surface of the flag click with your right mouse button, and scroll down to Paint > copyOfnurbsPlaneParticle Shape > goalPP. Your surface should turn white and your cursor should become an Artisan brush.
Click here to view larger image
Note: Make sure you have shading turned on by pressing 5 on the keyboard.
STEP FIVE Select the tool settings for the brush, by double clicking on its icon in the tool bar shelf. Click on the Display tab and click to disable lighting. Click on the Attr. Paint tab to bring up the brush attributes. Set the value to 0.1. Paint over all of the CVs except for the area near the pole. The surface should give feedback on the changes you are making to the goalweights by turning darker.
STEP SIX Select the Air Field and show the manipulator by pressing the t key on your keyboard . Using the blue circle beside the icon, scale out the one marked Magnitude to about 60. Press on the blue circle and change the direction of the Click here to view larger image air flow towards the flag. In your channel box set Max Distance to Off, and Set Attenuation to 0. This will ensure that the force does not diminish with an increase in distance from the actual position of the field. Select the Turbulence field, and set the following. ● Magnitude to around 100 ● Attenuation to 0. http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/ (3 of 4) [3/7/2000 14:26:12]
Assistant Online - Maya/How Tos/Dynamics/Flag
Playback the animation.
STEP SEVEN If you playback the animation at this point you will see that the "shape" of the turbulence seems to cycle over and over and as a result you don't quite get random ripples. You can fix this by animating the Phase attribute over time. Select the Phase attribute and with your right mouse button select expressions from the pop-up menu.
Click here to view larger image
In the expression editor enter: phase = frame * 10.
When you playback the animation at this point you will see that the flag is now fluttering in the wind. Go to a frame where the forces have evened out and in the menu go to Solvers > Initial State > Set for all dynamic. You now avoid the first couple frames where the forces need to start up.
CONCLUSION This animation is the result of converting a simple plane into a soft body which is then animated using forces such as wind and turbulence. By adjusting the goal weights and tweaking the dynamic forces you are able to create a realistic looking flag. In the final animation the wind direction and magnitude have been animated. Download a finished scene file: flag.ma[~144kb]
Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/ (4 of 4) [3/7/2000 14:26:12]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag02_big.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag02_big.gif [3/7/2000 14:26:15]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag03_big.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag03_big.gif [3/7/2000 14:26:18]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag04_big.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag04_big.jpg [3/7/2000 14:26:21]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag05_big.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag05_big.jpg [3/7/2000 14:26:25]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag06_big.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/flag/img/flag06_big.gif [3/7/2000 14:26:29]
Assistant Online - Maya/How Tos/Dynamics/Footprints
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Footprints
HOW TO CREATE FOOTPRINTS
Alias|Wavefront
MAYA Complete Particle Dynamics In this lesson, you will learn how to make footprints in a wet mud surface. It is a good example of the integration of character animation and dynamics working together. There are at least two ways to approach this problem. One method is to make Play Movie [~521K] the boots rigid bodies, and use rigid body/particle collision to make impressions in the mud. The problem with this method is that rigid bodies cannot bend as the sole of a boot does when walking. The second method involves using fields attached to the boots to displace mud made out of a softbody mesh. This lesson will use the later method. STEP ONE Open the scene file footprints.ma. This scene file contains a pair of animated boots walking on a flat mud surface. If you playback the scene, the mud is not interacting with the boots. You will begin by turning the mud surface into a soft body. Before beginning, set your view to persp/outliner. ● Select the mud surface. ● Select Bodies -> Create Soft Body - Option, and set the following: ❍ Creation Options to Make Soft ❍ Press Create. ❍ Select mudParticles in the Outliner. ❍ In the Channel Box, set the Conserve to 0. http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/footprints/ (1 of 4) [3/7/2000 14:27:05]
Assistant Online - Maya/How Tos/Dynamics/Footprints
STEP TWO There still is no deformation in the mud because there are no fields effecting it. You will be adding air fields to the sole and the heel of each boot to achieve this effect. ● In the Outliner, for the left boot, select bootLsole, and heelL. ● Select Fields -> Add Air - Options, and set the following: ■ Magnitude to 100 ■ Attenuation to .5 ■ Max Distance to 0.2 ■ Direction to 0,-1,0 ■ Press Add. ■ Repeat this process for the right boot. In the outliner you will notice that the boot pieces have air fields parented to them. STEP THREE You will now use the Dynamics Relationship Editor to connect the mud to the fields. ● Select Window -> Relationship Editors -> Dynamic Relationships... ● In the left column select mud. ● In the right column select all of the fields. The fields are now connected. Playback the scene to see the effect. Note: Must you have the animation Playback Speed preference set to Free.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/footprints/ (2 of 4) [3/7/2000 14:27:05]
Assistant Online - Maya/How Tos/Dynamics/Footprints
STEP FOUR The movement of the mud can look more realistic by having the mud bulge upward in front of the boots. This can be achieved by parenting another field to the boot that is pointing in the upward direction. You will also be creating an expression on the Magnitude attribute of the field to control for when the field is active. In other words, the expression will limit the magnitude of the field to operate only when the boot is at ground level and have no influence when the boot rises above the ground. ● Go back to frame 1. ● Select Fields -> Create Air - Options, press Reset, and set the following: ❍ Air Name to pushUpAirL ❍ Attenuation to 0.5 ❍ Direction to 0,1,0 ❍ Speed to 1.0 ❍ Max Distance to 1.0 ● Press Create. ● Position pushUpAirL just under the left toe of the boot. ● In the Outliner, MMB-drag pushUpAirL on top of bootL. The airField pushUpAirL is now parented to bootL. ● Repeat the steps for the right boot and name the new airField pushUpAirR. ● Open the Dynamic Relationships... editor and connect both the pushUpAir fields to the mud surface. STEP FIVE You will now be adding the expression to the Magnitude attribute of the pushUpAir airFields. ● Select pushUpAirL. ● In the Channel Box, highlight the Magnitude attribute. ● With the RMB over the Magnitude field, select Expressions... from the pop-up menu. ● Enter the following expression: if (bootL.translateY > -3.0) { pushUpAirL.magnitude = 0; }
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/footprints/ (3 of 4) [3/7/2000 14:27:05]
Assistant Online - Maya/How Tos/Dynamics/Footprints
else { pushUpAirL.magnitude = 50;
} ● ● ●
Press Create. Repeat these steps for pushUpAirR. Playback the scene.
Depending on your placements of pushUpAir fields, the bootL.translateY value in the expression may have to be adjusted accordingly. CONCLUSION You now have footprints that are created using softbodies and fields. There are a couple of things to note about this workflow. You may have noticed that when you turned Play Movie [~521K] the mud into a softbody, you did not create a goal for it. This is because the mud is not returning to its original shape. It is also important to note that the sole and the heel surfaces were rebuilt with even parameterization to get an even distribution of the air field. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/footprints/ (4 of 4) [3/7/2000 14:27:05]
Assistant Online - Maya/How Tos/Dynamics/Melting Object
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Melting Object
HOW TO ANIMATE A MELTING OBJECT
by Bob Gundu
Updated! [09.28.99] MAYA Complete Particle Dynamics In this lesson, you will learn how to use particle dynamics and lattice deformers to animate a melting vase. This will be accomplished by converting a lattice Play Movie [~284kb] into a soft body and adding collisions to the table surface. Other attributes will be added to lattice for further control.
STEP ONE Create a profile curve for the vase off the Y-axis. Revolve the curve to create the surface.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/melt/ (1 of 4) [3/7/2000 14:28:43]
Assistant Online - Maya/How Tos/Dynamics/Melting Object
STEP TWO With the vase selected, select Deform -> Create Lattice -> Options. Set the Divisions to the following: S = 6, T = 6, U=6 Press Create. STEP THREE You will now make the lattice a soft body. Select ffd1Lattice. Select Bodies -> Create Soft Body -options. Reset all the settings. Press Create. STEP FOUR Create a NURBS plane underneath the vase. Scale up the plane and increase the subdivisions to U 10, V 10. Move the plane slightly below the lattice soft body. This is to make sure the lattice deformer is not penetrating through the plane surface before simulation. STEP FIVE You are now going to add a gravity field to the soft object and particle collisions to the plane surface. Select ffd1Lattice. Select Fields > Create Gravity. To add collisions, select ffd1Lattice then the plane surface. Select Particles -> Make Collide.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/melt/ (2 of 4) [3/7/2000 14:28:43]
Assistant Online - Maya/How Tos/Dynamics/Melting Object
STEP SIX You will notice an obvious problem when you playback the animation [inProgress.mpg]. The vase is bouncing up and down and not spreading outward. This can be corrected with a simple expression controlled by adding two attributes to the ffd1LatticeParticleShape node. In the Outliner, have Display > Shape turned on. Select ffd1LatticeParticleShape. Select Modify -> Add Attribute... and set the following: ● Attribute Name to spread; ● Data Type to Float; ● Attribute Type to Scalar Press Add and repeat with another attribute: Attribute Name to thickness Press OK. STEP SEVEN With the new attributes on the soft body, you will now create an expression to spread out the bottom of the vase as it melts. Select ffd1LatticeParticleShape. Open Window -> Expression Editor. Enter the following in the expression box: vector $melt = ffd1LatticeParticleShape.worldPosition; float $spread = ffd1LatticeParticleShape.spread; float $thickness = ffd1LatticeParticleShape.thickness; if ($melt.y < $thickness) ffd1LatticeParticleShape.velocity = unit (ffd1LatticeParticleShape.worldPosition - <<0,0,0>>) * $spread;
Press Create.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/melt/ (3 of 4) [3/7/2000 14:28:43]
Assistant Online - Maya/How Tos/Dynamics/Melting Object
STEP EIGHT It is now easy to control the quality of the melt with the spread and thickness attribute. Select the ffd1LatticeParticle. In the channel box, change the spread to .4, and the thickness to 1.
Play Movie [~284kb]
Playback the animation. CONCLUSION You now have a vase melting on a surface. Keep in mind that you have several parameters that can be animated to add more life: ● to slow down the melting, decrease the gravity magnitude; ● try experimenting with the spread and thickness attributes; or even add a turbulence field to add more randomness to the effect. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/melt/ (4 of 4) [3/7/2000 14:28:43]
Assistant Online - Maya/How Tos/Dynamics/Particle Gears
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Particle Gears
HOW TO USE PARTICLES TO DRIVE RIGID BODIES
by Nancy Hosken
MAYA Complete Particle Dynamics In this lesson, you will learn how to use particle dynamics to animate the motion of a gear that in turn animates a second gear. Both gears use rigid body dynamics and a hinge dynamic constraint.
Play Movie [~576kb]
To animate the gears, you will create two polygonal gears. By creating a hinge constraint on the gears, they will rotate when acted on by a force.
You will then add an emitter and make the first gear a collision object so that it is influenced by the force of the falling particles. STEP ONE Create a polygonal gear using the steps outlined in the How to build a polygonal gear lesson. Rotate the gear by 90 degrees around the X axis so that it is sitting upright.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/particle_gears/ (1 of 4) [3/7/2000 14:28:55]
Assistant Online - Maya/How Tos/Dynamics/Particle Gears
STEP TWO Duplicate the gear. Place the second gear so that the cogs are linked together. Make sure that the surfaces are not touching.
STEP THREE You are now going to create hinge constraints. Select the first gear. In the Dynamics menu set, select Bodies > Create Constraint options. Change the Constraint type to Hinge. Press Create. Place this hinge at the center of the corresponding gear. Select the second gear and again select Bodies > Create constraint. Place this hinge at the center of the corresponding gear. Note that the gears automatically become rigid bodies when you add a hinge to them. This will help you use them in the particle simulation. STEP FOUR Select Particles > Create Emitter, and place the emitter above the gears. In the Channel Box, hold down your left mouse button over the Emitter Type attribute field and select Directional. Make sure that Direction X is set to 1 and increase the Spread to 0.5. This will point the emission towards the gears in a spray-like form. Play the simulation for a few frames. You can see the particles but they are not falling to the ground. You need to add gravity.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/particle_gears/ (2 of 4) [3/7/2000 14:28:55]
Assistant Online - Maya/How Tos/Dynamics/Particle Gears
STEP FIVE Select the particles. Select Fields > Create Gravity. This creates a gravity field and connects it to the particles. Play the simulation. Now the particles are falling but they may not be hitting the gears. Reselect the emitter and adjust the Speed attribute until the particles are landing on the gear as shown. As the particles reach the gears, you will notice that they are not animating. You need to make the first gear a particle collision object. STEP SIX Select the first gear, excluding its hinge. In the Channel Box, set the Particle Collision attribute field to on. A new collision node is created. If you were to playback the simulation you would see that the particles are still not colliding with the gear. This is because the particles need to be connected by hand to the first gear. Setting Particle Collision to On made collisions possible but didn't connect the particles. STEP SEVEN Select the particles, then the first gear. Select Particles->Make collide. The particles will now collide with the gear.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/particle_gears/ (3 of 4) [3/7/2000 14:28:55]
Assistant Online - Maya/How Tos/Dynamics/Particle Gears
STEP EIGHT Playback the simulation and watch the gears turn. To tweak the results, you can make adjustments such as decreasing the Resilience or increasing the Friction of the gears. These attributes are found in the ParticleShape input nodes. You can adjust the emitter by increasing or decreasing the rate of emission. You can also change the mass and bounciness attributes of the gear. CONCLUSION You now have particles that are driving a gear using dynamics. That gear is in turn driving a second gear. The hinge constraints on the two gears make sure that the gears are rotating during the simulation. Now you can add shaders to the various parts to put together a complete scene. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/particle_gears/ (4 of 4) [3/7/2000 14:28:55]
Assistant Online - Maya/How Tos/Dynamics/Pendulum
Alias|Wavefront / Assistant Online / Maya / How Tos / Dynamics / Pendulum
HOW TO CREATE A NEWTON'S PENDULUM
by Steve Christov
MAYA: Complete Rigid Bodies In this lesson, you will learn how to set up rigid bodies to create a Newton's Pendulum. You will use nail constraints on a series of spheres and apply gravity fields to the constraints.
Play Movie [~789kb]
STEP ONE Create a simple base for the frame of the pendulum. To get the same results as this how-to make the base 10 units high and 14 units long. Or if you like download the file base.ma.[~85kb]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/pendulum/ (1 of 5) [3/7/2000 14:29:11]
Assistant Online - Maya/How Tos/Dynamics/Pendulum
STEP TWO Create a sphere. Move the sphere 3 units in the Y axis. Select Create -> CV Curve Tool -> options. Set the curve to be a 1 degree linear curve. In the side view, while holding down the x key, place a CV in the center of the sphere and another CV at the top corner of the crossbar. Press Enter to create the curve. Press y to reinvoke the CV Curve tool. Create another curve from the center of the sphere to the opposite crossbar. Select Create -> NURBS Primitives -> Circle. Scale it down to 0.1. Using the x key, snap it to the center of the sphere. Select the circle and while holding down the Ctrl key, select one of the curves. Select Surfaces -> Extrude -> options. In the option box, set Result Position to At Path. Press Extrude. Using the same circle, repeat for the other curve. In the Hypergraph window, delete the NURBS circle, and the two curves. STEP THREE Select the Sphere and Group it to itself. Select and Group the two extrudes. Rename the group for the extrudes to threads and the group for the sphere ball. Select the two groups and set the Translate X to -4.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/pendulum/ (2 of 5) [3/7/2000 14:29:11]
Assistant Online - Maya/How Tos/Dynamics/Pendulum
STEP FOUR Select the threads and ball group nodes and select Edit -> Duplicate -> options. Change Translate X to 2. Set the Number of Copies to 4. Press Duplicate and close the duplicate window. STEP FIVE You are now ready to add nail constraints to the spheres. Select one of the spheres. Select Bodies -> Create Constraint -> options. In the dialogue box select nail as the constraint type. This will create a nail in the center of the sphere. With the nail still active switch to the side view. Select the Move tool and while pressing the x key, Move the nail so that it is positioned directly on the crossbar to the left of the sphere. Keep in mind that the nail constraints should follow the same path as the extrudes. Create a Second Nail constraint for the same sphere and move it so that it is positioned on the crossbar to the right of the sphere. Repeat the same procedure for the remaining spheres making sure that there are two nail constraints for each sphere.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/pendulum/ (3 of 5) [3/7/2000 14:29:11]
Assistant Online - Maya/How Tos/Dynamics/Pendulum
STEP SIX You will now parent the threads to each ball. In the Hypergraph window, Click and Drag with the middle mouse button the node threads on to the nurbsSphere1 icon. Repeat for each thread node to parent the groups to the appropriate spheres. STEP SEVEN Select the ball group node. Select the Rotate tool and press Insert to relocate the pivot point. While pressing x move the pivot point up to the level of the crossbar. Press Insert to return to the rotate tool. Rotate along the Z axis to bring the sphere up and away from the others. STEP EIGHT You are now ready to add gravity to the spheres. Select each sphere, making sure that the nail constraints are not picked. With all five spheres selected, Click on Fields -> Create Gravity. NOTE: To increase the speed of the pendulum, increase the magnitude of gravity.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/pendulum/ (4 of 5) [3/7/2000 14:29:11]
Assistant Online - Maya/How Tos/Dynamics/Pendulum
STEP NINE With the spheres still selected, set the following values in the channel box. ● Mass = 10 ● Bounciness = 1.0 ● Static Friction = 0.1 ● Dynamic Friction = 1 Set your time slider to 200 and press play. CONCLUSION You have used some basic dynamic features to re-create Newton's pendulum. By creating nail constraints on each sphere you automatically turn them into rigid bodies - you can then add gravity to create Newton's Toy! Download the completed pendulum.ma.[~157kb] Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/dynamics/pendulum/ (5 of 5) [3/7/2000 14:29:11]
Assistant Online - Maya/How Tos/Fur/Comb Fur
Alias|Wavefront / Assistant Online / Maya / How Tos / Fur / Comb Fur
HOW TO COMB FUR
by Robert Magee
Maya Unlimited Fur, Artisan In this lesson you will learn how to comb fur using the Artisan brushes. You will paint several fur attributes such as length and baldness to add some hair to the bouncing ball from Learning Maya. You will also use the brush to set the direction of the hair. With Artisan this will work just like combing your own hair.
STEP ONE Create a NURBS primitive Sphere and Scale it to look like a bouncing ball. Create and apply the face.iff texture from project one of Learning Maya. Select the sphere and select Fur > Attach Fur Description > New. Now you can see fur indicators all over the sphere.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/fur/comb_fur/index.html (1 of 4) [3/7/2000 14:34:51]
Assistant Online - Maya/How Tos/Fur/Comb Fur
STEP TWO Select the fur. In the Channel box, select the nurbSphere_Feedback Shape node and set the following: ● U and V samples to 50 ● Fur Accuracy to 1 ● Color Feedback enabled to On. Now the display is denser and will give more visual feedback. With larger models these settings might be too high and interactive feedback would be compromised but for the ball it is fine.
STEP THREE Reselect the sphere. Select Fur > Paint Fur Attributes Tool - options. This opens two windows. From the Paint Fur Tool Settings window, set Fur Attribute to Baldness. In the Tool Settings window, set the stamp profile's Value to 0 and its Opacity to 1. Click on the Flood button next to Value. Now the sphere is totally bald. Set the stamp profile's Value to 1 and its Opacity to 0.5. Create a Radius [u] for your brush that suits the top of the sphere then paint the hair back onto the sphere. You are reversing the baldness where you want the hair to be visible.
STEP FOUR To comb the hair, you will paint the Direction. From the Paint Fur Tool Settings window, set Fur Attribute to Direction. Zoom in and brush the hair. Oops! Nothing is happening. This is because the hair is standing straight up. Therefore any changes to its direction are not noticeable. You need to set the Fur's inclination so that the http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/fur/comb_fur/index.html (2 of 4) [3/7/2000 14:34:51]
Assistant Online - Maya/How Tos/Fur/Comb Fur
hair is not standing up straight. From the Paint Fur Tool Settings window, set Fur Attribute to Inclination. In the Tool Settings window, set the stamp profile's Value to .25 and its Opacity to 1. Click on the Flood button next to Value. Now the fur is tilted down. You can even see some changes in direction based on your original direction brushing.
STEP FIVE From the Paint Fur Tool Settings window, set Fur Attribute to Direction. In the Tool Settings window, set the stamp profile's Value to 1 and its Opacity to 0.5. Zoom in and brush the hair.
STEP SIX You will notice that it is easy to brush the hair on the sides but the top of the head is difficult. This is because the isoparm lines meet at the top and the direction is more sensitive. Tip: It might be better if the isoparm "poles" were not at the top of the head. To fix this you could create a second sphere that sits just inside the first one that holds the hair. This surface would put the isoparm poles at the ear so that the top of the head is easier to control. You can now set other fur values such as length, using either the Attribute editor or the Artisan brush. You can also set up color for the base and tip of the hair.
CONCLUSION This lesson introduces you to the use of Artisan tools for combing and editing fur in Maya. You can get more in-depth information about using fur from the Using Maya Fur manual.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/fur/comb_fur/index.html (3 of 4) [3/7/2000 14:34:51]
Assistant Online - Maya/How Tos/Fur/Comb Fur
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/fur/comb_fur/index.html (4 of 4) [3/7/2000 14:34:51]
Assistant Online - Maya/How Tos/Modeling/bevelCaps.mel
Alias|Wavefront / Assistant Online / Maya / How Tos / Modeling / bevelCaps.mel
HOW TO USE THE "bevelCaps" MEL SCRIPT
by Bob Gundu
Maya Complete In this lesson you will learn how to use the bevelCaps.mel script. This script will add planar surfaces to the top and bottom of the selected bevelled surfaces. It will also set the planar surfaces to a high quality of tessellation to get good quality results when rendered.
INSTALLATION Copy the bevelCaps.mel into your scripts directory (typically $Maya/scripts). For general instructions on installing mel scripts, see How to Use an Assistant Online mel Script .
STEP ONE Select Create > Text -Options, and set the following: Text to Maya Font to Helvetica-Bold Type to Curves Press Create. Scale X,Y,Z to 4.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/bevelCaps/ (1 of 2) [3/7/2000 14:35:41]
Assistant Online - Maya/How Tos/Modeling/bevelCaps.mel
STEP TWO With the type active, select Surfaces > Bevel - Options, and press Reset, then Bevel.
STEP THREE You will now execute the bevelCaps script. Type bevelCaps into the command line and press Enter. There should be surfaces on the front and back of the bevelled surfaces.
CONCLUSION You should have a good understanding of how to use the bevelCaps script. You should note that construction history on the bevels will not update the planar surfaces. You will need to reapply the script. Also, the script creates one planar surface for the front and one for the back. The workaround for creating a seperate face for each letter is to apply the script to each letter seperately. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/bevelCaps/ (2 of 2) [3/7/2000 14:35:41]
Assistant Online - Maya/How Tos/Modeling/Gear
Alias|Wavefront / Assistant Online / Maya / How Tos / Modeling / Gear
HOW TO BUILD A POLYGONAL GEAR
by Robert Magee
MAYA Complete Polygon Modeling In this lesson, you will learn how to build a gear by starting with a polygonal cylinder then pulling vertices to create the final shape. You will also learn how to constrain grid snap along one axis to refine some of the points.
Play Instructional movie [~8.6 MB]
STEP ONE Create a primitive POLYGON cylinder. Scale the cylinder along the Y axis to flatten the cylinder. Click on the cylinder's polyCylinder input node. Change the number of subdivisions to 32. This will give us enough vertices to create 8 spokes for the gear. Select the cylinder and then choose Edit > Delete by Type > History. This is very important for later when you want to harden the edges of the polyset.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/gear/ (1 of 3) [3/7/2000 14:35:49]
Assistant Online - Maya/How Tos/Modeling/Gear
STEP TWO Press F8 to go into component mode and make sure that the select by Points pick mask has been picked. In a top view, select two CVs then skip two CVs. Repeat this all round the edge of the cylinder. STEP THREE Select the Scale tool then click drag on the middle of the scale manipulator to scale in all directions. Scale the vertices out until you get the look that you want. STEP FOUR Since you scaled in all directions, the vertices at the top and bottom of your gear are no longer aligned. In a side view, select all the vertices belonging to the top of the gear. STEP FIVE Press the X key to temporarily turn on Grid snapping then click on the Y axis manipulator handle and drag the points up. They will be all snapped to the nearest grid line. Now without grid snapping, drag the points down using the Y axis manipulator handle to bring the points back down closer to the origin.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/gear/ (2 of 3) [3/7/2000 14:35:49]
Assistant Online - Maya/How Tos/Modeling/Gear
STEP SIX Repeat the steps outlined above to flatten the vertices on the bottom of the gear.
STEP SEVEN You now want to harden the edges of the polymesh. Turn the Select by Points mask button off and turn the Select by Lines button on. Click drag over the whole gear to select all of the poly edges. To harden the edges, select the Edit Polygons > Normals > Soften/Harden options. Click on the All Hard button then click on the Soft/Hard button. Now the edges will be hard when rendered later. CONCLUSION You now have a poygonal gear. You have learned how to edit vertice positions by scaling and by grid snapping while constrained along one axis. If you have Maya FX, you can now use this gear as part of a particle simulation involving particle collisions and dynamic constraints in the How to use particles to drive rigid bodies lesson. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/gear/ (3 of 3) [3/7/2000 14:35:49]
Assistant Online - Maya/How Tos/Modeling/Nurbs Booleans
Alias|Wavefront / Assistant Online / Maya / How Tos / Modeling / Nurbs Booleans
HOW TO WORK WITH NURBS BOOLEANS
by Robert Magee
Maya Unlimited Advanced Modeling In this lesson you will learn how to create shapes using NURBS booleans. A NURBS boolean operation treats two or more surfaces like solids then performs an intersection and trim on the participating surfaces. When working with booleans, the three main operations are Subtract which removes one surface volume from another, Intersect that creates a new shape where the two volumes share the same space and Union which adds the two shapes into a larger volume. Booleans have history and can be switched from Subtract to Intersect to Union. You can also update history by repositioning the original surfaces used to generate the boolean. To effectively use booleans, you will also explore how the surface's normals affects the results of the boolean.
STEP ONE Create a NURBS Sphere and a NURBS Cylinder. Place the two shapes so that they are intersecting.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/nurbs_boolean/ (1 of 4) [3/7/2000 14:36:01]
Assistant Online - Maya/How Tos/Modeling/Nurbs Booleans
STEP TWO Select Edit Surfaces > Booleans > Subtract Tool. Click on the sphere then press the Enter key to select it as the first object. Click on the cylinder then press the Enter key to select it as the second object. The shapes are subtracted and the sphere now has the cylinder removed from its surface. Note: If you added color in Step One to the two parts, you will notice that the color disappears. In fact the boolean operation has produced two new surfaces that will need to have shaders reapplied. In some cases more than two new surfaces may be produced.
STEP THREE The boolean does use history which can be updated. The first method for updating history is to choose another boolean operation from the Channel box. Click on the boolean input node in the Channel box. Set Operation to Intersect. Now the resulting shape shows the volume that is shared by the cylinder and the sphere.
STEP FOUR Select one of the boolean surfaces then click on the boolean input node in the Channel Box. In the Hypergraph, select the hidden nurbs sphere node. Move the sphere to update the history on the shape. You can even animate these hidden shape nodes although they will slow down interactive feedback when you playback the scene.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/nurbs_boolean/ (2 of 4) [3/7/2000 14:36:01]
Assistant Online - Maya/How Tos/Modeling/Nurbs Booleans
STEP FIVE Another issue that affects how booleans operate is the surface's normals. By using a plane, you can see how Maya treats any surface as if it is a volume when performing booleans. Start a new scene. Create a NURBS Primitive plane. Go into component mode and pull the middle two rows of CVs up to add curvature to the surface.
STEP SIX Create a NURBS sphere that intersects the plane. Duplicate both the sphere and the plane and move them to the side.
STEP SEVEN Select both of the plane surfaces and select Display > NURBS Components > Normals. Be sure that you are in shaded mode. Lines protrude out from the surface to indicate the surface's normal direction. Select one of the surfaces and select Edit Surfaces > Reverse Surface Direction. Now this surface's normals are going in the opposite direction.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/nurbs_boolean/ (3 of 4) [3/7/2000 14:36:01]
Assistant Online - Maya/How Tos/Modeling/Nurbs Booleans
STEP EIGHT Select Edit Surfaces > Booleans > Subtract Tool. Click on one of the spheres then press the Enter key to select it as the first object. Click on the corresponding plane then press the Enter key to select it as the second object. The shapes are subtracted and the sphere now has the cylinder removed from its surface. Repeat these steps for the other sphere/plane combination. You will notice that in the results are the opposite. This is because the side of the surface that shows the normals is seen as the "outside" of the surface volume while the opposite side is the "inside". Therefore the "inside" of the surface volume is subtracted from the sphere in both cases.
CONCLUSION Booleans are a great tool for quickly bringing together NURBS shapes into a series of trimmed surfaces. Make sure that trims are what you need for your model since they can break apart if the surfaces are deformed. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/nurbs_boolean/ (4 of 4) [3/7/2000 14:36:01]
Assistant Online - Maya/How Tos/Modeling/Spiral Staircase
Alias|Wavefront / Assistant Online / Maya / How Tos / Modeling / Spiral Staircase
HOW TO BUILD A SPIRAL STAIRCASE
by Robert Magee
Maya Complete Modeling In this lesson, you will learn how to build a spiral staircase using polygon booleans and a bend deformer. This lesson highlights how deformers can be used to enhance the modeling process.
Play Movie [~132kb]
STEP ONE Select Create > Polygons Primitives > Cube. In the Channel box, set the cube's width to 5 and its subdivisionsZ to 10. Move the cube so that it is sitting on the ground plane. This cube will act as the first tread of the staircase. The subdivisions will help ensure a smooth bending later.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/spiral_stair/ (1 of 5) [3/7/2000 14:36:12]
Assistant Online - Maya/How Tos/Modeling/Spiral Staircase
STEP TWO Select Edit > Duplicate > options. Set Smart Transform to On. This option will allow you easily create multiple duplications. Click the Duplicate button. In the side view, Move the duplicated cube up and to the right. This will be the second tread. Note: Do not de-select the cube. If you do, Smart Transform will lose the offset information it needs to produce the duplicates created in the next step.
STEP THREE Press Ctrl - d. This will create another duplicate that is offset by the same amount as the second tread. Press Ctrl - d eight more times to create the treads of the stair. You now have several cubes that are all separate shapes. You will need to use polygonal booleans to create a single surface for the stair.
STEP FOUR Select the first two treads. Select Polygons > Booleans > Union. They are now one shape. Note: you can only join two polysets at a time. Now you have to add the other treads. Press the shift key then add the third tread to the selection. Press the g key to repeat the boolean union. Repeat these steps until all the treads are combined into a single polyset. The various booleans have added history to the staircase that is not needed. Select the polyset then select Edit > Delete by Type > History to remove the extra input nodes.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/spiral_stair/ (2 of 5) [3/7/2000 14:36:12]
Assistant Online - Maya/How Tos/Modeling/Spiral Staircase
STEP FIVE Select Create > EP Curve Tool. In the side view, draw a single span curve where you would want to place a handrail. Select Edit Curves > Rebuild Curves options. Set Number of Spans to 20. Click Rebuild. This will add enough CVs to ensure a good bending when you add the deformer later. In the top view, place one curve at one side of the stair and then duplicate the curve to create a second handrail at the other side of the stair. Note: You have built a curve for the handrail so that you can extrude a profile after the bending. Building the handrail as a surface would add too much distortion after bending.
STEP SIX Select the curves and the stair polyset. Select Deform > Create Nonlinear > Bend options. Set Curvature to 4 then click on the Create button. This gives you a sideways bend that doesn't look like a staircase.
STEP SEVEN In the Channel box, set the bendHandle's rotateX to 90. This reorients the deformer to create more of a stair shape. With the Move tool, move the bendHandle along the X axis to widen the bend. Now the handrail curves and the treads are bending nicely into a spiral stair.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/spiral_stair/ (3 of 5) [3/7/2000 14:36:12]
Assistant Online - Maya/How Tos/Modeling/Spiral Staircase
STEP EIGHT In the Channel box, click on the bend Input node. Now select the Show Manipulator tool. You can drag on the curvature handle to adjust the amount of curve in the bend.
Play Movie [~160kb] Note: You can also animate the bending of the stair by setting keys on the curvature attribute.
STEP NINE To create the handrail surfaces, create a primitive circle and scale it to a reasonable radius. Select the circle and then one of the handrail curves. The path curve for an Extrusion must be picked last. Select Surfaces > Extrude - options. Set Result Position to At Path and Pivot to Component. Click Extrude and the handrail will be placed on the handrail curve. Repeat for the other handrail. Tip: If history is maintained as you extrude then you can later select the circle and scale it. The two handrail surfaces will update to show the new profile radius. This lets you evaluate the profile size after extruding to see it in context.
CONCLUSION The bend deformer has made it easy to build a spiral staircase with handrails. You can now delete history or choose to keep it around in case you want to update some part of the model. Download a finished scene file: Staircase.ma[~188kb] Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/spiral_stair/ (4 of 5) [3/7/2000 14:36:12]
Assistant Online - Maya/How Tos/Modeling/Spiral Staircase
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/spiral_stair/ (5 of 5) [3/7/2000 14:36:12]
Assistant Online - Maya/How Tos/Modeling/Square Surfaces
Alias|Wavefront / Assistant Online / Maya / How Tos / Modeling /Square Surfaces
HOW TO WORK WITH SQUARE SURFACES
by Robert Magee
Maya Unlimited Advanced Modeling In this lesson, you will build two surfaces using the Square tool. You will learn how to create a square surface using four boundary curves, and a square surface that maintains continuity with a neighboring surface.
STEP ONE Select Create > EP (Edit Point) Curve Tool. Draw a single span curve along the Z axis. Duplicate the curve and Move it forward along the X axis.
STEP TWO Select Create > EP (Edit Point) Curve Tool. Press the c key to use curve snapping and click drag on the first curve until you place a point at the end of the curve. Use this snapping to place a second point at the end of the other curve.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/square_surface/ (1 of 4) [3/7/2000 14:37:07]
Assistant Online - Maya/How Tos/Modeling/Square Surfaces
Press the Enter key. Repeat to add a single span curve to the other end of the initial curves. Be sure to use curve snapping to place all the points since the Square tool requires intersecting curves to work properly.
STEP THREE Select the front curve and the two side curves. Press F8 to go into component mode. Select all the CVs on the front curve and the two end CVs of the side curves. Move the CVs down along the Y axis. This will add some curvature to the shape you are creating. By moving the end CVs of the side curves, you make sure that they are still intersecting the front curve.
STEP FOUR Press F8 to go back to object mode. Click in space to deselect the curves. Select the four curves in either a clockwise or counterclockwise direction. They must be selected in some order for the Square tool to work properly. Select Surfaces > Square. Press the 3 key to increase the surface's display smoothness. The surface is created so that it touches all the boundary curves. You are now going to build a second square surface that uses the first surface for one of its edges.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/square_surface/ (2 of 4) [3/7/2000 14:37:07]
Assistant Online - Maya/How Tos/Modeling/Square Surfaces
STEP FIVE Duplicate the front curve that was used to build the surface. Move it forward and down in front of the first surface. Create two more single span edit point curves to create a boundary for a new surface. Use curve snapping to help you.
STEP SIX Click on the first surface with your right mouse button and select Isoparm from the marking menu. Click on the edge isoparm that makes up the top edge of the new boundary. It will highlight in yellow when it is selected. Press the shift key and select the other three curves in clockwise or counter clockwise order. Select Surfaces > Square. Press the 3 key to increase the surface's display smoothness. You can now see a surface but the surface is not created with a clean topology. You will try and find out why this is happening.
STEP SEVEN With the new surface selected and its squareSrf input node highlighted in the Channel box, select the Show Manipulator tool. Manipulators appear that show the continuity condition at the edges which are numbered in the order you picked them. Fixed means that the surface is meant to match the neighboring curve or surface based on the edge position. Tangent means that the surface will match the neighboring surface based on its tangency. This will make the surfaces appear to flow together.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/square_surface/ (3 of 4) [3/7/2000 14:37:07]
Assistant Online - Maya/How Tos/Modeling/Square Surfaces
The original single span curves should produce single span surfaces but the new surface has extra isoparm spans. If you zoom in closer, the surface is also not conforming to the two side curves. This is because the side curves were not tangent to the first surface. Therefore the new surface had to add isoparm spans and break away from the side curves in order to meet the tangency requirement at Edge 1.
STEP EIGHT Select the first surface and one of the side curves. Select Edit Curves > Project Tangent. Now the curve should be tangent to the surface. Construction history on the second square surface will update it's topology as the curve is fixed. Note: You may have to change the projectTangent node's Tangent Direction in the Channel box from U to V depending on the order in which you chose the curves to build the first surface. Repeat for the other side curve. Now if you select the second square surface, you will see that it is a single span in both directions. Also it is not breaking away from the side curves since they now all follow the same rules of tangency.
CONCLUSION By using the edge of one or more surfaces to help build another surface, the Square tool's tangent continuity capabilities can come into play. By building clean curves as boundary curves then making sure that those curves also maintain tangency with related surfaces, you can build up a patchwork of surfaces that all appear to work as a single surface. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/modeling/square_surface/ (4 of 4) [3/7/2000 14:37:07]
Assistant Online - Maya/How Tos/Paint Effects/Tree
Alias|Wavefront / Assistant Online / Maya / How Tos / Paint Effects / Tree
HOW TO CREATE A TREE IN PAINT FX
By Steve Christov
Maya 2.5 Complete Paint Effects In this lesson you will create a tree in Paint Effects starting from a simple black brush stroke. While this approach is somewhat drastic it will help you form a good understanding of the attributes that make up Paint Effects.
Play Movie [~800k]
This article assumes you have Paint Effects loaded into Maya. Please see the Maya help menu on how to install Paint Effects if you have not already done so. This lesson is the third of a three part lesson. You may want to complete parts one "How to create a realistic sky using EnvSky" and two "How to create realistic shadows using EnvSky" before you start this lesson. STEP ONE Download and open the scene Env_sky_shadow. If you have completed the previous lessons, you can use your last saved scene file. Delete the sphere. Select the lights, 3D env_sky icon, and the 3D texture icon for the cloud. Select Display > Hide > Hide Selection. This will unclutter the http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (1 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
scene so we can concentrate on the Paint Effects stroke. STEP TWO Switch to the Persp window. Select the plane and select the Paint Effects > Make Paintable. Open the Visor by selecting Windows > Visor. Scroll to the bottom and open the section marked Brushes. This will give you access to the Paint Effects preset brushes. Open the Pens and select the simpleLine brush. In your perspective window, Paint a small stroke near the origin. STEP THREE With the stroke still selected, open the Attribute Editor. Open the tab simpleLine1. Your first step is to add tubes to the brush. Open the tubes section and Click beside Tubes and then Tube Completion. Open the Tubes > Creation section. Change the Tubes Per Step to 0.1 and the Tube Rand attribute to 0. Also change the Length Min to 0.8, and the Length Max to 0.9. You will also see some attributes called Tube Width1 and 2. These set the width for the base of the tube and the tip of the tube respectively. Change the Tube Width1 to 0.12 and Tube Width2 to 0.09. There are settings for randomness and bias for multiple tubes across the same stroke but because we are only creating one tube, we can ignore these settings. Change the number of Segments to 40. This will increase the number of segments that are used to create the tube. The Elevation attribute dictates the lean on the tube. Where 0 is the tube lying flat against the curve and 1 standing straight up. Since you want the tree to stand straight up, set the Elevation Min and Max to 1.0. NOTE: You may notice that your tube is still lying flat against the curve despite changing the elevation attribute. You can fix http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (2 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
this in the attribute editor. Open Behavior > Forces. Change the Path Follow to 0.0. STEP FOUR Now that you have the basic shape of the trunk you are now ready to shade it. Open the Shading section in the Attribute Editor. Click on the color swatch next to Color1. In the color chooser change the RGB values to 0.64, 0.52, 0.41. Open the Tube Shading section. Click on the color swatch next to Color2. Set the RGB values to 1.0, 0.85, 0.83. You have now set the colors for the trunk of your tree. If you render now you will see that it will render out in one uniform color. By adding a simple ramp texture to the tube you can simulate bark. Open the Texturing section. Click on the icon next to Map Color. We are going to map a V Ramp to the trunk of the color to give the appearance of bark. From the drop down menu beside Texture Type, Select V Ramp. Set the following attributes: ● Texture2 Color to RGB 0.54, 0.49, 0.44 ● Repeat U to 6.0 ● Repeat V to 2.2 ● Blur Mult to .26 ● Smear to 0.203 ● Smear V to 0.61 You can preview the progress this far by pressing the hotkey "8" while in the persp window to switch to the paint effects preview render window. In the menu select Stroke Refresh > Rendered. However it will take longer to refresh with each change. NOTE: When you render, depending on the length of your original stroke, you may have more than one tube attached to your stroke. One way to solve this is to lower the Tubes per Step attribute in the Tubes > Creation section.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (3 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
STEP FIVE In Paint Effects you have the option to Illuminate the tree with simulated or real lights. Open the Illumination section, Check the box next to Illuminated. This will use real lights from your scene on your paint effects tree. We are also going to add some specular qualities to the tree to give it some highlights. Set Specular to 0.15.
STEP SIX Now that we have the trunk, we are ready to add some branches. Open the Tubes Growth section and click next to Branches to add them to the trunk. Open the Branches section. Increase the Split Max Depth to 7. This increases the number of times the branch will split up. Increase the Branch Dropout to 0.02. The next set of values control different attributes for the split on the branch including Randomness, Angle of split, Twist. Feel free to experiment with these values and come up with your own style of tree or you can set the following values: ● Split Rand to .017 ● Split Angle to 26.3 ● Split Twist to 0.32 ● Split Size Decay to 0.67 ● Split Bias to 0.19
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (4 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
STEP SEVEN Click on the box next to Twigs to turn them on. Open the twigs section. Set the Num Twig Clusters to 8.0 and set the Twig Dropout to 0.439. Then next attribute set length, width,angle and twist. Again feel free to experiment with the settings to get your own tree or set the following attributes: ● Twig Length to 0.08 ● Twig Base Width to 0.7 ● Twig Tip Width to 0.15 ● Twig Angle1 to 52.5 ● Twig Angle2 to 54.0 ● Twig Twist to 0.512 Keep in mind that your twigs will decide the placement of leaves. So these settings can have a pretty dramatic effect down the line. For example increasing the number of Twig Clusters will result in more leaves on your final tree. STEP EIGHT You will now add some leaves to the tree to complete the look. Click the box next to Leaves. Set the following attributes: ● Leaves in Cluster to 5.0 ● Num Leaf Clusters to 4.0 ● Leaf Dropout to 0.154 ● Leaf Length to 0.04 ● Leaf Base Width to 0.035 ● Leaf Tip Width
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (5 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
●
●
●
●
●
to 0.01 Leaf Start to 0.9
Leaf Twist to 0.5 Leaf Translucence to 0.561 Leaf Sat Rand to 0.033 Leaf Val Rand to 0.114
Check the box next to Terminal Leaf. This will place a leaf at the end of each twig. STEP NINE If you render your image at this point you should have a basic looking tree. You are now ready to add various other attributes to further enhance your tree. In the Attribute Editor open the Behavior Forces section. Set the Gravity slider to 0.05. You will notice that the branches and leaves out as if the weight of the leaves was pulling the branches down.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (6 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
STEP TEN You are now ready to add some animation to the tree to simulate it swaying in the wind. Open the Behaviour then the Turbulence section. Set the Turbulence Type to Grass Wind. Set Turbulence Interpolation to Smooth over Time and Space. Because we are going to use this tree with a time lapse sunset, you will want the tree to behave with tight motion in the tree trunk and branches but you do want the the leaves to give the impression of some quick fluttering in the wind. Set the following values: ● Turbulence to 0.02 ● Turbulence Frequency to 0.005 ● Turbulence Speed to 1.0 Set the Time Slider to 100. Press Play. Switch to the Perspective window. The wireframe will give you an indication of the general motion of the tree. STEP ELEVEN You will now save your brush to the visor so you can access it in the future. With the tree selected, go to Paint Effects > Get Settings from Selected Stroke. This will apply your tree to the template brush. Now Select > Paint Effects >Save Brush Preset. Set the Label and Overlay Label to Mytree. Save it To Visor and set the Visor Directory to Trees. Click on Grab Icon and drag around your tree in the render view to make an icon for you brush. Click Save Brush Preset.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (7 of 8) [3/7/2000 14:39:14]
Assistant Online - Maya/How Tos/Paint Effects/Tree
STEP TWELVE Select Panels > Perspective > Camera 1. Position your tree in the frame by selecting the stroke and moving it with the manipulator. Add a texture to the ground plane. Do some test renders at different frames to make sure you are happy with the framing and lighting. When you are satisfied with the results, set the render globals to render the animation for 100 frames from Camera1. CONCLUSION You have now assembled a complete scene similar to the one above. By this point you have learned how to create and use an environment sky, add a light to it to simulate realistic shadows based on the sun position, and made your own tree in paint effects.
Play Movie[~800k]
Enhance your scene by sculpting the floor surface with Artisan to make some nice rolling hills and adding some grass strokes to it. Download the completed scene file. [~100k] Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/index.html (8 of 8) [3/7/2000 14:39:14]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/img/nine.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/img/nine.gif [3/7/2000 14:39:30]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/img/ten.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/img/ten.gif [3/7/2000 14:39:32]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/img/eleven.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/paintFX/tree/img/eleven.gif [3/7/2000 14:39:34]
Assistant Online - Maya/How Tos/Rendering/Animate Textures
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Animate Textures
by Bob Gundu
HOW TO ANIMATE TEXTURE FILES MAYA: Base Rendering This lesson will demonstrate how to use a numbered sequence of images as a texture map. There are basically two methods to achieve this effect; expressions, and keyframing. Both will be covered in this lesson.
Play Movie [~314kb]
Note: Before beginning this how-to, you need to have ready a sequence of frames with a numbered extension such as filename.rgb.001, im.001, or filename.sgi.01. These frames will be used as the animated texture map. Tip: Check the images directory in your favorite Maya project for rendered frames that you can use with this how-to. STEP ONE In the Multilister, create a File texture node and open the Attribute Editor for the File node. In the Attribute Editor set the following: ● In the File Attributes section, use the Browse button or enter in the field the location and name of the sequence of images. Be sure not to include the extension. For example, if the first frame is named "myRender.sgi.001", you should only enter "myRender.sgi". ●
Change Use Frame Extension to On.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/animated_texture_files/ (1 of 5) [3/7/2000 14:42:01]
Assistant Online - Maya/How Tos/Rendering/Animate Textures
METHOD 1: KEYFRAMING This method requires a keyframe for the beginning and the end of the sequenced images. ● Go to frame 1 (or to the frame where you want the texture to begin animating). ●
●
With the file1 texture selected, open the Attribute Editor (or go to the Channel Box) and, in the Frame Extension field, enter the extension number of the frame where you want the texture to begin animating. (e.g. if your images are named sequentially filename.rgb.8 through filename.rgb.35, enter "8") With the RMB over the Frame Extension attribute, select Set Key if using the Attirbute Editor (or Key Selected if using the Channel Box) from the pop-up window.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/animated_texture_files/ (2 of 5) [3/7/2000 14:42:01]
Assistant Online - Maya/How Tos/Rendering/Animate Textures
●
●
●
●
In the Timeline, go to the last frame for the texture file animation. Enter the the last extension number from your sequence of images in the Frame Extension field. (e.g. if your images named filename.rgb.8 through filename.rgb.35, enter 35) Set another key with the RMB over the Frame Extension field. Connect the texture file to a shading group and assign it to a surface.
If you scroll through or playback your animation, you will notice that the file textures are updating. Tip: Ensure that your animation curve tangents are set to linear for each keyframe, and that your animation preference for playback is set to Free. METHOD 2: EXPRESSIONS You can also animate texture files using an expression, achieving the same result as in Method 1 but without using key frames. If you have already completed Method 1, you can with the RMB over the Frame Extension field, select Break Connection and http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/animated_texture_files/ (3 of 5) [3/7/2000 14:42:01]
Assistant Online - Maya/How Tos/Rendering/Animate Textures
continue with this method. With the RMB over the Frame Extension field, select Create New Expression... from the pop-up menu to display the Expression Editor. In the Expression Editor, complete the following steps: ● In the Attributes column select FrameExtension. ●
In the Expression field enter the following: file1.frameExtension = frame;
●
Press Create.
The above expression assumes your file textures sequence begins with the extension ".1" (e.g. myRender.rgb.1). If your source images sequence starts with anything other than ".1", you'll need to edit the expression as follows: file1.frameExtension = frame + 7;
This means that, similar to the example given in our keyframing method where the images are numbered filename.rgb.07 through filename.rgb.35, the system will read "frame" as "myRender.rgb.1", then add 6 more frames and start animating the file texture at "myRender.rgb.8". Note: If you had already created other file nodes, your file texture name may be something other than file1. If this is the case, use the name that appears in your session. ● Connect the texture file to a shading group and assign it to a surface If you scroll through or playback your animation, you will notice that the file textures are updating.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/animated_texture_files/ (4 of 5) [3/7/2000 14:42:01]
Assistant Online - Maya/How Tos/Rendering/Animate Textures
CONCLUSION The example of the television is only one way of using an animated texture map. Another possibility is using it for animating fast moving objects like rotating tires and helicopter blades which have extreme motion Play Movie [~314kb] blur. The animated texture maps could already include a blurred look to decrease rendering time. The keyframing method is a flexible and straight forward approach to animating a texture map. With this method, cycling the texture map can be achieved in the Graph Editor. To do the same with method 2 requires a slightly more advanced expression. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/animated_texture_files/ (5 of 5) [3/7/2000 14:42:01]
Assistant Online - Maya/How Tos/Rendering/Combine Map
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Combine Maps
HOW TO COMBINE BUMP & DISPLACEMENT MAPS
by Lorna Saunders
Maya Complete Rendering In this lesson, you will learn how to combine a displacement map and bump map to create a brick texture. You will also learn how to use the Connection Editor to connect hidden attributes as you build a textured brick wall. To achieve both a displaced and bumped surface, you will start by displacement mapping the shading group with a file texture. You will notice that this process also maps the bump channel automatically with the same file texture. Later, a fractal will serve as a new bump map "chained" to this first bump in the dependency graph. This approach gives you the combined look of both the displacement and the bump map qualities on the shading group. STEP ONE Open the Hypershade and create a Lambert material node with a shading group. Click the show Up and Downstream Connections icon in the Hypershade to display the shading group node. Name this shading group WallSG. Open up the Attribute editor and click on the WallSG tab. Map the displacement channel on this shading group with a grayscale brick file texture like the one shown here.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/ (1 of 4) [3/7/2000 14:42:13]
Assistant Online - Maya/How Tos/Rendering/Combine Map
STEP TWO Assign the shading group to a plane and rotate it 90 degrees around the X axis. Add a spotlight to illuminate the wall. Render the scene to see the displaced effect. STEP THREE In the Hypershade, create two new nodes using Create -> Create Render Node. Under the texture tab of the Create Render Node window, create a 2D Fractal texture. Under the Utilities tab, create a Bump 2D node. You will be layering these with the displacement map to give the brick a rougher look. STEP FOUR In the Hypershade clear the view in the work area. With your MMB, drag the WallSG, the 2Dbump, and the fractal nodes from the Visor into the Hypershade view. You will be building the rest of this shading network in the Hypershade.
Click to view larger version
STEP FIVE In the Hypershade, drag the fractal node onto the new bump2d node. The default connection (outAlpha to bumpValue) is made automatically in this case.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/ (2 of 4) [3/7/2000 14:42:13]
Assistant Online - Maya/How Tos/Rendering/Combine Map
STEP SIX Drag the bump2d node onto the bump2d node that is already part of the WallSG shading group. The Connection Editor opens. On the left side click on Out Normal. Go to the Right Side Filters menu and turn on Show Hidden. Click on Normal Camera.
Click to view larger version
This creates a connection between the two bump nodes. Be sure that you have Auto-connect turned on under the options menu in the Connection Editor to make connections this way. STEP SEVEN Select the second bump2d node that you just connected into the shading group. Open the Attribute editor and change the Bump Depth to about 0.2. Render your scene again to see the effect of this new bump added to the WallSG. STEP EIGHT Map an image like the one shown here to the color channel of the material on the WallSG to complete the look of the brick wall.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/ (3 of 4) [3/7/2000 14:42:13]
Assistant Online - Maya/How Tos/Rendering/Combine Map
STEP NINE Render your scene again to see the completed brick wall.
CONCLUSION You have learned how to create a shading group that has both a displacement map and a bump map by chaining two bump nodes together. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/ (4 of 4) [3/7/2000 14:42:13]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/img/step4_lrg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/img/step4_lrg.gif [3/7/2000 14:42:16]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/img/step6_lrg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/bump_displacement/img/step6_lrg.gif [3/7/2000 14:42:22]
Assistant Online - Maya/How Tos/Rendering/Camera Cuts
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Camera Cuts
HOW TO ANIMATE CAMERA CUTS Maya Complete Rendering When animating, you may want to be able to cut between several cameras that look at your scene from different points of view. In this lesson, you will learn how to use the cameraMain.mb camera to cut between other cameras in the scene.
by Robert Magee
Play Movie [~407kb]
The camera cut file is included inside cameraMain.ma. The cameraMain camera is a pre-made camera that has an expression which lets it mimic the qualities of the other cameras in the scene, based on a cameraNumber attribute that you can animate. Note: This expression has been updated for Maya 2.0. This lesson uses a scene of a robot in a tunnel to show you how the camera cuts can be animated using this camera. STEP ONE Create several cameras in your scene. Make sure that they are named camera1, camera2 etc. The naming is important to ensure they work with the camera cut expression later. You can now position and animate these cameras to view your scene.
Play Movie [~502kb]
For the Gunbot scene, camera1 was set up to use an http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/ (1 of 3) [3/7/2000 14:42:30]
Assistant Online - Maya/How Tos/Rendering/Camera Cuts
expression so that it moved along the z axis as the robot walks, camera2 is animated to move slowly down the tunnel while viewing the robot from a distance, and camera3 is waiting around the corner. This camera is also animated to react when the robot shoots at it. Each of these cameras represents a different point of view of the scene. STEP TWO Import cameraMain.mb. This file contains a new camera that uses the camera cut expression. If you want to build your own camera cut camera, or if you want to understand how the cameraMain camera works, review the How to create a camera cut camera lesson. Note: If you look through cameraMain and cameraNumber is referencing a camera that hasn't been created, then cameraMain will go to a default position at the origin. This behavior is built into the cameraMain expression. In a view panel, select Panels -> Perspective -> cameraMain. Now select View -> Select Camera. Now you have this camera's attributes in the channel box. The one attribute that is keyable is the cameraNumber attribute. By changing cameraNumber you change what camera cameraMain will look through. If cameraNumber is 2, then cameraMain will look through camera2. Note: When you first change the cameraNumber, cameraMain will not look through the chosen camera. You must playback the scene, or change your current frame for cameraMain to pop to its new position. STEP THREE You now want to set keys on cameraNumber so that you can animate the cutting of the camera. From the Animation preferences Under the Keys section, set the Click to view a larger version Default Out Tangent to Stepped. This will make sure that you jump from camera to camera at each key. To set keys on cameraNumber, select the cameraNumber attribute in the channel box then select Channels -> Key selected. The robot scene starts with camera3, switches to camera1, back to camera3 then finally to camera2. Once the keys are set, you can preview the cuts by playing http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/ (2 of 3) [3/7/2000 14:42:30]
Assistant Online - Maya/How Tos/Rendering/Camera Cuts
back the scene using cameraMain. To control the timing of when the cuts occur, you can now easily change the timing of the keys using the graph editor. CONCLUSION When you are happy with the results, you can render out the scene by making cameraMain as the renderable camera. Don't forget to turn off the renderable attribute for the perspective camera. Note: If you are using motion blur, rendering out the cuts using cameraMain will create an exaggerated blur at the first frame of every cut. For instance, as the camera cuts from camera1 to camera2, there will be a lot of motion blur as the camera leaps to the new position. If you want to use motion blur, you can either delete these incorrect frames, or you can use the cameraMain to find out where the cuts should occur then use the actual cameras (camera1, camera2 etc.) to render. To make sure that each camera renders out with the same name, use a File Name Prefix in the Render Globals Window. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/ (3 of 3) [3/7/2000 14:42:30]
Assistant Online - Maya/How Tos/Rendering/Create Camera
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Create Camera
HOW TO CREATE A CAMERA CUT CAMERA Maya Complete Rendering
by Robert Magee
This lesson teaches how to create the cameraMain.ma camera. In this lesson, you will learn how to set up a camera that will use an expression to cut between other cameras in the scene. This expression uses a new attribute called cameraNumber to decide which other camera in the scene to "mimic." Basically cameraMain takes on all the key attributes of the chosen camera. This camera is designed to be used in the How to animate camera cuts lesson. STEP ONE Select Create -> Camera. Rename this camera cameraMain. This is very important since the expression you will be writing refers to this camera name. STEP TWO With the Camera selected, select Modify -> Add Attribute... Set the following: ● Attribute name to cameraNumber. ● Data Type to Integer Click OK. This new Attribute will be used to determine which camera, cameraMain will be mimicking. Its name is very important since the expression uses this attribute name.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/camera.html (1 of 2) [3/7/2000 14:42:52]
Assistant Online - Maya/How Tos/Rendering/Create Camera
STEP THREE With the Camera selected, select Window -> Expression Editor. Create this expression. To understand how the expression works, read the script's comments. CONCLUSION When using this camera, it is important that your other cameras are named camera1, camera2 etc. To switch between them, you can now set keys on the cameraNumber attribute. For more details on how to use this camera, complete the How to animate camera cuts lesson. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/camera.html (2 of 2) [3/7/2000 14:42:52]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/img/cut4_lg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/camera_cuts/img/cut4_lg.gif [3/7/2000 14:43:01]
Assistant Online - Maya/How Tos/Rendering/Clouds
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Clouds
HOW TO MAKE NATURAL CLOUDS
by Tom Kluyskens
Maya Complete Rendering In this lesson you will learn how to create fly-through, shadowable clouds. To achieve this result, you will create a shading network using the sampler info node, a reverse utility node and a ramp texture.
Play Movie (472k)
STEP ONE Create a sphere. Use the E_copy script to randomize some copies of the sphere. Use the settings as shown below. If you are unfamiliar with the use of mel scripts, please see How to use an Assistant_Online Script
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/ (1 of 6) [3/7/2000 14:43:10]
Assistant Online - Maya/How Tos/Rendering/Clouds
STEP TWO Delete the original sphere. The result should look like this. Select all spheres and disable their double sided option in the Window -> Rendering Editors -> Rendering Flags. This will make them more transparent, especially at the borders. Important : The spheres must have a high degree of overlap or the spheres will be visible. They must NOT be scaled too much along one axis or you will see artifacts. Also note that too many spheres will slow down the render time. Use a maximum of 10.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/ (2 of 6) [3/7/2000 14:43:10]
Assistant Online - Maya/How Tos/Rendering/Clouds
STEP THREE Create a Lambert shading group, a ramp texture (without texture placement), a cloud texture, a sampler info utility and a reverse utility. Assign the Lambert shading group to the spheres. Rename the LambertSG to CloudSG, and the Lambert material to CloudM. Drag the MMB with the cloud texture onto the ambient color of the CloudM material node. Scale the Cloud place3Dtexture to 4,4,4.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/ (3 of 6) [3/7/2000 14:43:11]
Assistant Online - Maya/How Tos/Rendering/Clouds
STEP FOUR Connect as follows, using the Hypershade. ● Connect the outColor of the ramp to the input of the reverse node. ●
●
●
●
Connect the reverse output to the transparency of the CloudM node. We reverse the cloud color, because we want the clouds transparent where they are colored black. Connect the sampler info facing ratio to the U Coord of the ramp Set the type of the ramp to URamp and change the interpolation to exponential up. Map the Cloud to the top tab and configure as indicated. (bottom tab just black). The Ramp, using the sampler info facing ratio as an Input, will modify the Cloud so that the borders of the spheres will be transparent (black becomes white through the reverse utility node, thus totally
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/ (4 of 6) [3/7/2000 14:43:11]
Assistant Online - Maya/How Tos/Rendering/Clouds
transparent). If the U Coord (connected to the Facing Ratio in this example) of a U Type Ramp is 0, the output color will be the bottom color of the ramp, if it's 1, the top of the ramp is the output color.
Click to view larger version Note: The Facing Ratio is the degree to which a point on a surface is facing towards the camera. If the point is located on a part of the surface that is facing 90 degrees away from the camera (typically the border of a sphere), the Facing Ratio is 0. If the angle between the surface normal and the camera ray is 0, the Facing Ratio is 1.
STEP FIVE Put some lights in the scene : ● 1 directional for the sunlight ● 1 ambient (with a bit of ambient shade) for the scattered light ● Some colored Point lights with decay, placed inside the clouds to give the clouds some local color (if you want or need them).
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/ (5 of 6) [3/7/2000 14:43:11]
Assistant Online - Maya/How Tos/Rendering/Clouds
CONCLUSION You have now created a shading network that produces some interesting transparent cloud effects. With this shader, you can also try Play Movie (472k) scaling or animating the 3D placement texture node, or adjusting attributes on the CloudM material node for different effects. Here is the completed cloud scene, cloud.ma (106k) E_copy script was written by Gyedo Jeon Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/ (6 of 6) [3/7/2000 14:43:11]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/img/cloudhg.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/clouds/img/cloudhg.jpg [3/7/2000 14:43:18]
Assistant Online - Maya/How Tos/Rendering/Depth of Field
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Depth of Field
HOW TO USE DEPTH OF FIELD Maya Complete Rendering
by Steve Christov
This tutorial will teach you how to use Depth of Field in Maya to help add some realism of your renderings and animations. You will be using the measure tool to determine the distance from the camera to your object and then adjusting depth of field attributes such as F-stop and Focus Scale.
STEP ONE Open your completed Jack in the box tutorial from Learning Maya. Create a new camera. With the camera selected open the Attribute Editor, click on the cameraShape tab. Open the Depth of Field section. Set Depth of Field to On.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/depth_field/ (1 of 3) [3/7/2000 14:43:49]
Assistant Online - Maya/How Tos/Rendering/Depth of Field
STEP TWO To establish what your depth of field is going to focus on, you will need to measure the distance from your camera to the object or area you focusing on. Go to Modify > Measure > Distance Tool, and use the four view panels to measure the distance from camera1 to the Jack. Reselect the new camera. In the Depth of Field section, set Focus Distance to the value determined by the measure distance tool. Render your scene in the render view window.
STEP THREE You will notice that the desired effect of a focused Jack and unfocused foreground and background elements is minimal in this rendering. This is because the present units in the scene are measured in centimeters which makes the model too small to make use of any normal F-stop setting. Try to imagine photographing the toys on your desk with a camera standing only a foot away. You would not see the effect of depth of field because the objects are too small. Fortunately you have the option to scale the camera down to achieve a realistic result in these units. In the camera attribute change the Focus Region Scale to around 0.15. This is an approximate conversion from centimeters to feet. Now the camera's F-stop will acts as if Jack is a little further away. Re-render your scene. You should now see the Jack in the box in focus while the objects around it are slightly blurred.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/depth_field/ (2 of 3) [3/7/2000 14:43:49]
Assistant Online - Maya/How Tos/Rendering/Depth of Field
STEP FOUR To change the range of distances in which the objects appear in sharp focus you can use the F-stop. Increase the F-stop to around 7.00 to create a longer depth of field. Aim for a result that has the entire Jack in the Box in focus while the objects around it are blurred.
CONCLUSION Using Depth of Field, you can add a little realism to your renderings. As you animate your cameras, this effect will be even more visible. TIP: To make the camera automatically focus on its center of interest (similar to a real-world camera's auto-focus function), connect the output of the camera group node's Distance Between attribute to the input of the camera shape node's Focus Distance attribute. This is only possible with two-node and three-node cameras because one-node cameras do not have a camera group node. Download a finished scene file: Jack_Depth.ma[~372kb]
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/depth_field/ (3 of 3) [3/7/2000 14:43:49]
Assistant Online - Maya/How Tos/Rendering/Double Sided Shader
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Double Sided Shader
HOW TO CREATE A DOUBLE-SIDED SHADER
by Robert Magee
Maya Complete Rendering In this lesson, you will learn how to create a two-sided shading group where you have one material node on one side and a different material node on the other. This workflow is similar to the instructions found in the Play Movie [~150kb] What's new in Maya 2.0 guide except that rather than using different textures which share a material node, this example uses different material nodes that share a shading group node. This allows you to easily add various texture maps to the two materials, enhancing the look of both sides of the surface.
STEP ONE Select Create > NURBS Primitives > Sphere. Hit 3 on the keyboard to increase the sphere smoothness. Click on the sphere with your right mouse button and select Isoparm from the marking menu. Select an isoparm near the top of the sphere. It will highlight in yellow.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/ (1 of 5) [3/7/2000 14:45:15]
Assistant Online - Maya/How Tos/Rendering/Double Sided Shader
STEP TWO Select Edit Surfaces > Detach Surfaces. This breaks the sphere along the selected isoparm. Select the top surface and delete it. Now you have a sphere where you can clearly see the inside and the outside. You will use this surface to test your double sided shading group.
STEP THREE Open the Hypershade. Select Create > Create Render Node. Under the Materials tab choose a Blinn material. Make sure with shading group is checked. Using the Attribute Editor Change the color of the Blinn material to a red then Assign the shading group to the sphere. The color will help you distinguish it from the inside material later.
STEP FOUR From the Hypershade, select Create > Create Render Node and choose the following: Materials: • a Phong material With Shading Group turned Off. Utilities: • Condition • Sampler Info The Phong will be used for the second surface while the utility nodes will be used to build the two-sided nature of the shading group.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/ (2 of 5) [3/7/2000 14:45:15]
Assistant Online - Maya/How Tos/Rendering/Double Sided Shader
STEP FIVE With your middle mouse button, drag the samplerInfo node onto the condition node. This will open the Connection Editor. Connect the samplerInfo node's flipped Normal attribute to the condition node's First Term attribute.
Click here to view larger image
This will establish the surface normal as the driver of the condition. When the renderer sees a point on the inside of the surface, the samplerInfo node will tell it that there is a flipped normal and the condition node will know to change the material.
STEP SIX With your middle mouse button drag the blinn node onto the condition node. Connect the blinn node's Out Color to the condition node's Color1. This establishes the blinn material as one side of the shading group.
Click here to view larger image
STEP SEVEN With your middle mouse button drag the phong node onto the condition node. Connect the phong node's Out Color to the condition node's Color2. This establishes the phong material as the second side Click here to view larger image of the shading group. Leave the Connection Editor open for the next step.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/ (3 of 5) [3/7/2000 14:45:15]
Assistant Online - Maya/How Tos/Rendering/Double Sided Shader
STEP EIGHT Click the Clear All button in the Connection Editor. Delete the connection between the Blinn1 node and the BlinnSG node in the Hypershade. Select the Blinn node and click the Show Up and DownStream Connection to view the blinn1SG.
Click here to view larger image
Use your middle mouse button to drag the condition node to the outputs section of the Connection Editor. With your middle mouse button drag the blinn1SG node to the Inputs section of the Connection Editor. Connect the condition node's Out Color attribute to the blinnSG node's Surface Shader attribute. This allows the underlying network to plug directly into the Shading Group node. The shader is now ready to be rendered. Note: If you have hardware texturing turned on you will not see the shading group displayed properly. You will have to render to see the results.
STEP NINE You can now add lights to your scene, set up your Render Globals and render the scene to see the two sided surface. Note: If you want to reverse which surface is on the inside and which is on the outside then open up the condition node in the Attribute editor and change the Operation from Equal to Not Equal.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/ (4 of 5) [3/7/2000 14:45:15]
Assistant Online - Maya/How Tos/Rendering/Double Sided Shader
STEP TEN Because you now have two material nodes feeding the inside and outside of the shading group, you can apply various texture maps to the different materials. For instance you could apply a color map, specular map and bump map to Blinn material node to give it a look of wood then apply different maps to the Phong material to create a bumpy stone pattern.
CONCLUSION Creating a double-sided shading group that offers different material qualities on the two sides is a great way of working with certain kinds of surfaces. Clothing is a good example where you might want a rough wool fabric on the outside and a shiny silk lining on the inside. You can download the shading group from this lesson assign it to your own objects. You can even use this shading group as a template and replace the textures to create your own look. Note: One limitation of double-sided surfaces is that the inside surface will not reflect or refract when raytraced. The image shown to the right is a two-sided surface that is reflected in a mirror. You can see that the grainy interior of the sphere is not reflected in the mirror. Download shader: double.ma[~4kb] Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/ (5 of 5) [3/7/2000 14:45:15]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double6_lg.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double6_lg.jpg [3/7/2000 14:45:19]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double7_lg.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double7_lg.jpg [3/7/2000 14:45:23]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double8_lg.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double8_lg.jpg [3/7/2000 14:45:27]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double9_lg.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/double_sided/img/double9_lg.jpg [3/7/2000 14:45:30]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Environment Sky
HOW TO CREATE A REALISTIC SKY WITH THE ENVSKY TEXTURE
By Steve Christov
Maya Complete Rendering The environment sky is a powerful procedural texture that you can quickly and easily add to your scene to give the appearance of a sky overhead. In this first part of a three part lesson you will learn Play Movie [~800k] how to create an environment sky and set attributes that will create a realistic looking sky. In the next lesson - How to create realistic shadows using envSky - you will learn how to achieve realistic shadows using the position of the sun on the EnvSky texture. In the final lesson you will learn how to "grow" a tree in Paint Effects from a simple black brush stroke - How to create a tree using Paint Effects. After these three lessons, you will be able to combine these elements to produce an animation similar to the one above where you create a time lapse animation of a sunset. STEP ONE You will first need to create a new camera and then attach an image plane to it. Create a new camera by selecting Create > Camera. ● Translate the camera 2 units in the Y axis and 6 in http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (1 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
●
●
the Z axis. Open the Attribute Editor for the new camera, and open the Environment section. Click on the Create button next to Image Plane. The Attribute Editor window will now switch to the Attribute Editor for the Image Plane. Open the Placement section and click on Fit to Resolution Gate. This will ensure that your image plane will fill the entire rendered scene.
STEP TWO While you are still in the Attribute Editor for the Image Plane, Click on button the Map next to Texture and map an EnvSky. The EnvSky node is located in the Environment Textures section of the Create Render Node window.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (2 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
STEP THREE You will now set the colors for your environment. In the Attribute Editor for the EnvSky, Set the following attributes: ● Sun Brightness to 1, 1, 0.5 ● Halo Brightness to 0.35, 0.36, 0.5 ● Under Atmospheric Settings, Set the Sky Brightness to 0.56, 0.617, 1.0 To change any of the color values, select the color icon next to the attribute. This will open the Color Chooser. Make sure you are using the RGB values by checking the RGB box near the bottom of the window. You can then type the values in manually. NOTE: To open the Attribute Editor for the EnvSky, select the 3D Icon for the EnvSky texture and open the Attribute Editor. at the top right Click the Goto Output Selection Button side. This will take you to the EnvSky Attribute Editor. STEP FOUR Open the Floor Attributes section for the EnvSky, Map the color of the floor to a 2D Fractal texture. Change the Color Gain to a Dark Green and the Color Offset to a Dark Brown. This will be your floor. Select Camera 1 and Select > Panels > Look Through Selected. Turn on the Resolution Gate by selecting View > Camera Settings > Resolution Gate. Render this view by selecting Render > Render into New Window.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (3 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
STEP FIVE When you render with the floor turned on, you may encounter a bright red surface for part of the floor. This is due to the fact that your camera is rendering a point that is below the Floor Altitude. You can fix this by either lowering the Floor Altitude, raising the look at point of the camera, or scaling the 3D icon. In this case we are going to scale the icon. Select the EnvSky icon in the perspective view window. In the Channel Box set the Scale X Y Z to 5. Re-Render your scene. You should now have a floor that extends to a vanishing point.
STEP SIX You are now ready to add clouds to the scene. Open the Cloud Attributes section in the Attribute Editor for the EnvSky. Click the box next to Use Texture to turn it on. Click the Map button next to Cloud Texture. This will open the Create Render Node window. Select a Cloud Texture.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (4 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
STEP SEVEN Preview your sky by rendering the Camera 1 view. You will notice clouds in the scene but they are faint. You can make them more pronounced by setting the density. Set the Density under the Cloud Attribute of the EnvSky to 2.0. Render your scene. You should now see clouds in the sky.
STEP EIGHT Switch to your persp camera. If you take a close look at the 3D icon for the EnvSky, you will notice that there is a point that represents the sun. By adjusting the Elevation, Azimuth and Size, you will change the position and size of this point. Set the Elevation to 90 degrees. This will position the sun directly in the middle of the sky and also produce the brightest light. Notice on the 3D icon, that the sun icon has moved directly to the top middle of your icon. Render the scene. You should now see a bright blue sky.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (5 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
STEP NINE You will now position the sun so that it appears in your scene. To do this you will need to align the line that represents the sun to intersect a point in your image plane. Make the following changes to position and size of the sun so that it will be seen in the image plane. ● Elevation to 10 ● Azimuth to 0 ● Size to 3.0 If you imagine the line on the 3D icon representing the sun going off to infinity, it will intersect the image plane which in turn will render the sun in your image. You may need to switch to your persp view and zoom out to see this. Render the Scene. Notice how the color of the sky changes in relation to the elevation of the sun. At an elevation of 90, you get an image that has the brightest possible sky. At a lower elevation your sky begins to change to a darker color. However the appearance of the sun does not seem quite bright enough. In this case we will increase the total brightness to get a nice sunset. Increase the Total Brightness to 3.0. Render the Scene. You should now have a decent looking sunset. Save your File. CONCLUSION You have now setup an EnvSky texture that will produce an environment complete with sun and clouds. There are many attributes to experiment with on this texture. You can achieve some interesting results by adjusting the some of the Atmospheric and Cloud attributes.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (6 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky
In the next lesson you will use this file and learn how-to achieve realistic shadows based on the position of the sun. Download the completed envSky.ma [~60k] Go to How to create realistic shadows using envSky. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/ (7 of 7) [3/7/2000 14:45:46]
Assistant Online - Maya/How Tos/Rendering/Environment Sky Shadows
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / EnvSky_Shadows
HOW TO CREATE REALISTIC SHADOWS WITH ENVSKY
By Steve Christov
Maya Complete Rendering This lesson is a continuation of How to create a realistic sky using envSky. In this lesson you will use your environment sky texture from the last lesson and link a Play Movie [~800k] directional light to the elevation and azimuth that will simulate the shadows cast when you animate the position of the sun. In the final lesson you will learn how to "grow" a tree in Paint Effects from a simple black brush stroke - How to create a tree using Paint Effects. STEP ONE Open Env_Sky.ma file that you saved from the last lesson. In the Attribute Editor for the EnvSky, Set the Elevation and Azimuth to 0. Set the Total Brightness to 1.0. Providing you have not moved or rotated the 3D icon the sun position should be lined up along the Z axis.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/index.html (1 of 6) [3/7/2000 14:45:57]
Assistant Online - Maya/How Tos/Rendering/Environment Sky Shadows
STEP TWO You are now ready to create a directional light and link it into the attributes of the EnvSky texture. Create a Directional Light by selecting Lights -> Create Directional Light. You will want this light to cast shadows so you will need to turn on shadows. Open the Attribute Editor for the light. In the shadows section, Click the box next to the Use Depth Map Shadows. You will notice that the light is pointing at the sun rather than away from it. Rotate the light 180 in the Y axis. This will align it properly. STEP THREE With the light selected, Group it to itself by selecting Edit > Group. In the Attribute Editor Rename this node lightLinker. STEP FOUR Open the Hypergraph window and holding the shift key, Select the lightLinker node and the place3dTexture node for EnvSky. Select Graph > Up and Downstream Connections. With the Middle Mouse Button, Drag the EnvSky1 node onto the lightLinker node. In the Connection Window that opens, click on Elevation on the left side, then click on Rotate X on the right. This connects the Elevation on the EnvSky node to the Rotate X attributes on the lightLinker node. Close the Connection Editor window.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/index.html (2 of 6) [3/7/2000 14:45:57]
Assistant Online - Maya/How Tos/Rendering/Environment Sky Shadows
STEP FIVE In the Hypergraph window, click on Rendering > Create Render Node window. If you were to directly connect the azimuth to the directional light you would find that as you adjust the azimuth your light would rotate in the opposite direction. In this case a reverse node will be used to correct this. In the Create Render Node window, click on the Utilities tab. Under General Utilities section, Create a Reverse node.
STEP SIX In the Hypergraph window, Drag with the Middle Mouse Button, the EnvSky1 node onto the Reverse node. This will open the Connection Editor. Connect the Azimuth on the left side, with the Input X on the right side. In Hypergraph, Drag the Reverse node onto the lightLinker node. In the Connection Editor, Connect Output X to the Rotate Y. Test your light connection by opening the Attribute Editor for the EnvSky node, and changing the Elevation and Azimuth settings. You should now notice that the directional light will rotate along with the Elevation and Azimuth. STEP SEVEN Create a plane, by selecting Create > NURBS Primitive > Plane. Because you are unable to cast shadows on the floor of the EnvSky, you will need to turn it off. Open the Attribute Editor and Uncheck the box next to Has Floor. Scale the Plane out to roughly 35 units. Create a new Lambert material in the Hypershade, Change the color of the new Lambert to white. This will make it easier to see the shadow. http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/index.html (3 of 6) [3/7/2000 14:45:57]
Assistant Online - Maya/How Tos/Rendering/Environment Sky Shadows
Assign this material to the Plane. Select Create > NURBS Primitive > Sphere. Move the sphere up in the Y axis. This will be your shadow casting object and will make it easier to see where the shadow will fall. Assign a new material to the sphere. Move the sphere so that it sits just above the floor. Select Lights > Create Ambient Light. Move the light to a point in front of the cone. Set the Intensity to 0.5. STEP EIGHT Position Camera1 in your scene. The most effective positioning of the camera when using an EnvSky is to point the camera slightly towards the sky. Move the camera away from the cone to see a good portion of the floor in front of it. This is where your shadow will be cast. Make sure that the camera is not positioned past the edge of the plane. STEP NINE You are now are going to animate the clouds. Select the 3D icon for the cloud. Move it 6 units in the Z axis. Set a key at time 1 by selecting Translate Z in the channel box and with the right mouse button select Key Selected from the drop down menu. Set another key for the Rotate X attribute value at time 1. Move the time slider to time 100. Change the Translate Z of the icon to 0 and set a key. Change the Rotate X to 60 and set another key.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/index.html (4 of 6) [3/7/2000 14:45:57]
Assistant Online - Maya/How Tos/Rendering/Environment Sky Shadows
STEP TEN You are now ready to animate the setting of the sun. Move your time slider to 1. Set the elevation attribute on the EnvSky to 75 and click the attribute with your right mouse button and select Set Key. Change the time slider to 100. Change the elevation to 0 and Set a Key. Press Play, you should now see the EnvSky icon animate the elevation over time. Set up your Render Globals to render out 100 frames from Camera1. Save your file and then render out the frames. CONCLUSION You have now constructed an EnvSky that will cast accurate shadows according to the position of the sun. Click on the image to get a "time lapse" animation of a setting sun. Pay attention to the length and direction of the shadow as the sun sets.
Play Movie[~800k]
You can further enhance the animation by keying the size and total brightness of your sun as it sets to produce a more dramatic sunset. You may also want to key the ambient light slowly to zero intensity at around frame 80 so that your objects fade completely to black. In the next lesson you are going to replace the primitive sphere with a black stroke painted onto the plane and adjust attributes in Paint Effects until you produce a tree similar to the one above. You will then assemble all the elements to produce an animation like the one above. Go to - How to create a tree using Paint Effects. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/index.html (5 of 6) [3/7/2000 14:45:57]
Assistant Online - Maya/How Tos/Rendering/Environment Sky Shadows
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/index.html (6 of 6) [3/7/2000 14:45:57]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/img/six_lrg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/img/six_lrg.gif [3/7/2000 14:46:21]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/img/six_a.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky_shadow/img/six_a.gif [3/7/2000 14:46:24]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/img/three_lrg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/img/three_lrg.gif [3/7/2000 14:46:28]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/img/four_lrg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/img/four_lrg.gif [3/7/2000 14:46:32]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/img/six_lrg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/env_sky/img/six_lrg.gif [3/7/2000 14:46:34]
Assistant Online - Maya/How Tos/Rendering/Ghost Shader
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Ghost Shader
HOW TO CREATE A GHOST SHADER Maya Complete Rendering
by Terry Stoeger
In this lesson, you will learn how to create a shading network that has a soft, fuzzy look. You will be using the SamplerInfo utility node and a Ramp texture to achieve a transparent drop-off effect.
Play Movie {433 k}
STEP ONE Select Window -> Hypershade to open it. Create the following nodes: ● Lambert Surface Material (With Shading Group turned on) ● SamplerInfo utility node ● Ramp texture (With New Texure Placement turned off) STEP TWO You will be connecting the Facing Ratio attribute of the samplerInfo to the V Coord of the Ramp. The Facing Ratio produces a value that ranges between 0 and 1 depending on the normal of the surface to the camera eye (normal facing Camera Eye = 1; perpendicular to Camera Eye = 0). In the Hypershade, Drag and Drop with MMB samplerInfo onto the ramp texture. This will open the Connection Editor with the samplerInfo in the Outputs column and the ramp texture in the inputs column. Expand the UV Coord in the Inputs column. Click on the Facing Ratio attribute in the Outputs column and then click on V Coord. This Connects the samplerInfo's FacingRatio to the Ramp's V Coord. Close the connection editor.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ghost_shader/ (1 of 3) [3/7/2000 14:46:47]
Assistant Online - Maya/How Tos/Rendering/Ghost Shader
STEP THREE Double click on the Lambert Shading Group to open the Attribute Editor. Change the Color to a light gray, green, or blue for the ghost's color. You will now map the ramp to the transparency. Drag and Drop with MMB the ramp texture to the Transparency slider of the Lambert Shading Group.
STEP FOUR Double click on the Ramp Texture to open the Attribute Editor. Change the ramp colors to a dark grey and white as show in this figure. Also change the Interpolation to Smooth. For a more ghostly result, make the material node's Incandescence a dark blue and add a glow by opening the Special Effects section and increasing the Glow to .6. Do a test render and experiment with different ramp settings. CONCLUSION You have now constructed a Shading Network that creates some interesting transparent effects. This technique could also be used for other attributes (Incandescence, Specular Color, Diffusion, etc...). The ramp colors could also be mapped with a Fractal or a file texture
Play Movie {433 k}
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ghost_shader/ (2 of 3) [3/7/2000 14:46:47]
Assistant Online - Maya/How Tos/Rendering/Ghost Shader
(image) for a broken, cloudy effect. Try changing the colors for a different look. This works well for glass (like a jelly jar). Shift-Click to download the finished ghost shader. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ghost_shader/ (3 of 3) [3/7/2000 14:46:47]
Assistant Online - Maya/How Tos/Rendering/Gobo
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Gobo
HOW TO CREATE A LIGHT GOBO WITH BARN DOORS
by Robert Magee
MAYA Complete Rendering In this lesson, you will learn how to simulate the shadow coming from a window with blinds using a light gobo. You will create the blinds by texture mapping the color of your spotlight, then you will set up the spotlight's barn doors to complete the effect.
Play Movie [~160kb]
STEP ONE Create a spotlight. Use the Show Manipulator tool to reposition the light so that it is looking down at your scene. In the Attribute editor, change the light's Cone Angle to 80.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/light_blinds/ (1 of 3) [3/7/2000 14:47:12]
Assistant Online - Maya/How Tos/Rendering/Gobo
STEP TWO In the Attribute editor, click on the Map button next to Color. Choose a grid texture. This texture will act as the gobo which will render the window blind effect. Change the Grid's U Width to 0 and it's V Width to 0.5. Click on the place2DTexture tab and change the Repeat V to 16. Now you have more blinds. Test render your scene to see how the gobo is working. The blinds are working fine but the shape of the window needs to be more rectangular. You will need to set up the spotlight's barn doors. STEP THREE In the Attribute editor, click on the spotLightShape node and go to the Light Effects section. Turn Barn Doors to On. With the light selected, select Panels -> Look through selected. You are now looking through the spotlight. This will make it easier to preview the barn doors. Select the Show Manipulator tool. Now barn door manipulators are available in the view. Click drag on them to set up the shape of your window. You may need to increase your light's view angle to set up the shape you want. This example used a View angle of 100. STEP FOUR Test render the scene. Now the window has a rectangular shape. If you want to animate the blinds opening and closing then you can set keys on the grid texture's V width. Animate it from a value of 1.0 to 0.25.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/light_blinds/ (2 of 3) [3/7/2000 14:47:12]
Assistant Online - Maya/How Tos/Rendering/Gobo
CONCLUSION You can combine barn doors and a texture mapped light to create a number of gobo effects. The shadow from the leaves of a tree, as well as other effects, can be easily simulated using a similar technique. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/light_blinds/ (3 of 3) [3/7/2000 14:47:12]
Assistant Online - Maya/How Tos/Rendering/Aliasing Overview
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Aliasing Overview
ALIASING ARTIFACTS IN MAYA: A TECHNICAL OVERVIEW This document describes some of the key issues to be addressed which affect the quality of an image's aliasing when rendering in Maya.
by Andrew Woo
You will learn how to look for some of the causes of aliasing then address these issues while maintaining good aliasing and faster rendering times. The Maya renderer offers many attributes to help you solve aliasing problems on a project by project basis. This technical overview discusses several ways you can efficiently improve image quality when rendering. This document is a PDF file and can be viewed/printed using Adobe Acrobat Reader. PDF file [~619 k] Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/overview_aliasing/ [3/7/2000 14:47:20]
images by Chris Beaumont
Aliasing Artifacts in Maya: A Technical Overview Maya 1.0.1 IRIX and Maya 1.0 NT By Andrew Woo Alias|Wavefront a Silicon Graphics Company AP-M-AA-01
Aliasing Artifacts in Maya: A Technical Overview Algorithms: Maya Rendering Version 1.0, March 1998 ã September 1998, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A, All rights reserved. Assist Publishing Group: Robert Magee, Tracy Barber Maya 1.0 Rendering Team: Sanjay Bakshi, Silviu Borac, Josh Cameron, Jim Craighead, Renaud Dumeur, Antoine Galbrun, Philippe Limantour, Ryan Meredith, Chris Patmore, Andrew Pearce, Joe Spampinato, Kelvin Sung, Chris Thorne, Mamoudou Traore, Greg Veres, Gianluca Vezzadini, Changyaw Wang, Andrew Woo. A document by Andrew Woo Cover image credit: Chris Beaumont The following are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited: AliasÔ MayaÔ Maya ArtisanÔ Maya F/XÔ Maya PowerModelerÔ
MELÔ Alias MetamorphÔ OpenAliasÔ Alias OpenModelÔ Alias OpenRenderÔ
Alias PowerTracerÔ Alias QuickRenderÔ Alias QuickShadeÔ Alias QuickWireÔ Alias RayCastingÔ
Alias RayTracingÔ Alias SDLÔ Alias ShapeShifterÔ Alias StudioPaintÔ ZaPiT!Ô
MediaStudioÔ MultiFlipÔ VizPaint2DÔ
3DesignÔ
The following are trademarks of Alias|Wavefront, Inc.: Advanced VisualizerÔ Wavefront ComposerÔ DynamationÔ
ExploreÔ Wavefront IPRÔ KinemationÔ
Graph Layout Toolkit Copyright ã 1992-1996 Tom Sawyer Software, Berkeley, California, All Rights Reserved. All other product names mentioned are trademarks or registered trademarks of their respective holders. Any forward looking statements in this document are speculative and are based on current assumptions and in no way imply Alias|Wavefront will at any future time act upon said statements. This document contains proprietary and conÞdential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, nor its employees shall be responsible for incidental or consequential damages resulting from the use of this material or liable for technical or editorial omissions made herein.
Alias|Wavefront ❚ 210 King Street East ❚ Toronto, Canada M5A 1J7
Aliasing Artifacts
Technical Overview
When rendering in Maya, the quality of an imageÕs aliasing is one of the key issues that must be addressed. Aliasing artifacts can impact the look of an image and create unsatisfactory results. One method of dealing with these artifacts is to increase the Shading samples in MayaÕs Render Globals. While this may solve the aliasing problem, it is often not the most efficient way for the Maya renderer to deal with the aliasing artifacts. This means that renderings take longer when in fact it may have been possible to solve the problem another way. As well, if you find that the problem can be fixed using another method which does not require increased shading samples, it is very easy to forget to reset the original anti-aliasing values. Thus, the Maya renderer will continue to run a lot slower than needed. This paper has been written to help you identify and classify typical aliasing artifacts, with some understanding of the technical algorithms, so that you can optimally solve these artifacts with minimal impact to the performance of the renderer. This document will also help you recognize those cases where eventually the shading samples will need to be increased. It can be argued that all the aliasing artifacts should be taken care of automatically, without much user intervention. Our experience has found that automatic solutions may limit what you can achieve and prevent you from finding the desired balance between quality and performance. The Maya renderer therefore offers many attributes to help you solve the aliasing problems on an project by project basis. These attributes ensure that you do not hit a wall when a certain image quality is desired, or when a certain performance limit needs to be satisfied. Better automated solutions will be sought through continued research.
THE CAUSES OF ALIASING Following is a series of the most common aliasing artifacts, with visual examples so that you can easily identify the type of artifacts for future references.
Introduction Edge Aliasing
Edge Aliasing The Maya renderer employs a 32-bit, A-buffer to anti-alias polygon edges. This provides an analytic solution for producing very high quality edge anti-aliasing results. Thus edge anti-aliasing is separated from shading anti-aliasing, which also buys some performance gains, because usually a lot less shading samples are required for good overall anti-aliasing. Once you identify that the problem is that of edge aliasing, you can go to Render Globals ® Render Quality ® Edge Anti-aliasing to set the attribute to either High Quality or Highest Quality. The following image shows two sphere images that show high and low quality edge aliasing.
Good quality aliasing
Poor quality aliasing
High and low quality edge aliasing Since it is difficult to see the jagged effects well, the images are resized to show the aliasing more closely.
Poor quality aliasing
Good quality aliasing
Close-up of high and low quality edge aliasing
Thin Geometry Aliasing: In cases of very thin pieces of geometry, the 32-bit mask for edge antialiasing may not be adequate. This usually occurs when the polygons themselves are less than one tenth of a pixel wide. Under such situations, the problem gets worse as you see flicker over an animation. Therefore a multi-resolution bit mask will be implemented in Maya 1.5 IRIX and Maya 2.0 NT to help deal with thin geometry.
2 Aliasing Artifacts in Maya
The Causes of Aliasing Aliased Edges Through Transparency
Aliased Edges Through Transparency The 32-bit, A-buffer mask only applies to the first visible fragments in a pixel. If there are surfaces behind a transparent surface, the mask does not apply, and the renderer needs to resort to point sampling. Thus the Shading samples attribute for that surface needs to be increased to improve both the shading and the edge anti-aliasing of those surfaces. Unfortunately, the same limitation exists for raytracing.
Specular Highlight Aliasing The material used for rendering is also a very important consideration. The more common (isotropic) materials used by our customers include:
Note:
■
Phong
■
PhongE
■
Blinn (based on the Torrance-Sparrow model) It is mathematically provable that the highlight hotspots for the above materials all sit in the same spot. So the main difference between those models are how their highlights decay.
The following image has 3 thin cylinders with materials, from top to bottom, Phong, Blinn + PhongE (with diffuse set to 0). It is important to note that the Phong model results in a very sharp, hard edge for its specular highlight. With such a hard highlight, animations with thin-curvy or (nosily) bump mapped surfaces can usually result in extreme changes in the specular behavior, and thus resulting in flickering. The PhongE model is slightly better in its harsh edges. The Blinn model is the best in terms of a soft highlight. As a result, the same thin-curvy or bump mapped surface will appear much cleaner when animated.
Phong
Blinn
PhongE
Material highlights Technical Overview 3
Introduction File Texture Aliasing
Tip:
Increasing the shading samples may not help entirely; the shading samples will need to be very high, until the artifacts go away. The choice of the material can be a much more efficient alternative.
File Texture Aliasing When particular file textured surfaces are shimmering (or flickering) over an animation, it is also best not to play with the shading samples first. The first choice should be to play with the File texture ® Filter ® Filter and File texture ® Filter ® Filter offset values. First, it is recommended that you do not set the Filter attribute to 0, because the defaults for Filter and Filter offset are set so that in most cases, you get the best quality images. In this case, filtering means that there is a mipmap structure for texture mapping. In other words, the renderer stores multiple resolutions of the same texture. For example, if you have a 256x256 image - the renderer stores the 256x256, then 128x128, then 64x64, then 32x32, etc. The Maya renderer computes, internally, a filter size value so the renderer knows when to access which level (which resolution) to get the good quality results. The user can play with the Filter and Filter offset attributes, which act as multiplier and adder to the filter size values, respectively, to get smoother or crisper pictures. Think of it conceptually as FILTER * filter_size + FILTER_OFFSET. By setting Filter to 0 or a very small value, you're telling the renderer to ignore the internal filter size computation so that it completely relies on the Filter offset to get you to the right resolution levels. However, in some situations, playing with the Filter values will not help. Then the more optimal solution would be to employ a higher order filter, such as the quadratic filter (File texture ® filter ® quadratic). The following image has a file texture mapped with the default mipmap filter (on the left) and a quadratic filter (on the right). The quadratic filter does more computations in projecting pixel information to texture space, thus resulting in much cleaner results. Be sure to note that this method also increases rendering time, and should not be invoked unless the filter alternative is not useful.
Texture aliasing
4 Aliasing Artifacts in Maya
The Causes of Aliasing Depth Map Shadow Aliasing:
images by Chris Beaumont
The intention of the filter attributes, discussed earlier, is not to blur the images as a special effect. It may work in certain circumstances for the mipmap setting coincidentally, but likely will not work for the other settings. The attributes are meant as an adjustment factor to get the best image quality. For example, the following images show an exaggerated Filter of 2.6 when applied with mipmap and quadratic filters, respectively. Notice that exaggerated filter values will result in blockiness of the quadratic (and higher order filters) textures.
Mipmap texture
Quadratic texture
Depth Map Shadow Aliasing: The Maya 1.0 renderer had image quality problems where the depth map shadows often display very blocky, shadow borders. Thus as a workaround, it is recommended that the resolution of the shadow depth map be increased. This workaround is not ideal since it can increase both rendering time and memory usage. This problem has been fixed since Maya IRIX 1.0.1 and Maya NT 1.0, and you should not be employing such high resolutions any more. The following example shows a 256x256 resolution shadow depth map, casting a shadow from a sphere. Note the jaggies at the shadow borders. Increasing the shading samples will not help the situation.
Technical Overview 5
Introduction Depth Map Shadow Aliasing:
Poor depth map shadow aliasing To improve the anti-aliasing of such shadow border jaggies, first increase the light's Shape ® Dmap Filter Size. The below image uses a filter size of 3. The filter size indicates the level of neighboring shadow map pixels that are used to filter the shadow borders. Note:
A larger Filter size beyond 4 is not recommended. If more than 4, each shadow sample will need to evaluate far too many neighboring shadow map pixels. The final image shows even better anti-aliasing, when the Shape ® Dmap Resolution is set at 512x512.
Filtered depth map shadow
High resolution depth map shadow
6 Aliasing Artifacts in Maya
The Causes of Aliasing Light Fog Shadow Aliasing:
Finally, if your scene allows you to narrow the cone angle for the spotlight (or reduce the orthographic width of a directional light) without adversely affecting the outcome of the lighting, then you will get crisper shadows without having to increase the shadow map resolution. This is because the resolution of the shadow depth map will be focused in a smaller region, which, in effect, gives it much better resolution.
Light Fog Shadow Aliasing: Light fog shadows only work with depth map shadows. This is because the algorithm for calculating light fog shadows projects the view vector onto the shadow depth map. Then, for each shadow map pixel that the projected view vector visits, it asks whether it is in shadow or not. However, since this is needed for each view vector, and traversing the many shadow depth map pixels can increase rendering time, the renderer stochastically samples the shadow depth map pixels, capped by the Shape ® Depth Map Shadow Attributes ® Volume shadow samples value. Note the first image below, where the Depth map resolution is set at 512x512, but the Volume shadow samples is set at only 15. Notice the dicing artifact with respect to the light fog shadows, sometimes capturing the occluding surface's shadow, sometimes not. In an animation, this may cause flickering artifacts as well. Increasing the shading samples will not help this situation either. But increasing the Volume shadow samples to 50 will produce a much cleaner image, as seen in the second image below. Note that you should only worry about this attribute when you have small or skinny surfaces which may miss/hit the light fog shadow computations For example, if the occluding surface is a big sphere, there would not have been any artifacts.
Aliasing artifacts
Improved aliasing
Aliasing artifacts in fog shadow
Technical Overview 7
Introduction Motion Blur Visibility Aliasing:
Motion Blur Visibility Aliasing: To anti-alias motion blurred images properly can be tricky. The renderer does not use the standard distributed raytracing because it relies on raytracing and dicing artifacts that are significant. Alias|Wavefront invented a new (and patented) approach which produces an analytical solution to the edge anti-aliasing during motion blur. The following image shows the progression of image quality when certain attributes are increased. The first image indicates what happens when the Edge anti-aliasing is set at Low. In this case, all aliasing contains artifacts. With the next image, the Edge anti-aliasing is set at High. With the next image, Edge anti-aliasing is set at Highest which invokes more shading samples that do a much better job at spatial anti-aliasing. In the final image which uses higher initial Shading samples, and sometimes Visibility samples, the image contains well aliased motion blur. This is elaborated in Maya Software Rendering, Assistant Online [Pearce, Sung]. Low Quality
High Quality
Geometric Aliasing
Spatial Shading Aliasing
Highest Quality
Temporal Shading Aliasing
Highest Quality (With 16 shading samples)
Geometric vs. spatial vs. temporal aliasing
Image Plane Aliasing: If your image plane appears aliased, increasing the global shading samples will not help. The only way to improve the anti-aliasing of the image planes would be to increase the attribute values of Imageplane ® Shading samples and Imageplane ® Max shading samples. If the image of the image plane matches the resolution of the rendering, then additional anti-aliasing will not be required.
8 Aliasing Artifacts in Maya
The Causes of Aliasing Check List for other Common Animation Aliasing Artifacts:
Check List for other Common Animation Aliasing Artifacts: ■
■
Flicker due to screen space or min-screen tessellation. With a surface set at screen space or min-screen tessellation, the tessellation per frame can be different. When different, you can see flickering, for example, due to solid textures receiving very different (x,y,z) coordinates to texture map. Flicker due to filter or filter offset set to very small numbers. This was
explained in the file texture section above. ■
Flicker due to very noisy texture(s). With very noisy textures (other than file textures), usually the texture does not know how to antialias itself. If it does, it usually has Filter and Filter offset attributes, which you can tweak, as discussed in the file texture section. The other option is to apply a convert-solid-to-2d-texture operation, in which a snapshot of the noisy texture is completed to create a file texture that matches the procedural texture. Rendering with this file texture, and its ability to anti-alias, may resolve the flickering problems.
■
Exaggerated aliasing due to incorrect usage of multi-pixel filtering. If your non-filtered rendering already looks aliased, having multi-pixel filtering turned on will exaggerate the aliasing even more. The multipixel filtering is meant to improve the quality of thinline situations and when smoothing a good image quality result is needed.
■
Flicker or dicing due to raytracing soft shadows with small number of shadow samples. Soft shadows occur when Light ® Shadows ® Light radius is non-zero. If soft shadows are desired, it is best to use
shadow depth maps instead of raytrace soft shadows. It will require many samples to avoid flicker in the raytrace soft shadows, which becomes very time consuming for the renderer. Raytrace shadows are useful, as opposed to depth map shadows, mainly when shadows from transparent objects need to show colored shadows.
Raytraced aliasing artifacts
Check List for Mistaken Aliasing Artifacts: ■
Aliasing due to composite rendering. It is very common mistake to set the Render Globals ®ÊComposite render to On, then noticed that the rendered results look very aliased. This is because the composite render option is intended to look aliased before compositing, but should be perfect after compositing. This means that a composite render does not want to add the residue of the background color into the pixel result.
Technical Overview 9
Introduction Conclusion
■
Nickeling artifacts with tessellation. It is very easy to mistake the nickeling found at the edge of a surface as an anti-aliasing problem. This problem is in fact a tessellation issue and increasing the shading samples will not help. Rather, select the surface, and increase its tessellation parameters.
Nickeling
Nickeling at the edge of an object ■
Terminator problem. This is a common artifact in computer graphics, not particular to our software. This staircase of black polygons is due to the combination of coarse tessellation of the surface, and raytracing shadows. The only workaround for this problem is to increase the tessellation of the surface.
Staircase effect
■
You're out of options... Even if you need to increase the Shading samples, don't do it globally yet if this is only a problem for a small,
select number of surfaces. Instead, select the troubled surfaces, then edit the Shape ® Render Stats ® Shading Samples Override ® Shading Samples so that only those surfaces will have their shading samples increased, without having to affect the entire scene.
Conclusion When setting up a rendering it is important to remember that aliasing may occur for all of the reasons mentioned in this document. Be sure to try the various methods outlined here to fix aliasing issues before increasing the shading samples and slowing down rendering time. These tips should help you find the right balance between quality and performance.
10 Aliasing Artifacts in Maya
Assistant Online - Maya/How Tos/Rendering/SW Rendering Overview
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / SW Rendering Overview
MAYA SOFTWARE RENDERING: A TECHNICAL OVERVIEW
by Andrew Pearce and Kelvin Sung
This document describes some of the technical details of the Maya 1.0 Software Renderer. It assumes some technical knowledge of the inner workings of a renderer. There are many sections of this document which can be helpful to non-technical people as well. The document is laid out in two sections: The Rendering Pipeline: This section outlines the algorithms that the renderer uses from the moment it is invoked to the final pixel output. Understanding shading networks describes the power of the Maya shading network and how to tap that power interactively. It is hoped that this document will give you the knowledge that will help you to effectively, efficiently and optimally use the Maya 1.0 Renderer for your production’s needs. This document is a PDF file and can be view/printed using Adobe Acrobat Reader. PDF file [720 k] Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/overview_rendering/ [3/7/2000 14:47:46]
Maya Software Rendering: A Technical Overview By Andrew Pearce and Kelvin Sung
Alias|Wavefront a Silicon Graphics Company AP-M-SWR-01
Maya Rendering: A Technical Overview Algorithms: Maya Rendering Version 1.0, March 1998 ã September 1998, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A, All rights reserved. Assist Publishing Group: Bob Gundu, Robert Magee Maya 1.0 Rendering Team: Sanjay Bakshi, Silviu Borac, Josh Cameron, Jim Craighead, Renaud Dumeur, Antoine Galbrun, Philippe Limantour, Ryan Meredith, Chris Patmore, Andrew Pearce, Joe Spampinato, Kelvin Sung, Chris Thorne, Mamoudou Traore, Greg Veres, Gianluca Vezzadini, Changyaw Wang, Andrew Woo. A document by Andrew Pearce & Kelvin Sung Cover image credit: Balloon Girl by Chris Landreth, and the Alias|Wavefront Bingo Team. The following are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited: AliasÔ MayaÔ Maya ArtisanÔ Maya F/XÔ Maya PowerModelerÔ
MELÔ Alias MetamorphÔ OpenAliasÔ Alias OpenModelÔ Alias OpenRenderÔ
Alias PowerTracerÔ Alias QuickRenderÔ Alias QuickShadeÔ Alias QuickWireÔ Alias RayCastingÔ
Alias RayTracingÔ Alias SDLÔ Alias ShapeShifterÔ Alias StudioPaintÔ ZaPiT!Ô
MediaStudioÔ MultiFlipÔ VizPaint2DÔ
3DesignÔ
The following are trademarks of Alias|Wavefront, Inc.: Advanced VisualizerÔ Wavefront ComposerÔ DynamationÔ
ExploreÔ Wavefront IPRÔ KinemationÔ
Graph Layout Toolkit Copyright ã 1992-1996 Tom Sawyer Software, Berkeley, California, All Rights Reserved. All other product names mentioned are trademarks or registered trademarks of their respective holders. Any forward looking statements in this document are speculative and are based on current assumptions and in no way imply Alias|Wavefront will at any future time act upon said statements. This document contains proprietary and conÞdential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, nor its employees shall be responsible for incidental or consequential damages resulting from the use of this material or liable for technical or editorial omissions made herein.
Alias|Wavefront ❚ 210 King Street East ❚ Toronto, Canada M5A 1J7
Maya Software Rendering
Technical Overview
This document describes some of the technical details of the Maya 1.0 Software Renderer. It assumes some technical knowledge of the inner workings of a renderer. There are many sections of this document which can be helpful to non-technical people as well. The document is laid out in two sections: ■
The Rendering Pipeline
■
Understanding the Shading Network.
The Rendering Pipeline on page 1 outlines the algorithms that the renderer uses from the moment it is invoked to the final pixel output. Understanding shading networks on page 21 describes the power of the Maya shading network and how to tap that power interactively. It is hoped that this document will give you the knowledge that will help you to effectively, efficiently and optimally use the Maya 1.0 Renderer for your productionÕs needs. The Rendering Pipeline assumes you have a basic understanding of
rendering algorithms. Understanding the Shading Network assumes your are familiar with basic Maya Dependency Graph connections, nodes and attributes.
THE RENDERING PIPELINE This section outlines the phases and algorithms the Maya 1.0 Renderer uses in order to produce a final image. Before discussing the steps involved in Maya Rendering, a high-level overview of the algorithm is in order. The Maya Renderer is a hybrid renderer. It uses an EAS (Exact Area Sampling) or A-buffer algorithm for primary visibility from the eye, and then ray traces any secondary rays. EAS computes a coverage mask for the geometry in a pixel, which is more precise than point sampling can produce in all but the most extreme cases. The improved coverage mask results in better edge anti-aliasing of the objects in a scene. Part of the philosophy of the Maya Renderer is that it attempts to solve each part of the rendering process independently, using the
The Rendering Pipeline Step One: Initialize the camera
best method for each rendering problem. Geometric anti-aliasing is solved with EAS completely before the shading is solved, which is solved separately from glow, etc. The Maya Renderer also takes advantage of data cache and instruction cache locality by making each shading call with a vector of samples. If the shader is called with a single sample, the instructions for the shader must be brought into the instruction cache by the computerÕs CPU, and any data that that shader uses must be brought into the data cache. Cache memory works best (fastest) if the next instruction or next data are in the cache. By providing each shader with a vector, or array, of samples, MayaÕs renderer takes advantage of the computerÕs built-in caching mechanism. When an object is encountered that requires ray tracing to compute some component of its shading (ray traced shadows, reflections, and/or refractions), the ray tracer is invoked. The steps involved in rendering are: 1 Initialize the camera 2 Perform shadow depth map computations 3 Compute geometries that are potentially visible for rendering 4 Compute the tile system 5 Render each tile a) Compute visibility for stationary objects b) Compute visibility for moving objects (only if motion blur is selected) c) Compute shading (moving and stationary objects) d) If highestQuality is selected: i) Compute Contrast ii) Compute Extra Shading 6 Composite shaded results
Step One: Initialize the camera The 3D coordinates of the camera to be rendered are determined by evaluating the Dependency Graph (DG) at the current time value. The evaluated parameters of the camera are used to compute the perspective (or orthographic) matrix, and the coordinates of the camera are used to construct the WorldToEye matrix. Image planes to be used during the rendering phase are tested for existence.
Step Two: Perform shadow depth map computations Because the Maya Renderer is a hybrid renderer containing both EAS and ray tracing code, you have the option to either ray trace shadows or to use depth map shadows. This section deals with depth map shadows only, since the depth maps must be computed as a first pass before rendering, while ray traced shadows are computed during the rendering phase.
2 Maya Rendering
The Rendering Pipeline Step Two: Perform shadow depth map computations
The shadow depth map computation is similar to shadow depth map computations for other renderers you are familiar with. A ÒdepthÓ rendering is done from the point of view of the light source, and later used during the rendering phase to determine if that light illuminates a given point (i.e., if the point is obscured by any other object closer to the light, then it is in shadow). For an excellent introduction and overview of depth map shadowing techniques, see SIGGRAPH Ô87 Reeves, Salesin and Cook, ÒRendering Antialiased Shadows with Depth MapsÓ, pp. 283-291. This section discusses what is unique about the Maya Depth Map Shadows. In Maya, Depth Map Shadows are available from each of pointLights, directionalLights, and spotLights. In the attribute editor for these lights, the Depth Map Shadow section contains settings to allow you to Read/Write/Reuse Dmap. In all dealings with Depth Map Shadows in the UI, Dmap means Depth Map. These settings cause the depth maps to be written to or read from disk and should be enabled when doing iterative render tests on a scene with many shadows, or when there is only a camera fly-by of the scene (i.e., no objects move in the area visible to the light). Be aware that if you set these flags when moving objects or moving lights are present, it may cause your shadows to remain stationary while your objects move in your animation. Another feature of Depth Map Shadows in Maya is the ability to cast volume shadows through fog. The shadowing of the fog is done by examining the shadow map a number of times across the fog volume. The number of times the fog is sampled is controlled by the attribute volumeShadowSamples. Light Fog Volume
Geometry Shadow Viewing Ray
volumeShadowSamples
Figure 1: A side view of a ray penetrating a shadow volume for a spot light. volumeShadowSamples are taken across the penetration interval. To automatically get the best resolution out of your depth map, there is an attribute called useDmapAutoFocus. When this attributeÕs value is true, the renderer automatically computes a bounding volume for the objects in the view from the light source and uses the smallest possible field of view to render the shadow map. This can, however, create artifacts over an
Technical Overview3
The Rendering Pipeline Step Two: Perform shadow depth map computations
animation if the bounding box of the objects in your scene changes; the area covered by a shadow map changes, possibly creating aliasing artifacts in your shadows, or unwanted softening or noise in the shadows. Those familiar with Depth Maps for shadowing know that there are selfshadowing artifacts that can occur due to the finite resolution of the shadow map. Only one depth value is stored per pixel and if you happen to be shading a point on a surface that lies between samples in the depth map, there is the possibility that the averaged depth from the depth map will incorrectly shadow the point being shaded. In classical depth map shadow algorithms, a jitter or bias is added to the depths before comparison in order to alleviate this artifact. This is also done in Maya. However, Maya has an additional option called useMidDistDmap which modifies the depth map calculation and eventual use. useMidDistMap is on by default. If the depth map is to be used for purposes other than shadowing, then it is best to turn this option off. For those with an interest in the specifics of the algorithm, please refer to Graphics Gems III (Academic Press, ISBN 0-12-409670-0) p. 338. Essentially, Mid Dist attempts to eliminate the need for the jitter or bias parameters by storing the midpoint between the first and second surfaces visible to the light source in the depth map, rather than simply storing the distance to the nearest surface. By doing this, a larger margin for error is provided, thereby mitigating the incorrect self-shadowing problem. Figure 2 shows a simple side view of a depth map situation. The light source is shining on a sphere and a plane. In a normal depth map, Z1 (the distance to the Closest Intersection) is stored in the depth map. When Mid Dist is enabled, Zmid (the halfway point between Z1 and Z2) is stored in the depth map.
Distance Stored
z2 Light
zMid z1
De
pt
h
Next Closest Intersection
Closest Intersection
M
ap
Figure2: Diagram of the value stored for the mid distance depth map. Directional lights can cast depth map shadows in Maya. They have two
possible behaviors. Since directional lights are assumed to be at an infinite distance from the scene (hence the parallel light rays), by default directional lights will cast shadows on the entire scene. The bounding box of the scene is taken and an orthogonal depth map region is created, which contains the entire scene. This can result in shadow depth map resolution problems if the scene is very large, but only a small section of the scene is 4 Maya Rendering
The Rendering Pipeline Shadow Computation and Motion Blur
being viewed, or if the scene changes size dramatically over an animation. To limit the number of objects that are involved in a directional lightÕs depth map, an attribute named useLightPosition is provided at the top of the Attribute Editor for directional lights. Setting this attribute to true makes the directional light take its position (the location of the directional light icon in the modeling view) into account. Objects in the half space defined by the lightÕs position and direction are affected by the directional light and are used in the creation of the shadow depth map. Any objects ÒbehindÓ the directional light are not lit and do not participate in the generation of the shadow depth map. The useLightPosition attribute is not on by default because this is a new behavior which may be unexpected by people coming from other software where directional lights were infinitely far away regardless of icon position in the scene. Another way to optimize shadows is to link the lights only to those objects which you wish to cast and receive shadows. You can also avoid casting shadows from some objects by going to the objectÕs attribute editor and turning the castsShadows flag off under Render Stats. Point lights can cast depth map shadows in the Maya Renderer. By
default, these shadows are produced by casting 6 depth maps in each of the cardinal axes directions (+X, -X, +Y, -Y, +Z, and -Z) from the point lightÕs position in space. Be aware that if you specify a large shadow depth map resolution, there will be 6 depth maps of that large resolution generated. Maya does try to compact the depth maps as much as possible, but large depth maps can still occupy a great deal of memory and take valuable time to render. To further optimize your shadow depth maps from point lights, you can turn individual directions off or on. For example, if there is nothing of interest to cast shadows on the ceiling of your room, you could disable the +Y depth map by un-checking the useY+Dmap attribute in the Depth Map Shadow Attributes section of the point lightÕs Attribute Editor. Spot lights by default use only one depth map. Using only one depth map
has limitations when the angle of the spot light exceeds 90 degrees; the resolution of the depth map must be increased dramatically to keep the shadow quality high. Maya allows you to use up to six depth maps for spot lights by setting the useOnlySingleDmap check box to false in the Attribute Editor for spotlights. When this attribute is set to false, and the cone angle of the spot light exceeds 90 degrees, five or six depth maps are created around the spot light, tiling the faces of an axis-aligned cube with faces in each of the axis directions - much the same as for a point light. The only difference is that a spotlight will only cast five depth maps if the spot light does not shine onto one of the six faces. Just as cubic reflection maps avoid aliasing at the boundaries between faces of the cube, the cubic shadow map is also filtered to avoid artifacts.
Shadow Computation and Motion Blur Basically, shadows do not motion blur in the current renderer. MayaÕs renderer takes only one geometric position (shutter mid) when sampling the shadow map, so even though the geometry moves from A to B to C, the shadow only falls at position B.
Technical Overview5
The Rendering Pipeline Step Three: Compute potentially visible geometries
Methods to work-around this limitation are to use the Mid-distance shadow depth map algorithm, or to output the shadow depth map and process it to add blur before using it in a render. Ray traced shadows will not work in almost every motion blur instance. Light
e.g. Shading this position at Time = 0.7
Position at Time = 1.0
Position at Time = 0
Position at Time = 0.5
Geometry used to compute shadow
Step Three: Compute potentially visible geometries Gathering the objects to be rendered starts by going to all of the Shading Groups and collecting all of the objects contained in each group. Figure 3 shows that there is a ÒhiddenÓ list associated with each shading group which is a list of objects or geometries to be shaded using that shading group. A consequence of this is that if an object is not a member of any shading group, it is not rendered. Figure 3 also shows that there is a hidden partition (much like a partition which you as a user can create) called the renderPartition which contains the shading groups. The renderPartition is hidden from direct manipulation in the interface; changing an objectÕs group membership in the renderPartition is done using shading group assignment in the Multilister. Displacement Material
May or may not be connected to Shaders (material)
Surface Material Volume Material defaultLightList
List of active lights List of connected geometries
renderPartition
SG
SG
SG
SG SG
SG
SG
Pre-defined partition contains all the ÒactiveÓ shadingGroups
Figure 3: Shading Group Relationships
6 Maya Rendering
The Rendering Pipeline Step Three: Compute potentially visible geometries
Given this background, and now that the shadow depth maps have been computed, the rendering pipeline continues as follows: Computation of Visible Geometries For Rendering For each shadingGroup in renderPartition For each geometry in shadingGroup compute geometryÕs boundingBox in screen space if (boundingBox touches cameraÕs viewing frustum) initialize shadingGroupÕs shading network if (initialization succeeds) keep the geometry in the renderableGeometrySet endif endif endfor endfor
Note that the Maya renderer will only initialize a shading network at most once per material. Initializing shading networks does not load file textures. At this point, the renderer is identifying geometries and their associated shading networks that may be visible in this frame. Note:
A similar computation occurs for computing the shadow depth maps; however, shading networks are not initialized at that point, and visibility determination also includes light linking criteria. Displacement shading networks are the exception to this rule - the displacement must be evaluated during a shadow depth map computation to generate the proper shadowing.
For determining which geometries possibly intersect the cameraÕs frustum (frustum is a technical word describing a volume the shape of a pyramid with its point cut off) MayaÕs renderer looks at the near and far clipping planes. Geometry that penetrates the near clipping plane will be clipped to the near clipping plane. Any part of the geometry nearer to the camera than the near clipping plane is eliminated from being rendered. Geometry is not clipped at the far clipping plane in the Maya 1.0 Renderer. If a piece of geometry spans the far clipping plane, it will be rendered in its entirety. If a piece of geometry is beyond the far clipping plane it will not be rendered at all. So there is a type of clipping occurring at the far clipping plane, but it is at the object level, not at the triangle level. Figure 4 shows this clipping relationship. Geometry O1 will be cut by the near clipping plane so that only the portion beyond the near clipping plane is rendered. Geometry O3 will not be rendered at all since it is beyond the far clipping plane, and geometry O2 will be completely rendered because part of it lies between the camera and the far clipping plane.
Technical Overview7
The Rendering Pipeline Step Three: Compute potentially visible geometries
O1 (Object 1)
Far Clipping Plane
Near Clipping Plane
O2 (Object 2)
O3 (Object 3)
Figure 4: Near and Far plane clipping; O1 is partially rendered, O3 is not rendered, O2 is completely rendered.
Far Clipping Plane
Near Clipping Plane
Since MayaÕs renderer uses the bounding box to cull or accept geometry, it is possible that pathological geometries (such as the one diagrammed in Figure 5) can be unnecessarily placed into the renderableGeometrySet. This will not produce incorrect images, merely waste the time needed to process the geometry. In Figure 5, the gray ÒCÓ shaped geometry is unnecessarily placed into the renderable set because its bounding box intersects the viewing frustum even though the geometry itself does not. Break the object up into three separate geometries to solve this problem. Smaller objects shrink the size of the bounding boxes so that they do not contain the interior of the ÒCÓ.
Bounding Box
Figure 5: A grey ÒCÓ shaped object which will incorrectly be placed into the renderable set.
8 Maya Rendering
The Rendering Pipeline Step 4: Computing the tile system
Step 4: Computing the tile system The Maya Renderer ÒtilesÓ the image to be rendered into smaller pixel rectangles. If you have watched the Maya Renderer while it is rendering, you have seen this tiling pattern; areas of low complexity are rendered with larger tiles than areas with high complexity. This section describes why this occurs and how the decision is made about tile sizes. A goal of the Maya Renderer is to keep the amount of memory used to a minimum. One of the ways the renderer attempts to achieve that is by estimating the memory cost of rendering a single tile scanline. A tile is a subsection of an image, and a tile scanline is a single row of pixels in a tile. The Maya Renderer first uses a number of variables to compute the maximum allowable number of triangles that can render in a tile scanline. Factors used in the computation of this number include: ■
is ray tracing enabled?
■
is motion blur enabled?
■
is edgeAntiAliasing enabled?
■
what is the number of shading samples?
■
what is the setting of the Render Globals maxMemoryUse attribute?
■
is multi-pixel filtering on?
■
what is the vector length (the number of samples passed into the shading nodes)?
From these factors a maxTileCost is derived which represents the maximum number of triangles believed to be renderable in a single scanline while still maintaining the given memory limit. Factors that are not included in the estimation of tile cost are shading network complexity and the size of any file textures required to render the geometry in the tile. Each object in Maya has a method to estimate how much memory is required to render it (in terms of triangle counts, number of particles, etc.) in a given screen space window. The Maya Renderer starts by tiling the screen into four tiles to start with, each one quarter of the image resolution. It then estimates the cost of rendering each of the tiles in terms of the most complicated scanline (geometrically speaking) in the tile. If the estimated number of triangles in the most complicated scanline exceeds the maxTileCost, then the tile is subdivided into four new tiles and the same process is applied to each of them in turn. This continues until the maxTileCost criteria is met, or the tile has reached the minimum tile size of 16x16 pixels. Note that at this point, no tessellation has occurred; the renderer has merely collected bounding boxes of the objects in screen space, and gotten estimates from those objects regarding their geometric rendering complexity. From this information, a tile pattern is created to use when rendering the scene.
Technical Overview9
The Rendering Pipeline Step 5: Render each tile
The following pseudo-code describes the tile generation procedure: create four tiles based on the input image resolution Foreach geometry in renderableGeometrySet Foreach tile in tileList approximate tileCost of geometry put geometry into the tile, and update the tileCost if tileCost > maxTileCost Subdivide tile to create new smaller tiles put new tiles in tileList endif endFor endFor
Note:
To save memory, the subdivision of tiles is not really done until rendering begins, but is included in this code for clarity
Step 5: Render each tile So far, you have learned about the generation of shadow depth maps, the determination of renderable geometries, and the computation of the image tiling pattern. The next step in the rendering process is to perform the visible surface determination given the tile and a list of objects visible in that tile. The visible surface and shading computation is broken down as follows: a) Compute visibility for stationary objects b) Compute visibility for moving objects c) Compute shading d) Highest quality setting - compute contrast - compute extra shading samples if necessary Note:
The following sections will discuss non-moving objects and their shading first (step a), then discuss how adaptive sampling works (steps c + d), and finally return to discuss computing visibility for moving objects (step b).
Step a: Compute visibility for stationary objects
The Maya Renderer does not tessellate geometries until it has to. Tessellation is the process of approximating a NURB surface with triangles. Tessellation is a required step because the renderer only knows how to render triangles and volumes, not NURB surfaces. The process of avoiding tessellation until the renderer knows it will have to render the object is called lazy tessellation. By doing lazy tessellation, 10 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
the renderer hopes to avoid tessellating some objects, thus saving on the associated time and memory consumption that would otherwise be incurred. So how does lazy tessellation work? First the renderableGeometrySet is sorted for the tile in order of depth from the camera. Then the renderer only tessellates the front-most surface (or surfaces if two or more surfaces overlap in Z depth from the camera) in the hopes that they will fully occlude the more distant surfaces. If this is wrong, then the renderer will continue and tessellate the more distant surfaces, but in many cases, this saves some amount of work. Figure 6 shows a case where the renderer would first tessellate objects O1 and O2 - because they overlap in Z depth from the camera, the renderer must first determine inter-object occlusions, hence the need to tessellate them both - object O3 would not be tessellated since objects O1 and O2 can potentially occlude O3. Tessellation generally applies only to NURB surfaces, but in the case of displacement mapping, it can also apply to polymeshes.
O1 (Object 1)
O3 (Object 3)
Tile
Z
O2 (Object 2)
Objects in this zone may not have to be tessellated
Figure 6: Depth sorting objects in tiles. Objects O1 and O2 are initially tessellated, while O3 is not, pending visibility determination. Because the renderer is trying to fully determine visibility before moving onto the shading phase, if objects O1 or O2 are potentially transparent (i.e., they have a transparency map or have their transparency set to a constant, non-zero value) then the renderer has to assume that they will be transparent and compute the visibility of object O3. Tip:
It helps the renderer optimize the scene if you do not attach any nodes to the transparency channel of a texture when that object can never be transparent. That way, the shader initialization can flag the objects as completely opaque and use this optimization.
The visibility of the objects is determined by a method that has a close analogy to the pushpin array of nails novelty toy you often see in ÒscienceÓ stores or higher-end games stores. It consists of an array of blunt nails pushed through a plastic board with a plexiglass front shield to prevent the nails from being pushed all the way out of the board. You press your hand or face into the blunt end of the nails, and the nails on the other side of board take on the shape of your hand or face. The EAS algorithm used in Maya is very much like a pushpin approach where the renderer pushes the triangles into a digital pushpin array. Technical Overview11
The Rendering Pipeline Step 5: Render each tile
The digital pushpin array is many times more dense than the pixel, which gives us good geometrical anti-aliasing, and our digital pushpin array remembers which triangle pushed it the furthest towards the camera so that it can be shaded correctly. The portions of each triangle that remain visible in each pixel after all this digital pin-pushing are called fragments. A fragment is simply the shape left by clipping the triangle to the pixel. Note:
Step b will be explained at the end of this section.
Step c: Compute shading (for stationary objects)
Now that the visibility of all non-moving objects in the scene has been determined, the renderer needs to shade those objects which still remain visible in each pixel. Before the renderer starts to shade, though, it must first attempt to merge any triangle fragments from the same object into a larger fragment. This is done because it is important to shade each surface as few times as possible in each pixel. However, there are a number of cases where it is not possible or desirable to do the merging. If the fragments are from the same surface, but they have different depths (say you can see the front and back lip of a bowl in the same pixel, these need to be shaded differently; so the fragments cannot be merged) or if the triangles are on either side of a sharp edge on an object (say there is a degree one surface or an object which is not smooth shaded), then it is important to preserve the sharp edges and again, it is not possible to merge these fragments. Once the fragments are merged, the renderer then shades the merged fragment shadingSample a number of times as specified in renderQuality or overridden by each object in the Attribute Editor under Render Stats. The following pseudo-code briefly outlines the merging and shading process; For each pixel in the tile scanline merge all possible fragments for the same object shade the mergedFragments shadingSample number of times. endFor
The initialization and evaluation of the shading network is handled in a different section. For now, the renderer can almost consider the shading of each fragment as complete. Note:
If you have animated the camera in Maya then all objects are considered to be moving since the Maya renderer treats the camera as the stationary point. Therefore if you animate the camera, you must consider the issues in Step b.
Step d: Highest quality setting
The shading is not complete if highestQuality has been selected in renderQuality. The Maya Renderer tries to shade each object only once 12 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
per pixel; however, this is not always a high enough sampling frequency to properly anti-alias some shading events like thin speculars or shadow edges. To catch these shading events, the Maya Renderer provides an adaptive shading option that is enabled when highestQuality is selected. The Maya Renderer examines the contrast between this pixel and its five already-computed neighboring pixels (the next scanline is not yet rendered, so all 8 cannot be examined). Figure 7 shows the five neighboring pixels involved in the contrast computation.
Current Scanline
Current Pixel
Figure 7: The 5 neighboring pixels used to compute contrast. If the contrast exceeds the contrast threshold specified in the Contrast Threshold Attributes section of renderQuality, then additional shading samples are taken. The number of additional shading samples taken varies between shadingSamples and maxShadingSamples as specified in renderQuality and is overrideable on a per-object basis in the Render Stats portion of the Attribute Editor. A simple linear function is used to determine the number of shading samples. Figure 8 shows a chart of the function used to determine the number of additional samples to take. The number of samples starts at shadingSamples (SS) and remains at that number until the contrast threshold is reached. At that point, as the distance above the threshold increases, so does the number of shading samples taken until the full contrast of 1.0 is reached and maxShadingSamples are taken. Shading Samples MaxSS
MaxSS - Max shading samples. (defined in renderQuality) can be overridden by object
Extra Shading Samples taken
SS - shading samples (defined in renderQuality) can be overridden by object
SS
threshold
1.0
Contrast
Figure 8: Graph showing how the number of extra shading samples for highest quality is computed.
Technical Overview13
The Rendering Pipeline Step 5: Render each tile
If you look at the default contrast settings you will see that they are: Red = 0.4 Green = 0.3 Blue = 0.6 These settings were chosen because they roughly correspond to the human eyeÕs responsiveness to these wavelengths of light. The human eye is very sensitive to changes in green, but not very sensitive to changes in blue. The computation of contrast is physically based on the contrast recognition abilities of a monkey eye. While not wanting to start a debate regarding evolution vs. creation, it is generally accepted that the human eye is very similar to the monkey eye, genetically speaking. The contrast is computed with the following formula for each of R, G and B:
max
min
I ÐI ------------------------- = contrast max min I +I The algorithm for determining if additional samples should be taken is outlined in the following pseudo-code: Foreach pixel examine the pixelÕs 5 neighbors Foreach object shaded in this pixel collect (RGBmax) (RGBmin) compute contrast if (contrast > threshold) take additional shading samples endif endFor endFor
Figure 9 shows a simple example for non-moving objects. There are four images of a spot light shining on a plane. With low quality, both the geometric edge of the object and the shaded edge of the spot light are aliased. When high quality is selected, the geometric edges of the object are anti-aliased; however, the shading edge of the spotlight is still aliased because no adaptive shading was invoked. When highest quality is set, both the geometric edge of the object and the shading edge of the spot light are properly anti-aliased. The final image shows the same image generated with multi-pixel filtering on. This is a true multi-pixel filter applied at the sub-pixel level and not a post-process low pass filter that is applied to the pixels. Multi-pixel filtering is discussed further on page 18 of this document.
14 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
Low Quality
High Quality
Spatial/Geometric Aliasing
(No adaptive shading)
Shading Aliasing
Highest Quality (With adaptive shading)
Highest Quality (With multi-pixel filtering)
Figure 9: Geometric vs. shading anti-aliasing. Step b: Compute visibility for moving objects
You have learned how non-moving objects have their visible surfaces calculated and subsequently shaded, and touched on the methods the Maya Renderer uses for anti-aliasing stationary geometry and shading. In this section, you will learn about the rendering of moving objects and motion blur. Motion blur is solved with point sampling using a process unique to Alias|Wavefront. The Maya Renderer chooses pseudo-random locations on each pixel where it will sample the moving objects as illustrated in Figure 10.
Current Scanline
Current Pixel
Figure 10: Example sample locations (not actual) for motion blur point sampling. The number of sample points in each pixel is under user control. The number of visibility sample points for motion blur is determined by the motionBlurVisibilitySamples attribute in renderQuality. The number of motion blur visibility samples cannot be overridden on a per object basis; however, the contrast is used to increase the number of visibility samples for motion blur. For highest quality, the five neighboring samples are examined to compute the coverageContrast,
Technical Overview15
The Rendering Pipeline Step 5: Render each tile
and additional visibility samples are taken (up to maxVisibilitySamples from the renderQualityÕs Motion Blur Visibility section). While the minimum number of motion blur visibility samples cannot be overridden on a per-object basis, the maximum number of visibility samples can be overridden. The Render Stats section of the Attribute Editor for an object contains a Motion Blur section where this override can be set. To compute the coverage and visible surfaces for motion blurred objects, the Maya Renderer holds the ray stationary, and moves the triangle across it to see when and where the ray intersects the triangle. Figure 11 diagrams this procedure. A ray (a point sample) is sent through the pixel and checked for intersection with a moving triangle that moves from the left of the pixel at shutter open time, to the right of the pixel at shutter close time. By looking at the triangle itself, you can see that the triangle first intersects the ray at time = .2 and stops intersecting the triangle at time = .7. These intersection points allow us to form a line in the space of the triangle that describes where the triangle intersects our point sample. The renderer can then sample this line (and thus the triangle) at multiple times during the time it covers this pixel, which is how it supersamples the shading of moving objects. There are other optimizations which are used in computing motion blur that are not covered in this document. The important thing to learn from this section is that in the case of motion blurred objects, the meaning of shadingSamples is overloaded, which means it is used to control a different type of sampling when motion blur is on versus the type of sampling it controls when motion blur is off. In the case of motion blurred objects, shadingSamples controls the number of shading samples in time across the moving triangle(s), as represented by the ÔXÕs on the triangle in the upper left of Figure 11.
t=0.7
t=0.2 xxx
Pixel
!!shadingSampleÕs meaning is overloaded!!
Figure 11: Motion blur coverage and shading sampling. There is no adaptive shading sampling for time-based samples. Figure 12 shows a simple example of the differences between geometric, spatial and temporal aliasing, and how various Maya Renderer parameters anti-alias each of these artifacts. At low quality, all types of aliasing are present; going to high quality eliminates the geometric aliasing problem. Going to highest quality with one shading sample
16 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
eliminates the spatial aliasing, and going to 16 shading samples completely eliminates the temporal aliasing.The checkered plane is moving from left to right. Tip:
It is not recommended that you set the shading sample frequency to 16 for all your motion blur scenes, only that you increase the number of shading samples on objects that display this type of temporal aliasing.
Low Quality
High Quality
Geometric Aliasing
Spatial Shading Aliasing
Highest Quality
Temporal Shading Aliasing
Highest Quality (With 16 shading samples)
Figure 12: Geometric vs. spatial vs. temporal aliasing. In general, it is not possible to separately anti-alias or see if the spatial or the temporal aliasing is causing the artifact; the example in Figure 12 is a bit contrived to be able to show this. Figure 13 shows a more common case where both the spatial and temporal aliasing are seen in the same location. In Figure 13, the texture mapped plane is rotated 45 degrees and then moved from left to right across the screen.
Technical Overview17
The Rendering Pipeline Step 5: Render each tile
Low Quality
High Quality
Geometric Aliasing
Spatial/ Temporal Shading Aliasing
Highest Quality (performs spatial shading anti-aliasing)
Temporal Shading Aliasing
Highest Quality (With 10 shading samples)
Figure 13: Spatial and temporal aliasing can not always be separated.
Step 6: Composite shaded results At this point the renderer has a list of shaded fragments for each pixel. The next task is to composite the fragments together to form a single pixel color that represents the geometry visible in that pixel. If multi-pixel filtering is not enabled, the result is simply a box filtering of the fragments. The fragmentÕs color is multiplied by the amount of the pixel it covers, and then all fragments are added together, or to put it a different way, the fragment colors are weighted by their coverage contribution and then summed. If, however, multi-pixel filtering is enabled, then a 3x3 pixel filter kernel is used to combine the fragments. The 3X3 pixel filter kernel is a cubic spline filter kernel derived by convolving a square pulse with itself three times. The shape of this filter roughly approximates a gaussian filter. Figure 14 shows a graphic diagram of this filter. The fragment marked with the bold circle inscribed with an ÔXÕ is weighted according to the volume contained between it and the projection of the fragment onto the filter kernel. This is a true multi-pixel filter and not a post-filter; the fragments for all of the 3x3 pixels are weighted before pixel composition.
18 Maya Rendering
The Rendering Pipeline Working with BOT or Cached File Textures
Pixel
Figure 14: The 3x3 multi-pixel filter
Working with BOT or Cached File Textures BOT (Block Order Textures) are enabled by selecting useTextureCache on each file texture. If this flag is ON and the file textures are not already BOT format files, then Maya will automatically create BOT textures from your images files in the TMPDIR (temporary directory). If the textures are already in BOT format (you can convert them using the stand-alone utility makebot) then no conversion is required, the state of the useTextureCache flag is irrelevant, and BOT textures will be used. A BOT texture on disk is a compressed MIPMAP structure with 8x8 texel pages. (A texel is a texture element derived in much the same way as pixel is a picture element). The textureCache is a 256 texel page cache in memory; that is, it can hold 256 of the 8x8 texel pages. There is only one textureCache for the entire rendering session, and the cache is shared between all file textures. The textureCache is demand loaded. When a part of a texture is required, if it is not already in the cache, then it is loaded from disk. If the textureCache is full, then the least recently accessed pages are removed and replaced with the pages being loaded. Tip:
BOT textures have the advantage of reducing the amount of memory required to keep textures in memory, and they employ algorithms that help ensure a high hit ratio when looking for a part of a texture. If the image file has already been converted to a BOT texture file, then the Maya renderer can use it much more quickly than when it has to convert the file to BOT texture on its own. If you have lots of textures, or very big textures, then converting to BOT textures may be a useful way of conserving memory.
BOT textures do have some limitations as well. The image viewing utilities fcheck and wrl do not know how to display a BOT texture as it is not a standard image format. If multiple renderers are using the same BOT file (whether those renderers are on a multi-processor machine or on
Technical Overview19
The Rendering Pipeline Other renderGlobal Optimization Parameters
a separate machines.), there can be an I/O bandwidth problem as all of these renderers attempt to access the same file on the same disk. This will cause the renderers to slow down. The only solution to this problem is to ensure each renderer is accessing it's own local copy of the BOT texture, where each BOT texture resides on a separate hard disk from all the other BOT textures. If the image files are not BOT texture files to begin with, then TMPDIR can get full quickly with all of the temporary BOT files. BOT file (on disk) 8x8 page
256 slots textureCache (in Memory)
Other renderGlobal Optimization Parameters useFileCache swaps the least recently used (LRU) render data in memory out to a disk file in TMPDIR. At the start of rendering, Maya will compute the maximum size this swap file can become by setting its maximum size to 80% of the free space on TMPDIR. This is done to avoid filling up the disk and leaving no space for other processes which require TMPDIR space. As the renderer consumes more memory,the least recently used sections of data are swapped out to the swap file by the renderer. This does not involve any operating system context switch or swapping. Data items which are candidates for swapping are tessellated triangles and raytracing spatial subdivision structures (voxels). If, for some reason, swapping data to this swap file fails (i.e., the swap file has reached its maximum size), then the data is simply thrown away and re-calculated if required again at a later stage of the rendering. By having Maya do the swapping, it should be a little more intelligent about it than the operating system, which has no knowledge of what the renderer is doing. Disadvantages are I/O bandwidth problems, which get worse if there are multiple processes on a single multi-processor machine and they are all accessing the same TMPDIR. You could run out of disk space and not be able to save your images. Therefore, if the rendererÕs output image directory and TMPDIR are on the same disk partition, saving of image files may fail. The likelihood of this data loss increases as more frames of the animation are rendered.
20 Maya Rendering
Understanding shading networks Other renderGlobal Optimization Parameters
Tip:
When using useFileCache, it is better to therefore render to a different disk than the disk containing the TMPDIR.
UNDERSTANDING SHADING NETWORKS This section describes basic concepts that are important to make the most use of the power of the Maya RendererÕs shading network. First, let us define some terms. ■
shading network - a connected graph of nodes that can be used to shade objects. These networks generally contain what Maya classifies as materials and textures, but they do not have to contain these nodes.
■
shadingGroup - a collection of objects to be shaded with the shading network attached to the surfaceMaterial port of the shadingGroup if the object is a surface, or with the shading network attached to the volumeMaterial port of the shadingGroup if the object is a volume.
■
port - an attribute on the shadingGroup, which acts as an input for shading networks. These attributes differ from normal connected input attributes because the renderer evaluates these inputs for required connections.
■
material - these are similar to what were called shaders in Alias and Explore. They are called materials in Maya to avoid any functional associations that the word ÔshaderÕ might imply.
The shading network is designed as a data flow network. As you look at shading networks in the Hypergraph, data is fed in the left side of the network and a final shaded result emerges from the right-most node. A Shading Group can have a different shading network attached to both the surfaceMaterial port and the volumeMaterial port. Surfaces that are in this shadingGroup are shaded with the network attached to the surfaceMaterial port, while volumes that are in this Shading Group are shaded with the network attached to the volumeMaterial port. A shading network assigned to the displacementMaterial port affects only surfaces and only during tessellation (unless it is otherwise connected to the surface shading network as well as being attached to the displacementMaterial port). Note:
The Maya Renderer uses specially named attributes to supply shading networks with information about the sample point being shaded.
Technical Overview21
Understanding shading networks Other renderGlobal Optimization Parameters
Note:
For a list of the specially named attributes that the Maya Renderer uses to supply information to a shading network, see the Maya online
documentation ® Maya DeveloperÕs Tool Kit ® Maya API Overview for writing Shading Nodes ® Appendix C, ÒRendering attributesÓ. If a shader declares an attribute with one of these special names, the attribute is automatically fed that information at shading time during rendering. This is called an implicit connection and is similar to accessing global variables in RenderManÕs shading language. For example, if an attribute on a node is called pointCamera and that attribute is not connected, then when that attribute is queried during the shading computation, the intersection point in camera space will be provided to that attribute, since this is a specially named attribute. If an unconnected attribute exists anywhere in the shading network and the attribute has one of the special names listed in the appendix, the attribute will be filled with the requested information at shading time during rendering. Tip:
You can override the implicit behavior of any specially named attribute simply by explicitly connecting something to that attribute.
outAlpha
bumpValue
outNormal
normalCamera
normalCamera
Figure 15: Overriding normalCamera for bump mapping. Bump mapping in Maya works by overriding the normalCamera attribute on materials. The normalCamera is the normal of the surface in camera space. A similar naming convention is followed for other Maya specially named attributes. Figure 15 shows the manner in which the normalCamera for a material is overridden. Maya supplied materials have an attribute called normalCamera; usually normalCamera is unconnected and the normal in camera space of the intersection point is supplied to the shader. When the material is bump mapped, a bump node is connected to the normalCamera attribute. The bump node has two input attributes: normalCamera, which will normally be unconnected, and a bumpValue attribute. The final outNormal from the bump node will be the normal in camera space modified (bump mapped) by the texture map. Note:
22 Maya Rendering
Because of the way Maya supplies data to unconnected, specially named attributes, the bump node must also be connected to any reflection maps you have on your material, so that both the material and the reflection map are using the same bumped normal. This type of connection is
Understanding shading networks Other renderGlobal Optimization Parameters
shown in Figure 16. The attribute outNormal of the bump node is fed both into the materialÕs normalCamera as well as the environment textureÕs normalCamera.
normalCamera
outNormal normalCamera
outAlpha
bumpValue
outNormal reflectedColor
normalCamera outColor
Figure 16: Material and environment map sharing the same bump map. Note:
You do not need to program API shading nodes to access all the attributes provided to the shaders.
You can access any of the specially named attributes by adding a dynamic attribute onto any node, provided that the attribute has the same name and data type as listed in the appendix. Adding all of these dynamic attributes can be time-consuming, and may result in many different nodes with the same dynamic attributes defined, so to make accessing sample data easier, there is a helpful node provided in the Create Render Node window called sampleData, which is simply a node with many of the specially-named attributes already defined on it. You can create just one of these sampleData nodes and connect from its attributes to every place in your shading network that requires the information. Any attribute you require that is not already defined on the sampleData node can be added as a dynamic attribute of the same name and type. Creating just one sampleData node with all the attributes you require is an effective way to create a kind of global variable list. Of course, there is nothing wrong with creating multiple sampleData nodes to reduce confusion, if the attributes will be connected into many shading networks.
normalCamera
input1 outValue
rayDirection
input2
Figure 17: Using sample data to take the dot product of the ray and normal. Technical Overview23
Understanding shading networks Other renderGlobal Optimization Parameters
In Figure 17, the normal in camera space and the incident ray direction are supplied by the sampleData node and connected to the two inputs of a dotProduct node, the results of which are to be used elsewhere in the shading network. Since the dot product is an important component of many shading models, it can be seen that Maya allows for the prototyping of shaders without actually coding them in C++. Note:
Just as there are specially named input attributes, there are specially named output attributes.
A node must have at least one of the following specially named output attributes to be a valid node to directly connect to a surfaceMaterial port of a shadingGroup: ■
outColor
■
outTransparency
■
outGlowColor
If the node connected to the surfaceMaterial port of a shadingGroup does not have at least one of the above attributes, none of the surface objects assigned to that shadingGroup will render. It does not matter which attribute of a node is connected to the surfaceMaterial port of a shadingGroup; only the outColor, outTransparency and outGlowColor attributes of the connected node will be used. Even if the message port is used to attach a node to the surfaceMaterial port, the shadingGroup will look for outColor, outTransparency and outGlowColor attributes on the attached node. A node must have at least one of the following specially named output attributes to be a valid node to connect to the volumeMaterial port of a shadingGroup: ■
outColor
■
outTransparency
Creating special effects, such as inverting a materialÕs color after shading, requires that you attach a special node with outColor, outTransparency and/ or outGlowColor attributes to the surfaceMaterial port of the shadingGroup. A special node called surfaceShader is provided in the Create Render Node window available in the multilister. This is a light weight Òpass-throughÓ node that simply allows you to translate the names of the nodeÕs outputs to the names required for it to be a valid surfaceShader.
24 Maya Rendering
Understanding shading networks Other renderGlobal Optimization Parameters
out
in
outColor outTransparency outGlowColor
outColor outTransparency outGlowColor
Figure 18: Renaming output attributes using a surfaceShader node. In Figure 18, the shading group is attached to a surfaceShader node. Although most of the attributes have the same names, the outColor of the material is passed through an invert node which does not have a properly named attribute, so the surfaceShader node is required to rename that one attribute. The surfaceShaderÕs outTransparency and outGlowColor are attached directly to the materialÕs outTransparency and outGlowColor, so these values go to the shadingGroup unchanged, directly from the material. The outColor of the material, however, is first passed to the in attribute of an imaginary (a node made up for this example) invert node, which inverts the color and then places the result in the out attribute. The out attribute is then connected to the outColor of the surfaceShader node where it is passed through to the shadingGroup. The surfaceShader node is simply a means to translate an arbitrary network of Maya or user-written nodes with arbitrarily named output attributes into what the renderer will recognize as a shading network with which it can render objects. Of course, you can always create three dynamic attributes on the invert node and make connections from the material and a loop back connection from the out attribute to the dynamic outColor attribute on the invert node, as shown in Figure 19.
outColor outTransparency outGlowColor
in
out
outColor outTransparency outGlowColor
Figure 19: Invert node with 3 dynamic Òpass-throughÓ attributes. There is also a volumeShader node provided for the same reasons.
Technical Overview25
Understanding shading networks Other renderGlobal Optimization Parameters
26 Maya Rendering
Assistant Online - Maya/How Tos/Rendering/Realistic Glass
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Realistic Glass
HOW TO CREATE REALISTIC GLASS
by Alias|Wavefront
Maya Complete Rendering In this lesson, you will learn how to create a glass shader that uses a samplerInfo node and several blendColor nodes to add more realism than is possible with the material node alone. Play Movie [~246kb] STEP ONE Create a profile curve for the glass. Make the profile so that it creates a surface for both the inside and outside of the glass. This double surface will create a more realistic effect when you later add refraction to your scene. STEP TWO Revolve the curve to create the glass. Set up a simple scene with some props. These will be useful to evaluate the refractive qualities of the surface. Don't forget to add lights to your scene.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/realistic_glass/ (1 of 5) [3/7/2000 14:48:15]
Assistant Online - Maya/How Tos/Rendering/Realistic Glass
STEP THREE Open the Hypershade. Select Create -> Material -> Phong to create a phong material node. Open up the node in the Attribute editor and set the following: Color to Black; Transparency to White; Diffuse to 0; Translucence to 0; Cosine Power to 50; Under Raytrace Options set the following: Refractions to On; Refractive Index to 1.33; Refraction Limit to 6; Reflection Limit to 1. These settings offer the desired qualities for glass. STEP FOUR Assign the phong shading group to the glass. Now you can test render the scene to evaluate this basic glass shader. To raytrace the glass, you must follow the steps outlined in How to set up reflections and refractions. The reflections and refractions lesson will teach you how to set up critical attributes on your various props to ensure that they are reflected and refracted properly. You will also learn how to set up your Render Globals for raytracing. STEP FIVE In the Hypershade, select Create -> Create Render Node. This will open the Create Render Node window. and under the Utilities tab, create the following utility nodes: 3 Blend Color nodes, 1 Sampler Info node The Sampler Info node is a special utility node that returns values when a point is sampled on a surface during rendering. These values can be mapped to other nodes to create unique effects. In this lesson, the Sampler info node will control the blending of two colors in each of the three Blend Color nodes. Rename the three Blend Color nodes to the following: colorBC, reflectBC, transpBC http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/realistic_glass/ (2 of 5) [3/7/2000 14:48:15]
Assistant Online - Maya/How Tos/Rendering/Realistic Glass
This will help you distinguish the purpose of these nodes as you build the glass shading network. STEP SIX In the Hypershade, drag the samplerInfo node onto the colorBC node. The Connection editor will open. Connect the Facing Ratio attribute to the Blender attribute. The Facing Ratio attribute returns a value between 0 and 1 based on how much the sampled point is facing the camera. If you were looking at a cylindrical glass head on, the Facing Ratio values would go from 0 at the sides of the glass to 1 at the center. Repeat this step two more times to connect the samplerInfo node's Facing Ratio attribute to the Blender attribute belonging to the reflectBC and the transpBC nodes. Now the samplerInfo node is connected to all three Blend color nodes. STEP SEVEN Open up the transpBC node in the Attribute editor. Set Color1 and Color2 as shown here. This will create a blend from light gray to white. Drag the transpBC node onto the phong shading group. In the Connection editor, connect the transpBCs Output attribute to the phong's Transparency Attribute. Now the transparency of the glass will appear stronger at the center of the glass and slightly less transparent at the edges. Test render to compare the results. You may want to darken the gray blend color to make the edges even less transparent. Note: The value of the blending colors [1.0 for white and approximately 0.8 for the light gray] will be used to set the transparency value. To find out the value of a color that you choose, open the Color editor and look at the Value that is http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/realistic_glass/ (3 of 5) [3/7/2000 14:48:15]
Assistant Online - Maya/How Tos/Rendering/Realistic Glass
shown as part of Hue, Saturation and Value. A similar mapping of color values will apply to setting the reflectivity of the glass. STEP EIGHT Open up the reflectBC node in the Attribute editor. Set the Color1 and Color2 as shown here. This will create a blend from white to light gray. Drag the reflectBC node onto the phong shading group. In the Connection editor, connect the reflectBC's Output R attribute to the phong's Reflectivity Attribute. Now the reflectivity of the glass will be strongest at the edges of the glass and slightly less strong where the glass faces the camera. Test render to compare the results. You may want to darken the two blend colors to lower the amount of reflection on the glass. STEP NINE Open up the colorBC node in the Attribute editor. Set the Color1 and Color2 as shown here. This will create a blend from black to dark gray. Drag the colorBC node onto the phong shading group. In the Connection editor, connect the colorBC's Output R attribute to the phong's Color Attribute. Now the color of the glass will be black at the edges of the glass and a dark grey where the glass faces the camera. Test render to compare the results. You may want to change the two blend colors to alter the colors of the glass.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/realistic_glass/ (4 of 5) [3/7/2000 14:48:15]
Assistant Online - Maya/How Tos/Rendering/Realistic Glass
CONCLUSION You now have a glass rendering that uses Maya's utility nodes to create subtle reflection and refraction effects. You can easily alter the look of the glass by editing the various blend colors to suit your needs. To view the completed scene, download the following file: glassScene.ma Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/realistic_glass/ (5 of 5) [3/7/2000 14:48:15]
Assistant Online - Maya/How Tos/Rendering/Reflections + Refractions
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Reflections + Refractions
HOW TO SET UP RAYTRACED REFLECTIONS AND REFRACTIONS Maya Complete Rendering
by Robert Magee
In this lesson, you will learn how to set up a scene for reflections and refractions. Both of these effects require Raytracing and they also require that objects in the scene be set up properly.
Play Movie [~576kb]
This example will deal with both these qualities at the same time. In other cases you might want only reflections or only refractions. The workflow would be similar. You would only have to focus your attention on the effect that you are most concerned with. STEP ONE Create or import a shader that has reflective and refractive qualities. Take a look at the Glass shaders in the library for some examples. Shown below is a sample image before it has been prepared for reflections and refractions. You will require a material node that has either Reflectivity for reflections or Transparency for refractions. Phong and Blinn have both of these attributes. For reflections, you must set the Reflectivity attribute on the material node of your shader. You need to also set the number of reflections in the Raytrace Options section of the material
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/index.html (1 of 3) [3/7/2000 14:48:22]
Assistant Online - Maya/How Tos/Rendering/Reflections + Refractions
node. In most cases 1 or maybe 2 reflections will be all that are required. For refractions, your material will require Transparency and, under Raytrace Options, you will need to turn on Refractions and set the Refractive Index. The refractive index should be set based on the material you are trying to simulate. Below are some guidelines for Index values: Material Standard Glass Quartz Crown Glass Diamond
Refractive Index 1.2 1.46 1.52 2.4
The Refraction Limit should be set to at least the number of refractive surfaces that will overlap at any one time in the rendering. A simple sphere would have the front and back surface, therefore a setting of 2 would be required. If you had two spheres overlapping then you would need a setting of 4. STEP TWO Once your material has been built and assigned to your object then you must set up the other objects in the scene. Select objects such as Click to view larger version the wall or the floor that you want to reflect and refract through the glass. Using either the Attribute editor (one node at a time) or the Rendering Flags window (multiple nodes), turn the Visible in Reflections and Visible in Refractions to On. Note: This is a very easy step to forget therefore watch out for it when you want reflections/refractions. Also remember that the Visible in... settings are not required on the object that is doing the reflecting/refracting but rather on the surrounding objects that will be reflected/refracted by that object.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/index.html (2 of 3) [3/7/2000 14:48:22]
Assistant Online - Maya/How Tos/Rendering/Reflections + Refractions
STEP THREE Now open up the Render Globals and click on the Render Quality tab. From the Raytracing section, set the following:
Click to view larger version
Enable Raytracing to On; Reflections to 1; Refractions to 2. Earlier you set Reflections and Refractions for the shading group's material node. The renderer will use the lower of either the material node's setting or the Render Global setting. For example, if the material node had a reflection setting of 3 and the Render Globals set Reflections to 1 then only 1 reflection would occur. This lets you control these settings either locally at a material node by material node basis or globally using the Render Globals. CONCLUSION Now you can render your scene with reflections and refractions. Remember that Maya's renderer is a selective raytracer. This means that only objects with shaders that exhibit raytrace qualities, such as reflectivity and refractions, will be raytraced.
Play Movie [~576kb]
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/index.html (3 of 3) [3/7/2000 14:48:22]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/img/reflect_02.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/img/reflect_02.gif [3/7/2000 14:48:27]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/img/reflect_03.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflect_refract/img/reflect_03.gif [3/7/2000 14:48:29]
Assistant Online - Maya/How Tos/Rendering/Reflection Mapping
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Reflection Mapping
HOW TO CREATE A BALL ENV REFLECTION MAP
By Steve Christov
Maya Complete Rendering In Maya, reflections can be achieved in one of two ways. You can either raytrace the scene or you can map the reflected color attribute using an environment shader. In this lesson, you will learn how to render realistic reflections without needing to raytrace every frame of the animation. Using a ball env. shader, you can raytrace one image then reapplied it as a map to the shader's reflectivity. This is an update for Maya from a previous Assistant article "Reflection Mapping" by Lorna Saunders, Assistant issue No 3, Winter 1997. STEP ONE For any reflections you will need to use a digital set. The set must be enclosed in that it is not 3 sided, and needs to cover the area behind the camera. Download and uncompress the file: reflection.zip. [NT ~2 megs.] or, reflection.tar.gz [IRIX ~2megs.]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/ (1 of 6) [3/7/2000 14:49:09]
Assistant Online - Maya/How Tos/Rendering/Reflection Mapping
This is a simple set that will be used to demonstrate basic reflections. You will notice that the various objects are assigned to several layers. Select the ball layer and with your right mouse button select Template. STEP TWO Create a Sphere. Position the sphere so that it is in the same location as one of the balls for the pendulum. Scale the sphere to make it roughly the size of one of the balls.
STEP THREE You now need to give this sphere a chrome-like shader. In the Hypershade, Create a Blinn material. Name it Reflector and assign it to the sphere. Set the following values in the Attribute Editor. ● Color to Black ● Diffuse to 0.0 ● Eccentricity to 0.14 ● Specular Roll off to 1.0 ● Specular Color to White ● Reflectivity to 1.0
Click to view larger version
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/ (2 of 6) [3/7/2000 14:49:09]
Assistant Online - Maya/How Tos/Rendering/Reflection Mapping
STEP FOUR Create a new camera and toggle a panel to look through it. It should be called camera 2. In your Render Globals, set up the globals to render from your new camera. In the Resolution section change the size to be 512 X 512. Turn off Lock Device Aspect Ratio. The reason for this is because the env sphere needs to be a square image with the chrome ball as its focus. Name the output image Reflection, and in the Raytracing section turn Raytracing to On.
Click to view larger version
Set camera 2 as your render camera.
STEP FIVE In your persp view, Select the camera and move it using the move tool to position it to look directly at the ball. Open the Attribute Editor and set a narrow angle of view to around 20. This will decrease the distortion around the edges. Switch to the new camera view and select View -> Camera Settings -> Resolution Gate. Set up a two panel view where you can see the persp and Camera 4. Position your camera in the persp window so that the ball touches all four sides of the resolution gate of camera 1. It is important to keep the camera parallel to the ground so that it looks straight at the reflector. Make sure there is no Y rotation on the camera. Batch Render the image.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/ (3 of 6) [3/7/2000 14:49:09]
Assistant Online - Maya/How Tos/Rendering/Reflection Mapping
STEP SIX In your scene it is a good idea to put the camera and the chrome ball in its own layer so that you can hide them and come back to them later if you need to. Make sure your layer bar is shown by selecting Options -> Layer Bar. Create a new layer. Name it reflector. Select the camera and the chrome ball. In the layer bar move your mouse over the reflection layer, click with your right mouse button, and select Assign Selected. Again with your right mouse button, select Visible. This will hide the camera and chrome ball so that it does not clutter your scene. STEP SEVEN In the Hypershade window, select the reflector shader you made and select Edit -> Duplicate -> Shading Network. Rename the material to reflection_color. In the Attribute editor, click on the Map button beside Reflected Color. In the Environments Section, select Env Ball. In the
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/ (4 of 6) [3/7/2000 14:49:09]
Assistant Online - Maya/How Tos/Rendering/Reflection Mapping
Attribute editor window, Click beside Image, and select File in the Create Node Window. In the Attribute editor for the File, click on the folder beside image name and Select the image reflection.iff. By default, this image will be located in the images folder in your project directory. NOTE: Many times reflections are not perfect, to achieve a blurred effect, import the file into a paint program to add some blur. For the final animation, the file was blurred slightly. STEP EIGHT At this point you should see the material node updated in the Hypershade. Notice that the color is not changed but enhanced when you add the effect of reflections. Untemplate the Newton layer by selecting it and using the right mouse button to click on Standard. Assign the new material to the balls layer. STEP NINE In the Render globals, turn Raytracing to Off. Rename the final render. Set your Frame/Animation Ext. to start at frame 1 and end at frame 165. Pick the camera1 as your renderable camera. You are now ready to render the scene.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/ (5 of 6) [3/7/2000 14:49:09]
Assistant Online - Maya/How Tos/Rendering/Reflection Mapping
CONCLUSION Final Animation [MPEG 800k]
By using the ball method to create a reflection map you can save on total render time when rendering multiple frames for an animation. While this may not work in all cases, it does offer an alternative to raytracing a scene. You could also use different resolutions for your ball image depending on the size of the object and the distance from the camera, but generally you'll want to keep the resolution at either 256 x 256 or 1024 x 1024. In the final animation the shading samples have been increased to 4 instead of 1. This helps to reduce some flickering that was encountered when the final animation was rendered. Take a look at the following examples for rendering an animation of 165 frames on a Pentium III with 512 megs ram. ● Scene using reflection mapping. Time: 1 hour 28 minutes. ● Scene using selective raytracing only on the balls in the pendulum. Time: 3 hours 19 minutes. One thing to keep in mind is that reflections are used to enhance realism and most times you only need to see general contrast and shapes to produce the effect of a true reflection as more often than not the viewer is concentrating on the animation rather than reflections. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/ (6 of 6) [3/7/2000 14:49:09]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/three.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/three.jpg [3/7/2000 14:49:16]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/four.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/four.gif [3/7/2000 14:49:18]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/four.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/four.jpg [3/7/2000 14:49:22]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/nine.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/img/nine.gif [3/7/2000 14:49:25]
Assistant Online - Maya/How Tos/Rendering/Env Ball vs. Raytrace
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Env Ball vs. Raytrace
Env Ball Render vs. Raytracing
By Steve Christov
Reflection Map View the final animation using Reflection map - reflection.mpg [800k] Time to render 165 frames on Pentium III w/ 512 meg ram: 1 hr 28 min.
Raytracing View final animation using Raytracing - raytrace.mpg [800k] Time to render 165 frames on Pentium III w/ 512 meg ram: 3 hr 19 min.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/chart.html (1 of 2) [3/7/2000 14:49:33]
Assistant Online - Maya/How Tos/Rendering/Env Ball vs. Raytrace
When you compare the reflections of the env. ball render to the raytraced render you will notice a few differences. The actual reflection in the mapped image shows a consistent reflection for each sphere. For instance, the black base is reflected in exactly the same way in all the spheres. Also, the perspective of the room becomes distorted. However, the decision whether to use raytracing or not depends on the level of detail needed for your reflections. Using a reflection map you can "fake" reflections and achieve almost the same results while shaving valuable time off your renders. Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/reflection_map/chart.html (2 of 2) [3/7/2000 14:49:33]
Assistant Online - Maya/How Tos/Rendering/Ripple
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Ripple
HOW TO MAKE WATER RIPPLE
by Steve Christov
Maya Complete Rendering In this lesson you will learn how to create ripples on water that appear to cross over and float through each other. This will be done by using multiple water textures that will be layered to provide Play Movie [~350kb] information to a bump node to produce the ripples. You will map the textures to the colorOffset attribute to layer the ripples onto surface of the water. This article is an update for Maya of a previous article "Texture Mapping Aoffsets" by Erik Noteboom; Alias Assistant, Issue #14.
STEP ONE Open the Hypershade window and Create a Blinn material node. Open the Attribute editor window for the Blinn. ● Set the Color to Light Blue. ● Map a Water texture to Bump Mapping. ● Rename this texture to Ripple.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/ (1 of 5) [3/7/2000 14:49:46]
Assistant Online - Maya/How Tos/Rendering/Ripple
STEP TWO Create a NURBS Plane. Scale it out so that it covers the grid in your perspective window. Add and Position a Directional light so that it is illuminating the plane. Assign the Blinn to the Plane.
STEP THREE In the Attribute Editor for the Ripple set the following: ● Wave Amplitude to 0.0 ● Ripple Amplitude to 2.0 ● Spread Rate to 0.5 This will be your main water texture that will have other water textures mapped into the Color Offset attribute.
STEP FOUR To animate the ripples, you will need to keyframe the Ripple Time attribute. Make sure your Timeslider is at 1. In the Attribute editor for your Ripple texture, set the Ripple Time to 0 and using the RMB set a key for it. Move your Time Slider to 40 and key the Ripple Time at 1.
STEP FIVE You will now duplicate the Ripple texture with the animation. With the Ripple node in the Hypershade selected, go to Edit -> Duplicate -> Shading Network. Rename this texture node Ripple1. This will create a new water node without any connections to the shading network.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/ (2 of 5) [3/7/2000 14:49:46]
Assistant Online - Maya/How Tos/Rendering/Ripple
STEP SIX In the Attribute editor for Ripple1, change the Ripple Origin to 0.2 and 0.3. Finally with your MMB, drag the Ripple1 onto Ripple, and connect to Color Offset from the pop-up menu. Notice the updated water texture in the Hypershade. At this point you will notice that the original water texture becomes white. This is because the color offset channel is used to add color. By mapping a texture to it you are actually adding more color to it thus resulting in a white. This will still work with this example because the information for the bump is there even though you cannot see it. NOTE: To see the changes you are making in the Hypershade on the original water texture, you can remap the colors of the original water texture with a ramp.
STEP SEVEN Repeat the above steps to produce two more water textures. Rename these Ripple2 and Ripple3. Connect Ripple2 to Ripple1's colorOffset. Connect Ripple3 to Ripple2's colorOffset. Click here to view larger image For the Ripple2 change the Ripple Origin to 0.4 and 0.4. For the Ripple3 texture change the Ripple Origin to 0.3 and 0.5.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/ (3 of 5) [3/7/2000 14:49:46]
Assistant Online - Maya/How Tos/Rendering/Ripple
STEP EIGHT In the Hypershade window, select the Ripple3 texture. Select Window -> Animation Editors -> Graph Editor. Press W on the keyboard to select the Move tool. Click on the curve to select it. Click here to view larger image Hold down the Shift key, Move the curve to the right so that the end Keyframe is set to around 70. Repeat for the Ripple2 and Ripple1, setting their end keys at 60 and 55 respectively.
STEP NINE Render the Scene. You will notice in your render that only the Ripple node is rendered while the others do not render out. The reason for this is that the Bump node uses Alpha information which is not provided because you have only been mapping color information from the previous nodes. You will need to use color information to provide the bump information. To do this, Create a Luminance Node in the Hypershade under the Utilities menu. Highlight the connection between Ripple and the Bump Node and press Delete. Click here to view larger image Drag Ripple onto the Luminance node, the connection editor will open. Connect Ripple.outColor to Luminance.value. Drag Luminance on to the Bump Node, and Connect Luminance.outValue to Bump.bumpValue.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/ (4 of 5) [3/7/2000 14:49:46]
Assistant Online - Maya/How Tos/Rendering/Ripple
CONCLUSION Test Render your scene at a few diffrent frames. You should now see ripples on the surface. Mapping textures to the colorOffset of a texture offers a way to layer textures that will ultimately be used as a bump map. Keep in mind that you will need to use a luminance node to achieve this result. Another approach to this is instead of connecting Outcolor to colorOffset, connect outAlpha to the Alpha Offset for each texture thus keeping Alpha information intact which can connect directly to the Bump Node therefore eliminating the need for the Luminance node. Download ripple.ma. [~ 5kb] Use of this file confirms your agreement to the Terms and Conditions set out on the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/ (5 of 5) [3/7/2000 14:49:46]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/img/six.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/img/six.jpg [3/7/2000 14:49:53]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/img/eight.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/img/eight.jpg [3/7/2000 14:50:02]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/img/nine_2.jpg
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/ripple/img/nine_2.jpg [3/7/2000 14:50:06]
Assistant Online - Maya/How Tos/Rendering/Shading Networks
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Shading Networks
HOW SHADING NETWORKS OPERATE
by Robert Magee
Maya: Base Rendering Maya's Shading networks allow you to build up a shader using various nodes. These nodes connect together to help determine the final look of the shader when it is applied to a surface. The descriptions in the Maya shader library are a great place to learn more about how different nodes come together to form a network. You can use these descriptions to help you work with the pre-built shaders and to analyze them for learning purposes. Material Nodes Material nodes contain all the information that affects the overall shading of the network. Some of the common material types include: ● Lambert ● Phong ● PhongE ● Blinn There are attributes associated with these nodes that allow you to determine Common material attributes such as reflectivity, transparency and color. You can also determine the way in which the surface reacts to light using the Specular shading attributes.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/shader_ref/ (1 of 3) [3/7/2000 14:50:14]
Assistant Online - Maya/How Tos/Rendering/Shading Networks
Texture Maps In Maya, every attribute can be mapped to create more dynamic results. Some of the common mapping types include: ● Color maps ● Bump maps ● Transparency maps ● Specular maps In each of these mapping types, you will see that the normal value associated with an attribute is replaced by the values found in the map. In some cases, there are RGB values associated with the color of a map and in others cases it is the alpha information which is used in the map. Placement Nodes When you create a texture map, it needs to be created with some relationship to the surfaces on which it is mapped. You can choose a 2D or 3D mapping to achieve the final look. A 2D placement uses the surface's UV coordinates to place the texture. The texture can then be adjusted to fit the UV space accordingly. A 3D placement uses an external icon to determine the position of the texture in 3D space. You can position, scale and rotate the icon to get the mapping that you want. In fact, for many of the library shaders, you would want to adjust the icon to suit your own objects. If you want to animate your object, then the placement node must be parented to the object or the texture will swim on the surface. If you have a deforming surface then you will have to convert the 3D texture into a 2D texture which works better on the surface as it deforms. Utility Nodes Maya also includes utility nodes that can add important functionality to a shading network. For instance a BlendColors node can let you combine two textures. The Sampler Info node can get information from surfaces during the rendering process then use that information to affect the network. In the shader library, you will find some examples of utility nodes at work.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/shader_ref/ (2 of 3) [3/7/2000 14:50:14]
Assistant Online - Maya/How Tos/Rendering/Shading Networks
Conclusion This short synopsis of how shading networks operate is designed to help you make best use of the shader library. Reviewing how other people build shaders is one of the best ways to begin creating your own. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/shader_ref/ (3 of 3) [3/7/2000 14:50:14]
Assistant Online - Maya/How Tos/Rendering/Share Texture Nodes
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Share Texture Nodes
HOW TO SHARE TEXTURE NODES
by Terry Stoeger
MAYA Complete Rendering In this lesson, you will learn how to use the same ramp texture node to define the transparency, specular color and bump maps. The advantage of using the same texture node for all Download Movie [~240 Kb] three is the ease of making changes: you would only have to make changes to one ramp instead of three. For this example you will make a shading network that creates a shiny, perforated surface. STEP ONE In the Hypershade menu select Create, and add the following: ● Materials -> Blinn Surface Material (With Shading Group turned on) ● Textures -> 2D -> Ramp texture (Include Placement turned on) ● Utilities -> General -> Reverse ● Utilities -> Color -> Clamp node.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/sharing_node/ (1 of 4) [3/7/2000 14:50:23]
Assistant Online - Maya/How Tos/Rendering/Share Texture Nodes
STEP TWO Begin by double clicking the ramp texture to open the attribute editor. Change the Type to Circular Ramp. Set the ramp colors to black and white and slide them closer together. Select the place2dTexture tab and change the Repeat UV to 5 and 5. STEP THREE Double click on the Blinn Shading Group to open the Attribute Editor. Change the Color to a dark blue. You will now map the ramp to the Transparency. Drag and Drop with MMB the ramp texture to the Transparency slider of the Blinn Shading Group. STEP FOUR If you were to map the ramp directly to the specular color, the transparent areas would have highlights instead of the opaque areas. This is because white is treated as transparent and black as opaque. To solve this, you will connect the reverse utility node to the ramp before mapping to the specular color. In the Hypershade, Drag and Drop with MMB the ramp onto the reverse node. This will open the Connection Editor with the ramp in the Outputs column and the Reverse node in the inputs column. In the left column, click on Out Color and then click on Input in the right column. This connects the Ramp node's Out Color to the Reverse node's Input.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/sharing_node/ (2 of 4) [3/7/2000 14:50:23]
Assistant Online - Maya/How Tos/Rendering/Share Texture Nodes
STEP FIVE If you map this new reverse node directly to the specular color, you will have no control over its color. This can be solved by inserting the clamp utility node. Drag and Drop with MMB the reverse node onto the clamp node. This will open the Connection Editor with the reverse node in the Outputs column and the clamp node in the inputs column. In the left column, click on Output and then click on Input in the right column. This connects the reverse nodes Output to the clamp nodes Input. STEP SIX Double click on the Blinn Shading Group to open the Attribute Editor. You will now map the clamp to the Specular Color. Drag and Drop with MMB the clamp utility node onto the Specular Color slider of the Blinn Shading Group. This connects the Clamp Output to the Blinn's Specular Color. STEP SEVEN The clamp node can now be used to control the intensity and color of the specular highlight. Double click on the clamp node to open the Attribute Editor. In the Clamp Color Attributes section, enter .75 in all three channels for Max. This will give you a 75% gray as the specular color. As you enter .75 in the channels, watch the Shading group in the Hypershade. You will see first red being added , then green, then blue. This is the order of the min, max and input channels from left to right X-Y-Z = R-G-B . For example: If you want the specular color to be blue, lower the number in the red and green channels. STEP EIGHT Finally, the Ramp texture will also be used for a Bump Mapping. Drag and Drop with MMB the Ramp texture onto the Bump Mapping attribute in the Blinn attribute editor.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/sharing_node/ (3 of 4) [3/7/2000 14:50:23]
Assistant Online - Maya/How Tos/Rendering/Share Texture Nodes
CONCLUSION You have now created a shading network that uses one texture for Transparency, Specular Color, and Bump Mapping. Any change to the texture or its placement, will be reflected in all three channels. This will also minimize confusion and improve rendering performance.
Click to view larger version
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/sharing_node/ (4 of 4) [3/7/2000 14:50:23]
Assistant Online - Maya/How Tos/Rendering/Soft Spotlight
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Soft Spotlight
HOW TO CREATE A SOFT SPOT LIGHT
by Haskell Friedman
MAYA Complete Rendering In this lesson, you will learn how to create a spot light with soft lighting and shadows. This will involve the setting of several light attributes such as decay, intensity and penumbra angle as well as the use of depth map shadows.
Default Lighting [~432kb] Soft Lighting [~416kb]
By default, Maya's spot lights create strong sharp lighting. In this lesson, you will learn how to soften the effect of the light by adjusting various light attributes. Throughout this example, you will be shown how changing each attribute affects the look of the scene. At the end, you will learn how to use depth map shadows to further enhance the soft lighting effect. STEP ONE Create a primitive NURBS plane to act as a floor surface. Set Scale X, Scale Y,and Scale Z to 24.0, so that the plane covers the perspective grid. Rename the surface floor. If you would like to preview the scene using interactive hardware lighting, set the surface's Patch U and V to 16.
Place a character into the scene. This lesson uses Primitive man from Lesson 15 in the Learning Maya book. Place the character at the origin (0, 0, 0) and set the character's height to about 6 units.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/soft_spot_light/ (1 of 5) [3/7/2000 14:50:42]
Assistant Online - Maya/How Tos/Rendering/Soft Spotlight
STEP TWO Create a spotlight then rename it softSpotLight. Use the Show Manipulator tool to place the eye-point manipulator above the character at roughly a 45 degree angle. Place the look-at manipulator at the origin. Create an ambient light to provide fill lighting for the scene. Edit the Intensity to a value of 0.25 and the Ambient Shade to 0.0. STEP THREE In the Render Globals, set the Presets to Preview Quality in the Anti-aliasing Quality tab. Test render the scene to preview the lighting. Looking at the image, you will notice that the edge of the light, which is called the umbra, is very sharp. In this lesson, you will soften this edge. First you will tweak the color and angle of the light. STEP FOUR Open the Attribute editor for softSpotLightShape. Click on the Color swatch and set the HSV to 44.0, 0.06, 1.0. This creates a slightly off-white color. Now set the Cone Angle to around 45 degrees. Re-render the scene. Now the light's umbra is larger and covers more of the floor surface.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/soft_spot_light/ (2 of 5) [3/7/2000 14:50:42]
Assistant Online - Maya/How Tos/Rendering/Soft Spotlight
STEP FIVE You will now add Decay to your light. This means that the intensity of the light will decrease as the distance away from the source increases. To add decay to the scene, set the light's Decay Rate to Quadratic. Re-render the scene. The scene has suddenly become very dark. This is because the intensity of the light is not strong enough for this decay setting. STEP SIX To compensate for the new decay rate you will have to increase the amount of light in your scene. Set the spot light's Intensity to 500. Re-render the scene. Now your scene has more than enough illumination to compensate for the decay. In fact, the scene should be a little over-exposed since you will be further softening the light in the next step. STEP SEVEN Earlier you noted that the light's umbra is too sharp. To soften it, you will need to set the light's Penumbra angle and Dropoff. The Penumbra angle defines a ring around the light's edge where the light will fade more quickly. The Dropoff will cause the light intensity to decrease from the center of the spot to the umbra. Set the Penumbra Angle to 5.0 and the Dropoff to 25.0. Re-render the scene. You should now see a softening effect that is a combination of the Penumbra, Dropoff and Decay.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/soft_spot_light/ (3 of 5) [3/7/2000 14:50:42]
Assistant Online - Maya/How Tos/Rendering/Soft Spotlight
STEP EIGHT Now that you have soft lighting you will want soft shadows. You will use Depth map shadows to achieve the desired effect. In the Attribute Editor for your softSpotLight, open the Shadows section. Under Depth Map Shadow Attributes, turn Use Depth Map Shadows to On. Re-render your scene. With the default settings, the shadow appears sharp and pixelated compared to the light itself. STEP NINE To fix the shadow, you will reduce the resolution of the depth map and apply a filter setting that will blur the effect of the shadow. You are going to use a very low resolution depth map so that it appears softer. If you were to View Movie [~416Kb] increase the resolution of the depth map, the shadow would appear sharper and you would require a higher filter setting to soften the shadow. In the Attribute editor, set the Dmap Filter Size to 4 and the Dmap Resolution to 256. Render your scene. Now the shadows match correctly with the type of lighting being produced. This completes the soft light effect. Note: You can increase the Dmap Filter Size for higher quality shadows but keep in mind that the higher the filter size the longer it will take your scene to render. CONCLUSION You now know how to soften a spotlight by combining, decay, dropoff, penumbra and depth map shadows. Be sure to remember that the attribute values used in this lesson have been chosen because of the size of the scene. To use similar lighting in your work, you may have to increase or decrease the attribute values depending on the positioning of your lights and the size of your scene.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/soft_spot_light/ (4 of 5) [3/7/2000 14:50:42]
Assistant Online - Maya/How Tos/Rendering/Soft Spotlight
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/soft_spot_light/ (5 of 5) [3/7/2000 14:50:42]
Assistant Online - Maya/How Tos/Rendering/Toon Shader
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Toon Shader
HOW TO MAKE A CARTOON SHADER
by Tom Kluyskens
MAYA Complete Rendering In this lesson, you will learn how to create a cartoon shader. By combining several utility nodes to remap a Blinn material node using a Ramp, you will define the cartoonish look of the shader.
Play Movie [~485kb] This lesson will help you better understand how you can create custom shading networks using the Connection editor and utility nodes. STEP ONE In the Hypershade, select Create -> Create Render Node.. and create the following rendering nodes: Material nodes: Texture nodes: Utility nodes:
Blinn (no Shading Group), Surface Shader (with Shading Group) Ramp (no Texture Placement, Normal) Sampler Info Clamp Condition
The Blinn material node will be used to catch highlights on the objects. Leave the color grey. The greyscale blinn shading (white = highlights) will be transformed into the cartoon shader effect by remapping the grey values into a sequence of colors using a ramp. The Sampler info node will be used to put a line at the objects' border.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/ (1 of 4) [3/7/2000 14:50:55]
Assistant Online - Maya/How Tos/Rendering/Toon Shader
STEP TWO In the Hypershade with the MMB, drag the Blinn node over the Clamp node to open the Connection Editor. Connect the Blinn node's Out Color to the Clamp node's Input. The Clamp node is going to reduce all greyscale values to values less than or equal to 1. The clamp cuts off all highlights that have a greyscale value greater than 1 (superwhite). Open the Attribute Editor for the Clamp node, and set the left Max field to 1. The left field represents the Red channel (middle = Green, right = Blue), but because grey is an equal mix of R G and B, you only need one channel (this lesson chooses R). Min should be set to 0. STEP THREE The same way, connect the Output R of the Clamp node to the V Coord of the Ramp node, using the Connection Editor. Make sure that your Ramp is a V Type ramp. The color output of the ramp is now going to be the color in the ramp that corresponds to the greyscale value (0 <= clamp Color R Output <= 1) of the input. This technique is called remapping. STEP FOUR Connect the Ramp node's Out Color to the Color1 of the Condition node. Also connect the Facing Ratio of the Sampler info node to the First Term of the Condition node. The Facing Ratio, is the degree to which a point on a surface is facing towards the camera. If the point is located on a part of the surface that is facing 90 degrees away from the camera (typically the border of a sphere), the Facing Ratio is 0. If the angle between the surface normal and the camera ray is 0, the Facing Ratio is 1. Check your online Maya manuals for more info. STEP FIVE Open the Attribute Editor for the Surface shader material. Select Add -> Add Attributes... and add following attributes (float, scalar): LineThickness : Min 0, Max 1, Default .2 LineR LineG LineB These are the user-definable border thickness and color.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/ (2 of 4) [3/7/2000 14:50:55]
Assistant Online - Maya/How Tos/Rendering/Toon Shader
STEP SIX Connect the Line Diagram of final dependency graph Thickness and LineR G B of the Surface shader node to the Second Term and Color2 R G B of the Condition node. Set the Condition Operation to Greater Than. If the Facing Ratio (first term of the condition) is smaller than the line thickness (second term), the condition output will be Color2 (line color set in surface shader), else it will be Color1 (ramp-blinn color). Connect the Condition node's Out Color to the Surface shader node's Out Color. STEP SEVEN Adjust your Ramp to use the colors that you want. Cartoon shaders normally may be designed to use no interpolation between the ramp colors in order to create hard uniform color zone edges. Shown below is a sample ramp and how the final shader appears. Here are some examples of how different positions, color zones and interpolation affect the final result.
Other edits you can make include the following: ● Adjust line thickness and color in the attributes of the surface shader. ● Adjust your blinn parameters to have different kinds of highlights. ● You can even put a bump map on the blinn. This technique was used on the worm in the animation. ● You can use another material (instead of blinn) to get other kinds of highlight. You can now assign the shader to your objects.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/ (3 of 4) [3/7/2000 14:50:55]
Assistant Online - Maya/How Tos/Rendering/Toon Shader
CONCLUSION This lesson taught you how to build a cartoon shader as well as how to work with several utility nodes to build a complex shading network. Thanks to Michele Borghi and Duncan Brinsmead for the original design of the cartoon shader. Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/ (4 of 4) [3/7/2000 14:50:55]
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/img/cartoon_depend_lg.gif
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/img/cartoon_depend_lg.gif [3/7/2000 14:50:59]
Assistant Online - Maya/How_Tos/Rendering/Toon Shaders/Ramp Examples
Alias|Wavefront / Assistant Online / Maya / How Tos / Rendering / Ramp Examples
CARTOON SHADER: Ramp examples Shown below are some sample ramps that explore how the positions, number of color zones and ramp interpolation affect the final result: Example1: 2 colors, no interpolation
Example2: 3 colors, no interpolation
Example3: 5 colors, no interpolation
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/ramp.html (1 of 2) [3/7/2000 14:51:17]
Assistant Online - Maya/How_Tos/Rendering/Toon Shaders/Ramp Examples
Example4: 2 colors, smooth interpolation
Example5: 4 colors with transition zones, smooth interpolation
Example6: 5 rainbow colors, linear interpolation
Your use of this file confirms your agreement to the Terms and Conditions set out in the Terms and Conditions page.
http://www.aw.sgi.com/assistant_online/entertain/maya/how_tos/rendering/toon_shader/ramp.html (2 of 2) [3/7/2000 14:51:17]
images by Chris Beaumont
Aliasing Artifacts in Maya: A Technical Overview Maya 1.0.1 IRIX and Maya 1.0 NT By Andrew Woo Alias|Wavefront a Silicon Graphics Company AP-M-AA-01
Aliasing Artifacts in Maya: A Technical Overview Algorithms: Maya Rendering Version 1.0, March 1998 ã September 1998, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A, All rights reserved. Assist Publishing Group: Robert Magee, Tracy Barber Maya 1.0 Rendering Team: Sanjay Bakshi, Silviu Borac, Josh Cameron, Jim Craighead, Renaud Dumeur, Antoine Galbrun, Philippe Limantour, Ryan Meredith, Chris Patmore, Andrew Pearce, Joe Spampinato, Kelvin Sung, Chris Thorne, Mamoudou Traore, Greg Veres, Gianluca Vezzadini, Changyaw Wang, Andrew Woo. A document by Andrew Woo Cover image credit: Chris Beaumont The following are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited: AliasÔ MayaÔ Maya ArtisanÔ Maya F/XÔ Maya PowerModelerÔ
MELÔ Alias MetamorphÔ OpenAliasÔ Alias OpenModelÔ Alias OpenRenderÔ
Alias PowerTracerÔ Alias QuickRenderÔ Alias QuickShadeÔ Alias QuickWireÔ Alias RayCastingÔ
Alias RayTracingÔ Alias SDLÔ Alias ShapeShifterÔ Alias StudioPaintÔ ZaPiT!Ô
MediaStudioÔ MultiFlipÔ VizPaint2DÔ
3DesignÔ
The following are trademarks of Alias|Wavefront, Inc.: Advanced VisualizerÔ Wavefront ComposerÔ DynamationÔ
ExploreÔ Wavefront IPRÔ KinemationÔ
Graph Layout Toolkit Copyright ã 1992-1996 Tom Sawyer Software, Berkeley, California, All Rights Reserved. All other product names mentioned are trademarks or registered trademarks of their respective holders. Any forward looking statements in this document are speculative and are based on current assumptions and in no way imply Alias|Wavefront will at any future time act upon said statements. This document contains proprietary and conÞdential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, nor its employees shall be responsible for incidental or consequential damages resulting from the use of this material or liable for technical or editorial omissions made herein.
Alias|Wavefront ❚ 210 King Street East ❚ Toronto, Canada M5A 1J7
Aliasing Artifacts
Technical Overview
When rendering in Maya, the quality of an imageÕs aliasing is one of the key issues that must be addressed. Aliasing artifacts can impact the look of an image and create unsatisfactory results. One method of dealing with these artifacts is to increase the Shading samples in MayaÕs Render Globals. While this may solve the aliasing problem, it is often not the most efficient way for the Maya renderer to deal with the aliasing artifacts. This means that renderings take longer when in fact it may have been possible to solve the problem another way. As well, if you find that the problem can be fixed using another method which does not require increased shading samples, it is very easy to forget to reset the original anti-aliasing values. Thus, the Maya renderer will continue to run a lot slower than needed. This paper has been written to help you identify and classify typical aliasing artifacts, with some understanding of the technical algorithms, so that you can optimally solve these artifacts with minimal impact to the performance of the renderer. This document will also help you recognize those cases where eventually the shading samples will need to be increased. It can be argued that all the aliasing artifacts should be taken care of automatically, without much user intervention. Our experience has found that automatic solutions may limit what you can achieve and prevent you from finding the desired balance between quality and performance. The Maya renderer therefore offers many attributes to help you solve the aliasing problems on an project by project basis. These attributes ensure that you do not hit a wall when a certain image quality is desired, or when a certain performance limit needs to be satisfied. Better automated solutions will be sought through continued research.
THE CAUSES OF ALIASING Following is a series of the most common aliasing artifacts, with visual examples so that you can easily identify the type of artifacts for future references.
Introduction Edge Aliasing
Edge Aliasing The Maya renderer employs a 32-bit, A-buffer to anti-alias polygon edges. This provides an analytic solution for producing very high quality edge anti-aliasing results. Thus edge anti-aliasing is separated from shading anti-aliasing, which also buys some performance gains, because usually a lot less shading samples are required for good overall anti-aliasing. Once you identify that the problem is that of edge aliasing, you can go to Render Globals ® Render Quality ® Edge Anti-aliasing to set the attribute to either High Quality or Highest Quality. The following image shows two sphere images that show high and low quality edge aliasing.
Good quality aliasing
Poor quality aliasing
High and low quality edge aliasing Since it is difficult to see the jagged effects well, the images are resized to show the aliasing more closely.
Poor quality aliasing
Good quality aliasing
Close-up of high and low quality edge aliasing
Thin Geometry Aliasing: In cases of very thin pieces of geometry, the 32-bit mask for edge antialiasing may not be adequate. This usually occurs when the polygons themselves are less than one tenth of a pixel wide. Under such situations, the problem gets worse as you see flicker over an animation. Therefore a multi-resolution bit mask will be implemented in Maya 1.5 IRIX and Maya 2.0 NT to help deal with thin geometry.
2 Aliasing Artifacts in Maya
The Causes of Aliasing Aliased Edges Through Transparency
Aliased Edges Through Transparency The 32-bit, A-buffer mask only applies to the first visible fragments in a pixel. If there are surfaces behind a transparent surface, the mask does not apply, and the renderer needs to resort to point sampling. Thus the Shading samples attribute for that surface needs to be increased to improve both the shading and the edge anti-aliasing of those surfaces. Unfortunately, the same limitation exists for raytracing.
Specular Highlight Aliasing The material used for rendering is also a very important consideration. The more common (isotropic) materials used by our customers include:
Note:
■
Phong
■
PhongE
■
Blinn (based on the Torrance-Sparrow model) It is mathematically provable that the highlight hotspots for the above materials all sit in the same spot. So the main difference between those models are how their highlights decay.
The following image has 3 thin cylinders with materials, from top to bottom, Phong, Blinn + PhongE (with diffuse set to 0). It is important to note that the Phong model results in a very sharp, hard edge for its specular highlight. With such a hard highlight, animations with thin-curvy or (nosily) bump mapped surfaces can usually result in extreme changes in the specular behavior, and thus resulting in flickering. The PhongE model is slightly better in its harsh edges. The Blinn model is the best in terms of a soft highlight. As a result, the same thin-curvy or bump mapped surface will appear much cleaner when animated.
Phong
Blinn
PhongE
Material highlights Technical Overview 3
Introduction File Texture Aliasing
Tip:
Increasing the shading samples may not help entirely; the shading samples will need to be very high, until the artifacts go away. The choice of the material can be a much more efficient alternative.
File Texture Aliasing When particular file textured surfaces are shimmering (or flickering) over an animation, it is also best not to play with the shading samples first. The first choice should be to play with the File texture ® Filter ® Filter and File texture ® Filter ® Filter offset values. First, it is recommended that you do not set the Filter attribute to 0, because the defaults for Filter and Filter offset are set so that in most cases, you get the best quality images. In this case, filtering means that there is a mipmap structure for texture mapping. In other words, the renderer stores multiple resolutions of the same texture. For example, if you have a 256x256 image - the renderer stores the 256x256, then 128x128, then 64x64, then 32x32, etc. The Maya renderer computes, internally, a filter size value so the renderer knows when to access which level (which resolution) to get the good quality results. The user can play with the Filter and Filter offset attributes, which act as multiplier and adder to the filter size values, respectively, to get smoother or crisper pictures. Think of it conceptually as FILTER * filter_size + FILTER_OFFSET. By setting Filter to 0 or a very small value, you're telling the renderer to ignore the internal filter size computation so that it completely relies on the Filter offset to get you to the right resolution levels. However, in some situations, playing with the Filter values will not help. Then the more optimal solution would be to employ a higher order filter, such as the quadratic filter (File texture ® filter ® quadratic). The following image has a file texture mapped with the default mipmap filter (on the left) and a quadratic filter (on the right). The quadratic filter does more computations in projecting pixel information to texture space, thus resulting in much cleaner results. Be sure to note that this method also increases rendering time, and should not be invoked unless the filter alternative is not useful.
Texture aliasing
4 Aliasing Artifacts in Maya
The Causes of Aliasing Depth Map Shadow Aliasing:
images by Chris Beaumont
The intention of the filter attributes, discussed earlier, is not to blur the images as a special effect. It may work in certain circumstances for the mipmap setting coincidentally, but likely will not work for the other settings. The attributes are meant as an adjustment factor to get the best image quality. For example, the following images show an exaggerated Filter of 2.6 when applied with mipmap and quadratic filters, respectively. Notice that exaggerated filter values will result in blockiness of the quadratic (and higher order filters) textures.
Mipmap texture
Quadratic texture
Depth Map Shadow Aliasing: The Maya 1.0 renderer had image quality problems where the depth map shadows often display very blocky, shadow borders. Thus as a workaround, it is recommended that the resolution of the shadow depth map be increased. This workaround is not ideal since it can increase both rendering time and memory usage. This problem has been fixed since Maya IRIX 1.0.1 and Maya NT 1.0, and you should not be employing such high resolutions any more. The following example shows a 256x256 resolution shadow depth map, casting a shadow from a sphere. Note the jaggies at the shadow borders. Increasing the shading samples will not help the situation.
Technical Overview 5
Introduction Depth Map Shadow Aliasing:
Poor depth map shadow aliasing To improve the anti-aliasing of such shadow border jaggies, first increase the light's Shape ® Dmap Filter Size. The below image uses a filter size of 3. The filter size indicates the level of neighboring shadow map pixels that are used to filter the shadow borders. Note:
A larger Filter size beyond 4 is not recommended. If more than 4, each shadow sample will need to evaluate far too many neighboring shadow map pixels. The final image shows even better anti-aliasing, when the Shape ® Dmap Resolution is set at 512x512.
Filtered depth map shadow
High resolution depth map shadow
6 Aliasing Artifacts in Maya
The Causes of Aliasing Light Fog Shadow Aliasing:
Finally, if your scene allows you to narrow the cone angle for the spotlight (or reduce the orthographic width of a directional light) without adversely affecting the outcome of the lighting, then you will get crisper shadows without having to increase the shadow map resolution. This is because the resolution of the shadow depth map will be focused in a smaller region, which, in effect, gives it much better resolution.
Light Fog Shadow Aliasing: Light fog shadows only work with depth map shadows. This is because the algorithm for calculating light fog shadows projects the view vector onto the shadow depth map. Then, for each shadow map pixel that the projected view vector visits, it asks whether it is in shadow or not. However, since this is needed for each view vector, and traversing the many shadow depth map pixels can increase rendering time, the renderer stochastically samples the shadow depth map pixels, capped by the Shape ® Depth Map Shadow Attributes ® Volume shadow samples value. Note the first image below, where the Depth map resolution is set at 512x512, but the Volume shadow samples is set at only 15. Notice the dicing artifact with respect to the light fog shadows, sometimes capturing the occluding surface's shadow, sometimes not. In an animation, this may cause flickering artifacts as well. Increasing the shading samples will not help this situation either. But increasing the Volume shadow samples to 50 will produce a much cleaner image, as seen in the second image below. Note that you should only worry about this attribute when you have small or skinny surfaces which may miss/hit the light fog shadow computations For example, if the occluding surface is a big sphere, there would not have been any artifacts.
Aliasing artifacts
Improved aliasing
Aliasing artifacts in fog shadow
Technical Overview 7
Introduction Motion Blur Visibility Aliasing:
Motion Blur Visibility Aliasing: To anti-alias motion blurred images properly can be tricky. The renderer does not use the standard distributed raytracing because it relies on raytracing and dicing artifacts that are significant. Alias|Wavefront invented a new (and patented) approach which produces an analytical solution to the edge anti-aliasing during motion blur. The following image shows the progression of image quality when certain attributes are increased. The first image indicates what happens when the Edge anti-aliasing is set at Low. In this case, all aliasing contains artifacts. With the next image, the Edge anti-aliasing is set at High. With the next image, Edge anti-aliasing is set at Highest which invokes more shading samples that do a much better job at spatial anti-aliasing. In the final image which uses higher initial Shading samples, and sometimes Visibility samples, the image contains well aliased motion blur. This is elaborated in Maya Software Rendering, Assistant Online [Pearce, Sung]. Low Quality
High Quality
Geometric Aliasing
Spatial Shading Aliasing
Highest Quality
Temporal Shading Aliasing
Highest Quality (With 16 shading samples)
Geometric vs. spatial vs. temporal aliasing
Image Plane Aliasing: If your image plane appears aliased, increasing the global shading samples will not help. The only way to improve the anti-aliasing of the image planes would be to increase the attribute values of Imageplane ® Shading samples and Imageplane ® Max shading samples. If the image of the image plane matches the resolution of the rendering, then additional anti-aliasing will not be required.
8 Aliasing Artifacts in Maya
The Causes of Aliasing Check List for other Common Animation Aliasing Artifacts:
Check List for other Common Animation Aliasing Artifacts: ■
■
Flicker due to screen space or min-screen tessellation. With a surface set at screen space or min-screen tessellation, the tessellation per frame can be different. When different, you can see flickering, for example, due to solid textures receiving very different (x,y,z) coordinates to texture map. Flicker due to filter or filter offset set to very small numbers. This was
explained in the file texture section above. ■
Flicker due to very noisy texture(s). With very noisy textures (other than file textures), usually the texture does not know how to antialias itself. If it does, it usually has Filter and Filter offset attributes, which you can tweak, as discussed in the file texture section. The other option is to apply a convert-solid-to-2d-texture operation, in which a snapshot of the noisy texture is completed to create a file texture that matches the procedural texture. Rendering with this file texture, and its ability to anti-alias, may resolve the flickering problems.
■
Exaggerated aliasing due to incorrect usage of multi-pixel filtering. If your non-filtered rendering already looks aliased, having multi-pixel filtering turned on will exaggerate the aliasing even more. The multipixel filtering is meant to improve the quality of thinline situations and when smoothing a good image quality result is needed.
■
Flicker or dicing due to raytracing soft shadows with small number of shadow samples. Soft shadows occur when Light ® Shadows ® Light radius is non-zero. If soft shadows are desired, it is best to use
shadow depth maps instead of raytrace soft shadows. It will require many samples to avoid flicker in the raytrace soft shadows, which becomes very time consuming for the renderer. Raytrace shadows are useful, as opposed to depth map shadows, mainly when shadows from transparent objects need to show colored shadows.
Raytraced aliasing artifacts
Check List for Mistaken Aliasing Artifacts: ■
Aliasing due to composite rendering. It is very common mistake to set the Render Globals ®ÊComposite render to On, then noticed that the rendered results look very aliased. This is because the composite render option is intended to look aliased before compositing, but should be perfect after compositing. This means that a composite render does not want to add the residue of the background color into the pixel result.
Technical Overview 9
Introduction Conclusion
■
Nickeling artifacts with tessellation. It is very easy to mistake the nickeling found at the edge of a surface as an anti-aliasing problem. This problem is in fact a tessellation issue and increasing the shading samples will not help. Rather, select the surface, and increase its tessellation parameters.
Nickeling
Nickeling at the edge of an object ■
Terminator problem. This is a common artifact in computer graphics, not particular to our software. This staircase of black polygons is due to the combination of coarse tessellation of the surface, and raytracing shadows. The only workaround for this problem is to increase the tessellation of the surface.
Staircase effect
■
You're out of options... Even if you need to increase the Shading samples, don't do it globally yet if this is only a problem for a small,
select number of surfaces. Instead, select the troubled surfaces, then edit the Shape ® Render Stats ® Shading Samples Override ® Shading Samples so that only those surfaces will have their shading samples increased, without having to affect the entire scene.
Conclusion When setting up a rendering it is important to remember that aliasing may occur for all of the reasons mentioned in this document. Be sure to try the various methods outlined here to fix aliasing issues before increasing the shading samples and slowing down rendering time. These tips should help you find the right balance between quality and performance.
10 Aliasing Artifacts in Maya
Maya Software Rendering: A Technical Overview By Andrew Pearce and Kelvin Sung
Alias|Wavefront a Silicon Graphics Company AP-M-SWR-01
Maya Rendering: A Technical Overview Algorithms: Maya Rendering Version 1.0, March 1998 ã September 1998, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A, All rights reserved. Assist Publishing Group: Bob Gundu, Robert Magee Maya 1.0 Rendering Team: Sanjay Bakshi, Silviu Borac, Josh Cameron, Jim Craighead, Renaud Dumeur, Antoine Galbrun, Philippe Limantour, Ryan Meredith, Chris Patmore, Andrew Pearce, Joe Spampinato, Kelvin Sung, Chris Thorne, Mamoudou Traore, Greg Veres, Gianluca Vezzadini, Changyaw Wang, Andrew Woo. A document by Andrew Pearce & Kelvin Sung Cover image credit: Balloon Girl by Chris Landreth, and the Alias|Wavefront Bingo Team. The following are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited: AliasÔ MayaÔ Maya ArtisanÔ Maya F/XÔ Maya PowerModelerÔ
MELÔ Alias MetamorphÔ OpenAliasÔ Alias OpenModelÔ Alias OpenRenderÔ
Alias PowerTracerÔ Alias QuickRenderÔ Alias QuickShadeÔ Alias QuickWireÔ Alias RayCastingÔ
Alias RayTracingÔ Alias SDLÔ Alias ShapeShifterÔ Alias StudioPaintÔ ZaPiT!Ô
MediaStudioÔ MultiFlipÔ VizPaint2DÔ
3DesignÔ
The following are trademarks of Alias|Wavefront, Inc.: Advanced VisualizerÔ Wavefront ComposerÔ DynamationÔ
ExploreÔ Wavefront IPRÔ KinemationÔ
Graph Layout Toolkit Copyright ã 1992-1996 Tom Sawyer Software, Berkeley, California, All Rights Reserved. All other product names mentioned are trademarks or registered trademarks of their respective holders. Any forward looking statements in this document are speculative and are based on current assumptions and in no way imply Alias|Wavefront will at any future time act upon said statements. This document contains proprietary and conÞdential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, nor its employees shall be responsible for incidental or consequential damages resulting from the use of this material or liable for technical or editorial omissions made herein.
Alias|Wavefront ❚ 210 King Street East ❚ Toronto, Canada M5A 1J7
Maya Software Rendering
Technical Overview
This document describes some of the technical details of the Maya 1.0 Software Renderer. It assumes some technical knowledge of the inner workings of a renderer. There are many sections of this document which can be helpful to non-technical people as well. The document is laid out in two sections: ■
The Rendering Pipeline
■
Understanding the Shading Network.
The Rendering Pipeline on page 1 outlines the algorithms that the renderer uses from the moment it is invoked to the final pixel output. Understanding shading networks on page 21 describes the power of the Maya shading network and how to tap that power interactively. It is hoped that this document will give you the knowledge that will help you to effectively, efficiently and optimally use the Maya 1.0 Renderer for your productionÕs needs. The Rendering Pipeline assumes you have a basic understanding of
rendering algorithms. Understanding the Shading Network assumes your are familiar with basic Maya Dependency Graph connections, nodes and attributes.
THE RENDERING PIPELINE This section outlines the phases and algorithms the Maya 1.0 Renderer uses in order to produce a final image. Before discussing the steps involved in Maya Rendering, a high-level overview of the algorithm is in order. The Maya Renderer is a hybrid renderer. It uses an EAS (Exact Area Sampling) or A-buffer algorithm for primary visibility from the eye, and then ray traces any secondary rays. EAS computes a coverage mask for the geometry in a pixel, which is more precise than point sampling can produce in all but the most extreme cases. The improved coverage mask results in better edge anti-aliasing of the objects in a scene. Part of the philosophy of the Maya Renderer is that it attempts to solve each part of the rendering process independently, using the
The Rendering Pipeline Step One: Initialize the camera
best method for each rendering problem. Geometric anti-aliasing is solved with EAS completely before the shading is solved, which is solved separately from glow, etc. The Maya Renderer also takes advantage of data cache and instruction cache locality by making each shading call with a vector of samples. If the shader is called with a single sample, the instructions for the shader must be brought into the instruction cache by the computerÕs CPU, and any data that that shader uses must be brought into the data cache. Cache memory works best (fastest) if the next instruction or next data are in the cache. By providing each shader with a vector, or array, of samples, MayaÕs renderer takes advantage of the computerÕs built-in caching mechanism. When an object is encountered that requires ray tracing to compute some component of its shading (ray traced shadows, reflections, and/or refractions), the ray tracer is invoked. The steps involved in rendering are: 1 Initialize the camera 2 Perform shadow depth map computations 3 Compute geometries that are potentially visible for rendering 4 Compute the tile system 5 Render each tile a) Compute visibility for stationary objects b) Compute visibility for moving objects (only if motion blur is selected) c) Compute shading (moving and stationary objects) d) If highestQuality is selected: i) Compute Contrast ii) Compute Extra Shading 6 Composite shaded results
Step One: Initialize the camera The 3D coordinates of the camera to be rendered are determined by evaluating the Dependency Graph (DG) at the current time value. The evaluated parameters of the camera are used to compute the perspective (or orthographic) matrix, and the coordinates of the camera are used to construct the WorldToEye matrix. Image planes to be used during the rendering phase are tested for existence.
Step Two: Perform shadow depth map computations Because the Maya Renderer is a hybrid renderer containing both EAS and ray tracing code, you have the option to either ray trace shadows or to use depth map shadows. This section deals with depth map shadows only, since the depth maps must be computed as a first pass before rendering, while ray traced shadows are computed during the rendering phase.
2 Maya Rendering
The Rendering Pipeline Step Two: Perform shadow depth map computations
The shadow depth map computation is similar to shadow depth map computations for other renderers you are familiar with. A ÒdepthÓ rendering is done from the point of view of the light source, and later used during the rendering phase to determine if that light illuminates a given point (i.e., if the point is obscured by any other object closer to the light, then it is in shadow). For an excellent introduction and overview of depth map shadowing techniques, see SIGGRAPH Ô87 Reeves, Salesin and Cook, ÒRendering Antialiased Shadows with Depth MapsÓ, pp. 283-291. This section discusses what is unique about the Maya Depth Map Shadows. In Maya, Depth Map Shadows are available from each of pointLights, directionalLights, and spotLights. In the attribute editor for these lights, the Depth Map Shadow section contains settings to allow you to Read/Write/Reuse Dmap. In all dealings with Depth Map Shadows in the UI, Dmap means Depth Map. These settings cause the depth maps to be written to or read from disk and should be enabled when doing iterative render tests on a scene with many shadows, or when there is only a camera fly-by of the scene (i.e., no objects move in the area visible to the light). Be aware that if you set these flags when moving objects or moving lights are present, it may cause your shadows to remain stationary while your objects move in your animation. Another feature of Depth Map Shadows in Maya is the ability to cast volume shadows through fog. The shadowing of the fog is done by examining the shadow map a number of times across the fog volume. The number of times the fog is sampled is controlled by the attribute volumeShadowSamples. Light Fog Volume
Geometry Shadow Viewing Ray
volumeShadowSamples
Figure 1: A side view of a ray penetrating a shadow volume for a spot light. volumeShadowSamples are taken across the penetration interval. To automatically get the best resolution out of your depth map, there is an attribute called useDmapAutoFocus. When this attributeÕs value is true, the renderer automatically computes a bounding volume for the objects in the view from the light source and uses the smallest possible field of view to render the shadow map. This can, however, create artifacts over an
Technical Overview3
The Rendering Pipeline Step Two: Perform shadow depth map computations
animation if the bounding box of the objects in your scene changes; the area covered by a shadow map changes, possibly creating aliasing artifacts in your shadows, or unwanted softening or noise in the shadows. Those familiar with Depth Maps for shadowing know that there are selfshadowing artifacts that can occur due to the finite resolution of the shadow map. Only one depth value is stored per pixel and if you happen to be shading a point on a surface that lies between samples in the depth map, there is the possibility that the averaged depth from the depth map will incorrectly shadow the point being shaded. In classical depth map shadow algorithms, a jitter or bias is added to the depths before comparison in order to alleviate this artifact. This is also done in Maya. However, Maya has an additional option called useMidDistDmap which modifies the depth map calculation and eventual use. useMidDistMap is on by default. If the depth map is to be used for purposes other than shadowing, then it is best to turn this option off. For those with an interest in the specifics of the algorithm, please refer to Graphics Gems III (Academic Press, ISBN 0-12-409670-0) p. 338. Essentially, Mid Dist attempts to eliminate the need for the jitter or bias parameters by storing the midpoint between the first and second surfaces visible to the light source in the depth map, rather than simply storing the distance to the nearest surface. By doing this, a larger margin for error is provided, thereby mitigating the incorrect self-shadowing problem. Figure 2 shows a simple side view of a depth map situation. The light source is shining on a sphere and a plane. In a normal depth map, Z1 (the distance to the Closest Intersection) is stored in the depth map. When Mid Dist is enabled, Zmid (the halfway point between Z1 and Z2) is stored in the depth map.
Distance Stored
z2 Light
zMid z1
De
pt
h
Next Closest Intersection
Closest Intersection
M
ap
Figure2: Diagram of the value stored for the mid distance depth map. Directional lights can cast depth map shadows in Maya. They have two
possible behaviors. Since directional lights are assumed to be at an infinite distance from the scene (hence the parallel light rays), by default directional lights will cast shadows on the entire scene. The bounding box of the scene is taken and an orthogonal depth map region is created, which contains the entire scene. This can result in shadow depth map resolution problems if the scene is very large, but only a small section of the scene is 4 Maya Rendering
The Rendering Pipeline Shadow Computation and Motion Blur
being viewed, or if the scene changes size dramatically over an animation. To limit the number of objects that are involved in a directional lightÕs depth map, an attribute named useLightPosition is provided at the top of the Attribute Editor for directional lights. Setting this attribute to true makes the directional light take its position (the location of the directional light icon in the modeling view) into account. Objects in the half space defined by the lightÕs position and direction are affected by the directional light and are used in the creation of the shadow depth map. Any objects ÒbehindÓ the directional light are not lit and do not participate in the generation of the shadow depth map. The useLightPosition attribute is not on by default because this is a new behavior which may be unexpected by people coming from other software where directional lights were infinitely far away regardless of icon position in the scene. Another way to optimize shadows is to link the lights only to those objects which you wish to cast and receive shadows. You can also avoid casting shadows from some objects by going to the objectÕs attribute editor and turning the castsShadows flag off under Render Stats. Point lights can cast depth map shadows in the Maya Renderer. By
default, these shadows are produced by casting 6 depth maps in each of the cardinal axes directions (+X, -X, +Y, -Y, +Z, and -Z) from the point lightÕs position in space. Be aware that if you specify a large shadow depth map resolution, there will be 6 depth maps of that large resolution generated. Maya does try to compact the depth maps as much as possible, but large depth maps can still occupy a great deal of memory and take valuable time to render. To further optimize your shadow depth maps from point lights, you can turn individual directions off or on. For example, if there is nothing of interest to cast shadows on the ceiling of your room, you could disable the +Y depth map by un-checking the useY+Dmap attribute in the Depth Map Shadow Attributes section of the point lightÕs Attribute Editor. Spot lights by default use only one depth map. Using only one depth map
has limitations when the angle of the spot light exceeds 90 degrees; the resolution of the depth map must be increased dramatically to keep the shadow quality high. Maya allows you to use up to six depth maps for spot lights by setting the useOnlySingleDmap check box to false in the Attribute Editor for spotlights. When this attribute is set to false, and the cone angle of the spot light exceeds 90 degrees, five or six depth maps are created around the spot light, tiling the faces of an axis-aligned cube with faces in each of the axis directions - much the same as for a point light. The only difference is that a spotlight will only cast five depth maps if the spot light does not shine onto one of the six faces. Just as cubic reflection maps avoid aliasing at the boundaries between faces of the cube, the cubic shadow map is also filtered to avoid artifacts.
Shadow Computation and Motion Blur Basically, shadows do not motion blur in the current renderer. MayaÕs renderer takes only one geometric position (shutter mid) when sampling the shadow map, so even though the geometry moves from A to B to C, the shadow only falls at position B.
Technical Overview5
The Rendering Pipeline Step Three: Compute potentially visible geometries
Methods to work-around this limitation are to use the Mid-distance shadow depth map algorithm, or to output the shadow depth map and process it to add blur before using it in a render. Ray traced shadows will not work in almost every motion blur instance. Light
e.g. Shading this position at Time = 0.7
Position at Time = 1.0
Position at Time = 0
Position at Time = 0.5
Geometry used to compute shadow
Step Three: Compute potentially visible geometries Gathering the objects to be rendered starts by going to all of the Shading Groups and collecting all of the objects contained in each group. Figure 3 shows that there is a ÒhiddenÓ list associated with each shading group which is a list of objects or geometries to be shaded using that shading group. A consequence of this is that if an object is not a member of any shading group, it is not rendered. Figure 3 also shows that there is a hidden partition (much like a partition which you as a user can create) called the renderPartition which contains the shading groups. The renderPartition is hidden from direct manipulation in the interface; changing an objectÕs group membership in the renderPartition is done using shading group assignment in the Multilister. Displacement Material
May or may not be connected to Shaders (material)
Surface Material Volume Material defaultLightList
List of active lights List of connected geometries
renderPartition
SG
SG
SG
SG SG
SG
SG
Pre-defined partition contains all the ÒactiveÓ shadingGroups
Figure 3: Shading Group Relationships
6 Maya Rendering
The Rendering Pipeline Step Three: Compute potentially visible geometries
Given this background, and now that the shadow depth maps have been computed, the rendering pipeline continues as follows: Computation of Visible Geometries For Rendering For each shadingGroup in renderPartition For each geometry in shadingGroup compute geometryÕs boundingBox in screen space if (boundingBox touches cameraÕs viewing frustum) initialize shadingGroupÕs shading network if (initialization succeeds) keep the geometry in the renderableGeometrySet endif endif endfor endfor
Note that the Maya renderer will only initialize a shading network at most once per material. Initializing shading networks does not load file textures. At this point, the renderer is identifying geometries and their associated shading networks that may be visible in this frame. Note:
A similar computation occurs for computing the shadow depth maps; however, shading networks are not initialized at that point, and visibility determination also includes light linking criteria. Displacement shading networks are the exception to this rule - the displacement must be evaluated during a shadow depth map computation to generate the proper shadowing.
For determining which geometries possibly intersect the cameraÕs frustum (frustum is a technical word describing a volume the shape of a pyramid with its point cut off) MayaÕs renderer looks at the near and far clipping planes. Geometry that penetrates the near clipping plane will be clipped to the near clipping plane. Any part of the geometry nearer to the camera than the near clipping plane is eliminated from being rendered. Geometry is not clipped at the far clipping plane in the Maya 1.0 Renderer. If a piece of geometry spans the far clipping plane, it will be rendered in its entirety. If a piece of geometry is beyond the far clipping plane it will not be rendered at all. So there is a type of clipping occurring at the far clipping plane, but it is at the object level, not at the triangle level. Figure 4 shows this clipping relationship. Geometry O1 will be cut by the near clipping plane so that only the portion beyond the near clipping plane is rendered. Geometry O3 will not be rendered at all since it is beyond the far clipping plane, and geometry O2 will be completely rendered because part of it lies between the camera and the far clipping plane.
Technical Overview7
The Rendering Pipeline Step Three: Compute potentially visible geometries
O1 (Object 1)
Far Clipping Plane
Near Clipping Plane
O2 (Object 2)
O3 (Object 3)
Figure 4: Near and Far plane clipping; O1 is partially rendered, O3 is not rendered, O2 is completely rendered.
Far Clipping Plane
Near Clipping Plane
Since MayaÕs renderer uses the bounding box to cull or accept geometry, it is possible that pathological geometries (such as the one diagrammed in Figure 5) can be unnecessarily placed into the renderableGeometrySet. This will not produce incorrect images, merely waste the time needed to process the geometry. In Figure 5, the gray ÒCÓ shaped geometry is unnecessarily placed into the renderable set because its bounding box intersects the viewing frustum even though the geometry itself does not. Break the object up into three separate geometries to solve this problem. Smaller objects shrink the size of the bounding boxes so that they do not contain the interior of the ÒCÓ.
Bounding Box
Figure 5: A grey ÒCÓ shaped object which will incorrectly be placed into the renderable set.
8 Maya Rendering
The Rendering Pipeline Step 4: Computing the tile system
Step 4: Computing the tile system The Maya Renderer ÒtilesÓ the image to be rendered into smaller pixel rectangles. If you have watched the Maya Renderer while it is rendering, you have seen this tiling pattern; areas of low complexity are rendered with larger tiles than areas with high complexity. This section describes why this occurs and how the decision is made about tile sizes. A goal of the Maya Renderer is to keep the amount of memory used to a minimum. One of the ways the renderer attempts to achieve that is by estimating the memory cost of rendering a single tile scanline. A tile is a subsection of an image, and a tile scanline is a single row of pixels in a tile. The Maya Renderer first uses a number of variables to compute the maximum allowable number of triangles that can render in a tile scanline. Factors used in the computation of this number include: ■
is ray tracing enabled?
■
is motion blur enabled?
■
is edgeAntiAliasing enabled?
■
what is the number of shading samples?
■
what is the setting of the Render Globals maxMemoryUse attribute?
■
is multi-pixel filtering on?
■
what is the vector length (the number of samples passed into the shading nodes)?
From these factors a maxTileCost is derived which represents the maximum number of triangles believed to be renderable in a single scanline while still maintaining the given memory limit. Factors that are not included in the estimation of tile cost are shading network complexity and the size of any file textures required to render the geometry in the tile. Each object in Maya has a method to estimate how much memory is required to render it (in terms of triangle counts, number of particles, etc.) in a given screen space window. The Maya Renderer starts by tiling the screen into four tiles to start with, each one quarter of the image resolution. It then estimates the cost of rendering each of the tiles in terms of the most complicated scanline (geometrically speaking) in the tile. If the estimated number of triangles in the most complicated scanline exceeds the maxTileCost, then the tile is subdivided into four new tiles and the same process is applied to each of them in turn. This continues until the maxTileCost criteria is met, or the tile has reached the minimum tile size of 16x16 pixels. Note that at this point, no tessellation has occurred; the renderer has merely collected bounding boxes of the objects in screen space, and gotten estimates from those objects regarding their geometric rendering complexity. From this information, a tile pattern is created to use when rendering the scene.
Technical Overview9
The Rendering Pipeline Step 5: Render each tile
The following pseudo-code describes the tile generation procedure: create four tiles based on the input image resolution Foreach geometry in renderableGeometrySet Foreach tile in tileList approximate tileCost of geometry put geometry into the tile, and update the tileCost if tileCost > maxTileCost Subdivide tile to create new smaller tiles put new tiles in tileList endif endFor endFor
Note:
To save memory, the subdivision of tiles is not really done until rendering begins, but is included in this code for clarity
Step 5: Render each tile So far, you have learned about the generation of shadow depth maps, the determination of renderable geometries, and the computation of the image tiling pattern. The next step in the rendering process is to perform the visible surface determination given the tile and a list of objects visible in that tile. The visible surface and shading computation is broken down as follows: a) Compute visibility for stationary objects b) Compute visibility for moving objects c) Compute shading d) Highest quality setting - compute contrast - compute extra shading samples if necessary Note:
The following sections will discuss non-moving objects and their shading first (step a), then discuss how adaptive sampling works (steps c + d), and finally return to discuss computing visibility for moving objects (step b).
Step a: Compute visibility for stationary objects
The Maya Renderer does not tessellate geometries until it has to. Tessellation is the process of approximating a NURB surface with triangles. Tessellation is a required step because the renderer only knows how to render triangles and volumes, not NURB surfaces. The process of avoiding tessellation until the renderer knows it will have to render the object is called lazy tessellation. By doing lazy tessellation, 10 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
the renderer hopes to avoid tessellating some objects, thus saving on the associated time and memory consumption that would otherwise be incurred. So how does lazy tessellation work? First the renderableGeometrySet is sorted for the tile in order of depth from the camera. Then the renderer only tessellates the front-most surface (or surfaces if two or more surfaces overlap in Z depth from the camera) in the hopes that they will fully occlude the more distant surfaces. If this is wrong, then the renderer will continue and tessellate the more distant surfaces, but in many cases, this saves some amount of work. Figure 6 shows a case where the renderer would first tessellate objects O1 and O2 - because they overlap in Z depth from the camera, the renderer must first determine inter-object occlusions, hence the need to tessellate them both - object O3 would not be tessellated since objects O1 and O2 can potentially occlude O3. Tessellation generally applies only to NURB surfaces, but in the case of displacement mapping, it can also apply to polymeshes.
O1 (Object 1)
O3 (Object 3)
Tile
Z
O2 (Object 2)
Objects in this zone may not have to be tessellated
Figure 6: Depth sorting objects in tiles. Objects O1 and O2 are initially tessellated, while O3 is not, pending visibility determination. Because the renderer is trying to fully determine visibility before moving onto the shading phase, if objects O1 or O2 are potentially transparent (i.e., they have a transparency map or have their transparency set to a constant, non-zero value) then the renderer has to assume that they will be transparent and compute the visibility of object O3. Tip:
It helps the renderer optimize the scene if you do not attach any nodes to the transparency channel of a texture when that object can never be transparent. That way, the shader initialization can flag the objects as completely opaque and use this optimization.
The visibility of the objects is determined by a method that has a close analogy to the pushpin array of nails novelty toy you often see in ÒscienceÓ stores or higher-end games stores. It consists of an array of blunt nails pushed through a plastic board with a plexiglass front shield to prevent the nails from being pushed all the way out of the board. You press your hand or face into the blunt end of the nails, and the nails on the other side of board take on the shape of your hand or face. The EAS algorithm used in Maya is very much like a pushpin approach where the renderer pushes the triangles into a digital pushpin array. Technical Overview11
The Rendering Pipeline Step 5: Render each tile
The digital pushpin array is many times more dense than the pixel, which gives us good geometrical anti-aliasing, and our digital pushpin array remembers which triangle pushed it the furthest towards the camera so that it can be shaded correctly. The portions of each triangle that remain visible in each pixel after all this digital pin-pushing are called fragments. A fragment is simply the shape left by clipping the triangle to the pixel. Note:
Step b will be explained at the end of this section.
Step c: Compute shading (for stationary objects)
Now that the visibility of all non-moving objects in the scene has been determined, the renderer needs to shade those objects which still remain visible in each pixel. Before the renderer starts to shade, though, it must first attempt to merge any triangle fragments from the same object into a larger fragment. This is done because it is important to shade each surface as few times as possible in each pixel. However, there are a number of cases where it is not possible or desirable to do the merging. If the fragments are from the same surface, but they have different depths (say you can see the front and back lip of a bowl in the same pixel, these need to be shaded differently; so the fragments cannot be merged) or if the triangles are on either side of a sharp edge on an object (say there is a degree one surface or an object which is not smooth shaded), then it is important to preserve the sharp edges and again, it is not possible to merge these fragments. Once the fragments are merged, the renderer then shades the merged fragment shadingSample a number of times as specified in renderQuality or overridden by each object in the Attribute Editor under Render Stats. The following pseudo-code briefly outlines the merging and shading process; For each pixel in the tile scanline merge all possible fragments for the same object shade the mergedFragments shadingSample number of times. endFor
The initialization and evaluation of the shading network is handled in a different section. For now, the renderer can almost consider the shading of each fragment as complete. Note:
If you have animated the camera in Maya then all objects are considered to be moving since the Maya renderer treats the camera as the stationary point. Therefore if you animate the camera, you must consider the issues in Step b.
Step d: Highest quality setting
The shading is not complete if highestQuality has been selected in renderQuality. The Maya Renderer tries to shade each object only once 12 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
per pixel; however, this is not always a high enough sampling frequency to properly anti-alias some shading events like thin speculars or shadow edges. To catch these shading events, the Maya Renderer provides an adaptive shading option that is enabled when highestQuality is selected. The Maya Renderer examines the contrast between this pixel and its five already-computed neighboring pixels (the next scanline is not yet rendered, so all 8 cannot be examined). Figure 7 shows the five neighboring pixels involved in the contrast computation.
Current Scanline
Current Pixel
Figure 7: The 5 neighboring pixels used to compute contrast. If the contrast exceeds the contrast threshold specified in the Contrast Threshold Attributes section of renderQuality, then additional shading samples are taken. The number of additional shading samples taken varies between shadingSamples and maxShadingSamples as specified in renderQuality and is overrideable on a per-object basis in the Render Stats portion of the Attribute Editor. A simple linear function is used to determine the number of shading samples. Figure 8 shows a chart of the function used to determine the number of additional samples to take. The number of samples starts at shadingSamples (SS) and remains at that number until the contrast threshold is reached. At that point, as the distance above the threshold increases, so does the number of shading samples taken until the full contrast of 1.0 is reached and maxShadingSamples are taken. Shading Samples MaxSS
MaxSS - Max shading samples. (defined in renderQuality) can be overridden by object
Extra Shading Samples taken
SS - shading samples (defined in renderQuality) can be overridden by object
SS
threshold
1.0
Contrast
Figure 8: Graph showing how the number of extra shading samples for highest quality is computed.
Technical Overview13
The Rendering Pipeline Step 5: Render each tile
If you look at the default contrast settings you will see that they are: Red = 0.4 Green = 0.3 Blue = 0.6 These settings were chosen because they roughly correspond to the human eyeÕs responsiveness to these wavelengths of light. The human eye is very sensitive to changes in green, but not very sensitive to changes in blue. The computation of contrast is physically based on the contrast recognition abilities of a monkey eye. While not wanting to start a debate regarding evolution vs. creation, it is generally accepted that the human eye is very similar to the monkey eye, genetically speaking. The contrast is computed with the following formula for each of R, G and B:
max
min
I ÐI ------------------------- = contrast max min I +I The algorithm for determining if additional samples should be taken is outlined in the following pseudo-code: Foreach pixel examine the pixelÕs 5 neighbors Foreach object shaded in this pixel collect (RGBmax) (RGBmin) compute contrast if (contrast > threshold) take additional shading samples endif endFor endFor
Figure 9 shows a simple example for non-moving objects. There are four images of a spot light shining on a plane. With low quality, both the geometric edge of the object and the shaded edge of the spot light are aliased. When high quality is selected, the geometric edges of the object are anti-aliased; however, the shading edge of the spotlight is still aliased because no adaptive shading was invoked. When highest quality is set, both the geometric edge of the object and the shading edge of the spot light are properly anti-aliased. The final image shows the same image generated with multi-pixel filtering on. This is a true multi-pixel filter applied at the sub-pixel level and not a post-process low pass filter that is applied to the pixels. Multi-pixel filtering is discussed further on page 18 of this document.
14 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
Low Quality
High Quality
Spatial/Geometric Aliasing
(No adaptive shading)
Shading Aliasing
Highest Quality (With adaptive shading)
Highest Quality (With multi-pixel filtering)
Figure 9: Geometric vs. shading anti-aliasing. Step b: Compute visibility for moving objects
You have learned how non-moving objects have their visible surfaces calculated and subsequently shaded, and touched on the methods the Maya Renderer uses for anti-aliasing stationary geometry and shading. In this section, you will learn about the rendering of moving objects and motion blur. Motion blur is solved with point sampling using a process unique to Alias|Wavefront. The Maya Renderer chooses pseudo-random locations on each pixel where it will sample the moving objects as illustrated in Figure 10.
Current Scanline
Current Pixel
Figure 10: Example sample locations (not actual) for motion blur point sampling. The number of sample points in each pixel is under user control. The number of visibility sample points for motion blur is determined by the motionBlurVisibilitySamples attribute in renderQuality. The number of motion blur visibility samples cannot be overridden on a per object basis; however, the contrast is used to increase the number of visibility samples for motion blur. For highest quality, the five neighboring samples are examined to compute the coverageContrast,
Technical Overview15
The Rendering Pipeline Step 5: Render each tile
and additional visibility samples are taken (up to maxVisibilitySamples from the renderQualityÕs Motion Blur Visibility section). While the minimum number of motion blur visibility samples cannot be overridden on a per-object basis, the maximum number of visibility samples can be overridden. The Render Stats section of the Attribute Editor for an object contains a Motion Blur section where this override can be set. To compute the coverage and visible surfaces for motion blurred objects, the Maya Renderer holds the ray stationary, and moves the triangle across it to see when and where the ray intersects the triangle. Figure 11 diagrams this procedure. A ray (a point sample) is sent through the pixel and checked for intersection with a moving triangle that moves from the left of the pixel at shutter open time, to the right of the pixel at shutter close time. By looking at the triangle itself, you can see that the triangle first intersects the ray at time = .2 and stops intersecting the triangle at time = .7. These intersection points allow us to form a line in the space of the triangle that describes where the triangle intersects our point sample. The renderer can then sample this line (and thus the triangle) at multiple times during the time it covers this pixel, which is how it supersamples the shading of moving objects. There are other optimizations which are used in computing motion blur that are not covered in this document. The important thing to learn from this section is that in the case of motion blurred objects, the meaning of shadingSamples is overloaded, which means it is used to control a different type of sampling when motion blur is on versus the type of sampling it controls when motion blur is off. In the case of motion blurred objects, shadingSamples controls the number of shading samples in time across the moving triangle(s), as represented by the ÔXÕs on the triangle in the upper left of Figure 11.
t=0.7
t=0.2 xxx
Pixel
!!shadingSampleÕs meaning is overloaded!!
Figure 11: Motion blur coverage and shading sampling. There is no adaptive shading sampling for time-based samples. Figure 12 shows a simple example of the differences between geometric, spatial and temporal aliasing, and how various Maya Renderer parameters anti-alias each of these artifacts. At low quality, all types of aliasing are present; going to high quality eliminates the geometric aliasing problem. Going to highest quality with one shading sample
16 Maya Rendering
The Rendering Pipeline Step 5: Render each tile
eliminates the spatial aliasing, and going to 16 shading samples completely eliminates the temporal aliasing.The checkered plane is moving from left to right. Tip:
It is not recommended that you set the shading sample frequency to 16 for all your motion blur scenes, only that you increase the number of shading samples on objects that display this type of temporal aliasing.
Low Quality
High Quality
Geometric Aliasing
Spatial Shading Aliasing
Highest Quality
Temporal Shading Aliasing
Highest Quality (With 16 shading samples)
Figure 12: Geometric vs. spatial vs. temporal aliasing. In general, it is not possible to separately anti-alias or see if the spatial or the temporal aliasing is causing the artifact; the example in Figure 12 is a bit contrived to be able to show this. Figure 13 shows a more common case where both the spatial and temporal aliasing are seen in the same location. In Figure 13, the texture mapped plane is rotated 45 degrees and then moved from left to right across the screen.
Technical Overview17
The Rendering Pipeline Step 5: Render each tile
Low Quality
High Quality
Geometric Aliasing
Spatial/ Temporal Shading Aliasing
Highest Quality (performs spatial shading anti-aliasing)
Temporal Shading Aliasing
Highest Quality (With 10 shading samples)
Figure 13: Spatial and temporal aliasing can not always be separated.
Step 6: Composite shaded results At this point the renderer has a list of shaded fragments for each pixel. The next task is to composite the fragments together to form a single pixel color that represents the geometry visible in that pixel. If multi-pixel filtering is not enabled, the result is simply a box filtering of the fragments. The fragmentÕs color is multiplied by the amount of the pixel it covers, and then all fragments are added together, or to put it a different way, the fragment colors are weighted by their coverage contribution and then summed. If, however, multi-pixel filtering is enabled, then a 3x3 pixel filter kernel is used to combine the fragments. The 3X3 pixel filter kernel is a cubic spline filter kernel derived by convolving a square pulse with itself three times. The shape of this filter roughly approximates a gaussian filter. Figure 14 shows a graphic diagram of this filter. The fragment marked with the bold circle inscribed with an ÔXÕ is weighted according to the volume contained between it and the projection of the fragment onto the filter kernel. This is a true multi-pixel filter and not a post-filter; the fragments for all of the 3x3 pixels are weighted before pixel composition.
18 Maya Rendering
The Rendering Pipeline Working with BOT or Cached File Textures
Pixel
Figure 14: The 3x3 multi-pixel filter
Working with BOT or Cached File Textures BOT (Block Order Textures) are enabled by selecting useTextureCache on each file texture. If this flag is ON and the file textures are not already BOT format files, then Maya will automatically create BOT textures from your images files in the TMPDIR (temporary directory). If the textures are already in BOT format (you can convert them using the stand-alone utility makebot) then no conversion is required, the state of the useTextureCache flag is irrelevant, and BOT textures will be used. A BOT texture on disk is a compressed MIPMAP structure with 8x8 texel pages. (A texel is a texture element derived in much the same way as pixel is a picture element). The textureCache is a 256 texel page cache in memory; that is, it can hold 256 of the 8x8 texel pages. There is only one textureCache for the entire rendering session, and the cache is shared between all file textures. The textureCache is demand loaded. When a part of a texture is required, if it is not already in the cache, then it is loaded from disk. If the textureCache is full, then the least recently accessed pages are removed and replaced with the pages being loaded. Tip:
BOT textures have the advantage of reducing the amount of memory required to keep textures in memory, and they employ algorithms that help ensure a high hit ratio when looking for a part of a texture. If the image file has already been converted to a BOT texture file, then the Maya renderer can use it much more quickly than when it has to convert the file to BOT texture on its own. If you have lots of textures, or very big textures, then converting to BOT textures may be a useful way of conserving memory.
BOT textures do have some limitations as well. The image viewing utilities fcheck and wrl do not know how to display a BOT texture as it is not a standard image format. If multiple renderers are using the same BOT file (whether those renderers are on a multi-processor machine or on
Technical Overview19
The Rendering Pipeline Other renderGlobal Optimization Parameters
a separate machines.), there can be an I/O bandwidth problem as all of these renderers attempt to access the same file on the same disk. This will cause the renderers to slow down. The only solution to this problem is to ensure each renderer is accessing it's own local copy of the BOT texture, where each BOT texture resides on a separate hard disk from all the other BOT textures. If the image files are not BOT texture files to begin with, then TMPDIR can get full quickly with all of the temporary BOT files. BOT file (on disk) 8x8 page
256 slots textureCache (in Memory)
Other renderGlobal Optimization Parameters useFileCache swaps the least recently used (LRU) render data in memory out to a disk file in TMPDIR. At the start of rendering, Maya will compute the maximum size this swap file can become by setting its maximum size to 80% of the free space on TMPDIR. This is done to avoid filling up the disk and leaving no space for other processes which require TMPDIR space. As the renderer consumes more memory,the least recently used sections of data are swapped out to the swap file by the renderer. This does not involve any operating system context switch or swapping. Data items which are candidates for swapping are tessellated triangles and raytracing spatial subdivision structures (voxels). If, for some reason, swapping data to this swap file fails (i.e., the swap file has reached its maximum size), then the data is simply thrown away and re-calculated if required again at a later stage of the rendering. By having Maya do the swapping, it should be a little more intelligent about it than the operating system, which has no knowledge of what the renderer is doing. Disadvantages are I/O bandwidth problems, which get worse if there are multiple processes on a single multi-processor machine and they are all accessing the same TMPDIR. You could run out of disk space and not be able to save your images. Therefore, if the rendererÕs output image directory and TMPDIR are on the same disk partition, saving of image files may fail. The likelihood of this data loss increases as more frames of the animation are rendered.
20 Maya Rendering
Understanding shading networks Other renderGlobal Optimization Parameters
Tip:
When using useFileCache, it is better to therefore render to a different disk than the disk containing the TMPDIR.
UNDERSTANDING SHADING NETWORKS This section describes basic concepts that are important to make the most use of the power of the Maya RendererÕs shading network. First, let us define some terms. ■
shading network - a connected graph of nodes that can be used to shade objects. These networks generally contain what Maya classifies as materials and textures, but they do not have to contain these nodes.
■
shadingGroup - a collection of objects to be shaded with the shading network attached to the surfaceMaterial port of the shadingGroup if the object is a surface, or with the shading network attached to the volumeMaterial port of the shadingGroup if the object is a volume.
■
port - an attribute on the shadingGroup, which acts as an input for shading networks. These attributes differ from normal connected input attributes because the renderer evaluates these inputs for required connections.
■
material - these are similar to what were called shaders in Alias and Explore. They are called materials in Maya to avoid any functional associations that the word ÔshaderÕ might imply.
The shading network is designed as a data flow network. As you look at shading networks in the Hypergraph, data is fed in the left side of the network and a final shaded result emerges from the right-most node. A Shading Group can have a different shading network attached to both the surfaceMaterial port and the volumeMaterial port. Surfaces that are in this shadingGroup are shaded with the network attached to the surfaceMaterial port, while volumes that are in this Shading Group are shaded with the network attached to the volumeMaterial port. A shading network assigned to the displacementMaterial port affects only surfaces and only during tessellation (unless it is otherwise connected to the surface shading network as well as being attached to the displacementMaterial port). Note:
The Maya Renderer uses specially named attributes to supply shading networks with information about the sample point being shaded.
Technical Overview21
Understanding shading networks Other renderGlobal Optimization Parameters
Note:
For a list of the specially named attributes that the Maya Renderer uses to supply information to a shading network, see the Maya online
documentation ® Maya DeveloperÕs Tool Kit ® Maya API Overview for writing Shading Nodes ® Appendix C, ÒRendering attributesÓ. If a shader declares an attribute with one of these special names, the attribute is automatically fed that information at shading time during rendering. This is called an implicit connection and is similar to accessing global variables in RenderManÕs shading language. For example, if an attribute on a node is called pointCamera and that attribute is not connected, then when that attribute is queried during the shading computation, the intersection point in camera space will be provided to that attribute, since this is a specially named attribute. If an unconnected attribute exists anywhere in the shading network and the attribute has one of the special names listed in the appendix, the attribute will be filled with the requested information at shading time during rendering. Tip:
You can override the implicit behavior of any specially named attribute simply by explicitly connecting something to that attribute.
outAlpha
bumpValue
outNormal
normalCamera
normalCamera
Figure 15: Overriding normalCamera for bump mapping. Bump mapping in Maya works by overriding the normalCamera attribute on materials. The normalCamera is the normal of the surface in camera space. A similar naming convention is followed for other Maya specially named attributes. Figure 15 shows the manner in which the normalCamera for a material is overridden. Maya supplied materials have an attribute called normalCamera; usually normalCamera is unconnected and the normal in camera space of the intersection point is supplied to the shader. When the material is bump mapped, a bump node is connected to the normalCamera attribute. The bump node has two input attributes: normalCamera, which will normally be unconnected, and a bumpValue attribute. The final outNormal from the bump node will be the normal in camera space modified (bump mapped) by the texture map. Note:
22 Maya Rendering
Because of the way Maya supplies data to unconnected, specially named attributes, the bump node must also be connected to any reflection maps you have on your material, so that both the material and the reflection map are using the same bumped normal. This type of connection is
Understanding shading networks Other renderGlobal Optimization Parameters
shown in Figure 16. The attribute outNormal of the bump node is fed both into the materialÕs normalCamera as well as the environment textureÕs normalCamera.
normalCamera
outNormal normalCamera
outAlpha
bumpValue
outNormal reflectedColor
normalCamera outColor
Figure 16: Material and environment map sharing the same bump map. Note:
You do not need to program API shading nodes to access all the attributes provided to the shaders.
You can access any of the specially named attributes by adding a dynamic attribute onto any node, provided that the attribute has the same name and data type as listed in the appendix. Adding all of these dynamic attributes can be time-consuming, and may result in many different nodes with the same dynamic attributes defined, so to make accessing sample data easier, there is a helpful node provided in the Create Render Node window called sampleData, which is simply a node with many of the specially-named attributes already defined on it. You can create just one of these sampleData nodes and connect from its attributes to every place in your shading network that requires the information. Any attribute you require that is not already defined on the sampleData node can be added as a dynamic attribute of the same name and type. Creating just one sampleData node with all the attributes you require is an effective way to create a kind of global variable list. Of course, there is nothing wrong with creating multiple sampleData nodes to reduce confusion, if the attributes will be connected into many shading networks.
normalCamera
input1 outValue
rayDirection
input2
Figure 17: Using sample data to take the dot product of the ray and normal. Technical Overview23
Understanding shading networks Other renderGlobal Optimization Parameters
In Figure 17, the normal in camera space and the incident ray direction are supplied by the sampleData node and connected to the two inputs of a dotProduct node, the results of which are to be used elsewhere in the shading network. Since the dot product is an important component of many shading models, it can be seen that Maya allows for the prototyping of shaders without actually coding them in C++. Note:
Just as there are specially named input attributes, there are specially named output attributes.
A node must have at least one of the following specially named output attributes to be a valid node to directly connect to a surfaceMaterial port of a shadingGroup: ■
outColor
■
outTransparency
■
outGlowColor
If the node connected to the surfaceMaterial port of a shadingGroup does not have at least one of the above attributes, none of the surface objects assigned to that shadingGroup will render. It does not matter which attribute of a node is connected to the surfaceMaterial port of a shadingGroup; only the outColor, outTransparency and outGlowColor attributes of the connected node will be used. Even if the message port is used to attach a node to the surfaceMaterial port, the shadingGroup will look for outColor, outTransparency and outGlowColor attributes on the attached node. A node must have at least one of the following specially named output attributes to be a valid node to connect to the volumeMaterial port of a shadingGroup: ■
outColor
■
outTransparency
Creating special effects, such as inverting a materialÕs color after shading, requires that you attach a special node with outColor, outTransparency and/ or outGlowColor attributes to the surfaceMaterial port of the shadingGroup. A special node called surfaceShader is provided in the Create Render Node window available in the multilister. This is a light weight Òpass-throughÓ node that simply allows you to translate the names of the nodeÕs outputs to the names required for it to be a valid surfaceShader.
24 Maya Rendering
Understanding shading networks Other renderGlobal Optimization Parameters
out
in
outColor outTransparency outGlowColor
outColor outTransparency outGlowColor
Figure 18: Renaming output attributes using a surfaceShader node. In Figure 18, the shading group is attached to a surfaceShader node. Although most of the attributes have the same names, the outColor of the material is passed through an invert node which does not have a properly named attribute, so the surfaceShader node is required to rename that one attribute. The surfaceShaderÕs outTransparency and outGlowColor are attached directly to the materialÕs outTransparency and outGlowColor, so these values go to the shadingGroup unchanged, directly from the material. The outColor of the material, however, is first passed to the in attribute of an imaginary (a node made up for this example) invert node, which inverts the color and then places the result in the out attribute. The out attribute is then connected to the outColor of the surfaceShader node where it is passed through to the shadingGroup. The surfaceShader node is simply a means to translate an arbitrary network of Maya or user-written nodes with arbitrarily named output attributes into what the renderer will recognize as a shading network with which it can render objects. Of course, you can always create three dynamic attributes on the invert node and make connections from the material and a loop back connection from the out attribute to the dynamic outColor attribute on the invert node, as shown in Figure 19.
outColor outTransparency outGlowColor
in
out
outColor outTransparency outGlowColor
Figure 19: Invert node with 3 dynamic Òpass-throughÓ attributes. There is also a volumeShader node provided for the same reasons.
Technical Overview25
Understanding shading networks Other renderGlobal Optimization Parameters
26 Maya Rendering
Hypergraph
Hypergraph Contents
Hypergraph 1 Hypergraph
5
Understanding the Hypergraph panel
6
Understanding scene hierarchy terminology Using the scene hierarchy
8
10
Expanding scene hierarchy nodes
10
Displaying special nodes and connections
12
Shape, invisible, and underworld nodes
12
Expression, constraint, and deformer connections Parenting objects
15
Rearranging scene hierarchy nodes
17
Changing a node’s relative position Creating a free-form hierarchy
18
19
Displaying a background image with a scene hierarchy Understanding the dependency graph Using a dependency graph
20
22
23
Displaying render node connections
24
Displaying upstream and downstream connections Dragging nodes into a dependency graph Connecting nodes in a dependency graph
30 32
Updating the layout of a dependency graph Clearing the contents of a dependency graph Returning to the scene hierarchy
26
29
Disconnecting nodes in a dependency graph
Editing objects
14
40 40
40
41
Selecting objects
41
Adding and selecting an IK handle Renaming an object
42
43
Using Maya: Hypergraph, Sets & Expressions
3
Hypergraph Contents Hiding an object in the workspace Editing an object’s attributes Creating a render node Altering the view of a graph Tracking the view
46
Dollying the view
46
Dollying a region
46
44
45
45 45
Fitting an entire graph in the window
48
Centering selected nodes in the window Centering a hierarchy in the window
48
49
Centering a hierarchy branch in the window Adjusting view transition speed Setting graph update options
50 50
Undoing a view of a scene hierarchy Using bookmarks for graph views
51 51
Displaying a graph vertically or horizontally Rebuilding the graphs
4
49
54
Using Maya: Hypergraph, Sets & Expressions
53
H ypergraph
1
Hypergraph The Hypergraph shows a graphical relationship between components of a scene. You can display two kinds of graphs in the Hypergraph: the scene hierarchy or dependency graph. The scene hierarchy shows the ordered arrangement of objects, lights, cameras, and other items that make up a scene. It’s similar to the Outliner but has more features and visual aids for working with the hierarchy of scene components. Here’s an example scene hierarchy:
A dependency graph shows the architectural connections between Maya entities that input and output data. For example, it shows connections between shading group elements that create an object’s material appearance. This chapter describes the following topics: •
“Understanding the Hypergraph panel” on page 6
•
“Understanding scene hierarchy terminology” on page 8
•
“Using the scene hierarchy” on page 10 Using Maya: Hypergraph, Sets & Expressions
5
Hypergraph Understanding the Hypergraph panel •
“Understanding the dependency graph” on page 22
•
“Using a dependency graph” on page 23
•
“Editing objects” on page 41
•
“Altering the view of a graph” on page 45
Understanding the Hypergraph panel You can launch the Hypergraph in its own window or in a workspace panel. Displaying it in a workspace panel has the advantage of letting you see the Maya user interface and the Hypergraph without having to reposition the windows.
To start the Hypergraph in its own window: From the menu bar or Hotbox, select Window→Hypergraph. The Hypergraph appears:
Menu bar Tool bar
Scale and move the window as needed.
To start the Hypergraph in a workspace panel: From a workspace panel, select Panels→Panel→Hypergraph.
6
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Understanding the Hypergraph panel
Hypergraph panel items
The tool bar has icons for commonly used Hypergraph menu bar selections. To see the selection that an icon represents, drag the mouse pointer over the icon and look in the blue help box at the bottom of the Maya window. The name of the selection appears there. When you display the Hypergraph the first time, the scene hierarchy is displayed. In subsequent displays of the Hypergraph, the scene hierarchy or dependency graph appears, depending on which was displayed the previous time you closed the window. Note that a scene hierarchy is also referred to as a DAG, an abbreviation for directed acyclic graph. If you display the scene hierarchy, invisible objects such as the perspective, top, front, and side cameras do not appear in the graph by default. If you display the scene hierarchy for a new, empty scene, you’ll see no graph. In contrast, the Outliner shows the default cameras unless you choose not to display them. .
By default, the scene hierarchy doesn’t show these default cameras displayed in the Outliner.
Note Unless instructions in this chapter state otherwise, make all menu choices from the Hypergraph’s menu bar.
Using Maya: Hypergraph, Sets & Expressions
7
H ypergraph
The Hypergraph’s menu bar has entries for working with the scene hierarchy or dependency graph.
Hypergraph Understanding scene hierarchy terminology
Understanding scene hierarchy terminology A common technique in modeling, rendering, and animation is to work with objects in a hierarchical relationship. To work with a hierarchy you must understand the terminology for describing the relationship of objects. We use the following figure to define common hierarchy terminology:
Parent
An object or other item that controls attributes of one or more children. A parent can also be the child of another parent. In the figure, InnerSolarSystem is a parent of Sun. Sun is a parent of Mercury, Venus, Earth, and Mars. Earth is a parent of Moon.
Child
An object having attributes controlled by its parent. A child can be the parent of other children. A child in the graph is connected to its parent by an indented right angle line. Sun is a child of InnerSolarSystem. Mercury, Venus, Earth, and Mars are children of Sun. Moon is a child of Earth.
Node
8
A parent, child, or independent item. This refers generally to any box in the graph.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Understanding scene hierarchy terminology
Subnode
Any node below another node in the hierarchy. The subnodes of InnerSolarSystem are Sun, Mercury, Venus, Earth, Moon, and Mars. The subnodes of Sun are Mercury, Venus, Earth, Moon, and Mars. The subnode of Earth is Moon. Moon and Mars have no subnode.
Branch
All nodes along a path from a parent to child. A branch from Sun to Moon includes Sun, Earth, and Moon.
Hierarchy
The arrangement of all connected nodes that make up a scene or object. The scene hierarchy is made of all nodes in the figure. The Earth hierarchy consists of Earth and Moon.
Transform node A node that contains an object’s transformation attributes—
values for its translate, rotation, scale, and so on. It also holds information on parent-child relationships it has with other nodes. InnerSolarSystem, Sun, Moon, and all other boxes shown in the example are transform nodes. Shape node
A shape node holds an object’s geometry attributes or attributes other than the object’s transform node attributes. Shape nodes do not appear in the scene hierarchy by default. To display shape nodes, see “Displaying special nodes and connections” on page 12.
The scene hierarchy and the dependency graph display animated nodes as slanted boxes. If you animate a node with an expression, it displays a regular rectangle rather than a slanted box. All other animation techniques display a slanted box. Specifically, a slanted box indicates that the node has a param curve connected to it.
Not animated
Expression animation
Other animation
Using Maya: Hypergraph, Sets & Expressions
9
H ypergraph
InnerSolarSystem, Sun, Moon, and all other boxes in the graph are nodes.
Hypergraph Using the scene hierarchy
Using the scene hierarchy You can use the scene hierarchy to: •
display special nodes and connections You can display shape, invisible, and underworld nodes. You can also show expression, constraint, and deformer connections that link nodes. See “Displaying special nodes and connections” on page 12.
•
make an object the child of a parent object (known as parenting) A child adopts attribute changes made to the parent. See “Parenting objects” on page 15.
•
reorder the position of nodes See “Rearranging scene hierarchy nodes” on page 17.
•
create a free-form graph of the hierarchy that suits your visual preference See “Creating a free-form hierarchy” on page 19.
•
select, rename, and hide objects, and edit attributes of an object See “Editing objects” on page 41.
•
examine the structure of the scene The Outliner lists the components of a scene as an indented list. The Hypergraph shows the relationship of the objects of the scene graphically. See “Altering the view of a graph” on page 45 for details on navigating the view of the graph.
Expanding scene hierarchy nodes As you examine a scene hierarchy, you can expand or collapse the display of nodes. Collapsing nodes is helpful for lessening clutter in a hierarchy. You expand a node to see nodes below it. For a selected node, you can display: •
subnodes one level below the node
•
all subnodes below a node When you know where a node is in the workspace but you’re not sure of its graph position, you can select the node in the workspace and expand all nodes necessary to display and highlight it.
10
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy A selected node is yellow in the scene hierarchy.
1
Select the node. If the node is not visible in the scene hierarchy, select it in the workspace or Outliner.
2
Choose: Edit→Expand to expand a node to one level below. Edit→Expand All to expand all subnodes below a node. Edit→Show Selected to display and expand a node not visible in the graph.
A red arrow appears below a node if it’s collapsed.
Expanded node
To collapse a node: 1
Select the node.
2
Choose Edit→Collapse.
Using Maya: Hypergraph, Sets & Expressions
11
H ypergraph
To expand a node:
Hypergraph Using the scene hierarchy
Tips •
To expand or collapse a node, double-click it.
•
To quickly select Hypergraph menus, click the right mouse button in an empty part of the Hypergraph window.
•
To display context-sensitive Hypergraph menus, drag the mouse over a node and click the right mouse button. These menus are also available from the main Hypergraph menus, but they apply only to the selected node.
•
For details on navigating the view of the graph, see “Altering the view of a graph” on page 45.
Displaying special nodes and connections You can display shape, invisible, and underworld nodes in the scene hierarchy. You can also display expression, constraint, and deformer connections that link different nodes.
Shape, invisible, and underworld nodes By default, the scene hierarchy does not display shape nodes, invisible nodes, or underworld nodes. It displays only transform nodes—nodes that hold attributes and other information on an object’s transformation and parent-child relationships. A shape node holds an object’s geometry attributes or attributes other than the object’s transform node attributes. A shape node is a child of a transform node. A transform node has only one shape node. An invisible node is any object you’ve hidden with Display→Hide from Maya’s menu bar. The default cameras top, front, side, and persp are also invisible nodes. An underworld node is a pair of nodes below a shape node. When you create a curve on a NURBS surface, Maya generates an underworld transform node and shape node below the shape node of the surface. The CV positions of underworld nodes have UV coordinates on the surface rather than coordinates in world or local space.
12
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
To display invisible nodes, object shape nodes, or underworld nodes: H ypergraph
Turn on these options: Options→Show→Shape Nodes Options→Show→Invisible Nodes Options→Show→Underworld Nodes The graph displays invisible nodes with darker coloring. Underworld nodes appear only if you also display shape nodes in the graph. A dotted line in the scene hierarchy indicates a connection to an underworld node. Connections to instanced objects are also indicated by dotted lines.
Note Hypergraph option settings are saved with a scene file. The options are not saved for Maya globally.
Example Suppose you use Primitives→Create NURBS→Sphere from the Modeling menu to create a sphere. Maya creates a transform node and a shape node. The sphere’s shape node holds the mathematical description of the sphere’s shape. The sphere’s transform node holds the sphere’s position, scaling, rotation, and so on. The shape node is the child of the transform node. If you select Options→Show→Shape Nodes, the scene hierarchy shows these nodes for the sphere:
Maya gives the nodes the default names shown in the preceding figure. The nurbsSphere1 is the transform node, nurbsSphereShape1 is the shape node. If you rename the transform node, for example, as Bubble, Maya renames the shape node BubbleShape. If you rename the shape node, Maya does not rename the transform node. Maya doesn’t transmit a child’s attribute changes up to its parent. Using Maya: Hypergraph, Sets & Expressions
13
Hypergraph Using the scene hierarchy
Example Suppose you use Primitives→Create NURBS→Sphere to create a sphere. Maya creates a transform node and a sphere node. Suppose further you select Modify→Make Live, then use the Curves→CV Curve Tool to draw a curve on the surface of the sphere. If you turn on the display of shape nodes and underworld nodes, the scene hierarchy appears as follows:
Maya gives the nodes the default names shown. The nurbsSphere1 is the transform node of the sphere, nurbsSphereShape1 is the shape node. The curve1 and curveShape1 nodes are underworld nodes for the curve created on the sphere’s surface. When a curve-on-surface is hard to select in the workspace because of crowding or complex geometry, you can select it easily in the scene hierarchy with underworld nodes displayed.
Expression, constraint, and deformer connections You can display color-coded lines in the scene hierarchy that illustrate nodes connected by an expression, constraint, or deformer.
To display nodes connected by an expression, constraint, or deformer: Turn on any or all of these options: Options→Show→Expression Connections Options→Show→Constraint Connections Options→Show→Deformer Connections To turn off display of these connections, turn off the appropriate options.
14
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
Example
The expression links the two values. When you move Ball up or down in the workspace (in a Y-axis direction), Cone moves up or down the same amount. If you select Options→Show→Expression Connections, the scene hierarchy displays this:
This line means attributes in the two nodes are connected, for instance, by an expression.
Tip You can change the color-coding of the connection lines and other important entities by selecting Options→Customize→UI Colors from Maya’s main menu bar.
Parenting objects You can make an object the child of a parent object. The child adopts some or all attribute changes made to the parent. For example, suppose you animate a planet to orbit the center of the workspace. If you make a moon the child of the planet, it follows the motion of the planet. Though the moon is the child of the planet, you can also give the moon motion that’s independent of the planet. For example, you can make it orbit the planet. If you later change the orbiting motion of the planet, the moon continues to follow the planet’s motion, but stills retains its original orbiting motion.
Using Maya: Hypergraph, Sets & Expressions
15
H ypergraph
Suppose you create a NURBS sphere named Ball and a NURBS cone named Cone. You write an expression to assign the value of Ball’s translateY attribute to Cone’s translateY attribute.
Hypergraph Using the scene hierarchy To control multiple objects with one node, you can also create an empty group and make several objects its children. By grouping objects under one node, you can move, shade, apply texture, and do many other actions to all the objects by working with the group node.
Example
BackTire
FrontTire
1. Create original objects.
BikeTires
2. Create empty node and name it BikeTires.
BikeTires
3. Group objects under BikeTires.
BackTire
4. Move, rotate, shade BikeTires.
FrontTire
To parent an object: In the scene hierarchy, use the middle mouse button to drag the child node on the parent node. Use the middle mouse button to drag Moon onto Planet.
Moon is now a child of Planet.
If the parent node is not visible in the window, drag the child toward in the direction of the parent. The graph view scrolls as you drag into the Hypergraph’s window border.
16
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
To parent several objects to a new node: From the Maya main menu bar, choose Edit→Create Empty Group.
H ypergraph
1
A new node appears in the scene hierarchy named null1. This node is an invisible, empty object. 2
Use the middle mouse button to drag an object node onto the null1 node. The object becomes a child of the null1 node.
3
Repeat this step for other objects to be children of the group.
4
Rename the null1 node to something more meaningful. For example, you might rename a group containing four flower petals as flower. See “Renaming an object” on page 43. The scene hierarchy displays the objects parented to the group node:
If you modify the group node attributes, its corresponding member’s attributes also are modified. For example, if you scale down a flower group node, the four petals scale down also.
To break the relationship between parent and child: With the middle mouse button, drag the child node to an empty spot in the workspace.
Rearranging scene hierarchy nodes You can rearrange the position of nodes in a scene hierarchy to suit your preferences as follows: •
Move a node’s relative position.
Using Maya: Hypergraph, Sets & Expressions
17
Hypergraph Using the scene hierarchy •
Create a free-form scene hierarchy.
•
Display the graph vertically or horizontally. See “Displaying a graph vertically or horizontally” on page 53. Note that Maya updates the scene hierarchy as you modify a scene.
Changing a node’s relative position You can move a node’s relative position vertically or horizontally in a scene hierarchy. You might want to do this, for example, to make the node’s graph position correspond to its spatial position in the workspace. Be aware that rearranging an object’s position in the Hypergraph might alter its behavior or appearance in your scene. Reordering a node’s position in the graph affects Maya’s evaluation order for the object. The evaluation order occurs from left to right and top to bottom for a scene hierarchy displayed in automatic layout. For example, Maya typically renders nodes in the order they appear in the scene hierarchy. Changing this order changes their rendering order. If a node has transparency, however, Maya puts the node in a delayed render queue. Maya renders this queue after all opaque objects. To see the evaluation order for a graph in free-form layout, select Layout→Automatic Layout. To return to the free-form layout, select Layout→Freeform Layout.
To move a node in the graph: Use Ctrl-middle mouse button to drag the node on top of another node. In a horizontal graph, the dragged node replaces the other node’s position. The other node’s position gets pushed to the right. In a vertical graph, the dragged node replaces the other node’s position. The other node’s position gets pushed downward.
Example Suppose you’ve created a scene containing several of the solar system’s planets, including earth. As you add each planet, the scene hierarchy puts a node representing the planet in the graph.
18
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
H ypergraph
Maya puts each new node in the graph to the right of existing nodes. The location of the planet nodes in the graph might not represent the spatial relationship of the planets in the workspace, as in this example:
Here, earth sits further from mercury than mars. In the actual solar system and in your workspace, this is not true. To make the graph reflect the positioning of the earth in the workspace, use Ctrl-middle mouse button to drag the earth on top of mars. Maya positions the node to the right of venus and to the left of mars. Thereafter, you’ll know where to look for earth in the scene hierarchy.
Creating a free-form hierarchy Maya lets you choose a free-form layout for the scene hierarchy to suit your node position preferences. By doing so, you can make the graph’s appearance resemble the appearance of characters or other complex objects in your scene. This helps you find and select components from the hierarchy more quickly. For example, suppose you’ve modeled a human hand. You can customize the graph so the location of its nodes resembles the arrangement of the joints that represent the fingers and palm:
Using Maya: Hypergraph, Sets & Expressions
19
Hypergraph Using the scene hierarchy
Important Move as few nodes as necessary. When you drag a node to a new position in the graph, you increase the scene’s file size and the Maya processing time needed to work with the scene. When you move a parent node, Maya automatically moves its children with it. Automatically moved children do not increase the file size and processing time.
To make a free-form graph: 1
Select Options→Layout→Freeform Layout.
2
Drag nodes to the desired positions in the graph. If the spot where you want to put a node is not visible in the window, drag the node past the edge of the window. The window scrolls in the direction you drag. To drag two or more nodes to another position, click the first node, Shiftclick the second node and any other nodes, then drag to the desired position. To drag a parent but not its children, Ctrl-Shift-click the node and drag to the desired position.
To return to the automatically generated layout: Select Options→Layout→Automatic Layout. You can return to your previous free-form graph arrangement by turning off Options→Layout→Freeform Layout.
To reset the free-form graph: If you create a free-form graph and you decide you no longer like its appearance, you can reset the graph to the automatic layout. 1
Select Edit→Reset Freeform Layout.
2
Click Yes when asked to confirm your selection.
Displaying a background image with a scene hierarchy You can display a single image of your choice as the background for a scene hierarchy. This is helpful if you want to create a free-form hierarchy that lets you identify and select a character’s joints and nodes more easily.
20
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using the scene hierarchy
You can display the image in the background of a free-form hierarchy, then position nodes and joints to match the character skeleton. This helps you identify scene hierarchy components more quickly. An example follows:
Using Maya: Hypergraph, Sets & Expressions
21
H ypergraph
For example, suppose you’ve modeled a human character. Suppose further you’ve rendered an image of the character or used a snapshot utility to capture an image of the character’s skeleton in the workspace.
Hypergraph Understanding the dependency graph The character skeleton exists behind the scene hierarchy. With this arrangement, you can quickly find nodes, for example, that represents the character’s feet and ankles.
To import the background image: 1
Choose View→Load Background Image. The Load Image window appears.
2
Use the window to select the image. Make sure the image name is in the text box at the bottom of the Load Image window, then click the Load Image button. The image appears in the scene hierarchy. Note that the image appears for the automatic layout as well as for the free-form layout. Having a background image for the automatic layout has no practical purpose. The node positions for the automatic layout are fixed.
3
Dolly or track to bring the image into view.
4
In Freeform Layout mode, move nodes to positions on top of the image. Whenever you display the scene hierarchy in the Hypergraph, the image appears behind the nodes.
To turn the display of the background image off or on: Turn Options→Show→Background Image (in free-form) on or off. You can display the image in the background of a free-form hierarchy.
Understanding the dependency graph The dependency graph displays connections between nodes in Maya that input and output data. A dependency graph node can represent an object’s geometry, for example, a NURBS sphere. A node can also represent a Maya operation such as a deformer. Inputs and outputs are the connections between nodes, including direction of influence. A dependency graph has no parent-child relationships, only data flow. You can display a dependency graph, for example, to see the data flow between nodes that make up an object’s construction history or shading. All nodes in a scene hierarchy also can be displayed in a dependency graph. However, not all nodes in a dependency can be displayed in a scene graph.
22
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
H ypergraph
For example, a NURBS sphere’s transform and shape nodes appear in a scene graph and therefore can be displayed in a dependency graph. A shading group node or deformer operation node that appears in a dependency graph never appears in a scene hierarchy. A dependency graph node takes input data from one or more other nodes and uses the input to create output data. When you create models, deform objects, animate, process audio, and so on, dependency graph nodes work with the data involved. Though we refer to a dependency graph as a singular graph, be aware you can display two or more independent graphs of connected nodes in the same window. We refer to each independent graph also as a dependency graph. Maya updates the dependency graph as you modify a scene.
Using a dependency graph The dependency graph is a tool for programmers who extend Maya capabilities. If you’re an advanced Maya user, you’ll also find it useful to: •
examine render node connections See “Displaying render node connections” on page 24.
•
examine other node connections See “Displaying upstream and downstream connections” on page 26.
•
disconnect rendering nodes and other nodes See “Disconnecting nodes in a dependency graph” on page 30.
•
connect rendering nodes and other nodes See “Connecting nodes in a dependency graph” on page 32. Avoid disconnecting and connecting nodes unless you have an understanding of Maya’s architecture. You’ll spare yourself frustration tracking down resulting problems. See “Editing objects” on page 41 and “Altering the view of a graph” on page 45 for additional details on working with a dependency graph.
Using Maya: Hypergraph, Sets & Expressions
23
Hypergraph Using a dependency graph
Tip As a new user of the Hypergraph, you might be unsure whether you’re looking at the scene hierarchy or a dependency graph. If you see arrows between nodes, you’re looking at a dependency graph. If Scene Hierarchy under the Graph menu is dim, you’re looking at the scene hierarchy.
Displaying render node connections You can show connections to shading groups, materials, textures, and lights. See Using Maya: Rendering for details.
To display render node connections: Choose one of these options: Rendering→Show Shading Groups Rendering→Show Materials Rendering→Show Textures Rendering→Show Lights
Example Suppose you create a NURBS sphere, then use the Multilister to create and assign a Phong shading group to it. Next you use the Multilister to create a 2D checker texture and assign it to the Phong node.
24
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph The Multilister displays the following contents: H ypergraph
The following dependency graph appears when you choose Rendering→Show Shading Groups:
Connection lines
Using Maya: Hypergraph, Sets & Expressions
25
Hypergraph Using a dependency graph The connection lines between nodes show connection direction. The connection line originates at a node that outputs data, and the line points to a node receiving the data as input. The preceding figure shows that the flow of output goes from place2dTexture1 to checker1, to phong1, and finally to the phong1SG shading group. Though you can see most of the same nodes in the Multilister, the dependency graph shows the nodes in a flow diagram. This makes it easy to see the connections between the nodes that make up a shading group. The figure also shows that nurbsSphereShape1 outputs its data to the phong1SG shading group. The phong1SG shading group therefore controls the color of the NURBS sphere. If you move your mouse pointer over a connection line, small white boxes appear next to the input node and output node. The white box next to an input node shows the node’s name and attribute that receives the input.
phong1.color
checker1.outColor
Mouse pointer
The white box next to an output node shows the node’s name and attribute that provides the output. Each node name and attribute is separated by a period, for example, checker1.outColor and phong1.color. In the preceding figure, the outColor attribute of checker1 is output to the color attribute of phong1. In many cases, you must be familiar with Maya internal operation details to understand the node and attribute names you see in the white boxes.
Displaying upstream and downstream connections You can show upstream and downstream connections to a selected node. An upstream connection is a node that provides input to the selected node. A downstream connection is a node that receives input from the selected node. To see connections to most objects, you must select the shape node of the object rather than the transform node.
26
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
To select a node and display its connections: Select the node.
H ypergraph
1
To choose a shape node from the scene hierarchy, make sure Options→Show→Shape Nodes is on.
Tip You can select an object’s shape node in the scene hierarchy without showing shape nodes. Select the object’s transform node, put the mouse pointer in the Maya or Hypergraph window, then press your keyboard’s down arrow key. Selecting a shape node with this technique is useful for scenes having many nodes, where displaying all shape nodes in the scene hierarchy takes up much panel space. Press the up arrow key to return to the transform node. 2
Choose one of these options: Graph→Up and Downstream Connections Graph→Upstream Connections Graph→Downstream Connections When you display upstream connections for a node, you see the chain of nodes that provide input to each other all the way to the selected node. When you display downstream connections for a node, you see the chain of nodes that output to each other, all the way through to the end receiving node.
Using Maya: Hypergraph, Sets & Expressions
27
Hypergraph Using a dependency graph
Example Suppose you create a wine glass surface by revolving a NURBS curve. The following dependency graph appears when you select the revolved surface’s shape node and choose Graph→Up and Downstream Connections:
Note that the graph is shown with a vertical orientation to make the illustration fit on this page. By default, a dependency graph has a horizontal orientation. See “Displaying a graph vertically or horizontally” on page 53. The connection lines between nodes show connection direction. The connection line originates at a node that outputs data, and the line points to a node receiving the data as input. The example graph shows that a curve provides input to the revolve operation node. The revolve operation generates a revolved shape—the wine glass. The revolved shape is connected to initialShadingGroup, which sets the default color of all geometric shapes created in Maya. If you move your mouse pointer over a connection line, small white boxes appear next to the input node and output node. The white box next to an input node shows the node’s name and attribute that receives the input. The white box next to an output node shows the node’s name and attribute that provides the output. Each node name and attribute is separated by a period.
28
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
Note that the dependency graph and scene hierarchy display animated nodes as slanted boxes. If you animate a node with an expression, it displays a regular rectangle rather than a slanted box. All other animation techniques display a slanted box. Specifically, a slanted box indicates Ball has a param curve connected to it.
Example Suppose you keyframe the translateX attribute of a NURBS sphere named Ball. If you select Ball’s transform node and display all upstream and downstream connections, this graph appears:
The slanted box indicates Ball’s transform node has been animated. The graph doesn’t indicate which type of animation technique controls the attribute.
Dragging nodes into a dependency graph You can drag one or more nodes from the Outliner or Multilister into the dependency graph to display the dependency graph of the node or nodes. This is ideal for keeping irrelevant nodes out of view when you’re creating and assigning rendering nodes. Any dependency graphs previously in the display remain there. 1
To clear out all graphs from the display, select Edit→Clear View.
2
Click Yes to confirm. Note that you can also drag a node into the dependency graph from any part of Maya that lets you drag icons.
To drag the node into the dependency graph: Use the middle mouse button to drag the node or nodes into the Hypergraph panel.
Using Maya: Hypergraph, Sets & Expressions
29
H ypergraph
In many cases, you must be familiar with Maya internal operation details to understand the node and attribute names you see in the white boxes.
Hypergraph Using a dependency graph The upstream and downstream connections appear in the graph. If the Hypergraph previously displayed the scene hierarchy, it now displays a dependency graph.
Disconnecting nodes in a dependency graph You can use the dependency graph to disconnect nodes.
To disconnect nodes: 1
Click the connection line representing the connection in the dependency graph. The connection line turns yellow to indicate it’s selected.
2
Press your keyboard’s Backspace key. The connection line disappears, indicating you’ve disconnected the connection. To update the graph’s layout to display the disconnected nodes more appropriately, choose Graph→Layout.
Example Suppose you create a NURBS sphere named Ball. You then use the Multilister to create a Phong E material with red color and assign the resulting phongE1SG shading group node to Ball.
30
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph The Multilister displays the following contents: H ypergraph
The following dependency graph appears when you select Rendering→Show Shading Groups.
The graph shows that an attribute of the BallShape node (that represents Ball’s geometry) is input to the phongE1SG shading group node. Ball gets its color from the phongE1SG node.
Using Maya: Hypergraph, Sets & Expressions
31
Hypergraph Using a dependency graph To stop the phongE1SG node from setting Ball’s color, do these steps: 1
Click the connection line leading from BallShape to phongE1SG. The connection line turns yellow to indicate it’s selected.
2
Press your keyboard’s Backspace key. The connection line disappears, indicating you’ve disconnected the nodes. The phongE1SG no longer controls Ball’s color. Ball keeps its previous shading group attribute values. In other words, it stays red and doesn’t become the default gray. If you alter attributes of phongE1SG, though, the changes are not passed to Ball. You can reconnect BallShape to another shading group node to make it control Ball’s shading. For example, you can use the middle mouse button to drag BallShape onto initialShadingGroup. Ball’s color becomes the default gray color set in the initialShadingGroup node. Note that each geometric object you create is connected to the initialShadingGroup node, by default, until you connect it to another shading group.
Connecting nodes in a dependency graph The dependency graph offers convenient ways to connect nodes while you examine the graph. In the dependency graph, you can: •
launch the Connection Editor
•
launch a window that displays input or output attributes you can connect to
•
connect a node’s default output attribute to a node’s default input attribute
To launch the Connection Editor: Use Shift-middle mouse button to drag from an output node to an input node. The Connection Editor appears. The Outputs side of the Connection Editor displays the dragged node and its attributes. The Inputs side displays the attributes of the destination node. See Using Maya: Rendering for details on the Connection Editor.
To create a default connection: Use the middle mouse button to drag the output node onto the input node.
32
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
If the attributes aren’t compatible, no connection occurs and the Connection Editor appears instead.
Example Suppose you create a NURBS sphere and cone named Ball and Cone. You use the Multilister to create a Phong E material with red color, and a Blinn material with blue color. You assign the resulting phongE1SG shading group node to Ball, and the blinn1SG shading group to the Cone. The Multilister displays the following contents:
Using Maya: Hypergraph, Sets & Expressions
33
H ypergraph
Maya connects the default output attribute from the output node to the default input attribute of the input node. Usually, the default input and output attributes are the attributes you would most likely want to connect.
Hypergraph Using a dependency graph The following dependency graph appears when you select Rendering→Show Shading Groups:
The graph shows ConeShape connected to the blinn1SG shading group, and BallShape connected to the phongE1SG shading group. You can swap the colors of Ball and Cone by reversing their connections to the shading groups.
To reverse connections: 1
Drag ConeShape onto phongE1SG. This reconnects the default output attribute of the ConeShape node to the default input attribute of the phongE1SG node. Cone becomes red.
2
Drag BallShape onto blinn1SG. This reconnects the default output attribute of the ConeShape node to the default input attribute of the phongE1SG node. Ball becomes blue.
34
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
Tip
Example Suppose you create a NURBS sphere named Ball. You then use the Multilister to create a Phong E material with blue color and assign the corresponding phongE1SG shading group node to Ball to color it blue.
Suppose further you create a black and white 2D checker texture, but you haven’t assigned it to an object.
Using Maya: Hypergraph, Sets & Expressions
35
H ypergraph
Choose Rendering→Create Render Node to create a new material, texture, or light. You can then connect to the new node using the dependency graph.
Hypergraph Using a dependency graph The Multilister displays the following contents:
To replace Ball’s blue color with the checker texture, you must use the middle mouse button to drag the texture node onto the shading group. If you choose Rendering→Show Shading Groups, you’ll see the shading groups in the scene, but not the textures:
36
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph
To drag the checker1 texture onto the phongE1SG shading group, you need to display them in the graph at the same time. Do the following steps: 1
While the checker1 node is displayed in the dependency graph, use the middle mouse button to drag the phongE1SG shading group node from the Multilister into the window. The dependency graph for the phongE1SG node appears above the checker1 graph:
2
Use the middle mouse button to drag the checker1 node onto the phongE1SG or PhongE1 node.
Using Maya: Hypergraph, Sets & Expressions
37
H ypergraph
If you choose Rendering→Show Textures, you’ll see the textures created in the scene, but not the shading groups:
Hypergraph Using a dependency graph Maya makes a connection from checker1 to phongE1 and draws a connection line representing the connection:
Ball shows a black and white checkerboard texture, rather than blue color. Turn on Shading→Smooth Shade All and Shading→Hardware Texturing to display shading and textures of objects in your workspace.
3
38
To redraw the graph with better organization of connection lines, choose Graph→Layout.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Using a dependency graph Dolly and track to bring the reorganized graph into view:
5
Move the mouse pointer over the connection line between checker1 and phongE1.
H ypergraph
4
White boxes appear next to the nodes. They show that the default output outColor attribute of checker1 connects to the default input color attribute of phongE1. Because of this connection, the black and white checker1 texture provides the material color for the phongE1 node and therefore the phongE1SG shading group. An object connected to the phongE1SG shading group receives the black and white checker1 texture.
To launch the display of input or output attributes: 1
Drag a connection line to a node. If you drag the side of the line closer to the original output node, you display output attributes of the destination node. If you drag the side of the line closer to the original input node, you display input attributes of the destination node. After you drag a connection line to a node, a window appears and displays either the appropriate attributes you can connect to, either input or output. The part of the connection line you drag determines whether you display the node’s input or output attributes.
2
Click the attribute you want to connect to.
Using Maya: Hypergraph, Sets & Expressions
39
Hypergraph Using a dependency graph
Updating the layout of a dependency graph When you add or connect nodes in a scene, the dependency graph might place the nodes in a position that isn’t easy to read. If you don’t like the positioning of the added node, you can update the graph’s layout to a default reorganized layout.
To update the dependency graph’s layout: 1
Choose Graph→Layout. A window appears and asks you to confirm your choice.
2
Click Yes.
To return to the scene hierarchy from the dependency graph: Choose Graph→Scene Hierarchy.
Clearing the contents of a dependency graph You can clear the display of the dependency graph from the Hypergraph window. This is helpful when you’re looking at connections for one or more nodes, but want to look at unrelated nodes without the clutter of the existing nodes.
To clear the contents of the dependency graph: 1
Choose Edit→Clear View. A window requesting confirmation appears.
2
Click Yes.
Returning to the scene hierarchy While examining a dependency graph, you can return to the view of the scene hierarchy.
To return to the view of the scene hierarchy: Select Graph→Scene Hierarchy.
40
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Editing objects
Editing objects H ypergraph
There are several ways to edit objects as you’re examining the scene hierarchy or dependency graph. You can: •
select objects
•
add and select an IK handle
•
rename objects
•
hide objects
•
edit a selected node’s attributes
•
add a render node
Selecting objects The scene hierarchy and dependency graph offer a convenient way to select objects or other items in a scene. This is useful when items in the workspace are crowded and overlapping.
To select an object: 1
Track and dolly the view to find the node that represents the object or component. For example, if your scene has an object named Ball, bring the node representing Ball into view in the scene hierarchy.
2
Click the node to select it. The node changes to yellow.
Click a node to select the object it represents.
To deselect an object: Click an empty spot in the window.
Using Maya: Hypergraph, Sets & Expressions
41
Hypergraph Editing objects When you deselect a node, it becomes gray again.
Adding and selecting an IK handle In a scene having an IK character with a complex, crowded skeleton, you can use the scene hierarchy to easily add an IK handle to a joint chain. This lets you select the handle easily.
To add an IK handle: 1
From Maya’s Animation menu, choose Skeletons→IK Handle Tool.
2
In the scene hierarchy, select the top node of the joint chain.
3
Shift-select the bottom node of the joint chain. Maya creates an end effector and IK handle for the joint chain.
IK handle icon
To select an IK handle: Click the IK handle icon to the right of the end effector node. The IK handle node (and icon) turn yellow to indicate you’ve selected it. If you make the IK handle node the child of another node, its location might be hard to find in the graph. The IK handle icon to the right of the end effector at the bottom of the joint chain makes it easy to find.
42
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Editing objects
Renaming an object
MountainBike
RoadBike
FrontTire
FrontTire
BackTire
BackTire
This is allowed.
Bike
Tire
Tire
This is not allowed.
To rename an object: 1
Drag the mouse over the node representing the object.
2
Click the right mouse button and select Rename from the pop-up menu.
Using Maya: Hypergraph, Sets & Expressions
43
H ypergraph
You can rename an object or other item in the scene hierarchy or dependency graph. You can give two nodes the same name, but only if each has a different parent. An example follows:
Hypergraph Editing objects A small text box appears in the node:
Text box
3
Enter the new name.
Hiding an object in the workspace You can use the scene hierarchy or dependency graph to make an object or other item invisible in the workspace.
To hide an object: 1
Drag the mouse over the node representing the object.
2
Click the right mouse button and select Hide from the pop-up menu. The object disappears from the workspace and from the scene hierarchy.
To display a hidden object: 1
Select Options→Show→Invisible Nodes. The node representing a hidden object has a light gray color to indicate it’s invisible in the workspace.
Invisible node
2
Drag the mouse over the node representing the object.
3
Click the right mouse button and select Show from the pop-up menu. The object reappears in the workspace.
44
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
Editing an object’s attributes
To edit an node’s attributes: 1
Select the node in the graph.
2
Select Edit→Attributes. The Attribute Editor appears for the selected object or item.
Tip When the dependency graph is displayed, you can launch the Attribute Editor for a node by double-clicking it.
Creating a render node You can launch the Create Render Node window to create a new material, texture, and light. This is convenient when you’re examining the dependency graph for a rendering node. The Create Render Node window is the same window that appears when you choose Edit→Create from the Multilister.
To create a render node: Choose Rendering→Create Render Node. The Create Render Node window appears. See Using Maya: Rendering for details.
Altering the view of a graph A scene hierarchy or dependency graph covers lots of screen space for complex scenes. For example, you might create a detailed kinematic character that results in thousands of nodes. The following pages describe general navigation techniques for examining a graph. You can use the techniques with a scene hierarchy or dependency graph, unless otherwise noted.
Using Maya: Hypergraph, Sets & Expressions
45
H ypergraph
After you select a node in the scene hierarchy or dependency graph, you can edit its attributes:
Hypergraph Altering the view of a graph
Tracking the view You can move the view of the graph up, down, or sideways.
To track the view: In the graph view, use Alt-middle mouse button to drag in the desired direction.
Dollying the view You can enlarge or shrink the view of the graph.
To dolly the view: In the graph view, hold down the Alt key and drag the left and middle mouse buttons left to shrink the view; drag to the right to enlarge the view.
Note If you dolly away from a graph, the text in node boxes becomes abbreviated. An ellipses (...) appears to the right of the abbreviation. To read the text, drag the mouse pointer over the box. The node’s name appears in a pop-up box. The type of node appears in parenthesis next to the node name. For example, if you see Ball (transform) in a box, it means the box represents the node named Ball, which is a transform node.
Dollying a region You can dolly the view of a selected region by dragging a selection box.
To dolly a region: 1
46
Ctrl-Alt-drag a selection box from left to right around the region.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
H ypergraph
Drag from left to right.
The region in the selection box expands to the center of the Hypergraph window:
To dolly away from a selection: Ctrl-Alt-drag a selection box from right to left around the region.
Using Maya: Hypergraph, Sets & Expressions
47
Hypergraph Altering the view of a graph
Fitting an entire graph in the window You can fit an entire graph in the Hypergraph window. This is helpful if you want to see the general organization of nodes.
To fit the entire scene graph in the window: Select View→Frame All.
In a large graph, the node names will be too small to read. You’ll need to dolly and track this view to read the names.
Centering selected nodes in the window You can center and expand the view of selected nodes in the Hypergraph window. You might want to do this, for example, when you’re looking at distant, unreadable view of the graph, and you want to read the name of the currently selected object.
To center selected nodes in the window: 1
Click the node or nodes in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
48
Select View→Frame Selection.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph Here’s an example display: H ypergraph
Selected node
Centering a hierarchy in the window You can center a selected node’s hierarchy in the Hypergraph window. This is useful when you want to focus on a group of related nodes above and below the selected node. This option works only in the scene hierarchy, not in the dependency graph.
To center a hierarchy in the window: 1
Click the node in the graph. You can also select a node in the Maya workspace or from the Outliner.
2
Select View→Frame Hierarchy.
Centering a hierarchy branch in the window You can center the branch descending from a node in the Hypergraph window. This is useful when you want to focus on the related nodes below a selected node. This option works only in the scene hierarchy, not in the dependency graph.
To center a branch in the window: 1
Click the node in the graph. Using Maya: Hypergraph, Sets & Expressions
49
Hypergraph Altering the view of a graph You can also select a node in the Maya workspace or from the Outliner. 2
Select View→Frame Branch.
Adjusting view transition speed When you alter the view of a graph by selecting View→Previous View or View→Next View, Maya dollies from one view to another instantaneously, by default. You can slow Maya’s transition speed between views to make the view change action easier to see.
To adjust the transition speed between views: 1
Turn on Options→Transitions→Animate Transitions.
2
Choose Options→Transitions→ and select one of these speeds: 5 Frames 10 Frames 15 Frames 20 Frames 20 Frames dollies slowest, 5 Frames dollies fastest.
To return to the default transition speed between views: Turn off Options→Transitions→Animate Transitions.
Setting graph update options Whenever you add or delete an object, rendering node, or other item in the scene, the Hypergraph updates the scene hierarchy and dependency graph, by default. When you select an object in the scene hierarchy or dependency graph, the object is also selected in the workspace, Outliner, and elsewhere in Maya. Also, when you select an object in the workspace, Outliner, and elsewhere in Maya, the object becomes selected in the scene hierarchy or dependency graph. These updates slow Maya operation when you work with a complex scene or when you’re examining nodes or dragging nodes to new positions in a free-form hierarchy. You can turn off updating to improve operation speed.
50
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
To turn off graph updates for created nodes:
If you turn this option on later, the graph displays all previously added and deleted nodes.
To turn off Hypergraph selection updates: Turn off Options→Update→On Selection.
Undoing a view of a scene hierarchy As you’re tracking, dollying, and making other changes to the view of a scene hierarchy, you’ll sometimes want to return to a previous view. Maya keeps the history of your view changes and lets you return to one or more previous views. After you display a previous view, you can move forward again to other view.
To change to a previous view: Select View→Previous View. To see the view before this one, select View→Previous View again.
To see the view ahead: Select View→Next View. This works only after you’ve used View→Previous View. To see another view ahead, select View→Next View again.
Using bookmarks for graph views You can bookmark the view of a graph to return to it later. For instance, suppose you dolly the view to see a group of nodes, then bookmark the view. If you dolly to a different view of the scene, you can select the bookmarked view to return to it. Note that the layout of the nodes in a previously bookmarked view changes when you modify a scene as follows: •
add or delete objects.
•
reposition nodes in a free-form hierarchy
Using Maya: Hypergraph, Sets & Expressions
51
H ypergraph
Turn off Options→Update→On Nodes Creation.
Hypergraph Altering the view of a graph •
expand or collapse nodes
•
display invisible, shape, or underworld nodes If a node was selected and entirely visible in the view at the time of bookmarking, when you return to the bookmarked view, the node appears in the same position regardless of how you’ve altered the graph. If no node was selected or if a selected node was only partly visible in the view, returning to the bookmarked view shows the previously displayed region in the graph. Depending on how you’ve altered the graph, the previously displayed nodes might not appear in the bookmarked region anymore. You’ll likely need to create a new bookmark. As you add or delete nodes in a scene, Maya updates the layout of the scene hierarchy and dependency graph. Don’t be alarmed if you notice a node disappears from a previously bookmarked view of the dependency graph. This is usually the result of Maya conforming with its default graph layout.
Tip You can ensure that a bookmarked view displays a node even after you reposition, add, or delete nodes in the scene. To do so, select the node and make sure its entire outline is visible in the view before creating the bookmark. If you select two or more nodes, the bookmarked view displays the first node selected.
To bookmark a view: 1
Track and dolly the view as desired.
2
Select Bookmarks→Create Bookmark. The bookmarked view gets a default name, for example, hyperView1. The name appears at the bottom of the Bookmarks menu.
To name a view before bookmarking it: 1
Track and dolly the view as desired.
2
Select Bookmarks→Create Bookmark-❒. A window appears and prompts for the bookmark name.
3
52
Enter a bookmark name.
Using Maya: Hypergraph, Sets & Expressions
Hypergraph Altering the view of a graph
Select Bookmarks and the name of the bookmark at the bottom of the menu. For example, select Bookmarks→MonsterHead.
To delete a bookmarked view: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Delete Bookmark. The name of the bookmark is deleted.
To rename a bookmarked view: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Rename Bookmark. A window appears and prompts for the bookmark name.
4
Enter the new name. You can also rename a bookmark by selecting Bookmarks→name-❒, where name is the name of the bookmark. A prompt window appears and lets you enter the new name.
Displaying a graph vertically or horizontally The scene hierarchy and dependency graph have a horizontal layout by default. Here’s an example:
Using Maya: Hypergraph, Sets & Expressions
53
H ypergraph
To return to a bookmarked view:
Hypergraph Altering the view of a graph If you prefer to look at a graph upright, you can change to a vertical layout.
To display the graph vertically: Select Options→Orientation→Vertical.
To display the graph horizontally: Select Options→Orientation→Horizontal.
Rebuilding the graphs If your scene hierarchy or dependency graph doesn’t seem up to date, you can rebuild the graphs. For example, if you add an object to a scene and it doesn’t appear in the scene hierarchy, rebuild the graphs to make the scene hierarchy aware of the object’s presence.
To rebuild the graph: Select Graph→Rebuild.
54
Using Maya: Hypergraph, Sets & Expressions
Index A adding IK handle 42 animated nodes 9, 29 animating transitions (of view) 50 Attribute Editor launching 45 attributes default input and output 39 editing 45 automatic graph layout 20
B background image importing to scene hierarchy 20 bookmarks automatic view change 52 creating 52 deleting 53 renaming 53 returning to 53 branches 9 centering in view 49 breaking parent-child relationship 17
C
D default input and output attributes 39 deformer connections displaying 14
dependency graph 5 displaying lights 24 displaying textures 24 how to use 23 materials 24 rebuilding 38 shading groups 24 types of nodes 22 understanding the 22 displaying entire graph in view 48 hidden objects 44 horizontal graph 53 up and downstream connections 26 vertical graph 53 dollying graph view 46 selected region 46 downstream connections 26 dragging node from Outliner or Multilister 29 to reconnect nodes 37
E editing objects 41 ellipses (...) in graph 46 empty group nodes 17 expanding nodes 10 expression connections displaying 14
F
Index
cameras default display of 7 centering nodes in view 48 children 8, 15
clearing graph display 40 collapsing nodes 10 color swapping object 34 connecting default output to input 32 nodes 32 Connection Editor launching from dependency graph 32 connection lines in dependency graph 26 in scene hierarchy 14 connections creating default 33 direction of 26 displaying constraint 14 displaying deformer 14 displaying expression 14 constraint connections displaying 14 Create Render Node window launching 45 creating bookmarks 52 new materials, textures, or lights 45
free-form hierarchy 21, 22 creating 19
Using Maya: Hypergraph, Sets & Expressions
55
Index
G
lights dependency graph 24
graphs clearing display 40 dollying view 46 navigation techniques 45 rebuilding 54 tracking 46 turning off updates 51 viewing 46 group nodes 16
H hidden objects 44 hierarchy centering node in view 49 horizontal layout of graph 28, 53 Hypergraph 5, 6 menu bar 7 tool bar 7
M materials dependency graph 24 menu bar 7 menus displaying context sensitive 12 Multilister nodes visible in dependency graph 26
N next view 51
I IK handle adding 42 selecting 42 image displaying as background 20 improving speed Hypergraph 50 input nodes 26 invisible nodes 12 objects 44
L layout updating graph 40
56
Using Maya: Hypergraph, Sets & Expressions
nodes 8 animated 9, 29 attribute names in dependency graph 26, 28 child 8, 15 collapsing 10 connecting 32 containing param curves 9, 29 displaying invisible 12 displaying shape 12 displaying underworld 12 dragging from Outliiner or Multilister 29 dragging to reconnect 37 effect on graph of deleting and adding 52 empty group 17 expanding 10 group 16 input 26 moving relative position of 18 output 26 parent 8, 15 renaming 43 selecting 41 shape 9 showing invisible 11 slanted boxes 9, 29 subnodes 9, 10 transform 9
O objects displaying hidden 44 editing 41 editing attributes of 45 hiding 44 making invisible 44 selecting 41 output nodes 26
Index
P param curves 9, 29 parents 8, 15 breaking relationship 17 creating 16 previous view returning to 51
R rebuilding graph 38, 54 region dollying 46 renaming node 43
S
view centering branch 49 centering node hierarchy 49 centering nodes 48 changing transistion speed 50 dollying graph 46 history 51 next 51 returning to prior 51 tracking graph 46
W
T textures displaying in dependency graph 24 graph display example 37 tool bar 7 tracking graph view 46 transform nodes 9 transition speed changing 50
white boxes in dependency graph 26, 28
Y yellow nodes 41
U underworld nodes displaying 12 update options setting graph 50 updating graph layout 40 upstream and downstream connections 26
Index
scene hierarchy 10 automatic layout 20 creating free-form 19 defined 5 displaying background image 20 displaying special nodes and connections 12 parenting 15 rearranging nodes 17 terminology 8 selected nodes framing in view 48 selected region dollying 46 selecting IK handle 42 objects 41
shading groups 26 changing selected 36 display example 24 displaying in dependency graph 24 shape nodes 9 displaying 12 slanted boxes 9, 29 speed of Hypergraph improving 50 subnodes 9, 10
V vertical layout of graph 28, 53
Using Maya: Hypergraph, Sets & Expressions
57
Character Animation
Contents Character Animation 10 Understanding Character Animation Modeling the character
168
Building, posing, and animating the skeleton Skinning the skeleton Using flexors
181
Workflow summary
183
184
11 Building Skeletons Understanding skeletons
187 188
188
Joint chains Limbs
170
178
Animating the character
Joints
167
189
190
IK handles and IK solvers
191
Using Maya: Animation
3
Contents Creating a joint chain or limb
192
Viewing a skeleton’s hierarchy Resizing joint display Positioning joints Inserting joints Removing joints
195
195
196 197 198
Mirroring limbs or skeletons Connecting skeletons
199
202
Disconnecting a joint to make two skeletons Rerooting the skeleton
204
205
Setting joint creation options
206
Viewing joint creation options Setting degrees of freedom
207 208
Setting automatic joint orientation
208
Setting scale compensation
210
Setting automatic joint limits
210
Setting automatic creation of IK handles Setting IK handle options automatically Editing joint attributes
216
Editing a joint’s preferred angle
217
217
Editing joint orientation
219
Editing scale compensation Editing joint limits
212
214
Editing degrees of freedom Editing stiffness
220
220
Dampening rotation near joint limits
4
Using Maya: Animation
211
211
Viewing editable joint attributes Renaming a joint
211
223
Contents
12 Posing and Animating Skeletons Understanding posing and animating skeletons Forward kinematics
225 226
226
Posing and animating with forward kinematics Inverse kinematics (IK)
228
229
Posing and animating with inverse kinematics (IK) IK handles and IK chains IK solvers
230
230
231
Single chain (SC) solver
231
Rotate plane (RP) solver
233
Spline solver
237
Multi-chain (MC) solver Creating IK handles
237
238
Adding an IK handle
238
Creating an IK chain
239
Displaying IK handle’s end effector
240
Displaying IK handle’s goal and goal’s axis
240
Displaying IK handle’s twist disc and pole vector’s axis Setting IK handle creation options
241
Viewing IK handle creation options Setting the current solver
Setting sticky
243
243
Setting solver enable Setting snap enable
241
242
Activating the multi-chain (MC) solver Setting autopriority
240
244 244
244
Setting priority
245
Setting weight
245
Setting position vs. orientation (PO) weight Editing IK handle attributes
246
246
Viewing editable IK handle attributes
247 Using Maya: Animation
5
Contents Renaming an IK handle
249
Editing transform attributes Editing skeleton info
249
250
Editing IK handle attributes
250
Editing IK solver attributes and choosing an IK solver Editing pivots
251
Editing limit information Editing display
252
252
Editing node behavior Editing IK solvers
253
253
Editing IK solver attributes Editing node behavior Using IK systems
253
254
254
Creating an IK system
254
Accessing an IK system
255
Renaming an IK system
255
Viewing an IK system’s IK solvers
255
Editing global snap and global solve Editing node behavior Posing IK chains
255
256
256
Posing with single chain (SC) solver IK handles
256
Positioning with rotate plane (RP) solver IK handles Twisting with rotate plane (RP) solver IK handles
257 257
Eliminating flip in rotate plane (RP) solver IK handles Sticky posing
257
258
Using IK spline handles
259
Creating IK spline handles Animating the joint chain
259 261
Setting options before creating the IK spline handle
265
Setting attributes after creating the IK spline handle
271
Preventing unwanted start joint flipping
6
251
Using Maya: Animation
272
Contents Working with soft body curves
274
Tips for working with IK spline handles Working with human skeletons
276
Working with animal skeletons
277
274
Working with sinuous motion on skeletons Animating IK chains Keyframing
280
280
Motion capture
281
13 Skinning Skeletons Understanding skinning
283
284
Closest point skinning
284
Partition set skinning
285
Skin point set colors
285
Bind pose
278
285
Skin detachment and reattachment Binding by closest point Binding by partition set
285 287
Binding multiple objects as skin Returning to bind pose
288
289
Displaying skin point set colors Editing skin point sets
285
290
290
Detaching and reattaching skin
290
Detaching skin without preserving skin groups and percentages Detaching skin while preserving skin groups and percentages Reattaching skin while preserving skin groups and percentages
291 292 292
Using Maya: Animation
7
Contents Animating with skin and skeleton groups
14 Using Flexors
292
295
Understanding flexors
296
Lattice flexors
296
Sculpt flexors
298
Cluster flexors
299
Creating lattice flexors
301
Positioning lattice flexors after creation Editing joint lattice flexor attributes
302
Viewing joint lattice flexor attributes Renaming joint lattice flexors Editing creasing
303
Editing rounding
305
Editing length in
306
Editing length out Editing width left
303
303
308 310
Editing width right
311
Editing bone lattice flexor attributes
313
Viewing bone lattice flexor attributes Renaming bone lattice flexors Editing length in
314
Editing length out Editing width left
316 318
Editing width right
8
Editing bicep
321
Editing tricep
322
Using Maya: Animation
302
319
314
313
Contents Creating sculpt flexors
324
Editing sculpt flexor attributes Joint-driven sculpting Creating cluster flexors
325
325 326
Editing cluster flexor attributes
328
Editing with cluster flexor manipulators
328
Using Maya: Animation
9
Contents
10
Using Maya: Animation
10
Understanding Character Animation
This chapter presents an overview of animating an articulated, hierarchical 3D character in Maya. Animating a character includes the following: •
“Modeling the character” on page 168
•
“Building, posing, and animating the skeleton” on page 170
•
“Skinning the skeleton” on page 178
•
“Using flexors” on page 181
•
“Animating the character” on page 183 This chapter concludes with a summary of Maya’s workflow for skeletal character animation: “Workflow summary” on page 184.
Using Maya: Animation
167
Character Animation
As a character animator using Maya, you can create the illusion of life. You can animate virtually any character imaginable, no matter how realistic, abstract, or surreal. The essence of character animation is timing and motion. Maya offers the most sophisticated tools available for defining the timing and motion of characters. Using Maya: Animation, Character Animation, describes how to use Maya’s skeleton-based shape deformation tools to animate articulated, hierarchical 3D characters with forward or inverse kinematics techniques.
Understanding Character Animation Modeling the character
Modeling the character Modeling is the process of creating a geometry for the character. Modeling is the first step in animating a character.
For best results, create the geometry with limbs outstretched. This will make building a skeleton much easier. A geometry can be a non-uniform rational B-spline (NURBS) geometry or a polygonal geometry. A geometry defines the shape of the character’s surface.
168
Using Maya: Animation
Understanding Character Animation Modeling the character
Character Animation
To create a geometry for a character, use the modeling tools in Maya’s Model menu. When you create the geometry, you should also define how the character will look when rendered. For rendering, use the tools in Maya’s Render menu. Note that you can also use Maya’s particle system to define the character’s features. To use the particle system, use the tools in Maya’s Dynamics menu.
Note To use the animation tools this document describes, be sure you have Maya’s Animation menu selected. The next step in animating a character is to create a skeleton so you can control a character’s actions. First you build a skeleton for the character’s geometry, and then you bind the geometry to the skeleton. This lets you control the geometry’s shape and actions.
Using Maya: Animation
169
Understanding Character Animation Building, posing, and animating the skeleton
Building, posing, and animating the skeleton A skeleton is a structure for animating a character’s articulated, hierarchical actions.
The skeleton you build for a character need not exactly resemble what the character’s skeleton would be like in real life. You might create a skeleton for a character that would lack one in real life. Depending on the effect you want to create, you might even have the skeleton influence the geometry from a location outside of the geometry. A skeleton consists of joints connected by the bones of the joints. Additionally, a skeleton can consist of special tools called inverse kinematics (IK) handles. IK handles enable you to pose the character easily, and they facilitate animation. You could begin building a skeleton for a human character by creating some legs.
170
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Character Animation
In this example, each leg consists of a simple series of joints connected by bones. For clarity, these legs are shown without a geometry in the scene. When you create a skeleton, you should have the geometry in your current scene so you can be sure the skeleton fits the model properly. When we think of a real skeleton, we tend to think first of the bones and then of the joints that enable movement. When it comes to animating movement, however, we must first focus on the joints and their hierarchical relationships. In Maya, the joints of a skeleton always exist in a hierarchy that defines how they can move in relation to each other. Any two connected joints have a hierarchical relationship for defining articulated actions. This relationship is indicated by the bone that connects the two joints.
Using Maya: Animation
171
Understanding Character Animation Building, posing, and animating the skeleton
Joint Bone Joint
Note that the bone has a wedge shape. The joint at the thicker end of the wedge is higher in the hierarchy than the joint at the thinner end. Whenever the joint at the thicker end rotates, the bone and the joint at the thinner end will have to move in an arc. But when the joint at the thinner end rotates, the joint at the thicker end will not have to move. This is just like how a real skeleton moves. The joint at the thicker end is called the parent joint in relation to the joint at the thinner end, which is called the child joint. We can think of the parent joint as being “above” the child joint and the child “below” the parent.
Parent joint
Child joint
Parent joint’s bone
As far as hierarchical movement is concerned, the bone that connects the two joints is really part of the parent joint. A bone belongs to a parent joint, which completely controls the bone’s movements. Note that a joint can have more than one bone, each bone connecting the parent joint to a different child joint.
172
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Parent joint of joint chain
You can create very elaborate skeletons consisting of multiple joint chains organized into a complex hierarchy. A limb consists of one or more joint chains that branch off from one another in a tree-like structure.
Using Maya: Animation
173
Character Animation
Any simple series of joints connected together by bones is called a joint chain. The highest joint in the joint chain’s action hierarchy is called the parent joint of the joint chain. The action of a joint chain’s parent joint affects everything below it in the chain.
Understanding Character Animation Building, posing, and animating the skeleton
The highest joint in a skeleton’s hierarchy is called the root joint; when the root joint moves or rotates, everything must move or rotate with it. The order in which you create joints and their bones defines their action hierarchy for rotation and movement. In the leg, the hip joint is the highest joint in the action hierarchy. The hip joint was created first, then the knee joint, and so on.
174
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Character Animation
You can limit how joints rotate so that you can easily put the character in realistic poses. For example, you can limit how a knee joint can rotate so it can’t bend from side to side but only forward and back.
Using Maya: Animation
175
Understanding Character Animation Building, posing, and animating the skeleton Setting and editing the characteristics of the knee joints will make the animation of a walk cycle much easier. You can set each joint’s characteristics as you create a skeleton and later tweak them as you pose and animate the character. Chapter 11, “Building Skeletons”describes creating and editing joints and bones. After you’ve created all the joints and bones that make up a skeleton for your character, you’ll want to move the skeleton around and put it in various poses. In Maya, there are two basic ways to pose a joint chain: forward kinematics and inverse kinematics. With forward kinematics, when you pose a joint chain you have to specify the rotations of each joint individually, starting from the parent joint on down to all the joints below. This approach is excellent for creating detailed arc motions. With inverse kinematics, when you pose a joint chain all you have to do is tell the lowest joint in the joint chain’s hierarchy where you want it to be, and all the joints above it will rotate automatically. Inverse kinematics offers a very intuitive way to pose a joint chain because it enables goal-directed posing. When you reach for an object, you don’t think about how you are going to rotate your shoulder, your elbow, and so on. You just think about where the object is that you want to reach, and your body automatically does the rest. That’s how inverse kinematics works, too. To pose a joint chain with inverse kinematics, you need to add some special tools to a skeleton. These tools are called inverse kinematics (IK) handles. An IK handle enables you to pose a joint chain intuitively. An IK handle begins at a joint chain’s parent joint and can end at any joint below the parent joint. For example, for each leg you could create an IK handle that controls the joint chain beginning at the hip joint and ending at the ankle joint.
176
Using Maya: Animation
Understanding Character Animation Building, posing, and animating the skeleton
Character Animation You can select the IK handle where it ends at the ankle joint and move the chain with it in the same way that you would think about moving your own ankle. In addition to posing a skeleton, IK handles also play an important role in the animation of the skeleton. The movement of a chain between the keyframes of an animation is also automatically solved by the chain’s IK handles. IK handles figure out how to rotate and move all the joints in the chain for you by using an inverse kinematics (IK) solver. An IK solver is the motor intelligence behind an IK handle. Maya offers several different types of IK solvers for different types of movement effects. For further control, you can also specify the characteristics of the IK solvers themselves. You’ll want to create IK handles for all of a skeleton’s joint chains that you want to pose. Chapter 12, “Posing and Animating Skeletons” describes how to use IK handles and IK solvers. You can pose and animate a skeleton, but such an animation would show only the timing and motion of a character lacking form and shape. The next step is to bind the character’s model to the character’s skeleton so that the skeleton can control the model’s actions.
Using Maya: Animation
177
Understanding Character Animation Skinning the skeleton
Skinning the skeleton After you’ve created the character’s geometry and the character’s skeleton, the next step is to bind the two together. When a geometry is bound to a skeleton, the geometry can be referred to as the skeleton’s skin. When you pose the skeleton, the skin moves with the skeleton automatically.
The process of binding a geometry to a skeleton is called skinning. NURBS geometries are shaped by points called control vertices (CVs), and polygonal geometries are shaped by points called vertices. In both cases, Maya can control shape by means of points. After a geometry has been bound to a skeleton, these points are called skin points. To bind a geometry to a skeleton, Maya first divides the geometry’s points into sets according to each point’s proximity to a joint. The newly formed skin point sets are identified by various colors. (Note that some expert users call skin point sets partitions because any given point can be in only one set.) Next, Maya binds each skin point set to the nearest joint so the skin points in each skin point set will move with the nearest joint.
178
Using Maya: Animation
Understanding Character Animation Skinning the skeleton
Character Animation Note that because skin points are bound to joints by means of deformation tools called joint clusters, expert users sometimes call skin points joint cluster points. Once the skin is bound to the skeleton, exercise the character by putting it into various poses. It’s important to do this because you need to observe how the skin acts in response to the skeleton’s actions. Depending on the pose of the geometry and skeleton during binding, a few of the skin points could join an inappropriate skin point set.
Using Maya: Animation
179
Understanding Character Animation Skinning the skeleton
If so, you can easily move those skin points from one skin point set to another.
Chapter 13, “Skinning Skeletons”describes skinning in more detail.
180
Using Maya: Animation
Understanding Character Animation Using flexors
Using flexors You can animate skin deformation effects by using special deformation tools called flexors. Flexors are high-level deformeration tools for use with skins and skeletons. The effects of flexors can be driven by how you pose and animate a skeleton. Maya offers three types of flexors: lattice flexors, sculpt flexors, and cluster flexors. A lattice flexor influences skin around joints or the bones of joints. It can smooth or wrinkle skin around joints, and provide muscle definition around bones.
A cluster flexor controls the points in a skin point set around a joint with varying percentages of influence. It can provide very realistic smoothing effects. Let’s look at a lattice flexor attached to a joint. With a lattice flexor, a joint can directly influence skin points, changing the shape of the character’s skin. You can create a lattice flexor that will deform skin when the joint it is attached to rotates. For example, you can create a flexor that wrinkles the skin around an elbow as you bend a character’s arm.
Using Maya: Animation
181
Character Animation
A sculpt flexor provides anatomically based deformations such as muscle bulges, knee caps, and elbow caps. A sculpt flexor can influence skin around joints or the bones of joints.
Understanding Character Animation Using flexors
Similarly, a lattice flexor attached to a bone can influence the skin around a bone. You can use lattice flexors attached to bones for animating muscle definition.
182
Using Maya: Animation
Understanding Character Animation Animating the character Chapter 14, “Using Flexors” describes using flexors for skin deformation in more detail. Using Maya: Animation, Basic Deformers provides further information on Maya’s free form deformation tools. Unlike flexors, these deformation tools need not work in conjunction with a skeleton. These tools include sculpt deformers, wire deformers, lattice deformers, cluster deformers, and blend shape deformers. Blend shape deformers, for example, are excellent tools for facial animation. The time you put into building a skeleton, binding the geometry, and creating flexors is time well spent. The effort you put into these steps will pay off when you animate the character. Character Animation
Animating the character The more carefully you design and construct the character, the easier animating the character will be. You can animate the character by keyframing or by using motion capture data. For general information on keyframing animations in Maya, refer to Using Maya: Animation,Keyframe. For information on motion capture, see Using Maya, Animation,Motion Capture. In keyframing, you pose a character in key postures and set these postures as keys. Maya then interpolates the actions between the keys for you, playing the animation. For example, here is a frame from a walk cycle.
Using Maya: Animation
183
Understanding Character Animation Workflow summary
When Maya interpolates the actions between keyframes, it uses the IK handles, the IK solvers, the lattice flexors, sculpt flexors, cluster flexors, and all the other attributes of the character that you have defined to produce the animation. Chapter 12, “Posing and Animating Skeletons” describes how to pose and animate skeletons; note that the information there also applies to skeletons with skins. Chapter 13, “Skinning Skeletons” explains how to bind geometries to skeletons for posing and animating characters. Finally, Chapter 14, “Using Flexors” describes posing and animating skin deformations with flexors.
Workflow summary Animating an articulated, hierarchical 3D character in Maya involves using Maya’s skeletal deformation tools: skeletons and flexors. After you create a geometry for the character with Maya’s modeling tools, you can build a skeleton for the geometry and then bind the geometry to the skeleton. This binding process is called skinning. Skinning the geometry to the skeleton binds the model’s shape to the skeleton’s movement. The geometry has become the skeleton’s skin, and the skin’s shape will deform as appropriate when you pose and animate the skeleton. Skeletons can be posed and animated with Maya’s forward or inverse kinematics tools. Special inverse kinematics tools include IK handles and IK solvers.
184
Using Maya: Animation
Understanding Character Animation Workflow summary In addition to using a skeleton to create skin deformation effects, you can also use special deformation tools called flexors. Flexors provide a way for you to pose and animate skin deformation effects that complement the deformations being provided by the skeleton alone. Flexors are skin shape deformation tools whose effects can be driven by the actions of a skeleton. For example, the rotation of a joint can drive the bulging of some skin, indicating muscle. The next chapters cover the following topics: Chapter 11, “Building Skeletons”
•
Chapter 12, “Posing and Animating Skeletons”
•
Chapter 13, “Skinning Skeletons”
•
Chapter 14, “Using Flexors”
Character Animation
•
Using Maya: Animation
185
Understanding Character Animation Workflow summary
186
Using Maya: Animation
11
Building Skeletons After you’ve created a geometry for your character, the next step is to build a skeleton for the geometry. In general, you’ll want to have the geometry in the scene as you create the skeleton so can be sure the skeleton fits the geometry. You could create a character’s skeleton before you create the geometry, but you may have to scale the geometry and adjust the skeleton before you bind them together. Character Animation
This chapter describes how to build skeletons. Building skeletons includes the following: •
“Understanding skeletons” on page 188
•
“Creating a joint chain or limb” on page 192
•
“Resizing joint display” on page 195
•
“Positioning joints” on page 196
•
“Inserting joints” on page 197
•
“Removing joints” on page 198
Using Maya: Animation
187
Building Skeletons Understanding skeletons •
“Mirroring limbs or skeletons” on page 199
•
“Connecting skeletons” on page 202
•
“Disconnecting a joint to make two skeletons” on page 204
•
“Rerooting the skeleton” on page 205
•
“Setting joint creation options” on page 206
•
“Editing joint attributes” on page 211 Note that adding inverse kinematics (IK) handles and using IK solvers are important when animating a skeleton. For information about IK handle and IK solvers, see Chapter 12, “Posing and Animating Skeletons.”
Note To use the tools for building skeletons, be sure you have Maya’s Animation menu selected.
Understanding skeletons Skeletons are hierarchical, articulated structures for animating geometries. Skeletons provide a basis for animating hierarchical actions in much the same way that a human skeleton determines how the human body can move. When you build a skeleton, the grid can be quite useful for judging the size and shape of the skeleton. You can position and rescale the grid to suit your work. Also, use multiple camera views when building a skeleton to make sure that your skeleton fits the model appropriately in all three dimensions.
Joints Joints are the building blocks of skeletons. Each joint can have one or more bones attached to it. The action of a bone attached to a joint is controlled by the joint’s rotation and movement. Various joint attributes specify how the joint can act. For example, you can specify limitations on how far a joint can rotate. A root joint is the highest joint in a skeleton’s hierarchy. A skeleton can have only one root joint.
188
Using Maya: Animation
Building Skeletons Understanding skeletons A parent joint is any joint higher in a skeleton’s action hierarchy than any of the other joints that are influenced by that joint’s action. Joints below a given parent joint in the action hierarchy are called child joints.
Root joint (selected)
Character Animation
Parent joint of joint “A” Joint “A” Bone of joint “A” Child joint of joint “A”
Sample skeleton
Joint chains A joint chain is any group of joints and their bones connected in a series. The joints are connected linearly; you could draw a line through a joint chain’s series of joints and their bones without having to retrace your path. A given joint chain begins at the highest joint in the joint chain’s action hierarchy. This joint is the joint chain’s parent joint.
Using Maya: Animation
189
Building Skeletons Understanding skeletons
Joint chain Joint chain
Joint chain Joint chain
Joint chains
Limbs A limb is any group of one or more connected joint chains. The chains may branch off from one another, forming a tree-like structure. Unlike a joint chain, a limb’s joints may not be connected linearly; you may not be able to draw a line through all of a limb’s joints and their bones without doubling back. A given limb begins at the highest joint in the limb’s action hierarchy. This joint is the limb’s parent joint. When you begin building a skeleton that will have many symmetrical limbs, start in the center of the workspace near the scene’s world origin. Starting near the center will make it easier for you to create skeletons with many symmetrical parts.
190
Using Maya: Animation
Building Skeletons Understanding skeletons
Limb Limb
Character Animation
Limbs
IK handles and IK solvers IK handles are special tools for posing and animating joint chains. On any given chain, the joint where the IK handle begins is called the start joint and the joint the where IK handle ends is called the end joint. Note that experienced users sometimes refer to joint chains that have IK handles as IK chains. IK solvers provide the motor intelligence of IK handles. IK handles and IK solvers are described in Chapter 12, “Posing and Animating Skeletons.” When you create joint chains and limbs for your character, think about how you are going to use IK handles to pose the joint chains. Joint chains that consist of four or fewer joints are much easier to pose with IK handles than those that have many more joints.
Using Maya: Animation
191
Building Skeletons Creating a joint chain or limb Expert users have found that if a skeleton lies entirely in one plane before you bind the geometry to the skeleton, posing the character with IK handles can be somewhat awkward in extreme cases. Having some of the joints rotated slightly at various appropriate angles will make the character easier to pose later on.
Creating a joint chain or limb You begin building a skeleton by creating a joint chain, which is a series of joints and their bones. You can then add to the joint chain by continuing that joint chain or by creating new joint chains starting from any of the joint chain’s joints. In this way you can create a complex structure of various joint chains and limbs. These joint chains and limbs define a skeleton’s action hierarchy. Finally, you can view an outline of a skeleton’s hierarchy. This outline view is useful for getting a clear picture of how your skeleton is structured, and for selecting various parts of the skeleton.
To create a joint chain: 1
Select Skeletons→Joint Tool.
2
Click in the workspace at the position of the first joint. The joint is created. You can set a joint’s attributes while you create the joint or anytime after you have created it. To set a joint’s attributes while you create it, see “Setting joint creation options” on page 206. To modify a joint’s attributes after you have created it, see “Editing joint attributes” on page 211.
3
Move the pointer to where you want the second joint, and then click. The two joints are connected with a bone that indicates the direction of the joint chain’s hierarchy: the thinner end of the bone’s triangle points to the child joint.
4
Move the pointer to where you want the next joint, and then click. Continue moving the pointer and clicking until you’re done creating the joint chain you want.
5
To indicate you’ve finished creating the joint chain, press the Enter key or select another tool. If you want to change the positions of the joints, see “Positioning joints” on page 196.
192
Using Maya: Animation
Building Skeletons Creating a joint chain or limb
Character Animation
Creating a joint chain
To add to a joint chain: 1
Select Skeletons→Joint Tool.
2
Click on a joint in the joint chain. To continue a joint chain, click on the last joint in the joint chain. (The last joint is the lowest joint in the joint chain’s hierarchy.) To create a new joint chain that branches out from an existing chain, click on any joint other than the last joint in an existing chain. A group of one or more connected joint chains is called a limb.
3
Click where you want to create a new joint.
4
When you finish creating all the joints in the joint chain, press the Enter key or select another tool.
Using Maya: Animation
193
Building Skeletons Creating a joint chain or limb
Continuing a joint chain
1. Click here to continue the joint chain
2. Click to create more joints
or Creating a new joint chain from an existing joint chain
1. Click here to continue the joint chain
Adding to a joint chain
194
Using Maya: Animation
2. Click to create more joints
Building Skeletons Viewing a skeleton’s hierarchy You can rapidly build a skeleton for animating a character by continuing joint chains and creating new joint chains that branch out from existing joint chains.
Viewing a skeleton’s hierarchy To view an outline of a skeleton’s hierarchy Select Window→Outliner to view an outline of a skeleton’s hierarchy. Use the Outliner to see the structure of the skeleton, to select parts of the skeleton, and to see the names of the parts of the skeleton.
You can resize the display of a skeleton’s joints. Increasing the display size can make the joints and their bones easier to pick. Decreasing the display size can make other objects such as flexors easier to pick. Here is a skeleton displayed at normal size:
Skeleton at normal size Here is the same skeleton displayed at 25% of normal size: Using Maya: Animation
195
Character Animation
Resizing joint display
Building Skeletons Positioning joints
Skeleton at 25% normal size
To resize joint display: 1
Select Display→Joint Size.
2
Move the pointer to the arrow at the end of the Joint Size line.
3
Choose from the percentages listed to resize the joints, or choose Custom to set your own percentage. Percentages are relative to the default setting, which is always 100% or 1.00.
Positioning joints While you are creating a joint chain, you can edit the positioning of any joint without affecting the joints below it in the joint chain’s action hierarchy.
Note To edit the position of a joint after the skeleton is created and accepted, toggle on (the Select by Component Type icon) and (the Pivot icon), then use the right mouse button on the Pivot button to turn on Joint Pivots in the Pivot pick mask.
196
Using Maya: Animation
Building Skeletons Inserting joints
To position a joint as you create it: 1
Hold down the left mouse button to create a joint and drag it to a new position.
2
Release the mouse button when you’ve positioned the joint at the desired location.
To position the most recently created joint while creating the joint chain: While in create mode, you can use the middle mouse button to modify the most recent joint (the one currently selected). Character Animation
The transform manipulator appears and you can move the joint in any direction.
To position any joint in the hierarchy while creating a joint chain: 1
Press Insert on the keyboard. The transform manipulator appears at the end joint.
2
Move any joint in the skeleton by selecting and dragging it with the left mouse button.
3
Press Insert to toggle back to creating more joints for the skeleton. This will return you to the last created joint in the chain.
Inserting joints You can insert a joint anywhere in a skeleton’s action hierarchy below the root joint.
To insert a joint in a created skeleton: 1
Select Skeletons→Insert Joint Tool.
2
To position the new joint, use the left mouse button to drag from the joint you want as the new joint’s parent.Until you press Enter or select another tool, you can insert more joints.
3
When you have finished inserting joints, press Enter or select another tool.
Using Maya: Animation
197
Building Skeletons Removing joints
1. Click to add a joint below this one 2. Drag to position the new joint
Inserting a joint
Removing joints You can remove any joint from a skeleton except the root joint. The root joint is the highest joint in a skeleton’s action hierarchy, and deleting the root joint would delete the entire skeleton.
To remove a joint: 1
Select the joint you want to remove. Note that you can only remove one joint at a time.
2
Select Skeletons→Remove Joint. The joint is removed. The bone of the joint above the removed joint is extended to the joint below the removed joint.
198
Using Maya: Animation
Building Skeletons Mirroring limbs or skeletons
Click to delete the joint
Bone is resized
Character Animation
Removing a joint
Mirroring limbs or skeletons A group of one or more connected joint chains is called a limb. You can duplicate or make mirror copies of limbs. A mirror copy is a copy that is symmetrical about a selected plane; in effect, the reflection of the original in the plane is turned into a real copy of the original, but with all the aspects of the limb mirrored accordingly. The origin of the plane is at the parent joint of the limb. Joint attributes and IK handles are mirrored as well as the joints and their bones. Mirroring is extremely useful when you are creating the limbs for a character. For example, you can build a right arm and hand, and then create a mirrored copy of it for the left arm and hand. Mirroring affects all aspects of the creation of the left arm, including the joint limits. You don’t have to reset the joint limits so that the left arm’s joint limits will be symmetrical to the right arm’s joint limits; Maya will do it for you. You can also make a mirror copy of an entire skeleton. The procedure is the same as for creating mirror copies of limbs, except that the skeleton will be mirrored about the scene’s world origin.
Using Maya: Animation
199
Building Skeletons Mirroring limbs or skeletons
1. Click here to mirror this limb
2. A mirror copy of the limb is created
Mirroring a limb
200
Using Maya: Animation
Building Skeletons Mirroring limbs or skeletons
Click the root to mirror the whole skeleton
Skeleton is mirrored about the world origin
Character Animation
Mirroring a skeleton
To mirror a limb or skeleton: 1
Select the parent joint of the limb you want to duplicate, or select the root joint if you want to mirror an entire skeleton.
2
To choose the plane for mirroring, first select Skeletons→Mirror Joint-❐ to open the Mirror Joint Options window. Next, click the desired Mirror Across option to choose the plane in which you want the joint chain mirrored. The default is XY. If you are mirroring a limb, this indicates the XY plane whose origin is at the limb’s parent joint. If you are mirroring a skeleton, this indicates the XY plane whose origin is the scene’s world origin.
3
Click Mirror in the Mirror Joint Options window, or select Skeletons→Mirror Joint. If you are mirroring a limb, the limb is mirrored across the selected plane whose origin is at the limb’s parent joint. If you are mirroring a skeleton, the skeleton is mirrored across the selected plane whose origin is the scene’s world origin.
Using Maya: Animation
201
Building Skeletons Connecting skeletons
Connecting skeletons You can connect two skeletons in two ways: by combining joints and by connecting joints with a bone. First, you can connect two skeletons by combining the root joint of one skeleton with any joint of another skeleton except that skeleton’s root joint. The skeleton that becomes a limb of the other skeleton will change its position in the scene so that it is directly connected to the other skeleton’s joint. Second, you can connect the root joint of one skeleton to any joint of another skeleton by extending a bone to the root joint from the joint of the other skeleton. The skeleton that becomes a limb of the other skeleton will not have to move.
To connect skeletons by combining joints: 1
Select the root joint of the skeleton you want to be a limb of another skeleton.
2
On the other skeleton, select any joint other than the skeleton’s root joint.
3
Select Skeletons→Connect Joint-❐. The Connect Joint Options window is displayed.
4
In the Connect Joint Options window, turn on the Connect Joint mode. The skeleton that will become the limb moves so that its root is in the same place as the selected joint of the other skeleton.
5
In the Connect Joint Options window, click Connect. (Alternatively, select Skeletons→Connect Joint.) The two skeletons are connected.
202
Using Maya: Animation
Building Skeletons Connecting skeletons
Two joints are combined
Character Animation
Connecting skeletons by combining joints
To connect skeletons by connecting joints with a bone: 1
Click the root of the skeleton you want to be a limb of another skeleton.
2
On the other skeleton, select any joint other than the skeleton’s root joint. You can connect only to a non-root joint of the parent skeleton.
3
Select Skeletons→Connect Joint-❐. The Connect Joint Options window is displayed.
4
In the Connect Joint Options window, turn on the Parent Joint mode. Parent Joint mode connects the skeletons by creating a new bone between the selected root joint and the joint you’re connecting it to. The two skeletons do not move.
5
In the Connect Joint Options window, click Connect. (Alternatively, select Skeletons→Connect Joint.) Maya connects the skeletons with a bone. Note that connecting skeletons using Parent Joint mode is identical to the result you get by selecting Edit→Parent.
Using Maya: Animation
203
Building Skeletons Disconnecting a joint to make two skeletons
Bone created to connect the two skeletons
Connecting two skeletons by connecting joints with a bone
Disconnecting a joint to make two skeletons You can break up a skeleton into two skeletons by disconnecting any joint other than the root joint. The disconnected joint will become the root joint of the new skeleton. Note that if you disconnect a joint in a joint chain that has an IK handle, that IK handle will be deleted. For information about IK handles, see Chapter 12, “Posing and Animating Skeletons.”
204
Using Maya: Animation
Building Skeletons Rerooting the skeleton
Select joint you want to disconnect
Character Animation
Disconnecting a joint
To disconnect a joint to make two skeletons: 1
Select the joint you want to disconnect. This joint will become the root joint of the new skeleton.
2
Select Skeletons→Disconnect Joint. The joint is disconnected. The disconnected joint is now the root joint of the new skeleton.
Rerooting the skeleton You can change the hierarchical organization of a skeleton by changing which joint is the root joint. This process is called rerooting. Note that any IK handles that pass through the joint selected to be the new root joint will be deleted. Also, any animation of the skeleton’s root joint will be affected when you reroot.
Using Maya: Animation
205
Building Skeletons Setting joint creation options
Current root joint
Click to create new root joint
Rerooting a skeleton
To reroot a skeleton: 1
Click the joint where you want the new root. If you select the child of the entire joint chain, the hierarchy will reverse. If you select a joint in the middle of the skeleton to become the new root, you will have two child joints with separate hierarchies below the root joint.
2
Select Skeletons→Reroot Skeleton.
Setting joint creation options A joint’s various options and attributes define how a joint can be posed and animated. Specifying these is an important part of building a skeleton. You can set joint creation options before you create individual joints, or you can edit a joint’s attributes at any time after you have created it. This section describes how to set joint attributes automatically by setting the Joint Tool’s Tool Settings. To find out how to edit joint attributes, see “Editing joint attributes” on page 211. Setting joint attributes during joint creation includes:
206
Using Maya: Animation
Building Skeletons Setting joint creation options •
Viewing joint creation options
•
Setting degrees of freedom
•
Setting automatic joint orientation
•
Setting scale compensation
•
Setting automatic joint limits
•
Setting automatic creation of IK handles
•
Setting IK handle options automatically
Viewing joint creation options
Tool Settings window
To view joint creation options: Select Skeletons→Joint Tool-❐. The Joint Tool’s Tool Settings window is displayed. Using Maya: Animation
207
Character Animation
When you create a joint, you use the Joint Tool. You can set the Joint Tool’s options so that certain joint options and attributes will be set automatically. The Joint Tool’s options are displayed in the Joint Tool’s Tool Settings window.
Building Skeletons Setting joint creation options
Setting degrees of freedom Each joint has a local axis whose origin is at the center of the joint. The X-axis of the local axis is red, the Y-axis is green, and the Z-axis is blue. How a joint can rotate is defined in terms of this local axis. A joint’s degrees of freedom specifies which of its local axes it can rotate about during IK posing and animation.During IK, a joint is rotated by an IK handle, and how the IK handle performs depends on the type of IK solver the IK handle is using. A joint can have at most three degrees of freedom: the freedom to rotate about its X-axis, Y-axis, and Z-axis during IK. Expert users often call a joint with three degrees of freedom a ball joint because it can rotate about all three of its axes like a ball. Note that two types of IK solvers, the single chain solver and the plane solver, require that their start joints be ball joints that have no limitations on the extent they can rotate about each axis. You can limit a joint so that it has only two degrees of freedom or only one degree of freedom. A joint with two degrees of freedom can only rotate about any two of its local axes during IK. A human wrist would be a good example of a joint with two degrees of freedom, though the joint has limitations on the extent it can rotate about its axes. A joint with only one degree of freedom can rotate only about its local X-axis, or Y-axis, or Z-axis during IK. Expert users often call a joint with only one degree of freedom a hinge joint. A human knee would be a good example of a hinge joint.
To set degrees of freedom: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, click the X, Y, and Z, Degrees of Freedom check boxes to select the joint’s degrees of freedom.
Setting automatic joint orientation Maya can set the orientation of a joint’s local axis automatically. You can have the joint’s local axis oriented relative to the joint’s first child joint, or you can have the joint’s local axis oriented relative to the scene’s world axis. The orientation of a joint’s local axis is largely a matter of personal
208
Using Maya: Animation
Building Skeletons Setting joint creation options preference. Some expert users like to have the local axis of joints automatically orient towards first child joints, and other expert users prefer to have the local axis initially oriented the same as the scene’s world axis. By default, the orientation of a joint’s local axis is xyz. In this orientation, the positive X-axis points in the same direction as the joint’s wedge-shaped bone. That is, the X-axis points towards the center of the joint’s child joint. If the joint has more than one child joint, the X-axis points at the child joint that was created first. The Z-axis points sideways from the joint and its bone connecting the child joint, and the Y-axis points at right angles to the X-axis and Z-axis. All three axes are aligned according to the right hand rule.
You can select various combinations of the X-, Y-, and Z-axes to specify the orientation of a joint’s local axis. The first axis in the combination is the axis that points at the joint’s first child joint. The third axis points sideways from the joint and its bone connecting the child joint, and the second axis points at right angles to the first axis and third axis. All three axes are aligned according to the right hand rule. In terms of yaw, pitch, and roll, rotation about the first axis produces roll, rotation about the second axis produces yaw, and rotation about the third axis produces pitch. Instead of orienting the joint’s local axis relative to the first child joint, you can set the local axis to have the same orientation as the scene’s world axis. In this case, the orientation would be set to “none.”
To set automatic joint orientation: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, select one of the Auto Joint Orient options. Note that None orients the joint to the scene’s world axis.
Using Maya: Animation
209
Character Animation
For example, in a human skeleton the elbow joint’s X-axis would be pointing towards the wrist joint. With the arm lying flat, the elbow joint could twist about most of the X-axis, turning the rest of the arm. The elbow joint could partially swing up and down about the Z-axis, but it would not be able to pivot about the Y-axis.
Building Skeletons Setting joint creation options
Setting scale compensation When you scale the size of a joint, you can either scale the child joints also or prevent the scaling of the child joints. For example, if you increase the length of a lower arm bone by scaling the elbow joint, the wrist joint and its bones can either increase in size also or stay the same size. Either you can scale the hand as well as the lower arm or you can just scale the lower arm. Normally, when you scale a joint Maya will scale everything below it in the skeleton’s action hierarchy. However, by setting a joint’s Scale Compensate option on, you can prevent that joint and everything below it in the action hierarchy from being scaled when the joint’s parent joint is scaled. Additionally, expert users like to have Scale Compensate on to prevent inappropriate shearing deformation effects on a character’s skin. Shearing can occur when a given joint is scaled only along one or two of its axes.
To set scale compensation: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, click the Scale Compensate check box on or off.
Setting automatic joint limits You can have Maya automatically limit the extent a joint can rotate about its axes according to the angles at which you build the skeleton’s joints. With Auto Joint Limits on, the smaller inner angle of a joint rounded off to 180 degrees is set as the allowable range of rotation. For example, when you are creating a knee joint, if you create the joint slightly bent back, the joint will automatically not be able to swing the lower leg bone forward of the upper leg bone, nor will it be able to wobble from side to side. The joint will not be able to rotate in any other way except through the inner angle rounded off to 180 degrees. However, note that this limitation does not change the joint’s Degrees of Freedom setting.
To set automatic joint limits: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
210
In the Tool Settings window, click the Auto Joint Limits check box on or off.
Using Maya: Animation
Building Skeletons Editing joint attributes
Setting automatic creation of IK handles Maya can automatically create an IK handle for you when you finish creating a joint chain. The joint chain’s parent joint will become the IK handle’s start joint, and the last joint in the joint chain will become the IK handle’s end joint.
To set automatic creation of IK handles: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, click the Create IK Handle check box on or off.
See Chapter 12, “Posing and Animating Skeletons,” for descriptions of the IK handle options you can set when you create IK handles.
To set joint attributes: 1
Select Skeletons→Joint Tool-❐. The Tool Settings window is displayed.
2
In the Tool Settings window, select IK Handle Options.
Editing joint attributes A joint’s attributes can be set automatically when you create the joint, or you can edit a joint’s attributes at any time. This section describes how to edit joint attributes with the Attribute Editor. For more information on using the Attribute Editor, please see Using Maya: Maya Basics, Building Objects and Scenes, Chapter 5, “Working with General Editors.” To find out how to set joint attributes automatically, see “Setting joint creation options” on page 206. Editing a joint includes: •
Viewing editable joint attributes
•
Renaming a joint
•
Editing degrees of freedom
Using Maya: Animation
211
Character Animation
Setting IK handle options automatically
Building Skeletons Editing joint attributes •
Editing stiffness
•
Editing a joint’s preferred angle
•
Editing joint orientation
•
Editing scale compensation
•
Editing joint limits
•
Dampening rotation near joint limits You can access settings for a joint’s attributes, and also the Attribute Editor, by pressing the right mouse button while the cursor is on the joint you want to edit.
Viewing editable joint attributes To view or edit a joint’s attributes, use the Attribute Editor.
212
Using Maya: Animation
Building Skeletons Editing joint attributes
Character Animation
Attribute Editor for joints Using Maya: Animation
213
Building Skeletons Editing joint attributes
To view editable joint attributes: Choose Window→Attribute Editor to open the Attribute Editor. The Attribute Editor is displayed.
Renaming a joint Maya names joints for you when you create them. By default, joints are numbered consecutively as you create them. However, you can rename the joints to better reflect their purpose in your character’s skeleton. It’s a good idea to give joints meaningful names so they are easier to select when you are working with Maya’s editors, using the Hypergraph, or using the Outliner.
To rename a joint: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Enter the new name in the joint: field. The new name takes effect immediately.
214
Using Maya: Animation
Building Skeletons Editing joint attributes
Character Animation
Examples of meaningful joint names in the Outliner
Using Maya: Animation
215
Building Skeletons Editing joint attributes
Editing degrees of freedom Each joint has a local axis whose origin is at the center of the joint. The X-axis of the local axis is red, the Y-axis is green, and the Z-axis is blue. How a joint can rotate is defined in terms of this local axis. A joint’s degrees of freedom specifies which of its local axes it can rotate about during inverse kinematics (IK) posing and animation. During IK, a joint is rotated by an IK handle, and how the IK handle performs depends on the type of IK solver the IK handle is using. A joint can have at most three degrees of freedom: the freedom to rotate about its X-axis, Y-axis, and Z-axis during IK. Expert users often call a joint with three degrees of freedom a ball joint because it can rotate about all three of its axes like a ball. Note that two types of IK solvers, the single chain solver and the plane solver, require that their start joints be ball joints that have no limitations on the extent they can rotate about each axis. You can limit a joint so that it has only two degrees of freedom, or only one degree of freedom. A joint with two degrees of freedom can only rotate about any two of its local axes during IK. A human wrist would be a good example of a joint with two degrees of freedom, though the joint has limitations on the extent it can rotate about its axes. A joint with only one degree of freedom can rotate only about its local X-axis, or Y-axis, or Z-axis during IK. Expert users often call a joint with only one degree of freedom a hinge joint. A human knee would be a good example of a hinge joint. Note that you can have a joint’s degrees of freedom set automatically when you create the joint. To find out how to set a joint’s degrees of freedom automatically, see “Setting degrees of freedom” on page 208.
To edit a joint’s degrees of freedom:
216
1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
In the Attribute Editor, click the X, Y, and Z Degrees of Freedom check boxes to select the joint’s degrees of freedom.
Using Maya: Animation
Building Skeletons Editing joint attributes
Editing a joint’s preferred angle This attribute influences how an IK handle will prefer to rotate a joint during inverse kinematics. If you are not familiar with inverse kinematics (IK), IK handles, and IK solvers, see Chapter 12, “Posing and Animating Skeletons.” The IK solver often can rotate a joint in a number of different ways in order to reach the goal. Similarly, when more than one IK handle passes through a joint, the first priority of all the IK solvers is to make all the IK handles reach their goals. Often a variety of joint rotations can allow the IK handles to reach their goals.
Preferred angles can enable smoother motion during animation.
To edit a joint’s preferred angle: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Use the Preferred Angle fields to set the angle you prefer the joint to be in. The three values refer to the X, Y, and Z axes respectively. The angles are relative to the local coordinate system of the joint.
Editing stiffness This attribute influences how stiffly an IK handle can rotate a joint during inverse kinematics. If you are not familiar with inverse kinematics (IK), IK handles, and IK solvers, see Chapter 12, “Posing and Animating Skeletons.” When you use inverse kinematics to move a joint chain for animation, you can set some joints to move less freely than others. You can set joints in the mid-back of a human to move and bend less freely than those in the lower back, for example. The resistance to movement of a particular joint is called its stiffness.
Using Maya: Animation
217
Character Animation
Depending on how you want your character to move, some rotations are more appropriate than others. You can identify preferred angles for your character’s actions. Two types of IK solvers, the single chain IK solver and the rotate plane IK solver, will then give those angles priority over other possible angles during joint rotation. The angles you give priority to are called preferred angles.
Building Skeletons Editing joint attributes Stiffness operates relatively between joints in a joint chain controlled by IK handles. IK solver calculations for stiffness can require a little more time than usually required, so use stiffness only when its effect is particularly important. You set the stiffness for each axis separately. You can use this for joints that move in several directions. For example, a wrist joint moves more freely bending toward the forearm than it does from side to side.
Set stiffness high in Z-axis
Set stiffness low in X-axis
Set stiffness to create realistic animation Expert users have found that when stiffness is specified, the solver adjusts the internal energy strictly under the constraint that the end effectors stay fixed. Therefore, if there are no redundant degrees of freedom, the stiffness won’t modify the single chain IK solver’s solution.
To edit a joint’s stiffness 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
In the Stiffness fields, enter values from 0 to 100.0 for the X-, Y-, and Z-axes. The X-, Y-, and Z-axes are in the local coordinate system. 0 means the joint moves freely, 50 is moderately stiff, and 100 fuses the joint so that it’s immovable. With stiffness set to 0, no stiffness is specified. This is the recommended setting unless creating the effect of stiffness is particularly important.
218
Using Maya: Animation
Building Skeletons Editing joint attributes
Editing joint orientation You can edit the orientation of a joint’s local axis. You can have the joint’s local axis oriented relative to the joint’s first child joint, or you can have the joint’s local axis oriented relative to the scene’s world axis. The orientation of a joint’s local axis is largely a matter of personal preference. Some expert users like to have the local axis of joints automatically orient towards first child joints, and other expert users prefer to have the local axis initially oriented the same as the scene’s world axis.
For example, in a human skeleton the elbow joint’s X-axis would be pointing towards the wrist joint. With the arm lying flat, the elbow joint could twist about most of the X-axis, turning the rest of the arm. The elbow joint could partially swing up and down about the Z-axis, but it would not be able to pivot about the Y-axis. You can select various combinations of the X-, Y-, and Z-axes to specify the orientation of a joint’s local axis. The first axis in the combination is the axis that points at the joint’s first child joint. The third axis points sideways from the joint and its bone connecting the child joint, and the second axis points at right angles to the first axis and third axis. All three axes are aligned according to the right hand rule. In terms of yaw, pitch, and roll, rotation about the first axis produces roll, rotation about the second axis produces yaw, and rotation about the third axis produces pitch. Instead of orienting the joint’s local axis relative to the first child joint, you can set the local axis to have the same orientation as the scene’s world axis. In this case, the orientation would be set to “none.”
To edit a joint’s orientation: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Enter new values in the Joint Orient fields. The three values refer to the X-, Y-, and Z-axes respectively. Using Maya: Animation
219
Character Animation
By default, the orientation of a joint’s local axis is xyz. In this orientation, the positive X-axis points in the same direction as the joint’s wedge-shaped bone. That is, the X-axis points towards the center of the joint’s child joint. If the joint has more than one child joint, the X-axis points at the child joint that was created first. The Z-axis points sideways from the joint and its bone connecting the child joint, and the Y-axis points at right angles to the X-axis and Z-axis. All three axes are aligned according to the right hand rule.
Building Skeletons Editing joint attributes
Editing scale compensation When you scale the size of a joint, you can either scale the child joints also or prevent the scaling of the child joints. For example, if you increase the length of a lower arm bone by scaling the elbow joint, the wrist joint and its bones can either increase in size also or stay the same size. Either you can scale the hand as well as the lower arm or you can just scale the lower arm. Normally, when you scale a joint Maya will scale everything below it in the skeleton’s action hierarchy. However, by setting a joint’s Scale Compensate option on, you can prevent that joint and everything below it in the action hierarchy from being scaled when the joint’s parent joint is scaled. Additionally, expert users like to have Scale Compensate on to prevent inappropriate shearing deformation effects on a character’s skin. Shearing can occur when a given joint is scaled only along one or two of its axes.
To edit a joint’s scale compensation: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Toggle Segment Scale Compensate. Turn on Segment Scale Compensate so that this joint will compensate for scale factors applied to its parent. If the parent is scaled, this joint’s translation values will be scaled but the scale will not apply to any of this joint’s children.
Editing joint limits You can restrict a joint to a certain range of motion so that it cannot rotate beyond the angles you set as limits. You set these limits in the Limit Information panel of the Attribute Editor for joints. Expert users have found that it is best to not set joint minimum and maximum limits extremely close (±5 degrees or less). These restrictive limits can sometimes cause joints to get stuck during rotation.
To edit joint limits:
220
1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
Using Maya: Animation
Building Skeletons Editing joint attributes 3
Toggle on the boxes by the Min and Max limits of any value you want to change. For example, to set minimum and maximum limits for rotation in X, click the boxes to the left and right of Rot Limit X.
4
In the Limit X, Y, and Z fields under Translate, Rotate, and Scale, enter the angles between which you want to limit the joint’s motion.
Character Animation
Using Maya: Animation
221
Building Skeletons Editing joint attributes
Range of motion if the Z-axis rotation limits are set to -15, 45
Range of motion if the X-axis rotation limits are set to -45, 90
Restricting joint rotation with the Limits attributes
222
Using Maya: Animation
Building Skeletons Editing joint attributes
Dampening rotation near joint limits For most living creatures, when a joint rotates as far as it can, it tends to slow down or “dampen” before reaching its limit. For example, an elbow does not snap straight, but gradually slows down as the lower arm aligns with the upper arm. In animation terminology, the effect is that of an “ease-in.” Joint dampening applies resistance to a joint as it approaches its joint limits. Instead of the joint abruptly stopping when it reaches its limits, you can use damping to slow it down smoothly. Depending on the strength and range you set, a joint with dampening will not reach its limit boundary, unless forced.
Two settings in the Attribute Editor control a joint’s dampening: Damp Range and Damp Strength. •
Minimum and Maximum Rotate Damp Range set the number of degrees inside the joint limits at which resistance begins to occur.
•
Minimum and Maximum Rotate Damp Strength set the amount of resistance in the damp range.
Using Maya: Animation
223
Character Animation
The dampening factor for joints affects only the solution computed by an IK solver; it does not affect joints that are animated by other means.
Building Skeletons Editing joint attributes
Maximum damp range
Minimum damp range Maximum damp strength affects this area
Maximum damp strength affects this area
Maximum Zaxis joint limit (45)
Minimum Zaxis joint limit (-15)
Damping the limits of a right wrist joint in the Z-axis
To dampen rotation near joint limits: 1
Select the joint.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Use the Min and Max Rotate Damp Range and Rotate Damp Strength fields to set the joint dampening attributes. The Rotate Damp Range values let you set the angles inside the minimum and maximum joint limits. The Rotate Damp Strength of the resistance can range from 0, which takes the joint all the way to its limit with no resistance, to 100, which stops the joint at the outer edge of the damp range. The values are relative within the IK handle’s joint chain.
224
Using Maya: Animation
12
Posing and Animating Skeletons After you’ve created a skeleton for your character, you skin the skeleton by binding the geometry to the skeleton. You can then create flexors for further skin deformation effects. Animating the character includes animating the skeleton and animating the effects provided by the flexors. Character Animation
This chapter describes posing and animating skeletons. Posing and animating skeletons includes the following: •
“Understanding posing and animating skeletons” on page 226
•
“Creating IK handles” on page 238
•
“Setting IK handle creation options” on page 241
•
“Editing IK handle attributes” on page 246
•
“Editing IK solvers” on page 253
•
“Using IK systems” on page 254
•
“Posing IK chains” on page 256 Using Maya: Animation
225
Posing and Animating Skeletons Understanding posing and animating skeletons •
“Using IK spline handles” on page 259
•
“Animating IK chains” on page 280
Understanding posing and animating skeletons When you pose and animate a skeleton, you are specifying the skeleton’s motion. The term for the specification of motion is kinematics. Posing and animating skeletons involves two types of kinematics: forward kinematics and inverse kinematics. Although the terms sound complicated, what they refer to is easy to understand. Forward kinematics is ideal for creating detailed arc motions because it requires the direct specification of each joint rotation. Inverse kinematics is ideal for creating goal-directed motion because it only requires the specification of a position and orientation that the joints in a joint chain will rotate to reach.
Forward kinematics In forward kinematics, when you pose a joint chain you rotate each joint individually. For example, if you want a joint chain to reach for a particular location in space, you have to rotate each joint individually so that the joint chain can reach the location. To do this, you would rotate the joint chain’s parent joint, then the next joint, and so on down the joint chain. When you animate a skeleton posed with forward kinematics, Maya interpolates the joint rotations starting with the root joint, then the root’s child joints, and so on down through the skeleton’s action hierarchy. Maya proceeds “forward” through the action hierarchy, starting at the root joint. Posing and animating skeletons with forward kinematics is an excellent approach for specifying detailed arc motions, but it can take a fair amount of time if you are animating a large, complicated skeleton. Also, forward kinematics is often not very intuitive for specifying goal-directed motion. When you think about moving your hand to some location in space, you don’t normally think about how you are going to rotate all the joints in your arm. The following sequence of five images illustrates the steps required to extend a W-shaped joint chain with forward kinematics posing.
226
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Character Animation
Forward kinematics posing: joint chain’s root joint selected
Forward kinematics posing: root joint rotation
Forward kinematics posing: subsequent joint rotation
Using Maya: Animation
227
Posing and Animating Skeletons Understanding posing and animating skeletons
Forward kinematics posing: subsequent joint rotation
Forward kinematics posing: joint chain extended
Posing and animating with forward kinematics To pose a skeleton with forward kinematics, you move, rotate, or scale joints directly. You can do this in the same way that you move, rotate, or scale other objects in Maya. For example, you can use the move, rotate, and scale transform tools in the minibar. Alternatively, you could move, rotate, and scale joints by using the Channel Box. To animate a skeleton with forward kinematics, you can save keys in selected frames as described in Using Maya: Animation, Keyframe. If you would like to use motion capture data to drive the character animation, see Using Maya: Animation, Motion Capture. This chapter focuses on posing and animating with Maya’s inverse kinematics tools.
228
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Inverse kinematics (IK) In inverse kinematics (IK), you can pose a joint chain based on a location in space you want the joint chain to reach. Inverse kinematics is more intuitive for goal-directed motion than forward kinematics because you can focus on the goal you want a joint chain to reach without worrying about how each joint will have to rotate. However, unlike forward kinematics, inverse kinematics requires that you use special tools for posing and animating. These tools are called IK handles and IK solvers.
The IK solver is the motor intelligence behind the IK handle. For example, if you want a joint chain to reach a particular location in space, you can move the entire chain by using the IK handle that runs through the chain. Given where you want the joint chain to reach, the IK solver figures out how to rotate all the joints in the joint chain for you by means of Maya’s inverse kinematics methods. The following sequence of two images illustrates the steps required to extend a W-shaped joint chain with inverse kinematics posing.
Inverse kinematics posing: IK handle selected
Using Maya: Animation
229
Character Animation
An IK handle is like a wire that can run through a joint chain, providing a way for you to pose the entire joint chain in one action. As you pose and animate the joint chain with the IK handle, the IK handle automatically figures out how to rotate all the joints in the joint chain by using its IK solver.
Posing and Animating Skeletons Understanding posing and animating skeletons
Inverse kinematics posing: joint chain extended
Posing and animating with inverse kinematics (IK) To pose and animate joint chains with inverse kinematics, you use IK handles. The motor intelligence of an IK handle is provided by an IK solver.
IK handles and IK chains An IK handle runs through a selected joint chain like a wire, providing you with a way to move the entire joint chain. The joint the IK handle starts at is called the start joint. The last joint in the joint chain controlled by the IK handle is called the end joint. The start joint could be the skeleton’s root joint, or any joint in the skeleton’s action hierarchy above the end joint. The IK handle can pose all the joints in the chain, from the start joint to the end joint. A joint chain that has an IK handle is called an IK chain. IK chains are easy to use. However, some background on how they work can help you get the most out of posing and animating with inverse kinematics. The end of the IK handle, which is located at the end joint by default, is called the end effector. The reason the end of the IK handle is called the “end effector” is because it helps to bring about how the IK handle rotates the joints in the joint chain so that the end of the chain can reach some location in space. By telling the IK handle’s IK solver where the end of the IK handle is, the end effector provides information the IK solver needs to figure out how to rotate all the joints for you.
230
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons When you are posing and animating an IK chain, you also need to tell the IK solver the position and orientation in space where you would like the end effector to move to next. That information is provided by the IK handle’s goal. When you interactively pose an IK chain, what you are really doing is moving the IK handle’s goal. The IK solver looks at where the goal is, looks at where the end effector is, and figures out how to rotate all the joints in the IK chain to get the end effector to be where the goal is.
IK solvers IK solvers provide the motor intelligence of IK handles. IK solvers figure out how to rotate all the joints in a joint chain controlled by an IK handle. Maya offers four types of solvers: •
Single chain (SC) solver
•
Rotate plane (RP) solver
•
Spline solver
•
Multi-chain (MC) solver
Single chain (SC) solver The single chain (SC) solver is ideal for posing and animating the IK chains for a character’s limbs, such as arms and legs. The single chain solver provides a straightforward mechanism for posing and animating a chain anywhere the joint chain can reach in the scene’s world space. The joint chain will tend to stay within the plane that best includes all the joint chain’s joints. An IK handle using a single chain is displayed as follows:
Using Maya: Animation
231
Character Animation
A skeleton can have as many IK handles as you think you need for posing and animating its joint chains. However, be sure you are happy with which joint is the skeleton’s root joint before you begin creating IK handles. The skeleton’s root must not be between an IK chain’s start joint and end joint. You cannot create an IK chain that includes the root joint unless that joint is the start joint. Also, if you change which joint is the root joint, you will invalidate IK chains that include the new root joint unless the joint is the start joint of an IK chain.
Posing and Animating Skeletons Understanding posing and animating skeletons
Handle vector End joint
Start joint
Goal
Handle wire End effector
IK handle using single chain solver
Start joint The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle. The start joint could be the skeleton’s root joint or any other joint in the skeleton’s action hierarchy above the end joint.
End joint The end joint is the last joint in the joint chain controlled by the IK handle. The end joint must be below the start joint in the skeleton’s action hierarchy.
Handle wire The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle.The handle wire begins at the start joint’s local axis and by default ends at the end joint’s local axis.
End effector The end effector is the end of the IK handle. By default, the end effector is located at the end joint’s local axis. However, the end effector can be offset from the end joint. The end effector does not move from its location at the end joint (or at some offset from the end joint) during posing and animating. Also, note that the end effector is parented to the parent joint of the end joint, not to the end joint.
232
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Goal The goal indicates where you want an IK handle’s end effector to be. The goal, which is indicated by an axis, rests at the IK handle’s end effector. During posing, you can move the goal to any location in the scene’s world space. The IK handle’s end effector tries to keep up with the goal at all times. The IK handle’s single chain (SC) solver figures out how the end effector can have the same position and orientation as the goal’s position and orientation. The single chain (SC) solver figures out how to rotate the joint chain’s joints so that the end effector can reach the goal. However, depending on the rotational limits and fully extended length of the joint chain, the end effector might not be able to reach the goal’s current position and orientation.
The handle vector is the line drawn from the start joint to the IK handle’s end effector. The end effector is normally located at the IK chain’s end joint. The purpose of the handle vector is to indicate at which joints the IK handle starts and ends. Because of the handle vector’s similarity to what some systems call a limb axis, some expert users refer to the handle vector as the limb axis.
Single chain solver behavior The single chain solver first looks at the position (the translate X, Y, and Z attributes) and orientation (the rotate X, Y, and Z attributes) of the goal. Next, the solver figures out how to move the position and orientation of the end effector as close to the goal’s position and orientation as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. Expert users have found that single chain solver IK chains that consist of between two and four joints are the easiest to pose. Extremely long IK chains can become awkward to pose and animate. Note that the joint chain controlled by an IK handle using a single chain solver cannot have any other IK handles running through any of its joints.
Rotate plane (RP) solver Like the single chain (SC) solver, the rotate plane (RP) solver is ideal for posing IK chains for a character’s limbs such as arms and legs. However, the rotate plane solver offers more manipulator tools for posing the chain than does the single chain solver. Also, the rotate plane solver is ideal for IK
Using Maya: Animation
233
Character Animation
Handle vector
Posing and Animating Skeletons Understanding posing and animating skeletons chains that you would like to stay in more or less the same plane, even though that plane can rotate. For example, the shoulder, elbow, and wrist joints of an arm all stay within the same plane, but that plane rotates as the shoulder joint rotates. An IK handle using a rotate plane solver is displayed as follows:
Pole vector axis
Twist disc Plane indicator
Goal Handle vector
Pole vector Handle wire End joint Rotate disc Start joint
IK handle using rotate plane solver
Start joint The start joint is where the IK handle begins. The start joint is the first joint in the joint chain that is influenced by the IK handle.The start joint could be the skeleton’s root joint, or any other joint in the skeleton’s action hierarchy above the end joint.
End joint The end joint is the last joint in the joint chain controlled by the IK handle.The end joint must be below the start joint in the skeleton’s action hierarchy.
Handle wire The handle wire is the line that runs through all the joints and bones in a joint chain controlled by the IK handle. The handle wire begins at the start joint’s local axis and by default ends at the end joint’s local axis.
234
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
End effector The end effector is the end of the IK handle. By default, the end effector is located at the end joint’s local axis. However, the end effector can be offset from the end joint. The end effector does not move from its location at the end joint (or at some offset from the end joint) during posing and animating. Also, note that the end effector is parented to the parent joint of the end joint, not to the end joint. You can use the Hypergraph to view the relationships between the end effector and the joints in the joint chain.
Goal
Handle vector The handle vector is the line drawn from the start joint to the IK handle’s end effector. The end effector is normally located at the IK chain’s end joint. Because of the handle vector’s similarity to what some systems call a limb axis, some expert users refer to the handle vector as the limb axis.
Joint chain plane The joint chain plane is the plane that would best contain all the joints in the joint chain. By always containing the joints in the joint chain, the joint chain plane controls how the joint chain can twist. The joint chain plane is not displayed because you can infer it from where the joint chain’s joints are located. However, the joint chain plane’s orientation is indicated by the plane indicator displayed in the rotation disc. The joint chain plane can rotate about the handle vector. Rotating the joint chain plane about the handle vector has the effect of twisting the joint chain. (The degree of twist is measured relative to the reference plane, which is the plane defined by the handle vector and the pole vector.)
Using Maya: Animation
235
Character Animation
The goal indicates where you want an IK handle’s end effector to be. The goal, which is indicated by an axis, rests at the IK handle’s end effector. During posing, you can move the goal to any location in the scene’s world space. The IK handle’s end effector tries to keep up with the goal at all times. The IK handle’s rotate plane (RP) solver figures out how the end effector can have the same position as the goal’s position. The rotate plane (RP) solver figures out how to rotate the joint chain’s joints so that the end effector can reach the goal. However, depending on the rotational limits and fully extended length of the joint chain, the end effector might not be able to reach the goal’s current location.
Posing and Animating Skeletons Understanding posing and animating skeletons
Rotation disc The rotation disc is located at the start joint. The rotation disc indicates how the joint chain plane can rotate, which twists the joint chain. An indicator in the rotation disc, called the plane indicator, shows the orientation of the joint chain plane.
Twist disc The twist disc is located at the end joint. You can use the twist disc as a tool to twist the joint chain by rotating the joint chain plane.
Plane indicator The plane indicator indicates the orientation of the joint chain plane, which is the degree of twist in the joint chain relative to the reference plane. The plane indicator can be thought of as the reflection of the joint chain plane in the rotation disc.
Reference plane For the joint chain plane to rotate and twist the joint chain, the plane must rotate relative to some other plane so that the degree of twist can be measured. The plane that the joint chain plane rotates relative to is the reference plane. The difference between the two planes indicates the amount the joint chain twists. The reference plane is defined by the handle vector and the pole vector.
Pole vector Like the handle vector, the pole vector starts at the start joint. Unlike the handle vector, which always ends at its IK handle’s end effector, the pole vector can end anywhere you want it to end. The purpose of the pole vector is to help define the reference plane. During posing, you can sometimes move the end effector through the reference plane, which moves the handle vector through the reference plane. When that happens, the handle vector and pole vector can appear to cross as the joint chain suddenly flips because the degree of twist suddenly changes by 180 degrees. Because the reference plane is defined by the handle vector and the pole vector, you can prevent the flipping effect by simply moving the end of the pole vector to redefine the reference plane.
236
Using Maya: Animation
Posing and Animating Skeletons Understanding posing and animating skeletons
Rotate plane solver behavior The rotate plane solver first looks at the position (the translate x, y, and z attributes) of the goal. Next, the solver figures out how to move the position of the end effector as close to the goal’s position as possible. To do that, the solver figures out how to best rotate the joints in the IK handle’s joint chain. Unlike the single chain solver, the rotate plane solver does not look at the orientation (the rotate x, y, and z attributes) of the goal. That is, the rotate plane solver figures out how to rotate the joints based on the goal’s position, but not on the goal’s orientation. The orientation of the entire joint chain can be controlled by twisting the joint chain with the twist disc. However, unlike the single chain solver, you cannot rotate the joint chain by rotating the IK handle’s goal.
Note that the joint chain controlled by an IK handle using a rotate plane solver cannot have any other IK handles running through any of its joints.
Spline solver The IK spline solver lets you manipulate a long, flexible joint chain that conforms to the shape of a curve. This solver is useful for animating the motion of tails, spines, tentacles, snakes, long necks, and similar objects. Expert users have found that spline solver IK chains that include ten or more joints with relatively short bones are ideal. For information on using IK handles with the spline solver, please see “Using IK spline handles” on page 259.
Multi-chain (MC) solver The multi-chain (MC) solver is ideal for IK chains that can be posed and animated by more than one IK handle. In such a case, each IK handle should use the multi-chain solver. For information on using the multi-chain (MC) solver, please see “Activating the multi-chain (MC) solver” on page 243.
Using Maya: Animation
237
Character Animation
Expert users have found that rotate plane solver IK chains that consist of between two and four joints are the easiest to pose. Extremely long IK chains can become awkward to pose and animate.
Posing and Animating Skeletons Creating IK handles
Creating IK handles IK handles are tools that help you pose and animate joint chains with inverse kinematics. You can create an IK handle for almost any joint chain. A joint chain that has an IK handle is called an IK chain. In any IK chain, the joint where the IK handle starts should be closer to the skeleton’s root joint than the joint where the IK handle ends. Also, an IK chain should not include the root joint unless the root joint is the start joint. You use the IK Handle Tool to create IK handles. You can set certain IK Handle attributes during IK handle creation from the IK Handle Tool’s Tool Settings window. After you create the IK handles, you can edit IK handle attributes by using the Attributes Editor. Note that you can also use Maya Embedded Language (MEL) commands to create and edit IK handles. Some expert users like to define hotkeys based on MEL commands for quickly creating customized joint chains and IK handles. During inverse kinematics posing and animating, the rotations of all the joints in the IK chain are calculated, or “solved,” by an IK solver. Note that IK handles using the single chain (SC), rotate plane (RP), and spline solvers require that the joint chains they control be solved only by them. For example, two IK handles using one of the single chain (SC), rotate plane (RP), or spline solvers cannot overlap, allowing both to solve some of the same joints. Expert users have found that IK chains that consist of between two and four joints are the easiest to pose and animate. Extremely long IK chains can become awkward. In creating IK handles, you can add IK handles to existing joint chains, or you can create IK chains (joint chains with IK handles).
Adding an IK handle You can create an IK handle for any joint chain.
To create an IK handle: 1
Select Skeletons→IK Handle Tool.
2
To change the tool options, select Skeletons→IK Handle Tool-❐ to open the IK Handle Tool Options window. See “Editing IK handle attributes” on page 246 for a description of the IK Handle Tool options.
238
Using Maya: Animation
Posing and Animating Skeletons Creating IK handles 3
With the left mouse button, click the start joint and end joint for the IK handle. You can click the joints in either order: the IK handle is created with the end effector on the child joint.
Creating an IK chain An IK chain is a joint chain that has an IK handle. You can create IK chains in the same way that you create joint chains, but you must set the Joint Tool’s Create IK Handle option.
To create an IK chain: Select Skeletons→Joint Tool-❐ to open the Joint Tool’s Tool Settings window.
2
Toggle on the Create IK Handle option. You can set IK handle options within the IK Handle Options heading. Click the triangle on the heading line to view the options. For information on IK Handle options, see “Editing IK handle attributes” on page 246.
3
Create the joint chain as you would any skeleton. First, Click in the workspace at the position of the first joint. The joint is created.
4
Move the pointer to the position you want the second joint to be and click again. The two joints are connected with a bone that indicates the direction of the joint chain’s hierarchy: the thinner end of the bone’s triangle points to the child joint. See “Positioning joints” on page 196 for tips on editing the positions of joints.
5
Continue moving the pointer and clicking until you have created the chain of joints for the skeleton.
6
When you finish creating all joints in the chain, press the Enter key. Ending the joint chain creates the IK handle. You can edit the IK handle in the Attribute Editor to change its attributes.
Using Maya: Animation
239
Character Animation
1
Posing and Animating Skeletons Creating IK handles
Displaying IK handle’s end effector A marker that identifies an IK handle’s end effector is not displayed by default when you create an IK handle. However, if you would like to see the end effector, you can tell Maya to display it.
To display end effector: 1
Choose Window→Hypergraph to open the Hypergraph.
2
In the Hypergraph, select the IK handle’s end effector.
3
With the end effector selected, continue to press the right mouse button, and from the pull-down menu, select Show. An axis-shaped icon indicates the end effector.
Displaying IK handle’s goal and goal’s axis Markers that identify an IK handle’s goal and the local axis of the goal are not displayed by default when you create an IK handle. However, you can tell Maya to display them after you create the IK handle.
To display goal and goal’s axis: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Display if not opened.
4
In Display, click Display Handle on to display the IK handle’s goal.
5
In Display, click Display Local Axis to display the axis of the IK handle’s goal.
Displaying IK handle’s twist disc and pole vector’s axis An IK handle using the default rotate plane (RP) solver has two manipulators that are not displayed by default when you create an IK handle. These manipulators are the twist disc and the pole vector’s axis.
To display twist disc and pole vector’s axis:
240
1
Select the IK handle.
2
Click the Show Manipulator Tool icon.
Using Maya: Animation
Posing and Animating Skeletons Setting IK handle creation options If the IK handle uses the default rotate plane (RP) solver, the twist disc is displayed at the IK chain’s end joint. Also, the pole vector’s axis is displayed. If the IK handle uses the single chain (SC) solver, no additional manipulators are displayed.
Setting IK handle creation options
Setting automatic IK handle attributes includes: •
“Viewing IK handle creation options” on page 241
•
“Setting the current solver” on page 242
•
“Setting autopriority” on page 243
•
“Setting solver enable” on page 244
•
“Setting snap enable” on page 244
•
“Setting sticky” on page 244
•
“Setting priority” on page 245
•
“Setting weight” on page 245
•
“Setting position vs. orientation (PO) weight” on page 246
Viewing IK handle creation options The IK handle creation options can be set from the IK Handle Tool’s Tool Settings window. When you create an IK handle, you use the IK Handle Tool. You can set the IK Handle Tool’s settings so that certain IK handle attributes will be set automatically.
Using Maya: Animation
241
Character Animation
You can have the various options and attributes of IK handles set automatically when you create the IK handle, or you can edit the IK handle’s attributes at any time. This section describes how to set IK handle creation options. To edit attributes after you create an IK handle chain, see “Editing IK handle attributes” on page 246.
Posing and Animating Skeletons Setting IK handle creation options
The IK Handle Tool’s Tool Settings window
To view automatically set IK handle attributes: Select Skeletons→IK Handle Tool-❐. The IK Handle Tool’s Tool Settings window is displayed.
Setting the current solver You can have either the single chain solver or the rotate plane solver set as the current solver automatically provided when you create an IK handle.
To set the current solver: 1
242
Select Skeletons→IK Handle Tool-❐.
Using Maya: Animation
Posing and Animating Skeletons Setting IK handle creation options 2
From the Current Solver pop-up menu, select either ikRPsolver or ikSCsolver. The rotate plane (RP) solver (called the ikRPsolver) is the default solver. The other solver you can select here is the single chain solver (called the ikSCsolver). Depending on the plug-ins you are using, other solvers may be available. To use the spline solver, you must work directly with the IK Spline Handle Tool (Skeletons→IK Spline Handle Tool). You can select the multi-chain (MC) solver if it has already been activated.
The multi-chain (MC) solver is only available through the use of a Maya Embedded Language (MEL) command. Once you enter the command, you can choose the multi-chain solver from the IK Handle Tool’s Tool Settings window.
To activate the multi-chain solver: 1
Choose Window→General Editors→Command Shell...
2
In the Command Shell, enter the following command at the mel: prompt: createNode ikMCsolver. Now you can choose the multi-chain (MC) solver in the IK Handle Tool’s Tool Settings window.
Setting autopriority You can control the order in which IK chains are solved by having Maya automatically set their priority based on where the start joints are in the skeleton’s action hierarchy. When Maya automatically sets priority, IK chains whose start joint is the skeleton’s root joint have a priority of 1. IK chains whose start joints are child joints of the root joint have a priority of 2, and so on down the skeleton’s action hierarchy. The further an IK chain’s start joint is from the root joint, the lower its priority.
To set autopriority: 1
Select Skeletons→IK Handle Tool-❐.
2
Click Autopriority on or off. If off, all IK handles are given a priority of 1.
Using Maya: Animation
243
Character Animation
Activating the multi-chain (MC) solver
Posing and Animating Skeletons Setting IK handle creation options
Setting solver enable After you create an IK handle for a joint chain, you can immediately begin posing the new IK chain with inverse kinematics. However, if you would like to pose with forward kinematics, you can temporarily turn off the IK handle’s IK solver.
To set solver enable: 1
Select Skeletons→IK Handle Tool-❐.
2
Click Solver Enable off or on (the default is on).
Setting snap enable During posing, an IK handle’s goal can exceed the reach of the IK chain. Maya will show you this by continuing to draw a line between the end effector, which is located at the IK chain’s end joint by default, and the goal. When you release the mouse button, the goal will snap back to the IK handle’s end effector by default. If you prefer, you can have the goal remain wherever you have moved it last, rather than have it snap back to the end effector. Whether the goal snaps back or remains in its last location is largely a matter of personal preference. At times some expert users like to see where the goal is after it has exceeded the reach of the IK chain so they can make adjustments more easily to the overall position of the entire skeleton.
To set snap enable: 1
Select Skeletons→IK Handle Tool-❐.
2
Click Snap Enable off or on (the default is on).
Setting sticky You can have an IK handle’s goal stick to any location in the scene. When you move the start joint of the IK chain, or even the entire skeleton, the end joint of the IK chain with a sticky IK handle will stick to its location while the IK solver provides the appropriate joint rotations. For example, if you are animating a human character that is reaching up or out while standing in place, you can animate the natural articulation of the legs much more easily by making the IK handles that end at the character’s feet sticky.
To set sticky: 1
244
Select Skeletons→IK Handle Tool-❐.
Using Maya: Animation
Posing and Animating Skeletons Setting IK handle creation options 2
Click Sticky on or off.
Setting priority You can control the order in which a skeleton’s various IK handles calculate joint chain action during animation. Each IK handle can be assigned a priority. IK handles with a priority of 1 will be solved first, IK handles with a priority of 2 will be solved second, and so on. Maya can set these priorities for you based on where an IK handle’s start joint is in a skeleton’s action hierarchy, or you can give all IK handles a priority of 1. Having varied priorities for IK handles can improve overall inverse kinematics performance. Character Animation
To set priority: 1
Select Skeletons→IK Handle Tool-❐.
2
Slide Priority value to desired setting. Highest priority is 1.
Setting weight During animation, a skeleton with many IK chains can perform a wide variety of motions. Because of the specific ways the motions of IK chains can affect the overall position and orientation of the character’s skeleton, not all the end effectors may be able to reach their goals simulaneously. Consequently, some of the interpolated IK chain motions might not provide the effects you wish. For example, on a given limb with two IK chains that have the same priority, neither of the two IK chains might be able to reach their goals because they are pulling the limb in different directions. You can alleviate this situation by assigning the IK handles of those IK chains a weight. The assigned weight, combined with the current distance between an IK handle’s end effector and its goal, serve to prioritize the solutions of IK chains whose IK handles have the same priority settings. When the end effectors of two or more IK handles with the same priority cannot reach their goals simultaneously, the IK handles whose end effectors are furthest from their goals and whose weights are greatest will be solved first.
To set weight: 1
Select Skeletons→IK Handle Tool-❐. Using Maya: Animation
245
Posing and Animating Skeletons Editing IK handle attributes 2
Slide Weight value to desired setting (must be 0 or greater).
Setting position vs. orientation (PO) weight During animation, an IK handle’s end effector might be able to reach the goal’s position or the goal’s orientation, but not both. You can control the extent to which the end effector can reach the goal’s position versus the goal’s orientation by setting the position vs. orientation (PO) weight. The value of the PO weight ranges between 0 and 1. With a PO weight of 1, the end effector will seek to reach only the goal’s position. With a PO weight of 0, the end effector will seek to reach only the goal’s orientation. With a PO weight of 0.7, the end effector will seek to reach the goal’s position more than the orientation. Finally, with a PO weight of 0.5, the end effector will try to reach the goal’s position and orientation as equally as possible. Note that IK handles using the rotate plane (RP) solver do not consider the orientation of the goals, only the position. With IK chains being solved by the RP solver, you control IK chain orientation by means of the twist disc.
To set position vs. orientation (PO) weight: 1
Select Skeletons→IK Handle Tool-❐.
2
Slide POWeight value to desired setting.
Editing IK handle attributes You can edit the attributes of an IK handle at any time by using the Attribute Editor. This section describes how to use the Attribute Editor to edit an IK handle’s attributes. Editing IK handle attributes includes:
246
•
“Viewing editable IK handle attributes” on page 247
•
“Renaming an IK handle” on page 249
•
“Editing transform attributes” on page 249
•
“Editing skeleton info” on page 250
•
“Editing IK handle attributes” on page 250
•
“Editing IK solver attributes and choosing an IK solver” on page 251
•
“Editing pivots” on page 251
•
“Editing limit information” on page 252
Using Maya: Animation
Posing and Animating Skeletons Editing IK handle attributes •
“Editing display” on page 252
•
“Editing node behavior” on page 253 Note that you can access settings for an IK handle’s attributes, and also the Attribute Editor, by pressing the right mouse button while the cursor is on the IK handle you want to edit.
Viewing editable IK handle attributes To view or edit an IK handle’s attributes, use the Attribute Editor.
Character Animation
Using Maya: Animation
247
Posing and Animating Skeletons Editing IK handle attributes
Attribute Editor for IK handles
248
Using Maya: Animation
Posing and Animating Skeletons Editing IK handle attributes
To view editable joint attributes: Choose Window→Attribute Editor to open the Attribute Editor. The Attribute Editor is displayed.
Renaming an IK handle
To rename an IK handle: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Enter the new name in the ikHandle: field. The new name takes effect immediately.
Editing transform attributes An IK handle’s transform attributes include the following: •
Translate, rotate, scale, and shear transformations
•
Rotate order
•
Rotate axis
•
Inherits transform option
To edit transform attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Transform Attributes if not opened.
Using Maya: Animation
249
Character Animation
Maya names IK handles for you when you create them. By default, IK handles are numbered consecutively as you create them. For example, the first handle would be called “ikHandle1,” the second “ikHandle2,” and so on. You can rename the IK handles to better reflect their purpose in posing and animating your character. It’s a good idea to give IK handles meaningful names so that they are easier to select when you are working with Maya’s editors, using the Hypergraph, or using the Outliner. For example, you could name an IK handle that goes from a right shoulder joint to a right wrist joint “RShtoWrist.”
Posing and Animating Skeletons Editing IK handle attributes 4
In Transform Attributes, you can make changes to the translate, rotate, scale, and shear transformations. You can set the rotate order, which is by default set to xyz. You can change the location of the rotate axis, which is by default set to 0.0, 0.0, 0.0. Finally, you can toggle whether or not the IK handle inherits transformations.
Editing skeleton info An IK handle’s skeleton info include the following: •
Start joint
•
End effector
To edit skeleton info: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Skeleton Info if not opened.
4
In Skeleton Info, note that the names of the IK handle’s start joint and end effector are displayed. You can edit either of these by clicking on the right arrow buttons next to their names.
Editing IK handle attributes An IK handle’s handle attributes include the following: •
Snap enable
•
Stickiness
•
Priority
•
Weight
•
Position vs. orientation (PO) weight
To edit IK handle attributes:
250
1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open IK Handle Attributes if not opened.
4
In IK Handle Attributes, you can edit snap enable, stickiness, priority, weight, and position vs. orientation (PO) weight.
Using Maya: Animation
Posing and Animating Skeletons Editing IK handle attributes
Editing IK solver attributes and choosing an IK solver An IK handle’s solver attributes include the following: •
Solver enable
•
IK solver selection (single chain solver, rotate plane solver, or the multichain solver if activated)
•
Pole vector’s end location
•
Twist
To edit solver attributes and choose IK solver: Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open IK Solver Attributes if not opened. In IK Solver Attributes, you can choose the IK solver, snap enable, stickiness, priority, weight, and position vs. orientation (PO) weight.
4
In IK solver, choose the IK solver you want to assign to the IK handle. By default, only two IK solvers are offered here: the single chain solver (ikSCsolver) and the rotate plane solver (ikRPsolver), which is the default IK solver. To use the spline solver, you must work directly with the IK Spline Handle Tool (Skeletons→IK Spline Handle Tool).
Editing pivots An IK handle’s pivots attributes include the following: •
Display rotate pivot toggle
•
Display scale pivot toggle
•
Local space rotate pivot and scale pivot
•
World space rotate pivot and scale pivot
To edit pivots attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Pivots if not opened. Using Maya: Animation
251
Character Animation
1
Posing and Animating Skeletons Editing IK handle attributes 4
In Pivots, you can edit the display rotate pivot toggle and the display scale pivot toggle. Also, you can edit the coordinates for the local space pivot’s rotate and scale transformations and the world space pivot’s rotate and scale transformations.
Editing limit information An IK handle’s limit information attributes include the following: •
Translation transformation limits
•
Rotation transformation limits
•
Scale transformation limits
To edit limit information attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Limit Information if not opened. Below it you can open Translate, Rotate, and Scale.
4
In Translate, Rotate, or Scale, edit the minimum, current, and maximum transformation limits.
Editing display An IK handle’s display attributes include the following: •
Display handle
•
Display local axis
•
Select handle
•
Show manipulator default
•
Visibility
•
Template
To edit display attributes:
252
1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Display if not opened.
Using Maya: Animation
Posing and Animating Skeletons Editing IK solvers 4
In Display, toggle the Display Handle and Display Local Axis settings. Edit the coordinates of the Select Handle location. Select Show Manip Default as None, Translate, Rotate, or Scale. Check Visibility on or off, and check Template on or off.
Editing node behavior Maya’s system thinks of all its entities, including IK handles, as nodes. An IK handle’s node behavior attributes include the following: •
Caching
•
Node state Character Animation
To edit node behavior attributes: 1
Select the IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Node Behavior if not opened.
4
In Node Behavior, check Caching on or off. Select Node State as Normal, HasNoEffect, or Blocking.
Editing IK solvers You can edit the settings of the IK solvers from the Attribute Editor. By default, Maya names the single chain solver the “ikSCsolver” and the rotate plane solver the “ikRPsolver.” Editing IK solver settings includes: •
Editing IK solver attributes: maximum iterations and tolerance
•
Editing node behavior
Editing IK solver attributes An IK solver’s attributes include the following: •
Maximum iterations
•
Tolerance
To edit solver attributes: 1
Select the IK solver.
2
Choose Window→Attribute Editor to open the Attribute Editor. Using Maya: Animation
253
Posing and Animating Skeletons Using IK systems 3
Open IK Solver Attributes if not opened.
4
In IK Solver Attributes, edit the Max Iterations setting and the Tolerance setting.
Editing node behavior Maya’s system thinks of all its entities, including IK solvers, as nodes. An IK solver’s node behavior attributes include the following: •
Caching
•
Node state
To edit node behavior attributes: 1
Select the IK solver.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Node Behavior if not opened.
4
In Node Behavior, check Caching on or off. Select Node State as Normal, HasNoEffect, or Blocking.
Using IK systems An IK system can organize and manage a collection of IK solvers.
Creating an IK system To create an IK system: 1
Choose Window→Attribute Editor to open the Attribute Editor.
2
Choose List→Auto Update, clicking auto update off (not checked).
3
Choose List→Kinematics→IK Systems.
4
Choose Object→ikSystem. The Attribute Editor will now show information about an IK system whose default name is “ikSystem.” You can change the name by typing in a new name in the ikSystem: field.
254
Using Maya: Animation
Posing and Animating Skeletons Using IK systems
Accessing an IK system To access an IK system: 1
Select an IK handle.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
In the Attribute Editor, click on Set Focus. The Attribute Editor will now display information about the IK system.
Renaming an IK system You can rename an IK system.
1
Access the IK system with the Attribute Editor.
2
In the ikSystem: field, replace the current name with the name you would like to use.
Viewing an IK system’s IK solvers You can view and select the IK solvers Maya provides from the IK system.
To view available IK solvers: 1
Access the IK system with the Attribute Editor.
2
Open ikSystem if not opened. The available IK are listed. By default, three IK solvers are listed: the single chain (SC) solver (default name: ikSCsolver), the rotate plane solver (default name ikRPsolver), and the spline solver (default name: ikSplineSolver). You can select and edit the solvers by double-clicking on the names in the list. When you double-click, Maya creates folders for the selected solvers in the Attribute Editor.
Editing global snap and global solve You can edit the global snap and global solve settings.
To edit global snap and solve settings: 1
Access the IK system with the Attribute Editor. Using Maya: Animation
255
Character Animation
To rename an IK system:
Posing and Animating Skeletons Posing IK chains 2
Open ikSystem if not opened. Note the Global Snap and Global Solve check boxes below the listing of available IK solvers.
3
Click the Global Snap and Global Solve settings on or off.
Editing node behavior Maya’s system thinks of all its entities, including IK systems, as nodes.The IK system’s node behavior attributes include the following: •
Caching
•
Node State
To edit node behavior attributes: 1
Select the IK solver.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open Node Behavior if not opened.
4
In Node Behavior, check Caching on or off. Select Node State as Normal, HasNoEffect, or Blocking.
Posing IK chains Posing IK chains includes the following: •
Posing with single chain (SC) solver IK handles
•
Positioning with rotate plane (RP) solver IK handles
•
Twisting with rotate plane (RP) solver IK handles
•
Eliminating flip in rotate plane (RP) solver IK handles
•
Sticky posing
Posing with single chain (SC) solver IK handles To pose single chain (SC) solver IK handles: 1
256
Select the IK handle.
Using Maya: Animation
Posing and Animating Skeletons Posing IK chains You can select the IK handle directly or from the Hypergraph. In the Hypergraph, note that next to each end effector there is an icon you can click on to select the IK handle that the end effector belongs to. 2
Select the Move Tool or the Rotate Tool.
3
Press the right mouse button and pose the IK handle.
4
The joint chain will move or rotate as you move the mouse.
Positioning with rotate plane (RP) solver IK handles To position rotate plane (RP) solver IK handles: Select the IK handle.
Character Animation
1
You can select the IK handle directly or from the Hypergraph. In the Hypergraph, next to each end effector is an icon you can click on to select the IK handle that the end effector belongs to. 2
Select the Move Tool.
3
Press the right mouse button and position the IK handle. The joint chain will move as you move the mouse.
Twisting with rotate plane (RP) solver IK handles To twist a joint chain with a rotate plane (RP) solver IK handle: 1
Select the IK handle. You can select the IK handle directly or from the Hypergraph. In the Hypergraph, next to each end effector is an icon you can click on to select the IK handle that the end effector belongs to.
2
Select the Show Manipulator Tool.
3
Click on the twist disc (located at the end joint of the joint chain). With the right mouse button pressed, move the mouse to twist the joint chain.
Eliminating flip in rotate plane (RP) solver IK handles To eliminate flip: 1
Select the IK handle if not already selected.
Using Maya: Animation
257
Posing and Animating Skeletons Posing IK chains You can select the IK handle directly or from the Hypergraph. In the Hypergraph, next to each end effector is an icon you can click on to select the IK handle that the end effector belongs to. 2
Select the Show Manipulator Tool.
3
Select the pole vector. Note that the triangular object in the rotation disc is not the pole vector. That object is the plane indicator. The plane indicator indicates the orientation of the joint chain plane.
4
Drag the pole vector so that it will not cross the handle vector. Preventing the handle vector from crossing the pole vector will eliminate flipping. The joint chain might twist while you drag the pole vector. This is because when you change the pole vector, you change the orientation of the reference plane. The joint chain’s twist is defined in terms of the difference in degrees between the reference plane and the joint chain plane.
Sticky posing When you position a joint chain with IK handles, you might want to stick one or more IK handles to a location in space while you move other IK handles. This “sticking” feature of IK handles is useful for positioning characters engaging in movement where some part of the skeleton is stationary during part of the motion. For example, your character might be interacting with a solid object such as a floor or a step on a stairway. When you make an IK handle sticky, the IK handle sticks as if stuck by a piece of gum. The IK handle tends to stay stuck, but can be pulled away depending on how you are moving the skeleton. The IK handle’s goal and end effector tend to stay together, but can sometimes separate. A sticky IK handle is indicated by a dark red sphere on the IK handle’s goal. Note that sticky IK handles are only for interactive placement of a skeleton in a keyframe. They are not active when you play an animation.
To do sticky posing:
258
1
Select the IK handle if not already selected.
2
Choose Window→Attribute Editor to open the Attribute Editor.
3
Open IK Handle Attributes if not opened.
4
In IK Handle Attributes, set stickiness to sticky.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles The dark red sphere at the IK handle’s goal indicates that the IK handle is now sticky. The IK handle’s goal is now set to the goal’s current position and orientation for as long as the IK handle is sticky. 5
Pose the skeleton as desired. The sticky IK handle tries to keep its joint chain always reaching for where you’ve stuck the IK handle’s goal.
Using IK spline handles
Character Animation
You can add an IK spline handle to a joint chain to animate the motion of tails, necks, spines, tentacles, bullwhips, snakes, and similar objects. After you add the handle, Maya’s IK spline solver rotates the joints when you manipulate a curve that’s part of the handle.
The seven IK spline handles on this creature control its neck, back, tail, and flippers.
Plesiosaur by Matt Dougan
Creating IK spline handles You add an IK spline handle to a joint chain. To animate the joint chain, you manipulate a curve that’s part of the handle. You don’t manipulate the translation of the handle. You can also roll or twist the joint chain with convenient manipulators.
Using Maya: Animation
259
Posing and Animating Skeletons Using IK spline handles The joint chain can be an independent hierarchy or part of a larger hierarchy. By default, a curve is created for you when you create an IK spline handle. Instead, you can create your own curve before you create the handle. In either case, the joint chain mimics the shape of the curve.
To create an IK spline handle with a default curve and options: 1
Create a joint chain. To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
2
Select Skeletons→IK Spline Handle Tool.
3
Select the start joint for the IK handle.
4
Select the end joint for the IK handle. The IK spline handle appears on the joint chain with an automatically created curve. The joints in the chain rotate to adapt to the shape of the curve.
To create an IK spline handle with your own curve and options: 1
Use modeling tools to create the curve. Create a simple curve with no sharp bends to ensure the joint chain moves smoothly when you animate the curve. If you create a curve with fewer CVs, your control of the curve’s shape and skeleton’s movement will be less precise, but you’ll be able to manipulate the curve and its joint chain easier. With fewer CVs, you spend less time selecting and dragging CVs, and you’re more likely to have a smooth curve. Start with a curve having as few CVs as necessary. Add CVs only as needed to improve control.
2
Create a joint chain. To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
3
Select Skeletons→IK Spline Handle Tool-❐. The Tool Settings window appears. Set options as described in “Setting options before creating the IK spline handle” on page 265. Turn off Auto Create Curve. The option settings are saved for future use.
4
260
Select the start joint for the IK handle.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles 5
Select the end joint for the IK handle.
6
Select the curve. The IK spline handle appears on the joint chain. The joints in the chain rotate to adapt to the shape of the curve. If the curve is shorter than the joint chain, the extra length of the joint chain points out from the end of the curve in a straight line.
Animating the joint chain To animate the joint chain, you set keys for the appropriate attributes after you do any of these actions: manipulate the CVs of the curve
•
twist and roll the joint chain
•
slide the joint chain along the curve
•
translate, rotate, and scale the curve
Character Animation
•
To see the effects of animating the joint chain more clearly, bind skin to the joint chain.
To manipulate the CVs of the curve: 1
Select the curve. To select a curve without selecting joints or other objects in the workspace, turn on (Select by object type) and limit the selection specifiers to NURBS Curves. See Using Maya: Basics for details. You can also select the curve conveniently in the Outliner or Hypergraph. It’s helpful to display CVs and hulls as you work with CVs. With the curve selected in Select by object type mode, turn on Display→NURBS Components→CVs and Hulls.
2
Move the CVs. Turn on
(Select by component type) and use the Move tool on the CVs.
or From the Modeling menu, select Curves→Curve Editing Tool. 3
Select Keys→Set Key to set keys at the desired frames.
Using Maya: Animation
261
Posing and Animating Skeletons Using IK spline handles
Tip To improve speed as you play and scrub your animation, set keys only for the CVs you animate. For instance, select the CVs, then choose Keys→Set Key. If you use the Curve Editing Tool, select Keys→Set Key-❒, turn on All Manipulator Handles, and click the Save button. Thereafter when you choose Set Key, Maya sets keys only for the necessary CVs.
To twist and roll the joint chain: 1
Select the IK spline handle. To select the handle in the workspace, drag a selection box around the end joint. The default selection priority ensures you’ll select the handle rather than the end joint.
2
Select Modify→Transformation Tools→Show Manipulator Tool. Circular manipulators appear at the start joint and end joint.
Twist manipulator
Start joint End joint
Roll manipulator
262
3
To roll the entire joint chain, click and rotate the circular manipulator at the start joint.
4
To twist the joint chain, click and rotate the circular manipulator at the end joint.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles You can also adjust twist and roll by selecting the IK handle and entering values for Roll and Twist in the Channel Box or Attribute Editor. In the Attribute Editor, expand the IK Solver Attributes section to see these attributes. 5
Set keys for the handle’s Roll and Twist attributes. If the IK handle’s Solver Enable is on, the solver doesn’t use the IK handle’s Translate, Rotate, and Scale values as it rotates joints.
To slide the joint chain along the curve: 1
Select the IK handle.
2
Choose Window→Attribute Editor to display the Attribute Editor.
3
Expand the IK Solver Attributes section.
4
Turn on Root on Curve.
Character Animation
To select the IK handle, turn on (Select by object type) then drag a selection box around the end joint of the handle. The default selection priority ensures you’ll select the handle rather than the end joint.
This constrains the start joint of the IK spline handle to a position on the curve. It also provides an offset manipulator to slide the start joint along the curve. 5
Choose Modify→Transformation Tools→Show Manipulator Tool. The offset manipulator appears at the start joint.
Using Maya: Animation
263
Posing and Animating Skeletons Using IK spline handles
Offset manipulator at the start joint
6
Drag the manipulator to slide the joint chain along the curve. If you drag the start joint to the end of the curve, the child joints move off the end of the curve in a straight line.
Offset manipulator at the end of the curve
You cannot drag the manipulator past either end of the curve. You can also enter values for Offset in the Attribute Editor to move the start joint’s offset manipulator along the curve. Try various values over 0 to get the desired position.
264
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles The Offset attribute is ignored if you turn Root on Curve off. 7
Set keys for the Offset at the desired frames.
Note If you use Offset (or the offset manipulator) to animate a joint chain sliding on a curve, the start joint might flip unexpectedly. Use Offset only for small movements or when the start joint doesn’t rotate much. You can also use a motion path to prevent joint flipping. See “Preventing unwanted start joint flipping” on page 272.
To translate, rotate, and scale the curve: Select the curve.
2
Use the Move, Rotate, and Scale tools to translate, rotate, or scale the curve. If you created the handle with Root on Curve off, translating, rotating, and scaling the curve doesn’t translate the start joint.
3
Set keys for the appropriate Translate, Rotate, and Scale attributes.
Setting options before creating the IK spline handle This topic describes how to set IK spline handle tool options available before you create the handle. See “Tips for working with IK spline handles” on page 274 for additional information on how to use several of these options. For details on options you can set after creation, see “Setting attributes after creating the IK spline handle” on page 271.
To set IK Spline Handle Tool options: Select Skeletons→IK Spline Handle Tool-❐ Set the following options in the Tool Settings window.
Using Maya: Animation
265
Character Animation
1
Posing and Animating Skeletons Using IK spline handles
Root on Curve If you turn this option on, the start joint of the IK spline handle is constrained to a position on the curve. You can drag an offset manipulator to slide the start joint (and its children) along the curve. If you turn this option off, you can move the start joint away from the curve. The start joint is no longer constrained to the curve. Maya ignores the Offset attribute, and no offset manipulator exists at the start joint.
266
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles
Character Animation
You can move the start joint and its children off the curve by turning off Root on Curve.
Note If Root on Curve is off, the solver ignores any motion you previously keyed with Offset. Set keys with Root on Curve off or on, not a mixture of both. If Root on Curve is off and you move the start joint far enough away from the curve so that none of the joints can reach the curve, the bones point straight at the closest point on the curve. If the curve is wavy, the joints jump from closest point to closest point as you move the straightened joint chain towards parts of the curve. This is correct operation. The following figure shows a joint chain in four positions as it points towards the closest part of the curve.
Using Maya: Animation
267
Posing and Animating Skeletons Using IK spline handles
You can also turn Root on Curve on or off after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window→Attribute Editor.
Auto Create Root Axis This option creates a parent transform node above the start joint in the scene hierarchy. You can avoid unexpected start joint flipping by moving and rotating this transform node rather than the start joint. See “Preventing unwanted start joint flipping” on page 272 for details. You can turn this option on only when Root on Curve is off. If you turn on Auto Create Root Axis, you must turn off Auto Parent Curve if you want to use the curve as a motion path. Otherwise, a dependency graph loop occurs, which results in the display of a warning message and incorrect handle operation. You can set Auto Create Root Axis in the Tool Options window only as you create the IK spline handle.
Auto Parent Curve If the start joint has a parent, this option makes the curve a child of that parent. The curve and joints therefore move with the transformations of the parent. If you create a handle that starts at a joint in the chain lower than the root joint of your skeleton, turn this option on so the joint chain moves with the transformations of its parent joint. You can set this option in the Tool Options window only as you create the IK spline handle.
268
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles
Snap Curve To Root This option affects the handle only if you create your own curve for the handle. If this option is on when you create the handle, the start of the curve snaps to the position of the start joint. The joints in the chain rotate to adapt to the shape of the curve. If you want to move the joint chain to the curve to use the curve as a fixed path, turn this option off. Otherwise, turn this option on. You can set this option in the Tool Options window only as you create the IK spline handle.
Auto Create Curve If you turn on Auto Create Curve and turn off Auto Simplify Curve, the curve passes through all the joints. This often creates so many CVs that the curve is unwieldy to manipulate. For this reason, consider turning on Auto Simplify Curve. If you turn on Auto Create Curve and Auto Simplify Curve, creating the handle automatically creates a simplified curve that has a shape similar to the joint chain. The higher the Number of Spans, the closer the curve matches the joint chain. The curve has a curve degree of 3 (cubic). If you turn off Auto Create Curve, you must supply a curve for the joint chain. If the joint chain is part of an existing skeleton, you’ll typically turn this option on. If you’re using a curve as a path for sliding the joint chain, you’ll typically turn this option off. You can set Auto Create Curve in the Tool Options window only as you create the IK spline handle.
Auto Simplify Curve This option sets the automatically created curve to the specified Number of Spans. The number of spans corresponds to the number of CVs in the curve. The curve has a curve degree of 3 (cubic). If you create a curve with fewer CVs, your control of the curve’s shape and skeleton’s movement will be less precise, but you’ll be able to manipulate the curve and its joint chain easier. With fewer CVs, you spend less time selecting and dragging CVs, and you’re more likely to have a smooth curve.
Using Maya: Animation
269
Character Animation
This option creates a curve used by the IK spline handle.
Posing and Animating Skeletons Using IK spline handles This option works only if Auto Create Curve is on. You can set Auto Simplify Curve in the Tool Options window only as you create the IK spline handle.
Number of Spans This option specifies the number of CVs in the curve as follows: Number of Spans
CVs
1
4
2
5
3
6
4
7
This option is available only if Auto Create Curve is on. You can set the Number of Spans in the Tool Options window only as you create the IK spline handle.
Root Twist Mode This option turns on Power Animator IK spline twisting. As you turn the twist manipulator at the end joint, the start joint twists slightly with the other joints. With this option off, the start joint doesn’t twist. Use the roll manipulator at the start joint to turn the start joint. You can also set this option after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window→Attribute Editor.
Twist Type This option specifies how the twist occurs in the joint chain:
270
•
Linear twists all parts evenly.
•
Ease In twists more at the end than the start.
•
Ease Out twists more at the start than the end.
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles •
Ease In Out twists more at the middle than at either end. You can also set Twist Type after you create the IK spline handle by selecting the IK spline handle and displaying the Attribute Editor. To display the Attribute Editor, select Window→Attribute Editor.
Setting attributes after creating the IK spline handle After you create an IK spline handle, you can specify settings for several attributes.
To set attributes after creating the IK spline handle: Select the IK handle.
2
Choose Window→Attribute Editor to display the Attribute Editor.
3
Expand the IK Solver Attributes section.
Character Animation
1
The following attributes are displayed: Solver Enable
Turning this off disables the IK spline solver. If you’ve bound skin to the joint chain, turn this option off before returning the joint chain to the bind pose. While this option is on, avoid moving individual joints or you might encounter unexpected joint rotations. You also cannot move or rotate the IK handle. Be aware that the IK spline solver doesn’t operate if there are joint limits on any of the joints controlled by an IK spline handle.
Offset
See the following note.
Roll
See “Animating the joint chain” on page 261.
Twist
See “Animating the joint chain” on page 261.
Twist Type
See the following note.
Root on Curve
See the following note.
Root Twist Mode
See the following note.
Using Maya: Animation
271
Posing and Animating Skeletons Using IK spline handles
Note Twist Type, Root on Curve, and Root Twist Mode are available when you select Skeletons→IK Spline Handle Tool-❐. In the Attribute Editor, Offset affects the joint chain only if you turn on Root on Curve. For details on these attributes, see “Setting options before creating the IK spline handle” on page 265.
Preventing unwanted start joint flipping The start joint might flip undesirably when you move or rotate a curve or its CVs in some directions or slide the joint chain along its curve. If flipping occurs, it’s likely to do so only in a small range of rotation. The flipping is a normal outcome of IK spline solver calculations. If the orientation of a joint is more than 90 spatial degrees from its zerorotation value, it might flip unexpectedly as you rotate the curve or CVs. The zero-rotation value is where the joint’s RotateX, RotateY, and RotateZ attributes are 0 (relative to its parent joint’s coordinate system). Flipping is most pronounced near 180 degrees. Joint is at its zerorotation value.
Unwanted start joint rotation might occur in the half-spherical region. Flipping is pronounced in the conical region.
You can prevent start joint flipping in most cases by positioning joints appropriately when you create the joint chain. When you create each joint after the start joint, position it roughly in its rest position—the average position of its entire range of motion.
272
Using Maya: Animation
Posing and Animating Skeletons Using IK spline handles If you’ve positioned joints appropriately and joint flipping is still a problem, try parenting the start joint to another joint or to a transform node. See “Auto Create Root Axis” on page 268 and “Auto Parent Curve” on page 268. Unexpected start joint flipping might also occur when you animate a joint chain along its curve, for instance, when you slide a snake along a motion path. To prevent flipping in such cases, do these steps.
To prevent flipping when a joint chain slides down its curve: Select Skeletons→IK Spline Handle Tool-❐ to display the Tool Settings window.
2
Turn off Root on Curve, Auto Parent Curve, Auto Create Curve, and Snap Curve to Root.
3
Turn on Auto Create Root Axis.
4
Select the start joint, then the end joint, and then the curve you’ve created. This creates the IK spline handle with a parent transform node above the start joint. In a subsequent step you’ll put the node on a motion path that prevents the start joint flipping.
5
Select the parent transform node, then Shift-click the curve. To select the parent transform node, drag a selection box around the start joint.
6
Select Paths→Attach to Path-❐. The Attach to Path Options window appears.
7
Turn on Start/End.
8
For the Start Time and End Time, enter the frame range for the joint chain’s motion. The parent transform node and its child joint chain will move from the start of the curve to the end of the curve in the specified frame range.
9
Turn on Follow. If the curve has a 3D looping shape, you might also need to turn on Normal for the Up Direction to avoid unwanted flipping.
10 Leave other options at the default settings. 11 Click the Attach button.
Using Maya: Animation
273
Character Animation
1
Posing and Animating Skeletons Tips for working with IK spline handles When you play the animation, the parent transform node and joint chain move along the curve path. The movement will likely be free of unexpected flipping. However, flipping is unavoidable in some complex paths. Note that you can still roll and twist the joint chain with the IK handle’s roll and twist manipulators for additional control.
Working with soft body curves If you change an IK spline curve to a soft body, you can add dynamic forces to change the curve’s motion. For example, you can connect turbulence to the curve to create random, erratic motion. See Using Maya: Dynamics for details.
Tips for working with IK spline handles This section provides tips for working with IK spline handles on most characters. Subsequent topics offer suggestions specific to the type of character and motion you’re creating. •
To ensure the joint chain moves smoothly when you animate the curve, create many joints close to each other (with short bones).
•
Create a simple curve with no sharp bends to help make the joint chain move smoothly when you animate the curve. Use a small number of CVs.
•
When you add an IK spline handle to the skeleton of most creatures— including fish and snakes moving along a motion path—parent each IK spline start joint to a transform node or parent joint that’s not controlled by an IK spline handle. This makes the joint chain move with the transformations of the parent while avoiding unexpected joint flipping. See “Preventing unwanted start joint flipping” on page 272 for details. If you’re working on a character with a root joint that rotates little, for instance, a swaying tree, you don’t need to parent the start joint to a transform node or joint. The start joint can serve as the character’s root joint.
•
274
For a character such as a fish or snake moving along a motion path, if you create a handle that starts at a skeleton’s root, turn on Auto Create Root Axis when you create the IK spline handle. This prevents unexpected joint flipping as you animate the automatically created parent transform node along a motion path. Also turn off Auto Parent Curve.
Using Maya: Animation
Posing and Animating Skeletons Tips for working with IK spline handles If you create a handle that starts at a joint other than the skeleton’s root, turn on Auto Parent Curve and turn off Auto Create Root Axis so the handle’s curve and start joint move with the transformations of the parent joint. When you manipulate a tail or neck parented to a spine, avoid moving the first CV of the curve for the tail or neck. Move the second CV minimally, preferably only along an imaginary line extending straight out from the end of the spine. Manipulate the other CVs freely. This technique ensures that the skin flows naturally where the spine meets the tail or neck.
•
To prevent unexpected results, Maya doesn’t let you overlap the same joint with two IK spline handles.
•
Do not parent the curve to the start joint. This creates a dependency graph loop that causes the start joint to chase the curve as the curve moves. To detect such loops, use the MEL cycleCheck -all command described in the online MEL documentation.
•
Do not parent the curve to a transform node that would use that same curve as a motion path. In other words, don’t turn on Auto Create Root Axis and Auto Parent Curve if you plan to put the transform node on that curve. This creates a dependency graph loop.
Using Maya: Animation
275
Character Animation
•
Posing and Animating Skeletons Tips for working with IK spline handles
Working with human skeletons Because a human spine often twists, turns, and bends, an IK spline handle is ideal for controlling it. For example, you can position the handle’s start joint one joint hierarchically below (and positionally above) the skeleton’s root joint. This causes the IK spline joint chain to move with the root’s movement without unexpected joint flipping.
IK spline handle
IK spline handle Start joint Root joint
Zoomed view of image on left
276
Using Maya: Animation
Posing and Animating Skeletons Tips for working with IK spline handles
Working with animal skeletons Because an animal’s tail, back, and neck twist and turn independently, multiple IK spline handles are ideal for controlling them. This skeleton has three IK spline handles: on the tail, back, and neck. The handles give precise control of the spine. Handle Handle
Character Animation
Handle
Pelvic region
Here’s a close-up of the pelvic region of the preceding skeleton: Handle Handle
Close-up of previous image’s pelvic region
Note that you can use two rather than three handles for skeletons: one for the tail and one for the neck and back combined.
Using Maya: Animation
277
Posing and Animating Skeletons Tips for working with IK spline handles The start joint of the tail’s handle and the start joint of the back’s handle are near the position of the skeleton’s root, but one joint below the root in the skeleton’s hierarchy. This causes the IK spline joint chains to move with the root’s movement without unexpected joint flipping. If you use this approach, turn on Auto Parent Curve when you create the handles. This ensures the curve and joints move with the transformation of the root. For most creatures, using only one handle for the tail, back, and neck won’t give you adequate control.
Working with sinuous motion on skeletons IK spline handles are useful for animating land or sea creatures that move in sinuous or undulating patterns, for example, snakes, fish, and seals. The skeleton’s root location is crucial for achieving the desired motion. To animate a creature that glides smoothly along a path without abrupt direction changes at the head or tail, put the root of the skeleton at the character’s tail end. Turn on Auto Create Root Axis to prevent unexpected joint flipping as you transform the automatically created parent transform node. Also turn off Auto Parent Curve. An example skeleton follows:
Handle
Handle Handle Handle
Handle The skeleton’s root is at its tail.
278
Using Maya: Animation
Posing and Animating Skeletons Tips for working with IK spline handles Though not visible in the preceding figure, a parent transform node appears hierarchically above the start joint of the handle on the spine. If the creature’s head or tail moves abruptly, put the skeleton’s root between the spine’s midpoint and tail, for instance, near the pelvic region:
Handle Handle Handle
Character Animation
Handle Handle Handle
Handle
The root is in the pelvic region.
Handle
Handle
Handle
Handle
Close-up of previous image’s pelvic region
Using Maya: Animation
279
Posing and Animating Skeletons Animating IK chains Each handle’s start joint in the figure is separated from the root by one joint. None of the IK spline handles pass through the root. This causes the IK spline joint chains to move with the root’s movement without unexpected joint flipping.
Animating IK chains You can animate IK chains by keyframing or by using motion capture data.
Keyframing For information on keyframing, please see Using Maya: Animation, Part 1: Keyframe, which describes the tasks and tools for keyframing, including how to set keys, edit key options, use the Graph Editor, use the Dope Sheet, and use the Playblast window. Please note the following keyframing tips for character animation: •
Set a minimum number of keys
•
Use the Channel Box
Set a minimum number of keys You can set a key for every transformation attribute in a scene. However, in character animation, most expert users find that setting a minimum number of keys assures the best use of system resources. They only key transformation attributes that they want to be sure will be interpolated between frames. For example, if only the transformation attribute for translation along the X-axis of an IK handle’s goal has changed, expert users will save a key for only that transformation attribute, not the entire IK handle.
Use the Channel Box In addition to the selections from the Keys pull-down menu, many expert users often use the Channel Box to set keys for particular transformation attributes. For example, if you select the Translate X channel and then press the right mouse button, you can choose Key Selected to save a key for that channel only. (Note that in the Channel Box, transformation attributes are identified as channels.)
280
Using Maya: Animation
Posing and Animating Skeletons Animating IK chains
Motion capture For information on motion capture, please see Using Maya, Animation, Part 4: Constraints and Motion Capture. You can have motion capture data drive the IK handle’s goals, thereby posing the IK chains.
Character Animation
Using Maya: Animation
281
Posing and Animating Skeletons Animating IK chains
282
Using Maya: Animation
13
Skinning Skeletons
This chapter explains skinning. Skinning skeletons includes the following: •
“Understanding skinning” on page 284
•
“Binding by closest point” on page 285
•
“Binding by partition set” on page 287
•
“Binding multiple objects as skin” on page 288
•
“Returning to bind pose” on page 289 Using Maya: Animation
283
Character Animation
Skinning skeletons is the process of binding a geometry to a skeleton so that the skeleton’s actions can deform the geometry. A geometry can be either a non-uniform rational B-spline (NURBS) geometry whose points are control vertices (CVs), or a polygonal geometry whose points are vertices. Once bound, the geometry becomes the skeleton’s skin. In effect, the skeleton’s skin provides the shape of the character’s surface. The skin moves as the skeleton’s joints move, because during skinning the geometry’s points (CVs or vertices) are identified as skin points and organized into skin point sets that are bound to the skeleton’s joints.
Skinning Skeletons Understanding skinning •
“Displaying skin point set colors” on page 290
•
“Editing skin point sets” on page 290
•
“Detaching and reattaching skin” on page 290
•
“Animating with skin and skeleton groups” on page 292 Note that skinning skeletons often requires use of the Set Editor. If you are not familiar with the Set Editor, please refer to Using Maya: Hypergraph, Sets, and Expressions.
Understanding skinning Skin is a geometry that has been bound to a skeleton, and skinning is the process of binding a geometry to a skeleton. After you’ve built a skeleton and exercised how that skeleton can be posed and animated, you are ready to give the skeleton some skin. First, pose the skeleton so that it fits the geometry properly. Next, bind the geometry to the skeleton, making the model the skeleton’s skin. This skin provides the surface of your character. In Maya, there are two ways to skin a skeleton: •
Closest point skinning
•
Partition set skinning
Closest point skinning In binding by closest point, the geometry’s points (CVs or vertices) are automatically organized into skin point sets based on the proximity of each point to a joint. For each joint with a bone, a skin point set is created that includes the points that are closest to the given joint. The points are then identified as skin points, with each skin point being a member of only one skin point set. In Maya, a collection of sets that can have no members in common is called a partition. In organizing the geometry’s points for binding, Maya partitions them into skin point sets. Because skin point sets can have no members in common, a skin point cannot be bound to more than one joint. In binding by closest point, Maya creates the skin point sets for you. You can edit the sets after they are created to fine-tune the binding of individual skin points.
284
Using Maya: Animation
Skinning Skeletons Binding by closest point
Partition set skinning If the geometry has its points (CVs or vertices) organized into a partition whose sets you want to bind to joints, you can bind by closest partition. During modeling, you can partition a geometry’s points (CVs or vertices) into sets. A geometry that has the same number of sets as the skeleton has joints can be bound to the skeleton by partition set. In binding by partition set, a geometry’s already existing partition sets are bound to the skeleton’s joints as skin point sets. Each partition set is bound to the nearest joint as a skin point set.
Skin point set colors
Bind pose After you’ve given the skeleton some skin, whe posed and animated the skin will deform based on the skeleton’s action. The only pose in which the skin is not deformed relative to the original geometry is the bind pose, which is the pose the skeleton was in when you bound the geometry to it.
Skin detachment and reattachment You can detach and reattach the skeleton’s skin at any time. Expert users detach and reattach when they want to add or remove a skeleton’s joints, change the skeleton’s bind pose, do some more modeling on the skin, or detach and then bind a different geometry for the skin.
Binding by closest point In binding by closest point, Maya automatically creates jointClusters for each joint, and distributes the points closest to each joint into that joint’s jointCluster set. Binding by closest point is the most common way to skin a skeleton.
Using Maya: Animation
285
Character Animation
Whether you bind by closest point or by partition set, Maya assigns each skin point set a color. The points in a given skin point are displayed in the set’s color. You can also have the skin point set’s joint be displayed in the skin point set’s color.
Skinning Skeletons Binding by closest point If you plan to bind additional skins to the skeleton at a later time, you will want to be able to return easily to the pose at which the first skins were bound (the bind pose). Maya saves bind pose information for joints at which you bind the skin, but not joints without skin. Binding to the skeleton from the bottom of the skeleton’s action hierarchy can make it difficult to return the skeleton to its bind pose. The easiest way to ensure that you can return to the bind pose is to always bind from the top of the hierarchy downwards. In cases where you wish to concentrate on the lower part of the skinning first, it is best to bind simplistic substitute skins to the upper part of the skeletal hierarchy to ensure that Maya saves bind pose information for the entire skeleton. Late, you can delete the substitute skins when you are ready to bind the actual skin.
To bind by closest point: 1
Select the geometry and skeleton. If you are binding to the complete skeleton, select any joint. Maya will understand that you want to bind the geometry to the entire skeleton hierarchy that corresponds to the joint you have whose joint you have selected. If you are binding to selected joints only, explicitly select each joint that you want to bind to. Note that you can attach more than one geometry at a time. Select all the geometries that you want to bind to the skeleton by clicking on one and then Shift-clicking the others to select them.
2
Select Skinning→Bind Skin-❐. The Bind Skin Options window is displayed.
3
In Bind to, choose Complete Skeleton or Selected Joints.
4
Click Coloring on to color the joints according to the colors assigned to the skin point sets.
5
In Bind Method, click Closest Point.
6
At the bottom of the Bind Skin Options window, click Bind. The geometry binds to the skeleton. Maya puts the geometry’s points (CVs or vertices) into skin point sets, and each set is controlled by the jointCluster of the closest joint. The jointCluster name will correspond to the name of its joint. For example, if a joint is named elbow, the corresponding jointCluster will be named elbowCluster1.
286
Using Maya: Animation
Skinning Skeletons Binding by partition set When you first bind the skin, all cluster percentages will be set to 1.0, giving the skin a rigid look around the joints. You can apply lattice or jointCluster flexors to smooth the transition about the joints, or modify the cluster percentages directly using the Set Editor. Note that because the skin is bound to the skeleton, the skin’s transformation attributes are locked. If you try to manipulate the transformation attributes, the manipulator appears gray, indicating the attributes are locked. If you decide you want to modify the geometry that you’ve bound to the skeleton as its skin, you must first unbind the skin from the skeleton. After you’ve modified the geometry, you can then rebind it to the skeleton. 7
Binding by partition set In binding by partition set, Maya binds a geometry’s existing partition sets to a skeleton. The number of sets should equal the number of joints with bones. For information on creating partitions in Maya, see Using Maya: Hypergraph, Sets, and Expressions.
To bind by partition set: 1
Select the geometry and the skeleton or the specific joints to you wish to bind.
2
Select Skinning→Bind Skin-❐ The Bind Skin Options window is displayed.
3
In Bind to, choose Complete Skeleton or Selected Joints.
4
Click Coloring on to color the joints according to the colors assigned to the skin point sets.
5
In Bind Method, click Partition Set. In the Partition window, select the name of the partition you wish to bind. Only partitions composed of point sets are valid for binding by partition. Default Maya partitions such as the renderPartition and layerPartition are not valid for binding since they contain sets of objects, not points.
6
At the bottom of the Bind Skin Options window, click Bind.
Using Maya: Animation
287
Character Animation
Exercise the skeleton to see how the skin point sets have been created. Note how the skin point sets move with the joints to which they are bound. You might want to edit skin point set membership. To edit set membership, see Using Maya: Hypergraph, Sets, and Expressions.
Skinning Skeletons Binding multiple objects as skin Maya binds the selected partition’s sets to the skeleton, with each set bound to the nearest joint. Note that because the skin is bound to the skeleton, the skin’s transformation attributes are locked. If you try to manipulate the transformation attributes, the manipulator appears gray, indicating the attributes are locked. If you decide you want to modify the model that you’ve bound to the skeleton as its skin, you must first unbind the skin from the skeleton. After you’ve modified the geometry, you can then rebind it to the skeleton. 7
Exercise the skeleton to see how the skin point sets have been created. Note how the skin point sets move with the joints to which they are bound. You might want to edit skin point set membership. To edit set membership, see Using Maya: Hypergraph, Sets, and Expressions.
Binding multiple objects as skin Maya allows you to bind many objects as skin. You can attach new objects as skin at any time. There are two ways to attach additional objects to a skeleton which already has a bound skin: using the bind skin menu, or using set editing tools.
Binding additional objects with the Bind Skin menu: When you add new objects as skin, the skeleton must be in the same position that was in when you bound the original skin. This position is called the bind pose. The following section contains more details on returning the skeleton to the bind pose. Once the the skeleton is at the bind pose, follow the bind by closest point instructions to bind additional skins to the skeleton.
Binding additional objects using set membership: A second way to attach new skins is with the Set Editor by adding points to existing jointClusters. If you choose to attach new skins with set editing tools, note that if the skeleton is not at the bind pose, the new skins will immediately be deformed by the skeleton as soon as they are added to the jointCluster’s set. If this deformation is not desired, move the skeleton to the bind pose before adding the points into the jointCluster’s set.
288
Using Maya: Animation
Skinning Skeletons Returning to bind pose
Returning to bind pose The pose a skeleton is in during skinning is called the bind pose. When you pose a character, the skeleton’s action causes skin deformations. The only pose that does not cause skin deformations is the bind pose; when the skeleton is in the bind pose, the skin is in the same shape that it was in when it was a geometry. Yo will want to return the skeleton to the bind pose before binding new skin geometries. You will also want to return the skeleton to the bind pose before adding lattice flexors.
To return a skeleton to its bind pose: Select any joint on the skeleton.
2
Choose Skinning→Go to Bind Pose. The skeleton assumes the pose it had during skinning, when the geometry was bound to the skeleton. If possible, the skeleton assumes the pose it had during skinning, when the geometry was bound to the skeleton. It may not be possible for Maya to move the skeleton to the bind pose. Constraints, keyframed IK Handles, IK Handles using the spline solver, locked attributes and expressions can all create situations where a skeleton is unable to go to the bind pose. If the skeleton is unable to move to the bind pose, you will receive an error message saying: Error: Could not reach bindPose due to constraints, expressions, or keyframed handles. When this happens, a quick way to allow the skeleton to reach the bind pose, is to disable the source of the conflict:
3
Choose Modify→Disable Nodes→All. Maya only stores the bind pose for joints which have skin attached. It is best to always bind skin from the top-down so that there are no joints above the bound skin that do not have skin attached. Otherwise, going to the bind pose may cause your skeleton or skin to become distorted. For this reason , it is best to have all of the skeleton and skins displayed when you go to the bind pose. If either the skeleton or the skins are distorted, undo, and consider resetting the skeleton’s bind pose to a new position.
To reset a skeleton’s bind pose: You might want to reset a skeleton’s bind pose. You can do so as follows:
Using Maya: Animation
289
Character Animation
1
Skinning Skeletons Displaying skin point set colors 1
Select any joint on the skeleton.
2
Choose Skinning→Preserve Skin Groups→Detach Skeleton. The skin on the skeleton will move its undeformed position. If the undeformed position is not appropriate for the new bind pose, position the skin based on the new bind pose.
3
Choose Skinning→Preserve Skin Groups→Reattach Skeleton. The new bind pose will be set at the current postion of the skeleton.
Displaying skin point set colors Maya assigns each skin point set a color. When the points (CVs or vertices) in a skin point set are displayed, the points are displayed in the assigned color.
To display the skin point set colors: 1
Select the skin.
2
If the skin is from a NURBS geometry, choose Display→ NURBS Components →CVs. If the skin is from a polygonal geometry, choose Display→Polygon Components→Vertices. If the skin is a lattice geometry, choose Display→Object Components→Lattice Points.
Editing skin point sets You can edit skin point sets by using the Set Editor. For information about the Set Editor, please refer to Using Maya: Hypergraph, Sets, and Expressions.
Detaching and reattaching skin Occasionally, you might want to modify the skeleton, reset the bind pose, or do some further modeling on the skin. To do so, you first need to detach the skin from the skeleton. When you finish editing the skeleton or modeling the skin, you can reattach the skin to the skeleton. You can detach the skin in two modes:
290
•
Detach
•
Preserve Skin Groups - Detach
Using Maya: Animation
Skinning Skeletons Detaching and reattaching skin Typical reasons for using Detach include the following: •
You no longer want the geometry to act as a skin.
•
You plan to change the topology of the skin geometry before reattaching.
•
You want to reset the skin groups and percentage values to their default. Typical reasons for using Preserve Skin Groups - Detach include the following:
•
You do not want to lose the current skin groups and percentage values.
•
You want to reset the bind pose on the skeleton.
•
You want to modify the skeletal hierarchy.
Detaching skin without preserving skin groups and percentages To detach skin without perserving skin groups and percentages: 1
Select the skin(s) you want to unbind.
2
Choose Skinning→Detach Skin. The Detach Skin Options window is displayed.
3
From History, choose Delete History, Keep History, or Bake History. The Delete History option will unbind the skin, move it to its undeformed position, and delete any unused jointClusters. The Keep History option will unbind the skin, and move it to its undeformed position, but will not delete unused jointClusters. The Bake History option will unbind the skin without moving it to its undeformed position, and delete unused jointClusters.
4
Click the Coloring check-box to set whether to remove joint colors.
5
At the bottom of the Detach Skin Options window, choose Detach to detach the skin. Unless you use the Bake History option, the skin will move to its uneformed location. The skin’s transformation attributes (translate,rotate, and scale) will be unlocked. Unused jointCluster’s in the skin’s history will be deleted unless you use the Keep History option. Using Maya: Animation
291
Character Animation
Important: In order to reattach the skin while preserving skin groups, you must detach the skin in preserve skin groups mode. If you detach the skin using the standard detach option, you must reattach the skin by reperforming the bind skin operation.
Skinning Skeletons Animating with skin and skeleton groups
Detaching skin while preserving skin groups and percentages To detach skin while preserving skin groups and percentages: 1
Select a joint in the skeleton or explicitly select the joints which you wish to detach.
2
Choose Skinning→Preserve Skin Groups→Detach Skeleton or Skinning→Preserve Skin Groups→Detach Selected Joints based on how much of the skeleton you wish to detach. The skin affected by the detached joints will move to its undeformed position. Its transformation attributes (translate, rotate, and scale) will be unlocked so that you can reposition it. To reattach the skin with its old percentages and groups, use the Preserve Skin Groups - Reattach technique.
Reattaching skin while preserving skin groups and percentages You can only reattach the skin using this method if you detach the skin using the Preserve Skin Groups - Detach options. If you detach the skin using the Detach Skin method, your skin groups and percentages were deleted so you should the basic Bind Skin operation to reattach the skin.
To reattach skin while preserving skin groups and percentages: 1
Select the skeleton or explicitly select the joints which you wish to reattach.
2
Choose Skinning→Preserve Skin Groups→Reattach Skeleton or Skinning→Preserve Skin Groups→Reattach Selected Joints based on how much of the skeleton you wish to reattach.
Animating with skin and skeleton groups After skinning, create a group for your character that includes the character’s skeleton and skin. Having a group that includes everything that your character consists of can greatly ease the management of the character within an animation, particularly when you have many characters in an animation. You can easily view everything a character’s group can include from the Hypergraph. For more information on using the Hypergraph, please see Using Maya: Hypergraph, Sets, and Expressions.
292
Using Maya: Animation
Skinning Skeletons Animating with skin and skeleton groups
To group skin and skeleton: 1
Select a skeleton and its skin.
2
Choose Edit→Group. A group for the character is created. Note that this group node should only be used for organizational purposes. It should not be used to translate, rotate, or scale the character. Moving the group node causes the skin to get doubly transformed since it is transformed once by the skeleton and a second time by the group node.
Character Animation
Using Maya: Animation
293
Skinning Skeletons Animating with skin and skeleton groups
294
Using Maya: Animation
14
Using Flexors Maya offers a wide variety of deformer tools for creating deformations. Flexors are high-level deformer tools for deforming a skeleton’s skin; their effects can be linked to the actions of the skeleton.
Character Animation
For more information about Maya’s basic deformer tools, please see Using Maya: Animation, Basic Deformers. This chapter describes flexors. Using flexors includes the following: •
“Understanding flexors” on page 296
•
“Creating lattice flexors” on page 301
•
“Positioning lattice flexors after creation” on page 302
•
“Editing joint lattice flexor attributes” on page 302
•
“Editing bone lattice flexor attributes” on page 313
•
“Creating sculpt flexors” on page 324
•
“Editing sculpt flexor attributes” on page 325 Using Maya: Animation
295
Using Flexors Understanding flexors •
“Joint-driven sculpting” on page 325
•
“Creating cluster flexors” on page 326
•
“Editing cluster flexor attributes” on page 328
•
“Editing with cluster flexor manipulators” on page 328
Understanding flexors Flexors are high-level deformers that deform skin based on how a skeleton moves. There are three types of flexors: •
Lattice flexors (joint lattice flexors and bone lattice flexors)
•
Sculpt flexors (joint sculpt flexors and bone sculpt flexors)
•
Cluster flexors (joint cluster flexors only)
Lattice flexors Lattice flexors are tools for deforming the skin around joints and the bones of joints. They can smooth or wrinkle skin around joints and provide muscle definition around bones. You could use a joint lattice flexor to ease and smooth the skin around a joint as it bends, or you could use a bone lattice flexor to show bulging muscles around the bones of joints.
296
Using Maya: Animation
Using Flexors Understanding flexors
Character Animation
Skin bending around joint without lattice flexor (note creases)
Using Maya: Animation
297
Using Flexors Understanding flexors
Skin bending around joint with lattice flexor (note smoothed crease)
Sculpt flexors Sculpt flexors provide a way to create various types of bulges and dips in a character’s skin.
298
Using Maya: Animation
Using Flexors Understanding flexors
Character Animation Sculpt flexors are ideal for deformations such as muscle bulges, knee cap action, or elbow cap action. You can create sculpt flexors at joints (joint sculpt flexors) or at the bones of joints (bone sculpt flexors).
Cluster flexors Cluster flexors can provide realistic smoothing effects by allowing you to control the points in a skin point set around a joint with varying percentages of influence.
Using Maya: Animation
299
Using Flexors Understanding flexors
To understand cluster flexors, you need some background on the role of the basic cluster deformers in the skinning process. When you skin a skeleton, the skin points are organized into a partition of sets called skin point sets. A skin point set is created to correspond to each joint and bone combination. Also automatically created for each skin point set is one of Maya’s basic deformers, the cluster deformer. Cluster deformers that enable skinning are called joint cluster deformers. A joint cluster deformer is what glues a skin point set to a joint-and-bone combination so that the skin moves with the skeleton. A joint cluster deformer is like a basic cluster deformer except that it acts specifically on a skin point set. (For more information on basic cluster deformers, please refer to Using Maya: Animation, Basic Deformers.) Cluster flexors are high-level tools that provide you with a way to manipulate joint cluster deformers. Cluster flexors can be created only at joints (joint cluster flexors only) because they control joint cluster deformers.
300
Using Maya: Animation
Using Flexors Creating lattice flexors
Creating lattice flexors Lattice flexors create a lattice deformer around a joint (joint lattice flexor) or bone (bone lattice flexor). The flexor’s effect on the skin around the joint or bone can be driven by the action of a joint. When you create a lattice flexor, the lattice’s reset (base) position corresponds to the bind pose. To edit a joint lattice flexor, see “Editing joint lattice flexor attributes” on page 302. To edit a bone lattice flexor, see “Editing bone lattice flexor attributes” on page 313. Character Animation
To create a lattice flexor at a joint or bone: 1
Put the skeleton in bind pose by clicking any joint or bone and choosing Skinning→Go to Bind Pose. It’s possible to create a flexor on a skeleton that’s not in the bind pose, but it’s not recommended—you might get unexpected results.
2
Select the joint or joints on which you want to create a joint flexor. To create a bone flexor, select the parent joint of the bone. To create flexors on all joints or bones, select any joint on the skeleton.
3
Choose Skinning→Create Flexor... . The Create Flexor window is displayed.
4
From the Flexor Type: pull-down menu, choose lattice.
5
To create one or more joint lattice flexors, use the Joints box. In the Joints box, click At Selected Joint(s) to create flexors only at the selected joints, or click At All Joint(s) to create flexors at all the skeleton’s joints.
6
To create one or more bone lattice flexors, use the Bones box. In the Bones box, click At Selected Bone(s) to create flexors only at the bones of the selected parent joints, or click At All Bone(s) to create flexors for all the bones.
7
To specify the divisions of the lattice, use the Lattice Options box. The default is 2 S divisions, 5 T divisions, and 2 U divisions. You can enter new numbers for the divisions or use the sliders. The greater the number of divisions, the smoother the deformation effect; the smaller the number of divisions, the faster the performance.
Using Maya: Animation
301
Using Flexors Positioning lattice flexors after creation 8
Click Position the flexor if you want to adjust the location of the lattice flexor before closing the Create Flexor window.
9
If you would like to move, rotate, or scale the flexor without worrying about deforming the skin, you can do so now. Click Position the Flexor. Then choose one of the transform tools (move, rotate, or scale) and change the flexor’s position.
10 To create the lattice flexor(s), click OK. Once you have created the lattice flexors, you edit them to control how they deform the skin. To edit joint lattice flexors, see “Editing joint lattice flexor attributes” on page 302. To edit bone lattice flexors, see “Editing bone lattice flexor attributes” on page 313.
Positioning lattice flexors after creation To position a lattice flexor after creation: 1
Put the skeleton in bind pose by selecting it and choosing Skinning→Go to Bind Pose.
2
Select the lattice group from the Outliner. The lattice group is the highest-level lattice in the Outliner. If you open this lattice (the default name is lattice followed by a number), you’ll see the lattice that deforms the skin underneath it (the default name is deformed followed by a number).
3
Select a transform tool. The manipulator of the selected tool appears on the lattice.
4
Move the lattice with the manipulator.
Editing joint lattice flexor attributes The attributes of joint lattice flexors control how the flexors deform the skin around joints. Use the Attribute Editor to edit joint lattice flexor attributes. Editing joint lattice flexor attributes includes:
302
•
“Viewing joint lattice flexor attributes” on page 303
•
“Renaming joint lattice flexors” on page 303
•
“Editing rounding” on page 305
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes •
“Editing creasing” on page 303
•
“Editing length in” on page 306
•
“Editing length out” on page 308
•
“Editing width left” on page 310
•
“Editing width right” on page 311
Viewing joint lattice flexor attributes To view joint lattice flexor attributes: 1
Make sure the skeleton is not in the bind pose.
2
Select a joint lattice flexor.
3
Choose Window→Attribute Editor... . The Attribute Editor is displayed. In the Attribute Editor, you can modify the attributes of lattice flexors on joints to create specific effects.
Renaming joint lattice flexors By default, joint lattice flexors are given the name “jointFlexor” with a number added at the end. You can change the default name. Using names that describe the purpose of the lattice flexor can be helpful when you have a complex character with many flexors.
To rename a joint lattice flexor: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In the flexorShape: field, enter a new name.
Editing creasing The creasing attribute affects the bulging of a joint’s point groups on the inside of a bend. When you enter a creasing value, the flexor points on the inside of the bend move inward or outward to change the shape of the bulge. •
A positive creasing value causes the skin to bulge outward.
•
A negative creasing value causes the skin to tuck inward. Using Maya: Animation
303
Character Animation
Flexors don’t deform skin in the bind pose. To see the effects of flexors, you must view the skeleton in another pose.
Using Flexors Editing joint lattice flexor attributes The following figures illustrate positive and negative creasing.
Positive creasing effect with joint lattice flexor
Negative creasing effect with joint lattice flexor
To edit creasing: 1
304
View the joint lattice flexor’s attributes in the Attribute Editor.
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes 2
In Creasing, enter a new value or use the slider. Note that you can also edit the creasing attribute from the Channel Box.
Editing rounding Rounding affects the bulging of a joint’s point groups on the outside of a bend. When you enter a rounding value, the flexor points on the outside of the bend move outward or inward to change the shape of the bulge. •
A positive rounding value causes the skin to bulge outward.
•
A negative rounding value causes the skin to bulge inward. Character Animation
The following figures illustrate positive and negative rounding:
Positive rounding effect with joint lattice flexor
Using Maya: Animation
305
Using Flexors Editing joint lattice flexor attributes
Negative rounding effect with joint lattice flexor
To edit rounding: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Rounding, enter a new value or use the slider. A positive rounding value causes the skin to bulge outward, and a negative rounding value causes the skin to bulge inward. Note that you can also edit the rounding attribute from the Channel Box.
Editing length in The Length In attribute affects the locations of flexor points along the joint’s point group around the upper bone. When you enter a Length In value, the flexor planes along the upper bone move away from or towards the joint.
306
•
A positive Length In value causes the lattices to move away from the joint, spreading the bend effect up the upper bone.
•
A negative Length In value causes the lattices to move towards the joint, making the bend effect more local to the joint.
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes When you change the Length In value, you modify the regions affected by the round, crease, and width effects. The following figures illustrate positive and negative length in effects.
Character Animation
Positive length in effect with joint lattice flexor
Negative length in effect with joint lattice flexor Using Maya: Animation
307
Using Flexors Editing joint lattice flexor attributes
To edit length in: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Length In, enter a new value or use the slider. A positive value causes the deformation to spread farther up the bone towards the joint’s parent joint. A negative value causes the deformation to concentrate towards the joint. Note that you can also edit the length in attribute from the Channel Box.
Editing length out The Length Out attribute affects the locations of flexor points along the joint’s point group around the lower bone. When you enter a Length Out value, the lattices along the lower bone move away from or towards the joint. •
A positive Length Out value causes the flexor lattices to move away from the joint, spreading the bend effect down the lower bone.
•
A negative Length Out value causes the flexor lattices to move towards the joint, making the bend effect more local to the joint. When you change the Length Out value, you modify the regions affected by the round, crease, and width effects. The following figures illustrate postive and negative length out effects.
308
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes
Character Animation
Positive length out effect with joint lattice flexor
Negative length out effect with joint lattice flexor
Using Maya: Animation
309
Using Flexors Editing joint lattice flexor attributes
To edit length out: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Length Out, enter a new value or use the slider. A positive value causes the deformation to spread farther down the joint’s bone. A negative value causes the deformation to concentrate towards the joint. Note that you can also edit the length out attribute from the Channel Box.
Editing width left The Width Left attribute affects the bulging of a joint’s point groups on the left side of a bend. When you enter a Width Left value, the flexor points on the left side of the bend move outward or inward to change the shape of the bulge. •
A positive Width Left value causes the skin to bulge outward.
•
A negative Width Left value causes the skin to bulge inward. The following figures illustrate positive and negative width left effects.
Positive width left effect with joint lattice flexor
310
Using Maya: Animation
Using Flexors Editing joint lattice flexor attributes
Character Animation
Negative width left effect with joint lattice flexor
To edit width left: 1
View the joint lattice flexor’s attributes in the Attribute Editor.
2
In Width Left, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width left attribute from the Channel Box.
Editing width right Width Right affects the bulging of a joint’s point groups on the right side of a bend. When you enter a Width Right value, the flexor points on the right side of the bend move inward or outward to change the shape of the bulge. •
A positive Width Right value causes the skin to bulge outward.
•
A negative Width Right value causes the skin to bulge inward. The following figures illustrate positive and negative width right effects.
Using Maya: Animation
311
Using Flexors Editing joint lattice flexor attributes
Positive width right effect with joint lattice flexor
Negative width right effect with joint lattice flexor
To edit width right: 1
312
View the joint lattice flexor’s attributes in the Attribute Editor.
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes 2
In Width Right, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width right attribute from the Channel Box.
Editing bone lattice flexor attributes To edit bone lattice flexor attributes, use the Attributes Editor. Editing bone lattice flexor attributes includes: “Viewing bone lattice flexor attributes” on page 313
•
“Renaming bone lattice flexors” on page 314
•
“Editing length in” on page 314
•
“Editing length out” on page 316
•
“Editing width left” on page 318
•
“Editing width right” on page 311
•
“Editing bicep” on page 321
•
“Editing tricep” on page 322
Character Animation
•
Viewing bone lattice flexor attributes To view bone lattice flexor attributes: 1
Make sure the skeleton is not in the bind pose. Flexors don’t deform skin in the bind pose. To see the effects of flexors, you must view the skeleton in another pose.
2
Select a bone lattice flexor.
3
Choose Windows→Attribute Editor... . The Attribute Editor is displayed. In the Attribute Editor, you can modify attributes of lattice flexors on bones to create specific effects.
Using Maya: Animation
313
Using Flexors Editing bone lattice flexor attributes
Renaming bone lattice flexors By default, bone lattice flexors are given the name “boneFlexor” with a number added at the end. You can change the default name. Using names that describe the purpose of the lattice flexor can be helpful when you have a complex character with many flexors.
To rename a bone lattice flexor: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In the flexorShape: field, enter a new name.
Editing length in The Length In attribute affects the locations of flexor points along the bone’s point group. When you enter a Length In value, the flexor planes move away from or towards the center of the bone. •
A positive Length In value causes the lattices to move away from the center, spreading the bend effect to a greater area of the bone.
•
A negative Length In value causes the lattices to move towards the center, making the bend effect more localized. By changing the Length In value, you can lengthen or shorten the bulging created by the other deformation parameters. The following figures illustrate no effect, positive length in effect, and negative length in effect.
314
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Character Animation
No length in effect with bone lattice flexor
Positive length in effect with bone lattice flexor
Using Maya: Animation
315
Using Flexors Editing bone lattice flexor attributes
Negative length in effect with bone lattice flexor
To edit length in: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Length In, enter a new value or use the slider. A positive value causes the deformation to spread away from the center of the bone. A negative value causes the deformation to concentrate towards the center of the bone. Note that you can also edit the length in attribute from the Channel Box.
Editing length out The Length Out attribute affects the locations of flexor points along the bone’s point group. When you enter a Length Out value, the flexor planes move away from or towards the center of the bone. •
A positive Length Out value causes the lattices to move away from the center, spreading the bend effect to a greater area of the bone.
•
A negative Length Out value causes the lattices to move towards the center, making the bend effect more localized. By changing the Length Out value, you can lengthen or shorten the bulging created by other deformation parameters.
316
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes The following figures illustrate positive and negative length out effects.
Character Animation
Positive length out effect with bone lattice flexor
Negative length out effect with bone lattice flexor
Using Maya: Animation
317
Using Flexors Editing bone lattice flexor attributes
To edit length out: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Length Out, enter a new value or use the slider. A positive value causes the deformation to spread away from the center of the bone. A negative value causes the deformation to concentrate towards the center of the bone. Note that you can also edit the length out attribute from the Channel Box.
Editing width left Width Left affects the bulging of a bone’s point group on the left side of a bend. When you enter a Width Left value, the flexor points on the left side of the bend move outward or inward to change the shape of the bulge. •
A positive Width Left value causes the skin to bulge outward.
•
A negative Width Left value causes the skin to bulge inward. The following illustrate positive and negative width left effects.
Positive width left effect with bone lattice flexor
318
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Character Animation
Negative width left effect with bone lattice flexor
To edit width left: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Width Left, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width left attribute from the Channel Box.
Editing width right Width Right affects the bulging of a bone’s point group on the right side of a bend. When you enter a Width Right value, the flexor points on the right side of the bend move inward or outward to change the shape of the bulge. •
A positive Width Right value causes the skin to bulge outward.
•
A negative Width Right value causes the skin to bulge inward. The following figures illustrate positive and negative width right effects.
Using Maya: Animation
319
Using Flexors Editing bone lattice flexor attributes
Positive width right effect with bone lattice flexor
Negative width right effect with bone lattice flexor
To edit width right: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In Width Right, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the width right attribute from the Channel Box.
320
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Editing bicep Bicep affects the bulging of a bone’s point group on the inside of a bend. When you enter a Bicep value, the flexor points on the inside of the bend move outward or inward to change the shape of the bulge. •
A positive Bicep value causes the skin to bulge outward.
•
A negative Bicep value causes the skin to bulge inward. The following illustrate positive and negative bicep effects.
Character Animation
Positive bicep effect with bone lattice flexor
Using Maya: Animation
321
Using Flexors Editing bone lattice flexor attributes
Negative bicep effect with bone lattice flexor
To edit bicep: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In the Attribute Editor, choose Extra Attributes.
3
In Bicep, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the bicep attribute from the Channel Box.
Editing tricep The Tricep attribute affects the bulging of a bone’s point group on the outside of a bend. When you enter a Tricep value, the flexor points on the outside of the bend move outward or inward to change the shape of the bulge. •
A positive Tricep value causes the skin to bulge outward.
•
A negative Tricep value causes the skin to bulge inward. The following illustrate positive and negative tricep effects.
322
Using Maya: Animation
Using Flexors Editing bone lattice flexor attributes
Character Animation
Positive tricep effect with bone lattice flexor
Negative tricep effect with bone lattice flexor
To edit tricep: 1
View the bone lattice flexor’s attributes in the Attribute Editor.
2
In the Attribute Editor, choose Extra Attributes.
Using Maya: Animation
323
Using Flexors Creating sculpt flexors 3
In Tricep, enter a new value or use the slider. A positive value causes the skin to bulge outward, and a negative value causes the skin to bulge inward. Note that you can also edit the tricep attribute from the Channel Box.
Creating sculpt flexors You can create sculpt flexors at joints (joint sculpt flexors) or at the bones of joints (bone sculpt flexors). You can use sculpt flexors to make skin slide more realistically over a joint, or use them on bones to create bulges or dips as the joint moves.
To create a sculpt flexor: 1
Put the skeleton in bind pose by selecting any joint and choosing Skinning→Go to Bind Pose. It’s possible to create a sculpt flexor on a skeleton that’s not in the bind pose, but it’s not recommended—you might get unexpected results.
2
324
Select the joint or joints on which you want to create the flexor. If you want to create a bone sculpt flexor, select the bone’s parent joint. To create flexors on all joints or bones, select any joint of the skeleton.
Using Maya: Animation
Using Flexors Editing sculpt flexor attributes 3
Select Skinning→Create Flexor. The Create Flexor window is displayed.
4
From the Flexor Type: pull-down menu, choose sculpt.
5
Click the boxes under Joints and Bones to indicate where you want to position the flexor or flexors: at selected joints or all joints, and at selected bones or all bones.
6
Set the Max Displacement, Dropoff Distance, Dropoff Type, Mode, and Inside Mode options as you would for a basic sculpt object. These options are described in Using Maya: Animation, Basic Deformers.
7
Click OK to create the flexors on the joints and bones you indicated.
Editing sculpt flexor attributes To edit sculpt flexors: 1
Select the flexor you want to modify.
2
Open the Attribute Editor by selecting Window→Attributes. The sculpt flexor’s attributes are displayed.
3
Change the attributes as desired. These attributes are described in Using Maya: Animation, Basic Deformers.
Joint-driven sculpting To have a joint’s attributes drive the sculpt deformation, use the Set Driven Key tool. (For more information on Set Driven Key, please refer to Using Maya: Animation, Keyframe.)
To set joint-driven sculpting: 1
Put the skeleton in bind pose by selecting any joint and choosing Skinning→ Go to Bind Pose.
2
Select the sculpt flexor.
3
Select Keyframe→Set Driven Key... .
Using Maya: Animation
325
Character Animation
Once you have created the sculpt flexors, you manipulate them to deform the skin when the joints move. See “Joint-driven sculpting” on page 325.
Using Flexors Creating cluster flexors The Set Driven Key window is displayed. A default driver and driver attribute are loaded for you. The driver is the joint whose motion controls the animation of the sculpt deformation. The Attribute is the transform of driver joint that the sculpt deformation is specifically keyed to. Driver attributes include the following: autoGuide
The guide axis (or axes) correspond to the axes the joint is permitted to rotate in (based on the Joint Limits setting in the Attribute Editor). Auto Guide is the default and works well in most cases.
rotateX
The guide axis is the joint’s X-axis.
rotateY
The guide axis is the joint’s Y-axis.
rotateZ
The guide axis is the joint’s Z-axis.
maxXYZ
The guide axes are the joint’s X-, Y-, and Z-axes.
4
In the browser, select the attribute you want to animate.
5
Set the key by clicking Key. The key for the bind position of the character is created.
6
Select the handle of the joint chain, move the joint chain, and continue setting keys by clicking Key.
Creating cluster flexors Cluster flexors allow you to control how smoothly skin moves around joints during posing and animating.
326
Using Maya: Animation
Using Flexors Creating cluster flexors
Character Animation During skinning, cluster deformers are automatically created to bind skin point sets to joints. These cluster deformers that bind skin point sets to joints are called joint clusters. Joint clusters indicate their deformation effects on skin point sets by their drop-off values. The drop-off values are percentage values that indicate the range and magnitude of the deformation effects. By controlling the range and magnitude of drop-off, you can control the smoothness of skin around a joint. Cluster flexors provide a way for you to manipulate the drop-off directly. Rather than having to specify actual values for the percentages, you can use the cluster flexor’s manipulators to edit the deformation effects.
To create a cluster flexor: 1
Put the skeleton in bind pose by selecting any joint and choosing Skinning→Go to Bind Pose.
2
Select the joint (or joints) on which you want to create the flexor.
3
Choose Skinning→Create Flexor... . The Create Flexor window is displayed.
4
From the Flexor Type: pull-down menu, choose jointCluster.
Using Maya: Animation
327
Using Flexors Editing cluster flexor attributes 5
Click the boxes under Joints to indicate where you want to position the flexor or flexors: at selected joints or at all joints. Except for simple cases, you will probably want to adjust the cluster to position it and change the percentages for the best effect on the skin bending around the joint.
6
Click Create. Cluster flexors are created at the selected joints.
7
Open the Hypergraph by choosing Window→Hypergraph... . The Hypergraph will indicate the cluster flexor(s) as a “jointFlexor” with a number appended. The number indicates the order in which the flexors have been created. When you select the cluster flexor, note that a “J” is displayed near the cluster flexor’s joint.
Editing cluster flexor attributes To edit cluster flexors: 1
Select the cluster flexor you want to edit.
2
Open the Attribute Editor by selecting Window→Attribute Editor... . In the Attribute Editor, you can edit the attributes of the cluster flexor, the cluster flexor’s shape, and the joint cluster deformer (the cluster deformer that binds skin point sets to joints). The cluster flexor’s attributes folder is identified as “jointFlexorn,” the cluster flexor’s shape attributes folder is identified as “jointFlexor_Shape,” and the joint cluster deformer (the cluster deformer that binds skin point sets to joints) attributes folder is identified as “JointnClustern.”
3
Edit the attributes as desired. Note that the attributes of cluster deformers are described in Using Maya: Animation, Basic Deformers.
Editing with cluster flexor manipulators You can use the cluster flexor’s manipulators to edit the deformation effects of joint clusters. A cluster flexor’s manipulators include of pair of rings.
328
Using Maya: Animation
Using Flexors Editing with cluster flexor manipulators
Character Animation
Cluster flexor manipulator rings Each ring includes two manipulators: a diamond manipulator and a radial manipulator.
Using Maya: Animation
329
Using Flexors Editing with cluster flexor manipulators
Diamond manipulator
Diamond manipulator (selected) Located at the center of the ring, the diamond manipulator controls the range of smoothing. The diamond manipulator controls the range of dropoff of the joint clusters acting on the skin point sets bound to the current joint and the current joint’s parent joint.
330
Using Maya: Animation
Using Flexors Editing with cluster flexor manipulators
Radial manipulator
Character Animation
Radial manipulator (selected) Located on the ring, the radial manipulator controls the magnitude of smoothing. The radial manipulator controls the magnitude of drop-off of the joint clusters acting on the skin point sets bound to the current joint and the current joint’s parent joint.
To edit with the cluster flexor manipulators: 1
If you have just created the cluster flexor, you need to choose to have the cluster flexor manipulators displayed. In the Hypergraph, select the cluster flexor (identified as “jointFlexorn”). Open the Attribute Editor; from Display, click on Display Handle. A cross-shaped mark is displayed at the center of the joint, near the “J” that identifies the cluster flexor.
2
Select the joint with the Show Manipulator Tool. The cluster flexor manipulators are displayed.
3
Be sure the joint is not in the bind pose. Flexors do not provide deformation effects when the skeleton is in the bind pose. By having the joint in some other pose, you can see the effects of your editing.
4
To edit the range of smoothing, select one of the diamond manipulators.
5
Use the left mouse button to click and drag the diamond manipulator towards or away from the joint. The range of smoothing changes as you drag the manipulator. Using Maya: Animation
331
Using Flexors Editing with cluster flexor manipulators 6
To edit the magnitude of smoothing, select one of the radial manipulators.
7
Use the left mouse button to click and drag the radial manipulator towards or away from the joint. The magnitude of smoothing changes as you drag the manipulator. Note that you can also edit the drop-off values of joint clusters from the Attribute Editor. The Upper Value of the current joint’s joint cluster and Lower Value of the parent joint’s joint cluster are controlled by radial manipulators. The Upper Bound of the current joint’s joint cluster and Lower Bound of the parent joint’s joint cluster are controlled by the diamond manipulators. For total smoothing, the values, which are expressed as percentages, should be equal 100. Editing which skin points are in which skin point sets can also help to control smoothing effects.
332
Using Maya: Animation
Index
A
C
D
animating characters 11, 27 IK chains 124 keyframing 124 motion capture 125 necks, tails, spines 103 with skin and skeleton groups 136 attributes editing joints 55 setting IK spline handle 115 Auto Create Curve 113 Auto Create Root Axis 112, 122 Auto Joint Limits 54 Auto Joint Orient 53 Auto Parent Curve 122 Auto Simplify Curve 113 Autopriority 87
characters animating 27 deforming 25 flexors 25 geometry 12 modeling 12 skeletons 14 skinning 22, 127 child joints 16, 33 closest point binding by 130 cluster flexors 25, 143 creating 171 editing attributes 172 editing with manipulators 175 manipulators 172 Connect Joint 46 control vertices (CVs) 22 creating cluster flexors 171 IK chains 83 IK handles 82 IK spline handle 103 joint chains 36 joints 36 lattice flexors 145 parent transform with IK spline 112 sculpt flexors 168 Curve Editing Tool 105 curves auto-creating with IK spline handle 113 auto-simplifying with IK spline handle 113 IK spline handle 103 transforming IK handle 109
dampening joints 67 Degrees of Freedom 52, 60 dependency graph loops IK spline 112, 119 diamond manipulator 173 Disconnect Joint 49
B
end effectors 76, 79 displaying 84 end joints 35, 74, 76, 78
F fish animating with IK spline 118, 122 flexors 25, 140 cluster flexors 25, 143 lattice flexors 25, 140 sculpt flexors 25, 142 flipping eliminating in rotate plane (RP) solver IK handles 101 preventing IK spline start joint 116 flipping in motion path preventing IK spline start joint 117 forward kinematics 20, 70
Index
ball joints 52, 60 Bicep deformation 165 bind pose 133 reseting 133 returing to 133 binding by closest point 130 binding by partition set 131 binding multiple objects 132 bone lattice flexors 145 bones 14 bone lattice flexors 145 compensating scale 54, 64
E
G geometry 12 skin 22 skinning 127 Using Maya: Modeling
333
Index
goal displaying 84 goal’s axis displaying 84 goals 77, 79
H handle vectors 77, 79 handle wires 76, 78 human spines IK spline handle 120
I IK chains 35 animating 124 Autopriority 87 creating 83 posing 100 IK handles 14, 20, 35, 74 Autopriority 87 creating 82 editing attributes 94 editing display 96 editing limits 96 end joints 74 Priority 89 setting creation options 85 setting PO weight 90 setting weight 89 Snap Enable 88 Solver Enable 88 start joints 74 Sticky 89 IK solvers 21, 35, 75 editing attributes 97 IK spline solvers 81 multi-chain (MC) solvers 81 rotate plane (RP) solvers 77 single chain (SC) solvers 75
334
Using Maya: Modeling
IK spline handle 103 animating sinuous motion 122 auto-creating curve 113 auto-parenting curve 112 creating 103 curve 103 human spines 120 manipulating curve CVs 105, 119 motion path 117 offset 108 parenting to transform or joint 118 rolling 106 selecting 107 setting keys 106 sliding joint chain 107 snapping curve to start joint 113 soft body on curve 118 tail, back, and neck 121 tips for using 118 tool options 109 twisting 106 IK systems 98 accessing 99 creating 98 renaming 99 viewing available IK solvers 99 Insert Joint Tool 41 inverse kinematics 20, 70
J joint chain planes 79 joint chains 17, 33 adding to 37 creating 36 inserting joints 41 limbs 17
joint cluster points 23 joint clusters 23 joint lattice flexors 145 joint limits 64 Joint Orient 63 Joint Tool 36 joints 14, 32 Auto Joint Limits 54 Auto Joint Orient 53 ball joints 52 child joints 16, 33 compensating scale 54, 64 dampening 67 Degrees of Freedom 52, 60 disconnecting 49 editing attributes 55 editing joint limits 64 end joints 35, 74 inserting 41 joint chains 17, 33 joint lattice flexors 145 Joint Orient 63 limbs 34 local axis orientation 63 parent joints 16, 33 positioning 40 Preferred Angle 61 removing 42 renaming 58 resizing display 40 root joints 18, 32 Rotate Damp Range 68 Rotate Damp Strength 68 Scale Compensate 54 Segment Scale Compensate 64 setting creation options 50 start joint 35 start joints 74 Stiffness 62
Index
K
N
keyframing 124 minimum keys 124 using Channel Box 124 kinematics 70
Number of Spans 113, 114
L lattice flexors 25, 140 bone lattice flexors 145 creating 145 editing bone lattice flexor attributes 157 editing joint lattice flexor attributes 146 joint lattice flexors 145 positioning 146 Length in deformation 150, 158 Length out deformation 152, 160 limbs 17, 34 mirroring 45 limits joint limits 64
M
offset IK spline handle 108 overlapping IK spline handle joints 119
P parent joints 16, 33 partition set binding by 131 partitions 22 pelvic region positioning skeleton root in 123 plane indicators 80 PO weight 90 points 22 skin point sets 22 skin points 22 pole vector’s axis displaying 84 pole vectors 80 posing IK chains 100 sticky posing 102 Power Animator IK spline twisting in Maya 114 Preferred Angle 61 Priority 89
R radial manipulator 173
S Scale Compensate 54 sculpt flexors 25, 142 creating 168 editing attributes 169 joint-driven sculpting 169 seals animating with IK spline 122 Segment Scale Compensate 64 selecting IK spline handle 107
Using Maya: Modeling
335
Index
Mirror 45 Mirror Across 45 Mirror Joint 45 mirroring 43 modeling 12 motion capture 125 motion paths IK spline handle 117 moving start joint off IK spline curve 111 multi-chain (MC) solvers 81 activating 87
O
reference planes 80 Remove Joint 42 Reroot Skeleton 50 rerooting skeletons 50 rolling IK spline handle 106 root joints 18, 32 Root on Curve 107 Root Twist Mode 114 Rotate Damp Range 68 Rotate Damp Strength 68 rotate plane (RP) solvers 77 behavior 81 end effectors 79 end joints 78 goals 79 handle vectors 79 handle wires 78 joint chain planes 79 plane indicators 80 pole vectors 80 reference planes 80 rotation discs 80 start joints 78 twist discs 80 rotation discs 80 Rounding deformation 149
Index
setting keys IK spline handle 106 single chain (SC) solvers 75 behavior 77 end effectors 76 end joints 76 goals 77 handle vectors 77 handle wires 76 start joints 76 sinuous motion IK spline handle 122 skeletons 14, 32 animating 14 building 14, 31 combining 46 construction strategies 50 disconnecting 49 flexors 25 mirroring 45 posing 14 rerooting 50 skinning 22, 127 viewing hierarchy outline 39 skin binding 127 skin point sets 22 skin point sets 22 displaying colors 134 editing 134 skin points 22 skinning 22, 127 binding by closest point 130 binding by partition set 131 binding multiple objects 132 detaching skin 134 reattaching skin 134 sliding joint chain along curve 107 snakes animating with IK spline 118, 122
336
Using Maya: Modeling
Snap Curve To Root 113 Snap Enable 88 Solver Enable 88 IK spline handle 115 spline solvers 81 start joint flipping in motion path 117 preventing IK spline 116 start joints 35, 74, 76, 78 stickiness 102 Sticky 89 sticky posing 102 Stiffness 62
T tips building skeletons with grid 32 IK chain length 35 IK chains with rotate plane (RP) solvers 81 IK chains with single chain (SC) solvers 77 IK spline handle creation 118 skeletons with many limbs 34 using mirroring to create limbs 43 tool options IK spline handle 109 transforming IK spline handle curve 109 Tricep deformation 166 twist discs 80 displaying 84 Twist Type 115 twisting IK spline handle 106
V vertices 22
W Width left deformation 154, 162 Width right deformation 155, 163
Z zero rotation IK spline joint orientation 116
Maya Live
™
Maya Live makes realistic mixing of 3D graphics with live-action scenes fast, easy and accurate. BREAK THE BARRIER Maya Live an
ADVANCED MODULE for MAYA the next-generation 3D software for creating high quality character animation & visual effects
Maya Live breaks the live-action barrier for 3D animators, matchmovers, and designers who need to create extraordinary visual effects and stunning design visualizations. With unique automated tools, Maya Live eliminates virtually all of the tedious manual work previously required to mix 3D and live-action. Maya Live turns days of manual work into hours, freeing artists to concentrate on the creative aspects of their projects.
THE PERFECT MATCH™ From live-action footage alone, Maya Live creates a Maya camera which duplicates all essential characteristics of the original camera used to shoot the scene. This duplicate camera is used to render images in Maya. When the rendered images are combined with the live-action scene, the result is a precise match between the 3D graphics and the live-action footage. There is virtually no slipping‚ even with complex camera moves. Maya Live runs inside Maya for the smoothest possible workflow.
Maya Live provides an integrated 2D/3D workspace.
JET SET™ 3D SCENE RECONSTRUCTION Maya Live enables artists to easily reconstruct elements of live-action scenes as 3D geometry in Maya. Maya Live provides an integrated 2D/3D workspace containing the reconstructed geometry, the liveaction plates, and any other Maya models. This integrated workspace allows artists to position, orient, scale, and choreograph 3D elements accurately relative to live-action scenes.
SAMPLE APPLICATIONS
More Tools for
3 D M i n d s
Add 3D characters and 3D objects such as cars, buildings, and products, into live-action scenes. Use Maya Live to add 3D dinosaurs running across a live-action highway, or add 3D cars into a live-action showroom. Add live-action elements into 3D virtual environments. Shoot live-action actors on a blue screen and put them on the deck of a Maya-rendered ocean liner, or shoot a furniture sample and render it into different, virtual rooms for presentation.
T E C H N I C A L
JET SET SCENE RECONSTRUCTION
Fa c t s & F e a t u r e s GENERAL Maya Live handles the most challenging shots, from almost any source. Flexibility
• Use almost any live-action scene,
including new, archival, or stock footage, as source images for Maya Live. Both film and video source images are supported. • The need for special setup, calibration, or markers for the live-action shoot is greatly reduced. If desired, markers may be placed in scenes to designate desired positions of the 3D objects to be added later. • Maya Live greatly reduces the need for motion control rigs or camera mounts. • Information about the camera or lens that was used to shoot the live-action scene is no longer needed to match the live-action footage. • Measurements of the live-action set are no longer required. If known, set measurements may be entered into Maya Live.
Robustness
• The camera moves are not restricted
in the live-action scene. Bouncing, handheld, slow pans, dollies, tracking shots, aerial shots, tilts, zooms, and more, are all supported. • Maya Live works with a wide variety of scales - miniatures, wide exterior shots, and everything in between.
Reconstruct elements of live-action scenes as 3D geometry in Maya.
• Respects user-specified values for camera parameters, if actual values are known. • Incorporates real-world physical constraints on camera movement into the automated camera solution, if desired. Helps ensure that camera moves calculated with Maya Live can be run on motion control rigs. • Uses distance measurements from the live-action set, if known. • Allows multiple user-selectable quality settings. Fast, Integrated 2D point Tracker
• Subpixel accuracy. • Multiple correlation modes. • Multiple color spaces. • Smart update behavior. • Intelligent error handling. • Tracking curve editor/smoother. • Bidirectional tracking. • Variable target size and search range. • Track points may move in and out of frame. Subpixel-Level Camera Adjustments
• A unique, through-the-lens interactive camera control adjusts the Maya camera indirectly, as a result of manipulating 3D objects in the scene. This lets artists focus naturally on fixing mismatches between the 3D objects and live-action features, instead of focusing on the 3D camera in a lengthy process of trial and error. • Camera "nudge" controls allow ultra-fine direct camera adjustments.
any reconstructed geometry, and any other Maya models. This integrated workspace allows artists to position, orient, scale, an choreograph 3D elements realistically and intuitively relative to live-action scenes.
Tight Integration with Maya
Locations
• Places Maya 3D locaters in the true 3D positions of user-designated features in the live-action scene. This allows easy reconstruction of scene geometry, and precise positioning of 3D objects relative to the live action scene. Registration
• Automatically aligns and sizes the 3D
Maya world to register with the world in the live-action scene. Allows intiutive choreography of 3D objects, and realistic dynamic interactions between 3D and live-action elements. For example, aligns the Maya "gravity" force with the liveaction world. • Places the Maya ground plane in the true location of the ground plane in the liveaction scene, for reference when animating objects, and realistic dynamic effects.
EFFICIENT WORKFLOW Maximizes productivity and quality. Simple, Task-Based User Interface
• Easily mastered by animators, matchmov-
ers, and designers.
Integrated 2D/3D Workspace
• Maya Live provides an integrated 2D/3D
workspace containing the live-action plates,
• Maya integration allows immediate
viewing, and evaluation, of final results. Unlike obsolete, non-integrated approaches for mixing 3D with live action, what you see is what you get‚ with Maya Live. This significantly shortens the evaluation cycle. • The full power of Maya, including camera control, modeling, rendering, and animation, is always easily accessible from within Maya Live.
H I G H LY C O M P AT I B L E Maya Live fits the production environment. Multiple File Formats
• Supports common image file formats
including TIFF, Alias Pix, Cineon, RGB, and SGI Movie. • Supports square and non-square pixels.
Import and Export
• Import and export tracked points to and
from Alias|Wavefront Composer, and other software packages, via text files. • Improve motion control camera moves, by importing motion control data into Maya Live, applying the Maya Live tools to the scene, and exporting the camera move. • Import and export entire scenes, including 3D camera solutions, in all formats supported by Maya.
P E R F E C T M AT C H C A M E R A M AT C H I N G A suite of automatic and interactive tools delivers the highest standards of realism, accuracy, and reliability. Powerful Automatic Camera Solver
• Maya Live's automatic matchmoving
system duplicates the live-action camera as a Maya camera, including camera translations, camera rotations, and camera lens focal length, even as these parameters change dynamically over time. • Provides fast preview of camera matchmove solution. • Compensates for lens distortion.
UNITED STATES FIELD OFFICES ATLANTA BOSTON CHICAGO DALLAS DAYTON DETROIT HOUSTON LOS ANGELES MINNEAPOLIS NEW YORK SAN FRANCISCO SEATTLE WASHINGTON
Tel: 770.393.1881 Tel: 617.270.0606 Tel: 847.397.5280 Tel: 972.789.2950 Tel: 937.258.7441 Tel: 248.737.3500 Tel: 713.780.9292 Tel: 310.914.1566 Tel: 612.339.5820 Tel: 212.268.4900 Tel: 415.596.7000 Tel: 206.287.5600 Tel: 301.572.3265
Fax: 770.393.2705 Fax: 617.270.0608 Fax: 847.397.6067 Fax: 972.789.2951 Fax: 937.258.7449 Fax: 248.737.3506 Fax: 713.780.9296 Fax: 310.914.1580 Fax: 612.339.5939 Fax: 212.563.9418 Fax: 415.596.7002 Fax: 206.667.9049 Fax: 301.572.3280
Maya Live enables easy, accurate placement of real objects into 3D virtual environments. INTER NA TIO NA L F IEL D O F F IC ES AUSTRALIA BELGIUM FRANCE GERMANY HONG KONG ITALY JAPAN LATIN AMERICA MALAYSIA SINGAPORE UNITED KINGDOM
Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel:
61.2.9956.3819 32.9.266.1212 33.1.44.92.81.60 49.89.31.70.20 852.2519.4412 39.39.605.8272 81.3.3470.8282 1.305.919.8200 60.3.209.4703 65.435.0458 44.1494.441.273
Fax: 61.2.9437.6574 Fax: 32.9.266.1210 Fax: 33.1.44.92.81.61 Fax: 49.89.31.70.2199 Fax: 852.2827.4227 Fax: 39.39.605.8281 Fax: 81.3.3470.8288 Fax: 1.305.919.8300 Fax: 60.3.209.4705 Fax: 65.536.8502 Fax: 44.1494.449.289
G L O B A L H E A D Q U A RT E RS 210 King Street East Toronto Ontario Canada M5A 1J7 TOLL FREE: TEL: FAX: E-MAIL: WEB:
800.447.2542 416.362.9181 416.369.6140 [email protected] www.aw.sgi.com
© 1998 Alias|Wavefront, a division of Silicon Graphics Limited, all rights reserved. Alias|Wavefront, Maya, the Maya logo, Tools For 3D Minds, Maya Live, Jet Set and Perfect Match are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Silicon Graphics and OpenGL are registered trademarks of Silicon Graphics, Inc. All other trademarks mentioned herein belong to their respective owners.
Polygonal Modeling
Polygonal Modeling 9 Polygonal Modeling
407
Introduction to polygonal modeling Solids
408
408
Polygonal surfaces
408
Texturing polygons
409
Importing foreign polygonal objects Menus for polygonal modeling
409
410
Selecting polygonal objects and components Hotkeys for polygonal modeling Using the construction history Using actions and tools Quick start
411
415 417
417
417
10 Learning the Basics
427
Creating a polygonal sphere
429
Setting Sphere options
430
Creating a polygonal cube
431
Setting Cube options
432
Creating a polygonal cylinder
433
Setting Cylinder options
434
Creating a polygonal cone
436
Setting Cone options
437
Creating a polygonal plane
438
Setting Plane options
439
Creating a polygonal torus Setting Torus options
440 441
Using Maya: Modeling
iii
NURBS Modeling in Maya Contents Creating polygonal text Creating a polygon
442
443
Repositioning a point
443
Setting Create Tool options Appending facets to a polygon
446 448
Making a hole in a polygon
449
Setting Append Tool options Splitting facets
453
Setting Split Tool options Moving vertices
450
454
456
Setting Move Vertex Options Changing the pivot
457
458
Best way of moving vertices, facets, or edges Moving facets
460
Setting Move Facet options Changing the pivot Moving edges
461
462
463
Setting Move Edge options Changing the pivot
464
465
Subdividing edges or facets
466
Setting Subdivision options Keeping facets together Creating an extrusion
467
469 470
Extruding perpendicular to the geometry Repeating extrusions
471
Changing an extrusion
471
Changing the extrusion mode Using the local and global pivot Changing the pivot
472
Setting Extrusion options Deleting edges
iv
478
Using Maya: Modeling
476
471 472
471
458
NURBS Modeling in Maya Contents Deleting vertices Deleting facets
479 480
11 Beyond the Basics Collapsing edges or facets
481 483
Softening and hardening edges
486
Setting Soften/Harden Edge options Closing a border Merging edges
488
489 490
Setting Merge Edge options Beveling polygons
491
492
Setting Bevel options
493
Extracting parts of polygons
496
Extracting perpendicular to the geometry Changing the extraction Changing the pivot
496
497
Setting Extraction options
498
Duplicating parts of polygons
500
Duplicating perpendicular to the geometry Changing the duplicate Changing the pivot
500
500
501
Setting Duplicate options Triangulating
496
502
504
Quadrangulating
505
Setting Quadrangulate options Trimming facets
505
510
Setting Trim Facet options Changing the normals
510
512
Using Maya: Modeling
v
NURBS Modeling in Maya Contents Uniting polygons
514
Separating polygons
515
Smoothing polygons
516
Setting the Smooth option
517
Using smart command settings
519
Applying an action to several components Cancelling smart command settings
12 Texturing Polygons Mapping polygons
520
521
523
524
Creating a projection
525
Map-positioning manipulators U and V space
526
526
Example of projecting maps Making a planar map
527
528
Using the planar mapping manipulators Setting Planar Projection options Changing the projection center Changing the projection scale Making a cylindrical map
532
533 536 537
538
Using the cylindrical mapping manipulators Setting Cylindrical Projection options Changing the projection center
541
542
Changing the projection scale width Making a spherical map
542
543
Using the spherical mapping manipulators Setting Spherical Projection options Changing the projection center Assigning a shader to each projection The Texture View
vi
549
Using Maya: Modeling
539
546
547 548
544
NURBS Modeling in Maya Contents Using the Texture View Moving texture coordinates
549 553
Displaying the Texture View manipulators Mapping objects
554
Rendering the mapped object Example of mapping a head Setting Move UV options Changing the pivot Deleting a map
557 558
561
561
562
Cutting textures
563
Sewing textures
564
13 Using selection constraints Selecting components
565
566
Constraints for facets
568
Constraints for vertices
577
Constraints for edges
579
Extending a selection
582
14 Examples of polygonal models Making a hand
553
585
586
Using duplicates to work faster Doing a negative scaling
589
593
Using Maya: Modeling
vii
NURBS Modeling in Maya Contents
viii
Using Maya: Modeling
9
Polygonal Modeling This chapter provides an overview of polygonal modeling and explains how to begin using the polygonal modeling features in Maya.
Polygonal Modeling
Topics include: •
“Introduction to polygonal modeling” on page 408
•
“Solids” on page 408
•
“Polygonal surfaces” on page 408
•
“Texturing polygons” on page 409
•
“Importing foreign polygonal objects” on page 409
•
“Menus for polygonal modeling” on page 410
•
“Hotkeys for polygonal modeling” on page 415
•
“Redefining hotkeys for polygonal modeling” on page 416
•
“Using the construction history” on page 417
•
“Quick start” on page 417
Using Maya: Modeling
407
Polygonal Modeling Introduction to polygonal modeling
Introduction to polygonal modeling To create polygonal models in Maya, you should be familiar with some underlying concepts. This section defines what polygons are and provides some basics on working with polygonal models once they are created. You can use polygons to construct and control objects. Polygons are shapes formed from a sequence of line segments. Polygons, unlike curves and surfaces which are NURBS-based, are based on a standard B-Rep structure. B-Rep stands for Boundary Representation. Many shapes in Maya can be started using primitives or basic shapes. Primitives are pure shapes that can be used as the basis of creating more complex models. To create a primitive, select Primitives → Create Polygons and select the primitive you want to create. For more information on primitives, see “Learning the Basics” on page 427. A facet is defined as the linkage of vertices. It can be convex or concave, and may contain holes. A facet can be non-planar, but you are advised to keep them planar. A polygonal object is a set of connected facets. When it is closed, it forms a solid. With polygonal modeling, you can perform many operations such as extrusion or shape modification.
Solids A solid consists of facets meshed together to create a closed volume. Each edge in a solid is shared by exactly two facets. A solid always has an inside and outside defined by the direction of the normals. A normal refers to a directional line perpendicular to a surface. When you’re standing on the floor, the direction normal to the surface is straight up and down, with the surface of the floor being zero. This makes it easy to mathematically describe a position anywhere on that line. You can create solids either directly as primitives (spheres, cylinders, cones, boxes, or torus) by conversion from closed surfaces, or from non-solid polygonal objects handled with polygonal operations (such as Close Border).
Polygonal surfaces A polygonal surface consists of facets meshed together, but not enclosing a volume. Each edge is shared by one (at the surface borders) or two facets.
408
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling You can create polygonal surfaces either directly as primitives (meshes) by conversion from NURBS surfaces, or from polygons that you make using the polygon tools. You convert from NURBS to polygons, so you can optimize for speed, precision, or flexibility as needed.
Texturing polygons You can add texture maps to polygonal models with polygonal mapping functions. A texture map is assigned to a polygonal model to give the model more visual interest.
A soda can with a map.
Polygonal Modeling
The example below shows a soda can made of polygons. Two different labels are fitted or mapped around the cans to give them a distinct visual appearance. Once you have created the polygonal model and mapped a texture to it, rendering is a fairly easy task.
The same soda can with another map.
You have a choice as to how the label is mapped onto the can. Because the can is cylindrical in shape, cylindrical mapping is an obvious choice. For more information on texturing polygons, see “Texturing Polygons” on page 523.
Importing foreign polygonal objects Maya allows you to create only topologically valid polygonal objects, that is, solids or surfaces. However, you can import inconsistent polygonal descriptions from other systems, via CAD interfaces. Using Maya: Modeling
409
Polygonal Modeling Introduction to polygonal modeling Non-valid polygonal objects can have a good topology to be a surface or a solid but are not oriented correctly. For instance, a cube with some facet normals pointing towards the inside whereas the others pointing towards the outside. Therefore, Maya includes some normals-handling functions, like Normals Reverse that quickly solve these types of errors. Other non-valid objects often need more handling manipulations (as in the case of a cube with one or more dangling facets sharing one of the cubes’ edges). You will find, however, that these are not very common. From now on, we will use the simpler term polygon instead of polygonal object.
Menus for polygonal modeling The Polygon menu contains the set of actions and tools, with which you create, edit, and manipulate polygonal objects. While pressing and holding the Space bar in any view, click the word Polygons.
410
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling You can view sub-menus for some items. For example, clicking Facets displays related menu items. A further set of menu items is available for creating and editing polygonal primitives such as boxes and cones. While pressing and holding the Space bar in any view, click the word Primitives, then the words Create Polygons.
Polygonal Modeling
Selecting polygonal objects and components The concept of Object selection and Component selection are important in polygonal modeling. In Object selection mode, you are selecting entire objects and you can select only objects. In Component selection mode, you are selecting elements within objects—for example, when you want to move a vertex. You can be in only one of these modes at a time. You’ll need to switch from Object selection to Component selection when you want to change a component of an object and vice versa. You can select four different types of components: vertices, edges, facets, or UV points. You can switch from one component mode to another, but you can select only one component mode at a time.
Switching between Object and Component selection To work on objects or components, you can switch between Object selection mode and Component selection mode and vice versa: •
by pressing F8 (This acts as a toggle between Object and Component selection; see “Hotkeys for polygonal modeling” on page 415.)
Using Maya: Modeling
411
Polygonal Modeling Introduction to polygonal modeling •
by clicking the Select by object type icon as shown:
Click to toggle on Object selection.
•
by clicking the Select by component type icon as shown:
Click to toggle on Component selection.
Selecting a component After you enter Component mode, you can select four types of components—vertices, edges, facets, or UV points. When you click-drag a selection in this mode, you can select only components. You can select a component by using a function key, clicking an icon, or using the marking menu. The component you select becomes the selected item and will be highlighted in a view. The following sections explain the different methods of selecting components.
To work on vertices: Select an object and then use one of the following three ways to turn on vertex selection: •
Press F9.
•
Click the Select by component type icon. With the right mouse button, click the Points icon and toggle Poly Vertices on from the pop-up menu.
Click the Poly Vertices icon to toggle on vertex selection.
412
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling •
Place the pointer over the active object, and use the right mouse button to select Vertex from the marking menu.
To work on edges: Select an object and then use one of the following three ways to turn on edge selection: •
Press F10.
•
Click the Select by component type icon. With the right mouse button, click the Lines icon and toggle Poly Edges on from the pop-up menu.
Click the Poly Edges icon to toggle on edge selection.
Using Maya: Modeling
413
Polygonal Modeling
In a view, drag to select Vertex.
Polygonal Modeling Introduction to polygonal modeling •
Place the pointer over the active object, and use the right mouse button to select Edge from the marking menu.
In a view, drag to select Edge.
To work on facets: Select an object and then use one of the following three ways to turn on facet selection: •
Press F11.
•
Click the Select by component type icon. With the right mouse button, click the Facets icon and toggle Facets on from the pop-up menu.
Click the Facets icon to toggle on facet selection.
414
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling •
Place the pointer over the active object, and use the right mouse button to select Facet from the marking menu.
To work on UV points: Select an object and then use one of the following three ways to turn on UV point selection: •
Press F12.
•
Click the Select by component type icon. With the right mouse button, click the Parm Points icon and toggle Poly UVs on from the pop-up menu.
Click the Poly UVs icon to toggle on UV point selection.
•
Place the pointer over the active object, and use the right mouse button to select Facet from the marking menu.
Hotkeys for polygonal modeling Maya includes the following keyboard shortcuts:
Using Maya: Modeling
415
Polygonal Modeling
In a view, drag to select Facet.
Polygonal Modeling Introduction to polygonal modeling
Shortcut
Function
F8
toggles between object and component selection
F9
vertex selection
F10
edge selection
F11
facet selection
F12
texture coordinate selection
W
move
E
rotate
R
scale
G
repeat an action
With the function keys, you can switch from one component to another quickly and easily.
Redefining hotkeys for polygonal modeling You can customize keyboard shortcuts as you like. For polygonal modeling, you might find it handy to remap certain function keys, so they are closer to other frequently used keys such as the Q, W, E, R, T, and Y. Select Options → Customize UI → Hotkeys and remap the keys as follows:
416
Using Maya: Modeling
Default key
Remap to
F8
'
F9
1
F10
2
F11
3
F12
4
Polygonal Modeling Introduction to polygonal modeling By default, the single quote character (') is mapped to Set keyboard focus to command line and the 1 is mapped to Low Quality Display Setting (the Z Display option in NURBS). If you do not plan to use NURBS or the Set keyboard focus to command line, then you can redefine these keys for polygonal modeling.
Using the construction history
You can change a particular item that is already part of the construction history for a polygonal model the way you would any other modeling operation. However, changing the topology of a particular item already part of the construction history may in turn produce different results for subsequent operations in the construction history. For example, let’s say that you did an extrusion while you were creating your models. If you go back to a previous item in the construction history and subdivide a facet, it is difficult to predict which facet is extruded subsequently in the construction history, and this affects the final result.
Using actions and tools Once you start to do polygonal modeling, you apply actions for most tasks. This means that you select an item and apply an action to it. For example, Extrude is an action because you need to select an item before you can do the extrusion. For tools such as Create Polygon Tool, or Append Polygon Tool, you set options in the tool’s option window, select the tool and then select the item. Tools have the word Tool after them in the menu.
Quick start You can master Maya's polygonal modeling with only a handful of commands. By using four simple polygonal commands combined with the Transform manipulators (Move, Rotate, and Scale Tools), and following a few basic rules, you can get quick results in polygonal modeling.
Using Maya: Modeling
417
Polygonal Modeling
Construction history keeps track of the operations you do to build your models. Because this history is associated with your model, it may slow down the animation of your models unless you discard it. Therefore, you should delete the construction history before doing an animation so that animations run faster. Also, deleting the construction history before saving your models makes your models load faster.
Polygonal Modeling Introduction to polygonal modeling To help you get started, this section outlines the basic steps of making a polygonal hand. If you want to create the hand yourself, you should refer to the following sections for more details on the commands. These commands form the typical polygonal workflow and are explained in more detail as you move through the polygonal modeling part. Extrude Transform Split Smooth Create
Four basic polygonal modeling functions combined with the Transform manipulators (Move, Rotate, and Scale).
This example shows how to create a polygonal model from scratch, extrude it, split facets, and smooth it. The following examples provide an overview of the workflow.
To begin building a hand: 1
Make a polygonal shape such as the following: Create a polygon using either polygonal primitives (Primitives → Create Polygons) or the Create Polygon Tool (Polygons → Create Polygon Tool). For details, see “Creating a polygon” on page 443. As you can see, drawing an object is a simple series of clicks. As you draw, Maya displays the outline of the object, so you can experiment with the shape before completing the action.
Draw a polygonal shape using Create Polygon Tool. You click four points with the left mouse button.
418
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling If the polygon isn’t the shape you want, you can correct the shape using the Channel Box.
After you create an object, you can change the object’s parameters in the Channel Box.
Polygonal Modeling
The following figures illustrate steps for creating the hand.
To rapidly select a facet, press F11 and drag over the facet.
The same view in wireframe.
Select components, before you apply an action to them. Press F11 so the components selected when you click-drag are facets in this example. To select other components, see “Hotkeys for polygonal modeling” on page 415.
To move a facet, display the Move Tool by pressing W and then move.
The same view in wireframe.
Using Maya: Modeling
419
Polygonal Modeling Introduction to polygonal modeling
420
To rotate a facet, display the Rotate Tool by pressing E and then rotate.
The same view in wireframe.
To scale a facet, display the Scale Tool by pressing R and then scale.
The same view in wireframe.
The Extrude manipulator appears when you are extruding a shape.
The same view in wireframe.
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling
The same view in wireframe.
Extrude the polygonal shape sideways along the Z-axis (The Z-axis displays in blue in the online document.) to create the wrist. A small scaling was done along the X- and Y-axis.
The same view in wireframe.
Extrude to create the base of the thumb. Rotate along the Y-axis and translate slightly along the Z-axis.
The same view in wireframe.
Polygonal Modeling
Extrude the polygonal shape upwards along the Y-axis (The Y-axis displays in yellow in the online document).
Using Maya: Modeling
421
Polygonal Modeling Introduction to polygonal modeling 2
To transform the block into a hand, use the Split Polygon Tool to prepare where the fingers are to go.
Before splitting.
After splitting, the side is divided into four facets, corresponding to where the four fingers will be.
3
Select the five facets that you are going to extrude by pressing F11.
Extrude to make the split facets become the elongated fingers of the hand.
Extrude to make the shapes for the fingers and thumb.
422
Split this side.
Using Maya: Modeling
And in wireframe.
Polygonal Modeling Introduction to polygonal modeling In the Attribute Editor, you can see that the fingers and thumb were extruded using a local translation along the Z-axis (-1.9448) and were scaled along the X-, Y-, and Z-axis (0.85).
The values in the Attribute Editor.
You can use the Channel Box to quickly change values and settings after an operation. 4
Continue to extrude the fingers, including the thumb. At any stage, you can reshape or scale or move or resize individual fingers using the Move, Rotate, or Scale Tools. See the Using Maya: Basics book on how to use the Transform manipulators (Move, Rotate, and Scale).
More extruding along the Z-axis and a scaling of 0.8333 in the X-, Y-, and Z-axes.
And in wireframe.
Using Maya: Modeling
423
Polygonal Modeling
And the same values in the Channel Box.
Polygonal Modeling Introduction to polygonal modeling
5
424
More extruding along the Z-axis and a scaling of 0.8333 in the X-, Y-, and Z-axes.
Matching hand in wireframe.
Before smoothing.
Matching hand in wireframe.
Make the hand smooth using Polygons → Smooth.
Using Maya: Modeling
Polygonal Modeling Introduction to polygonal modeling
Polygonal Modeling
Smoothed hand
Matching hand in wireframe
Where I can learn more? For more information on these tasks, refer to the following table.
Typical Tasks
Where to look
Creating polygons
“Creating a polygon” on page 443
Extruding shapes
“Creating an extrusion” on page 470
Splitting facets
“Splitting facets” on page 453
Smoothing objects
“Smoothing polygons” on page 516
Using Maya: Modeling
425
Polygonal Modeling Introduction to polygonal modeling
426
Using Maya: Modeling
10
Learning the Basics This chapter shows you how to create polygonal models, explains how to modify their shape by extruding and splitting facets, and shows you how to move and subdivide components.
Polygonal Modeling
Topics include: •
“Creating a polygonal sphere” on page 429
•
“Creating a polygonal cube” on page 431
•
“Creating a polygonal cylinder” on page 433
•
“Creating a polygonal cone” on page 436
•
“Creating a polygonal plane” on page 438
•
“Creating a polygonal torus” on page 440
•
“Creating a polygon” on page 443
•
“Appending facets to a polygon” on page 448
•
“Splitting facets” on page 453
•
“Moving vertices” on page 456
•
“Moving facets” on page 460 Using Maya: Modeling
427
Learning the Basics
•
“Moving edges” on page 463
•
“Subdividing edges or facets” on page 466
•
“Keeping facets together” on page 469
•
“Creating an extrusion” on page 470
•
“Deleting edges” on page 478
•
“Deleting vertices” on page 479
•
“Deleting facets” on page 480 The six polygonal primitives are basic shapes that everyone can make use of. What follows is a description of how to create and modify each polygonal primitive.
428
Using Maya: Modeling
Learning the Basics Creating a polygonal sphere
Creating a polygonal sphere Use Create Polygons → Sphere to create spherical primitives.
To create a polygonal spherical primitive: Select Primitives → Create Polygons → Sphere. By default, the primitive appears centered at the world coordinate system. You can move the primitive to any location with the Move Tool (W). To specify precise values for a rotation, scale, or a move, enter values in the Channel Box. Polygonal Modeling
Create a polygonal sphere
After you create a spherical primitive, you can change settings in the Channel Box.
The primitive is created with the default settings in the options window. You can change the settings for these options before you create the sphere.
Using Maya: Modeling
429
Learning the Basics Creating a polygonal sphere
Setting Sphere options You can change the default options so that the next time you create a new sphere primitive, it uses the new settings. Select Primitives → Create Polygons → Sphere - ❐ to display the options window.
Radius
Use the slider or type a value to change the size of the sphere.
Subdivisions
Use the slider or type a value to change the subdivisions of the primitive. For a sphere, you can enter subdivisions in X and Y only. Enter at least three meridians (north-south lines) and three parallels (east-west lines).
Axis
Changes the orientation of the primitive to the X-, Y-, or Z-axis. By default, primitives are created along the Y-axis.
Texture
By default, UV values are assigned for texture mapping. If you do not plan to map textures on a ball, you can turn off this option.
430
Using Maya: Modeling
Learning the Basics Creating a polygonal cube
Creating a polygonal cube Use Create Polygons → Cube to create box primitives.
To create a polygonal cube primitive: Select Primitives → Create Polygons → Cube. By default, the primitive appears centered at the world coordinate system. You can move the primitive to any location by using the Move Tool (W). To specify precise values for a rotation, scale, or a move, enter values in the Channel Box. Polygonal Modeling
Create a polygonal cube
After you create a cube primitive, you can change settings in the Channel Box.
Using Maya: Modeling
431
Learning the Basics Creating a polygonal cube The primitive is created with the default settings in the options window. You can change the settings for these options before you create the cube.
Setting Cube options You can change the default options so that the next time you create a new cube primitive, it is created according to the new settings. Select Primitives → Create Polygons → Cube - ❐ to display the options window.
Width
Use the slider or type a value to change the width of the cube.
Height
Use the slider or type a value to change the height of the cube.
Depth
Use the slider or type a value to change the depth of the cube.
Subdivisions
Use the slider or type a value to change the subdivisions of the cube. For a cube, enter the number of subdivisions for the front and back, top and bottom, and the sides.
Axis
Allows you to change the orientation of the cube by choosing the X-, Y-, or Z-axis.
Texture
By default, UV values are assigned for texture mapping. If you do not plan to map textures on polygonal primitives, you can turn off this option.
432
Using Maya: Modeling
Learning the Basics Creating a polygonal cylinder
Creating a polygonal cylinder Use Create Polygons → Cylinder to create cylindrical primitives.
To create a polygonal cylindrical primitive: Select Primitives → Create Polygons → Cylinder. By default, the primitive appears centered at the world coordinate system. You can move the primitive to any location with the Move Tool (W). To specify precise values for a rotation, scale, or a move, enter values in the Channel Box. Polygonal Modeling
Create a polygonal cylinder
Using Maya: Modeling
433
Learning the Basics Creating a polygonal cylinder
After you create a cylindrical primitive, you can change settings in the Channel Box.
The primitive is created with the default settings in the options window. You can change the settings for these options before you create the cylinder.
Setting Cylinder options You can change the default options so that the next time you create a new cylinder primitive, it is created according to the new settings. Select Primitives → Create Polygons → Cylinder - ❐ to display the options window.
434
Using Maya: Modeling
Learning the Basics Creating a polygonal cylinder
Use the slider or type a value to change the radius of the cylinder.
Height
Use the slider or type a value to change the height of the cylinder.
Subdivisions
Use the slider or type a value to change the subdivisions of the cylinder. For a cylinder, enter number of subdivisions (three or more meridians with at least one parallel, and zero or more concentric subdivisions).
Axis
Allows you to change the orientation of the primitive by choosing the X-, Y-, or Z-axis.
Texture
By default, UV values are assigned for texture mapping. If you do not plan to map textures on the polygonal cylinder, you can turn off this option.
Using Maya: Modeling
435
Polygonal Modeling
Radius
Learning the Basics Creating a polygonal cone
Creating a polygonal cone Use Create Polygons → Cone to create conical primitives.
To create a polygonal cone primitive: Select Primitives → Create Polygons → Cone. By default, the primitive appears centered at the world coordinate system. You can move the primitive to any location with the Move Tool (W). To specify precise values for a rotation, scale, or a move, enter values in the Channel Box.
Create a polygonal cone
After you create a conical primitive, you can change settings in the Channel Box.
436
Using Maya: Modeling
Learning the Basics Creating a polygonal cone The primitive is created with the default settings in the options window. You can change the settings for these options before you create the cone.
Setting Cone options You can change the default options so that the next time you create a new cone primitive, it is created according to the new settings. Select Primitives → Create Polygons → Cone - ❐ to display the options window.
Polygonal Modeling
Radius
Use the slider or type a value to change the radius of the cone.
Height
Use the slider or type a value to change the height of the cone.
Subdivisions
Use the slider or type a value to change the subdivisions of the cone. For a cone, enter three or more meridians with at least one parallel, and zero or more concentric subdivisions.
Axis
Allows you to change the orientation of the primitive by choosing the X-, Y-, or Z-axis.
Texture
By default, UV values are assigned for texture mapping. If you do not plan to map textures on the polygonal cone, you can turn off this option.
Using Maya: Modeling
437
Learning the Basics Creating a polygonal plane
Creating a polygonal plane Use Create Polygons → Plane to create mesh primitives.
To create a polygonal plane primitive: Select Primitives → Create Polygons → Plane. By default, the primitive appears centered at the world coordinate system. You can move the primitive to any location with the Move Tool (W). To specify precise values for a rotation, scale, or a move, enter values in the Channel Box.
A polygonal plane resembles a mesh
After you create a planar primitive, you can change settings in the Channel Box.
438
Using Maya: Modeling
Learning the Basics Creating a polygonal plane The primitive is created with the default settings in the options window. You can change the settings for these options before you create the plane.
Setting Plane options You can change the default options so that the next time you create a new plane primitive, it is created according to the new settings. Select Primitives → Create Polygons → Plane - ❐ to display the options window.
Polygonal Modeling
Width
Use the slider or type a value to change the width of the plane.
Height
Use the slider or type a value to change the height of the plane.
Subdivisions
Use the slider or type a value to change the subdivisions of the plane. For a plane you can enter subdivisions in X and Y.
Axis
Allows you to change the orientation of the primitive by choosing the X-, Y-, or Z-axis.
Texture
By default, UV values are assigned for texture mapping. If you do not plan to map textures on the plane, you can turn off this option.
Using Maya: Modeling
439
Learning the Basics Creating a polygonal torus
Creating a polygonal torus Use Create Polygons → Torus to create torus primitives. A torus primitive resembles a doughnut.
To create a polygonal torus primitive: Select Primitives → Create Polygons → Torus. By default, the primitive appears centered at the world coordinate system. You can move the primitive to any location with the Move Tool (W). To specify precise values for a rotation, scale, or a move, enter values in the Channel Box.
Create a torus
440
Using Maya: Modeling
Learning the Basics Creating a polygonal torus
After you create a torus primitive, you can change settings in the Channel Box.
Polygonal Modeling
The primitive is created with the default settings in the option window. You can change the settings for these options before you create the torus.
Setting Torus options You can change the default options so that the next time you create a new torus primitive, it is created according to the new settings. Select Primitives → Create Polygons → Torus - ❐ to display the options window.
Using Maya: Modeling
441
Learning the Basics Creating polygonal text Radius
Use the slider or type a value to change the distance from the center of the torus in all directions.
Section Radius
Use the slider or type a value to change the size of the section.
Twist
Use the slider or type a value to change the twist angle of the torus.
Subdivisions
Use the slider or type a value to change the subdivisions of the primitive. For a torus, you can enter subdivisions only in X and Y.
Axis
Allows you to change the orientation of the primitive by choosing the X-, Y-, or Z-axis.
Texture
By default, UV values are assigned for texture mapping. If you do not plan to map textures on a torus, you can turn off this option. This torus uses the following default values: Radius 1.0, Section Radius 0.5, Twist 0, Subdivision in X 20, and Subdivision in Y 20
Torus default values.
Subdivision in the X direction changed to 5.
Subdivision in the Y direction changed to 3.
Twist changed to 30.
Creating polygonal text To create polygonal text, see “Creating and editing text” on page 235.
442
Using Maya: Modeling
Learning the Basics Creating a polygon
Creating a polygon Use the Create Polygon Tool to create a single facet polygon. You can create the polygon with holes, and you can relocate the individual points that define an object’s geometry.
To create a polygon: 1
Select Polygons → Create Polygon Tool.
2
In any view, click the left mouse button. The first point appears. Click-drag to move the first point around.
4
Add another point by clicking the left mouse button.
5
A new point appears with an edge connecting the new point and the last point. If there are more than two points, a dashed edge closes the polygon. The dashed edge turns into a real edge if you validate it. When you finish drawing a polygon, you can validate it by pressing Y and continue creating other polygons, or validate and exit by pressing Enter. By default, the first three vertices of the polygon define its plane. This means that you can position the first, second, and third points of the polygon anywhere in space while any subsequent points will be in the plane defined by the first three. In perspective view, the default plane is the grid. To transform a polygon while the polygon is active, select a transform tool (Move, Rotate, or Scale Tool) and click-drag to move, rotate, or scale. If you want to specify precise values, use the Channel Box. By default, the Channel Box is located on the right side of the screen. In the Translate, Rotate, and Scale boxes, you can specify exact values. For keyboard shortcuts, see “Hotkeys for polygonal modeling” on page 415.
Repositioning a point To reposition a point: 1
To reposition a previously created point, press the Insert key on the keyboard. This switches from Creation mode to Editing mode and vice versa. To reposition the most recently created point, use the middle mouse button.
2
If a point isn’t precisely where you want it, click-drag it to a new position.
Using Maya: Modeling
443
Polygonal Modeling
3
Learning the Basics Creating a polygon A manipulator appears over the point being repositioned to indicate that you are in editing mode. You can use the manipulator to move the point. 3
To validate the new position and exit insertion mode, press the Insert key again. You cannot add points that create a nonplanar polygon if the Ensure Planarity mode is selected.
4
To punch a hole through an object, hold down the Ctrl key and click the first point anywhere within the outer polygon; then release the Ctrl key. Once you start to make a hole, you can no longer return to add points to the outer loop.
5
Continue to add points by clicking the left mouse button anywhere within the outer polygon. Make the hole in the same manner as the outer loop of the polygon.
6
Continue to make holes by Ctrl-clicking where you want the first point of the new hole to begin. Each time you Ctrl-click, a new hole is created and the first point of the new hole appears where you click next.
7
Optionally, add subdivisions to edges. By default, one subdivision is added to an edge. Use the options window to change the number of subdivisions to be distributed along the edges.
8
Validate by pressing the Y key and continue creating other polygons, or validate and exit by pressing Enter. The polygon is finished and closed.
444
Using Maya: Modeling
Learning the Basics Creating a polygon
Add points.
Reposition point.
Make a hole.
Insert
+
Polygonal Modeling
Click to create first point.
Ctrl
+
Using Maya: Modeling
445
Learning the Basics Creating a polygon
Add subdivisions to all edges.
Or click on point and adjust subdivisions.
Insert
Validate.
Enter
Setting Create Tool options Select Polygons → Create Polygon Tool - ❐ to display the options.
446
Using Maya: Modeling
Learning the Basics Creating a polygon Subdivisions
Use the slider or enter a value to change the number of subdivisions that are distributed along the edges of the polygon being created. The default is 1.
Ensure Planarity
By default, any facets you add are in the same plane as the polygonal object you are appending to. Turn off Ensure Planarity if you want to add facets in another plane. This is the same as Polygons → Keep New Facets Planar.
Operation
Select either Create or Append operation mode. The default is Create.
Tip
Using Maya: Modeling
447
Polygonal Modeling
If you set planarity with Polygons → Keep New Facets Planar, the setting is saved to the preferences file when you exit Maya. It will apply to all new objects until you change the setting.
Learning the Basics Appending facets to a polygon
Appending facets to a polygon The Append to Polygon tool lets you add a facet to the border of any open polygonal object. You can append facets to any edge on the border of an object. The appended facet becomes a connected part of the polygonal object. Any appended facet is automatically oriented to conform to the object’s orientation, no matter how the appended facet was built. In other words, if the original facet has an outward facing normal, the new facet’s normal will face outward also. This orientation safeguard forces certain constraints on how facets can be appended.
To append to a polygon: 1
In a view, click the polygonal object that you want to append to.
2
Select Polygons → Append to Polygon Tool. Once you select this tool, Maya is in object selection mode.
3
Click to select the border edge of the polygon that you want to append to. This edge is the first edge of the new facet. The border edges appear thicker than non-border edges and display several arrows to indicate the edge direction. Also, the border edge you append to appears in a different color than the other border edges to help you avoid building odd polygons. This particular color is called Active Affected (select Options → Customize UI → Colors → Active → General). You can control the size of the arrows by pressing the + or - keys. Note that you cannot append a polygon to a closed primitive such as a sphere, but you can append to a plane (Primitives → Create Polygons → Plane).
4
Add a point by clicking the left mouse button away from the object, or add an edge by clicking another border edge. A new point appears with a line connecting it to the last point of the selected facet edge. Further points will have a dashed edge closing the polygon. The dashed edge turns into a real edge when the new facet is validated. If you change your mind, press Backspace and change the order in which you picked edges.
5
448
To reposition the last created vertex of the polygon being appended, hold down the middle mouse button. Press the Insert key to reposition a previously created vertex. This switches you from Creation mode to Editing mode and vice versa.
Using Maya: Modeling
Learning the Basics Appending facets to a polygon A manipulator appears over the point being repositioned. You can use the manipulator to move the point. 6
To validate the newly position point and exit Insertion mode, press the Insert key again.
7
To create a point in different plane, change the rotation angle in the options window. Then add points by clicking the left mouse button. Continue adding points in the new plane.
The append can roll
8
The append cannot roll
Validate by pressing Y and continue appending by clicking the left mouse button on a border edge, or validate and exit by pressing Enter. After pressing Y, you can select another polygonal object. Click the object, then click the border edge you want to append to.
Making a hole in a polygon To make a hole in a polygon: 1
To punch a hole through a facet you are currently appending, Ctrl-click the first point anywhere within the outer polygon; then release the Ctrl key.
2
Continue to add points by clicking the left mouse button anywhere within the outer polygon. Make the hole in the same manner as the outer loop of the polygon.
3
Continue to make further holes with Ctrl-click, or validate and exit by pressing Enter.
Using Maya: Modeling
449
Polygonal Modeling
The newly created facet rolls around the first edge you select. As long as all the edges you select can be set on a hinge, the newly created facet turns around the reference line. However, if the edges you select are not aligned, then the newly created facet will not turn around this reference line.
Learning the Basics Appending facets to a polygon Each time you press Ctrl, a new hole is created and the first point of the new hole appears where you click next. The polygon is considered finished.
Setting Append Tool options The Append to Polygon tool uses the current settings in the tool’s options window. To change the tool options, select Polygons → Append to Polygon tool - ❐ to display the options.
Subdivisions
Use the slider or enter a value to change the number of subdivisions that are distributed along the edges of the polygon being created. The default is 1.
Rotation Angle
Enter a value or drag the slider to change the angle for placing a point in a new plane. By default, points are created in the same plane. The rotation angle ranges from 0 to 360 degrees and is available as soon as you select the first edge.
Operation
Select either Create or Append operation mode. The default is Append.
Ensure Planarity
By default, any facets you add are in the same plane as the polygonal object you are appending to. Turn off Ensure Planarity if you want to freely position your points. This is the same as Polygons → Keep New Facets Planar.
450
Using Maya: Modeling
Learning the Basics Appending facets to a polygon
Tip If you set planarity with Polygons → Keep New Facets Planar, the setting is saved to the preferences file when you exit Maya. It will apply to all new objects until you change the setting. After you click an edge and add points, click an edge near the first edge to close the facet. You can then either make holes in the facet or validate the append.
Polygonal Modeling
Click on any border edge.
Add a point.
Click to add edge, closing the polygon being appended.
Create a hole.
Ctrl
+
Using Maya: Modeling
451
Learning the Basics Appending facets to a polygon
Click on any edge to start a new polygon.
Click edge adjoining first edge to close.
Use the options window to add subdivisions.
Can still modify position.
Insert
Tip Before appending polygons between two separate shapes, you must use Polygons → Unite (see “Uniting polygons” on page 514).
452
Using Maya: Modeling
Learning the Basics Splitting facets
Splitting facets Use the Split Polygon Tool to create new vertices and edges. This lets you split existing facets into pieces.
To split facets: 1
Select Polygons → Split Polygon Tool.
2
In a view, click the left mouse button on an edge of the facet where you want to split it into two pieces. A dot appears on the edge. Drag the dot along the edge and release it where you want. The edge is subdivided there, with a new vertex inserted.
4
Click to select a second edge. Click only the edges that appear highlighted to avoid creating odd polygons. The edges display in red by default. You can click only on the neighboring facets. You can also click a free point anywhere inside the outline appearing in red. Such points are called “free points” because they are located independently of edges, but they lie on the facet plane. A new vertex appears on the second edge and an edge appears between the two vertices. As an aid to splitting facets, a reference line is displayed as you hold down the mouse. This line is aligned with the last two split points you created.
5
To undo a step, press Backspace.
6
To reposition the last created free point or edge point, hold down the middle mouse button. Press the Insert key to reposition a previously created free point or edge point. This switches you from Creation mode to Editing mode and vice versa.
7
Validate by pressing Y and continue splitting other facets, or validate and exit by pressing Enter. Because the facets are split based on the current settings in the options window, you may need to change the tool options.
Using Maya: Modeling
453
Polygonal Modeling
3
Learning the Basics Splitting facets
Setting Split Tool options Select Polygons → Split Polygon Tool - ❐ to display the options window.
Subdivisions
Drag the slider to change the number of subdivisions you want for each new edge.
Edge Snapping
When on, the pointer snaps to a point along the edge of the facet you are splitting. In order to position the pointer freely, turn off Edge Snapping.
Snapping tolerance
Drag the slider to change the snapping tolerance you want for each new edge point you are going to create.
To change the settings for the Split tool: 1
Specify the number of subdivisions you want for each new edge. Use Subdivisions to insert the number of points between two edges.
2
Specify the snapping tolerance you want for each new edge. The tolerance value can range from 0 to 33.3%. A value of 0 indicates no tolerance. The tolerance controls how sensitive the Split Polygon Tool is to where you click. If you turn on Edge snapping, and click the edge where you want to split it, the pointer will snap to the nearest point, endpoint, or midpoint that falls inside the tolerance range and is contiguous to the point on which you clicked.
454
Using Maya: Modeling
Learning the Basics Splitting facets When you want to split an edge at a specific location, you may find it useful to turn off Edge snapping. When you want to split an edge midway between a pair of endpoints, set Snapping tolerance to 33.3. This splits the edge in the middle of the segment with the two endpoints on each side.
Click an edge
Click a second edge
Move the point along the edge. Press Y.
Click a third edge; notice the reference line. Press Y.
Continue onto bordering facets, if desired. Press Enter.
Using Maya: Modeling
Polygonal Modeling
Original object
455
Learning the Basics Moving vertices
Moving vertices Use Move Component to translate, rotate, or scale vertices of polygonal objects.
To move vertices: 1
Select an object whose vertices you want to move.
2
Press F9 to select vertices.
3
Marquee-select the vertices of the polygonal object that you want to move.
4
Select Polygons → Move Component.
5
Use the transform manipulators to move the vertices in whatever direction you wish. Also see “Using the local and global pivot” on page 472. You can also enter specific values in the Channel Box. The current settings in the options window determine the way the vertices are moved.
Tip You can press the Insert key to move the manipulators anywhere in a view. Press the Insert key again to use the manipulators to click-drag the selected vertices again. 6
Adjust the move settings if you wish, and then click Move Vertex. The vertices are moved.
456
Using Maya: Modeling
Learning the Basics Moving vertices
Setting Move Vertex Options Select Polygons → Move Component - ❐ to display the options window.
Polygonal Modeling
Manipulator on Global values
Controls whether components are transformed using local or global values. By default, this option is set to local values. This means that components are transformed separately according to the local axes of each facet. When you turn off Manipulator on Global values, components are transformed globally relative to a single reference point.
Local Values Translate Z
Moves locally along the Z axis. Positive or negative values indicate how far the vertex (or vertices) is moved.
Direction
Defines the direction in the X-, Y-, or Z-axis.
Global Values Translate
Moves the vertex or vertices along the X-, Y-, or Z-axis.
Scale
Scales the vertices along the X-, Y-, or Z-axis.
Rotate
Sets the angle by which you want to rotate the vertex or vertices around the X-, Y-, or Z-axis.
Using Maya: Modeling
457
Learning the Basics Moving vertices
Other Values Random
Changes vertices by a random amount, ranging from 0 to 1.
World Space Coords
Turn on to use the world coordinate system when you are changing values randomly.
Changing the pivot The pivot defines the center point in the X-, Y-, or Z-axis from where you can rotate or scale the vertex or vertices. After moving vertices, you can change the Pivot in the Channel Box or Attribute Editor.
Drag to select vertices on the original nose.
Move the selected vertices.
Rotate the selected vertices.
Scale the selected vertices.
Best way of moving vertices, facets, or edges You can move facets, vertices, or edges in either of two ways. One method, using Move Component, produces animations that interpolate the rotation, scale, or translation values. The second method, using the Move, Rotate, or Scale Tools (W, E, or R), produces animations that interpolate between the key position for each vertex.
458
Using Maya: Modeling
Learning the Basics Moving vertices Before moving, you need to figure out how you want the facets or vertices to follow the path of the animation. With Move Component, the moving facets or vertices gracefully follow the animation path. Because Move Component is actually part of the polygonal workflow, it works more intelligently than the Move, Rotate, or Scale Tools and is the recommended method. Move Component lets you: correctly play animations that involve rotations
•
take advantage of the construction history capability because it remembers each rotation, translation, scaling, and pivot value; this makes it easier to make changes later when you apply other actions
•
work well after you change a geometry parameter, something which the Move, Rotate, or Scale Tools do not
Polygonal Modeling
•
Use the Move, Rotate, or Scale Tools: •
to animate vertices when each vertex moves separately
•
when you plan to use the current shape as a starting point. That is, the model is in its final modeling stages and is nearly completed.
Using Maya: Modeling
459
Learning the Basics Moving facets
Moving facets Use the Move Component to translate, rotate, or scale facets of polygonal objects. In addition, you can offset or scale facets from the center.
To move facets: 1
Select an object whose facets you want to move.
2
Press F11 to select facets.
3
Marquee-select the facets you want to move. You can change the way in which facets are displayed by selecting Options → General Preferences → Modeling. In the window, set Select Facets with to Center or Whole facet.
4
Select Polygons → Move Component.
5
Use the transform manipulators to move the facets in whatever direction you wish. You can also enter specific values in the Channel Box. Also see “Using the local and global pivot” on page 472 for using the local and global pivot. The facets are moved based on the current settings in the options window.
6
Adjust the move settings if you wish, and then click Move Facet. The facets are moved.
460
Using Maya: Modeling
Learning the Basics Moving facets
Setting Move Facet options Select Polygons → Move Component - ❐ to display the options window.
Polygonal Modeling
Manipulator on Global values
Controls whether components are transformed using local values or global values. By default, this option is set to local values. This means that components such as facets are transformed separately according to the local axes of each facet. When you turn off Manipulator on Global values, components are transformed globally relative to a single reference point.
Local Values Offset
Offsets the facet edges.
Translate
Moves the facet locally along the X-, Y-, or Z-axis. Positive or negative values indicate how far the facet or facets are moved.
Rotate
Sets the angle at which you want to rotate the facet or facets locally around the X-, Y-, or Z-axis.
Scale
Scales the facet locally along the X-, Y-, or Z-axis.
Direction
Defines the XYZ direction for each facet.
Using Maya: Modeling
461
Learning the Basics Moving facets
Global Values Translate
Moves the facet along the X-, Y-, or Z-axis.
Scale
Scales the facet along the X-, Y-, or Z-axis.
Rotate
Sets the angle to rotate the facet around the X-, Y-, or Z-axis.
Other Values Random
Changes the facets by a random amount, ranging from 0 to 1.
World Space Coords
Turn on to use the world coordinate system when you are changing values randomly.
Dynamic Values Gravity
Rotates the facet so its normal is aligned with the X-, Y-, or Z-axis.
Weight
Controls the amount of rotation.
Magnet
Sets the magnet center you want the facet normal to point to along the X-, Y-, or Z-axis.
Attraction
Sets the level of attraction to the magnet. You can move the Attraction slider between -2 and 2 but the most useful values range from 0 to 0.25. The closer you move the attraction towards the magnet, the smaller the value.
Changing the pivot The pivot defines the center point in the X-, Y-, or Z-axis. You rotate or scale the facet from this center point. After moving facets, you can change the Pivot in the Channel Box or Attribute Editor (Window → Attribute Editor). Also see “Best way of moving vertices, facets, or edges” on page 458.
462
Using Maya: Modeling
Learning the Basics Moving edges
Moving edges Use the Move Component to move edges.
To move edges: 1
Select an object whose edges you want to move.
2
Press F10 to select edges.
3
Marquee-select the edges of the polygonal object that you want to move.
4
Select Polygons → Move Component. The edges are moved. You can change their shape, location, orientation, and their size by using the manipulators. Also see “Using the local and global pivot” on page 472. You can also enter specific values in the Channel Box. The current settings in the options window determine the way the edges are moved.
5
Adjust the move settings if you wish, and then click Move Edge.
Using Maya: Modeling
463
Polygonal Modeling
You can change the way in which edges are displayed by selecting Display → Custom Polygon Display - ❐. In the window, set Edge to Standard, Soft/ Hard, or Only Hard.
Learning the Basics Moving edges
Setting Move Edge options Select Polygons → Move Component - ❐ to display the options window.
Manipulator on Global values
Controls whether components are transformed using local values or global values. By default, this option is set to local values. This means that components such as facets are transformed separately according to the local axes of each facet. When you turn off Manipulator on Global values, components are transformed globally relative to a single reference point.
Local values Translate
Moves locally along the X-, Y-, or Z-axis. Positive or negative values indicate how far the edge is moved.
Rotate
Sets the angle at which you want to rotate the edge locally around the X-, Y-, or Z-axis.
Scale
Scales the edge locally along the X-, Y-, or Z-axis.
Local center
Scales the edge from the middle, start, or end of the edge. The default is middle.
464
Using Maya: Modeling
Learning the Basics Moving edges
Global Values Translate
Moves the edge(s) along the X-, Y-, or Z-axis.
Scale
Scales the edge along the X-, Y-, or Z-axis.
Rotate
Sets the angle by which you want to rotate the edge around the X-, Y-, or Zaxis.
Other Values Changes edges by a random amount, ranging from 0 to 1.
World Space Coords
Turn on or off to use the world coordinate system when you are changing values randomly.
Changing the pivot The pivot defines the center point in the X-, Y-, or Z-axis from where you can rotate or scale the edge or edges. After moving edges, you can change the Pivot in the Channel Box or Attribute Editor (Window → Attribute Editor). Also see “Best way of moving vertices, facets, or edges” on page 458.
Using Maya: Modeling
465
Polygonal Modeling
Random
Learning the Basics Subdividing edges or facets
Subdividing edges or facets Use Subdivide to subdivide an edge into one or more subedges. You can also subdivide a facet into one or more facets, creating new facets.
To subdivide edges or facets: 1
Select an object whose edges or facets you want to subdivide.
2
Press F10, for edges.
or Press F11, for facets. 3
Marquee-select the edges or facets of the polygonal object that you want to subdivide. You can change the way in which edges are displayed by selecting Display → Custom Polygon Display - ❐. In the window, set Edge to Standard, Soft/ Hard, or Only Hard.
4
Select Polygons → Subdivide. The edges or facets are subdivided and you can change their shape, location, orientation, and their size by using the manipulators. You can also enter specific values in the Channel Box. The current settings in the option window determine the way the edges or facets are subdivided.
5
Change the subdivide settings again in the options window if you wish and then click Subdivide.
6
Select Edit → Repeat (G) to repeat the subdivision operation as many times as you wish. You must do this immediately after you perform the operation.
7
466
Continue subdividing other facets or edges or take some other action.
Using Maya: Modeling
Learning the Basics Subdividing edges or facets
Setting Subdivision options Select Polygons → Subdivide - ❐ to display the options window.
Enter the maximum number of vertices to be inserted in each edge, or enter the maximum number of times facets are to be subdivided. For facets, the number of subdivisions required means the number of times each facet is subdivided again. The number of facets created is proportional to (3)x or (4)x depending on the subdivision mode where (3)x = 3 x 3 x 3 or (4)x = 4 x 4 x 4. Do not specify values higher than 4 or 5 for facets; you can specify a higher number for edges.
Using Maya: Modeling
467
Polygonal Modeling
Subdivisions
Learning the Basics Subdividing edges or facets
The original facet to be subdivided using quads and a subdivision of 1.
The original facet to be subdivided with quads turned off and a subdivision of 1.
The result of subdividing the original facet.
The result of subdividing the original facet.
Repeat the subdivision on the four new facets using a subdivision of 1. You can get same result by subdividing the original facet using a subdivision of 2.
The result of subdividing the facets in the middle. You can also get the same result by subdividing the original facet using a subdivision of 2.
Mode
Toggle quads on to subdivide facets into quads or toggle triangles on to subdivide facets into triangles. This option is valid only for facets.
Minimum length
Sets the minimum length of each subedge created. This option is valid only for edges.
Worldspace
This option is valid only for edges.
468
Using Maya: Modeling
Learning the Basics Keeping facets together
Note You cannot subdivide facets with holes. You cannot subdivide concave facets unless the center is visible. To remove holes or to subdivide a concave facet into convex parts, use Split or Triangulate.
Keeping facets together
The distinction between turning on and off Polygons → Facets → Keep Facets Together is not noticeable when you are simply extruding a planar group. However, when you scale a group, or “grow” a nonplanar group, you will see that the facets stay in one group when you turn on Keep Facets Together. If Keep Facets Together is on, only the border edges make walls as they are extruded. Facets connected by their edges will create a single tube, with the connected facets as a single “roof”. If Keep Facets Together is off, each edge makes a wall as it is extruded. The facets separate from each other and scale from their own center. However, the facets are scaled from the center of the group as for On.
Using Maya: Modeling
469
Polygonal Modeling
Use Polygons → Facets → Keep Facets Together while you are extruding, extracting, or duplicating facets to specify whether to retain the edges of each facet or only the border edges. By default, this option is turned off.
Learning the Basics Creating an extrusion
Creating an extrusion Extrude extends objects by partially extruding facets of the object. You can extrude facets so that only the border edges make walls as they are extruded. Or you can extrude the facets separately, so that each edge makes a wall as it is extruded.
To extrude facets: 1
Select an object you want to extrude.
2
Press F11 to select facets.
3
Marquee-select the facets you want to extrude. You can change the way in which facets are displayed by selecting Options → General Preferences → Modeling. In the window, set Select Facets with to Center or Whole facet.
4
Select Polygons → Facets → Extrude. The facets are extruded. You can change their shape, location, orientation, and size with the manipulators. Using the transform handles is the easiest way to manipulate the extruded facets, but you can also enter precise values in the Channel Box. The facets are extruded based on the current settings in the option window. By default, facets are extruded separately. To extrude facets together, turn on Keep Facets Together by selecting Polygons → Facets → Keep Facets Together.
5
Select another group of facets that you want to extrude, or use the same facets, and select Edit → Repeat (G) to repeat the same extrusion. Pressing G repeatedly executes the extrusion with the same parameters on the same facets. Thus, you can create a series of extrusions depending on the options set in the options window. To return to the original object, press Ctrl-Z.
6
Change the extrusion settings again in the options window if you wish and then click Extrude. Use Ctrl-Shift to add facets to your selection, Ctrl to remove facets from a selection, and Shift to switch between being selected and not, without affecting the rest of the group.
470
Using Maya: Modeling
Learning the Basics Creating an extrusion Extrude applies the same values of the old group to the extrude of the new group. Either way, you can still modify after pressing g the second time, and then continue the Edit → Repeat (G) sequence as many times as you wish.
Extruding perpendicular to the geometry The path you extrude along can be perpendicular, or at any other angle to the extruded shape. To extrude along a facet normal, in the options window set the Z value for Local Values Translate to 1, and then click the Extrude button at the lower left of the options window.
Sometimes you may want to repeat the same extrusion to extend it. The Edit → Repeat (G) command lets you repeat an extrusion as many times as you want. You must choose the command immediately after you perform the operation.
Changing an extrusion You can change the effect of an extrusion in the Extrude options window (Polygons → Facets → Extrude - ❐) before you create an extrusion or in the Attribute Editor (Window→Attribute Editor) for individual extrusions after you create them.
Changing the extrusion mode The distinction between turning on and off Polygons → Facets → Keep Facets Together is not noticeable when you are simply extruding a planar group. However, when you scale a group, or “grow” a non-planar group, you will see that the facets stay in one group when you turn on Keep Facets Together. There are two modes: If Keep Facets Together is on, only the border edges make walls as they are extruded. Facets connected by their edges will create a single tube, with the connected facets as a single “roof”. If Keep Facets Together is off, each edge makes a wall as it is extruded. The facets separate from each other and scale from their own center. However, the facets are scaled from the center of the group as for On.
Using Maya: Modeling
471
Polygonal Modeling
Repeating extrusions
Learning the Basics Creating an extrusion
Using the local and global pivot When you work with commands operating on facets, you will notice an additional handle as part of the standard Maya transform manipulators. You can use this additional handle when extruding, extracting, or duplicating. For example, you can extrude facets in a selection relative to a local or global point of origin. By default, facets in a selection are extruded relative to the axis of each individual facet. The effect differs from that of extruding facets in a selection around a common point of origin. Local values are based upon the reference point of each selected facet, as contrasted with global values that are based upon a single reference point common to all the selected facets. If you are using local values, the little circle is a solid dot; if you are using global values, the little circle is hollow. In global mode, the manipulator is always positioned over the currently selected facets. Use the Insert key to relocate the manipulator only in global mode, not in local mode. Toggling between local and global mode is similar to choosing the Manipulator on Global values option in the options window. Click to toggle between local mode and global mode. In local mode, a solid dot appears whereas a hollow dot appears in global mode. Local mode
Global mode
Changing the pivot The pivot defines the center point in the X-, Y-, or Z-axis. You can rotate or scale the facet or facets from the center point. After extruding facets, you can change Pivot in the Channel Box or Attribute Editor (Window → Attribute Editor).
472
Using Maya: Modeling
Learning the Basics Creating an extrusion
Note Turning on Keep Facets Together and selecting all facets of an open polygon will make it a solid.
Polygonal Modeling
Draw the shapes to represent the glasses.
Extrude the glasses.
Make the glasses smooth using a smoothness value of 2—the angular edges are removed.
Match the glasses to the face and complete the frames.
Seeing clear and sharp after rendering.
Using Maya: Modeling
473
Learning the Basics Creating an extrusion The following figures show the effects of extruding facets.
474
Select facets.
Extruding separately (keeps walls in between).
Extruding facets together (no walls in between).
Extruding facets separately and creating a bevel.
Extruding facets together (no walls in between).
Extruding facets together and creating a bevel.
Using Maya: Modeling
Learning the Basics Creating an extrusion
Move along the facet normal while extruding facets together.
Move along the facet normal while extruding facets separately.
Scale while extruding facets together.
Polygonal Modeling
Translate while extruding facets together.
Extruding at an angle.
Using Maya: Modeling
475
Learning the Basics Creating an extrusion
Setting Extrusion options The settings in the options window apply to all extrusions you create subsequently. Select Polygons → Facets → Extrude - ❐ to display the options window.
Manipulator on Global values
Controls whether components are transformed using local values or global values. By default, this option is set to local values (no check mark appears). This means that components such as facets are transformed separately according to the local axes of each facet. When you turn on Manipulator on Global values (a check mark appears), components are transformed globally relative to a single reference point.
Local Values Offset
Offsets the edges of the facet or facets being extruded. This option can be used to produce a beveling type of effect.
Translate
Moves locally along the X-, Y-, or Z-axis. Positive or negative values indicate how far the facet or facets being extruded are moved locally.
476
Using Maya: Modeling
Learning the Basics Creating an extrusion Rotate
Sets the angle at which you want to rotate the facet or facets being extruded locally around the X-, Y-, or Z-axis.
Scale
Scales locally along the X-, Y-, or Z-axis.
Direction
Sets the location of the X-, Y-, or Z-point in the local axis.
Global Values Moves the extruded facet or facets along the X-, Y-, or Z-axis.
Rotate
Sets the angle by which you want to rotate the extruded facet or facets around the X-, Y-, or Z-axis.
Scale
Scales the facet or facets being extruded along the X-, Y-, or Z-axis.
Other Values Random
Makes the facets being extruded vary randomly from 0 to 1.
World Space Coords
Turn on the World Space Coords to use the world coordinate system when you are changing values randomly.
Dynamic Values Gravity
Rotates the facet so that its normal is aligned with the X-, Y-, or Z-axis.
Weight
Controls the amount of rotation.
Magnet
Sets the magnet center that you want the facet normal to point to along the X-, Y-, or Z-axis.
Attraction
You can move the Attraction slider between -2 and 2 but the most useful values range from 0 to 0.25. The closer you move the Attraction towards the Magnet, the smaller the value.
Using Maya: Modeling
477
Polygonal Modeling
Translate
Learning the Basics Deleting edges
Deleting edges Pres the Backspace key to delete the selected edge between two facets and merge the original two facets. The result is a single facet, but the vertices shared at the ends of the edge are not deleted. To delete these unwanted vertices in addition to the edge, you should select Polygons → Edges → Delete and Clean.
To delete edges: 1
Select an object whose edges you want to delete. Only interior edges can be deleted.
2
Press F10 to select edges.
3
Marquee-select the edges you want to delete. You can change the way in which edges are displayed by selecting Display → Custom Polygon Display - ❐. In the window, set Edge to Standard, Soft/ Hard, or Only Hard.
4
Press Backspace to remove the selected edges, but not the related vertices. You can also select Polygons → Edges → Delete and Clean to remove both the selected edge or edges and the related vertices. When you press Backspace, the selected edge or edges are deleted, but the vertices belonging to that edge or edges are not deleted. When you use Polygons → Edges → Delete and Clean, the edges and the related vertices are removed, if the vertices are not shared by an adjacent facet.
5
478
Continue deleting other edges or take some other action.
Using Maya: Modeling
Learning the Basics Deleting vertices
Deleting vertices To delete vertices: 1
Select an object whose vertices you want to delete.
2
Press F9 to select vertices.
3
Marquee-select the vertices you want to delete. If the vertices do not appear, turn on the vertex display by selecting Display → Polygon Components → Vertices.
4
Press Backspace to remove the selected vertices. Polygonal Modeling
The selected vertices are deleted. 5
Continue deleting other vertices or take some other action.
Note Only vertices between two or more edges can be removed.
Using Maya: Modeling
479
Learning the Basics Deleting facets
Deleting facets To delete facets: 1
Select an object whose facets you want to delete.
2
Press F11 to select facets.
3
Marquee-select the facets you want to delete. You can change the way in which facets are displayed by selecting Options → General Preferences → Modeling. In the window, set Select Facets with to either Center or Whole facet.
4
Press Backspace to remove the selected facets. The selected facets are deleted.
5
480
Continue deleting other facets or take some other action.
Using Maya: Modeling
11
Beyond the Basics This chapter shows you how to do more advanced tasks including triangulating and quadrangulating facets. This chapter also explains how to merge edges and bevel polygons.
Polygonal Modeling
Topics include: •
“Collapsing edges or facets” on page 483
•
“Closing a border” on page 489
•
“Merging edges” on page 490
•
“Beveling polygons” on page 492
•
“Extracting parts of polygons” on page 496
•
“Duplicating parts of polygons” on page 500
•
“Triangulating” on page 504
•
“Quadrangulating” on page 505
•
“Trimming facets” on page 510
•
“Changing the normals” on page 512
•
“Uniting polygons” on page 514 Using Maya: Modeling
481
Beyond the Basics
482
•
“Separating polygons” on page 515
•
“Smoothing polygons” on page 516
•
“Using smart command settings” on page 519
•
“Applying an action to several components” on page 520
•
“Cancelling smart command settings” on page 521
Using Maya: Modeling
Beyond the Basics Collapsing edges or facets
Collapsing edges or facets Use Collapse to turn a facet or an edge into a point. When you collapse facets or edges, you are not allowed to create two-edged facets. Use this command to clean small facets or edges.
To collapse edges or facets: 1
Select an object whose edges or facets you want to collapse.
2
Press F10, for edges.
or
3
Marquee-select the edges or the facets of the polygonal object you want to collapse. You can change the way in which facets or edges are displayed by selecting Display → Custom Polygon Display - ❐. In the window, set Edge to Standard, Soft/Hard, or Only Hard and set Facets to Centers.
4
Select Polygons Collapse. The edges or facets are collapsed.
5
Continue collapsing other edges or facets or take some other action.
Using Maya: Modeling
483
Polygonal Modeling
Press F11, for facets.
Beyond the Basics Collapsing edges or facets
The original object.
Click an edge.
484
Using Maya: Modeling
The edge turns into a point.
Beyond the Basics Collapsing edges or facets
The original object.
Polygonal Modeling
Click the facet center (or group the facets).
The facet collapses.
Using Maya: Modeling
485
Beyond the Basics Softening and hardening edges
Softening and hardening edges Sometimes an object is faceted when displayed in Smooth Shaded. To correct this, use Soften/Harden Edges to smoothly render any polygonal objects. You can specify an angle at which the polygonal object is to be smoothed. If the angle between two facets is sharper than the smoothing angle, the edge is hard. If the angle between two facets is flatter than the smoothing angle, the edge is soft. You can use the options window to preset a smoothing angle. The angle value in the options window is the default value. For example, if you want to render edges hard, you can preset the smoothing angle in the options window to 0 degrees. To render soft edges, preset the angle to 180 degrees.
To make edges soft or hard: 1
Select an object whose edges you want to soften or harden.
2
Press F10 to select edges.
3
Marquee-select the edges of the polygonal object that you want to change.
4
Select Polygons → Edges → Soften/Harden. The edges are modified based on the current settings in the options window. By default, the angle is set to 30 degrees.
486
5
If necessary, change the angle in the options window to soften the edges you want and then click Soft/Hard.
6
To continue softening repeatedly on the same edges, choose Edit → Repeat (G) or select a new group of edges or take some other action.
Using Maya: Modeling
Beyond the Basics Softening and hardening edges
An angle of 360° produces a much smoother jug.
Polygonal Modeling
Hard edges appear as vertical streaks on the jug.
Jug in wireframe.
Jug in wireframe.
Using Maya: Modeling
487
Beyond the Basics Softening and hardening edges
Setting Soften/Harden Edge options Select Polygons → Edges → Soften/Harden - ❐ to display the options window.
Angle
Use the slider or enter a value to set the angle. Angles greater than this value render hard; angles less than this value render soft.
All Hard
Set the angle to 0, making edges render hard.
All Soft
Set the angle to 180 degrees, making edges render soft.
World Space
Turn on or off the World Space Coords to use the world coordinate system.
488
Using Maya: Modeling
Beyond the Basics Closing a border
Closing a border Use Close Border to automatically close open borders with a single facet. However, the facets will create non-planar facets if the border of the object is non-planar. To avoid non-planar facets, use the Append to Polygon Tool to close the object with several co-planar facets. You can also use Triangulate after closing.
To close a border: Select an object whose border edge(s) you want to close.
2
Press F10 to select edges.
3
Marquee-select the edges of the border you want to close.
4
Select Polygons → Edges → Close Border.
Polygonal Modeling
1
The edges are closed. 5
Continue closing other borders or take some other action.
Using Maya: Modeling
489
Beyond the Basics Merging edges
Merging edges Use the Merge Tool to merge two border edges into one. You can place the new edge at the first or last edge selected or between both edges. Merging edges is not the same as removing an edge with Backspace in Component mode.
To merge edges: 1
Select Polygons → Edges → Merge Tool. Once you select this tool, Maya is in object selection mode.
2
Click to select the first border edge you want to merge. This must be a border edge (try to click directly on it, not drag over it). The order of the steps you are expected to do are displayed in the Feedback Line. Border edges are displayed thicker than non-border edges and display several arrows to indicate the edge direction. The border edge you are merging is in a different color than the other border edges. This helps you avoid building odd polygons. This particular color is called Active Affected (select Options → Customize UI → Colors → Active → General). You can control the size of the arrows by pressing the + or - keys.
3
Click to select the second border edge you want to merge. To cancel the second border edge you select, press Backspace.
4
Validate by pressing Y and continue merging other border edges, or validate and exit by pressing Enter.
Tip To do several merges on the same object, you do not need to validate each individual merge by pressing Y. Instead, select the pair of border edges for the first merge, when you click the first border edge for the second merge the first merge is automatically validated. You can select only border edges in the Merge Tool.
490
Using Maya: Modeling
Beyond the Basics Merging edges
Setting Merge Edge options Border edges are merged based on the settings in the options window. Select Polygons → Edges → Merge Tool - ❐ to display the options window.
The first edge you click becomes the new edge whereas the second edge you click is removed.
Middle
The new edge is equidistant between the first and the second edge whereas the first and second edges you click are removed.
Second
The second edge you click becomes the new edge whereas the first edge you click is removed.
Note Maya won’t merge edges that may result in strange polygons. For example, if you select two edges with another selected edge between them, Maya will not merge them.
Edge A
Edge B
Edge C
Edge D
Edge E
Edge C is already selected Edges A and E cannot be selected for merging.
Using Maya: Modeling
491
Polygonal Modeling
First
Beyond the Basics Beveling polygons
Beveling polygons Use Bevel to modify the topology of polygonal objects by smoothing vertices and their connected edges. Beveling expands each vertex and each edge into a new facet. You can position these facets at an offset or scale them towards the original facet center. Beveling works with convex and even star-shaped concave facets. However, it can give unwanted results with concave facets. This happens when the center of the facet is in the outer facet domain.
To bevel polygons: 1
Select an object you want to bevel.
2
Press F10 to select edges.
3
Marquee select the edges of the polygonal object that you want to bevel. You can change the way in which edges are displayed by selecting Display → Custom Polygon Display - ❐. In the window, set Edge to Standard, Soft/ Hard, or Only Hard.
4
Select Polygons → Edges → Bevel. The edges are bevelled based on the current settings in the options window.
492
5
If necessary, adjust the options in the options window to bevel the area you want and click Bevel.
6
To continue beveling repeatedly on the same edges, choose Edit → Repeat or select a new group of edges.
Using Maya: Modeling
Beyond the Basics Beveling polygons
Setting Bevel options Choose Polygons → Edges → Bevel - ❐ to display the options window.
Use the slider or enter a value to set the distance between the edge and the center of the facet.
Roundness
Use the slider or enter a value to round the edges. By default, Maya automatically adjusts the rounding to bevel an object based upon the object's geometry. If you select Auto Fit, this option is dimmed.
Segments
Use the slider or enter a value to change the number of segments along the edges of the polygon being beveled (the default is 1).
Auto Fit
Turn on Auto Fit if you want Maya to automatically determine how the bevel is to fit the object. If you turn off this option, you can enter a value for Roundness.
World Space
Turn on or off the World Space Coords to use the world coordinate system.
Using Maya: Modeling
493
Polygonal Modeling
Offset
Beyond the Basics Beveling polygons
494
Marquee-select edges on the object you want to bevel.
The corner point is bevelled using the default settings: Offset = 0.2 Roundness = 0.5 Segments = 1
With an Offset of 0.4, the corner point is really sanded down. The other options use the default settings.
Segments = 4 and the other options use the default settings.
Using Maya: Modeling
Beyond the Basics Beveling polygons
Polygonal Modeling
Offset = 0.2 Roundness = 1 Segments = 4
Offset = 0.2 Roundness = -1 Segments = 4 A negative value cuts into an object to create a groove.
Using Maya: Modeling
495
Beyond the Basics Extracting parts of polygons
Extracting parts of polygons Use Extract to chip off or remove selected facets from an object. After you do an extraction, the extracted facets will be the current set.
To extract facets: 1
Select an object you want to extract.
2
Press F11 to select facets.
3
Marquee-select the facets you want to detach. You can change the way facets are displayed by selecting Options → General Preferences → Modeling. In the window, set the Select Facets with option to either Center or Whole facet.
4
Select Polygons → Facets → Extract. The selected facets are extracted. You can change their shape, location, orientation, and their size with the manipulators. You can use the transform handles or enter specific values in the Channel Box. Also see “Using the local and global pivot” on page 472.
5
Select another group of facets that you want to extract and select Edit → Repeat (G) to repeat the same extraction. Repeated use of pressing g will repeatedly execute the extraction with the same parameters on the same facets. Thus, you can create a series of extractions depending on the options set in the options window. To return to the original object, press Ctrl-Z.
6
Change the extraction settings again in the options window if you wish and then click Extract.
Extracting perpendicular to the geometry To extract along a facet normal, in the options window set the Z value for Local Values Translate to 1, and then click the Extract button.
Changing the extraction You can change the settings in the options window before you create an extraction. To change the extraction after you create it, use the Attribute Editor.
496
Using Maya: Modeling
Beyond the Basics Extracting parts of polygons
Changing the pivot The pivot defines the center point in the X-, Y-, or Z-axis. You rotate or scale the facet from this center point. After extracting facets, you can change the Pivot in the Channel Box or Attribute Editor (Window → Attribute Editor). Group or select facets (F11).
Move chips (now a group of original).
Z
Y X Shift
Scale chips 85%.
+
Z
X
Can extend chip off on same or new group.
Y
Y Z
Polygonal Modeling
Y
X
Z
X
Using Maya: Modeling
497
Beyond the Basics Extracting parts of polygons
Setting Extraction options Choose Polygons → Facets → Extract - ❐ to display the options window.
Manipulator on Global values
Controls whether components are transformed using local values or global values. By default, this option is set to local values. This means that components such as facets are transformed separately according to the local axes of each facet. When you turn off Manipulator on Global values, components are transformed globally relative to a single reference point.
Local Values Offset
Offsets the edges of the facet or facets being extracted.
Translate
Moves locally along the X-, Y-, or Z-axis. Positive or negative values indicate how far the facet (or facets) being extracted is moved.
Rotate
Sets the angle at which you want to rotate the facet or facets being extracted locally around the X-, Y-, or Z-axis.
Scale
Scales the facet or facets being extracted locally along the X-, Y-, or Z-axis.
Direction
Sets the location of the X-, Y-, or Z-point in the local axis.
498
Using Maya: Modeling
Beyond the Basics Extracting parts of polygons
Global Values Translate
Moves the facet or facets being extracted along the X-, Y-, or Z-axis.
Rotate
Sets the angle by which you want to rotate the facet or facets being extracted around the X, Y, or Z axis.
Scale
Scales the facet or facets being extracted along the X-, Y-, or Z-axis.
Other Values Changes facets by a random amount, ranging from 0 to 1.
World Space Coords
Turn on or off the World Space Coords to use the world coordinate system when you are changing values randomly. For an explanation of Dynamic Values, see “Dynamic Values” on page 477.
Using Maya: Modeling
499
Polygonal Modeling
Random
Beyond the Basics Duplicating parts of polygons
Duplicating parts of polygons Use Duplicate to make an exact copy of selected facets. Afterwards, the duplicated will be the current set.
To duplicate facets: 1
Select an object whose facets you want to duplicate.
2
Press F11 to select facets.
3
Marquee-select the facets you want to duplicate. You can change the way facets are displayed by selecting Options → General Preferences → Modeling. In the window, set the Select Facets with option to either Center or Whole facet.
4
Select Polygons → Facets → Duplicate. The selected facets are duplicated. You can change their shape, location, orientation, and their size with the manipulators. Using the transform handles is the easiest way to manipulate duplicated facets, but you can also enter specific values in the Channel Box. Also see “Using the local and global pivot” on page 472.
5
Select another group of facets that you want to duplicate, or use the same facets, and select Edit → Repeat (G) to duplicate them again. Pressing G repeatedly duplicates the same facets. Thus, you can create a series of duplicates depending on the options set in the options window. To return to the original object, press Ctrl-Z.
6
Change the duplicate settings again in the options window if you wish and then click Duplicate.
Duplicating perpendicular to the geometry To duplicate along a facet normal, in the options window set the Z value for Local Values Translate to 1, and then click the Duplicate button.
Changing the duplicate You can change the settings in the options window before you create a duplicate. To change the duplicate after you create it, use the Attribute Editor.
500
Using Maya: Modeling
Beyond the Basics Duplicating parts of polygons
Select facets (F11).
Make a copy and move.
Y Z
Y X Shift
Can extend the copy operation on the same or new group.
Y
Y Z
X
Polygonal Modeling
Scale the duplicates 85%.
+
Z
X
Z
X
Changing the pivot The pivot defines the center point in the X-, Y-, or Z-axis. You rotate or scale the facet from this center point. After duplicating facets, you can change the Pivot in the Channel Box or Attribute Editor (Window → Attribute Editor).
Using Maya: Modeling
501
Beyond the Basics Duplicating parts of polygons
Setting Duplicate options Choose Polygons → Facets → Duplicate - ❐ to display the options. A window with the following options appears.
Manipulator on Global values
Controls whether components are transformed using local values or global values. By default, this option is set to local values. This means that components such as facets are transformed separately according to the local axes of each facet. When you turn off Manipulator on Global values, components are transformed globally relative to a single reference point.
Local Values Offset
Offsets the facet edges.
Translate
Moves locally along the X-, Y-, or Z-axis. Positive or negative values indicate how far the duplicated facet or facets are moved.
Rotate
Sets the angle at which you want to rotate the facet or facets being duplicated locally around the X-, Y-, or Z-axis.
Scale
Scales locally along the X-, Y-, or Z-axis.
502
Using Maya: Modeling
Beyond the Basics Duplicating parts of polygons Direction
Sets the location of the X-, Y-, or Z-point in the local axis.
Global Values Translate
Moves the facet or facets being duplicated along the X-, Y-, or Z-axis.
Rotate
Sets the angle by which you want to rotate the facet or facets being duplicated around the X-, Y-, or Z-axis.
Scale
Scales the duplicated facets along the X-, Y-, or Z-axis.
Other Values Changes facets by a random amount, ranging from 0 to 1.
World Space Coords
Turn on or off the World Space Coords to use the world coordinate system when you are changing values randomly. For an explanation of Dynamic Values, see “Dynamic Values” on page 477.
Using Maya: Modeling
503
Polygonal Modeling
Random
Beyond the Basics Triangulating
Triangulating Use Triangulate to break polygons down into triangles. This ensures that all your polygons are co-planar and without holes. Triangulation has been designed to improve rendering results, particularly when models include non-planar facets.
To triangulate facets: 1
Select an object whose facets you want to move.
2
Press F11 to select facets.
3
Marquee-select the facets you want to triangulate. You can change the way facets are displayed by selecting Options → General Preferences → Modeling. In the window, set the Select Facets with option to either Center or Whole facet.
4
Select Polygons → Facets → Triangulate. The facets are triangulated across their center.
5
504
Continue triangulating other facets or take some other action.
Using Maya: Modeling
Beyond the Basics Quadrangulating
Quadrangulating Use Quadrangulate to merge triangles of a polygonal object into four-sided facets.
Quadrangulating facets: 1
Select an object you want to quadrangulate.
2
Press F11 to select facets.
3
Marquee-select the facets or sets of facets you want to quadrangulate.
4
Select Polygons → Facets → Quadrangulate. The facets are quadrangulated.
5
Continue quadrangulating other facets or take some other action.
Setting Quadrangulate options Choose Polygons → Facets → Quadrangulate - ❐ to display the options window.
Angle Threshold
Sets the limit beyond which two triangles are merged or not. If Angle Threshold is 0, only co-planar triangles are merged. The maximum angle is 180 degrees. A value of 180 degrees means that all possible triangles are quadrangulated.
Keep Facet Group Border
If on, the borders of facet sets are maintained. If off, the borders of facet sets can be modified.
Using Maya: Modeling
505
Polygonal Modeling
You can change the way facets are displayed by selecting Options → General Preferences → Modeling. In the window, set the Select Facets with option to either Center or Whole facet.
Beyond the Basics Quadrangulating Keep Hard Edges
If on, the hard edges are maintained. If off, the hard edges may be deleted between two triangles.
Keep Texture Border
If on, the borders of texture maps are maintained. If off, the borders of texture maps may be modified.
World Space Coords
Turn on or off to use the world coordinate system.
506
The original object is a triangulated mesh as shown in Smooth Shaded.
In wireframe.
The object after quadrangulating.
In wireframe.
Using Maya: Modeling
Beyond the Basics Quadrangulating
In wireframe.
The mesh is quadrangulated using an angle of 180° as shown in wireframe and Smooth Shaded. The following two options are turned on: Keep Facet Group Border Keep Texture Border but Hard Edges is turned off.
In wireframe.
Using Maya: Modeling
Polygonal Modeling
The mesh is quadrangulated using an angle of 180° as shown in wireframe and Smooth Shaded. The following options are turned on: Keep Facet Group Border Keep Hard Edges Keep Texture Border.
507
Beyond the Basics Quadrangulating
The original object is a triangulated mesh.
With Keep Facet Group Border turned on, the border of the map is maintained.
508
Using Maya: Modeling
Two sets of facets are quadrangulated. With Keep Facet Group Border turned off, the triangulated border between the two groups is not kept.
Beyond the Basics Quadrangulating
Polygonal Modeling
The original mesh is twisted and already triangulated.
Angle = 0
The mesh is quadrangulated with an angle of zero; all the Keep parameters are set to Off. There are 132 facets, 68 quads, and 64 triangles. Only the neighboring facets in the same plane are quadrangulated.
Angle = 10
The mesh is quadrangulated with an angle of 10; all the Keep parameters are set to Off. There are 100 facets, 100 quads, and no triangles.
Using Maya: Modeling
509
Beyond the Basics Trimming facets
Trimming facets The Trim Facet Tool tool merges two facets. The second facet becomes a hole in the first facet. The facet with the new hole is placed at the first or last facet selected, or between both facets.
To trim facets: 1
Select Polygons → Facets → Trim Facet Tool. Once you select this tool, Maya is in object selection mode and the facet centers are displayed so that you can easily select them.
2
Click the left mouse button on the facet you want to trim.
3
Click to select the second facet you want to use as a hole.
4
Validate by pressing Y and continue trimming other facets, or validate and exit by pressing Enter.
Note Do not confuse this command with the removal of an facet by pressing Backspace in component mode.
Setting Trim Facet options Select Polygons → Facets → Trim Facet Tool - ❐ to display the options window.
First
The first facet you click stays in place whereas the second facet you click is moved to trim its new outer loop.
Middle
The new facet is equidistant between the first and the second facet—both facets you click are moved.
510
Using Maya: Modeling
Beyond the Basics Trimming facets Second
The second facet you click stays in place whereas the first facet you click is moved to surround the new hole.
Note Maya won’t trim facets that may result in strange polygons. For example, you are not allowed to select a second facet that is a neighbor of the first facet.
Using Maya: Modeling
511
Polygonal Modeling
To do several trims on the same object, you do not need to validate each individual trim by pressing Y. Instead, select the pair of facets for the first trim, then selecting the first facet for the second trim automatically validates the first trim.
Beyond the Basics Changing the normals
Changing the normals The normal shows in which direction a facet is facing. Objects made in Maya always have consistent normals. However, the normals may not be correct if the object was made by another modeler. The following three options help correct poorly oriented normals: Conform
Takes the direction used by the majority of the normals, and forces all normals to take that direction. If 51 out of 100 normals face outward, all 100 will face outward. You can use sets of objects.
Propagate
Select a normal of a facet and echo its direction throughout the rest of the object, thus creating normals consistent with the one selected. If the selected normal faces outward, then all the normals will face outward. Select a facet and select Polygons → Normals → Propagate.
Reverse
Reverses the normals of a facet. You can use groups of facets.
To change normals: 1
Display normals by selecting Display → Polygon Normals → Toggle Normals. A line indicating the direction of the normal appears on the facets. You can also control the length of this line representing the normal by selecting Display → Polygon Normals → Long (or Medium or Short).
2
Press F11 to select facets.
3
Marquee-select facets whose normals you want to change.
4
Select Polygons → Normals → Reverse (or Propagate, or Conform).
For
Select
Reverse
one or more facets or a group of facets
Conform
a group of facets
Propagate
a single facet
Depending on the operation you do, the normals of the selected facets are reversed or the normals for a group of facets now conform or the normals of the facets point in the same direction as the normal of a single facet.
512
Using Maya: Modeling
Beyond the Basics Changing the normals 5
Marquee-select another group of facets whose normals you want to flip or use the same facets and select Edit → Repeat (G) to repeat the same operation.
6
Continue changing the normals of other facets, or select another operation.
Note Using Reverse might create databases that are invalid for functions such as Extrude.
1
2
+
Use Reverse to flip all normals. 1
Use Propagate to force all normals to direction of selected single facet.
1
Shift
Polygonal Modeling
Use Conform to force all normals to direction of overall majority.
2
Shift
+
The result.
2
Shift
+
Using Maya: Modeling
513
Beyond the Basics Uniting polygons
Uniting polygons Use Unite to combine several selected objects to form an even larger single object. This is useful when you want to use tools such as Append, Merge Edge, or Trim Facet. When using Unite, avoid creating invalid objects. Invalid objects are those with inconsistent normals across their different parts. Any materials previously assigned to the original objects are maintained when you use Unite. Do not: •
Unite objects with opposing normals.
•
Unite objects with same normals if one lies entirely within the other.
•
Unite intersecting objects.
To unite polygons: 1
Turn on object selection mode by toggling F8 or clicking the Select by object type icon.
2
Marquee-select the objects you want to unite into a single object.
3
Select Polygons → Unite. All selected objects become pieces in the new object. Now when you click on one of the objects, they are activated as one object but they are retained at their original coordinates.
4
Continue uniting other polygons or take some other action.
Tip Before appending polygons between two separate shapes, or before using Merge Edge Tool or Trim Facet Tool, you must use Unite.
514
Using Maya: Modeling
Beyond the Basics Separating polygons
Separating polygons Separate breaks an object into distinct objects. The object you want to separate must consist of several pieces that were previously added together— for example, objects produced by the Unite command (Polygons → Unite) or a primitive from which you removed all the facets in a row.
To separate polygonal objects: Turn on object selection mode by toggling F8 or clicking the Select by object type icon.
2
Marquee-select the polygonal objects you want to separate.
3
Select Polygons → Separate. The objects are separated into individual shapes and for example you can do a transform on one without affecting the other. But the individual shapes are still parented to the initial shape reference so that you can still drag them together as well.
Using Maya: Modeling
515
Polygonal Modeling
1
Beyond the Basics Smoothing polygons
Smoothing polygons Smooth modifies the topology of polygonal objects by smoothing out vertices and their connected edges. Doing so leads to smoother objects. Smoothing expands each vertex and each edge into a new facet. These facets will be either positioned at an offset or scaled towards the original facet center. Smoothing works with convex and even star-shaped concave facets. However, it can give unwanted results with concave facets. This happens when the center of the facet is in the outer facet domain. Smoothing works only for entire objects.
To make polygons smooth: 1
Select a polygonal object that you want to smooth by dragging over the object in a view. Whether you select a single component such as a facet or a vertex, the entire object is smoothed.
2
Select Polygons → Smooth. By default, Maya automatically smooths your objects using a built-in smoothness setting.
3
When the smoothing is to your liking, you can stop the smoothing process at a particular stage, by pressing Esc. This is a good way to get the smoothing results that look best for you.
4
To continue smoothing repeatedly on the same object, select Edit → Repeat (G) or select a new object (toggle F8). An object can be smoothed in a single smoothing pass or many passes may be used. Each next smoothing pass increases the smoothness based on the number selected in the options box. The following example shows how to turn a hard-edged geometric object into a flowing, organic shape.
516
Using Maya: Modeling
Beyond the Basics Smoothing polygons
Polygonal Modeling
Object before smoothing
Smoothed with subdivision = 1
Smoothed with subdivision = 2
Setting the Smooth option Choose Polygons → Smooth - ❐ to display the options window.
Using Maya: Modeling
517
Beyond the Basics Smoothing polygons Smoothness
Use the slider or enter a value to change the degree of smoothness to be applied (the default is 1). The following formula will help you understand the amount of smoothing to be done depending on the value of smoothness you define: Number of new facets created = (N) multiplied by 4x where N is the number of facets to be smoothed and x is the smoothness value you define.
518
Using Maya: Modeling
Beyond the Basics Using smart command settings
Using smart command settings Each polygonal command has default display properties for showing which components are selected. If you find these display properties unsuitable, you can change them using Polygons → Smart Command Settings. For example, Close Border concerns border edges only but you can force Maya to change the display of the border edge for special emphasis, prior to closing a border. By default, Smart Command Settings is turned off.
To change the selection and display properties of commands: Turn on smart settings by selecting Polygons → Smart Command Settings.
2
Hold down Shift and choose a polygonal command.
Polygonal Modeling
1
An alternative is to select a command without first selecting any components. 3
Select the properties you want to change. The properties of the selected command become the current properties of that command.
Note To revert to the default properties of a polygonal command, select Polygons → Uninstall Current Settings (see “Cancelling smart command settings” on page 521).
Using Maya: Modeling
519
Beyond the Basics Applying an action to several components
Applying an action to several components Normally, applying an action affects the component you selected. You can use Convert Selection to apply an action to all the components of an object at once. In general, use Convert Selection as you work. For example, in such commands as Soft/Hard edges, Close Border, or Extrude, you can force Maya to apply an action to the appropriate components in one go.
To apply an action to several components at once: 1
Turn on Convert Selection by selecting Polygons → Convert Selection. When you turn off Polygons → Smart Convert Selection, an action affects only the individual component you select.
2
Select an object.
3
Apply an action. Select any polygonal command and the action is applied to all the components of the selected object.
520
Using Maya: Modeling
Beyond the Basics Cancelling smart command settings
Cancelling smart command settings Each polygonal command has default display properties that you can change using Polygons → Smart Command Settings. Use Uninstall Current Settings to clear all changes you have made to the properties of each polygonal command and reset them to their default values.
To reset the default properties of commands: Select Polygons → Uninstall Current Settings.
2
Hold down Shift and choose a polygonal command whose properties you want to reset. An alternative is to select a command without first selecting any components. The current properties of the selected command are reset to their default values.
Using Maya: Modeling
521
Polygonal Modeling
1
Beyond the Basics Cancelling smart command settings
522
Using Maya: Modeling
12
Texturing Polygons Your polygonal models can have the look you want. This chapter shows you how to give your polygonal models the most appealing appearance possible by using texture mapping techniques. For example in this image, the flowers make a polygonal planar primitive look as if it were a tablecloth. Polygonal Modeling
Topics include: •
“Mapping polygons” on page 524
•
“Creating a projection” on page 525
•
“Making a planar map” on page 528
•
“Making a cylindrical map” on page 538
•
“Making a spherical map” on page 543
•
“Assigning a shader to each projection” on page 548
•
“The Texture View” on page 549
•
“Moving texture coordinates” on page 553
•
“Deleting a map” on page 562
•
“Cutting textures” on page 563 and “Sewing textures” on page 564
Using Maya: Modeling
523
Texturing Polygons Mapping polygons
Mapping polygons Placing texture maps on polygonal objects is a type of mapping known as parametric mapping. Parametric mapping lets you directly control the map layout and location by clicking and dragging. It is a great way of placing maps on intricate areas of objects such as around the eyes, chin, mouth, and so on. One valuable feature of using polygonal textures is that you can flatten out objects. This is also good for working precisely on irregularly shaped or intricate objects such as a shoe. If your object is made from surfaces, select Edit Surfaces → NURBS to Polygons to convert it to polygons. See “Converting NURBS to polygons” on page 252. Before you start to do mapping, you should have a good idea about how you want the object to be colored in the final rendered image. Try to avoid mapping on closed objects with a single set because closed objects are difficult to “completely flatten out” and may not close neatly at the ends. For example, assume that you want to map an image onto a football. It is desirable to create at least two sets on the football—one on each half— instead of a single set. Then you place the image on the two separate sets. The basic purpose of mapping is to ensure that the map will fit onto the object. You need to anticipate cases where this may not be so. Each polygonal object that you want to map contains an UV reference. This is similar to a geographic reference—such as a street address or a pair of latitude and longitude coordinates—that allows Maya to identify the appropriate location of the map on the object.
The tiger skin, mapped as a texture map, exactly fits onto the irregular surface of the tiger.
Texture map matching the flattened tiger in the Texture View.
You can use whatever program you like to create a texture map.
524
Using Maya: Modeling
Texturing Polygons Creating a projection
Creating a projection Think of the texture as being projected onto a polygon rather than being on the surface of a geometry. There are three ways of projecting a texture onto a model: planar, spherical, or cylindrical. You can only use one at a time. Choosing the proper projection is an important step because if you change your choice of projection later on, you will lose your work. In practice, this means that you should not change from one projection to another after you project a texture map. In general, you need to match the projection type to the geometry. Choose: planar projection for a planar-like model, for example, mapping something onto a billboard
•
spherical for a spherical model, for example, wrapping a picture of the earth onto a sphere
•
cylindrical for a box-like model; for example, mapping brick texture around a building Experiment with the various mapping methods—spherical, cubic, and planar—applying each one to a simple brick tower.
Planar projection makes the map flat in shape.
Cylindrical projection makes the map cylindrical in shape.
Spherical projection makes the map spherical in shape.
If a texture does not fit exactly onto a geometry, Maya bends or stretches the texture so that it does fit the geometry. In this example, the brick texture fits a planar projection exactly, however the texture is stretched to fit a cylindrical or spherical projection.
Using Maya: Modeling
525
Polygonal Modeling
•
Texturing Polygons Creating a projection
Map-positioning manipulators To project a map onto an object, you must choose one of the projection types: planar, spherical, or cylindrical (you can only choose one at a time). For each type of projection, you use a slightly different manipulator. To help you place your map on the model, you can move the manipulator anywhere on your model. To use this manipulator, you click-drag the appropriate handle, including the part of the lines appearing in color. As you drag and click in the 3D view, your changes affect how your map is going to be placed on the database. You can see this in the Texture View as well as the 3D views in the Smooth Shaded mode. You click-drag handles until the entity is where you want it. To position maps precisely, use the positioning manipulator in combination with the settings in the options window and the Channel Box. Clicking in empty space automatically returns the cursor to the last point that you selected. This is useful when you are not sure where you clicked.
U and V space Because Maya must put a numeric value on the locations of each point of the surface receiving the map, the coordinates are expressed in U and V dimensions and not in the more standard XYZ coordinates. The U and V dimensions represent a plane (U for the width and V for the height). A texture map is always defined by the coordinates U for the horizontal component, and V for the vertical component. Each ranges in values from 0.0 to 1.0, as shown. The lower left corner of the UV grid is defined as U=0 and V=0. (0 1)
(1 1)
V
(0 0)
(1 0) U
526
Using Maya: Modeling
Texturing Polygons Creating a projection The rectangular area is superimposed on the outer surface of your model, indicating how the selected group of facets will receive the map. By controlling this rectangular area (within the boundaries of those lines), a map of the dimensions and shape you designate appears on the model.
Example of projecting maps Create two sets. Then project the texture maps onto each set. Finally, use Move Component to arrange the UV points of the textures. A bump map was also applied to the can. Polygonal Modeling
A soda can with two projections—a cylindrical and a planar.
The same soda can but using a different texture.
Using Maya: Modeling
527
Texturing Polygons Making a planar map
Making a planar map Planar Mapping is used to project a texture map onto an object by using the projection plane of the texture map. This type of projection is best suited to flat objects such as a billboard.
To create a planar map: 1
Press F11 to select facets.
2
In a view, click a set of facets on which to make a planar map or marqueeselect facets.
3
Select Polygons → Texture → Planar Mapping. The map is projected based on the settings in the options window.
4
Change the projection settings again in the options window if you wish and then click Project. Only the most recent projection is retained.
5
Use the map-editing manipulators to indicate where on the 3D object the map will be projected. By default, the manipulators automatically appear relative to the object; you can designate which axis is to be used by using the options window. You can toggle back and forth between the projection manipulator and the transform manipulator to refine the shape of the map naturally.
6
Select Window → Multilister and in the Multilister, select the shading group that you want to assign to the object or selected facets. Initially, your selection in a modeling view has no material assigned. To see your map appear on your selection in a modeling view, you must assign a material such as a Phong. For example, to create a Phong shading group, select Edit → Create. In the Create Render Node window, click the Materials tab, click Phong, and close the Create Render Node window. If necessary, click the General tab to see shading groups in the Multilister. For more information on the Multilister, see the Using Maya: Rendering book.
528
7
Double-click the shading group to display the Attribute Editor.
8
Under the Common Material Attributes, click the Map button to the right of the Color parameter.
Using Maya: Modeling
Texturing Polygons Making a planar map This assigns a map to the color but you can assign the map to other parameters if you wish. The Textures tab appears. By default, Normal is turned on. This means that the UV coordinates present in the object or the selected facets where you want to project the map will be used.
9
Click the left mouse button on a 2D texture of your choice.
Using Maya: Modeling
529
Polygonal Modeling
After you click Map.
Texturing Polygons Making a planar map
For example, select a texture such as File. If you click File, then in the Attribute Editor, click Browse under the File Attributes section and choose the texture name, including its location by specifying the path. The referenced map is usually in the same location as the map you load into the Texture View.
530
Using Maya: Modeling
Texturing Polygons Making a planar map
The material is assigned to the facets you selected in the modeling view and the material in turn has a map assigned to one of its parameters such as Color. If you have trouble selecting objects in a modeling view, use the Outliner. 11 To see the map on the object in a modeling view, select Shading → Hardware Texturing (press 6).
Press 6 to see your map in a modeling view.
12 Adjust the mapping manipulators again, if desired or use the settings in the options window. 13 Select Window → Rendering Editors → Render View and in the Render View window, either click the right mouse button on Render from the popup menu and choose a view in which to render, or use Render → camera and then select a view. You will also find Redo Previous Render useful. Using Maya: Modeling
531
Polygonal Modeling
10 With both the facets you want to project onto in the modeling view and the shading group in the Multilister selected, use Edit → Assign in the Multilister.
Texturing Polygons Making a planar map After the rendering is done, you can see a rendered version of the mapped object.
Using the planar mapping manipulators The mapping manipulators consist of the projection manipulator and the transform manipulator. You can manipulate a map by dragging the color-coded control points of the projection manipulator. To further control the shape of the projection manipulator, you can use the transform manipulator. Drag one of the corner points to simultaneously change the width (U) and height (V) of the area where you are going to project the map. Projection center Changes the point in the Y-axis (in green), from which the map is projected. Moves the map freely along the X-axis and Y-axis. Changes the width (U) of the map. Changes the point in the X-axis (in red), from which the map is projected. Changes the width (U) and height (V) of the map simultaneously.
Changes the height (V) of the map. Switches to the transform manipulator.
The advantage of the transform manipulator is that it lets you move, rotate, and scale the underlying projection manipulator for fitting a map onto an object. You should remember that it is not the map you are transforming, but rather the manipulator for projecting the map.
532
Using Maya: Modeling
Texturing Polygons Making a planar map
Rotating a map Click the red, green, or blue circle to rotate the map in the X-, Y-, or Z-direction. Scaling along a single axis Click a red, green, or blue box to the scale the map in the X-, Y-, or Z-direction.
Scaling along all three axes To scale in all three directions at once, click-drag the box at the center of the manipulator. Moving on all three axes Clicking the hollow circle at the center of the manipulator moves the map in all three directions at once, setting a new XYZ point. Switches to the projection manipulator.
Setting Planar Projection options Choose Polygons → Texture → Planar Mapping - ❐ to display the options window.
Using Maya: Modeling
533
Polygonal Modeling
Moving along a single axis Click a red, green, or blue arrow to move the map in the X-, Y-, or Z-direction.
Texturing Polygons Making a planar map Mapping Rotations
Rotates the manipulator in the 3D view around the manipulator’s X-, Y-, or Z-axis.
Original settings.
Rotate the manipulator by 45 degrees around the manipulator’s X axis.
Rotate the manipulator by 45 degrees around the manipulator’s Y-axis.
Rotate the manipulator by 45 degrees around the manipulator’s Z-axis.
534
Using Maya: Modeling
Texturing Polygons Making a planar map Image Center
Sets the center of the 2D map in the X-, Y-, or Z-axis.
Polygonal Modeling
Move the center of the 2D map to 0.7 in the X-axis.
Center for the X and Y axes is 0.5. Move the center of the 2D map to 0.7 in the Y-axis.
Image Rotation
Changes the angle at which a map is rotated in the 2D window. Drag the slider to rotate the image to some angle.
Image Scale
Changes the width (U) or the height (V) of the 2D map relative to the 2D centerpoint.
Move the U (width) to 1.5.
Default value for U and V is 1.
Move the V (height) to 1.5. Keep Image Ratio
By default, Keep Image Ratio is turned on to let Maya display the shape of the projection manipulator as a square.
Using Maya: Modeling
535
Texturing Polygons Making a planar map
Changing the projection center The projection center defines the point of origin in the X-, Y-, or Z-axis from where you can project a texture map. By default, this is the center of the selected facets in the X-, Y-, or Z-axis. After creating a projection, you can change the Projection Center in the Channel Box or Attribute Editor.
536
Default manipulator settings.
Move the projection center to 0.2 in the X-axis.
Move the projection center to 0.2 in the Y-axis.
Move the projection center to 0.2 in the Z-axis.
Using Maya: Modeling
Texturing Polygons Making a planar map
You can enter new values for the Projection Center in the Channel Box.
Polygonal Modeling
You can enter new values for the Projection Scale in the Channel Box.
Changing the projection scale Scaling a projection enlarges or reduces the width (U) or the height (V) of the map, or both relative to the 3D projection axis. After creating a projection, you can change the Projection Scale in the Channel Box or Attribute Editor.
Move the U (width) to 1.5
Move the V (height) to 1.5
Default value for U and V is 1.
Using Maya: Modeling
537
Texturing Polygons Making a cylindrical map
Making a cylindrical map Cylindrical Projection bends a texture map into a cylindrical shape. Because this type of projection resembles wrapping a texture map around a cylinder, it is best suited to cylindrical objects such as a brick.
To create a cylindrical map: 1
Press F11 to select facets.
2
In a view, click a set of facets on which to make a cylindrical map or marquee-select facets.
3
Select Polygons →Texture → Cylindrical Mapping. The map is projected based on the settings in the options window.
4
Change the projection settings again in the options window if you wish and then click Project. Only the most recent projection is retained.
5
Use the map-editing manipulators to indicate where on the 3D object the map will be projected. By default, the manipulators automatically appear relative to the object; you can designate which axis is to be used by using the options window. You can toggle back and forth between the projection manipulator and the transform manipulator to refine the shape of the map naturally.
6
Select Window → Multilister and in the Multilister, select the shading group that you want to assign to the object or selected facets. Initially, your selection in a modeling view has no material assigned. To see your map appear on your selection in a modeling view, you must assign a material such as a Phong. For example, to create a Phong shading group, select Edit → Create. In the Create Render Node window, click the Materials tab, click Phong, and close the Create Render Node window. If necessary, click the General tab to see shading groups in the Multilister. For more information on the Multilister, see the Using Maya: Rendering book.
538
7
Double-click the shading group to display the Attribute Editor.
8
Under the Common Material Attributes, click the Map button to the right of the Color parameter.
Using Maya: Modeling
Texturing Polygons Making a cylindrical map This assigns a map to the color but you can assign the map to other parameters if you wish. The Textures tab appears. By default, Normal is turned on. This means that the UV coordinates present in the object or the selected facets where you want to project the map will be used. 9
Click the left mouse button on a 2D texture of your choice. For example, select a texture such as File. If you click File, then in the Attribute Editor, click Browse under the File Attributes section and choose the texture name, including its location by specifying the path. The referenced map is usually in the same location as the map you load into the Texture View.
The material is assigned to the facets you selected in the modeling view and the material in turn has a map assigned to one of its parameters such as Color. 11 To see the map on the object in a modeling view, select Shading → Hardware Texturing (press 6). 12 Adjust the mapping manipulators again, if desired or use the settings in the options window. 13 Select Window → Rendering Editors → Render View and in the Render View window, either click the right mouse button on Render from the popup menu and choose a view in which to render, or use Render → Camera and then select a view. After the rendering is done, you can see a rendered version of the mapped object.
Using the cylindrical mapping manipulators The mapping manipulators consist of the projection manipulator and the transform manipulator. You can manipulate a map by dragging the colorcoded control points of the projection manipulator. To further control the shape of the projection manipulator, you can use the transform manipulator.
Using Maya: Modeling
539
Polygonal Modeling
10 With both the facets you want to project onto in the modeling view and the shading group in the Multilister selected, use Edit → Assign in the Multilister.
Texturing Polygons Making a cylindrical map
Drag one of the corner points to simultaneously change the width (U) and height (V) of the area where you are going to project the map. Projection center
Changes the width (U) of the map. Changes the point in the X-axis, from which the map is projected. Moves the map in any direction, making the map pivot around the projection center. Changes the point in the Y-axis, from which the map is projected. Changes the height of the map (V). Switches to the transform manipulator.
Projection axis.
The advantage of the transform manipulator is that it lets you move, rotate, and scale the underlying projection manipulator for fitting a map onto an object.
540
Using Maya: Modeling
Texturing Polygons Making a cylindrical map
Rotating a map Click the red, green, or blue circle to rotate the map in the X-, Y-, or Z-direction. Scaling along a single axis Click a red, green, or blue box to the scale the map in the X-, Y-, or Z-direction.
Polygonal Modeling
Moving along a single axis Click a red, green, or blue arrow to move the map in the X-, Y-, or Z-direction. Moving on all three axes Clicking the hollow circle at the center of the manipulator moves the map in all three directions at once, setting a new XYZ point. Scaling along all three axes To scale in all three directions at once, click and drag the box at the center of the manipulator. Switches to the projection manipulator.
Setting Cylindrical Projection options Select Polygons → Texture → Cylindrical Mapping - ❐ to display the options window.
Using Maya: Modeling
541
Texturing Polygons Making a cylindrical map Mapping Rotations
Rotates the manipulator in the 3D view around the manipulator’s X-, Y-, or Z-axis.
Projection Scale Aperture
Scales the width (U) of the map relative to the 3D projection axis.
Image Center
Sets the center of the 2D map in the X-axis, or Y-axis.
Image Rotation
Changes the angle at which a map is rotated in the 2D window. Drag the slider to rotate the image to some angle.
Image Scale
Changes the width (U) or the height (V) of the 2D map relative to the 2D centerpoint.
Keep Image Ratio
By default, Keep Image Ratio is turned on to let Maya display the shape of the projection manipulator as a square.
Changing the projection center The projection center defines the point of origin in the X-, Y-, or Z-axis from where you can project a texture map. By default, this is the center of the selected facets in the X-, Y-, or Z-axis. After creating a projection, you can change the Projection Center in the Channel Box or Attribute Editor.
Changing the projection scale width Scaling a projection enlarges or reduces the height (V) of a map relative to the 3D projection axis. After creating a projection, you can change the Projection Scale Width in the Channel Box or Attribute Editor.
542
Using Maya: Modeling
Texturing Polygons Making a spherical map
Making a spherical map Spherical Projection bends a texture map into a spherical shape. This type of projection is best suited to spherical objects such as a football.
To create a spherical map: 1
Press F11 to select facets.
2
In a view, click a set of facets on which to make a spherical map or marqueeselect facets.
3
Select Polygons → Texture → Spherical Mapping.
4
Change the projection settings again in the options window if you wish and then click Project. Only the most recent projection is retained.
5
Use the map-editing manipulators to indicate where on the 3D object the map will be projected. By default, the manipulators automatically appear relative to the object; you can designate which axis is to be used by using the options window. You can toggle back and forth between the projection manipulator and the transform manipulator to refine the shape of the map naturally.
6
Select Window → Multilister and in the Multilister, select the shading group that you want to assign to the object or selected facets. Initially, your selection in a modeling view has no material assigned. To see your map appear on your selection in a modeling view, you must assign a material such as a Phong. For example, to create a Phong shading group, select Edit → Create. In the Create Render Node window, click the Materials tab, click Phong, and close the Create Render Node window. If necessary, click the General tab to see shading groups in the Multilister. For more information on the Multilister, see the Using Maya: Rendering book.
7
Double-click the shading group to display the Attribute Editor.
8
Under the Common Material Attributes, click the Map button to the right of the Color parameter.
Using Maya: Modeling
543
Polygonal Modeling
The map is projected based on the settings in the options window.
Texturing Polygons Making a spherical map This assigns a map to the color but you can assign the map to other parameters if you wish. The Textures tab appears. By default, Normal is turned on. This means that the UV coordinates present in the object or the selected facets where you want to project the map will be used. 9
Click the left mouse button on a 2D texture of your choice. For example, select a texture such as File. If you click File, then in the Attribute Editor, click Browse under the File Attributes section and choose the texture name, including its location by specifying the path. The referenced map is usually in the same location as the map you load into the Texture View.
10 With both the facets you want to project onto in the modeling view and the shading group in the Multilister selected, use Edit → Assign in the Multilister. The material is assigned to the facets you selected in the modeling view and the material in turn has a map assigned to one of its parameters such as Color. 11 To see the map on the object in a modeling view, select Shading → Hardware Texturing (press 6). 12 Adjust the mapping manipulators again, if desired or use the settings in the options window. 13 Select Window → Rendering Editors → Render View and in the Render View window, either click the right mouse button on Render from the popup menu and choose a view in which to render, or use Render → Camera and then select a view. You will also find Redo Previous Render useful. After the rendering is done, you can see a rendered version of the mapped object.
Using the spherical mapping manipulators The mapping manipulators consist of the projection manipulator and the transform manipulator. You can manipulate a map by dragging the colorcoded control points of the projection manipulator. To further control the shape of the projection manipulator, you can use the transform manipulator.
544
Using Maya: Modeling
Texturing Polygons Making a spherical map
Drag one of the corner points to simultaneously change the width (U) and height (V) of the area where you are going to project the map.
Changes the height of the map. Changes the width of the map.
Moves the map in any direction, making the map pivot around the projection center. Changes the point in the Y-axis, from which the map is projected.
Projection center. Switches to the transform manipulator.
Projection axis.
The advantage of the transform manipulator is that it lets you move, rotate, and scale the underlying projection manipulator for fitting a map onto an object.
Using Maya: Modeling
545
Polygonal Modeling
Changes the point in the X-axis, from which the map is projected.
Texturing Polygons Making a spherical map
Rotating a map Click the red, green, or blue circle to rotate the map in the X-, Y-, or Z-direction. Scaling along a single axis Click a red, green, or blue box to the scale the map in the X-, Y-, or Z-direction.
Moving along a single axis Click a red, green, or blue arrow to move the map in the X-, Y-, or Z-direction.
Scaling along all three axes To scale in all three directions at once, click and drag the box at the center of the manipulator.
Switches to the projection manipulator.
Moving on all three axes Clicking the hollow circle at the center of the manipulator moves the map in all three directions at once, setting a new XYZ point.
Setting Spherical Projection options Select Polygons → Texture → Spherical Mapping - ❐ to display the options window.
546
Using Maya: Modeling
Texturing Polygons Making a spherical map Rotates the manipulator in the 3D view around the manipulator’s X-, Y-, or Z-axis.
Projection Scale Aperture
Scales the width of the map relative to the 3D projection axis.
Projection Scale Height
Scales the height of the map relative to the 3D projection axis.
Image Center
Sets the center of the 2D map in the X-axis, or the Y-axis.
Image Rotation
Changes the angle at which a map is rotated in the 2D window. Drag the slider to rotate the image to some angle.
Image Scale
Changes the width (U) or the height (V) of the 2D map relative to the 2D centerpoint.
Changing the projection center The projection center defines the point of origin in the X-, Y-, or Z-axis from where you can project a texture map. By default, this is the center of the selected facets in the X-, Y-, or Z-axis. After creating a projection, you can change the Projection Center in the Channel Box or Attribute Editor.
Using Maya: Modeling
547
Polygonal Modeling
Mapping Rotations
Texturing Polygons Assigning a shader to each projection
Assigning a shader to each projection When you create a projection, it helpful to have a map to indicate where the UV coordinates have been assigned. Turn on Polygons → Texture → Assign shader to each projection to assign the Checker texture to your object or set. The area being mapped is temporarily shown by the Checker, but you can change the map assignment to any map of your choice. The Checker texture makes it easier to distinguish which areas are being mapped. In the Multilister, the Checker texture is added to the Textures tab.
A checker texture is automatically assigned.
For more information on the Shading Group Editor, see the Using Maya: Rendering book.
548
Using Maya: Modeling
Texturing Polygons The Texture View
The Texture View This section explains how to use the Texture View window. To open the Texture View window, select Window → Rendering Editors → Texture View. Until you create a projection, nothing appears in the Texture View except the current texture image that you load. The Texture View is empty when it first opens. To load a texture map into the Texture View, select Images → Load from Disk (you can also press the right mouse button to see the pop-up menus in the Texture View). Polygonal Modeling
Loading a texture map into the Texture view window.
In the Texture View, you define the mapping relation between the map and the model by positioning vertices in relation to areas of your map, according to the underlying colors in the map. You can manipulate things directly by clicking and dragging in this window. If the 2D layout of your object is not readily visible in the Texture View, you may frame it by clicking the right mouse button on Frame: All in the View menu.
Using the Texture View You can specify how to display a texture (Display menu), how to view a texture (View menu), and how to load a texture (Images menu) by using the following pop-up menus. With the right mouse button in the Texture View, click to choose the Display, View, or Images pop-up menus.
Using Maya: Modeling
549
Texturing Polygons The Texture View
Display menu In the Texture View, click the right mouse button on Display and choose any of the following: Red Plane
Displays the red plane only.
Green Plane
Displays the green plane only.
Blue Plane
Displays the blue plane only.
All Planes
Displays all planes.
Luminance
Lets you change the brightness of the texture in the Texture View. Drag the slider at the bottom of the Texture View to change the intensity of a texture.
Mask Plane
Displays the mask only.
Show Grid
Shows or hides the grid. This is an on-off toggle. When you select Display → Grid - ❐, you will see the following options in the options box— Grid, Subdivisions, Extent, and Style. These options are the same as when you select Display → Grid - ❐ and are described in the Using Maya: Basics book.
Single Buffer
On SGI machines without texture hardware, you might want to turn Single buffer on from time to time to see a better view of the texture. This is an onoff toggle. In general, turn on the Single Buffer to display the “best” version of a texture. Turn off the Single Buffer to display a dithered texture, so the resulting texture will not be as good.
View menu In the Texture View, click the right mouse button on View and choose any of the following: Frame All
If the 2D layout of your object is not readily visible in the Texture View, you may frame it by clicking the right mouse button on the Frame All in the View menu.
Frame Selected
Displays the selected items so that they are fully visible in the Texture View window. The amount you see in the Texture View window at any one time depends on the window’s size.
Real Size
Automatically adjusts the size of the texture so that the resolution of the texture as found on disk is maintained. The resolution of the default image provided in Maya is 8 pixels by 8 pixels; resizing has no effect, hence the internal texture format.
550
Using Maya: Modeling
Texturing Polygons The Texture View
Images menu Still in the same view, click the right mouse button on Images and choose any of the following: Keeps the texture in the Texture View. When you specify Keep it for a series of images, a slider appears at the bottom of the Texture window, allowing you to bring a specific image into view without having to reload the image.
Remove it
Deletes one of the textures that you previously loaded into the Texture View but not the original texture on disk. Select the texture that you want to remove by clicking on it in the pop-up menu. The removal of a texture frees up memory for other use. The default texture cannot be removed.
Load from Disk
Lets you choose the texture maps you want by clicking on the relevant names in the file list that pops up. Images usually end with a selfexplanatory suffix, indicating the image format.
Save to Disk
Saves the texture. You can load all image formats output by Composer. The standard keyboard shortcuts in the Texture View work in the same way as in the 3D views except Change View is not available in the Texture View.
Action
Keyboard Shortcut
Track
Alt while holding down the left or middle mouse button.
Zoom in and out
Alt while holding down the left and middle mouse buttons.
Frame a zone
Ctrl-Alt while holding down the left mouse button
If points are difficult to pick on the screen, you can use such functions as Track, Move in or out, or Frame to more easily locate vertices in your object.
Using Maya: Modeling
551
Polygonal Modeling
Keep it
Texturing Polygons The Texture View
Tips Dragging the tiny slider at the bottom of the Texture View window to the left or right displays each successive image that you have loaded. The images are displayed one at a time in the order in which you loaded them. Thus, you can avoid having to reload images. Clicking a polygonal object or set in a 3D view displays the map, if any, for that object or set in the Texture View. When you are working on a complex scene and have several maps applied, use the Hypergraph to find out which maps are used.
552
Using Maya: Modeling
Texturing Polygons Moving texture coordinates
Moving texture coordinates With Move Component, you can move selected UV points (also known as texture coordinates) on the flattened representation of your 3D object to modify a selected part of your map. As you move the selected UV points, notice how they appear to ride over the geometry which remains stationary. Moving UV points works in the same way as when you are moving polygonal vertices. Instead of references to X, Y, and Z, you will see references to U and V. You can select the UV points either in the 3D view or in the Texture view. You can use the manipulator or drag the mouse for moving a selection only in the Texture view.
Displaying the Texture View manipulators Initially, only a quarter of the Texture View manipulator set is displayed. To display the full manipulator set, click any of the items, such as the arc in the quarter displayed. Clicking any of the corners displays the manipulator for the opposite corner. Clicking the arc displays the full circle used for rotating a map.
Click any of the colored-coded manipulators to display the full manipulator set.
Initially, only a quarter of the manipulator set is displayed.
Using Maya: Modeling
553
Polygonal Modeling
As you adjust UV points, the way the image is mapped onto the object changes accordingly. You manipulate UV points of the model in the Texture view without actually changing the UV points of the object in the 3D view. The idea is to stretch and squeeze parts of the 2D object so that they match up with the equivalent parts of the 3D object. The 3D view reflects your changes as you make them in the Texture view.
Texturing Polygons Moving texture coordinates
Mapping objects You use the following controls for mapping objects. Scales the map in the V direction only, relative to the opposite side. Scales the map in the V direction only, relative to the center.
Freely resizes the height (V) and the width (U) of the map, relative to the opposite corner. Freely resizes the height (V) and the width (U) of the map, relative to the center. Rotates the map
Moves the map in the V direction.
Scales the map in the U direction only, relative to the center.
Moves the map in the U direction only, relative to the opposite side.
Scales the map in the U direction only, relative to the opposite side. Moves the map in the U and V direction.
Scales the map in the V direction only, relative to the opposite side.
Tip To resize a map proportionally, enter new values in the Channel Box to preserve the relative width and height of the map.
554
Using Maya: Modeling
Texturing Polygons Moving texture coordinates
To fit a map onto your object: 1
Select Window → Rendering Editors → Texture View to open the Texture View window.
2
In the Texture view, click the right mouse button and choose Images → Load from disk from the pop-up menu to select the texture map you want to use for mapping.
Tip Before moving UV points, make sure that the map is already assigned to a material such as a Phong that in turn is assigned to an object or a part of an object. For more information, see “Making a planar map” on page 528, or “Making a cylindrical map” on page 538, or “Making a spherical map” on page 543. 3
Press F12 to select UV points.
4
Select the object in the 3D view if it is not already active.
5
In the Texture View, drag to select the UV points you want to move.
6
Select Polygons → Move Component.
7
Press T unless the UV manipulators are already displayed in the Texture View. The UV manipulators for adjusting UV points to control where the map appears on the object or a part of the object appear in the Texture View. Pressing the Insert key lets you reposition the manipulators to a more convenient location. When you have relocated the manipulators, press the Insert key again. Notice that the appearance of your model has changed because you are now viewing it in 2D. What you see in the Texture View is a flattened representation of your 3D model, with vertices on top of the colors in your map. In the Texture View, you manipulate a model independently of the 3D object. Using Maya: Modeling
555
Polygonal Modeling
The map you choose appears in the Texture view. The map you load in the Texture View is used as a visual aid for placing the map on an object but the actual map assigned to the object in the rendering depends on the map selected for the File node in the Multilister. Usually, the map you load in the Texture view is the same as the map defined by the File node in the Multilister.
Texturing Polygons Moving texture coordinates 8
Where required, drag selected point(s) over the part of the map that you want to map in the Texture view. To get the right mapping, you adjust UV points to selected areas rather than globally. Selecting a single object or set in a 3D view displays only the flattened representation of that object or set in the Texture View. Avoid selecting several objects or sets all at once in the 3D view because when you have more than one object flattened out in the Texture view, it may be difficult to distinguish which points belong to which set. The more points that are located over a particular color or area of your map, the more prominent that color in your mapped object. Assume that you were to move all the UV points to a white area in the Texture view, then the entire object is mapped with white. This tells Maya which areas of your object are more or less affected by such and such a color in your map. When you are moving UV points closer together or further apart, you need to work carefully to prevent UV points or UV edges from overlapping as this causes havoc. In the Texture view, you reposition UV points of the flattened representation of your 3D model.
9
To see how well the image is mapped onto the object in a modeling view, select Shading → Hardware Texturing (press 6). You select both these menus from the view menu bar. On workstations with slow displays, you are advised to turn off Smooth Shaded when you are finished looking at the map. Smooth Shaded slows down your work considerably while you are working in the Texture view. You may also close the Multilister.
10 As necessary, adjust the manipulator controls in the Texture View. For example, you may find that changing the scale makes it easier to position selected UV points with respect to the map. The UV points are moved based on the current settings in the options window. 11 Change the settings again in the options window if you wish and then click Move UVs. The UV points are moved.
556
Using Maya: Modeling
Texturing Polygons Moving texture coordinates
Note When you are scaling a map to a very small size, it is best to enter small values in the Channel Box. Dragging a scale handle is effective until the map is so small that the scale manipulator’s appearance no longer changes. 12 You can continue to move UV points by clicking the left mouse button on a selection or take some other action.
After you map an object, you may want to render it.
To render the mapped polygon: Select Window → Rendering Editors → Render View and in the Render View window, either click the right mouse button on Render from the popup menu and choose a view in which to render, or use Render → camera and then select a view. You will also find Redo Previous Render useful. After the rendering is done, you can see a rendered version of the mapped object. Note that the map follows the geometry as the geometry is transformed.
Using Maya: Modeling
557
Polygonal Modeling
Rendering the mapped object
Texturing Polygons Moving texture coordinates
Example of mapping a head Before moving UV points on the raw mapping No matter how good a map is, you’ll almost always want to tweak the UV points to make the map look the way you think it should.
The head to be mapped as shown in a 3D view.
An initial rendering shows that the map of the girl needs to be adjusted to the head.
558
Using Maya: Modeling
The face of a girl is going to be mapped onto the head. Both the map of the girl and the UV points of the head appear in the Texture view.
Texturing Polygons Moving texture coordinates
Effect of moving UV points over the map
A second rendering shows that the area around the nose and the eyes is starting to look good—the facial complexion is being improved.
The UV points you adjust in the Texture View will change the affected map in the 3D view.
Using Maya: Modeling
559
Polygonal Modeling
In the Texture view, make the map match more closely the head by dragging the UV points so that they cover the head.
Texturing Polygons Moving texture coordinates
Final result of moving UV points
As a result of moving the UV points in the Texture view, the UV points match the face.
The final rendered image shows that the face is perfectly mapped onto the head.
560
Using Maya: Modeling
The head as shown in a 3D view.
Texturing Polygons Moving texture coordinates
Setting Move UV options Select Polygons → Move Component - ❐ to display the options window.
Polygonal Modeling
Global Values Translate
Moves the UV point along the U and V axis.
Scale
Scales the UV point along the U and V axis.
Rotate
Sets the angle by which you want to rotate UV points in the Texture View. The UV points are rotated in the texture plane.
Other Values Random
Changes UV points by a random amount, ranging from 0 to 1.
Changing the pivot The pivot defines the center point in UV space from where you can rotate or scale UV points. After moving UV points, you can change the Pivot in the Channel Box or Attribute Editor.
Using Maya: Modeling
561
Texturing Polygons Deleting a map
Deleting a map Deleting a map from an object removes it permanently.
To delete a map: 1
Press F11 to select facets.
2
Marquee-select a group of facets on which to delete the map.
3
Select Polygons → Texture → Delete Mapping. The map is deleted as well as the UV points.
4
562
To check that the map is gone, select Shading → Smooth Shade All (press 5) and then select Shading → Hardware Texturing (press 6) and the map should no longer appear on the object in the modeling view.
Using Maya: Modeling
Texturing Polygons Cutting textures
Cutting textures Cutting and sewing involve changing one or more facets so that an area of your object (usually an intricate area such as the part surrounding the eyes) no longer looks stretched or squeezed. You can model interesting textures by using a combination of cut and sew operations.
To cut a texture: 1
Select the edges that you want to cut by clicking the left mouse button while holding down the Shift key. To subtract from your selection, click the middle mouse button while holding down the Ctrl key either in the Texture window or in the 3D view.
2
Select Polygons → Texture → Cut Texture.
3
Cut up the edges by pressing Enter. All cut edges become “borders” and turn to the tool color.
Tip The manner in which you cut up 3D objects is based on your judgment and intuition. You should consider the most natural ways for cutting up your objects, just as a dressmaker would cut along a seam rather than haphazardly. A single edge cannot be cut unless it touches a border. This means that you must start from a border just as you would cut a sheet of paper and continue cutting step by step.
Using Maya: Modeling
563
Polygonal Modeling
When you start with the best possible partitioned object, you will have less cutting and sewing work to do. If the problem vertices are small, this is a good way of creating seamless connections between neighboring facets. You have to decide whether it is worth the time to perform major surgery. Unfortunately, this method does not provide exact adjustment. Cutting is optional of course.
Texturing Polygons Sewing textures
Sewing textures Cutting and sewing involve changing one or more facets so that an area of your object (usually an intricate area such as the part surrounding the eyes) no longer looks stretched or squeezed. You can model interesting textures by using a combination of cut and sew operations.
To sew a texture: 1
Tape together the edges that you have cut by clicking them.
2
Select Polygons → Texture → Sew Texture. These edges are no longer considered borders.
564
Using Maya: Modeling
13
Using selection constraints This chapter details how you can select components in a variety of ways. For advanced-polygonal modeling, you will need to know how to select facets, vertices, or edges using these selection criteria.
Polygonal Modeling
Topics include: •
“Constraints for facets” on page 568
•
“Constraints for vertices” on page 577
•
“Constraints for edges” on page 579
•
“Extending a selection” on page 582
Using Maya: Modeling
565
Using selection constraints Selecting components
Selecting components Sometimes in Maya, you want to select certain facets, vertices, or edges, but they are too difficult or too tedious to choose manually. Often, you can choose them using Maya’s powerful constraint tools. With constraints, you can choose facets, vertices, edges, or texture UV points that have a common characteristic. Examples of these characteristics are size, number of edges, general position, facing direction, random choice, and so on. You can use them whenever you are using sets. Constraints can be very helpful to create sets and partitions with minimum time spent on selection.
566
Using Maya: Modeling
Using selection constraints Selecting components
To set selection constraints: 1
Select an object you want to apply constraints to.
2
Select a component as follows.
Component mode in effect
F9
vertex selection
F10
edge selection
F11
facet selection
F12
texture coordinate selection
Select Polygons → Selection Constraints. Depending on whether you selected vertices, edges, facets, or UV points, you will see the corresponding options in the Constraints window for each of these entities.
4
Apply the constraints in an eligible function such as Polygons → Move Component. Constraints are used in two steps whenever you can select sets:
•
Activate the constraints with the mode at the top of the window.
•
Then individually select which constraints you want to use, like Random or Area. Adjust that constraint’s parameters. In the constraints list, you can set up conditions to filter your selection actions in different ways. Constrain has four different modes when you enter it:
Nothing
When you turn on this option, no constraints are used.
Next Set
When you turn on this option, the constraints affect only the next group chosen with a technique such as holding down Shift and clicking the middle mouse button.
Current & Next
When you turn on this option, the constraint is applied to whatever group has already been activated, plus whatever groups you select next.
All & Next
When you turn on this option, the constraints apply to the entire object automatically, plus whatever group you select next.
Using Maya: Modeling
567
Polygonal Modeling
3
Shortcut
Using selection constraints Selecting components
Important To be sure you are applying constraints, set Constrain to the All & Next option. To avoid any side effects, make sure to turn off other constraints that may affect what you are trying to do unless you also want to apply these other constraints. When you know that you are not applying a constraint, set Constrain to Nothing, meaning that the item(s) you are going to click will not be affected by constraints. Which constraints will be applied, and to what settings, is determined by the options you turn on. Note that you can turn off all constraints at once without resetting their values by selecting Reset → Disable All in the Constraints window.
Constraints for facets Selecting facets by properties The Property section has controls for selecting facets according to location, order, planarity, shape (for example, if a polygon is concave instead of convex), domains, mapping, and topology.
Location OnBorder
Selects only the items on the perimeter of your current objects are selected.
Inside
Selects only the items on the inside of your current objects are selected. It has the reverse effect of OnBorder.
Off
This constraint is not taken into account.
Facets on the border are selected
568
Using Maya: Modeling
Facets on the inside are selected
Using selection constraints Selecting components
Order Sets a valid range for the facet shape. Off
This constraint is not taken into account.
Triangles
only facets with three edges are selected.
Quads
only facets with four edges are selected.
Nsided
only facets other than triangles or quads are selected.
Note Polygonal Modeling
A triangular or square facet that is holed is not considered a triangle or Nsided.
Triangles are selected
Quads are selected
Nsided facets are selected
Using Maya: Modeling
569
Using selection constraints Selecting components
Planarity Off
This constraint is not taken into account.
Planar
Only planar facets are selected.
Non-Planar
Only non-planar facets are selected.
Only planar facets are selected.
Only warped or skewed facets are selected.
Convexity Off
This constraint is not taken into account.
Concave
Selects polygons that have at least one interior angle greater than 180 degrees.
Convex
Selects polygons whose interior angles are all less than or equal to 180 degrees.
Convex polygon
Concave polygon
Domains Off
This constraint is not taken into account.
Non-Holed
Selects facets that do not have holes.
Holed
Selects facets that have holes (holes can be created using the Create Polygon Tool or the Trim Facet Tool (Polygons → Facets → Trim Facet Tool).
570
Using Maya: Modeling
Using selection constraints Selecting components
Note Holed facets are considered concave.
Only facets without a hole are selected
Mapping Off
This constraint is not taken into account.
Mapped
Only mapped facets appear.
UnMapped
Only unmapped facets appear.
Only facets that are mapped are selected.
Facets that are not mapped are selected.
Topology Lamina
Selects a group of facets glued on top of each other.
Using Maya: Modeling
571
Polygonal Modeling
Only facets with a hole are selected.
Using selection constraints Selecting components Non-triangulable
Lets you select facets that cannot be triangulated. Use this constraint to select these problem facets. Then you can repair them with the Split Polygon Tool (Polygons → Split Polygon Tool).
Selecting facets by geometry The Geometry section has controls for selecting facets according to area, mapped area, distance, orientation, and visibility. All geometric values such as areas, length, and distances are measured relative to world space, not to the reference point of the object.
Area Activate
Turns on or off this constraint.
Min
The lowest value allowed.
Max
The highest value allowed.
Only facets with a minimum area of 5 and a maximum of 8 are selected
Only facets with a maximum area of 8 are selected.
Mapped Area Controls the area range of facets that are flattened out in the Texture View window. You can enter the minimum (Min) and maximum value (Max) for this area which lies in the UV plane. The mapped area of a flattened facet may be positive or negative. It is positive if the facet, as determined by the projection tool, is seen from the front; it is negative if the facet, as determined by the projection tool, is seen from the back. Off
572
This constraint is not taken into account.
Using Maya: Modeling
Using selection constraints Selecting components UnSigned
Selects all facets whose flattened area (whether they are positive or negative) matches the minimum and maximum range. Unsigned tells Maya to ignore the direction the facet normal is facing.
Signed
Selects all facets whose flattened area matches the minimum and maximum range.
Min
The lowest value allowed.
Max
The highest value allowed.
Polygonal Modeling
Unsigned means that positive or negative values may be included in the selection. In this example, all facets between a minimum of 0.2 and a maximum of 1 are selected.
Signed selects the facets between the minimum and maximum in the range (in this example, from -0.3 to 1).
Distance Sets a reference point and a valid range for the distance between the facet center and this point. Off
This constraint is not taken into account.
Point
The distance to origin (specified as P that is explained below) is taken into account.
Axis
The distance to the line defined by its origin (P) and its axis (V) is taken into account. Indicates the axis or the normal of the plane.
Plane
The distance to the plane defined by its origin (P) and its normal (V) is taken into account.
Min
The lowest value allowed.
Max
The highest value allowed. Using Maya: Modeling
573
Using selection constraints Selecting components Px, Py, Pz
Defines the location of the point from which you want the selection to extend from.
Vx, Vy, and Vz
Defines the axis along which the selection is to be made.
Distance Point Max selects all points that fall within a maximum of five units from the chosen point. In this example, the chosen point is the origin and Max is set to 5, meaning that the selection extends over a distance of five units from the origin.
Distance Plane selects the facets in the XY plane that is perpendicular to the Z axis. Min = 0, Max = 5, Vx = 0 Vy =0, and Vz =1
Distance Axis selects all facets that fall within a maximum of five points from the specified axis. In this example, Min = 0, Max = 5, Vx = 0 Vy =0, and Vz =1
Orientation Sets a reference axis and a valid range for the angle between the facet normal and this axis. Works in the direction and the orientation mode.
574
Using Maya: Modeling
Using selection constraints Selecting components Off
This constraint is not taken into account.
Orientation
Determines that the orientation of the facet is to be used for the selection.
Direction
Determines that the direction of the facet will be used for the selection. Using this option, even two facets facing opposite each other can be selected.
Min
The lowest value allowed.
Max
The highest value allowed.
Vx, Vy, and Vz
Define the axis along which the selection is to be made.
Polygonal Modeling
Orientation selects all facets between the specified axis and their facet normal. In this example, the facets from 45 to 70 degrees along the Y axis are selected. Min = 45, Max = 70, Vx = 0 Vy =1, and Vz = 0
Direction selects all facets between
Visibility Sets a target point and a focal angle. A facet is selected if the target point can be viewed from the center of the facet with its normal as the viewing axis and the angle as the field of vision. Activate
Turns on or off this constraint.
Angle
Sets an angle.
Px
Sets the location of the target point in the X-axis.
Py
Sets the location of the target point in the Y-axis.
Pz
Sets the location of the target point in the Z-axis.
Using Maya: Modeling
575
Using selection constraints Selecting components
Visibility selects all facets facing a specific point. In this example, the facets whose normal is at a right angle to the X and Y axis are selected. Angle = 90, Px = 5, Py = 5, and Pz = 0
Y The facets in the X and Y axis that face this point are selected.
X
Only facets facing a target point are selected. In this example, the shaded area shows the facets that are selected because they face a specific point.
Selecting facets by ratio The Random section lets you select facets according to a ratio. Activate
Turns on or off this constraint.
Ratio
Randomly selects as many facets as the ratio states (0 = no facet, 1 = all facets, 0.5 = 50% of the facets.)
576
Using Maya: Modeling
Using selection constraints Selecting components
Polygonal Modeling
Random selects facets depending on the ratio. In this example, a ratio of 0.5 is used to control the number of facets selected.
Constraints for vertices Selecting vertices by location The Property section has a control for selecting vertices according to location. Location
Same as for facets as described in “Location” on page 568.
Selecting vertices by geometry The Geometry section has controls for selecting vertices according to neighbors, angle, mapped area, distance, orientation, and visibility. Neighbors
Selects vertices located near another.
Activate
Turns on or off this constraint.
Min
The lowest value allowed.
Max
The highest value allowed.
Using Maya: Modeling
577
Using selection constraints Selecting components
Neighbors selects vertices between a Min of two and a Max of two.
Neighbors selects vertices between a Min of three and a Max of three.
Neighbors selects vertices between a Min of four and a Max of four. Angle
Works only for vertices shared by two edges (also known as “winged” vertices). Specify the angle between the two edges.
Activate
Turns on or off this constraint.
Min
The lowest value allowed.
Max
The highest value allowed.
Mapped Area
Same as for facets and selects vertices belonging to facets matching the mapped area criterion.
Distance
Same as for facets as described in “Distance” on page 573.
Orientation
Same as for facets as described in “Orientation” on page 574.
Visibility
Same as for facets as described in “Visibility” on page 575.
578
Using Maya: Modeling
Using selection constraints Selecting components
Selecting vertices by ratio The Random section lets you select vertices according to a ratio. This works in the same way as for facets as described in “Selecting facets by ratio” on page 576.
Constraints for edges You can select edges according to properties, geometry, or a ratio (Random).
Selecting edges by properties Polygonal Modeling
The Property section has two controls for selecting edges according to location, and smoothing.
Location Same as for facets as described in “Location” on page 568.
Smoothing Click Off, Hard, or Smooth to select a smoothing option.
Using Maya: Modeling
579
Using selection constraints Selecting components
Smoothing Hard selects hard edges.
Smoothing Smooth selects soft edges.
With Smoothing turned Off, neither smooth or hard edges are selected.
Selecting edges by geometry The Geometry section has controls for selecting edges according to length, angle, mapped area, distance, orientation, and visibility. Length
Sets a valid range for the edge length. A good example of where you can apply this selection criterion is in the Collapse Edge function (Polygons → Edges → Collapse) where you can remove tiny edges sometimes produced as a result of converting a NURBS object.
Activate
Turns on or off this constraint.
Min
The lowest value allowed.
Max
The highest value allowed.
580
Using Maya: Modeling
Using selection constraints Selecting components
Length selects edges between a Min of 11and a Max of 20.
Angle
Sets a valid range for the angle between the facets sharing the edge. This option works only for non-border edges.
Mapped Area
Same as for facets and selects edges belonging to facets matching the mapped area criterion.
Distance
Same as for facets as described in “Distance” on page 573.
Orientation
Same as for facets as described in “Orientation” on page 574.
Visibility
Same as for facets as described in “Visibility” on page 575.
Polygonal Modeling
Length selects edges between a Min of zero and a Max of ten.
Selecting edges by ratio The Random section lets you select edges according to a ratio. This works in the same way as for facets as described in “Selecting facets by ratio” on page 576.
Using Maya: Modeling
581
Using selection constraints Selecting components
Extending a selection Use Propagation to extend your selection. You are also shown how to use the More, Less, and Border buttons in combination with other selection constraints.
Propagation Off
This constraint is not taken into account.
Shell
Extends the selection to include all the pieces. This option is useful for objects made from a series of individual pieces such as those produced by the Polygons → Unite command.
Border
Extends the selection to include the entire border after you select one or more items along the border.
582
Using Maya: Modeling
Using selection constraints Selecting components
Facets selected after you click the More button twice. Each time you click More, a facet is added around every facet in the current selection.
Facets selected after you click the Less button once. Less is useful for shaving off one facet around every facet in the current selection.
Facets selected after you click the More button three times. This is similar to turning on Propagation Shell.
Using Maya: Modeling
583
Polygonal Modeling
Turn on Properties Inside and select the facets you want using the mouse.
Using selection constraints Selecting components
Facets selected after you click the Border button.
Tip With Constrain set to All & Next, turn on Properties Location Inside and Propagation Shell at the bottom of the Constraints window, then clicking a single facet selects all the facets that are inside your object.
584
Using Maya: Modeling
14
Examples of polygonal models
Polygonal Modeling
Examples of polygonal models include: •
“Making a hand” on page 586
•
“Using duplicates to work faster” on page 589
•
“Doing a negative scaling” on page 593
Using Maya: Modeling
585
Examples of polygonal models Making a hand
Making a hand This series of examples show how to make a hand out of a box. Starting from a simple shape as a box, a hand was carved out and fingers added, then it was smoothed and finally mapped. 1
Make a primitive box with the following dimensions: 9.86 along the X axis, 2.39 along the Y axis, and 12.43 along the Z axis. You can always rescale box once it is made to fit the scene. The box is divided into the following subdivisions: 7,1, and 5.
2
Extrude facets of the box to create the thumb and the four fingers. You need to select a facet that constitutes a finger and then perform the extrusion. Then repeat this minor surgery to make the other fingers and the thumb.
Extrude the thumb and four fingers.
3
586
Smooth the extruded hand.
Using Maya: Modeling
Matching hand in wireframe.
Examples of polygonal models Making a hand
4
Polygonal Modeling
Smoothed hand in wireframe.
Smoothed hand as produced by using a smoothness setting of 2.
Use the Sculpt Lattice command to fill out the hand.
Building up the palm of the hand.
Building up the back of the hand.
The back of the hand while lying flat.
The palm of the hand while lying flat.
Using Maya: Modeling
587
Examples of polygonal models Making a hand
Build up the hand tissue using Sculpt Lattice.
5
Create a planar projection
6
The last step, and one of the most challenging involved tweaking the UV points using Move Component.
Mapping the hand.
588
Using Maya: Modeling
Examples of polygonal models Using duplicates to work faster
Using duplicates to work faster If you work with polygons, then you’d do well to check the following. The Edit → Duplicate command that seems far removed from the day-to-day issues of workflow and productivity—fares better than you might expect. Duplicate objects permit Maya to work at unparalleled speed. They permit you to experiment with a series of actions and then apply them en masse when you achieve the desired effect.
To use duplicate objects to help you work smart 1
Make an object, for example a polygonal cube (pCube1).
2
Duplicate the cube (pCube2) by selecting Edit → Duplicate (Ctrl-D). You should also move the duplicate as it is copied on top of the original.
3
Select pCube1 and smooth this object (Polygons → Smooth). The high-resolution object is pCube1 and the low-resolution object is pCube2.
4
Open the Hypergraph (Window → Hypergraph).
5
In the Hypergraph, make sure to turn on the Shape Nodes item by selecting Options → Show → Shape Nodes. You need to do this to select shape nodes.
Tip You can drag the shape node of the low-resolution object directly onto the shape node of another high-resolution object to open the Connection Editor window automatically, with the selected shape nodes loaded into the Editor’s columns. If this does not work for some reason, do the following five steps.
Using Maya: Modeling
589
Polygonal Modeling
Instead of applying all actions directly to the original object—thereby slowing down the polygonal modeling process and potentially degrading the object quality over time—Maya displays the effects of your actions on screen using a low-resolution duplicate. As a result, most actions complete in a matter of seconds, regardless of the object size, and the original data remains unscathed. Only when you finish making a polygonal model does Maya apply your actions to the original high-resolution object.
Examples of polygonal models Using duplicates to work faster 6
In the Hypergraph, select a Shape node, for example pCubeShape1.
7
Open the Connection Editor window (Window → General Editors → Connection Editor).
8
Using the Reload Left button in the Connection Editor window (Outputs column), load the currently selected shape node into the left side of the Connection Editor window.
9
In the Hypergraph, select the second Shape node, for example pCubeShape2.
10 Using the Reload Right button in the Connection Editor window (Inputs column), load the currently selected shape node into the right side of the Connection Editor window. 11 In the Connection Editor window, connect the out Mesh attribute of pCubeShape1 to the In Mesh attribute of pCubeShape2. You need to scroll down the list to see the out Mesh and In Mesh attributes.
Out Mesh In Mesh
Shape of the duplicate object (low-resolution object)
High-resolution object
12 Click either pCubeShape1 or pCubeShape2 and then select Graph → Up and Downstream Connections or click
icon.
13 Drag and drop the low-resolution object (pCubeShape2) onto the highresolution object (pCubeShape1). Now all the transformations or actions that you apply to pCube2 (the low resolution object) are associated with pCube1 (the high resolution object) but pCube1 is not directly affected.
590
Using Maya: Modeling
Examples of polygonal models Using duplicates to work faster
Polygonal Modeling
In the Hypergraph, arrange so that the high- and low-resolution object belong to the same group.
14 Select the high-resolution object (pCube1 in this example) that you have smoothed and hide it by selecting Display → Hide → Selection (Ctrl h). From now on, Maya applies your actions to only the object that is displayed at any one time which speeds up your interactions. 15 In a modeling view, select the low-resolution object (pCube2). You can also use the Outliner to select it. In the Outliner, turn on Show Shapes using the right mouse button. 16 Smooth the duplicate object (named pCube2 in this example) or take any other action such as moving a vertex. Rather than smoothing or moving a vertex on the high resolution object, you can smooth or move a vertex on the duplicate. The advantage is that you can continue to work on the lightweight polygon and in the end Maya reapplies your series of actions to the original high-resolution object.
Out Mesh High-resolution object
Shape node of the high-resolution object
Smoothing action
In Mesh Shape of the duplicate object (low-resolution object)
Using Maya: Modeling
591
Examples of polygonal models Using duplicates to work faster 17 Select Display → Show All. Maya reapplies your actions such as the smoothing to the high-resolution object.
Other uses Another typical use of this duplicate technique is when you are building an animation. If the objects being animated are too heavy, you may notice a slowdown in the animation. By displaying only the simple object, you can make an animation run faster. High resolution objects tend to display at slower rates than lightweight objects do. Then when you are satisfied with the animation you can display the high resolution objects to see the full animation at its best.
592
Using Maya: Modeling
Examples of polygonal models Doing a negative scaling
Doing a negative scaling By scaling an object by a negative scale such as -1, you can produce interesting results as shown. Instead of modeling a full shape, just model half the object and then create the second half from the first. This technique can be a big time-saver.
Polygonal Modeling
Original half head
Whole head
Here is quick way of making the second half of the face by changing the dimension of the model along an axis. By scaling along an axis (the X-axis in this example), you can create the second half.
To do a negative scale: You can create a shape by first creating half the shape and then doing a negative scale along any axis to create the finished shape. 1
Select the half head.
2
Press F11.
3
Select all the facets to be scaled negatively.
4
Select Polygons → Facets → Extrude. In the Channel Box, enter -1 for Translate X. Make sure that the Keep Facet Together is turned on in the Channel Box. You may need to press the Insert key to relocate the manipulator so that it is easier to position the other half of your model.
Using Maya: Modeling
593
Examples of polygonal models Doing a negative scaling
Position the manipulator in a convenient position such as the one shown.
In the Channel Box, enter a value of -1 for Translate X
5
Move the half you have created as a result of scaling so that it aligns exactly with the original half.
6
Press F10.
7
Select all edges along the join except the first and last edge. Sandwich facets along the join separating the two halves may need to be removed. The join is where the two halves touch in the middle.
594
Using Maya: Modeling
Examples of polygonal models Doing a negative scaling
Do not select the top edge
Select all edges along the join except the top and bottom edge.
8
Select Polygons Collapse. By collapsing the edges, you are removing the unwanted tissue that runs along the join.
9
Select Polygons → Smooth. Because a rough effect may appear along the join, smoothing is a good way of refining it.
10 Soften the edges along the join by selecting Polygons → Edges → Soften/ Harden. Do this as a final touch-up for the softness of the edges.
Using Maya: Modeling
595
Polygonal Modeling
Do not select the bottom edge
Examples of polygonal models Doing a negative scaling
596
Using Maya: Modeling
Index A All Hard option 488 Soft option 488 Angle option 488 Threshold option 505 Append to Polygon tool 448 change options 450 appending facets 448 assigning shader 548 Attraction option 462, 477 Auto Fit option 493 Axis option 430, 432, 435, 437, 439, 442
B beveling 492 border 489
C
D deleting edges 478 facets 480 maps 562 vertices 479 Depth option 432 Duplicating facets 500
edges constraints for 579 deleting 478 hardening 486 moving 460 moving polygonal 463 softening 486 Ensure Planarity option 447, 450 extracting parts of polygons 496 Extrude polygonal 470 extruding facets 470
F facets appending 448 constraints for 568 creating 427 deleting 480 duplicating 500 extracting 496 extruding 470 moving 460 splitting 453 First option 491, 510
G E Edge Snapping option 454 Edges Delete and Clean 478
global pivot 472 Global values option 457, 462, 465, 477, 499, 503 Gravity option 462, 477
Index
changing normals 512 pivot 465 the extrusion mode 471 the pivot 458, 462, 472, 497 closing a border 489 collapsing edges 483 facets 483 Cone polygonal primitive 436
Conform Polygons Normals option 512 constraints 565 Create Polygon Tool change options 446 creating a polygonal cone 436 a polygonal cube 431 a polygonal cylinder 433 a polygonal plane 438 a polygonal sphere 429 Cube polygonal primitive 431 cutting textures 563 Cylinder polygonal primitive 433 cylindrical map applying to a polygon 538
H hardening edges 486 Height option 432, 435, 437, 439
Using Maya: Modeling
597
Index
K Keep Facet Group Border option 505 Facets Together 469 Facets Together option 471 Hard Edges option 506 Texture Border option 506
moving edges 460 facets 460 vertices 466
O
Random option 458, 462, 465, 477, 499, 503 Reversing normals Polygons 512 Rotation angle option 450 Roundness option 493
Offset option 493
S
L
P
Local center option 464 local pivot 472 Local values option 457, 461, 464, 476, 498, 502
pivot changing 465 planar map applying to a polygon 528 Plane polygonal primitive 438 polygon appending facets to 448 creating 443 making a hole in 449 Polygon Components 479 Vertices 479 polygons duplicating 500 projection defined 525 Propagate Polygons Normals option 512
Second option 491, 511 Section Radius option 442 Segments option 493 selection constraints 566 separating polygons 515 sewing textures 564 smart command settings 519 smoothing polygons 516 Snapping tolerance option 454 softening edges 486 Sphere polygonal primitive 429 spherical map applying to a polygon 543 Split Polygon Tool 453 change options 454 splitting facets 453 Subdivide 466 subdividing edges 466 facets 466 Subdivision change options 467 Subdivisions in X 442 in Y 442 Subdivisions option 430, 432, 435, 437, 439, 447, 450, 454, 467
M Magnet option 462, 477 Manipulator on Global values option 457, 461, 464, 476, 498, 502 maps cylindrical 538 deleting 562 planar map 528 spherical 543 merging edges 490 Middle option 491, 510 Minimum length option 468 Mode option 468 Move Component 456, 460, 463 Move Edge 463 change options 464 Move Facet 460 change options 461 Move Vertex 456 change options 457
598
Using Maya: Modeling
Q quadrangulating polygons 505 quads option 468
R Radius option 430, 435, 437, 442
Index
T Texture View window 549 Texture option 430, 432, 435, 437, 439, 442 Texture View mapping controls 553 textures adjusting to polygons 553 applying to polygons 524, 549 cutting 563 sewing 564 Torus polygonal primitive 440 torus polygonal primitive 440 triangles option 468 triangulating polygons 504 trimming facets 510 Twist option 442
Width option 432, 439 World Space option 488, 493 World Space Coords option 458, 462, 465, 477, 499, 503 Worldspace option 468
U U and V space 526 uniting polygons 514
V
Index
vertices constraints 577 deleting 479 moving 466 moving polygonal 456
W Weight option 462, 477
Using Maya: Modeling
599
NURBS Modeling
NURBS Modeling 1 NURBS Modeling Modeling basics
1
1
Using construction history
2
Using curves to build surfaces
4
Creating objects using NURBS primitives Creating surfaces
5
5
Editing curves and surfaces
7
Creating locators and measuring distances Using the Show Manipulator Tool
11
Selecting an item’s history node
12
Changing a curve’s parameter range
14
Editing subCurves in the Attribute Editor Editing parameters with manipulators Editing attributes with manipulators Using the Attribute Editor Using axes and pivot points
26
What are pivot points?
26
Creating locators
19 21
22
22
Accessing the Attribute Editor
What is an axis?
10
22
29
31
Using Measure tools
33
Using distance measures
33
Displaying parameter values Measuring arc lengths
38
41
NURBS modeling tips and tricks Tools and actions Workflow tips
45
Modeling tips
47
45
45
Using Maya: Modeling
iii
NURBS Modeling in Maya Contents Using commands
49
Organizational tips Special scripts
50
51
2 Introduction to Curves Curve basics
53
53
Creating the perfect curve
54
Which curve creation method should you use? What are CV curves?
57
What are edit point curves? Deleting curve segments
58
Deleting CVs on a surface
3 Creating curves
58 59
61
Creating curves with CVs
61
Changing the CV curve shape
63
Setting CV Curve Tool options
66
Creating curves with edit points
69
Changing the edit point curve shape Setting EP Curve Tool options Creating curves using a pencil
Creating trim curves
4 Editing Curves
71
73
Setting Pencil Curve Tool options Creating a curve-on-surface
70
74
75 75
79
Editing curves in the Attribute Editor
79
Transforming curves in the Attribute Editor
iv
Using Maya: Modeling
80
54
NURBS Modeling in Maya Contents Accessing the curve’s history Using the Curve Editing Tool
81
84
Changing the parameter position
85
Transforming the curve tangents
85
Aligning the tangent horizontally or vertically Adding points to a curve Adjusting CVs
87
88
90
Inserting knots and isoparms
93
Setting Insert Knot and Insert Isoparm options Extending curves
100
Setting Extend Curve options
101
Offsetting curves and curves on surface Setting Offset Curve options
107
112
Setting Offset Curve On Surface options Fitting cubic geometry to linear geometry Setting Fit B-Spline options Filleting curves
96
117
120
121
123
Creating circular curve fillets
123
Creating freeform curve fillets
126
Setting Fillet Curve options
128
Opening and closing curves and surfaces Setting Close Curve options
135
Setting Close Surface options Duplicating curves and isoparms
135 139
Setting Duplicate Curves options Attaching curves and surfaces
133
146
148
Attaching curves and surfaces with history off
148
Setting Attach Curves and Attach Surfaces options Detaching curves and surfaces
156
Setting Detach Curves and Detach Surfaces options Aligning curves and surfaces
154 161
165
Using Maya: Modeling
v
NURBS Modeling in Maya Contents Aligning Curves
166
Aligning surfaces
169
Setting Align options
172
Changing the order of the alignment
174
Scaling the tangent and curvature alignment Projecting curve tangents
186
Setting Project Tangent options
188
Adjusting the tangent interactively
191
Reversing the curve or surface direction Setting Reverse Curves options
195
196
Setting Reverse Surfaces options Rebuilding curves
177
197
199
Setting Rebuild Curve options
200
5 Creating and Editing Objects Using NURBS primitives
207
207
Creating objects with NURBS primitives Modifying primitives to build objects
208
208
Using the Show Manipulator Tool with primitives Setting primitive options
213
Setting Circle options
218
Setting Cylinder options
219
Setting Cone options
221
Setting Cube options
223
Setting Plane options
225
Editing objects in the Attribute Editor Using a construction plane
227
232
Setting Construction Plane Options Creating and editing text
235
Setting Create Text options
vi
Using Maya: Modeling
235
233
211
NURBS Modeling in Maya Contents
6 Introduction to Surfaces
243
What you need to know about surfaces
243
What is world coordinate space? What is an isoparm?
243
245
What is the U / V surface direction? What are U and V divisions?
246
246
What is a surface normal?
248
What is construction history? Converting NURBS to polygons
250 252
Setting NURBS To Polygons options Choosing a tessellation method
7 Creating surfaces Filleting surfaces
254
259
259
Creating circular surface fillets Setting Circular Fillet options
259 260
Creating free-form surface fillets Setting Freeform Fillet options Blending surfaces
269 274
279
Using the revolve manipulator Editing the input profile curve Setting Revolve options Lofting curves and surfaces Setting Loft options Beveling surfaces
266
271
Setting Fillet Blend Tool options Revolving surfaces
253
280 282
285 293
296
303
Changing the bevel’s dimensions interactively Setting Bevel options
304
308
Using Maya: Modeling
vii
NURBS Modeling in Maya Contents Extruding surfaces
316
Setting Extrude options
317
Preparing to stitch surfaces
328
Creating stitched surfaces
328
Setting Stitch Tool options Stitching surface points
332
339
Setting Stitch Surface Points options Creating boundary surfaces
340
346
Creating a four-sided boundary surface
346
Creating a three-sided (triangular) boundary surface Setting Boundary options Creating birail surfaces
349
356
Using the Birail 1 Tool
357
Setting Birail 1 Tool options Using the Birail 2 Tool
358
364
Setting Birail 2 Tool options Using the Birail 3+ Tool
365
368
Setting Birail 3+Tool options
8 Editing Surfaces Trimming surfaces
369
373
373
Setting Trim Tool options
375
Untrimming a trimmed surface
378
Setting Untrim options Planar trimming
378
380
Setting Planar Trim Surface options Intersecting surfaces
385
Setting Intersect options Projecting curves
387
390
Setting Project Curve options
viii
Using Maya: Modeling
391
381
347
NURBS Modeling in Maya Contents Rebuilding surfaces
397
Setting Rebuild Surfaces options
399
Using Maya: Modeling
ix
NURBS Modeling in Maya Contents
x
Using Maya: Modeling
NURBS Modeling
1
NURBS Modeling This chapter contains short general descriptions of the Maya tools and actions you use to create and edit NURBS curves and surfaces. It also contains information about manipulators, the Attribute Editor and Channel Box, creating locators, and the Measure tools. A compilation of NURBS modeling tips and tricks are included at the end of the chapter. This chapter includes: • • • • • • • • • • • •
“Modeling basics” on page 1 “Using curves to build surfaces” on page 4 “Creating objects using NURBS primitives” on page 5 “Creating surfaces” on page 5 “Editing curves and surfaces” on page 7 “Creating locators and measuring distances” on page 10 “Using the Show Manipulator Tool” on page 11 “Using the Attribute Editor” on page 22 “Using axes and pivot points” on page 26 “Creating locators” on page 31 “Using Measure tools” on page 33 “NURBS modeling tips and tricks” on page 45 See also Chapter 2, “Introduction to Curves” for information on curve basics, Chapter 6, “Introduction to Surfaces,” for information on surface basics, and for information on primitives and text curves, see Chapter 5, “Creating and Editing Objects”
Modeling basics Modeling in 3D is different from the conventional 2D drawing process. Imagine working with wire. You first place wires that determine the basic shape of the object, and then cover the wires with a surface that can be positioned to create motion for an animation. Cover the surface with a skin of almost any material you can think of, set up lights, and take a picture. This is essentially how Maya works. Using Maya: Modeling
1
NURBS Modeling Modeling basics The surface can be shaped and refined in real time using four views. You can build 3D surfaces in many ways. For example, you can start by extruding a 2D curve, revolve it or draw boundaries that define it, and then cut areas out of the constructed surfaces by trimming them. When you are satisfied with the model, you can turn the surface into a photo-realistic image by adding textures, colors, highlights, and backgrounds using the rendering functions and options provided. Use raytracing to add highly accurate reflections, refractions, and shadows for surfaces such as glass and water. And to complete the image, you can add natural phenomena like fog, sky, and sunsets. Non-Uniform Rational B-Splines (NURBS) are a special type of spline you use to create smooth curves and surfaces. The curves and surfaces are defined by a set of control points, which influence the object or shape in their vicinity. The overall object shape is determined by the way the control points are distributed in space. As you move the control points, the curve or surface changes shape and follows the control points in an intuitive way that is easy to work with.
Using construction history Most surface and curve creation tools produce objects with construction history. This means that the original curves or surfaces are still there after a surface is constructed or a curve is modified. By default, a surface with construction history is displayed in dark pink. In the following example, a revolved surface is created from a curve. The curve is selected and then extended using Curves → Extend Curve, thus changing the revolve surface result.
extended curve construction curve
2
Using Maya: Modeling
NURBS Modeling Modeling basics
Construction history on
Construction history off
Now when you create the revolved surface and select the construction curve, you can modify or delete it without changing or deleting the surface.
To delete construction history after a surface is created, select Edit → Delete by Type → History or Delete All by Type → History. The surface reverts to the default inactive color when you select the construction curve.
Attaching curves and surfaces with history off The Attach Curves options window (for both curves and surfaces) contain a toggle that lets you keep the original curves or surfaces after the attach is performed. Keep Original is toggled on by default. Try not to toggle this option off if history is set to on (the Construction History icon in the Status Line). Odd behavior may occur if the attached curve or surface is later modified. Using Maya: Modeling
3
NURBS Modeling
If you want to turn off construction history before you create a surface, click the Construction History On/Off icon from the Status Line.
NURBS Modeling Modeling basics
Animating CVs and construction history If you animate CVs on an object that was created with history, do not delete the object’s history. The CV animation will not be correct and unexpected results will occur.
Using curves to build surfaces Maya provides three curve creation tools. Surfaces can be built from one or more curves using one of these methods:
CV Curve Tool A CV (control vertex) is a point that controls the shape of a curve or surface. The CV Curve Tool is used to create free-form curves. CVs are placed one at a time, and the curve is created when there are sufficient CVs to define at least one span. For a degree 3 curve, at least 4 CVs are needed to create a single span. The CVs can be manipulated using transformation tools to give localized, predictable modifications to the curves and surfaces. See “Creating curves with CVs” on page 61 for details.
EP Curve Tool An edit point is a point that lies on the curve or surface. Use the EP Curve Tool to place points one at a time. The curve is created to interpolate them with one span between each edit point. See “Creating curves with edit points” on page 69 for details.
Pencil Curve Tool The Pencil Curve Tool method is useful for sketching a curve, rather than creating it by placing CVs or edit points. The Pencil method lets you create a curve as easily as drawing a line on a piece of paper. See “Creating curves using a pencil” on page 73 for details.
4
Using Maya: Modeling
NURBS Modeling Modeling basics
Creating objects using NURBS primitives NURBS Modeling
Several simple NURBS objects, such as spheres, cubes, cylinders, cones, and planes, are called primitives. You can create primitives in a single operation by selecting an item from the Primitives → NURBS menu. You can create complex objects by combining, transforming, trimming and cutting, or using surface functions, such as filleting, on these simple shapes. Throughout this book, NURBS primitives are used in various surface construction situations. You can also create text (Primitives → Create Text) using a variety of fonts. You can specify whether the text curves are NURBS, trim curves, or polygons.
Creating surfaces This section includes a brief description of the tools and actions you use to construct surfaces using various methods and how to tailor your creations.
Filleting and blending surfaces Filleting is a fast and easy way to create either a smooth rounded curve between two existing curves or a rounded edge between two surfaces. Use Surface fillets (Surfaces → Circular Fillet and Freeform Fillet) to create an object with rounded edges, or to blend two surfaces together. For example, you can protrude a NURBS cylinder primitive through a flat surface and create a smooth rounded edge where the two intersect. Or you could use the Surfaces → Fillet Blend Tool to join two sphere primitives using a free-form surface fillet and transform the top and bottom to construct a bottle. Surface filleting functions are also used to create the curves-on-surface you need to trim a surface.
Revolving curves Creating a surface of revolution is like using a lathe. First you create a silhouette, or profile, then revolve it.Unlike the lathe, when you use Surfaces → Revolve you can choose whether or not the object completes the revolution. Instead of being limited by a closed 360 degree revolution, you can specify the number of degrees. For instance, if you want the object to be flat on one side, revolve it by 180 degrees. If it needs to fit in a corner, revolve it by 90 degrees.
Using Maya: Modeling
5
NURBS Modeling Modeling basics
Lofting curves and surfaces Lofting is like building a boat. You construct a skeleton of ribs then apply a hull of skin, planks, or metal sheets to the ribs. In other words, you create a series of splines that define the shape of the object, then you loft these splines together. You can use Surfaces → Loft to create an airplane fuselage or wings, or to create intermediate areas between any two surfaces created with boundary curves.
Beveling curves and isoparms Use Surfaces → Bevel to create an extruded surface with a beveled edge from any curve. This lets you create a ledge on a building, for example, or the piping on an upholstered chair.
Extruding surfaces An extrusion is defined by two splines—one spline for the outline of the shape, and the other for the path that the outline follows. Extrusions are like tubing that comes out of a machine. They have an outline that remains consistent throughout their length. To define the path that the extrusion follows, use Surfaces → Extrude.
Stitching surfaces Use Prepare to Stitch to set up your surfaces before a stitching operation is performed. Use the Edit Surfaces → Stitch Tool to stitch, or align, two NURBS surfaces. Use Edit Surfaces → Stitch Surface Points to stitch NURBS surfaces together by selecting points on the surface.
Creating boundary and birail surfaces Use Surfaces → Boundary to create three-sided or four-sided surfaces from three or four curves. A boundary surface has four edges and can have almost any three-dimensional shape. Boundary curves (or profile curves) give you control over the shape when creating smoothly curved, non-planar 3D surfaces. You provide the splines for all the sides, or boundaries, of the surface to be created. The boundary curves define the surface’s profile, and the rail curves define the cross-section, which determines how the splines connect. Boundary curves are useful when creating complex surfaces that are not constant in any of three dimensions, but change across the whole surface.
6
Using Maya: Modeling
NURBS Modeling Modeling basics
NURBS Modeling
You can also use Surfaces → Birail 1 Tool, Birail 2 Tool, and Birail 3+Tool to create surfaces by combining three or four free-form curves that intersect.
Editing curves and surfaces After creating curves and building surfaces, you may want to modify them using specific functions instead of moving points.
Adding points to a curve After a curve is constructed, you may sometimes find that additional points are necessary if you want to move points on a curve. Use Curves → Add Points Tool to add additional CVs or edit points to a curve or curve-onsurface.
Adjusting CVs Use Curves → CV Hardness to adjust CVs to build smoother curves.
Inserting knots and isoparms You may need extra spans on curves or on isoparms on surfaces to provide enough freedom in the curve or surface to be able to create the desired shape. Use Curves → Insert Knot to insert knots to add additional edit points on a curve, or Edit Surfaces → Insert Isoparms to insert isoparms on a surface.
Extending curves Sometimes after you create a curve, you find that it is not long enough to intersect other curves when using another operation (such as a Birail Tool) or you want to use an extension of a particular curve to change a surface (such as a revolved object). Use Curves → Extend Curve to extend a curve or curve-on-surface using a linear, circular, or extrapolation method.
Offsetting curves Use Curves → Offset Curve to create a curve parallel to the original at a specified offset distance. To create a curve-on-surface parallel to the original curve-on-surface, use Curves → Offset Curve On Surface.
Fitting cubic geometry Use Curves → Fit B-Spline to fit a cubic curve to a degree 1 (linear) curve.
Using Maya: Modeling
7
NURBS Modeling Modeling basics
Opening and closing curves and surfaces Use Curves → Open/Close or Edit Surfaces → Open/Close to toggle curves and surfaces open or closed.
Duplicating curves and isoparms Use Curves → Duplicate Curves to transform a curve-on-surface, a boundary curve, or an interior isoparm of an existing surface into a 3D curve.
Attaching curves and surfaces Use Curves → Attach Curves to join two curves by attaching their endpoints to create a single curve. You an also join two surfaces by attaching their edges to create a single surface.
Detaching curves and surfaces Use Curves → Detach Curves or Edit Surfaces → Detach Surfaces to break a curve into two curves, open a currently closed curve, or detach a surface.
Projecting curve tangents Use Curves → Project Tangent to modify a curve’s tangent at an endpoint so that it coincides with the tangent of a surface or two other intersecting curves.
Trimming surfaces Trimmed surfaces let you cut surfaces in three dimensions. Applying one or more trimming curves to an existing surface creates a new surface with areas trimmed away. Use Edit Surfaces → Trim Tool to select the regions of the surface to keep or cut away. To be able to trim a surface, you must have curves-on-surface. There are several ways to create such trim curves:
8
•
Make Live. Draw a curve directly onto a surface by first making the surface “live” (click the Make Live icon on the Status Line), then drawing on the surface using any of the curve creation tools.
•
Project Curve. Project a curve onto a surface using Edit Surfaces → Project Curve.
Using Maya: Modeling
NURBS Modeling Modeling basics •
Trimming planar curves Use Surfaces → Planar to quickly covert a planar curve into a surface. The resulting surfaces look like shapes stamped out of sheet metal.
Intersecting surfaces Use Edit Surfaces → Intersect Surfaces to intersect one object with another. Intersections can also be used to create the curves-on-surface you need to trim a surface.
Filleting curves Use Curves → Fillet Curve to create a bridge between two curves.The resulting curves have the exact amount of roundness required, and the curves do not necessarily have to intersect. There are two ways to construct curve fillets—Circular and Freeform. You select the type you want from the options window (Curves → Fillet Curve - ❐).
Aligning curves and surfaces Use Curves → Align Curves to establish continuity between curves or surfaces. Use manipulators to align the elements interactively.
Reversing the curve or surface direction Use Curves → Reverse Curves and Edit Surfaces → Reverse Surfaces to reverse the sequence (or direction) of CVs on a curve or surface. You can also reverse the surface normals for surfaces and trimmed surfaces.
Rebuilding curves and surfaces Sometimes after a sequence of modeling operations, surfaces grow in complexity and become cumbersome and slow to work with. Use Edit Surfaces → Rebuild Surfaces to change the number of patches or the degree of a surface. This lets you reduce the number of patches on a complex surface. Use Curves → Rebuild Curve to recreate a curve or a curve-onsurface to reduce data and construct smoother curves.
Using Maya: Modeling
9
NURBS Modeling
Intersect. Intersect two surfaces using Edit Surfaces → Intersect Surfaces, or use one of the surface filleting functions. You can optionally create trim curves on the surfaces when using these functions.
NURBS Modeling Modeling basics
Creating locators and measuring distances You can replace primitives with locators to control other objects. For example, you can create these locators, connect them to expressions, and use them as control objects instead of primitives. The main advantage to this is that locators don’t render. This way, you don’t have to remember to turn control objects off before rendering. Also, locators don't slow down your scene. This is another advantage over using spheres or planes as control objects.
Creating locators Use Primitives → Create Locator to create a locator to mark a position in world space. Maya also provides measure tools to measure distances and display parameters on the curves and surfaces you create.
Measuring distances Use Modify → Measure → Distance Tool to measure and display distances between two specified points.
Displaying parameter values Use Modify → Measure → Parameter Tool to display parameter values on curves and surfaces at a specified point.
Measuring arc lengths Use Modify → Measure → Arc Length Tool to measure and display arc lengths on curves and surfaces at a specified point.
10
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Using the Show Manipulator Tool
To access and display manipulators: There are several ways to access and display manipulators using the Show Manipulator Tool. Before you start, make sure construction history is on. 1
For a surface constructed with curves (such as an extruded surface), set Curve Range to Partial in the options window.
Curve Range set to Partial
2
Click the Show Manipulator icon
.
3
In the Channel Box, click the heading for the subCurve you want to edit.
Using Maya: Modeling
11
NURBS Modeling
Some functions display special manipulators that let you tailor a surface or curve after a surface has been created. Use the Show Manipulator Tool to edit the construction history of an operation or sometimes, the attributes of an object itself. In other words, this tool lets you access the input node of an object.
NURBS Modeling Using the Show Manipulator Tool
or For an active object such as a NURBS primitive or a revolved surface, click the Show Manipulator icon and click the item’s heading in the Channel Box.
Selecting an item’s history node The Show Manipulator Tool associates a manipulator with the history node of the operation, therefore, to access the manipulator the history node has to be selected. For example, to edit the parameters of a revolve operation after the revolve has been performed, select the operation’s history node. If you perform several other operations and then want to edit the revolved surface, the manipulators are no longer displayed. You have to select them using one of the following methods.
To select the history node:
12
1
Select the revolved surface.
2
On the keyboard, press the letter “a”, and with the left mouse button clickdrag to Select All History from the marking menu in any view.
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Select All History can display manipulators for multiple history nodes. To edit the node you need, click the headings in the Channel Box to select which one you want to edit, or open the Attribute Editor and select the properties you want to change.
or From the History list menu in the Status Line, select Revolve.
or From the Channel Box, select the history node (revolve1). In the following example, the history nodes for a revolved surface and the curve used to construct it are selected. Click revolve1 to select the history node for the revolved surface.
Using Maya: Modeling
13
NURBS Modeling
Tip
NURBS Modeling Using the Show Manipulator Tool Click subCurve1 to select the history node for the construction curve.
Once the history nodes and the Show Manipulator Tool have been selected, manipulators are displayed on the surface or the construction curve. To interactively edit these nodes, click and drag the manipulators, or change the values in the Channel Box or the Attribute Editor.
Tip Some options windows include a Keep Original toggle. Toggle this on to access the manipulators (for example, Curves → Detach Curves).
Changing a curve’s parameter range A subCurve is created when you select the Partial option as the Curve Range in some of Maya’s options windows. This option lets you select a minimum and maximum parameter value on the curve, and only the part of the curve between those points is used in the creation of the surface. Most surfaces that use a curve as input include this option. A subCurve can also be the construction curve, or input curve, you use to create surfaces, such as revolved or extruded surfaces.
Editing a subCurve in the Channel Box You can edit a subCurve history node interactively using manipulators, or you can enter values in the Channel Box and Attribute Editor. In the following example, you create an extruded surface and modify its subCurves (the input curves, profile, and path, used to create the extruded surface).
14
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
To edit a subCurve from the Channel Box: Before you create the extruded surface, set the Curve Range to Partial in the Extrude options window.
2
Create the extruded surface from a curve and a primitive circle.
3
To display the curve range manipulators on one of the partial input curves (in this case, the path curve, which is subCurve2), click subCurve2 in the Channel Box and select the Show Manipulator Tool (if it is not already selected).
4
To change the parameter value, drag a manipulator handle.
Using Maya: Modeling
15
NURBS Modeling
1
NURBS Modeling Using the Show Manipulator Tool You can also enter values in the Channel Box to change the parameter value without using the manipulator.
5
To edit the input profile curve, click subCurve1.
If you want to perform another function on the extruded surface and later edit the subCurve, you can select the subCurves you need from the Channel Box.
Tip You can also type values in the Numerical Input line for the current manipulator handle if you do not want to leave the Channel Box open. Add the subCurve to the history menu to select it from there instead. See “Adding a subCurve to the History menu” on page 17 for details.
16
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Adding a subCurve to the History menu NURBS Modeling
In order to select a subCurve from the History list menu in the Status Line, you have to add it to the menu first.
To add a subCurve to the History menu: 1
From the bottom of the History list menu, select Complete list.
2
In the History list window, select List from the Filter pop-up menu.
The subCurve is now included in the History list menu.
Using Maya: Modeling
17
NURBS Modeling Using the Show Manipulator Tool This means, instead of selecting the subCurve manipulator from the Channel Box, you can select it from the History list menu on the Status Line. You can also access an Attribute Editor for the subCurves by clicking the option box (❐) beside the heading. See “Editing subCurves in the Attribute Editor” on page 19 for details.
Note Adding a subCurve to the menu is done on a per-object basis, meaning if you create another surface using a partial curve, that subCurve will not appear in the menu.
Accessing a subCurve from the marking menu Once you add the subCurve to the History menu, you can also access it through the marking menu.
To access a subCurve from the marking menu:
18
1
Place the pointer over the surface that was created with the subCurve (such as a revolved surface with a partial curve) while the surface is active.
2
Press the right mouse button and click the triangle beside Inputs to display the pop-up menu.
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Editing subCurves in the Attribute Editor
Once a subCurve has been added to the History list menu, you can also open the Attribute Editor for the subCurve by clicking the option box (❐) beside the Sub Curve heading in either the History list menu from the Status Line or the Inputs pop-up menu from the marking menu.
Using Maya: Modeling
19
NURBS Modeling
Select Object → subCurve1 - ❐ to open the Attribute Editor for a subCurve. (Since some operations require that you use more than one subCurve, the number after a subCurve heading represents the subCurve you want to edit.)
NURBS Modeling Using the Show Manipulator Tool
Setting SubCurve Attributes
Input Curve The Input Curve text box is read-only. Click the arrow beside the box to access the curve you want to edit and to open its Attribute Editor.
Min/Max parameter values The Min Value and Max Value parameter boxes are the same ones you see in the Channel Box. You can enter values here and press the Select button or press Enter to update the subCurve.
Relative Use the Relative toggle to turn the relative addressing mode on or off. Relative is toggled on by default. If toggled off, the mode is absolute, meaning the actual parameter range of the curve is used. If toggled on, the parameter range of the curve is treated as though it were from 0 to 0.
20
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Editing parameters with manipulators
For example, to display the manipulators for a NURBS cone primitive from the Channel Box, first select the Show Manipulator icon, then click the cone’s heading (makeNurbCone1):
To display manipulators from the History list menu, drag to the Make Nurb Cone heading and release the mouse button.
To display manipulators from the marking menu, place the pointer over the active NURBS cone, press the right mouse button and drag to select the Make Nurb Cone heading from the Inputs pop-up menu, and release the mouse button.
Using Maya: Modeling
21
NURBS Modeling
To display manipulators for the NURBS sphere, NURBS cylinder, and NURBS cone primitives, select the Show Manipulator Tool while the primitive is active. Then click the object’s heading in the Channel Box, select it from the History list menu in the Status Line, or from the marking menu Inputs pop-up menu. Click-drag the manipulator handles to edit the object.
NURBS Modeling Using the Attribute Editor
Editing attributes with manipulators In some cases, a manipulator is associated with the parameters of an object itself. Examples include texture projection nodes, cameras, polygons, joints, and all light types. To display the manipulators, select the Show Manipulator Tool on one of these active items (or select it before you create the item). See the Animation and Rendering books and the “Polygonal Modeling” section of this book (Chapter 1, “Polygonal Modeling”) to find out more about these manipulators.
Using the Attribute Editor The Attribute Editor is used as an editor for all nodes. This means that surfaces, curves, and any selectable item can be displayed in this one window. You can use the Attribute Editor in addition to the Channel Box to edit various nodes and operations for a specific operation.
Accessing the Attribute Editor Besides selecting Window → Attribute Editor for an active item, there are several ways to access the information you need to edit. The following example shows how to set the options in the Attribute Editor for a filleted curve.
22
Using Maya: Modeling
NURBS Modeling Using the Attribute Editor
To access the Attribute Editor:
Click to select the fillet curve in the view...
... or select the node in the Channel Box.
•
In the Channel Box, select Object → filletCurve1 - ❐.
•
From the History list menu in the Status Line, select Fillet Curve - ❐.
From the Channel Box
•
NURBS Modeling
Select the fillet curve to make it active. Click on the curve, or select its heading from the Channel Box.
From the History list menu
From the marking menu, press and hold the right mouse button while the pointer is over the active curve. Drag to the Inputs pop-up menu, select Fillet Curve - ❐ and release the mouse button.
Using Maya: Modeling
23
NURBS Modeling Using the Attribute Editor
Drag to here and release the mouse button to open the Attribute Editor.
A node’s history section of the editor (in this case, the Curve Fillet History section) includes all the information related to the creation of an item.
24
Using Maya: Modeling
NURBS Modeling Using the Attribute Editor
Curve Parameter values These values correspond to the fillet’s param manipulators you see when the Show Manipulator Tool is selected. These parameter values define the region between the two original curves where the fillet curve is created.
Input Curve This read-only information gives you access to the history of the curves you used to create the fillet. Click the arrow buttons to select an input curve and open its section of the editor.
Other attributes Other curve fillet-related options which are also included in the Fillet Curve options window.
Temporarily blocking (or hiding) a node The Attribute Editor also includes generic information for all nodes. The following describes the Node Behavior section.
If you select Blocking from the Node State pop-up menu, your surface temporarily becomes invisible. This can be very useful when you have complex scenes and want to edit only one facet of a surface. For example, let’s say you have a complex revolved surface and want to edit the curve, but you don’t want to wait while the revolve re-draws. You can select Blocking and edit the curve. To see the results, select the revolve surface’s node (either from the Channel Box or the History list menu), and then select Normal from the Node State pop-up menu in the Attribute Editor.
Using Maya: Modeling
25
NURBS Modeling
In this example, the editor contains the nodes for the input curves and the various options that were set in the options window for a curve fillet, including:
NURBS Modeling Using axes and pivot points
Using axes and pivot points There are various ways you can define where your objects are transformed from. You use the location of the pivot point or axes to transform in a specific direction from a specific point in local or world space.
What are pivot points? Objects are transformed based on a specific point in 3D space known as a pivot. When you rotate a primitive, for example, the pivot point represents the center of the rotation axis; when you scale, the pivot point represents the fixed point around which scaling occurs. By default, the pivot point is set so that the rotational and scale pivots are located at the point of origin for an object (0, 0, 0). The point of origin is the center of the object. A quick way to change an object's pivot when in a transformation tool is to use the Insert key on the keyboard to toggle to and from an edit mode. Edit mode displays a manipulator for moving the pivot. For more details, see the section describing the transformation tools in the Basics book.
To quickly display and reposition pivot points: You can move the pivot point to determine at which point you want to move, scale, or rotate the object from. Use the Insert key on the keyboard to display the pivot point, then use any of the transformation tools. In the following example the Rotate transformation tool is selected. 1
26
While an object is active, select a transformation tool, then press the Insert key. The manipulator appears; use it to move the pivot point.
Using Maya: Modeling
NURBS Modeling Using axes and pivot points Drag the manipulator to move the pivot point.
3
Press the Insert key again to display the rotate manipulator, drag to rotate the object.
NURBS Modeling
2
To display the pivot point from the Attribute Editor: 1
Open the Attribute Editor (Window → Attribute Editor).
2
To display the pivot points for models, toggle Display Rotate Pivot or Display Scale Pivot on in the Pivots section under the object’s transform tab.
Using Maya: Modeling
27
NURBS Modeling Using axes and pivot points
To reposition the pivot point using the Attribute Editor: 1
While the object is active, open the Attribute Editor and toggle Display Rotate Pivot on.
2
In the Local or World Space sections, enter a value for Rotate Pivot and press Enter. In the following example, the pivot is moved 5.0 units in the Z direction in absolute local space. You can now rotate the object from that pivot point location.
Rotate pivot point moved 5.0 in Z
28
Using Maya: Modeling
NURBS Modeling Using axes and pivot points
What is an axis?
Displaying the axis indicators To display the global axes at the origin in the perspective view, select Display → Axes → Origin from the menu bar. To display the local axis in all views for an active object, open the Attribute Editor. In the Display section under the objects’s transform section of the editor, toggle Display Local Axis on.
Using Maya: Modeling
29
NURBS Modeling
An axis is a straight line that indicates the origin and direction. For example, by using two axes, a plane is determined: the XY plane is defined by placing X and Y axes so they intersect at the origin. Three dimensions are determined by using three axes: X, Y, and Z.
NURBS Modeling Using axes and pivot points
Changing the origin and direction of the axes In the Transform Attributes section of the Attribute Editor, you can change the rotation order of the axes for an object by selecting Rotate Order from the pop-up menu. You can also enter values in the Rotate Axis X, Y, or Z boxes to rotate the axes in a specific direction, and to rotate the object around a different axis.
Toggling the axes origin from the Command Line You can also type the following commands in the Command Line to toggle the global axis display on and off in the 3D views.
30
Command
Action
toggleAxis -o true;
displays the axis at the origin
toggleAxis -o false;
hides the axis at the origin
toggleAxis -v true;
displays the axis at the bottom left of each view
toggleAxis -v false;
hides the axis at the bottom left of each view
Using Maya: Modeling
NURBS Modeling Creating locators
Creating locators A locator marks a position in world space. A locator is displayed as a small gnomon; its lines extend in each direction along the X, Y and Z axes (like the directional rods of a sundial). You can use point snapping to snap to a locator position.
To create and move a locator: 1
Select Primitives → Create Locator. A locator is created at the origin.
2
Use the Move Tool to position the locator.
Repositioning the locator in the Attribute Editor You can reposition the locator in local space from the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
31
NURBS Modeling
Use Primitives → Create Locator to create a space or curve locator.
NURBS Modeling Creating locators Click the locatorShape# tab to open that section of the editor. Enter X, Y, or Z values in the Local Position boxes.
You can transform the locator three ways:
32
•
Use the transformation tools.
•
Change the transformation values in the Channel Box.
•
Click the locator# tab in the Attribute Editor and change the Transformation values in that section of the editor.
Using Maya: Modeling
NURBS Modeling Using Measure tools
Using Measure tools NURBS Modeling
The Measure menu includes the Distance Tool, Parameter Tool, and Arc Length Tool. Click the triangle beside Measure in the Modify menu to display the cascading menu.
Using distance measures Use the Measure → Distance Tool to measure and display distances between two specified points.
To display a distance measure: 1
Select Modify → Measure → Distance Tool.
2
Click to select two points in space, or click on a curve or surface to display the distance measure locator.
Using Maya: Modeling
33
NURBS Modeling Using distance measures The following example shows the distance locator when two points are placed on a surface.
This shows the distance locator when one point is placed in world space and the other is placed on the surface.
The following shows the distance locator when two points are placed on a curve.
To snap a distance measure point: If you want to snap a locator to a curve or surface, use the Snap to curves icon and click on the curve or surface. When you move the item, the distance measure updates. This can be especially helpful if you want to measure the distance between two curves.
34
1
Click the Snap to curves icon from the Status Line.
2
Place a point on one curve and another point on the other curve.
Using Maya: Modeling
NURBS Modeling Using distance measures 3
Move one of the curves and the distance measure updates. NURBS Modeling
To move the distance locator: Select the Move Tool, then click to select a locator and drag to where you want to measure the distance between. The distance measure updates interactively.
Using Maya: Modeling
35
NURBS Modeling Using distance measures
Editing the distance locators in the Attribute Editor If you want, you can specify the start and points of the distance measure in X, Y and Z from the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
To specify the start and end points of the distance measure: Click the distanceDimensionShape# tab to open that section of the editor. Enter values in the Start Point and End Point boxes to specify the start and end points of the distance measure in X, Y, and Z.
To reposition the distance locator in local space: Click the locatorShape# tab to open that section of the editor. Enter values in the Local Position boxes to reposition the distance measure in X, Y, or Z.
36
Using Maya: Modeling
NURBS Modeling Using distance measures
NURBS Modeling
Using Maya: Modeling
37
NURBS Modeling Displaying parameter values
Displaying parameter values Use the Measure → Parameter Tool to display parameter values on curves and surfaces at a specified point. This locator also displays the direction of the curve or surface and the normal to the curve or surface at a specified point.
Normal Normal Curve direction Surface direction
To display parameter values on a surface or curve: 1
Select Modify → Measure → Parameter Tool.
2
Click-drag on a curve or surface to display the parameter values at a specified point. For curves, the parameter value in U at the specified point on the curve is displayed.
38
Using Maya: Modeling
NURBS Modeling Displaying parameter values
NURBS Modeling
For surfaces, the parameter value in U and V at the specified point is displayed.
To move the parameter locator: Select the Move Tool, then click-drag a locator over the curve or surface. The parameter values update as you drag.
If you create another locator, the previous locator is dimmed. This means that you can move it later if you need to.
Using Maya: Modeling
39
NURBS Modeling Displaying parameter values
Editing the parameter locators in the Attribute Editor If you want, you can specify the U and V parameters values from the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. Click the arrow beside the Nurbs Geometry box to access the curve or surface whose locator you want to edit.
To specify the U and V parameter values: Click the paramDimensionShape# tab to open that section of the editor. Enter new U and V Param values.
40
Using Maya: Modeling
NURBS Modeling Measuring arc lengths
NURBS Modeling
In the following example, the first figure shows the parameter locator on a surface at the position where it was created. The second figure shows how the locator is modified when you change the U and V Param values.
Measuring arc lengths Use the Measure → Arc Length Tool to measure and display arc lengths on curves and surfaces at a specified point. It also displays the direction of the curve or surface and the normal to the curve or surface at a specified point.
Normal
Surface direction
Normal
Curve direction
To display arc length values on a surface or curve: 1
Select Modify → Measure → Arc Length Tool.
2
Click-drag over a curve or surface to display the parameter values at a specified point. Using Maya: Modeling
41
NURBS Modeling Measuring arc lengths For curves, the distance of the specified point from the start point of the curve is measured.
For surfaces, the specified point from the start point in both the U and V direction is measured.
To move the arc length locator: Select the Move Tool, then click- drag over the curve or surface. The parameter values update as you drag.
If you create another locator, the previous locator is dimmed, meaning you can select to move it later if you wish.
42
Using Maya: Modeling
NURBS Modeling Measuring arc lengths
Editing the arc length locators in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
NURBS Modeling
If you want, you can specify the U and V parameters values from the Attribute Editor. To open the Attribute Editor, either:
Click the arrow beside the Nurbs Geometry box to access the curve or surface for which you want to edit the locator.
To specify the U and V parameter values: Click the arcLengthDimensionShape# tab to open that section of the editor and enter new U and V Param values.
Using Maya: Modeling
43
NURBS Modeling Measuring arc lengths In the following example, the first figure shows the arc length locator on a surface at the position where it was created. The second figure shows how the locator is modified when the U and V Param values are changed.
44
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks
NURBS modeling tips and tricks
Tools and actions Because Maya works on a selection-based mode, picking items is critical to modeling. If you forget what needs to be picked for a tool or an action, hold and drag the mouse button over the menu item. The Help Line displays the type of selection required for the current item.
What is a tool? If something is a tool, it contains the word Tool after its name (for example, Curves → CV Curve Tool). When using a tool, first set the options in the options window, select the tool, and then select the item. After the operation is complete, you can change the object’s attributes in the Channel Box or Attribute Editor if necessary.
What is an action? If something is an action, you have to select the item first and then the action. For example, if you want to create a revolved surface, first select the profile curve you want to use, then select Revolve from the Surfaces menu.
Workflow tips The following are some handy tips and tricks that can help to get you started.
Using marking menus when modeling Select Options → Customize UI → Marking Menus. In the Marking Menus editor, do the following: 1
With the left mouse button, click to select a mouse button style (for example, PA_Style_LMB).
2
Select the Hotbox option from the Use Marking Menu in pop-up menu.
Using Maya: Modeling
45
NURBS Modeling
The following information can be useful to get you started or if you run into problems. A few special tricks are also included.
NURBS Modeling NURBS modeling tips and tricks
3
46
Select the Center option in the Hotbox Region section, and click to turn the Left toggle on in the Mouse Button(s) section.
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks Click Apply Settings to assign a specific series of actions to the left mouse button.
5
Repeat this for the middle and right mouse buttons. Once completed, click Close.
Hiding the Hotbox A Hotbox is available for each of the four menu sets: Animation, Modeling, Dynamics, and Rendering. Marking menus are activated by pressing the space bar and pressing the left, middle, or right mouse buttons. When you press and hold the space bar, the Hotbox is displayed. Now if you press the left mouse button, a set of marking menus is displayed on top of the hotbox. The hotbox can be distracting when it is under the marking menus, so you can disable it if you want to.
To hide the Hotbox: 1
While holding down the space bar, press a mouse button over the Hotbox Controls menu.
2
From the Hotbox Style menu, select Center Zone Only. Selecting this option hides the Hotbox and when you press the space bar and a mouse button, only the marking menus are displayed.
3
To reopen the hotbox, press the space bar and use the left mouse button to select Zones and Menu Rows from the Hotbox Style menu.
Modeling tips Because many of the modeling functions in Maya are command based, the selection order is critical. There are times when you have to select different types of entities, such as isoparms (surface curves) or points on a surface.
Picking mode tips For example, when lofting between a curve and the edge of a plane, you have to select the curve first in object selection mode, and then the plane’s isoparm edge in component selection mode.
Using Maya: Modeling
47
NURBS Modeling
4
NURBS Modeling NURBS modeling tips and tricks
To reduce the number of picking steps: 1
Click the Select by hierarchy and combinations icon, the first mini icon in the row of the Status Bar. To the left of this button, the word Hierarchy is displayed in a box.
2
Click the arrow to the left of this box to display a pull-down menu.
3
Select NURBS to change the selection mode so that you don’t have to know if an isoparm, a curve, or a curve point has to be active to select something. This mode places an override on the selection mode and lets you pick what you want without worrying which mode you are working in. This works well for modeling, but it can be cumbersome to continuously select this option. For this reason, the right mouse marking menu lets you select the kind of component you need when over an active object. You’ll notice throughout this book that various modes of selection are used to let you choose to adopt a method that you’re comfortable with.
Picking and displaying history A quick way to pick and display history, such as a subCurve history node, is to press the “a” key and use the left mouse button to select Select All History from the marking menu in any view.
48
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks
Stepping backwards in construction history Some operations, such as Stitch, Align (with join turned off), and Curve Fillet, produce an intermediate object. This is an invisible copy of the original. To see and select this object, first select the visible result, then press Ctrl i to select the original surface. If you are animating the CVs of an object that has an intermediate object, animate the CVs of the intermediate object for better results.
Deleting CVs on a surface To delete a row of CVs on a surface, select more than one CV in that row, select the hull that corresponds to that row of CVs, then press the Backspace key. Do the same thing if you want to delete a column of CVs on a surface. If you select only a single CV, both the row and the column are deleted.
Using commands The following commands can save you time when using any Maya tool or action.
Assign commands to an alias Use the ‘alias’ MEL command in your favorite shell. It saves lots of typing, especially if you frequently use commands with the same sets of non-default parameters.
Display attribute dependencies Use affectedNet command to set up a dependency graph consisting of nodes that represent the attributes of a specific node (or type of node). Connections represent how the source attribute affects the destination attribute.
Using Maya: Modeling
49
NURBS Modeling
In some cases, there may be multiple history nodes. To edit the node you need, simply click the headings in the Channel Box to select which node you want to edit, or open the Attribute Editor and select the attributes you want to change.
NURBS Modeling NURBS modeling tips and tricks
Prevent offset of CVs on NURBS with clusters If you create a cluster with NURBS CVs in it, and then try to drive other CVs on the same NURBS object using the connectAttr command, the other CVs are offset. To prevent this offset, change this attribute before you make the attribute connection: setAttr .relativeTweak false;
Warning! Do not toggle this attribute on and off at whim as it may produce unwanted results.
Organizational tips The following tips can help when you use the Outliner or Hypergraph windows.
Open the full hierarchy with one click In the Outliner, if you Shift-click the expand/contract triangle, you can open or close the whole hierarchy for the object at one time.
Reorder and reparent in the Outliner With the middle mouse button, drag and drop selected objects onto a group node to reparent it. Drag and drop selected objects at the bottom of the Outliner to reparent it directly under the world.
Reorder and reparent in the Hypergraph Drag and drop one node onto a sibling node in the hypergraph while pressing the Ctrl key to reorder the nodes.
50
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks
Special scripts NURBS Modeling
These special scripts provide you with a fast and easy way to perform operations similar to the Power Animator functionality.
To use Power Animator’s Attach or Blend functionality: Select a NURBS surface isoparm and enter the following in the Command Line: attachBlendCurve
or Select a NURBS surface isoparm (to define the attach direction) and enter: attachBlendSurface
To create a Power Animator Round surface: 1
In a curve tool’s options window, set the Curve Degree to Linear.
2
Turn Snap to grids on in the Status Line and create a linear square curve.
3
Close the curve using Curves → Open/Close Curves.
4
In the Bevel options window (Surfaces → Bevel - ❐), set the following options: Bevel Cap Edge to Convex Bevel Corners to Circular Arcs
5
Click the Bevel button in the options window.
Using Maya: Modeling
51
NURBS Modeling NURBS modeling tips and tricks
6
52
To put a lid on the surface, select the end (square) isoparm of the bevel surface and select Surfaces → Planar.
Using Maya: Modeling
To build a model, you usually start by building curves that are combined to create surfaces. You can create curves with CVs and Edit Points, or draw free-form curves using the Pencil method. See Chapter 3, “Creating curves,” for details about these curve creation methods. The following topics are discussed in this chapter: •
“Curve basics” on page 53
•
“Creating the perfect curve” on page 54
•
“What is the curve degree?” on page 55
•
“What is parameterization?” on page 56
•
“Which curve creation method should you use?” on page 54
•
“What are CV curves?” on page 57
•
“What are edit point curves?” on page 58
•
“Deleting curve segments” on page 58
•
“Deleting CVs on a surface” on page 59
Curve basics Once you create a curve, or a spline, you can build a surface from it. B-splines are a series of polynomial curve segments that join to form one continuous curve. The degree of the polynomials is from 1 to 7. In Maya, you can draw splines to create complex shapes using a variety of editing tools. The following shows the basic elements of a curve.
Using Maya: Modeling
53
NURBS Modeling
2
Introduction to Curves
Introduction to Curves Creating the perfect curve
CV Hull Span Start of curve Edit point
Curve direction
•
The start of the curve is indicated by a small hollow box at the first CV.
•
The curve direction is displayed as a small letter u.
•
A hull is the visual line that connects the CVs.
•
The curve between two edit points is called a span. By modifying one or more spans, you change the shape of the curve.
Creating the perfect curve There are various methods you can use to create your curves. When you create curves, there are certain factors to keep in mind, such as the curve degree, or how many spans you need. The following should help when trying to decide what type of curve you need for a particular project.
Which curve creation method should you use?
CV curve
Edit point curve
Try to create simple curves because they are easier to control. Curves with less CVs are simpler and easier to manipulate.
54
Using Maya: Modeling
Introduction to Curves Creating the perfect curve
Tips Before you place the points to construct a curve, open the options window for the curve tool you want to use. You can set specific options such as the curve degree or whether you want to use uniform or chord knot spacing. If you need more localized control, you can insert knots to add points. See “Inserting knots and isoparms” on page 93 for more information.
What is the curve degree? The higher the curve degree, the smoother the curve, and the greater the number of points needed to define a single curve span. Two points define a linear curve span, three are needed for quadratic curves, and four are required for a cubic curve (the CV Curve Tool default). The following shows a curve constructed with nine points using different curve degrees. The first curve (the default) is used as a guide to show the difference between curve degrees. All the other curves are drawn on top of it for illustrative purposes.
Default degree 3 (Cubic)
Degree 5 (Quintic)
Degree 1 (Linear)
Degree 2 (Quadratic)
Degree 7 (Heptic)
Using Maya: Modeling
55
NURBS Modeling
The main advantage of using an edit point curve is that it interpolates the points you place. In other words, build a curve with edit points if you need it to pass through certain points. When you place CVs, the curve only passes through the end points.
Introduction to Curves Creating the perfect curve Degree 1 curves have sharp corners at the edit points; degree 2 curves are tangent continuous at edit points, but not as smooth. Degree 3 curves are used more often since they work best with most modeling operations and the result is a smooth curve with not too many points.
Tips You need degree 3 or higher to achieve C(2) or G(2) continuity between curves. You cannot change the curve degree from the Attribute Editor. Use the options window.
What is parameterization? Parameterization specifies how knot spacing relates to the U parameter values assigned to edit points. Chord length
If the curve is created with Chord length knot spacing, the parameter value is determined by the position of the point along the length of the curve. An initial parameter value of 0 is assigned to the start of the curve; the value is increased proportionally to the chord length between edit points.
Uniform
If the curve is created with Uniform knot spacing, the parameters have equally spaced values (0, 1, 2, and so on) at edit points. The parameter values of a uniform curve always range from 0 to the total number of spans on the curve. A parameter value of 0 is assigned to the start of the curve; this value is incremented by 1 for each edit point along the curve.
Tip Uniform knot spacing produces a curve with a more predictable parameterization. Chord knot spacing produces a better curvature distribution, and, when used to build surfaces, better texture mapping. Uniform curves have more straightforward parameterization and are used more often than chord length curves. Uniform parameters can be easily subdivided based on edit points; this makes it easier to use Insert Knot if you need to add spans later.
56
Using Maya: Modeling
Introduction to Curves Creating the perfect curve
What are CV curves?
How to select CVs There are two selection modes you can use to select CVs: from the Status Line and from the marking menu.
Selecting CVs from the Status Line While the curve is active, click the Select by component icon on the Status Line, click the Points icon, and select CVs from the pop-up menu.
Selecting CVs from the marking menu Place the pointer over an active curve and press the right mouse button to display the marking menu. Drag to Control Vertex, then click to select the CV or CVs you want to edit.
Using Maya: Modeling
57
NURBS Modeling
A CV is a point that controls the shape of a curve or surface. It is displayed as a small filled box. Use the CV Curve Tool to create these kinds of curves.
Introduction to Curves Creating the perfect curve
What are edit point curves? An edit point is displayed as a small letter x. The areas where polynomials are joined are called edit points (sometimes known as knots). Edit points lie directly on the spline. You can add edit points to an existing curve without affecting its shape. When you add edit points to a curve, you create more spans on the curve. As the number of spans increases, you have more localized control over the curve. Use the EP Curve Tool to create this kind of curve.
How to select edit points Like CVs, edit points can be selected using the Status Line icons or the marking menu.
Selecting edit points from the Status Line While the curve is active, click the Select by component icon on the Status Line, click the Parm Points icon, and select Edit Points from the pop-up menu.
Selecting edit points from the marking menu Place the pointer over an active curve and press the right mouse button to display the marking menu. Drag to Edit Point, then click to select the edit point or edit points you want to edit.
Deleting curve segments To delete curve segments while you are creating a curve, press the Backspace key on the keyboard. To delete curve segments after the curve is created, select the CVs or edit points and then press the Backspace key.
58
Using Maya: Modeling
Introduction to Curves Creating the perfect curve
NURBS Modeling
Note When you create a curve using the Pencil Curve Tool, you cannot delete curve segments by pressing the Backspace key. Instead, once the curve is created, select CVs or edit points (in component selection mode) and then press the Backspace key.
Deleting CVs on a surface To delete a row of CVs on a surface, select more than one CV in that row or select the hull that corresponds to that row of CVs. Do the same thing if you want to delete a column of CVs on a surface. If you select only a single CV, both the row and the column are deleted.
Single CV
Three CVs in the same row.
Using Maya: Modeling
59
Introduction to Curves Creating the perfect curve
60
Using Maya: Modeling
Since curve creation methods are tools, first adjust the option settings in the options window for the tool before you create the curves. If you create the curves with the default option settings, you can later edit the completed curve in the Attribute Editor. The following topics are described in this chapter: •
“Creating curves with CVs” on page 61
•
“Creating curves with edit points” on page 69
•
“Creating curves using a pencil” on page 73
•
“Creating a curve-on-surface” on page 75
Creating curves with CVs A CV is a point that controls the shape of a curve or surface. Use the CV Curve Tool to create free-form curves. You can manipulate CVs using transformation tools to give localized, predictable modifications to your curves and surfaces.
Tip Remember, more CVs doesn’t necessarily mean easier control. You should try to keep the number of isoparms to a minimum.
Before you begin When you construct a curve with CVs, you must place several points to complete the curve, depending on the curve degree setting in the options window. The following example uses the default curve degree of Cubic, degree 3. Since you need one point more than the curve degree, you have to place at least four points to construct the curve. See “About curve degrees” on page 67 for more information.
Using Maya: Modeling
61
NURBS Modeling
3
Creating curves
Creating curves Creating curves with CVs
To create a curve with CVs: 1
Select Curves → CV Curve Tool.
2
Position the pointer in any of the views where you want the curve to begin.
3
Click to place the first CV. The first CV is displayed as a small hollow box that indicates the start point of the curve.
Tip If you hold the mouse button while you click, the CV can be dragged to any location in the view. Release the mouse button to place the CV. 4
Click where you want to place the second CV. This CV is displayed as a small letter u. Once you place the CV, a line joins the two CVs. This is the hull line. The hull line is part of the control polygon and does not represent a curve or curve segment.
5
Click to place a third CV. Another hull line is created to connect the second and third CVs. The curve is not built yet since this is a degree 3 curve (Cubic by default) and you have to place at least four points.
6
Click to place the last and fourth CV. When you place the fourth CV, a curve segment is created that interpolates the first and last CVs.
2
1
3 4
As you continue to place CVs, new curve segments are created and the curve continually updates to interpolate the last CV placed.
62
Using Maya: Modeling
Creating curves Creating curves with CVs
NURBS Modeling
Tip To complete the curve so you can start to place new curve points, press Enter.
To create a CV curve-on-surface: 1
Select the NURBS surface.
2
Click the Make Live icon on the Status Line (or select Modify → Make Live) to make the surface live.
3
Select Curves → CV Curve Tool and place the curve-on-surface CVs directly on the live surface.
Changing the CV curve shape Once a CV curve is drawn, or while you are drawing it, you may want to modify its shape. You can use the transformation tools to move, rotate, or scale CVs to change the shape of your curves.
To change the shape of the curve as you create it: 1
Before you press Enter to complete the CV curve, press the Insert key on the keyboard. This displays a move manipulator, which appears on the CV at the end of the curve by default.
Using Maya: Modeling
63
Creating curves Creating curves with CVs 2
Drag the manipulator to move the CV and to change the curve’s shape.
3
To continue to change the curve’s shape, click with the left mouse button to select another CV and drag the manipulator.
Tip You can marquee-select more than one CV at a time. Remember to press the Insert key to continue placing CVs.
To change the shape of the curve after it is constructed:
64
1
Click the Select by component type icon from the Status Line.
2
Click the Points icon, press the right mouse button to display the pop-up menu, then toggle CVs on.
Using Maya: Modeling
Creating curves Creating curves with CVs
or
3
Click to select the CV (or CVs) you want to move.
4
Select a transformation tool, (in this example, the Move Tool), and drag the manipulator to move the CV.
Using Maya: Modeling
65
NURBS Modeling
While the pointer is over an active CV curve, use the right mouse button and drag to select Control Vertex from the marking menu.
Creating curves Creating curves with CVs
Setting CV Curve Tool options Set the tool options before you create the curve. To open the options window, select Curves → CV Curve Tool - ❐. To change the options after the curve is created, use the Channel Box or the Attribute Editor. See “Editing curves in the Attribute Editor” on page 79 for details.
Changing the curve degree Select a Curve Degree option to specify the curve degree. 1 Linear curves are often referred to as polylines (linear segments), degree 2 curves as quadratics, degree 3 Cubic curves as cubics (the default), degree 5 as quintic, and degree 7 as heptic. The higher the curve degree, the more points you need to define a single curve span. If the number of control points is the same and the curve degree is high, the curve looks as though it has more tension than if the degree is low.
66
Using Maya: Modeling
Creating curves Creating curves with CVs
About curve degrees NURBS Modeling
Each curve segment is defined and controlled by n+1 CVs, where n is the degree of the curve. For example, a curve of degree 5 requires 6 CVs to form a curve segment.
6 1
2
3
4 5
A curve of degree 7 requires 8 CVs.
8 1
2
3
4
5
6 7
Changing the knot spacing The type of knot spacing relates to the U parameter values assigned to CVs (also referred to as parameterization). Select an option for Knot Spacing. Chord length
If you create a curve with Chord length knot spacing, the parameter value depends on the distance along the length of the curve. An initial parameter value of 0 is assigned to the start of the curve, then the value is increased proportionally to the chord length between edit points.
Uniform
If you create a curve with Uniform knot spacing, the parameters have equally spaced values (0, 1, 2, and so on) between edit points. The parameter values of a uniform curve always range from 0 to the total number of spans on the curve. This is the default setting.
Using Maya: Modeling
67
Creating curves Creating curves with CVs
Tip Uniform knot spacing produces a curve with a more predictable parameterization. Chord knot spacing produces a better curvature distribution, and, when used to build surfaces, better texture mapping. See “What is parameterization?” on page 56 for more information about knot spacing. The joints where the curve spans are joined are called knots. Toggle Multiple End Knots on to help control the shape of the curve. The default is on.
Multiple End Knots
Notice how the curve does not go through the end CVs.
Multiple End Knots toggled on
Multiple End Knots toggled off
For more information on editing curves, see:
68
•
“Creating the perfect curve” on page 54.
•
“Using the Curve Editing Tool” on page 84.
•
“Editing curves in the Attribute Editor” on page 79 for information about editing the curve once you have created it.
Using Maya: Modeling
Creating curves Creating curves with edit points
Creating curves with edit points
When constructing a curve with edit points, the edit points are visible while the curve is being constructed. Unlike the CV method where you must place several points to construct the curve, only two edit points are necessary to create the initial curve segment, no matter what degree of curve.
To create an edit point curve: 1
Select Curves → EP Curve Tool.
2
Click in any of the views to place the first edit point. A small letter x is displayed.
3
Click to place the second edit point. When you place the second edit point, you create a curve segment that interpolates the two edit points. Click to place as many edit points as you want. As you plot each additional edit point, a new curve segment is created.
4
To complete the curve so you can start to place new curve points, press Enter. The following shows a curve constructed with four edit points.
1
3 2
4
To create an edit point curve-on-surface: 1
Select the NURBS surface.
2
Click the Make Live icon on the Status Line (or select Modify → Make Live) to make the surface live.
3
Select Curves → EP Curve Tool and place the curve-on-surface points directly on the live surface.
Using Maya: Modeling
69
NURBS Modeling
An edit point is a point that controls the shape of a curve or surface. Use the EP Curve Tool to help define how many spans sit on the curve. Edit point curves are also useful if the curve must go through certain points.
Creating curves Creating curves with edit points
Changing the edit point curve shape Once an edit point curve is drawn, or while you are drawing it, you may want to modify its shape.You can use the transformation tools to move, rotate, or scale edit points to change the shape of your curves.
To change the shape of the curve as you create it: 1
Before you complete the edit point curve, press the Insert key on the keyboard. This displays a move manipulator which appears on the edit point at the end of the curve by default.
2
Drag the manipulator to change the curve’s shape.
3
To continue to change the curve’s shape, click with the left mouse button to select another edit point and drag the manipulator.
Notes You can only select one edit point at a time. This prevents the curve shape from changing too much.
To change the shape of the curve after it is constructed: 1
Click the Select by component type icon.
2
Click the Parm Points icon to display the pop-up menu, then toggle Edit Points on.
or While the pointer is over an active edit point curve, use the right mouse button and drag to select Edit Point from the marking menu. 3
70
Click to select the edit point (or edit points) you want to move. Select a transformation tool (for example, the Move Tool), and drag the manipulator to move the edit point.
Using Maya: Modeling
Creating curves Creating curves with edit points
Setting EP Curve Tool options
To change the options after the curve is created, use the Channel Box or the Attribute Editor. See “Editing curves in the Attribute Editor” on page 79 for details.
Changing the curve degree Select a Curve Degree option to specify the curve degree. 1 Linear curves are often referred to as polylines (linear segments), degree 2 curves as quadratics, 3 Cubic curves as cubics (the default), degree 5 as quintic, and degree 7 as heptic. The higher the curve degree, the more points you need to define a single curve span. If the number of control points is the same and the curve degree is high, the curve looks as though it has more tension than if the degree is low.
Using Maya: Modeling
71
NURBS Modeling
Set the tool options before you create the curve. To open the options window, select Curves → EP Curve Tool - ❐.
Creating curves Creating curves with edit points
Changing the knot spacing The type of knot spacing relates to the U parameter values assigned to edit points (also referred to as parameterization). Select an option for Knot Spacing. Chord length
If you create a curve with Chord length knot spacing, the parameter value depends on the distance along the length of the curve. An initial parameter value of 0 is assigned to the start of the curve, then the value is increased proportionally to the chord length between edit points.
Uniform
If you create a curve with Uniform knot spacing, the parameters have equally spaced values (0, 1, 2, and so on) between edit points. The parameter values of a uniform curve always range from 0 to the total number of spans on the curve. This is the default setting.
Tip Uniform knot spacing produces a curve with a more predictable parameterization. Chord knot spacing produces a better curvature distribution, and, when used to build surfaces, better texture mapping. For more information on editing curves, see:
72
•
“Creating the perfect curve” on page 54.
•
“Using the Curve Editing Tool” on page 84.
•
“Editing curves in the Attribute Editor” on page 79 for information about editing the curve once you have created it.
Using Maya: Modeling
Creating curves Creating curves using a pencil
Creating curves using a pencil To create a curve using a pencil: Sometimes the most natural way to create a curve is to sketch it, rather than placing CVs or edit points. The pencil construction method lets you create a curve as easily as drawing a line on a piece of paper. 1
Select Curves → Pencil Curve Tool.
2
The pointer changes to a small pencil. Position it where you want the curve to begin.
3
Click-drag the pencil to sketch a curve.
4
To stop sketching, release the mouse button. The line is fit with a curve that has chord length parameterization by default.
Sketching in different views As the curve is sketched, the pencil position is sampled as often as possible. Points are kept if they are at least five screen pixels from the previous point. When the mouse button is released and the actual curve is fitted to the points, the curve interpolates the first and last point. If you are sketching in an orthographic view (front, top, or side), two of the coordinates of the spline correspond to those of the current view and the other coordinate is set to 0. If sketching in the perspective view, the curve is created on the ground plane or live surface.
Using Maya: Modeling
73
NURBS Modeling
Use the Curves → Pencil Curve Tool to sketch a curve, rather than create it by placing CVs or edit points.
Creating curves Creating curves using a pencil
Setting Pencil Curve Tool options Set the tool options before you create the curve. To open the options window, select Curves → Pencil Curve Tool - ❐. To change the options after the curve is created, use the Channel Box or the Attribute Editor. See “Editing curves in the Attribute Editor” on page 79 for details.
Changing the curve degree Select a Curve Degree option to specify the curve degree. 1 Linear curves are often referred to as polylines (linear segments), and degree 3 curves as cubics.
Warning! Curves created using a pencil usually have many CVs. Use Curves→Rebuild Curves to smooth out and simplify this type of curve. For more information on editing curves, see:
74
•
“Creating the perfect curve” on page 54.
•
“Using the Curve Editing Tool” on page 84.
•
“Editing curves in the Attribute Editor” on page 79 for information about editing the curve once you have created it.
Using Maya: Modeling
Creating curves Creating a curve-on-surface
Creating a curve-on-surface
Creating trim curves In general, you draw a curve-on-surface to prepare a surface for trimming, or to create a curve to use in subsequent surface construction. You can do this in various ways, including intersecting objects, creating fillets between objects, or projecting curves onto a surface. See “Trimming surfaces” on page 373 for more information on how to use the Edit Surfaces → Trim Tool.
To create a curve-on-surface by placing it onto a live surface: To draw a curve-on-surface, select the surface, then select Modify → Make Live or click the Make Live icon from the Status Line. Use any curve creation tool to draw the curve directly onto the surface. Click the Make Live icon from the Status Line to make an active primitive NURBS plane “live” and draw a curve on the surface.
Trim curve
Trimmed surface
Using Maya: Modeling
75
NURBS Modeling
A curve on surface is a curve that you create directly on a surface. These special curves are created within the UV parameter space of a chosen surface and become part of that surface.
Creating curves Creating a curve-on-surface
To create a curve-on-surface using a surface fillet: 1
In the Circular Fillet options window (Surfaces → Circular Fillet - ❐), toggle Create Curve On Surface on.
2
Pick the surfaces you want to create a fillet between.
3
Select Edit Surfaces → Circular Fillet to create a fillet between the two surfaces.
Trim curves
Trimmed surface
See “Creating trim curves” on page 261 in Chapter 7, “Filleting surfaces,” for information on filleting functions and their associated options.
To create a curve-on-surface by intersecting surfaces: A curve-on-surface is created when you intersect surfaces using Edit Surfaces → Intersect Surfaces. Trim curve
Trimmed surface
See “Intersecting surfaces” on page 385 for more information about Intersect Surfaces and its options window.
76
Using Maya: Modeling
Creating curves Creating a curve-on-surface
To create a curve-on-surface by projecting curves:
Trim curves
NURBS Modeling
Use Edit Surfaces → Project Curve to project curves, such as NURBS text, onto a surface. The projected curves become trim curves. Trimmed surface
See “Projecting curves” on page 390 for more information about Project Curve and its options window.
Using Maya: Modeling
77
Creating curves Creating a curve-on-surface
78
Using Maya: Modeling
NURBS Modeling
4
Editing Curves This chapter includes information about editing curves. It also describes some of the tools you use to edit surfaces built from curves. The following topics are discussed in this chapter: • • • • • • • • • • • • • • • •
“Editing curves in the Attribute Editor” on page 79 “Using the Curve Editing Tool” on page 84 “Adjusting CVs” on page 90 “Inserting knots and isoparms” on page 93 “Extending curves” on page 100 “Offsetting curves and curves on surface” on page 107 “Fitting cubic geometry to linear geometry” on page 120 “Filleting curves” on page 123 “Opening and closing curves and surfaces” on page 133 “Duplicating curves and isoparms” on page 139 “Attaching curves and surfaces” on page 148 “Detaching curves and surfaces” on page 156 “Aligning curves and surfaces” on page 165 “Projecting curve tangents” on page 186 “Reversing the curve or surface direction” on page 195 “Rebuilding curves” on page 199“
Editing curves in the Attribute Editor To edit completed curves and curve-related operations, use the Attribute Editor. The Attribute Editor for curves includes parameters that let you transform the curve and validate the curve’s history, as well as change the way it is displayed. First select the curve you want to edit. To open the Attribute Editor: •
Click the option box (❐) beside its name in the Object pop-up menu in the Channel Box.
Using Maya: Modeling
79
Editing Curves Editing curves in the Attribute Editor •
Select the active curve’s name from the marking menu.
•
Select Window → Attribute Editor.
•
If the curve has history, you can open the Attribute Editor from the History list menu on the Status Line, or from the Inputs pop-up menu in the marking menu.
Transforming curves in the Attribute Editor Click the curve tab to open the transformation sections of the editor.
Transform Attributes Use the Transform Attributes section to enter values to move, rotate, scale, or shear the curve. You can also change the X, Y, Z rotation order or rotate the local axes.
80
Using Maya: Modeling
Editing Curves Editing curves in the Attribute Editor
Pivots
Limit Information Use the Limit Information section to set limits to the transformations of the curve. You toggle the Limit X, Y, or Z boxes on or off and then change the values in the transformation boxes. When you do this, you can only move, rotate, or scale to the unit value you set in the corresponding boxes.
Display In the Display section, you can toggle the display of the local axis, display a selection handle, set a default manipulator (if you use the Show Manipulator Tool), or choose to hide the whole curve or toggle it into a template.
Accessing the curve’s history Click the curveShape tab to open the section of the editor that includes the history for the curve shape.
Click the triangle beside a heading to open that section of the editor. Using Maya: Modeling
81
NURBS Modeling
Use the Pivots section to scale or rotate the world space pivot, and toggle the display of scale and rotate pivots on or off.
Editing Curves Editing curves in the Attribute Editor
Nurbs Curve History The Nurbs Curve History section of the editor lists information for the active curve. This information is read-only. It simply provides you with the curve’s creation data.
Components The Components section is displayed when you select a CV on a curve that is created without history. The parameter boxes list the position of any CVs selected on the curve. This information is also available from the Channel Box.
Attribute Editor
Channel Box
Component Display For curves created with CVs, the Component Display section lets you change parameters to alter the curve’s display.
82
Using Maya: Modeling
Editing Curves Editing curves in the Attribute Editor
Object Display The Object Display section lets you toggle the visibility of the curve on or off, or turn it into a templated or intermediate curve. For example, the curve becomes invisible since it will only be used as a guide for subsequent operations.
Bounding Box The Bounding Box Information section is read-only. It displays the minimum and maximum world space coordinates of a curve along the X, Y and Z axes.
Using Maya: Modeling
83
NURBS Modeling
You can also toggle the display of CVs, edit points, or hulls on or off, and turn off the display of the curve in the Object Display section.
Editing Curves Using the Curve Editing Tool
Using the Curve Editing Tool Once you create a curve, you can open the Channel Box or the Attribute Editor and transform it or change the way it displays. You can also change its shape by transforming the CVs using the transformation tools. The Curve Editing Tool (Curves → Curve Editing Tool) is a shortcut tool. Use it to quickly change the shape of a curve by manipulating the tangent or position of a curve at any point along its length by scaling or rotating the tangent vector. This tool can be used on any modeling curve or animation motion path.
Tips The Curve Editing Tool will not modify the parameterization of the curve (chord or uniform). Use Curves → Rebuild Curves to do this. If you display curve CVs (Display → NURBS Components → CVs) while using the curve editor manipulator, notice how the manipulator changes the tangent by changing the position of the CVs of the curve.
To modify a curve using the curve editor manipulator handles: 1
Select Curves → Curve Editing Tool.
2
Click on the curve you want to modify to display the curve editor manipulator. It has several manipulator handles.
Parameter Position Tangent Scale
Point Position
Tangent Direction
3
84
Click-drag an active manipulator to change a curve point position and tangent alignment.
Using Maya: Modeling
Editing Curves Using the Curve Editing Tool
Changing the parameter position
Tips If you use the middle mouse button to drag the manipulator all the way to the left, it indicates the beginning or start point of the curve. If Snap to points is on when you are using this manipulator, you can snap to edit points on the curve. Click the Snap to points icon on the Status Line to turn snapping on.
Transforming the curve tangents A curve tangent is the slope of the curve at a specific point. Click-drag the manipulators to interactively scale or rotate the curve tangents. When using these manipulators, you can use either the right or middle mouse button to modify the curve tangents. •
Click-drag with the left mouse button to move an active manipulator.
•
Click-drag with the middle mouse button to move an active manipulator relative to the mouse position.
Using Maya: Modeling
85
NURBS Modeling
The parameter position handle of the manipulator determines on which point on the curve the curve editor manipulator is acting. As you move it along the curve, it shows the tangent and scale directions of the curve at that parameter value. Click-drag to slide the parameter position manipulator handle to a new position, or type a new value in the Numerical Input line, then press Enter.
Editing Curves Using the Curve Editing Tool In the following example, the Tangent Scale manipulator handle scales the tangent.
Tangent Scale manipulator
In this example, the Point Position manipulator handle changes the point position.
Point Position manipulator
In this example, the Tangent Direction manipulator handle changes the tangent direction.
Tangent Direction manipulator
86
Using Maya: Modeling
Editing Curves Using the Curve Editing Tool
Aligning the tangent horizontally or vertically NURBS Modeling
The red and blue dashed lines represent the AxisManips. Click once on a dashed line to align the tangent either horizontally or vertically. Click the red dashed line to align the tangent horizontally.
Click the blue dashed line to align the tangent vertically.
Using Maya: Modeling
87
Editing Curves Adding points to a curve
Adding points to a curve After a curve is constructed, you sometimes find that additional points are necessary to move points on a curve. Use the Curves → Add Points Tool to add additional CVs or edit points to a curve or curve-on-surface.
Tip If you want to add points to the start of a curve, first select Curves → Reverse Curves to reverse the curve direction.
To add CVs to a curve: If the curve is created with CVs: 1
Select Curves → Add Points Tool. The CVs are displayed.
2
Click on the curve to add a new CV. Continue clicking to add additional points. The new curve segment is tacked down from where you added the point.
3
Keep clicking to add additional CVs.
Click to add a new CV.
Select the Add Points Tool. CVs are displayed. Click to add additional CVs.
To add edit points to a curve: If the curve is created with edit points: 1
88
While the curve is active, click the Select by component type icon.
Using Maya: Modeling
Editing Curves Adding points to a curve 2
NURBS Modeling
With the right mouse button, click the Parm Points icon and toggle Edit Points on from the pop-up menu.
Tip Make sure the Points icon is not selected, otherwise CVs are selected first.
or While the curve is active, use the right mouse button to select Edit Point from the marking menu. 3
Select Curves → Add Points Tool.
4
Marquee-select the edit point at the end of the curve (the last edit point placed), then click to add a new edit point.
5
The new curve segment is tacked down from where you added the point. Keep clicking to add additional edit points.
Using Maya: Modeling
89
Editing Curves Adjusting CVs
Adjusting CVs Use Curves → CV Hardness to turn multiplicity factors of CVs on or off. See “Setting Insert Knot and Insert Isoparm options” on page 96 for information about changing the multiplicity factors for curve points.
Note CV hardness only works on curves of degree 3 (cubic).
To increase or decrease the CV hardness: 1
While the curve is active, click the Select by component type icon.
2
With the right mouse button, click the Points icon and toggle CVs on from the pop-up menu.
or While the curve is active, use the right mouse button to select Control Vertex from the marking menu. 3
90
Open the CV Hardness options window (Curves → CV Hardness - ❐) and click to turn Multiplicity to Full or Off.
Using Maya: Modeling
Editing Curves Adjusting CVs
Setting the multiplicity to full or off
To change the multiplicity of the interior CVs to go from 1 to 3, select Full. This is the default. To change a multiplicity factor from 1 to 3, there must be at least two CVs on each side of the CV being modified that have a multiplicity factor of 1. To change the multiplicity of the interior CVs to go from 3 to 1, select Off.
Example: smoothing text Select all the CVs and set Multiplicity to Off to quickly remove all the multiple knots on a cubic curve. The following example shows how text is modified by setting the Multiplicity to Off in the options window. 1
In component CV mode, marquee-select the text to pick all CVs.
2
Set the Multiplicity option Off in the options window and click the Apply button. Notice how the text loses its hard edges.
Keeping original geometry Turn the Keep Originals option On to specify whether the original curves or surfaces are retained after you change the multiplicity setting, and to access the Attribute Editor.
Editing the CV hardness in the Attribute Editor Use the Attribute Editor to edit the CV hardness once the operation is complete. Make sure Keep Original is on when you perform the operation to be able to access the Attribute Editor.
Using Maya: Modeling
91
NURBS Modeling
By default, when a cubic curve is created, the end CVs have a multiplicity factor of 3 and the arcs in between have a multiplicity factor of 1. The following options let you change the Multiplicity factors, or turn them off.
Multiplicity
Editing Curves Adjusting CVs To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Input Curve
The Input Curve information is read-only. It gives you access to the history of the curve you changed. Click the arrow button to select the curve and open its section of the editor.
Multiplicity
Enter a value in the Multiplicity box, or use the slider to specify the number of knots you want to insert when adjusting the CVs. See “Selecting the number of knots or isoparms” on page 97 for information about changing the multiplicity factor.
92
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
Inserting knots and isoparms NURBS Modeling
Sometimes you need to add extra spans on curves or more isoparms on a surface so you can edit surfaces to your specifications. Use Curves → Insert Knot to insert additional points on a curve without changing the shape of the curve. Use Edit Surfaces → Insert Isoparms to insert additional isoparms on a surface without changing the shape of the surface.
To insert points on a curve: 1
While the curve is active, select Display → NURBS Components → CVs or Edit Points.
2
Click the Select by component type icon, click the Parm Points icon, and select Curve Points from the pop-up menu.
or While the curve is active, use the right mouse button to select Curve Point from the marking menu. 3
Click on the curve where you want to insert a knot. A point is highlighted where you click.
4
To update the curve, select Curves → Insert Knot.
Using Maya: Modeling
93
Editing Curves Inserting knots and isoparms
Tips To change the location of the new knot before you insert it, hold the mouse button and drag the highlighted point to where you want it. As the location of the knot changes, the parameter value on the Feedback Line updates to indicate the new position of the point on the curve. You can select more than one curve point at a time. Press the Shift key while selecting the curve points then select Curves → Insert Knot.
To insert isoparms on a surface: 1 2
While the surface is active, click the Select by component type icon. With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu. You can also click the Parm Points icon, select Surface Points, then click on a point on the surface.
Parm Points Lines
3
94
or While the surface is active, use the right mouse button to select Isoparm or Surface Point from the marking menu Click-drag an existing isoparm to where you want to add a new isoparm, or select a point on the surface and click-drag, then select Edit Surfaces → Insert Isoparms to insert the new isoparm.
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
Unlike a curve which has only a U parametric direction, a surface has both a U and a V parametric direction. If you are inserting a U directional isoparm, you can only move along the V parametric direction on the surface. If you are inserting a V directional isoparm, you can only move along the U parametric direction on the surface. Look in the Feedback Line to verify your selection. You can select more than one isoparm at a time. Hold the Shift key while selecting the isoparms then select Edit Surfaces → Insert Isoparms.
Positioning knots or isoparms using the Channel Box When you insert a knot, the Channel Box includes a Parameter box from which you can enter values to change the position of the knot.
When you insert an isoparm, the Channel Box includes a Parameter box, as well as a Direction pop-up menu.
Enter a value in the Parameter box to reposition the isoparm. With the pointer over the Direction box, use the left mouse button to insert the isoparm in U or V. A Direction pop-up menu is also available in the Attribute Editor.
Using Maya: Modeling
95
NURBS Modeling
Tip
Editing Curves Inserting knots and isoparms
Setting Insert Knot and Insert Isoparm options To open the options window, select Curves → Insert Knot - ❐ or Edit Surfaces → Insert Isoparms - ❐.
Multiplicity
You can use the Multiplicity options to insert knots or isoparms concurrently or one-by-one.
Inserting knots or isoparms concurrently Select Set to and continue inserting new knots into the curve or isoparms to the surface until you achieve the specified multiplicity value. For example, if multiplicity at a point is 1 and the value in the Multiplicity box is set to 3, two knots are added to achieve a multiplicity of 3 on a CV curve. See also, “Adjusting CVs” on page 90 for more information about turning the multiplicity factors of CVs on or off.
96
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
NURBS Modeling
Set to 3
Notice the extra points.
Click to insert a point and press the Insert button.
Inserting knots or isoparms one-by-one Select Increase by to insert the number of knots specified in the Multiplicity box.
Note These new knots do not change the shape of the curve or surface.
Selecting the number of knots or isoparms Enter a value in the Multiplicity box, or use the slider to specify the number of knots you want to insert.
Keeping original geometry Toggle Keep Original on to determine whether the original curves or surfaces are retained after the insertion, and to let you use the Show Manipulator Tool. Using Maya: Modeling
97
Editing Curves Inserting knots and isoparms
Editing the inserted knot or isoparm position using manipulators If Keep Original is toggled on and you select the Show Manipulator Tool before you insert a knot, a manipulator is displayed at the insert location. Drag this manipulator to reposition the knot.
If you select the Show Manipulator Tool before you insert an isoparm, the isoparm remains highlighted after the insert operation is performed. This means you can drag the isoparm to a new location while the surface is active.
See “Using the Show Manipulator Tool” on page 11 for more information about the Show Manipulator Tool and modeling functions.
Editing the insert in the Attribute Editor To edit an active inserted knot or isoparm, use the Attribute Editor. To open the Attribute Editor, either:
98
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
NURBS Modeling
Input Curve/ Surface
The Input Curve or Input Surface information is read-only. It gives you access to the history of the curve or surface isoparm you used. Click the arrow button to select the curve or surface isoparm and open its section of the editor.
Add Knots
The Add Knots toggle is the same as the Multiplicity toggle in the options window. If toggled on, the number of knots you specify (in Number of Knots below) are added. If toggled off, knots are added until the number of knots you specified is achieved.
Parameter
The Parameter section of the editor includes the value you set in the Channel Box. This value is used to reposition the knot on the curve or the isoparm on the surface. See “Positioning knots or isoparms using the Channel Box” on page 95 for details.
Number of Knots
The Number of Knots section lets you specify how many knots or isoparms you want to insert. This is the same as the Multiplicity option in the options window.
Direction
For isoparms, a Direction pop-up menu is available. Use this to insert the isoparm in U or V. You can also select an insert direction from the Channel Box.
Using Maya: Modeling
99
Editing Curves Extending curves
Extending curves Sometimes after you construct a curve you find that it is not long enough to intersect other curves when using another operation (such as a Birail Tool), or that you want to use an extension of a particular curve to change a surface (such as a revolved object). Use Curves → Extend Curve to extend a curve or curve-on-surface using a linear, circular, or extrapolation method.
Note If you extend a curve-on-surface the result will be a NURBS curve (a 3D curve instead of a 2D curve).
To extend a curve: The following example uses the default options — a linear extension at the end point of the curve. Change the options to extend curves to suit your needs. 1
Pick the curve you want to extend.
2
Select Curves → Extend Curve. By default, the extension occurs at the end of the curve at a unit distance of 1.0000. To see the new points on the curve, select Display → NURBS Components→ CVs or Edit Points. In the following example, notice the added points where the curve extension occurs on the CV curve.
Extension
100
Using Maya: Modeling
Editing Curves Extending curves
Setting Extend Curve options NURBS Modeling
To open the options window, select Curves → Extend Curve -❐.
Changing the extension distance Distance is the default Extend Method. You can specify the length of the extension by entering a value in the Distance box below or using the slider.
Distance
Note For Linear extensions, the result is a linear distance. For Circular extensions, the result is an arc length distance. For Extrapolate extensions, the extension curve has an arc length equal to distance.
To change the extension distance: 1
Select the curve and undo the previous extension.
2
Type a new value in the Distance box, then press the Extend button.
Using Maya: Modeling
101
Editing Curves Extending curves The following example shows what happens when you change the default distance value on a curve that was used to create a revolved surface with construction history. Distance changed to 3 Construction curve
Default distance = 1
Press the Extend button to continue extending the curve by the distance you specify.
Extending to a point location Point
Use the Point extend method to extend the curve to the current point location. When you click the Point button, X, Y, and Z point extension boxes are displayed in the options window. By default, the extension occurs to the origin (0, 0, 0). To change the extension distance to or from the last point of the curve, select the curve. Enter a new value in the X, Y, or Z boxes, then press the Extend button.In the following, the extension occurs along the Y axis 10 units away from the default pivot point location (at position 0, 10, 0 in world space).
Construction curve
102
Using Maya: Modeling
Editing Curves Extending curves
Changing the curve extension type
If the curve is already extended, select it and undo the previous extension. Select an Extension Type button, then press the Extend button. Linear
The Linear extension type extends the curve in a straight line. This is the default.
Circular
The Circular extension type extends the curve as an arc.
Extrapolate
When you use Extrapolate, the extension maintains the tangent of the selected curve.
Specifying where to begin the extension Extend Curve At
Set Extend Curve At to Start or End to specify where the extension will occur. The default is End. For example, if you select the Start option, the curve is extended from the start point of the curve.
To change where the extension begins: Select an option for Extend Curve At, then click the Extend button. The following shows a revolved surface with the construction curve highlighted. Both End and Start methods are applied to the same curve. Using Maya: Modeling
103
NURBS Modeling
There are three types of curve extensions for the distance extension method: Linear, Circular, and Extrapolate.
Editing Curves Extending curves
Construction curve
End method selected
Start method selected
start
end
Attaching and detaching the extension Join to Original
Toggle Join to Original on to attach the curve extension to the original curve. The default is on. If toggled off, the curve extension is not attached to the input curve. The input curve and the curve extension are independent objects. You can transform the resulting extension separately.
Original curve
Join to Original on
Join to Original off
Simplifying the extension by removing multiple knots Remove Multiple Knots
Toggle Remove Multiple Knots on to remove all multiple knots that are created when the curve is extended and Join To Original is on. The resulting extended curve is of the same degree as the original curve.
Keeping original geometry If Keep Original is toggled off, the original curve is extended. If toggled on, a copy of the original curve with the extension is created. The default is off.
104
Using Maya: Modeling
Editing Curves Extending curves
Be careful when you toggle Join to Original off. If both Keep Original and Join to Original are toggled off, the extension curve replaces the original curve.
Editing the extension using manipulators If Keep Original is toggled on and you select the Show Manipulator Tool before extending a curve, manipulators are displayed on the curve and a Distance parameter box is displayed in the Channel Box. In the following, dragging the manipulator changes the distance from the default 1.0 to 4.0. Notice the Distance value in the Channel Box.
Drag the manipulator to further extend the curve, or type a distance value in the Channel Box. See “Using the Show Manipulator Tool” on page 11 for more information about the show manipulators.
Using Maya: Modeling
105
NURBS Modeling
Note
Editing Curves Extending curves
Editing the extension in the Attribute Editor To edit an extended curve, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The options you set in the options window or the Channel Box are displayed. See the option descriptions for details. The Attribute Editor for a curve extension includes the following additional parameters: Input Curve
Input Curve information is read-only. It gives you access to the input curve you extended. Click the arrow button to select the curve and open that section of the Attribute Editor.
Input Point
If Point is selected as the Extend Method in the options window, the Input Point parameter boxes are made available.
106
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
Offsetting curves and curves on surface Use Curves → Offset Curve On Surface to create a curve-on-surface parallel to the original curve-on-surface.
To offset a curve: 1
Select the curve you want to offset, then select Curves → Offset Curve.
2
An offset curve is created at a default offset distance of 1.0.
Original curve
Offset Curve selected
3
To change the default offset distance interactively, select the Show Manipulator Tool to display a LengthPoint manipulator on the original curve.
4
Click-drag the manipulator to change the offset curve distance.
You can also change the offset distance from the options window, the Attribute Editor, or the Channel Box.
To offset a surface isoparm: 1
To select the surface isoparm you want to offset, click the Select by component type icon.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
Using Maya: Modeling
107
NURBS Modeling
Use Curves → Offset Curve to create a curve parallel to the original at a specified offset distance.
Editing Curves Offsetting curves and curves on surface
or While the surface is active, use the right mouse button to select Isoparm from the marking menu. 3
Click the isoparm you want to offset.
4
Select Curves → Offset Curve. The isoparm is offset by the default offset distance of 1.0.
If you want, you can now use this isoparm to create a beveled edge to the cylinder. 5
108
While the offset curve is highlighted, select Surfaces → Bevel.
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
NURBS Modeling
Change the offset distance from the options window, Attribute Editor, or the Channel Box. The following shows how to change the offset distance from the Channel Box. 6
To select the offset surface isoparm, open the Outliner or Hypergraph window (Window → Outliner or Hypergraph).
7
Click the heading for the offset curve in the Channel Box and enter a new Distance value for the offset.
Using Maya: Modeling
109
Editing Curves Offsetting curves and curves on surface
To offset a curve-on-surface: 1
Draw a curve-on-surface, or use another method to create a curve-on-surface (see “Creating a curve-on-surface” on page 75 for details). In this example, the surface is live and the curve-on-surface is drawn in the top view.
top view
110
perspective view
2
Select Curves → Offset Curve On Surface while the curve-on-surface is active. The curve-on-surface is offset by a default offset distance value of 1.0.
3
To change the default offset distance interactively, select the Show Manipulator Tool while the offset curve-on-surface is highlighted. Drag the manipulator, or enter a value in the Distance box in the Channel Box.
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
NURBS Modeling
You can now use the Trim Tool (Edit Surfaces → Trim Tool), for example, to trim these sections out of the surface.
Using Maya: Modeling
111
Editing Curves Offsetting curves and curves on surface
Setting Offset Curve options Select Curves → Offset Curve - ❐ to open the options window.
Determining the normal direction Use the Normal Direction options to specify how the offset is calculated. Active View
Active View calculates the offset relative to the original geometry in the active view. Curves are offset in the plane of the active view.
Geometry Average
Geometry Average calculates the offset using a geometry average. This is the default.
112
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
NURBS Modeling
Tip Planar curves are offset in the plane of that curve. 3D curves are offset in 3D. If the original geometry is rotated out of the main planes or construction planes, you can get unexpected results when you create an offset using the Active View normal direction. If this happens, delete the offset geometry and create it again using the Geometry Average calculation.
Changing the offset distance The Offset Distance value is used to specify the distance between the original curve and the offset curve. You can use manipulators and the Channel Box to change the distance between the original curve and the offset curve; you can also change this value in the Offset Distance box or move the slider to obtain the desired offset distance.
Connecting offset curve breaks Breaks can occur in an offset if you attempt to offset a curve with CVs that have a multiplicity greater than 1 or multiple knots. These curves can have sharp corners and the offset curve may therefore break apart at these points. Connect Breaks
The following Connect Breaks options are used to specify how breaks in an offset curve can be adjusted. Use Circular to insert circular arcs between the offset components. Use Linear to connect the offset geometry linearly. If Off is selected, the offset curve remains broken and no action is taken to connect the offset geometry.
Note When Connect Breaks is set to Circular or Linear, multiple knots are inserted on the curve to preserve the curve shape. Any adjustment made to the curve later in the vicinity of the multiple knot locations may result in tangent breaks along the curve.
Using Maya: Modeling
113
Editing Curves Offsetting curves and curves on surface
Curve loop cutting Loop Cutting
Turn Loop Cutting to On or Off to determine whether or not any resulting loops in the offset geometry are trimmed away. Loop Cutting is set to On by default. Offset geometry looping occurs if the offset distance from the original curve exceeds the minimum bend radius (curvature) of the curve being offset. For example, if a curve has a 20mm radius and you try to offset more than 20mm inward, the offset curve crosses over itself and creates a loop.
Loop Cutting off
Loop Cutting on
Setting the cutting radius Cutting Radius
When Loop Cutting is on (the default), the Cutting Radius value is used. If the Cutting Radius value is greater than 0, instead of getting a sharp corner at the point where the loop has been cut, the result is a small arc of the given radius.
Cutting Radius is 0.0
114
Using Maya: Modeling
Cutting Radius is 0.375
Editing Curves Offsetting curves and curves on surface
Subdividing offset geometry The Max Subdivision Density value is a multiplicative factor that specifies the maximum number of times the offset geometry can be subdivided within the current tolerance. The default is 5, which means any single span on the curve could be subdivided up to 5 times.
Applying tolerance globally or locally Use Tolerance
With Use Tolerance, you can select to apply tolerance globally or locally.
Note A few functions include Use Tolerance as a construction operation alternative. For example, you can create a revolved surface with a preset number of spans, or you can toggle Use Tolerance on so that the revolved surface is closer to the actual surface of revolution. If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling to calculate the tolerance is used.
If you select Local tolerance, a box displays where you can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful where you want to change these values often, but don’t want to change the Global tolerance all the time.
Using Maya: Modeling
115
NURBS Modeling
Max Subdivision Density
Editing Curves Offsetting curves and curves on surface
Using tolerance values to place the offset curve accurately The Tolerance value represents the accuracy in which the offset curve is placed at a specified distance. The default is accurate to within 0.05 units. The default unit is in centimeters. Offsetting is an iterative process that continues until the current offset comes within the tolerance value or the maximum subdivision limit is reached.
Tolerance
Setting the curve range If you select Complete as the Curve Range, an offset curve is created along the entire original curve.
Curve Range
Select Partial to create an offset curve on only part of the original curve. This creates a subCurve history node (initially set to the whole curve) which can be edited using the Show Manipulator Tool.
Editing part of an offset curve If Partial is the selected Curve Range in the options window, the parameter range of an offset curve with history can be edited with manipulators. 1
Select the Show Manipulator Tool, then click on the offset curve result to list the subCurve history node in the Channel Box.
2
To display the manipulators, click the heading in the Channel Box to select the subCurve history node. Notice how the original curve turns a gray color.
Drag the manipulators to edit the subCurve interactively, or enter values in the Min Value and Max Value boxes in the Channel Box.
116
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
Setting Offset Curve On Surface options Select Curves → Offset Curve On Surface - ❐ to open the options window.
Most of the options in this options window are the same as the options for Offset Curve. See “Setting Offset Curve options” on page 112 for details. The following describes the one option particular to Offset Curve On Surface.
Checking the offset’s tolerance accuracy You can change the default value of Checkpoints Density to adjust the number of points per span at which the offset curve-on-surface is compared with the original. This lets you check if the offset curve is accurate to the required tolerance.
Editing the offset curves in the Attribute Editor To edit the attributes for a completed offset curve or curve-on-surface, use the Attribute Editor. To open the Attribute Editor, either: Using Maya: Modeling
117
NURBS Modeling
Use the same procedure to edit part of an offset curve-on-surface or surface isoparm.
Editing Curves Offsetting curves and curves on surface •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor for an offset curve contains the attributes for the type of input you used to create the offset.The options you set in the options window or the Channel Box are displayed. See the option descriptions for details.
Input Curve
118
The Input Curve information is read-only. It gives you access to the history of the curves or isoparms you used. Click the arrow buttons to select the input curve or surface isoparm and open its section of the editor.
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
Editing offset curves-on-surface in the Attribute Editor NURBS Modeling
The Attribute Editor for offset curves-on-surface differs slightly. Some attributes are not available for an offset curve-on-surface.
Editing subCurves in the Attribute Editor If the Partial option is set as the Curve Range in the options window, the Input Curve box displays the subCurve history node. Click the arrow to access the subCurve and its Attribute Editor. See “Editing subCurves in the Attribute Editor” on page 19 for details.
Using Maya: Modeling
119
Editing Curves Fitting cubic geometry to linear geometry
Fitting cubic geometry to linear geometry Use Curves → Fit B-Spline to fit a cubic curve to a degree 1 (linear) curve.
Tip Typically you use Fit B-spline when importing curves and surfaces from other systems that may import to Maya as degree 1 (linear) geometry. Degree 1 geometry is also quite common when working with digitized data.
To fit a cubic curve: 1
Select the curve or curves to which you want to fit a cubic curve.
2
Select Curves → Fit B-Spline. The fit is based on the tolerance type you select from the options window.
120
Using Maya: Modeling
Editing Curves Fitting cubic geometry to linear geometry
Setting Fit B-Spline options NURBS Modeling
Select Curves → Fit B-Spline - ❐ to open the options window.
Setting the tolerance Use Tolerance
The tolerance determines the degree of accuracy that is maintained between the original and fit or interpolated curves. Select a Use Tolerance option to apply tolerance globally or locally. If set to Global, the fit should be accurate to within 0.010 units. A unit refers to the current unit of linear measure (the default unit of measure is centimeter). The default for Use Tolerance is Global. If set to Local, you can change the default tolerance value in the Positional Tolerance box.
Using Maya: Modeling
121
Editing Curves Fitting cubic geometry to linear geometry
Editing the B-Spline curve in the Attribute Editor To edit a fit b-spline curve, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Input Curve
The Input Curve information is read-only. It gives you access to the original curve you used. Click the arrow button to select the curve and open its section of the editor.
Tolerance
The Tolerance value you set in the options window is displayed. See the option descriptions for details.
122
Using Maya: Modeling
Editing Curves Filleting curves
Filleting curves There are two ways to construct curve fillets: Circular and Freeform. Select the type you want from the options window before you create the fillet. Circular is the default fillet construction type.
Creating circular curve fillets Use circular curve fillets to create curves with the exact amount of roundness you want. The curves do not necessarily have to intersect.
To create a circular curve fillet: 1
Marquee-select two curves.
2
Open the Fillet Curve options window (Curves → Fillet Curve - ❐). Make sure Circular (which is the default) is the selected Construction type.
Tips If you select more than two curves, the last two selected curves are used to create the fillet curve. If creating a circular fillet, make sure the curves are on the ground plane or the same construction plane. You cannot fillet between a NURBS curve and a curve-on-surface, or between two curves on surface on different surfaces. If you do, a fillet is created on the first selected curve between its end points. 3
Select Curves → Fillet Curve to create the curve fillet, or click the Fillet button in the options window.
Using Maya: Modeling
123
NURBS Modeling
Use Curves → Fillet Curve to create a circular bridge between two NURBS curves or two curves on surface.
Editing Curves Creating circular curve fillets
Circular curve fillet
Editing the circular curve fillet with manipulators 1
Select the Show Manipulator Tool and click the filletCurve heading in the Channel Box to display the TopPoint manipulator and two param manipulators for the fillet curve.
TopPoint manipulator
Param manipulators
2
124
Click-drag the TopPoint manipulator to adjust the radius of the circular fillet.
Using Maya: Modeling
Editing Curves Creating circular curve fillets
NURBS Modeling
3
Click-drag the param manipulators to interactively slide the fillet curve along the input curves.
4
In the following example, notice how the values update in the Channel Box when all three manipulators are adjusted.
As you drag a manipulator, the parameter values are also updated in the Feedback Line. If you want, you can enter a numerical value in the Numerical Input line when a manipulator is active.
Using Maya: Modeling
125
Editing Curves Creating freeform curve fillets
Creating freeform curve fillets Use this type of filleting when you want more flexibility in choosing where the fillet occurs. You can specify exact parameter repositioning, or choose to fillet the curve wherever you need to.
To create a freeform curve fillet: 1
Make sure Freeform is the selected Construction type in the options window.
2
Marquee-select the curves you want to create a fillet between.
3
Select Fillet Curve to create the curve fillet.
Editing the freeform curve fillet with manipulators
126
1
Select the Show Manipulator Tool and click the filletCurve heading in the Channel Box to display two param manipulators for the fillet curve.
2
Click-drag the param manipulators to interactively slide the fillet curve along the input curves. Since the fillet curve is not circular, you can drag in any direction.
Using Maya: Modeling
Editing Curves Creating freeform curve fillets
NURBS Modeling
As you drag a manipulator, notice how the parameter values change in the Channel Box and the Feedback Line and how the freeform fillet curve is adjusted. You can also type a numerical value in the Numerical Input line when a manipulator is active.
Using Maya: Modeling
127
Editing Curves Creating freeform curve fillets
Setting Fillet Curve options Select Curves → Fillet Curve - ❐ to open the options window.
Creating and attaching trimmed fillet curves Trim
If Trim is toggled on, the curves selected as the filleting components are automatically trimmed back to the ends of the fillet curve.
Freeform fillet with Trim toggled off. Join
128
Same fillet with Trim toggled on.
The Join toggle is only available when Trim is toggled on. Use this option to join the trimmed curves to the fillet curve.
Using Maya: Modeling
Editing Curves Creating freeform curve fillets
NURBS Modeling
When Join is toggled off, the trimmed curves are not joined to the fillet curve.
When toggled on, both the trimmed curves and the fillet curve are joined.
Keeping original geometry This toggle is only available if the Trim option is toggled on. If Keep Original is toggled on, the original curves that you used to create the fillet are retained. This lets you modify the geometry of the input curves and recreate the fillet. The following shows the same fillet with Trim, Join, and Keep Original toggled on.
Setting the fillet construction type Circular
Select Circular to create fillets with true radii, based on the current Radius value. See “To create a circular curve fillet:” on page 123 for more information.
Freeform
Select Freeform when you need a fillet that is more flexible and less precise. Use this construction method to determine the contact points of the fillet and base components. See “To create a freeform curve fillet:” on page 126 for more information.
Note The Radius option is not available when you select the Freeform fillet construction type.
Using Maya: Modeling
129
Editing Curves Creating freeform curve fillets
Changing the fillet radius The value you enter in the Radius box specifies the radius of the fillet for circular curve fillet construction before the fillet is created. Use the slider or enter a new value, then press the Fillet button in the options window. The radius can also be changed interactively using manipulators (if the Show Manipulator Tool is selected), from the Channel Box, or from the fillet’s Attribute Editor.
Selecting the free-form fillet type The following Freeform Type options are used to specify on which side of a curve a free-form fillet is constructed. Tangent
If Tangent is selected, the fillet is pulled toward the intersection of the tangents of the two curves at the contact points.
Blend
If Blend is selected, the fillet is pulled toward the mid-point of the projected contact points of the two curves. Each contact point is projected onto the tangent of the other curve. The default Freeform Type is Blend.
Blend Control
Use Blend Control to adjust the fillet component. It can be toggled on or off when you use either filleting construction type. If toggled on, Depth and Bias boxes are displayed.
Note If Blend Control is toggled on when constructing circular fillets, the resulting fillet will not be truly circular. The true contact points from the circular fillet are used to create a freeform fillet.
Changing the fillet depth and bias Depth
130
The Depth value controls how much the fillet curve is pulled toward the intersection of the two curves.
Using Maya: Modeling
Editing Curves Creating freeform curve fillets
Depth = 0.5000 Bias = 0.0000 (default)
Depth = 0.0000 Bias = 0.5000
Depth = 0.3500 Bias = 0.3500
Depth = 0.7500 Bias = 0.1000
Editing curve fillets in the Attribute Editor To edit a completed curve fillet, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor for circular curve fillets and freeform curve fillets contain the same attributes. All other options are included in the Fillet Curve options window. See “Setting Fillet Curve options” on page 128 for details.
Using Maya: Modeling
131
NURBS Modeling
The Bias value controls how much the fillet curve is pulled to either of the two curves. See the following examples.
Bias
Editing Curves Creating freeform curve fillets
Input Curve
The Input Curve information is read-only. It gives you access to the history of the curves you used to create the fillet. Click the arrow buttons to select one of these curves if you want to edit it.
Curve Parameters
The Curve Parameter1 and Curve Parameter2 values correspond to the fillet’s param manipulators you see when the Show Manipulator Tool is selected. These parameter values define the region between the two curves where the fillet curve is created.
132
Using Maya: Modeling
Editing Curves Opening and closing curves and surfaces
Opening and closing curves and surfaces To close an open curve: 1
Select the curve you want to close, then select Curves → Open/Close.
2
Select Curves → Open/Close again to re-open the curve.
To create a closed surface from an open curve: 1
Use an open curve as a construction curve and select Surfaces → Revolve.
2
Pick the construction curve and select Curves → Open/Close. The revolved surface is now closed.
Using Maya: Modeling
133
NURBS Modeling
Use Curves → Open/Close or Edit Surfaces → Open/Close to toggle curves and surfaces open or closed.
Editing Curves Opening and closing curves and surfaces
3
You can open it again by selecting the construction curve and clicking Curves → Open/Close.
To open a closed surface:
134
1
Select the surface you want to open.
2
Select Edit Surfaces → Open/Close.
3
To close the open surface, simply select Edit Surfaces → Open/Close to toggle the surface closed.
Using Maya: Modeling
Editing Curves Opening and closing curves and surfaces
Setting Close Curve options NURBS Modeling
Select Curves → Open/Close Curves - ❐ to open the options window.
Preserving the shape of the original curve or surface Use Preserve Shape to determine how the original curve or surface is affected by the Open/Close operation. This option is toggled on by default. Control points are added or deleted as necessary to preserve the shape of the original curve or surface. If toggled off, the selected curve or surface is open or closed without ensuring that the shape of the original is preserved.
Keeping the original geometry Toggle Keep Original on to determine whether the original curves or surfaces are retained after Open/Close is performed.
Setting Close Surface options Select Edit Surfaces → Open/Close Surfaces - ❐ to open the options window.
Using Maya: Modeling
135
Editing Curves Opening and closing curves and surfaces
Changing the surface direction The Surface Direction options, U, V, and Both, let you choose in which direction a surface is opened or closed. The following shows how these options are used to close a beveled curve.
Surface Direction
U
V
Both
Selecting an isoparm to change the close direction You can specifically select in which direction you want to close a surface from the options window, or you can click to select isoparms on the surface. When you do this, you override the Surface Direction setting in the options window.
To select isoparms on an open surface: 1
Click the Select by component type icon.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the surface is active, use the right mouse button to select Isoparm from the marking menu. 3
136
Click on an isoparm in the direction in which you want it to open or close.
Using Maya: Modeling
Editing Curves Opening and closing curves and surfaces
V
NURBS Modeling
U
U/V
Editing the closed shape in the Attribute Editor To edit the opened or closed curve or surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
137
Editing Curves Opening and closing curves and surfaces
The Attribute Editor for a closed curve contains the same attributes for curves. See “Editing curves in the Attribute Editor” on page 79 for details. For a closed surface, the options you set in the options window or the Channel Box are displayed. See the option descriptions for details.
138
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
Duplicating curves and isoparms NURBS Modeling
Use Curves → Duplicate Curves to transform a curve-on-surface, a boundary curve, or an interior isoparm of an existing surface into a 3D curve.
To duplicate a surface isoparm: 1
Select the surface on which you want to duplicate an isoparm.
2
Click the Select by component type icon.
3
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the surface is active, use the right mouse to select Isoparm from the marking menu. 4
Click on a surface isoparm that is going in the same direction as the one you want to duplicate.
5
Click-drag the isoparm to the required location, then release the mouse button.
Using Maya: Modeling
139
Editing Curves Duplicating curves and isoparms 6
Select Curves → Duplicate Curves.
7
The selected surface isoparm is duplicated and highlighted, indicating that it is active.
New 3D curve
Open the Hypergraph (Window → Hypergraph) to see the new duplicated curve.
Changing a duplicated isoparm’s direction While the duplicated isoparm is active, use the left mouse button to select either U or V as the Isoparm Direction in the Channel Box or in the curveFromSurfaceIso section of the Attribute Editor. U is the default direction.
140
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
NURBS Modeling
Notes and Tips All transformations of the surface where the original curve is located are combined and applied directly to the CVs of the new duplicated curve. This places the duplicate in the same location in space as the original. If the surface isoparm you want to duplicate is either a U or V directional isoparm, you can only move it along the U or V parametric direction on the surface.
To duplicate a curve-on-surface: The following shows how to duplicate projected text to create a text string which follows the curve of a NURBS sphere. 1
Create and scale a NURBS sphere larger than the default.
2
Use Primitives → Create Text to create text and scale it larger than the default size. See “Creating and editing text” on page 235 for more information.
3
Marquee-select the sphere and the text, then use Edit Surfaces → Project Curve to project the text onto the sphere. See “Projecting curves” on page 390 for more information.
Using Maya: Modeling
141
Editing Curves Duplicating curves and isoparms
4
Select Curves → Duplicate Curves and use the Move Tool to move the duplicated text off the sphere.
To duplicate curves for trimming: Another way you can use duplicate curves on surface is to trim holes from both sides of a surface using the same curve. The following shows how to trim holes out of a NURBS cylinder.
142
1
Create a primitive cylinder at the origin and scale it by 5 in X, Y, and Z.
2
Select the cylinder and select Modify → Make Live to make it a live surface.
3
In the front view, draw a curve on the cylinder (a curve-on-surface). This curve must be a closed curve, so make sure the end points of the curve meet. To close the curve, you can also select the curve, then select Curves → Open/Close Curves.
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
NURBS Modeling
4
Deselect the curve and select Modify → Make Live again to deselect the surface. The curve you just created is highlighted.
5
Select Curves → Duplicate Curves. The curve is duplicated and appears in the lead object color.
6
Click the Snap to grids icon on the Status Line.
7
In the top view use the Move Tool and click-drag to move the duplicated curve to the other side of the surface and rotate it in Y by -180.
8
To move the duplicated curve back onto the cylinder, enter 0, 0, 0 in the Translate X, Y, and Z boxes in the Channel Box or in the Attribute Editor.
9
Select the cylinder and the duplicated curve, then select Edit Surfaces → Project Curves to highlight the projected curve.
Using Maya: Modeling
143
Editing Curves Duplicating curves and isoparms
10 Click to deselect everything. Select Edit Surfaces → Trim Tool, then click on the cylinder as the area to keep. Press Enter to trim the holes out of the surface.
Tip on duplicating a curve-on-surface If you move a curve-on-surface over a surface, it does not necessarily stay the same shape. For example, if you create a circular curve-on-surface and then start sliding it to a region of the surface where the isoparms are closer together, the curve-on-surface becomes squashed and oval shaped.
144
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
Editing part of a duplicated curve 1
While the duplicated curve is active, select the Show Manipulator Tool. Click the heading in the Channel Box to display the manipulators.
2
Drag the manipulators or enter Min or Max values to edit the duplicated surface isoparm.
Using Maya: Modeling
145
NURBS Modeling
To keep the same shape, duplicate the curve-on-surface to make it into a 3D curve. Move it over the surface to place it where you want. You can then project it back onto the surface to create a curve-on-surface and retain the curve’s shape.
Editing Curves Duplicating curves and isoparms
Setting Duplicate Curves options Select Curves → Duplicate Curves - ❐ to open the options window.
Grouping the original curve on or off The Group With Original option is toggled off by default. If you duplicate a curve with Group With Original toggled off, the resulting duplicated curve uses the world space version of the surface and is created with the initial surface’s transformation. If toggled on, the resulting curve uses the local space version of the surface, but is parented under the surface transformation. It may look the same as the isoparm or curve-on-surface, but if you edit the CVs on the resulting curve or apply any kind of transformation to it, you will notice a difference, especially after any subsequent surface transformations. For example, duplicate a cylinder isoparm, move the middle CV of the resulting curve in X, then rotate the cylinder 90 degrees about Z. If the option was toggled on, the center CV of the curve is moved in X. If toggled off, the center CV is moved in Y, which may be the result you need.
146
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
Editing the duplicated curve in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. A duplicated curve includes the same options and parameters for a curve. See “Editing curves in the Attribute Editor” on page 79 for details.
Using Maya: Modeling
147
NURBS Modeling
To edit a duplicated curve, use the Attribute Editor. To open the Attribute Editor, either:
Editing Curves Attaching curves and surfaces
Attaching curves and surfaces You use Curves → Attach Curves to join two curves by attaching their endpoints to create a single curve. You can also join two surfaces by attaching their edges to create a single surface.
Attaching curves and surfaces with history off The Attach options windows (both for curves and surfaces) contain a toggle that lets you keep the original curves or surfaces after the attach is performed. Keep Original is toggled on by default. Try not to toggle this option off if history is set to on (the Construction History icon in the Status Line); odd behavior can occur if the attached curve or surface is modified later. In the following, two curves are attached using different settings for Keep Original and history. They are then scaled by 0.5 in X, Y, and Z.
Original curves
If history is on and Keep Original is toggled off, the attached curve replaces the first curve. When you scale the resulting attached curve, the scale is applied to the original curve (the one that was replaced) and changes the shape of the curve, thereby changing the attachment. History on, Keep Original off
The attachment looks fine, but when you scale the attached curve, the results are probably not what you expected.
148
Using Maya: Modeling
Editing Curves Attaching curves and surfaces
NURBS Modeling
If you want to scale the attached curve and maintain its shape, make sure construction history is off when Keep Original is toggled off, or both construction history and Keep Original are set to on. History on, Keep Original on
History off, Keep Original off
To attach two curves: 1
Marquee-select the curves you want to attach.
2
Select Curves → Attach Curves to attach the two curves. The curve ends that are closest to each other are attached.
You can also place a curve point to specify the attach location. To place a curve point, use the marking menu or the Select by component type icon.
To place a curve point using the marking menu: 1
Select the first curve, press the right mouse button while the pointer is over the curve and select Curve Point from the marking menu. Using Maya: Modeling
149
Editing Curves Attaching curves and surfaces
150
2
Click on the curve where you want to place the first curve point. A point is displayed at the click location.
3
Shift-select the other curve and release the mouse button.
4
Press the right mouse button while the pointer is over this curve and select Curve Point from the marking menu again.
5
Shift-select and click at the next attach location. Another point is displayed at the click location.
6
Select Curves → Attach Curves to attach the curves.
Using Maya: Modeling
Editing Curves Attaching curves and surfaces
To place a curve point in component mode: Click the Select by component type icon on the Status Line.
2
With the right mouse button, click the Parm Points icon and toggle Curve Points on from the pop-up menu.
3
Click on the first curve to place the first point and Shift-click on the second curve. Points are displayed at each click location.
4
Select Curves → Attach Curves to attach the two curves.
5
To return to object selection mode, click the Select by object type icon on the Status Line.
To attach two surfaces: To specify the attach location for surfaces, use the marking menu or the Select by component type icon. To attach two surfaces, you must select surface isoparms.
Important Note When you select isoparms to attach surfaces, the surfaces are attached depending on the selection order. In the following example, the isoparms are selected in a different order. Notice the difference between the two resulting surfaces. The same applies when attaching two curves.
Using Maya: Modeling
151
NURBS Modeling
1
Editing Curves Attaching curves and surfaces
Pick first
Pick first
To select isoparms using the marking menu: 1
With the pointer positioned over the surface, use the right mouse button to select Isoparm from the marking menu, and click to select an isoparm.
Select isoparm
2
152
Shift-select the other surface and release the mouse button.
Using Maya: Modeling
Editing Curves Attaching curves and surfaces With the pointer positioned over this surface, use the right mouse button to select Isoparm from the marking menu again.
4
Shift-select the second isoparm.
5
To attach the surfaces, select Edit Surfaces → Attach Surfaces.
To select isoparms in component mode: 1
Click the Select by component type icon on the Status Line.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
3
Click on the first isoparm you want to attach, then Shift-select the second isoparm.
4
Select Edit Surfaces → Attach Surfaces to attach the two surfaces.
5
To return to object selection mode, click the Select by object type icon on the Status Line.
Using Maya: Modeling
153
NURBS Modeling
3
Editing Curves Attaching curves and surfaces
Setting Attach Curves and Attach Surfaces options Select Curves → Attach Curves - ❐ or Edit Surfaces → Attach Surfaces - ❐ to open the options window.
Keeping and removing knots Multiple Knots
The Multiple Knots options are used to specify whether the multiple knots at the join point are kept or removed after the attach is done. Use Keep to keep the multiple knots created at the join point as a result of the attach. This is the default. Use Remove to remove the multiple knots at the join point. The shape of the geometry can be changed if required.
154
Using Maya: Modeling
Editing Curves Attaching curves and surfaces
NURBS Modeling
Tip If you construct the initial curves or surfaces carefully, an attach usually produces the desired results without knot insertion. If you perform an attach operation with Multiple Knots set to Remove and then feel you need more localized control, you can reverse it using Edit → Undo, then perform the Attach again with Keep selected.
Keeping original geometry If Keep Original is toggled on, the original curves or surfaces are retained after the attach is performed. See “Attaching curves and surfaces with history off” on page 148 for information.
Editing the attachment in the Attribute Editor You can edit the parameters displayed in the Channel Box and the Attribute Editor for a selected attached curve or attached surface node. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The options you set in the options window or the Channel Box are displayed in the Attribute Editor. See the option descriptions for details. These parameters are the same as the Curves → Align Curves parameters. All Continuity and Scaling options are off by default and should not be toggled on. The Join parameter can be changed to specify a different end of the curve or surface isoparm to use in the attach. See “Editing the alignment using manipulators and the Channel Box” on page 178 and “Editing the alignment in the Attribute Editor” on page 180 for more information about these parameters.
Using Maya: Modeling
155
Editing Curves Detaching curves and surfaces
Detaching curves and surfaces Use Curves → Detach Curves or Edit Surfaces → Detach Surfaces to break a curve into two curves, to open a currently closed curve, or to detach a surface.
To detach a curve: The following shows what happens when you detach part of the construction curve used to create a revolved surface. The revolved surface must be created with the Construction History icon on. 1
Select the original construction curve.
If it is difficult to select the construction curve, open the Hypergraph or Outliner window and select it from there.
156
Using Maya: Modeling
Editing Curves Detaching curves and surfaces Click the Select by component type icon from the Status Line.
3
With the right mouse button, click the Parm Points icon and toggle Curve Points on from the pop-up menu.
or While the pointer is over the active curve, use the right mouse button to select Curve Point from the marking menu. 4
Click where you want to detach the curve. A point appears where you click. This point is the parameter value.
Tip To change the detach location before detaching the curve, click on another point and drag it along the curve. 5
Select Curves → Detach Curves. The construction curve is detached at this parameter value, the detached section of the curve is highlighted, and the revolved surface is reconstructed.
Using Maya: Modeling
157
NURBS Modeling
2
Editing Curves Detaching curves and surfaces
6
To delete the unwanted curve section, deselect everything, select the part of the curve you want to delete and press the Backspace key.
You can also detach at more than one curve point at a time. Shift-click when placing the curve points and select Curves → Detach Curves.
To move a periodic curve’s start point: A periodic curve, such as a NURBS circle or a closed curve, has a start point. You can move this start point using Detach Curves.
158
1
Make sure the Construction History icon is off in the Status Line before you create the curve.
2
With the right mouse button, select Curve Point from the marking menu.
3
Click to determine a detach point, then select Curves → Detach Curves. This moves the start point to the curve point position.
Using Maya: Modeling
Editing Curves Detaching curves and surfaces
start point moved detach point
To detach a surface: 1
Select the surface you want to detach.
2
Click the Select by component type icon.
3
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the pointer is over the active surface, use the right mouse button to select Isoparm from the marking menu. 4
Click on the isoparm where you want to detach the surface.
Using Maya: Modeling
159
NURBS Modeling
start point
Editing Curves Detaching curves and surfaces
5
Select Edit Surfaces → Detach Surfaces. The surface is detached from the isoparm location you specified.
6
You can now transform the detached section of the surface.
You can also detach at more than one isoparm at a time. When you select the isoparms, Shift-click to select more than one isoparm, then select Edit Surfaces → Detach Surfaces.
160
Using Maya: Modeling
Editing Curves Detaching curves and surfaces
NURBS Modeling
Setting Detach Curves and Detach Surfaces options Select Curves → Detach Curves - ❐ or Edit Surfaces → Detach Surfaces - ❐ to open the options window.
Keeping original geometry If Keep Original is toggled on when you perform the detach, the original curve or surface is retained. If you use the Show Manipulator Tool when you perform the detach, a detach curve manipulator is displayed. This manipulator lets you interactively change the parameter value for the detach.
Using Maya: Modeling
161
Editing Curves Detaching curves and surfaces If you later want to change this value with the Show Manipulator Tool, select the detached curve, then select the detach curve node in the Channel Box, and enter a new parameter value.
Editing the detachment in the Attribute Editor The Attribute Editor for a detached curve contains the same attributes for curves. See “Editing curves in the Attribute Editor” on page 79 for details. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor for detached surfaces, however, contains the same attributes you find in the Channel Box. See “Changing the detach direction and position,” that follows for details.
162
Using Maya: Modeling
Editing Curves Detaching curves and surfaces
NURBS Modeling
Input Surface
The Input Surface information is read-only. It gives you access to the history of the surface you detached. Click the arrow button to select the surface and open its section of the editor.
Direction
Use the Direction pop-up menu items to specify the direction of the detachment.
Keeping the geometry in U or V The Keep section lets you specify whether or not original geometry is kept in either U or V when you perform the detachment.
Changing the detach direction and position You can change the direction of the detachment by selecting U or V from the Direction pop-up menu in the Channel Box or Attribute Editor. You can also enter a parameter value to change where the detachment occurs. In the following, a V isoparm is selected, moved, and then detached twice. The first detachment moves the seam of the cone, which is periodic in V.
Using Maya: Modeling
163
Editing Curves Detaching curves and surfaces
If you change the parameter value, the detachment area is increased or decreased. In the following example, the parameter value is increased to 1.5.
To change the detach direction, select U from the Direction pop-up menu to detach the isoparm from a parameter value of 1.5 in the U direction.
164
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Aligning curves and surfaces What is continuity? Continuity between curves or surfaces can be an important factor when you want to create the perfect surface for animation and rendering purposes. Aligning always enforces at least positional continuity, and lets you enforce tangent and curvature continuity. Once the selected elements are aligned, you can adjust the tangent magnitude at the junction of the two elements by setting options or manipulators to give you more control when modifying the aligned elements.
Positional continuity aligns the first CVs along the curves or surface isoparms.
1st CV 2nd CV Tangent continuity uses the second CVs to achieve tangent continuity.
1st CV Curvature continuity uses the third CVs to achieve curvature continuity.
3rd CV
When you use Align, the selected elements are modified to positional continuity based on one option setting, then modified to tangent continuity based on a second option setting. See “Setting Align options” on page 172 for more information.
Using Maya: Modeling
165
NURBS Modeling
Use Curves → Align Curves and Edit Surfaces → Align Surfaces to establish continuity between curves and surfaces.
Editing Curves Aligning curves and surfaces
Important notes The Align options windows (both for curves and surfaces) contain an Attach toggle that lets you attach the original curves or surfaces after the align is performed. Attach is toggled off by default. If this option is on, toggle history off (the Construction History icon in the Status Line) or odd behavior can occur if the aligned curve or surface is modified later. See “Attaching curves and surfaces with history off” on page 148 for examples. If the Attach option is toggled on in the options window, the aligned elements are joined together and you get one result.
Selecting curve points and isoparms to align Align doesn’t always work when you marquee-select curves or surfaces. Select a component (a curve point or a surface isoparm) to reliably define which ends to align.
Aligning Curves To specify the align location for curves, you have to place curve points. Use the Select by component type icon or the marking menu. The following alignment is performed using the default option settings.
To align two curves in component mode:
166
1
Click the Select by component type icon from the Status Line.
2
With the right mouse button, click the Parm Points icon to toggle Curve Points on from the pop-up menu.
3
Click on the first curve to place the first point, and Shift-click on the second curve. Points are displayed at each click location.
4
Select Curves → Align Curves to align the two curves.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
NURBS Modeling
If necessary, you can also select the curve point and drag it to the desired location.
To return to object selection mode, click the Select by object type icon on the Status Line.
To align two curves from the marking menu: 1
Select the first curve, and while the pointer is over the curve select Curve Point from the marking menu.
Using Maya: Modeling
167
Editing Curves Aligning curves and surfaces
168
2
Click on the curve where you want to place the first curve point.
3
Shift-select the other curve and release the mouse button.
4
While the pointer is over this curve, use the right mouse button to select Curve Point from the marking menu again.
5
Shift-click at the next align location. Another point is displayed.
6
Select Curves → Align Curves to align the curves.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
A curve can only be aligned to another free curve. A curve-on-surface can only be aligned to another curve-on-surface, provided it is on the same surface.
Aligning surfaces To specify the align location for surfaces, you have to select surface isoparms. Use the Select by component type icon or the marking menu. The following alignment is performed using the default option settings.
To align surface isoparms in component mode: 1
Click the Select by component type icon.
2
With the right mouse button, click the Lines icon to toggle Isoparms on from the pop-up menu.
3
Click on the isoparms where you want to align the surfaces, then select Edit Surfaces → Align Surfaces.
Using Maya: Modeling
169
NURBS Modeling
Tips
Editing Curves Aligning curves and surfaces
Tips You can also hold the mouse and drag the isoparm to another location if necessary. When aligning a surface to a surface, only surface isoparm boundaries can be modified, although you can align one surface (the one that is modified) to any isoparm on the other surface.
To align surface isoparms from the marking menu: 1
With the pointer positioned over the first surface, use the right mouse button to select Isoparm from the marking menu, and click to select an isoparm.
2
With the pointer positioned over the second surface, use the right mouse button to select Isoparm from the marking menu again.
3
Shift-select the second isoparm.
4
Select Edit Surfaces → Align Surfaces to align the surfaces.
Align limitations
170
•
You cannot align closed/periodic curves or surface boundaries that are closed/periodic.
•
An exact tangent or curvature continuous surface cannot be guaranteed if surfaces are rational (if the weight is not 1.0, the surface is rational).
•
You cannot align a free curve to a curve-on-surface.
•
You cannot align a curve or surface to itself.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Aligning to a trimmed edge
1
Select an isoparm at the edge of the untrimmed surface and one near the trimmed edge of the other surface.
2
Adjust the Join Parameter value in the Channel Box if necessary.
Using Maya: Modeling
171
NURBS Modeling
You cannot align to a trimmed edge; you can only align to surface isoparms. For example, if your surfaces look like the following you can still align the two surfaces, but Align uses the boundary of the underlying surface of the trimmed surface.
Editing Curves Aligning curves and surfaces
Setting Align options Select Curves → Align Curves - ❐ or Edit Surfaces → Align Surfaces - ❐ to open the options window.
See “Editing the alignment using manipulators and the Channel Box” on page 178 to find out how you can adjust some of these parameters in the Channel Box to suit your needs.
Setting attachment options Select Attach if you want to attach the alignment. You can then set the following options:
Attach
Keeping or removing multiple knots Multiple Knots
When objects are joined, Multiple Knots are created at the join parameter. Select Keep to retain these knots. Select Remove to remove as many knots as possible without changing the shape of the object when the attach is performed.
172
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Determining the continuity between intersections
Position
Positional continuity means that the ends of two curves or the edges of two surfaces meet exactly. The following shows how curves are aligned with each Modify Position option (First, Second, and Both). When Keep Original is toggled on, notice how the curves are aligned by comparing the position of the original curves to the aligned curve. The alignment occurs depending on which curve is selected first (white) and last (green).
Both
First (default)
Second
See “Changing the order of the alignment” on page 174 for more information about the order in which you want the curve or surface modified. Tangent
Tangent continuity exists when two elements are placed end to end, but the tangents at the two endpoints also match.
Using Maya: Modeling
173
NURBS Modeling
Continuity means that two curves intersect, or that two surfaces share a boundary. Continuity options let you specify how to achieve continuity for the two elements. See “What is continuity?” on page 165 for more information about continuity.
Editing Curves Aligning curves and surfaces
End point of curves curve 1
curve 2
Curvature
Curvature continuity exists when two elements that meet with tangent continuity also have the same curvature at the joint. When this option is selected, the curvature scale sliders are enabled. See also “Scaling the tangent and curvature alignment” on page 177 for information on increasing or decreasing the tangent magnitude or curvature at the end of a curve.
Changing the order of the alignment You can choose in what order you want the curve or surface modified. The following tables show what is modified when you select the Modify Position, Modify Boundary, and Modify Tangent options, First, Second, or Both, for curves or surfaces.
Changing the Modify Position options
Modify Position
Curves
Surfaces
First
The entire first curve moves so its end point coincides with the start of the second curve.
The entire first surface moves so its end boundary coincides with the start boundary of the second surface. Some adjustments are made to the first surface end boundary CVs.
Only the shape of the first element you select is modified.
174
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Curves
Surfaces
Second
The entire second curve moves so its start point coincides with the end of the first curve.
The entire second surface moves so its start boundary coincides with the end boundary of the first surface. Some adjustments are made to the second surface start boundary CVs.
The entire first and second curves move so that the end points coincide with each other. The CVs at the end points are moved halfway along the line of minimum distance.
The entire first and second surfaces move so that the end boundary of the first surface and the start boundary of the second surface coincide. The adjacent boundary CVs move halfway along the line of minimum distance.
Only the shape of the second element you select is modified.
Both
The shapes of both the first and second elements you select are modified.
Changing the Modify Boundary options
Modify Boundary
Curves
Surfaces
First
The CV at the endpoint of the first curve moves to coincide with the CV at the start point of the second curve.
All the end boundary CVs of the first surface move to coincide with the adjacent start boundary CVs of the second surface.
Only the shape of the first element you select is modified.
Using Maya: Modeling
175
NURBS Modeling
Modify Position
Editing Curves Aligning curves and surfaces
Modify Boundary
Curves
Surfaces
Second
The CV at the start point of the second curve moves to coincide with the CV at the end point of the first curve.
All the start boundary CVs of the second surface move to coincide with the adjacent end boundary CVs of the first surface.
The CVs at the end point of the first curve and the start point of the second curve move to coincide with each other. The CVs at the end points are moved halfway along the line of minimum distance.
All the end boundary CVs of the first surface and the start boundary CVs of the second surface move to coincide with each other. The adjacent CVs move halfway along the line of minimum distance.
Only the shape of the second element you select is modified.
Both
The shapes of both the first and second elements you select are modified.
Changing the Modify Tangent options
Modify Tangent
Curves
Surfaces
First
The tangent at the end of the first curve adjusts to coincide with the tangent at the start of the second curve.
The tangents at the end boundary of the first surface adjust to coincide with the tangents at the start boundary of the second surface.
The tangent at the start of the second curve adjusts to coincide with the tangent at the end of the first curve.
The tangents at the start boundary of the second surface are adjust to coincide with the tangents at the end boundary of the first surface.
Only the shape of the first element you select is modified.
Second
Only the shape of the second element you select is modified.
176
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Note
Scaling the tangent and curvature alignment The values in the Tangent Scale and Curvature Scale boxes increase or decrease the tangent magnitude or curvature at the end of the curve or surface. You can enter a value in the box or drag the slider bar. The following table shows what happens when the tangent and curvature is scaled.
Tangent Scale
Curves
Surfaces
First
The tangent magnitude at the end of the first curve adjusts.
The tangent magnitude at the end boundary of the first surface adjusts.
Only the shape of the second element you select is scaled.
The tangent magnitude at the start of the second curve adjusts.
The tangent magnitude at the start boundary of the second surface adjusts.
Curvature Scale
Curves
Surfaces
First
The curvature at the end of the first curve adjusts.
The curvature at the end boundary of the first surface adjusts.
The curvature at the start of the second curve adjusts.
The curvature at the start boundary of the second surface adjusts.
Only the shape of the first element you select is scaled. Second
Only the shape of the first element you select is scaled. Second
Only the shape of the second element you select is scaled.
Using Maya: Modeling
177
NURBS Modeling
Curvature continuity is applied to the curve or surface that is modified for tangent continuity (see the table above).
Editing Curves Aligning curves and surfaces
Keeping original geometry If Keep Original is toggled off, the original curves or surfaces are replaced with the aligned curves or surfaces. If toggled on, two new curves or surfaces are created and the originals are retained.
Editing the alignment using manipulators and the Channel Box To display manipulators on your curves or surfaces so you can edit the alignment interactively, turn construction history on before performing an alignment, then select the Show Manipulator Tool.
Tangent scale manipulators
Use to adjust Join parameter
If Continuity is set to Curvature and the scale value is more than 0, more manipulators are added. The example on the left shows the manipulators for the default, Curvature Scale First and Second set to 0.0. The example on the right shows the manipulators if the scale values are changed to 2.0
Curvature scale = 0 (default)
Curvature Scale = 2
You can edit the options in the Channel Box for selected items. For example, if you edit the tangent scale parameters in the Channel Box for a curve, notice how the manipulators are adjusted.
178
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
NURBS Modeling
Some of these parameters are also included in the Attribute Editor. See “Editing the alignment in the Attribute Editor” on page 180 for details.
Using Maya: Modeling
179
Editing Curves Aligning curves and surfaces Enter parameter values, or choose items from the Continuity Type pop-up menus using the left mouse button. Type on or off to toggle the Reverse and Swap parameters as well as Tangent and Curvature Continuity. The Direction U parameter determines in which direction the alignment occurs. If off, the alignment occurs in the V direction. See the section describing the Reverse, Swap, and Twist toggles in “Editing aligned surfaces in the Attribute Editor” on page 183.
Editing the alignment in the Attribute Editor The Attribute Editor for Align Curves and Align Surfaces reflect the options you see in the Channel Box and the options window for an aligned curve or an aligned surface. If you aligned curves, the sections of the editor for the Input Curves are accessible. If you aligned surfaces, the sections of the editor for the Input Surfaces are accessible. To open the Attribute Editor, either:
180
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Editing aligned curves in the Attribute Editor NURBS Modeling
The Align History section of the editor for a curve alignment includes options you set in the options window or the Channel Box. Input Curve
The Input Curve information is read-only. It gives you access to the history of the curves you aligned. Click the arrow buttons to select an input curve and open its section of the editor.
Using Maya: Modeling
181
Editing Curves Aligning curves and surfaces Positional/ Tangent Continuity
For details on Positional and Tangent Continuity types, see “Determining the continuity between intersections” on page 173.
Join Parameter
The Join Parameter slider becomes available depending on the Positional Continuity Type you select. Use Join Parameter to define the parameter on the first/second item at which the alignment is performed. For example, if Move First is selected for curves, the join parameter defines the point on the second curve where the first one is aligned.
Reverse
For curves, the Reverse toggles specify whether the curves must be reversed before performing the alignment. Remember, Align uses the end point of the first curve and the start point of the second curve.
Interior Blending
The Interior Blending sections are the same as the Tangent Scale options in the options window. The sliders become available depending on which type of continuity you select.
182
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Editing aligned surfaces in the Attribute Editor NURBS Modeling
The Align History section of the editor for a surface alignment includes options you set in the options window or the Channel Box. Input Surface
The Input Surface information is read-only. It gives you access to the history of the surfaces you aligned. Click the arrow buttons to select an input surface and open its section of the editor. Using Maya: Modeling
183
Editing Curves Aligning curves and surfaces Positional/ Tangent Continuity
For details on Positional and Tangent Continuity types, see “Determining the continuity between intersections” on page 173.
Join Parameter
The Join Parameter slider becomes available depending on the Positional Continuity Type you select. Use Join Parameter to define the parameter on the first/second item at which the alignment is performed.
Reverse/Swap
The Reverse and Swap toggles for surfaces define whether the surfaces have to be reversed and or swapped before performing the alignment (remember, align uses the end of the first surface and the start of the second). The reverse is done in the direction defined by Direction U (on or off) in the Channel Box.
Twist
If Twist is toggled on, the second surface is also reversed in the opposite direction of Direction U. Turn this on if your aligned surface is twisted. For example, if you align the surfaces and the surface boundaries are going in different directions, the following results.
Surface boundaries are not going in the same direction.
When you marquee-select the surfaces, the align result is twisted. Turn Twist on either from the Attribute Editor or in the Channel Box to correct the problem.
184
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
NURBS Modeling
Twist off
Twist on
The other alternative is to check the surface U/V direction before you align the surfaces. Use Edit Surfaces → Reverse Surfaces to reverse the surface directions if necessary. See “Reversing the curve or surface direction” on page 195 for details. Reverse the surface boundary on one of the surfaces.
Align result
Interior Blending
The Interior Blending sections are the same as the Tangent Scale options in the options window. The sliders become available depending on which type of continuity you select.
Using Maya: Modeling
185
Editing Curves Projecting curve tangents
Projecting curve tangents Use Curves → Project Tangent to modify a curve’s tangent at an endpoint so that it coincides with the tangent of a surface or two other intersecting curves. You can also use this method to adjust a curve’s curvature to match a surface curvature, or the curvature where two other curves intersect. For instance, if a curve’s end point is on a surface, use this function to make the curve tangent continuous with either the U or V direction of the surface where the curve touches the surface. Although you can use Align Curves (Curves → Align Curves) to establish tangent plane continuity between construction curves prior to constructing a surface, it can only align curves to curves or surfaces to surfaces. Project Tangent can be used to easily re-establish tangent continuity of a curve with two other curves or with a surface before constructing the next surface.
To project a curve tangent onto a surface:
186
1
Select the surface you want to use for the project tangent, then select the curve that you want to modify.
2
Select Curves → Project Tangent.
Using Maya: Modeling
Editing Curves Projecting curve tangents
In some cases, you cannot project one curve tangent onto two surfaces at different ends of the curve. You must be careful that there are enough interior CVs to avoid any overlap. For instance, if the curve is cubic and you want to project both ends of the curve with curvature continuity, you should make sure that the curve has at least three spans (that is, a total of six CVs).
To project a curve tangent onto curves: 1
When projecting curve tangents, make sure the endpoint of the curve you want to project is located at the intersection of the other curves.
Intersection point
2
Select the curve for which you want to project a tangent first then Shift-select the other curves.
3
The tangent is projected depending on which curve you select last (highlighted in green).
Using Maya: Modeling
187
NURBS Modeling
Note
Editing Curves Projecting curve tangents
Setting Project Tangent options Select Curves → Project Tangent - ❐ to open the options window.
Defining the construction type Construction
The following Construction options lets you determine what construction method is used to project the curve. The default project tangent Construction type is Tangent. The curve is modified by projecting its tangent vector where it intersects the surface onto the tangent plane of the surface. This means that only necessary modifications are made to the start or end of the curve where it intersects the surface. If you select Curvature, the curve is made tangent and curvature continuous with the surface in the direction of the tangent vector. An extra manipulator is displayed on the curve to let you adjust the Curvature Scale value. (The Curvature Scale slider is also displayed in the options window when this option is selected).
188
Using Maya: Modeling
Editing Curves Projecting curve tangents
NURBS Modeling
Setting the tangent align direction Tangent Align Direction
The Tangent Align Direction options provide a convenient way to either: •
reverse the direction of the curve’s tangent vector,
•
automatically align the tangent vector with either the U or V parameter directions of the intersecting surface or two curves. Select either U or V to pick which tangent you want to use for the adjustment. U is the U direction of the surface, or the second selected curve. V is the V direction of the surface, or the third selected curve. Normal is the normal vector of the tangent plane. Select the Normal option to make a curve normal to or perpendicular to a surface or two curves. When selected, the curve is no longer tangent continuous to the surface since it is perpendicular to the surface.
Notes When you select Normal, it becomes the mode you are working in for the current curve modification. To return to the general project tangent operation, select either the U or V tangent align direction. Tangent rotation is not available when the Tangent Align Direction is Normal.
Using Maya: Modeling
189
Editing Curves Projecting curve tangents
Scaling the tangent Tangent Scale
The Tangent Scale slider displays the current tangent scale factor. Scaling the tangent adjusts the length of the tangent vector without changing its direction. You can adjust the tangent scale by clicking and moving the slider, or by entering a value. A negative scale factor reverses the direction of the tangent vector.
Rotating the tangent Tangent Rotation
The Tangent Rotation slider displays the current tangent rotation angle. Adjusting the rotation rotates the tangent vector on the tangent plane defined by the surface intersection. You can adjust the tangent rotation angle by clicking and moving the slider, or by entering a value.
Note If you change the Tangent Rotation value, the curve is no longer tangent to the surface or two other curves.
Adjusting the curvature scale Curvature Scale
Project tangent works by first selecting a curve to modify and then selecting a surface or two other curves that intersect with either of its end points. The curve is modified by projecting its tangent vector where it intersects the surface onto the tangent plane of the surface. If Curvature is selected as the construction type, the curve is made tangent and curvature continuous with the surface or curves in the direction in which the tangent vector is going. Adjusting the Curvature Scale value modifies the curve in such a way that the tangent or curvature doesn’t change at the curve or surface intersection point. For example, if you modify a curve at its end point, the curvature slider moves the third CV from the end of the curve along a line that joins the end two CVs of the curve (for instance, along the tangent vector line). Such a modification doesn’t change the curvature at the end of the curve, it just adjusts the tangent vector.
Reversing the tangent vector direction Reverse Direction
190
Toggle Reverse Direction on or off to change the direction of the tangent vector so that it points in the opposite direction. Reverse Direction simply multiplies the current tangent scale factor by -1.0.
Using Maya: Modeling
Editing Curves Projecting curve tangents
Keeping original geometry
Adjusting the tangent interactively When you select the Show Manipulator Tool after you project a tangent onto a surface, manipulators display as well as editable parameter boxes in the Channel Box. You can click-drag these manipulators to interactively adjust the curvature scale, tangent scale, or tangent rotation of the curve. You can also enter values in the Channel Box, or in the Numerical Input line when a manipulator is active.
Curvature manipulators The manipulators correspond to the Construction method you used in the options window. For example, if the project tangent Construction method is Curvature, an extra manipulator appears.
Curvature Scale Point manipulator
If the Curvature Scale value does not equal 0, the Curvature Scale Point manipulator appears at the specified scale location. In the following, the scale value is 4.0.
Using Maya: Modeling
191
NURBS Modeling
Toggle Keep Original on to keep the original curve after the projection is performed.
Editing Curves Projecting curve tangents
Tangent manipulators The following examples show the manipulators for a Tangent Construction method. Click-drag the Rotation manipulator to rotate the tangent vector.
Rotation manipulator
Click-drag the Tangent Scale Point manipulator to adjust the tangent scale.
Tangent Scale Point manipulator
The same manipulators appear for curves.
Curvature Scale Point manipulator
Rotation manipulator
192
Using Maya: Modeling
Editing Curves Projecting curve tangents
NURBS Modeling
Tangent Scale Point manipulator
Editing the projected tangent in the Attribute Editor To edit a projected tangent, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
193
Editing Curves Projecting curve tangents
The Attribute Editor for a projected tangent contains the same attributes you set in the options window and the Channel Box. See the option descriptions for details.
194
Using Maya: Modeling
Editing Curves Reversing the curve or surface direction
Reversing the curve or surface direction
Tip Since motion path curves follow the direction of the curve, you can use Reverse to change the path direction.
To reverse the direction of CVs on a curve: 1
Make sure the curve is active.
2
To display the curve CVs, select Display → NURBS Components → CVs.
3
Select Curves → Reverse Curve. The CVs are reversed along the U parametric direction by default.
Start CV
After Reverse
To reverse the surface normal direction: See “What you need to know about surfaces” on page 243 for more information about the surface direction and surface normals. 1
Make sure the surface is active.
2
To display the surface CVs, select Display → NURBS Components → CVs.
3
Select Edit Surfaces → Reverse Surface. The surface normals are reversed along the U parametric direction by default. See “Changing the direction of surface CVs” on page 197 for more information on how to reverse the surface CV direction.
Using Maya: Modeling
195
NURBS Modeling
Use Curves → Reverse Curves to reverse the sequence (direction) of CVs on a curve. Use Edit Surfaces → Reverse Surfaces to reverse and examine the surface normals for surfaces and trimmed surfaces.
Editing Curves Reversing the curve or surface direction
Setting Reverse Curves options Select Curves → Reverse Curve - ❐ to open the options window.
Keeping original geometry Toggle Keep Original on to determine whether the original curves are retained after a Reverse operation is performed.
To switch start and end CVs using the Show Manipulator Tool:
196
1
Check to make sure Construction History is on in the Status Line or manipulators do not display during the Reverse operation.
2
Select the Show Manipulator Tool, toggle Keep Original on, and then reverse the curve CVs to display a reverse curve manipulator. Click this manipulator to interactively reverse the curve’s start and end CVs.
Using Maya: Modeling
Editing Curves Reversing the curve or surface direction
Setting Reverse Surfaces options
Changing the direction of surface CVs The following is a close-up view of the U and V indicators on a surface.
U and V indicators.
When you reverse the Surface Direction, notice how the indicators change depending on what you choose. Surface Direction
Select U to reverse the CVs along the U parametric direction. U is the default surface direction. Select V to reverse the CVs along the V parametric direction. Select Swap to exchange U and V parameterization. Selecting an item a second time using the same direction restores the original CV sequence. Reversing the sequence of CVs for a surface reverses the surface normals. Select Both to reverse the CVs and normals along both U and V parametric directions.
Using Maya: Modeling
197
NURBS Modeling
Select Edit Surfaces → Reverse Surfaces - ❐ to open the options window.
Editing Curves Reversing the curve or surface direction
To quickly reverse a surface: To quickly reverse a surface in a specific direction, select an isoparm and then select Edit Surfaces → Reverse Surfaces without opening the options window.
Reversed direction
Reversed direction
Reversed direction
Editing the reversed item in the Attribute Editor The Attribute Editor for a reversed curve or surface contains the same curve and surface history attributes for a curve or an object. See “Editing curves in the Attribute Editor” on page 79 and “Editing objects in the Attribute Editor” on page 227 for details.
198
Using Maya: Modeling
Editing Curves Rebuilding curves
Rebuilding curves To rebuild a curve: 1
Click on the curve or marquee-select the curves that you want to rebuild.
2
Select Curves → Rebuild Curve. The curve is rebuilt based on the current option settings. In the following example, the curve is rebuilt with the default settings.
Original curve with CVs
Rebuilt curve
3
Toggle Keep Original on in the options window (it is off by default) and select Display → NURBS Components. Now you can see the CVs or edit points on the curve when you rebuild the curve. This lets you easily verify how the rebuild affects the curve.
4
A new curve is rebuilt on top of the original and becomes the active curve. You can move the new curve and select the original curve to try different option settings. This way you can compare the results and delete the curves you don’t want.
Using Maya: Modeling
199
NURBS Modeling
Use Curves → Rebuild Curve to rebuild a NURBS curve or curve-on-surface to reduce data and construct smoother curves.
Editing Curves Rebuilding curves 5
You can also select the original curve from the Channel Box by clicking the heading to display and edit its parameters if necessary.
Setting Rebuild Curve options Select Curves → Rebuild Curve - ❐ to open the options window.
The Rebuild Curve options window changes to include the options associated with a selected option setting, or to hide the options you don’t need.
200
Using Maya: Modeling
Editing Curves Rebuilding curves
Changing the curve rebuild type
Rebuilding the curve uniformly Uniform
Select Uniform (the default) to rebuild a curve with uniform parameterization. You can change the number of spans and degree of the curve you want to rebuild. The Number of Spans and Degree values become available. You can enter a value in the boxes or use the slider bar. When you press the Rebuild button after you change the values, the curve is rebuilt as a uniform knot curve of the specified degree and number of spans.
Reducing the number of spans on the curve Reduce
If Reduce is selected, a knot is removed only if its removal does not cause any of the remaining CVs to move by a distance greater than the tolerance setting. A higher tolerance setting results in a greater span reduction. See “Setting the curve’s tolerance,” next.
Setting the curve’s tolerance Use Tolerance
If the Rebuild Type is Reduce or Curvature, the Use Tolerance options are displayed in the options window.
These options let you rebuild the curve within a specified tolerance of the original curve. You can select to apply global tolerance or set the specific tolerance for this function.
Using Maya: Modeling
201
NURBS Modeling
There are various options you can set to rebuild your curves to suit your needs. The options window changes depending on the type of rebuild you select.
Editing Curves Rebuilding curves If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling is used.
Select Local tolerance to display the following box. You can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful when you often want to change these values often, but don’t want to change the Global tolerance.
Matching the rebuilt curve’s geometry to another curve Match Knots
More than one curve is required if you want to use Match Knots. Select Match Knots to rebuild a curve to match the knot values, degree, and number of spans of another curve. The rebuilt curve is matched to the settings of last curve you select (the green curve). The Keep toggles are available when you select this Rebuild Type and the Match Curve input curve information is available in the Attribute Editor. See “Editing the rebuilt curve in the Attribute Editor” on page 206 for details.
Removing multiple knots No Multiple Knots
202
Select No Multiple Knots to remove all of the multiple knots. The resulting curve is the same degree as the original curve. The Keep toggles are not available when you select this option.
Using Maya: Modeling
Editing Curves Rebuilding curves
NURBS Modeling
Tip While rebuilding curves to remove any multiple interior knots, quite often the shape of the curve is lost. If you want to preserve the shape of the curve, enter the following command in the Command Line: setAttr rebuildNodeName.fr false
Rebuilding the curve with more edit points Curvature
Select Curvature to insert more edit points in the areas of higher curvature. The resulting curve is the same degree as the original curve.
The Keep toggles are not available when you select this option, however the Use Tolerance options are displayed. See “Setting the curve’s tolerance” on page 201 for details.
Setting the parameter range Parameter Range
The three Parameter Range options are used to specify how parameters are affected during the rebuild. If 0 to 1 is selected (the default setting), the resulting curve’s parameter ranges from 0 to 1.0. Keep means the rebuilt curve’s parameter range matches that of the original curve.
Using Maya: Modeling
203
Editing Curves Rebuilding curves If 0 to # spans is selected, the resulting curve’s 0 to # spans gives you integer knot values which makes it easier for numerical input. If using the Uniform Rebuild Type, this option always gives you integer knot values. For example, if you want to use Detach Surfaces on an isoparm and you prefer to type a value, it is easier to enter the number 2 than something like 0.362.
Selecting elements of the original curve to keep Keep toggles
The Keep toggles, Ends, Tangents, and CVs, are used to specify whether or not you want to keep the end points, tangents, or CVs of the original curve. The Ends toggle is on by default.
Changing the number of spans on the curve The number of spans in the resulting curve is set by the value you enter in the Number of Spans box.
Number of Spans = 4 (default)
Number of Spans = 2
Number of Spans = 10
Changing the curve degree The Degree of the resulting curve is determined by the U or V degree you select. See the description “What is the curve degree?” on page 55 for information on curve degrees.
204
Using Maya: Modeling
Editing Curves Rebuilding curves
NURBS Modeling
Cubic, degree 3 (default)
Linear, degree 1
Keeping original geometry If Keep Original is toggled on, a new curve is rebuilt on top of the original and becomes the active curve. You can move it and select the original curve to try different option settings. This lets you compare the results and delete the curve you don’t want.
Note If the rebuild is not successful, the temporary curve is not created and the original curve remains active.
Editing the rebuilt curve from the Channel Box When you rebuild a curve, its parameters are displayed in the Channel Box when you click the rebuildCurve heading. These options are also available in the options window and the Attribute Editor. You can enter values in the value boxes, type on or off in the toggle boxes, or select items (Rebuild Type or Degree) from a pop-up menu.
Using Maya: Modeling
205
Editing Curves Rebuilding curves
Editing the rebuilt curve in the Attribute Editor To edit the rebuilt curve’s attributes, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The options you set in the options window or the Channel Box are displayed. See the option descriptions for details. Input Curve
The Input Curve information is read-only. It gives you access to the history of the original curves you rebuilt. Click the arrow button to select the curve and open its section of the editor.
Match Curve
The Match Curve read-only information is made available only if there is more than one curve and Match Knots is selected in the options window.
206
Using Maya: Modeling
This chapter introduces you to NURBS primitive objects. There are several ways you can use NURBS primitives to build objects quickly and easily. Use primitives as a starting point, then use a combination of object and surface editing operations to complete a task. Throughout this book you’ll find examples where primitives are used as the base element of a particular task in combination with many of the Maya editing and creation operations. This chapter includes the following topics: •
“Using NURBS primitives” on page 207
•
“Setting primitive options” on page 213
•
“Editing objects in the Attribute Editor” on page 227
•
“Using a construction plane” on page 232
•
“Creating and editing text” on page 235
Using NURBS primitives The most basic object type is the primitive. Primitives are pure shapes that can be used as the basis of creating more complex models. You can create five NURBS surfaces—Sphere, Cone, Cylinder, Cube, and Plane. You can also create a Circle NURBS primitive that is a curve.
Using Maya: Modeling
207
NURBS Modeling
5
Creating and Editing Objects
Creating and Editing Objects Using NURBS primitives
Creating objects with NURBS primitives You can instantly make simple NURBS objects like spheres, cubes, cylinders, cones, planes, and circles. When you select the NURBS primitive from the menu, it displays in all views at the origin of the grid (or ground plane). By combining, transforming, trimming and cutting, or using surface functions, such as filleting, on these simple shapes, you can construct more complex objects.
Modifying primitives to build objects There’s a fast and easy way to do almost anything in Maya, but using simple primitive shapes and the transformation tools Maya provides is the easiest way to build something that is simple, but essential to a scene. For example, you can use a NURBS primitive cube to build a staircase. You simply scale it, duplicate it, and move each step into place.
Or you can select surface curves (isoparms) on two spheres, create a fillet blend between them, and scale the spheres to create a bottle using a freeform surface fillet (Surfaces → Freeform Fillet).
208
Using Maya: Modeling
Creating and Editing Objects Using NURBS primitives
First, select the CV or CVs you want to transform. Place the pointer over the active object, then with the right mouse button select Control Vertex from the marking menu.
In this example, one CV of a NURBS primitive sphere is selected and moved using the Move Tool.
You can also transform either one or multiple CVs from the Channel Box. Select the CV or CVs, then enter values in the X, Y and Z boxes provided. The following shows the editable CV boxes in the Channel Box for a single CV. The X value is changed and the CV is moved accordingly.
Using Maya: Modeling
209
NURBS Modeling
To create a simple animation, you can also select surface CVs, transform them, and set key frames to the transformations.
Creating and Editing Objects Using NURBS primitives
In the next example, multiple CVs are moved from the Channel Box.
You can then animate the CVs by setting keyframes.
210
Using Maya: Modeling
Creating and Editing Objects Using NURBS primitives
NURBS Modeling
Important Note You cannot animate CVs on an object that was created with history and then delete the object’s history. The CV animation will not be correct and unexpected results will occur.
Using the Show Manipulator Tool with primitives When you create a Sphere, Cone, or Cylinder NURBS primitive, you can display manipulators with which you can edit specific parameters of the primitive. To display these manipulators, make sure the primitive is created with history. Select the Show Manipulator Tool while it is active (or before you create it), then click the primitive’s heading in the Channel Box. You can also select the primitive’s heading from the History menu in the Status Line or from the Inputs menu in the marking menu.
Editing primitives using revolve manipulators The NURBS Sphere, Cylinder, and Cone primitives are like revolved surfaces, therefore the manipulators that display are revolve manipulators.
Circle Sweep manipulator The circle at the bottom of the revolve manipulator is called the Circle Sweep manipulator. Click-drag the manipulator handle to sweep the sphere, or enter values in the Numerical Input line or the Channel Box. You can also enter a new Sweep value in the options window before you create the sphere, or from the Attribute Editor after you create the sphere.
Using Maya: Modeling
211
Creating and Editing Objects Using NURBS primitives
AxisStartPoint and AxisEndPoint manipulators The arrow manipulator handles represent the origin and direction of the axis: AxisStartPoint and AxisEndPoint. Click-drag these handles to reposition the axes. You can also enter values in the Numerical Input line while a manipulator is active or in the Location Attributes section of the sphere’s Attribute Editor.
axisMidPoint manipulator The axisMidPoint handle represents the pivot point position. Click-drag the middle handle, or enter values in the Numerical Input line or in the Attribute Editor.
212
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
Setting primitive options
To set primitive options: 1
Select the type of primitive you want to create and click the box (❐) from the menu to open the options window (Primitives → Create NURBS → Sphere - ❐).
2
To change the option settings, immediately after the primitive is created, select Edit → Undo. Change the options, then press the Create button to create a new primitive.
Using Maya: Modeling
213
NURBS Modeling
Since most of the options for primitives are similar, the option descriptions for the Sphere NURBS primitive are described in detail. A table is included after the options window illustration for subsequent NURBS primitives. If there are options which are not common to all primitives, they are also described in detail.
Creating and Editing Objects Setting primitive options
Setting the default pivot point By default, the Pivot is set to Object, and the resulting primitive is created at the origin. The primitive appears centered about the specified pivot; the rotate and scale pivots of the primitive are at the origin.
Pivot
For example, Sphere, Cone, and Cylinder primitives are revolved from simple hidden curves and this option defines the start point of the axis of revolution. If you set Pivot to User Defined, you can enter values in the Pivot Point X, Y, and Z boxes to reposition the primitive. The resulting primitive is centered about this point.
Changing the direction of the X, Y, and Z axes Axis
Select either X, Y, or Z (Y is the default) to change the axis direction of the object.
Axis Definition
If you select the Free button, the X, Y and Z Axis Definition boxes are enabled. Enter new values to change the axis direction in X, Y and Z.
Changing the sweep angle Start and End Sweep Angles
Enter the degree of rotation about the vertical world axis. Degree values can range from 0.00 to 360.00 degrees. The default is 360.00 degrees, which creates a full 360 degree of revolution. The following example shows the top view of a sphere after changing the End Sweep Angle to 180 degrees (a hemisphere). Default = 360
End Sweep Angle = 180
See also “Editing primitives using revolve manipulators” on page 211 for information about the Circle Sweep manipulator.
214
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
Changing the radius value Enter a value in the Radius box or use the slider to change the radius.
Changing the surface degree Surface Degree
Select a Surface Degree option to automatically create the NURBS sphere as a Linear (degree 1) or a Cubic (degree 3) B-spline. The default is Cubic. Cubic
Linear
Controlling the accuracy of the sphere using tolerance The more sections and spans, the better the match. When you create a NURBS Sphere primitive, the sphere is always an approximation to a true sphere. In some cases you may want to build a surface that matches a true sphere to a certain tolerance. When you specify the tolerance, Number of Spans is automatically computed to be enough to be able to match a true sphere to the given tolerance. Use Tolerance
If Use Tolerance is toggled on, you can see the effects when you change the values in the Tolerance slider from the Attribute Editor. Set this tolerance value in the options window before you create the sphere only if you know the values you need. If set to None, no tolerance calculations are performed and the sphere is created with the given number of sections and spans. This is the default. If set to Local, the following is displayed:
Using Maya: Modeling
215
NURBS Modeling
Radius
Creating and Editing Objects Setting primitive options You can enter a new value to override the Positional tolerance value you set in Options → General Preferences → Modeling. Local tolerance is useful on a per-task basis where you want to change these values, but don’t want to change the Global tolerance values. If set to Global tolerance, the Positional tolerance value you set in Options → General Preferences → Modeling is used.
Subdividing the sphere Number of Sections
The Number of Sections value specifies the number of subdivisions that are created on the sphere. The default value is 8. The following shows a sphere with 16 sections. A value less than 4 gives a poor approximation to a sphere.
Sections = 8 (default)
Sections = 16
You can also change the number of sections in the Channel Box or the Attribute Editor. In the Channel Box, click the makeNurbSphere heading and enter a new value in the Sections box.
216
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
NURBS Modeling
In the Attribute Editor, click the makeNurbSphere tab to open the Sphere History section of the editor, then enter a new value in the Sections box.
Changing the number of spans Number of Spans
Enter a value in the Number of Spans box to increase the number of spans that define a primitive. A value less than 4 gives a poor approximation to a sphere.
Number of Spans = 4 (default)
Number of Spans = 16
You can also change the number of spans in the Channel Box or the Attribute Editor. In the Channel Box, click the makeNurbSphere heading and enter a new value in the Spans box. In the Attribute Editor, click the makeNurbSphere tab to open the Sphere History section of the editor, then enter a new value in the Spans box.
Using Maya: Modeling
217
Creating and Editing Objects Setting primitive options
Setting Circle options Select Primitives → Create NURBS → Circle - ❐ to open the options window.
Common option descriptions The following table refers you to the documentation for each option.
218
Option
Heading and page
Pivot
“Setting the default pivot point” on page 214
Normal Axis
“Changing the direction of the X, Y, and Z axes” on page 214
Sweep Angle
“Changing the sweep angle” on page 214
Radius
“Changing the radius value” on page 215
Degree
“Changing the surface degree” on page 215
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
Heading and page
Use Tolerance
“Controlling the accuracy of the sphere using tolerance” on page 215
Number of Sections
“Subdividing the sphere” on page 216
NURBS Modeling
Option
Setting Cylinder options Select Primitives → Create NURBS → Cylinder - ❐ to open the options window.
The NURBS Cylinder primitive is created as an open-ended cylinder.
Changing the height to radius ratio Ratio of Height to Radius
Use the slider or enter a new value in the Ratio of Height to Radius box to change the height to radius ratio of the cylinder. Using Maya: Modeling
219
Creating and Editing Objects Setting primitive options
Common option descriptions For information on the other options, refer to the following table.
220
Option
Heading and page
Pivot
“Setting the default pivot point” on page 214
Axis
“Changing the direction of the X, Y, and Z axes” on page 214
Start/End Sweep Angle
“Changing the sweep angle” on page 214
Radius
“Changing the radius value” on page 215
Surface Degree
“Changing the surface degree” on page 215
Use Tolerance
“Controlling the accuracy of the sphere using tolerance” on page 215
Number of Sections
“Subdividing the sphere” on page 216
Number of Spans
“Changing the number of spans” on page 217
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
Setting Cone options NURBS Modeling
Select Primitives → Create NURBS → Cone - ❐ to open the options window.
The NURBS Cone primitive is created as an open-ended cone.
Using Maya: Modeling
221
Creating and Editing Objects Setting primitive options
Common option descriptions The following table refers you to the documentation for each option.
222
Option
Heading and page
Pivot
“Setting the default pivot point” on page 214
Axis
“Changing the direction of the X, Y, and Z axes” on page 214
Start/End Sweep Angle
“Changing the sweep angle” on page 214
Radius
“Changing the radius value” on page 215
Ratio of Height to Radius
“Changing the height to radius ratio” on page 219
Surface Degree
“Changing the surface degree” on page 215
Use Tolerance
“Controlling the accuracy of the sphere using tolerance” on page 215
Number of Sections
“Subdividing the sphere” on page 216
Number of Spans
“Changing the number of spans” on page 217
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
Setting Cube options NURBS Modeling
Select Primitives → Create NURBS → Cube - ❐ to open the options window.
A NURBS Cube primitive consists of six separate sides. You can click to select a side of the cube in the view, or click on a heading in the Outliner or Hypergraph window (Window → Outliner or Hypergraph).
Using Maya: Modeling
223
Creating and Editing Objects Setting primitive options
To select the cube as a whole object, select the top heading in the Outliner or Hypergraph window, or click the Select by hierarchy and combinations icon from the Status Line.
Changing the cube’s width Enter a value in the Width box to change the default value or use the slider to change the width of the cube.
Width
Changing the length and height ratios Ratio of Length to Width / Height to Width
Enter a value in the Ratio of Length to Width or Height boxes to change the default value, or use the slider to specify the height and length of the cube.
Setting U and V patches U patches/V Patches
224
Change the value in the U Patches or V Patches boxes or use the slider to set the number of (U, V) patches between the edges that make up the cube. This value changes the number of spans on an object. You can also change these values in the Channel Box or the Attribute Editor.
Using Maya: Modeling
Creating and Editing Objects Setting primitive options
Common option descriptions
Option
Heading and page
Pivot
“Setting the default pivot point” on page 214
Axis
“Changing the direction of the X, Y, and Z axes” on page 214
Surface Degree
“Changing the surface degree” on page 215
Setting Plane options Select Primitives → Create NURBS → Plane - ❐ to open the options window.
Using Maya: Modeling
225
NURBS Modeling
For information on the other options, refer to the following table.
Creating and Editing Objects Setting primitive options
Changing the length ratio Ratio of Length to Width
Enter a value in the Ratio of Length to Width box to change the default value, or use the slider to specify the length of the plane. You can also change these values in the Channel Box or the Attribute Editor.
Common option descriptions For information on the other options, refer to the following table.
226
Option
Heading and page
Pivot
“Setting the default pivot point” on page 214
Axis
“Changing the direction of the X, Y, and Z axes” on page 214
Width
“Changing the cube’s width” on page 224
Surface Degree
“Changing the surface degree” on page 215
U/V Patches
“Setting U and V patches” on page 224
Using Maya: Modeling
Creating and Editing Objects Editing objects in the Attribute Editor
Editing objects in the Attribute Editor •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The following is the Attribute Editor for a NURBS primitive Sphere. The Attribute Editor for NURBS primitives include the same options and attributes you find in the options window. Click the makeNurb tab for a selected primitive (for example, makeNurbSphere) to see these attributes. See the options window descriptions for details.
Using Maya: Modeling
227
NURBS Modeling
To edit an object after you create it, use the Attribute Editor. To open the Attribute Editor for an active object, either:
Creating and Editing Objects Editing objects in the Attribute Editor
Sphere History The Sphere History section of the editor gives you access to the options you set in the options window. You can change these options to adjust the final result after the primitive is created.
Location Attributes The Location Attributes are used to change the X, Y, and Z position of the pivot and the direction of the axes.
Accessing the surface history sections of the editor Click the second arrow beside the heading to access the primitive’s transform and shape tabs. Click a tab to open that section of the editor and access the information you need.
Click this arrow to access the transform and shape tabs.
NURBS Surface History The NURBS Surface History section of the editor (the nurbsSphereShape tab) lists the statistical information for the active primitive. This information is read-only; it simply provides you with the primitive’s geometric data.
228
Using Maya: Modeling
Creating and Editing Objects Editing objects in the Attribute Editor
NURBS Modeling
Click the triangle beside a heading to open that section of the editor.
Model Stats The following shows the Model Stats section for a NURBS primitive sphere. You can change these attributes to alter the sphere’s display.
Using Maya: Modeling
229
Creating and Editing Objects Editing objects in the Attribute Editor If you want to change the parameters of a rendered primitive or adjust the tessellation parameters if you converted it to polygonal output, click the triangles to open those sections of the editor.
Object Display The Object Display section lets you toggle the visibility of the primitive on or off, or turn it into a templated or intermediate object. For example, you can make a primitive invisible to used as a guide for subsequent operations.
Bounding Box The Bounding Box section under Object Display is read-only. It displays the minimum and maximum world space coordinates of a primitive along the X, Y and Z axes.
Transforming an object in the Attribute Editor Click the nurbsSphere tab to open the transformation section of the editor for a NURBS sphere.
230
Using Maya: Modeling
Creating and Editing Objects Editing objects in the Attribute Editor
Transform Attributes
Pivots Use the Pivots section to change the position of the scale or rotate pivots, and toggle the display of scale and rotate pivots on or off.
Limit Information Use the Limit Information section to set limits to the transformations of the primitive. You toggle the Limit X, Y, or Z boxes on or off and then change the values in the transformation boxes. When you transform the primitive, you can now only move, rotate, or scale to the unit value you set in the corresponding boxes.
Tip As an alternative, use Modify → Transformation Tools and select Move Limit Tool, Rotate Limit Tool, or Scale Limit Tool.
Display In the Display section, you can toggle the display of the local axis, display a selection handle, set a default manipulator (if you use the Show Manipulator Tool on an object), or hide the whole object or toggle it into a template.
Using Maya: Modeling
231
NURBS Modeling
The Transform Attributes section lets you enter values to move, rotate, scale, or shear the primitive. You can change the X, Y, Z rotation order or rotate the local axes.
Creating and Editing Objects Using a construction plane
Using a construction plane Use Primitives → Construction Plane to create an infinite plane perpendicular to the Z axis, passing through the origin (the X Y plane, which is the default). This type of plane differs from a NURBS primitive plane because you cannot render or animate it. You use these planes as construction aids. By default, a construction plane is created as a 24 x 24 unit square.
You can use a construction plane as a live construction surface (click the Make Live icon on the Status Line or select Modify → Make Live). A live construction plane replaces the ground plane as the surface on which points are placed when using one of the curve creation tools, or on which objects are moved relative to. By transforming the plane, planar curves can be created in arbitrary planes.
232
Using Maya: Modeling
Creating and Editing Objects Using a construction plane
Setting Construction Plane Options NURBS Modeling
Select Primitives → Construction Plane - ❐ to open the options window.
Before you create a new construction plane, change the options, if necessary, then click the Apply button.
Creating a construction plane at a specified location Pole Axis
The Pole Axis determines the orientation of the construction plane. The default is an YX plane.
YX
YZ
XZ
Determining the size of the construction plane Size
Enter a value in the Size box or use a slider to specify a size for the new construction plane.
Using Maya: Modeling
233
Creating and Editing Objects Using a construction plane
Transforming the construction plane You can use the transformation tools to move, scale, and rotate the construction plane. Since you cannot, however, select a live object, either: •
transform the plane before you make it live,
•
toggle the live plane off, select it and transform it, then make it live again
Editing the construction plane in the Attribute Editor The Attribute Editor for a construction plane contains generic attributes you use to transform and alter the display of the plane. See “Editing objects in the Attribute Editor” on page 227 for details.
234
Using Maya: Modeling
Creating and Editing Objects Creating and editing text
Creating and editing text NURBS Modeling
Use Primitives → Create Text to create text objects and control their characteristics. A wide selection of fonts are available.
To create text: 1
Select Primitives → Create Text.
2
The word Maya is displayed at the origin (0, 0, 0) by default.
To create your own text curves, open the options window, type the text you want to create, select a specific font, and the type of text you need. See the following for details.
Setting Create Text options Select Primitives → Create Text - ❐ to open the options window.
Using Maya: Modeling
235
Creating and Editing Objects Creating and editing text
Entering new text and changing the font Text Curves options let you alter the text string in a number of ways. After you select your options, click the Create button to see the resulting text.
Tip The options only affect the active text string in the text field. Text that has already been placed is not affected.
To change the text:
236
1
Select Primitives → Create Text - ❐ to open the options window.
2
Type a new word in the Text box.
3
Select the Font and set the Type options, then click the Create button.
Using Maya: Modeling
Creating and Editing Objects Creating and editing text
To change the font and create the new text: Click the arrow beside the Font box to select a different font from the menu.
2
Press the Create button. The new text appears at the origin in the font you selected.The following shows the word Magic in an AvantGarde-Book font.
Transforming text The text that first appears at the origin when you select Create Text is active by default. Text are curves, which means they are separate entities. All the curves for one text string are grouped under one transform.The transform results can vary depending on the way you select the text.
Using Maya: Modeling
237
NURBS Modeling
1
Creating and Editing Objects Creating and editing text To transform the text later (after you deselect the text then perform another operation and reselect it), you will find that the letters are not transformed together.
To transform a text string: If you want to transform a whole string of existing text, the transformation will occur on each letter individually if you marquee-select the text. To transform the whole string, do the following:
238
1
Marquee-select the letters. Notice the headings in the Channel Box. The lead object, (the c in Magic), is the only curve that appears while the other letters are individual curves.
2
Change some of the values in the Channel Box. In this example, the X, Y, and Z Scale values are changed. Notice that all letters are scaled, but the space between the letters is lost.
Using Maya: Modeling
Creating and Editing Objects Creating and editing text
NURBS Modeling
To correct this problem, select Edit → Undo, deselect the text, then change the selection type. Click the Select by hierarchy and combinations icon and reselect the text.
or 3
Open the Outliner window (Window → Outliner) and select the top text object (Text_Magic_1).
Using Maya: Modeling
239
Creating and Editing Objects Creating and editing text 4
The heading in the Channel Box now displays the text string as one object (Text_Magic_1), and all the letters are displayed in the lead object color.
5
You can now transform the whole string as one object.
To transform individual letters:
240
1
If you want to transform just one letter in a text string, open the Outliner window (Window → Outliner).
2
The letters in a text string are grouped under a parent node called Text_Magic_1. Click the triangle beside this heading to display the individual letters and select the one you need. The Channel Box is updated and the letter is highlighted in the view.
Using Maya: Modeling
Creating and Editing Objects Creating and editing text
Changing the text type The three Type buttons, Curves, Trim, and Poly, are used to create text in three different formats. Select one of these before you create the text. The Curves text type is the default. The text is displayed as NURBS curves which you can transform and manipulate. The Trim text type is created as planar trim surfaces. This means that these letters will render because they are surfaces. The Poly text type is created as polygons which you can manipulate as you would any other polygonal entity. When this text type is selected, a planar trim curve is created between the curve and tessellate nodes, but you only see the polygonal surface, not the planar surface. Notice the difference between a Trim text string and a Poly text string in the Hypergraph (Window → Hypergraph).
Planar trim surfaces
Polygonal surfaces
Using Maya: Modeling
241
NURBS Modeling
Type
Creating and Editing Objects Creating and editing text
Editing the text in the Attribute Editor The Attribute Editor for text curves contains the same transform attributes as you would find for curves. See “Transforming curves in the Attribute Editor” on page 80 for details.
242
Using Maya: Modeling
This chapter introduces you to using Maya surface functions. In this chapter you will learn some basic surface construction rules and how easy it is to convert NURBS surfaces to polygonal surfaces. This chapter includes the following topics: •
“What is world coordinate space?” on page 243
•
“What is an isoparm?” on page 245
•
“What is the U / V surface direction?” on page 246
•
“What is a surface normal?” on page 248
•
“What is construction history?” on page 250
•
“Converting NURBS to polygons” on page 252
What you need to know about surfaces With Maya surface creation and editing tools and actions, you can edit existing surfaces using a variety of methods. You can also use curves as construction guides to create more organic surfaces. The following explains some of the concepts you need to know about surfaces.
What is world coordinate space? You build objects in a 3D coordinate system that lets you define objects using dimensionally accurate values. In Maya, the origin is the center. The origin’s coordinates are 0, 0, 0. All points are defined by one coordinate in the X direction, one in the Y direction, and one in the Z direction. A Y-up world is defined by the viewing plane which displays X as horizontal, Y as the up direction, and Z as the depth of the scene. This is the default XYZ orientation.
Using Maya: Modeling
243
NURBS Modeling
6
Introduction to Surfaces
Introduction to Surfaces What you need to know about surfaces
A Z-up world starts with a ground plane that represents the X and Y directions, and Z represents the up direction. To illustrate, put your middle finger on your nose (Y), point your thumb out (X) and point your index finger up (Z).
Z
Y X
To change the Y-up or Z-up orientation, select Options → General Preferences and select an Up Axis button from the World Coordinate System section of the window.
244
Using Maya: Modeling
Introduction to Surfaces What you need to know about surfaces
What is an isoparm? NURBS Modeling
A parametric surface is crossed with flow lines, or isoparms. Isoparms are constant U or V parameter curves on a surface. isoparms patch
U
V
The flow lines on a surface are drawn at parameter values that correspond to the locations of edit points on the surface’s edge curves. The regions between these isoparms are called patches. The interval between two edit points on a surface edge is called a span.
span
The number of patches on a surface is equal to the number of spans in U multiplied by the number of spans in V. The more spans on a surface, the more CVs.
Tip Keep the number of patches to a minimum. The fewer patches you have, the more control you have.
Using Maya: Modeling
245
Introduction to Surfaces What you need to know about surfaces
What is the U / V surface direction? The U/V coordinate system is similar to the X, Y, and Z coordinate system used to position objects. The difference is that it applies to points that lie directly on the surface. In some ways, the U and V directions are like latitude and longitude. Where curves have a single U parameter, surfaces have an additional V parameter. Just as the value of U varies along the length of a parametric curve, both U and V vary across a parametric surface. Any point on a surface is defined by a U and V value. Understanding U/V parameter space is important when you are drawing curves on surface or when you are positioning textures on a surface. The parameter direction is determined in various ways. For example, for a revolved surface, the U parameter direction of the surface is determined by the construction curve, and the V parameter direction is determined by the direction of the revolve.
Construction curve in U
Revolved surface in V
What are U and V divisions? U and V divisions are visual aids and do not change the geometry of a surface. You change the division values to see a finer wire mesh, but the number of spans stays the same. You can change these values in the Model Stats section of the Attribute Editor.
246
Using Maya: Modeling
Introduction to Surfaces What you need to know about surfaces
NURBS Modeling
Change these values
This example shows what happens when you change the division values for a NURBS primitive sphere. 3 divisions in U
3 divisions in V
3 divisions in U and V
Using Maya: Modeling
247
Introduction to Surfaces What you need to know about surfaces
What is a surface normal? A surface normal is a vector that is perpendicular to the surface at a given point. For example, surface normals are used to calculate the way light reflects from the surface.
What is the surface normal direction? The direction of U and V on the surface determines the direction of the surface normal. To illustrate, point your right thumb in the increasing U direction and your right forefinger in the increasing V direction, then point your middle finger perpendicular to these two to see the surface normal direction.
U
Normal
V
The direction of surface normals can be very important when rendering. For example, if you render a hollow object, you can render either the inside or the outside. If the normals point outward, the outside is rendered. To render only the inside, you can reverse the normals to point inward.
To display surface normals:
248
1
While the object is active, select Display → NURBS Components → Custom- ❐.
2
In the Display Control Options window, toggle Normal (shaded mode) on and click the Apply button.
Using Maya: Modeling
Introduction to Surfaces What you need to know about surfaces
NURBS Modeling
3
Make sure you select a Flat Shade or Smooth Shade mode from the Shading menu in the current view to see the normals.
How to reverse the surface normal direction In some situations, you may need to reverse the direction of the surface normals. Use Edit Surfaces → Reverse Surface to do this.
Using Maya: Modeling
249
Introduction to Surfaces What you need to know about surfaces Open the Reverse Surface options window (Edit Surfaces → Reverse Surface - ❐) and change the options if necessary. •
Reversing the direction of U or V reverses the surface normal direction.
•
Reversing both U and V does not change the surface normal direction.
•
Swapping U and V reverses the surface normal direction. See “Reversing the curve or surface direction” on page 195 for details.
Tip Some situations require U and V to be aligned in specific directions. For example, when applying a parametric texture map, the mapping of the image to a surface depends on the U / V orientation. If a texture map appears inverted on the surface, reversing the U / V direction of the surface is one way to correct the problem. In the following example, a NURBS cone’s surface normals are reversed. Instead of pointing outward, the normals are pointing inward.
What is construction history? If you create surfaces using construction history, the original curves remain linked to the new surface. This means that editing the original construction curves also edits the surface. You can also connect surfaces with multiple levels of history, which means if you edit one construction curve, several surfaces can be affected.
250
Using Maya: Modeling
Introduction to Surfaces What you need to know about surfaces
NURBS Modeling
You can create surfaces without history by selecting the Construction History icon from the Status Line before you create the surface.
You can also delete history once a surface is created. While the surface is active, select Edit → Delete by Type or Delete All by Type → History.
Tip When you attach curves or animate CVs, turn Construction History off or you may get unexpected results. See “Using construction history” on page 2 in Chapter 1, “NURBS Modeling” for more information.
Using Maya: Modeling
251
Introduction to Surfaces Converting NURBS to polygons
Converting NURBS to polygons Use Edit Surfaces → NURBS To Polygons to convert NURBS surfaces to polysets. You can convert any NURBS surfaces created in Maya or imported surfaces, including trimmed surfaces. Use the options window to specify the resulting polygonal output, or you can change the result in the Attribute Editor.
To convert NURBS geometry to polygonal geometry: 1
While a surface is active, select Edit Surfaces → NURBS To Polygons. A polygonal representation of the surface is created on top of the NURBS surface.
2
The NURBS surface is still there. If you want to reconstruct the surface, select Edit → Undo to undo the polygonal surface, edit the NURBS surface, then select Edit Surfaces → NURBS To Polygons again.
Note If you convert the surface while construction history is on, you can edit the surface. The polygonal surface is recreated to match the edited NURBS surface.
252
Using Maya: Modeling
Introduction to Surfaces Converting NURBS to polygons
Setting NURBS To Polygons options NURBS Modeling
Select Edit Surfaces → NURBS To Polygons - ❐ to open the options window.
Outputting to triangles or quads Type
Use a Type option to specify the type of polygons to use when you convert NURBS geometry to polygonal data. If you select Triangle (the default), 3-sided polygons are created. If you select Quads, 4-sided polygons are created.
Triangle polygon type
Quad polygon type
Using Maya: Modeling
253
Introduction to Surfaces Converting NURBS to polygons
Note When you tessellate a trimmed surface, some 3-sided (triangle) polygons may be created along the trim edge even when the option is set to Quads.
Choosing a tessellation method Tessellate means that you create a set of polygons from NURBS geometry. Each tessellation method provides you with options that let you control the resulting polygonal surface. There are three tessellation methods; Standard Fit, General, and Count.
Standard fit Standard Fit is the default tessellation method. It is “adaptive” tessellation, meaning that the following options are used to determine when to stop the tessellation. For example, the tessellation stops at the Fractional Tolerance value you set. If there is an edge shorter than the Minimal Edge Length, the tessellation stops on that edge. If the surface is flat enough within the edge (the specified chord/height ratio is small enough), the tessellation stops there. Chord Height Ratio
The Chord Height Ratio is the ratio between the maximum distance of the curve from the polygon edge used to approximate it and the chord length. The chord length is the linear distance between two polygon vertices. A value greater than 0 results in fewer polygon vertices, if the ratio on the curve is greater than the current value. For example, the default value, 0.1, means that the height must be larger than 1/10 of the chord length before additional edit points are created.
Fractional Tolerance
The Fractional Tolerance value determines the degree of accuracy maintained between the original surface and the interpolated polygonal surfaces. The default is to be accurate to within 0.01 units, where a unit refers to the current unit of linear measure (the default unit of measure is centimeters). Therefore, at no point will the polygonal surface be more than the tolerance distance away from the original NURBS surface.
Minimal Edge Length
Enter a value or use the Minimal Edge Length slider to set the minimum length of the edges of the triangles or quads that are created.
254
Using Maya: Modeling
Introduction to Surfaces Converting NURBS to polygons 3D Delta
3D Delta=0.1
3D Delta=0.01
General Set the Tessellation Method to General to display the following options.
Using Maya: Modeling
255
NURBS Modeling
The 3D Delta value determines the 3D spacing for U and V isoparms on a surface that makes up the initial grid for the tessellation. In the following example, the 3D Delta value is changed from the default 0.1 to 0.01.
Introduction to Surfaces Converting NURBS to polygons
Setting the initial tessellation controls Unless Use Chord Height or Use Chord Height Ratio is toggled on, a uniform tessellation is performed. Each span/surface is split into a number of polygons depending on the Number U and V values you set. U Type/V Type
The U Type and V Type pop-up menu items let you specify whether you want to split the surface based on where the spans are (then split each span), or based on the parameterization of the whole surface.
Number U/ Number V
Each span or surface is split into the number of polygons you specify here.
Specifying the chord height and chord height ratio Chord Height/ Chord Height Ratio
If Use Chord Height or Use Chord Height Ratio is toggled on, you can set a specific value for both the Chord Height and the Chord Height Ratio. A value greater than 0 results in fewer polygon vertices if the ratio on the curve is greater than the current value. For example, the default value, 0.1, means that the height must be larger than 1/10 of the chord length before additional edit points are created. If Edge Swap is toggled on the value you specify determines the optimum chord height method with which to tessellate a quadrilateral into triangles.
Count Set the Tessellation Method to Count to display the following slider.
Count
256
Use the Count slider to determine how many polygons the surface can be tessellated into. See the following examples.
Using Maya: Modeling
Introduction to Surfaces Converting NURBS to polygons
Count = 100
NURBS Modeling
Count = 200
Count = 50
Editing the polygonal result in the Attribute Editor To edit the attributes for NURBS geometry converted to polygonal geometry, select the polygonal surface you want to edit and use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor changes depending on which NURBS surface you converted to polygonal data. Some of the options you set in the options window or the Channel Box are displayed. See the option descriptions for details (“Setting NURBS To Polygons options” on page 253).
Using Maya: Modeling
257
Introduction to Surfaces Converting NURBS to polygons
258
Using Maya: Modeling
NURBS Modeling
7
Creating surfaces In this chapter you will learn how to create surfaces using various Maya construction methods. This chapter includes the following topics: • • • • • • • • • • •
“Filleting surfaces” on page 259 “Blending surfaces” on page 271 “Revolving surfaces” on page 279 “Lofting curves and surfaces” on page 293 “Beveling surfaces” on page 303 “Extruding surfaces” on page 316 “Preparing to stitch surfaces” on page 328 “Creating stitched surfaces” on page 328 “Stitching surface points” on page 339 “Creating boundary surfaces” on page 346 “Creating birail surfaces” on page 356
Filleting surfaces Fillets let you quickly create an object with rounded edges, or blend two surfaces together. Three methods are provided: circular filleting, free-form filleting, and blending fillets.
Creating circular surface fillets Use Surfaces → Circular Fillet to construct a fillet surface between two existing surfaces. The following example uses NURBS primitives to quickly and easily create a smooth rounded edge where the two objects join.
To create a circular surface fillet: 1
Create and scale NURBS plane primitive, then create and scale a NURBS cylinder primitive. Since the cylinder is created at the origin by default, notice how it fits through the plane.
Using Maya: Modeling
259
Creating surfaces Filleting surfaces
2
To create a circular fillet where the cylinder meets the plane, marquee-select the plane and the cylinder, then select Surfaces → Circular Fillet.
Setting Circular Fillet options Select Surfaces → Circular Fillet - ❐ to open the options window.
260
Using Maya: Modeling
Creating surfaces Filleting surfaces
Creating trim curves
When Create Curve On Surface is off curves-on-surface are not constructed on the original surface. The default is off.
To trim the surface using fillet trim curves: 1
Before you create the fillet, toggle Create Curve On Surface on.
2
Select both surfaces and click the Fillet button. When the fillet is created, trim curves (or curves-on-surface) are displayed. Trim curves
3
Deselect both surfaces.
4
Select Edit Surfaces → Trim Tool and click on the part of the surface you want to keep. The fillet is trimmed away from the surface. Deselect the surfaces again and use the Trim Tool to trim away from the other curve-onsurface.
Using Maya: Modeling
261
NURBS Modeling
Toggle Create Curve On Surface on to create curves-on-surface when the fillet is constructed. The curves are automatically placed on the surface at the point where they intersect with the fillet.
Create Curve On Surface
Creating surfaces Filleting surfaces
Reversing the surface normals Reverse Surface Normals
During the fillet construction, the surfaces are offset in the direction of the normals by the Radius value you specify. By reversing the surface normals, you can exactly construct the desired fillet. Click the Show Manipulator icon to see the surface normals. Before you create the fillet, choose to reverse either the primary surface normal (the first selected surface), or the second surface normal (the second selected surface). The following examples show both primary and secondary reverse methods with a radius value of 0.75.
262
Using Maya: Modeling
Creating surfaces Filleting surfaces
Reverse Primary
Reverse Secondary
Reverse Primary, Secondary
NURBS Modeling
circular fillet
To reverse surface normals by selecting surface points: You can also reverse surface normals by selecting points on the surfaces and then constructing the fillet. For example, the normals on the secondary surface are reversed if the point selected on the primary surface does not lie on the same side as its surface normal. 1
Select Surface Point from the marking menu while a surface is active. Click to select a point, then Shift-select another surface point.
Using Maya: Modeling
263
Creating surfaces Filleting surfaces 2
Select either Reverse Primary Surface Normal or Reverse Secondary Surface Normal, then click the Fillet button. Click the Show Manipulator icon to see the surface normals.
Editing the circular fillet normals using manipulators 1
To display the surface normals and radius manipulator, select the Show Manipulator Tool after you create the fillet.
2
Click-drag a radius manipulator handle. You can also click on an active manipulator and enter a value in the Numerical Input line, or enter a value in the Channel Box.
Defining the circular surface fillet’s tolerance Use Tolerance
The Use Tolerance options let you reapply a circular fillet within a specified tolerance value. You can apply tolerance globally or locally. Global tolerance means the Positional and Tangential values you set in Options → Preferences → Modeling are used.
264
Using Maya: Modeling
Creating surfaces Filleting surfaces
NURBS Modeling
If you select Local, you can enter a new value to override the Positional and Tangential tolerance value you set in the General Preferences options window. Local tolerance is useful on a per-task basis where you want to change these values, but don’t want to change the Global tolerance values. This is the default.
Editing circular surface fillets in the Attribute Editor To edit a circular filleted surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
265
Creating surfaces Filleting surfaces
The Attribute Editor for circular filleted surfaces contain the same attributes you find in the Circular Fillet options window. See the option descriptions for details.
Creating free-form surface fillets Use Surfaces → Freeform Fillet to construct a fillet between two curves-onsurface, two surface isoparms, or trimmed edges.
To create a free-form surface fillet between two isoparms: You have to select two isoparms to create the free-form surface fillet between.
266
1
Click the Select by component type icon.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
Using Maya: Modeling
Creating surfaces Filleting surfaces
Place the pointer over the active surface, and use the right mouse button to select Isoparm from the marking menu. 3
Shift-click the two isoparms you want to create a free-form fillet between, then select Surfaces → Freeform Fillet.
To create a simple object, such as a cocktail shaker, select the top of the surface, then scale the top smaller than the bottom. Notice how the fillet adjusts accordingly to the transformation.
Using Maya: Modeling
267
NURBS Modeling
or
Creating surfaces Filleting surfaces
To create a free-form surface fillet between curves-on-surface: Select the curves-on-surface, then select Surfaces → Freeform Fillet.
Editing the free-form fillet using manipulators 1
Click the Show Manipulator icon, then perform the free-form fillet.
2
To display specific isoparm manipulators, click the heading that you need from the Channel Box and change the values in the Min and Max boxes.
You can also enter values in the Numerical Input line while a manipulator is active and press Enter.
268
Using Maya: Modeling
Creating surfaces Filleting surfaces
Setting Freeform Fillet options NURBS Modeling
Select Surfaces → Freeform Fillet - ❐ to open the options window.
Changing the free-form surface fillet’s bias and depth Bias
The Bias value scales the end tangents across the two surface curves.
Depth
The Depth value controls the curvature of the filleted surface.
Defining the free-form surface fillet’s tolerance Use Tolerance
The Use Tolerance options let you reapply a free-form fillet within a specified tolerance value. If you select Global tolerance, the Positional and Tangential value you set in Options → General Preferences → Modeling are used. If you select Local, you can enter a new value to override the Positional and Tangential tolerance value you set in the General Preferences options window. Local tolerance is useful on a per-task basis where you want to change these values, but don’t want to change the Global tolerance values. This is the default.
Using Maya: Modeling
269
Creating surfaces Filleting surfaces
Choosing the output geometry Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Output Geometry
Editing free-form surface fillets in the Attribute Editor To edit a free-form filleted surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The Attribute Editor for free-form filleted surfaces contain the same options you find in the Freeform Fillet options window. See the option descriptions for details.
270
Using Maya: Modeling
Creating surfaces Blending surfaces
Blending surfaces If you know which options to set before you create the blended surface, open the options window first, then use the tool to create the surface. Click the option box (❐) after the tool name to change the option settings. See “Setting Fillet Blend Tool options” on page 274 for details. Alternately, you can create the blended surface with the default options and then edit the completed surface from the Channel Box or Attribute Editor. See “Editing the blend fillet using manipulators” on page 273 and “Editing a blended surface in the Attribute Editor” on page 278 for details.
To construct a blended surface: In the following, you transform a sphere and cone NURBS primitive and create a fillet blend between them to create the head of a bird. 1
Create and translate a sphere and a cone NURBS primitive so that the circular isoparm of the cone (the bottom) is facing the bottom of the sphere. The following illustration shows the primitives in the top view. Notice how the bottom of the cone and the sphere are placed so that the isoparms on both objects are facing each other.
2
Deselect both surfaces and select Surfaces → Fillet Blend Tool.
3
In the side view, click on the first surface isoparm and press Enter.
Using Maya: Modeling
271
NURBS Modeling
Use the Surfaces → Fillet Blend Tool to build a surface by forming a blend between two boundaries defined as a set of surface curves.
Creating surfaces Blending surfaces 4
Click on the second surface isoparm and press Enter to create the fillet blend.
5
If necessary, click-drag to reposition the isoparm before you press Enter to create the blend.
6
When the isoparm is in the desired position, Shift-click on the original isoparm to deselect it.
You can now transform either the cone or the sphere. The fillet blend adjusts to the transformation. In the following illustration, the head of the bird on the left is scaled larger, and on the right the beak is scaled smaller.
272
Using Maya: Modeling
Creating surfaces Blending surfaces
NURBS Modeling
Editing the blend fillet using manipulators
Note If you want to use the manipulator handles to adjust a fillet blend, try not to use straight lines as the selected isoparms (such as the edges of two planes). Twisting and unexpected results may occur. 1
Click the Show Manipulator icon before or after you perform the fillet blend.
2
To display both manipulators and editable parameters for the resulting fillet, click the ffBlendSrf heading in the Channel Box.
Using Maya: Modeling
273
Creating surfaces Blending surfaces 3
To display specific isoparm manipulators, click the heading that you need from the Channel Box and change the values in the Min and Max boxes.
You can also enter values in the Numerical Input line while a manipulator handle is active.
Setting Fillet Blend Tool options Set the tool options before you blend the surfaces. To open the options window, select Surfaces → Fillet Blend Tool - ❐.
274
Using Maya: Modeling
Creating surfaces Blending surfaces
Setting the blend direction There are three possible blends for the same input—First, Second, and First and Second. Automatic Blend Direction
The Automatic Blend Direction calculates which one works best. This option is toggled on by default. If Automatic Blend Direction is toggled off, the Flip Boundary Normals options are displayed.
Flipping the boundary normals These options are used to determine the boundary normals by flipping the curve around to create a different fillet blend. First
If First is toggled on, the surface for the first selected isoparm is flipped resulting in different surface normals.
Second
If Second is toggled on, the surface for the second selected isoparm is flipped resulting in different surface normals. If both First and Second are toggled on, both normals are flipped.
Using Maya: Modeling
275
NURBS Modeling
To change the options after the blend is completed, use the Channel Box or the Attribute Editor. See “Editing a blended surface in the Attribute Editor” on page 278 for details.
Creating surfaces Blending surfaces
First
Second First and Second
If Automatic Blend Direction is toggled off and you use the Show Manipulator Tool, additional locators are displayed. Click a manipulator handle to flip the surface normals.
Defining the fillet blend’s tolerance Tolerances
Click the Tolerances triangle to display the tolerance settings. These options let you apply a fillet blend within a specified tolerance value. You can apply tolerance globally or locally. If you select Global tolerance, the Positional and Tangential value you set in Options → General Preferences → Modeling are used. This is the default.
276
Using Maya: Modeling
Creating surfaces Blending surfaces
Local tolerance is useful on a per-task basis where you want to change these values, but don’t want to change the Global tolerance values.
Choosing the output geometry Output Geometry
Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Using Maya: Modeling
277
NURBS Modeling
If you select Local, you can enter a new value to override the Positional and Tangential tolerance value you set in the General Preferences options window. Click the Local button to display the following options
Creating surfaces Blending surfaces
Editing a blended surface in the Attribute Editor To edit the completed blended surface, open the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The Attribute Editor for a blended surface contains the same surface history attributes for an object. See “Editing objects in the Attribute Editor” on page 227 for details.
278
Using Maya: Modeling
Creating surfaces Revolving surfaces
Revolving surfaces
To revolve a curve to build a surface: 1
Draw a curve in the front view so it is perpendicular (Y) in the perspective view. This curve serves as the outline of the surface you want to construct. This is called the profile curve.
2
While the curve is active, select Surfaces → Revolve to build the surface.
U
V
Using Maya: Modeling
279
NURBS Modeling
Use Surfaces → Revolve to construct a surface by revolving a profile curve about an axis. Any curve can be revolved: free curves, surface curves (isoparms), curves-on-surface, and trim boundaries are all valid. The curve can be revolved by either positive or negative amounts, up to a maximum of 360 degrees.
Creating surfaces Revolving surfaces
Tip By default, all selected curves are revolved 360 degrees about the world Y axis. The U parameter direction of the surface is determined by the original curve. The V parameter direction is determined by the direction of the revolve. See “What is the U / V surface direction?” on page 246 for more information. Make sure construction history is on before you create a revolved surface if you want to use the Show Manipulator Tool to edit the resulting surface. 3
When the surface is first created, the revolve history node is active. Click the Show Manipulator icon to see the revolve manipulators. If you want to edit the surface later, you have to select the revolve node in the Channel Box or marking menu (from the Inputs menu) to see the manipulators. You can also edit the parameters for a completed revolved surface in the Attribute Editor.
Using the revolve manipulator The revolve manipulator consists of handles that let you interactively change the pivot and direction of the revolve axis, and the end sweep angle of the revolve.
Using the axis manipulators Click the Show Manipulator icon before or after you create the revolved surface to display the revolve manipulator.
AxisEndPoint CircleSweep AxisMidPoint AxisStartPoint
280
Using Maya: Modeling
Creating surfaces Revolving surfaces
Tips If you move the axis endpoints, the axis direction is modified. However, if you move the axis midpoints, the radius of the revolved surface is modified without affecting the axis direction. To snap the axis, start, end, and midpoint to the desired position, use a snap mode. The snap mode icons are located on the Status Line.
See the Basics book for more information about the Show Manipulator Tool. The following shows what happens to the revolved surface when you transform the axis manipulators.
Move the AxisEndPoint
Move the AxisStartPoint
Move the AxisMidPoint
Using the circle sweep manipulator To modify the sweep angle, drag the circle sweep manipulator by moving along the arc, allowing the sweep to begin somewhere away from the profile curve. You can also modify the sweep angle by changing its value in the Channel Box. Using Maya: Modeling
281
NURBS Modeling
Click-drag the handles to change the axis of revolution of the revolved surface interactively, or enter exact X, Y, and Z positions for the active handle in the Numerical Input line. You can also enter precise values in the options window, Channel Box, or in the Attribute Editor.
Creating surfaces Revolving surfaces
Click-drag the sweep manipulator
Note You cannot use snap modes with the sweep manipulators.
Editing the input profile curve If construction history is on when the revolved surface is created, you can modify the profile curve. This in turn modifies the completed surface. When you select the profile curve, the surface changes color to indicate that it has construction history.
If you have trouble selecting the profile curve, open the Hypergraph or the Outliner and select it from there (Window → Hypergraph or Outliner).
282
Using Maya: Modeling
Creating surfaces Revolving surfaces
NURBS Modeling
To transform the profile curve, you can either: •
use a transformation tool,
•
change its properties in the Channel Box or Attribute Editor,
•
use another operation, such as Extend or Detach Curves. The following example shows the profile curve extended and scaled.
Using Maya: Modeling
283
Creating surfaces Revolving surfaces
Profile curve extended
Profile curve scaled
You can also display the connections for the revolved surface in the Hypergraph window. Select Options → Show → Shape Nodes, click the revolve node (revolve1, for example), then click the Up and Downstream Connections icon.
Select Shape Nodes, then click this icon.
284
Using Maya: Modeling
Creating surfaces Revolving surfaces
Setting Revolve options NURBS Modeling
Select Surfaces → Revolve - ❐ to open the options window.
Selecting the X, Y, or Z axis of revolution Select an Axis Preset option to specify the revolution axis. The default is Y. Axis Preset
If you set the Axis Preset to X, Y, or Z, you cannot change the values in the Axis boxes. See “Setting a free axis of revolution” on page 286 for more information about the Free option. In the following example, a profile curve (drawn in the front view) is revolved using each revolution axis in the perspective view.
Using Maya: Modeling
285
Creating surfaces Revolving surfaces
Profile curve
Revolved in Y (default)
Revolved in X
Revolved in Z
Setting a free axis of revolution Free Axis
286
If you set the Axis Preset to Free, you can enter values in the Axis X, Y, or Z boxes to specify the axes about which the profile curve is revolved. You can also change these values in the Channel Box or the Attribute Editor. In this example, 1 is the value for X, Y, and Z in the Channel Box.
Using Maya: Modeling
Creating surfaces Revolving surfaces
Changing the pivot point location If you set Pivot to Object, the revolve is performed from the default pivot location (0,0, 0). This is the default. If you select Preset, you can change the X, Y, or Z location of the pivot point by entering values in the Pivot Point boxes. You can also change these values in the Channel Box or Attribute Editor. The following shows how a revolved surface is created with the default pivot values and what happens when you change the default values to 5 in X, Y, and Z in the Channel Box.
0, 0, 0 by default
5, 5, 5
Selecting the surface degree Surface Degree
The Surface Degree options determine whether the V parameter direction of the surface is created with linear (degree 1) or cubic (degree 3) geometry. If you select Linear, the surface is constructed with flat facets all around. If you select Cubic, the smooth polygonal profiles are defined by the original profile curve. This is the default.
Using Maya: Modeling
287
NURBS Modeling
Pivot
Creating surfaces Revolving surfaces
Linear
Cubic
You can also change these values in the Channel Box or the Attribute Editor. To select a Degree type from the Channel Box, place the pointer in the Degree box, use the right mouse button and click-drag to select an option from the pop-up menu.
Sweeping the revolved surface Use the Start Sweep Angle and End Sweep Angle values to specify the angle of revolution in degrees. The default is 360, with a valid range of 0 to 360. You can also change the sweep angle in the Channel Box or the Attribute Editor. See also, “Using the circle sweep manipulator” on page 281 for information on how to sweep the revolved surface with manipulators.
Setting the revolve tolerance value Use Tolerance
The Use Tolerance options control the accuracy of the resulting revolved surface. You can apply tolerance globally or locally. If you select None you can change the segments value. See “Defining the number of revolution segments” on page 289 for details. If you select Local, enter a new value to change the tolerance of the revolved surface. This lets you create the revolved surface so it is closer to the actual surface of revolution.
288
Using Maya: Modeling
Creating surfaces Revolving surfaces
NURBS Modeling
Global tolerance means the Positional and Tangential value you set in Options → General Preferences → Modeling are used.
Defining the number of revolution segments Segments
The Segments value determines how many sections are used to create the surface of revolution. With a sweep of 360 degrees, six or eight sections are usually sufficient. The following shows the revolve with the default 8 sections.
You can also change the amount of sections in the Attribute Editor or the Channel Box. The following shows a surface with 20 segments, or sections.
Using Maya: Modeling
289
Creating surfaces Revolving surfaces If Use Tolerance is not set to None, the Segments value is automatically computed so that the result differs from the default revolved surface by less than the specified tolerance value. If Local is set as the Use Tolerance option, the tolerance value of the revolved surface is closer to the actual surface of revolution.
Tip If animating the sweep angle, change the Segments value instead of the tolerance value to change the numbers of CVs of the surface.
Selecting the curve range Curve Range
Select Complete as the Curve Range to create the revolved surface along the entire profile curve. This is the default. Select Partial if you only want to use a segment of the curve for the revolve.
Editing part of the revolved surface If you set the Curve Range to Partial before you create the revolved surface, a subCurve node is created. Use this node to specify a range of the curve. To edit this curve range, select the subCurve node and click-drag the curve segment manipulator (click the subCurve heading in the Channel Box, then select the Show Manipulator Tool) or change the Min and Max values.
290
Using Maya: Modeling
Creating surfaces Revolving surfaces
NURBS Modeling
Choosing the output geometry Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Output Geometry
To change the number of polygons created for the surface when creating polyset data, use the Attribute Editor. The polygonal surface must be selected. Click the nurbsTesselate tab to display and edit the Tessellation Attributes and the Mesh Component Display.
Editing the revolved surface in the Attribute Editor To edit the revolved surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
291
Creating surfaces Revolving surfaces
The options you set in the options window or the Channel Box are displayed. See the option descriptions, “Setting Revolve options” on page 285 for details. Input Curve
The Input Curve information is read-only. It gives you access to the history of the curve you used to create the revolved surface. Click the arrow buttons to select the curve and open its section of the editor.
Editing the subCurves in the Attribute Editor If you set the Curve Range to Partial in the options window when the revolve was created, you have access to the Attribute Editor for the resulting subCurves. See “Setting SubCurve Attributes” on page 20 in Chapter 1, “NURBS Modeling” for details.
292
Using Maya: Modeling
Creating surfaces Lofting curves and surfaces
Lofting curves and surfaces
Tip Before you begin, you need at least two profile curves or surface isoparms.
To loft curves: 1
Pick the first curve you want to loft, then Shift-click to pick subsequent curves.
2
Select Surfaces → Loft.
3
The lofted surface is constructed from curve to curve in the order that you selected them. The last curve selected is green by default.
Tip If you require an even and uniform transition of the surface as it lofts through each profile curve (for example, a boat hull), space the curves evenly.
Using Maya: Modeling
293
NURBS Modeling
Use Surfaces → Loft to construct a surface that passes through a series of profile curves. These curves can be curves-on-surface, surface isoparms, or trimmed edges. Lofting is used most often to create new surfaces from curves or primitive shapes, or to close open surfaces.
Creating surfaces Lofting curves and surfaces
To add additional curves to a lofted surface: You can add new curves to an existing lofted surface created with construction history. 1
Select one of the curves you used to create the lofted surface. Notice the lofted surface is displayed in the construction history color.
2
Select the curve you want to add, then select Surfaces → Loft.
The following shows the result when two curves are added to the initial lofted surface.
294
Using Maya: Modeling
Creating surfaces Lofting curves and surfaces
To loft surface isoparms: While the surface is active, click the Select by component mode icon.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the pointer is positioned over the active surface, use the right mouse button to select Isoparm from the marking menu. 3
Shift-click to select the isoparms you want to loft together, then select Surfaces → Loft.
Using Maya: Modeling
295
NURBS Modeling
1
Creating surfaces Lofting curves and surfaces
Setting Loft options Select Surfaces → Loft - ❐ to open the options window.
Changing the loft parameterization Select one of the Parameterization options to modify the V parameterization of the lofted surface. Uniform
With Uniform knot spacing, the profile curves run parallel to the V direction. The parameter values of the resulting surface in the U direction are equally spaced. The first profile curve corresponds to the isoparm on the surface at U 0, 0, the second to U 1.0, and so on.
Chord Length
With Chord Length spacing, the parameter values on the resulting surface in the U direction are based on the distance between the start points of the profile curves.
296
Using Maya: Modeling
Creating surfaces Lofting curves and surfaces
Since lofting is based on the parameter values along the curves, if the curves are all parameterized the same way (each curve is the same degree with an equal number of edit points and identical knot values), the lofted surface will have the same number of spans in the U surface parameter direction. This helps to control the amount of surface data, and the size of the related data file. You can achieve this by copying the original cross sectional curve, and then transforming and modifying it as necessary. If the parameterization of all the curves do not match, the resulting surface can have considerably more spans than any of the curves used in its construction. If you create the original curves as Edit Point curves with chord length, this results in increased surface complexity.
Changing the loft degree Surface Degree
You can set the Surface Degree to either Linear or Cubic. This sets the lofted surface to linear or cubic in the U direction.
Cubic
Linear
Reversing the loft direction Auto Reverse
If Auto Reverse is toggled off, the curves are used as they are which may result in a twisted surface. If toggled on, the curves are automatically reversed. The default in on. In the following example, the two top curves and the two bottom curves are going in different directions.
Using Maya: Modeling
297
NURBS Modeling
Tips on Knot Spacing
Creating surfaces Lofting curves and surfaces
If Auto Reverse is toggled off, the result is a twisted lofted surface. If toggled on, the curves are automatically reversed.
Auto Reverse off
Auto Reverse on
If Auto Reverse is toggled off, you can use the Show Manipulator Tool to reverse the curve direction of the original profile curves as needed. Simply click the manipulator handle to reverse the curve direction.
Opening or closing the lofted surface Close
298
The Close option determines whether the created surface is closed in the U direction. Close is toggled off by default.
Using Maya: Modeling
Creating surfaces Lofting curves and surfaces
NURBS Modeling
Close toggled off
Close toggled on
Selecting the curve range Curve Range
If you set the Curve Range to Complete, the lofted surface passes through the entire curve. If you select Partial and select the Show Manipulator Tool, curve range manipulators are displayed on the profile curves. This means you can drag the manipulators to interactively alter the portion of the curve to use in the loft. The resulting surface only passes through the selected portions of the profile curves (the subCurves).
Editing part of a lofted surface To edit part of a lofted surface, set Partial as the Curve Range in the options window. Click the Show Manipulator icon to display the curve range manipulators and editable parameters in the Channel Box. Click the subCurve heading in the Channel Box for the input curve you want to edit.
Click the subCurve heading in the Channel Box to display the manipulators for a specific subCurve.
Click-drag the manipulators or enter values in the Min/Max boxes.
Using Maya: Modeling
299
Creating surfaces Lofting curves and surfaces You can also enter values in the Numerical Input line while a manipulator handle is active.
Choosing the output geometry Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Output Geometry
To change the number of polygons created for the surface when creating polyset data, use the Attribute Editor. The polygonal surface must be selected. Click the nurbsTesselate tab to display and edit the Tessellation Attributes and the Mesh Component Display.
Editing the lofted surface in the Attribute Editor To edit the lofted surface, use the Attribute Editor. To open the Attribute Editor, either:
300
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Creating surfaces Lofting curves and surfaces
NURBS Modeling
If you selected curves to construct the lofted surface, the following is displayed:
The options you set in the options window or the Channel Box are displayed. See the option descriptions for details. Input Curves
The Input Curve sections and available options change depending on which method you used to create the lofted surface. This information is read-only. It gives you access to the history of the lofted surface you constructed. Click the arrow buttons to select the surface, isoparms, or curves and open its section of the editor.
Reverse Curve
If you toggle Auto Reverse off, a Reverse Curve toggle box is displayed for each curve, primitive, or surface isoparm you used to create the lofted surface. Select the Show Manipulator Tool to also display the reverse manipulators. Click the toggles to reverse the direction of the input curves, or click the manipulators.
Using Maya: Modeling
301
Creating surfaces Lofting curves and surfaces In the following illustration, the first curve used to create the lofted surface is selected for reversal.
Editing the subCurves in the Attribute Editor If you set the Curve Range to Partial in the options window when the loft was created, you have access to the Attribute Editor for the resulting subCurves. See “Setting SubCurve Attributes” on page 20 in Chapter 1, “NURBS Modeling” for details.
302
Using Maya: Modeling
Creating surfaces Beveling surfaces
Beveling surfaces NURBS Modeling
Use Surfaces → Bevel to create an extruded surface with a beveled edge from any curve, including text curves and trim edges.
To create a beveled surface from a curve: Click on the curve you want to bevel and select Surfaces → Bevel. The following example shows a text curve beveled with the default options.
To create a beveled surface from an isoparm: 1
To select the isoparms, click the Select by component type icon from the Status Line.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the pointer is positioned over the active surface, use the right mouse button to select Isoparm from the marking menu. 3
Click to select an isoparm.
Using Maya: Modeling
303
Creating surfaces Beveling surfaces
4
Select Surfaces → Bevel to bevel the isoparm.
Note By default, Bevel Width and Bevel Depth are 0.5 linear units of measure, and Extrude Height is 1.00 linear units of measure.
Changing the bevel’s dimensions interactively You can change the dimensions of the bevel interactively with the Show Manipulator Tool, or in the Numerical Input line. You can also enter values in the Channel Box or the Attribute Editor. If you want to edit the beveled curve from the Channel Box or Attribute Editor, the manipulators do not have to be displayed.
304
Using Maya: Modeling
Creating surfaces Beveling surfaces
Editing a beveled curve with manipulators
HeightPoint
WidthPoint
DepthPoint
To interactively edit the bevel units, click-drag the manipulator handles. The Feedback Line displays the current measurement of each bevel unit as you move an active manipulator. You can also enter values in the Numerical Input line or in the Channel Box.
Changing the bevel height The HeightPoint manipulator handle corresponds to the Extrude Depth option in the Channel Box. To change the bevel height, click-drag the HeightPoint manipulator handle. You can also enter a value in the Numerical Input line or in the Extrude Depth box in the Channel Box.
Using Maya: Modeling
305
NURBS Modeling
If you bevel a curve, the following manipulators are displayed when you click the Show Manipulator icon and click the bevel heading in the Channel Box.
Creating surfaces Beveling surfaces
Changing the bevel width To change the bevel width, click-drag the WidthPoint manipulator handle. You can also enter a value in the Numerical Input line or in the Width box in the Channel Box.
Changing the bevel depth To change the bevel depth, click-drag the DepthPoint manipulator handle. You can also enter a value in the Numerical Input line or in the Depth box in the Channel Box.
Reversing the bevel direction To reverse the direction of the bevel, use a negative value for the bevel depth, width, and height (or Extrude Depth). Change these values in the Channel Box or in the options window. The following shows a beveled isoparm created in the default direction, and one in the reverse direction. Sometimes, this is the result you may want. For instance, you may want to create a beveled edge on a surface as shown in the example.
306
Using Maya: Modeling
Creating surfaces Beveling surfaces
NURBS Modeling
Default direction
Reversed direction
Editing a beveled isoparm with manipulators Although the same manipulators are displayed for a beveled isoparm, an additional set of manipulators, StartParam and EndParam, become available when you click the isoparm heading in the Channel Box.
Click to display Start and End manipulators
StartParam EndParam
Click-drag the start and end parameter manipulators to change the beveled isoparm segment. You can also enter values in the Numerical Input line or in the Min and Max boxes in the Channel Box. The following shows what happens when you edit the StartParam.
Using Maya: Modeling
307
Creating surfaces Beveling surfaces
Setting Bevel options Select Surfaces → Bevel -❐ to open the options window.
308
Using Maya: Modeling
Creating surfaces Beveling surfaces
Attaching the bevel surfaces Toggle Attach Surfaces on to attach each part of the bevel surface. The default is on. If toggled off, the surfaces are not attached. For example, if Attach Surfaces is toggled off and you create a bevel with Bevel set to Both, three surfaces are created. These surfaces are independent and can be selected and modified as such. Attach Surfaces on
Attach Surfaces off
You can select one of these surfaces from the Hypergraph or Outliner window (Window → Hypergraph or Outliner).
Using Maya: Modeling
309
NURBS Modeling
Attach Surfaces
Creating surfaces Beveling surfaces You can also select the surface you want to edit from the Objects pop-up menu in the Channel Box and open its Attribute Editor.
Selecting a bevel surface area Bevel
The Bevel options specify whether the beveled surface area is applied to the top, bottom, or both sides of the original curve or isoparm. The following example uses a NURBS Circle primitive curve using each method.
Top Side The bevel is created from the top of the circle.
Bottom Side The bevel is created from the bottom of the circle.
Both The bevel is created from both the top and bottom of the circle. This is the default method.
310
Using Maya: Modeling
Creating surfaces Beveling surfaces
NURBS Modeling
Off Only the extrude part of the bevel surface is created.
Changing the bevel dimensions from the options window You can enter exact bevel dimensions values before the bevel is created. Bevel Width
The Bevel Width value specifies the initial width of the bevel as viewed from the front of the curve or isoparm.
Bevel Depth
The Bevel Depth value specifies the initial depth of the bevel portion of the surface.
Tip The combination of Bevel Width and Bevel Depth values determine the angle of the bevel. The Extrude Height value specifies the height of the extruded portion of the surface, not including the bevel surface area. For more information, see:
Extrude Height
•
“Editing a beveled curve with manipulators” on page 305
•
“Editing a beveled isoparm with manipulators” on page 307
•
“Editing a beveled surface in the Attribute Editor” on page 314
Selecting a bevel corner type Bevel Corners
The Bevel Corners options specify how corners in the original construction curves are handled in the beveled surface.
Straight The bevel is created with linear, or straight, corners.
Using Maya: Modeling
311
Creating surfaces Beveling surfaces
Circular Arcs The bevel is created with rounded, or circular arc corners.
Note If the curve is degree is 1 or 2, the bevel’s surface will be cubic (degree 3).
Selecting bevel cap edges to determine the bevel shape Bevel Cap Edge
The Bevel Cap Edge options are used to determine the shape of the beveled part of the surface.
Convex The bevel is created with a convex edge.
Concave The bevel is created with a concave edge.
Straight The bevel is created with a straight edge.
Setting the curve range Use the Curve Range options if you are creating a bevel from a curve.
312
Using Maya: Modeling
Creating surfaces Beveling surfaces Curve Range
Select Partial to only use a segment of the curve for the bevel. When you select the Show Manipulator Tool, a manipulator is displayed at each end of the curve. Use these manipulators to edit a part of the input curve to change the beveled result.
Editing part of the beveled curve Select Partial as the Curve Range in the options window and click the Show Manipulator icon to display the curve range manipulators and editable parameters in the Channel Box. Click the subCurve heading in the Channel Box for the input curve you want to edit, then click-drag the StartParam or EndParam manipulator handles to interactively edit the input curve. You can also enter values in the Min and Max boxes.
You can adjust these subCurves in the Attribute Editor if you require further modifications. See “Editing a beveled surface in the Attribute Editor” on page 314, and “Editing a beveled isoparm with manipulators” on page 307 for more details.
Choosing the output geometry Output Geometry
Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Setting the bevel tolerance Use Tolerance
The Use Tolerance options let you create a bevel within a specified tolerance of the original input curves. You can apply tolerance globally or locally.
Using Maya: Modeling
313
NURBS Modeling
Select Complete to use the entire curve for the bevel operation. Complete is the default setting.
Creating surfaces Beveling surfaces Global tolerance means the Positional value you set in Options → General Preferences → Modeling is used.
If you select Local tolerance, you can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful if you want to change these values often, but don’t want to change the Global tolerance all the time.
Editing a beveled surface in the Attribute Editor To edit the completed beveled surface, use the Attribute Editor. To open the Attribute Editor, either:
314
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Creating surfaces Beveling surfaces
NURBS Modeling
The options you set in the options window or the Channel Box are displayed. See“Changing the bevel’s dimensions interactively” on page 304 and “Setting Bevel options” on page 308 for details. Input Curve
The Input Curve information is read-only. It gives you access to the history of the curves or isoparms you used to create the bevel surface. Click the arrow buttons to select the curve and open its section of the editor.
Editing the subCurves in the Attribute Editor If you set the Curve Range to Partial in the options window when the bevel was created, you have access to the Attribute Editor for the resulting subCurves. See “Setting SubCurve Attributes” on page 20 in Chapter 1, “NURBS Modeling” for details.
Using Maya: Modeling
315
Creating surfaces Extruding surfaces
Extruding surfaces Use Surfaces → Extrude to construct a surface by moving a cross sectional profile curve along a path. Extrude works by sweeping a profile curve. Before you extrude, set the pivot point of each profile curve to specify the relationship between the profile and the path. The profile curve, the curve you want to extrude along the path, can be an open or closed free curve. You can also use a surface isoparm, curve-onsurface, or a trim boundary.
To create an extruded surface: You need at least two curves to create an extruded surface: a path curve and a profile curve. The profile curve is the curve that gets swept along the path curve to create the surface. The path curve is the last selected curve. 1
Select the profile curve first, then Shift-select the path curve. The last curve you select (the path curve) displays in the selected default green color.
2
Select Surfaces → Extrude.
Path curve
Profile curve
Tip If you select more than two curves, select all the profile curves first, then select the path curve last.
316
Using Maya: Modeling
Creating surfaces Extruding surfaces
Restrictions If the extrusion path has sudden changes of direction, undesirable twisting of the cross section around the path can occur. If this happens, increase the number of CVs in the path to make the change of direction between CVs more gradual. Sharp corners work well, but tight corners do not. For example, try extruding a circle along a linear path with 90 degree angles.
Setting Extrude options Select Surfaces → Extrude - ❐ to open the options window.
Choosing the extrude style Select a Style option to specify the type of extrusion you want. See “Setting the extrude distance” on page 318 for information on the Distance option. Flat
If you choose the Flat option, the extrude maintains the orientation of the cross section in space as it moves along the extrusion path.
Using Maya: Modeling
317
NURBS Modeling
To extrude a profile curve without using a path curve, change the extrude Style to Distance in the options window. See “Choosing the extrude style” on page 317 for details.
Creating surfaces Extruding surfaces
Tube is the default extrude style. It sweeps the cross section along the specified path so that the reference vector stays tangent to the path.
Tube
With Tube, the extrusion sweeps along the profile curve and pushes out as it follows the path.
Setting the extrude distance Select the Distance extrude Style to extrude a profile along a straight line. No path curve is required. When selected, the options window changes to include the following:
Extrude Length
318
Enter a value or drag the slider bar to specify the length of the extrusion. By default, the extrude length is 1.0. The following shows the result when you change the value to 5.0.
Using Maya: Modeling
Creating surfaces Extruding surfaces
NURBS Modeling
Length = 1.0
Length = 5.0
Setting the profile normal extrude direction Direction
If Distance is the selected extrusion Style, the default direction of the extrusion is Profile Normal. This means that the direction of the path is automatically taken from the normal of the profile curve. If the profile curve is not flat (planar), the average normal is used. Normal direction
Resulting surface
Specifying the direction vector Direction Vector
Click the Specify button to change the default direction for the extrusion.
Using Maya: Modeling
319
Creating surfaces Extruding surfaces When you click Specify, you can select X Axis, Y Axis, Z Axis, or Free. If you select an axis button, the extrusion occurs along that axis. For example, if you click the Z Axis button, the extrusion will be linear in the Z direction. If you select Free, you can enter values in the X, Y, and Z boxes to specify a vector to extrude. For example, the extrusion occurs by 1.0 in the X direction by default. The following example shows what happens if you set X and Y to 0.0 and Z to 1.0 when you extrude a curve.
x = 1.0 y = 0.0 z = 0.0
x = 0.0 y = 0.0 z = 1.0
Selecting the result position Result Position
If you set Style to Flat or Tube, At Profile is the default Result Position. This means the resulting surface starts at the profile; the path curve is moved to the profile and then the extrusion is performed. If you select At Path, the profile curve is moved to the path curve and then the extrusion is performed. This results in a surface at the path.
Setting the pivot Pivot
The Pivot options are only available if you set the Style to Tube. The Pivot options let you choose the pivot point method to position the profile curve on the extrusion path. If you select At Path as the Result Position, you can choose the profile curve and position it to the pivot point on the extrusion path. If you choose Closest End Point, the path end point closest to the center of the bounding box of the profile curves is used. This end point is used as the pivot point for all the profile curves. If performing a multiple extrusion, the resulting surfaces are offset from the path. This is the default. If you select Component, the pivot point of each individual profile curve is used to extrude the profile curve. The extrusion occurs along the components of the profile curve.
320
Using Maya: Modeling
Creating surfaces Extruding surfaces See the following examples. NURBS Modeling
Path and profile curves
Closest End Point
Component
Selecting the extrusion orientation Orientation
The Orientation options are only available if Style is set to Tube. If you choose Path Direction, the direction of the extrusion is determined by the direction of the path curve.
Using Maya: Modeling
321
Creating surfaces Extruding surfaces By default, the direction of the extrusion is determined by the Profile Normal direction. The direction of the linear path is automatically taken from the normal of the profile curve.
Orientation examples The following examples show the extrusion using a combination of Orientation modes and Result Positions. In this first example, Result Position is set to At Profile and Orientation is set to Profile Normal. The path curve is moved and rotated to match the profile curve. This is the default setting.
In this next example, Result Position is set to At Path and Orientation is set to Path Direction.
322
Using Maya: Modeling
Creating surfaces Extruding surfaces
NURBS Modeling
In this last example, Result Position is set to At Profile and Orientation is set to Profile Normal. The profile curve is moved and rotated to match the path curve.
Using Maya: Modeling
323
Creating surfaces Extruding surfaces
Selecting the curve range Curve Range
Set the Curve Range to Complete to extrude the entire profile along the entire path. Select Partial to extrude only part of the profile along part of the path. This creates a “subCurve” history node (initially set to the whole curve) which can then be edited using the Show Manipulator Tool.
Editing the extruded surface using manipulators If the Curve Range is set to Partial in the options window, you can use the Show Manipulator Tool to edit the parameter range of part of the curve used in the extrude operation. In the first example that follows, Tube requires two input curves, so two subCurve history nodes are included in the Channel Box. Click the heading in the Channel Box to select a subCurve history node, then click the Show Manipulator icon to display the manipulators (if not already selected). Drag the manipulators to edit the subCurve interactively, or enter values in the Min and Max boxes. In the following example, the profile input curve (subCurve 1) is selected and edited.
324
Using Maya: Modeling
Creating surfaces Extruding surfaces Now the path curve (subCurve2) is selected and edited. NURBS Modeling
If the Distance extrude style is used, click the extrude1 heading to display the manipulator to edit the length of the extruded surface.
Click the subCurve heading to edit the profile curve (the curve used to create the extrude).
Using Maya: Modeling
325
Creating surfaces Extruding surfaces
Choosing the output geometry Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Output Geometry
To change the number of polygons created for the surface when creating polyset data, use the Attribute Editor. The polygonal surface must be selected. Click the nurbsTesselate tab to display and edit the Tessellation Attributes and the Mesh Component Display.
Editing the extruded surface in the Attribute Editor To edit the completed extruded surface, use the Attribute Editor. To open the Attribute Editor, either:
326
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Creating surfaces Extruding surfaces
NURBS Modeling
The Attribute Editor includes the options you set in the options window. See “Setting Extrude options” on page 317 for details. Profile Curve/ Path Curve
The Profile Curve and Path Curve boxes let you access the input curves as well as statistical information about these curves. Click the arrows beside the boxes to select the input curves and click the tab to open the Attribute Editors for them.
Editing the subCurves in the Attribute Editor If you set the Curve Range to Partial in the options window when the extrude was created, you have access to the Attribute Editor for the resulting subCurves. See “Setting SubCurve Attributes” on page 20 in Chapter 1, “NURBS Modeling” for details.
Using Maya: Modeling
327
Creating surfaces Preparing to stitch surfaces
Preparing to stitch surfaces Use Edit Surfaces → Prepare For Stitch to easily prepare multiple surfaces for stitching before you use the Stitch Tool. Prepare For Stitch attaches a stitch operation node in front of each selected surface. Any subsequent stitch or stitch surface points operation carried out on the surface is performed by using the stitch node inserted in front.
Creating stitched surfaces Use the Edit Surfaces → Stitch Tool to stitch, or align, two NURBS surfaces together. The two surfaces can be stitched together with position (C0) and tangent (G1) continuity. Stitch modifies the positions of the boundary row (column) of CVs, and the first row (column) of CVs on a NURBS surface to achieve C0 and G1 continuity respectively. C0 (position) aligns the first CVs along the surface isoparms.
G1 (tangent) uses the second CVs to achieve tangent continuity along the surface isoparms.
C0 continuity
C0 and G1 continuity
If you know which options to set before you create the stitched surface, open the options window first, then use the tool to stitch the surface. Click the option box (❐) after the tool name to change the option settings. See “Setting Stitch Tool options” on page 332 for details. Alternately, you can create the stitched surface with the default options and then edit the completed surface from the Channel Box or Attribute Editor. See “Editing the stitched surface in the Channel Box” on page 334 and “Editing the stitched surface in the Attribute Editor” on page 336 for details.
328
Using Maya: Modeling
Creating surfaces Creating stitched surfaces
To stitch a surface: Change the Stitch Tool options, if necessary. Click the option box (❐) beside the tool name to open the options window.
2
Select Edit Surfaces → Stitch Tool, then follow the prompts on the Help Line.
3
Select the isoparms you want to stitch together. The isoparms you select must be the surface boundary isoparms or the stitched surface is not created. Surface boundary isoparms are those that define the edges of a surface.
4
A temporary stitch surface is created. At this point, you can click-drag the manipulators to edit the stitch before you press Enter to see the resulting surface.
Note For illustrative purposes the following example displays in white. Maya displays this temporary stitch surface in bright green.
5
Press Enter to complete the stitched surface. Using Maya: Modeling
329
NURBS Modeling
1
Creating surfaces Creating stitched surfaces
Selecting different edges The stitch result depends on the order in which you select the surface boundary edges, provided the two edges have been assigned non-equal weights. See “Determining the weighting factors for the input isoparms (edges)” on page 333 for information on assigning weights on input isoparms. The following shows how the resulting surface is affected when you change the selection order for the default edge weights of 1.0 and 0.0 on the first and second selected edge of a revolved surface. The highlighted isoparm indicates the first isoparm selected.
330
Using Maya: Modeling
Creating surfaces Creating stitched surfaces
Using isoparm manipulators on a stitched surface
Note When you use the Stitch Tool, the manipulator displays only on edges with a non-zero weight.
Using Maya: Modeling
331
NURBS Modeling
You can also use manipulators to interactively edit the surface after it is constructed. Select the Show Manipulator Tool and click on an isoparm heading in the Channel Box. The manipulators are displayed on the surface from which you first picked the isoparm. Use these manipulators to selectively modify the portions of the two isoparms where the two surfaces come together in C0 and (or) G1.
Creating surfaces Creating stitched surfaces
Setting Stitch Tool options Set the tool options before you use the Stitch Tool. To open the options window, select Surfaces → Stitch Tool - ❐.
To change the options after the surfaces are stitched, use the Channel Box or the Attribute Editor. See “Editing the stitched surface in the Attribute Editor” on page 336 for details.
Setting the blend options Blending
Toggle the Blending options on or off to specify the global blend when the surface edges are stitched. Position is the default blending option. When selected, the two surfaces stitched together have positional continuity (C0). When Tangent is selected, the two surfaces stitched together have tangent continuity (G1).
332
Using Maya: Modeling
Creating surfaces Creating stitched surfaces
NURBS Modeling
Note The Stitch Tool does not change the number of CVs or the U/V space parametrization. It does modify the CV positions to get as close to positional and tangent continuity as possible.
Determining the weighting factors for the input isoparms (edges) Weighting Factor on Edge
Before stitching the edges, the two selected isoparms are averaged in a weighted mode. The two surfaces are modified to meet along this averaged isoparm in C0, G1. You can assign weights to the selected isoparms. By default, a weight of 1.0 and 0.0 is assigned to the first and second selected isoparm. In effect, this modifies the CVs on the second surface so the surface is C0, G1 continuous with the first surface. If you assign a non-zero weight to the two selected isoparms, the CVs on both surfaces are modified to achieve C0, G1 continuity.
Note For illustrative purposes the following example displays in white. Maya displays this temporary stitch surface in bright green.
weight = 1.5 (default)
weight = 0.5
You can choose to modify the weights after completing the stitch with history in the Attribute Editor on the avgCurve node created during the stitch (accessible through the Channel Box).
Using Maya: Modeling
333
Creating surfaces Creating stitched surfaces You can drag the manipulators to selectively alter the portions along the isoparms to be weighted together. These are the portions on the two surfaces that will be stitched together.
Tip To see the curve computed by the average node, select the Show Manipulator Tool on the average node. This manipulator provides a visual clue only and cannot be edited.
Setting the samples along the stitch edge Samples Along Edge
The CVs for the stitched surface are determined by sampling (discretizing) the edge along the surface which needs to be modified for C0, G1 continuity. You can explicitly set Samples Along Edge to close any possible C0 gaps on the stitched surface. The higher the count, the slower the performance. This is the same as Step Count in the Channel Box and Attribute Editor.
Cascading the stitch node Cascade Stitch Nodes
If Cascade Stitch Node is toggled on, the stitch operation ignores any prior stitch operations on the surface. If toggled off and the surface has had a stitch operation performed on it, the stitch node from the previous operation is used. The default is on.
Keeping original geometry If Keep Original is toggled on, the stitch surface is created on top of the original input surfaces. This way, you can move the resulting surface if you are not satisfied with the result and restitch a new surface with different option settings. If toggled off, the result of the stitch operation replaces the surface being stitched. Keep Original is off by default.
Editing the stitched surface in the Channel Box Once you press Enter and then select the stitched surface, parameters for the input surface and the resulting stitched surface are displayed in the Channel Box. Click the heading for the stitch surface to display its parameters.
334
Using Maya: Modeling
Creating surfaces Creating stitched surfaces
NURBS Modeling
Continuity
Type on or off in the Continuity boxes to toggle positional or tangential continuity for the stitch surface.
Step Count
Step Count means the same thing as Sample Count in the Surface History section of the options window. See “Setting the samples along the stitch edge” on page 334 for details.
Bias
Use the Bias value to blend the CVs between the input surface to the stitch node and the result from the stitch operation. A value of 0.0 has no effect.
Fix Boundary
You can use the Fix Boundary option only if the Cascade Stitch Nodes option and G1 continuity are on during the stitch operation. While solving G1 continuity across all four edges, it is quite possible that the eight CVs (two boundary CVs next to each of the four surface corners, giving a total of eight) could be modified; this may result in positional discontinuity. To avert this, turn Fix Boundary on to ensure that the eight CVs remain unmodified.
Using Maya: Modeling
335
Creating surfaces Creating stitched surfaces
Updating the stitch surface history Click the Surface History tab to display the following parameters.
Blend Points
Use the Blend Points toggles, Position Continuity and Tangent Continuity, to set local positional or tangential continuity on or off for surface points (if you are stitching the surface using edit points or CVs).
Blend Edge
Use the Blend Edge toggles, Position and Tangent, to set local positional or tangential continuity on or off for surface edges.
Sample Count
Use the Sample Count value to close any gaps between the surfaces. See “Setting the samples along the stitch edge” on page 334 for more information.
Editing the stitched surface in the Attribute Editor To edit the completed stitched surface, use the Attribute Editor. To open the Attribute Editor, either: •
336
Click the option box (❐) in the Object pop-up menu in the Channel Box.
Using Maya: Modeling
Creating surfaces Creating stitched surfaces Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The Stitch Surface History section gives you access to the input surface and the curves that the stitch operation is attempting to stitch to. Click the arrow buttons to select the surfaces or curves if you want to edit them.
Using Maya: Modeling
337
NURBS Modeling
•
Creating surfaces Creating stitched surfaces Fix Boundary
The Fix Boundary toggle is also available in the Channel Box. See “Editing the stitched surface in the Channel Box” on page 334 for details.
Bias
Use the Bias value to blend the CVs between the input surface to the stitch node and the result from the stitch operation. A value of 0.0 has no effect.
Positional/ Tangential Continuity
The Positional Continuity and Tangential Continuity toggles are also included in the Channel Box. Type on or off to globally set the continuity for the surface edges. If toggled off (the default setting), the Step Count (or Sampling Rate) is used as the tolerance value. If toggled on, you can set a specific tolerance value.
338
Using Maya: Modeling
Creating surfaces Stitching surface points
Stitching surface points
To stitch a surface using surface points: 1
Select the points on the surface you want to stitch together. In this example, edit points are selected from two primitive NURBS planes.
2
To select the edit points, click the Select by component type icon, click the Parm Points icon and select Edit Points from the pop-up menu.
or With the right mouse button over the active surfaces, select Edit Point from the marking menu. 3
Marquee-select the edit points you want to stitch together.
4
Select Edit Surfaces → Stitch Surface Points.
Using Maya: Modeling
339
NURBS Modeling
Use Edit Surfaces → Stitch Surface Points to stitch NURBS surfaces together by selecting points on the surface. Any type of surface point can be selected, including edit points, CVs, or surface points along the surface boundaries.
Creating surfaces Stitching surface points
Setting Stitch Surface Points options Select Edit Surfaces → Stitch Surface Points - ❐ to open the options window.
Keeping original geometry If Keep Original is toggled on, the stitch surface is created on top of the original input surfaces. This lets you move the resulting surface if you are not satisfied with the result. You can restitch a new surface with different option settings.
Assigning equal weights Assign Equal Weights
If Assign Equal Weights is toggled on, a weighted average of the selected points is performed both in position and normal using an average NurbsSurfacePoint node. If toggled on, all the points are assigned a weight of 0.5. When toggled off, the first selected point is assigned a weight of 1.0 and the rest of the points a weight of 0.0. The default is on.
Cascading the stitch node Cascade Stitch Node
340
If Cascade Stitch Node is toggled on, the stitch operation ignores any prior stitch operations on the surface. If toggled off and the surface has had a stitch operation performed on it, the stitch node from the previous operation is used. The default is on.
Using Maya: Modeling
Creating surfaces Stitching surface points
Editing stitched surface points in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Input Surface
The Input Surface box is read-only. You click the arrow beside its name to access the surface to edit it.
Fix Boundary/ Bias
The Fix Boundary option and the Bias options are included in the Channel Box for a stitched surface. See “Editing the stitched surface in the Channel Box” on page 334 for details about these options.
Using Maya: Modeling
341
NURBS Modeling
To edit the completed stitched surface points, use the Attribute Editor. To open the Attribute Editor, either:
Creating surfaces Stitching surface points
Setting point constraint options If you stitched edit points together, the Point Constraints options are available.
Parameter U / V
Enter values in the Parameter U and Parameter V boxes to adjust the U or V parameters of the edit points you used to stitch the surface.
Position / Normal
The Position and Normal information is read-only. These values indicate in which XYZ direction the edit points and surface normals are located.
342
Using Maya: Modeling
Creating surfaces Stitching surface points
Setting the CV positions
CV Index boxes
The CV Index boxes let you override the default (or initial) position of the CVs you used to stitch a surface together.
CV Position
The CV Position information is read-only. These values indicate in which XYZ direction the CVs are located.
To edit surface points in the Attribute Editor: 1
Click the NurbsSurfacePoints node heading in the Channel Box.
2
Click the option box (❐) next to its name in the Object pop-up menu.
Click this heading, then click the box beside its name in the Object pop-up menu.
Using Maya: Modeling
343
NURBS Modeling
If CVs are stitched together, the Override CV Position options are available.
Creating surfaces Stitching surface points
To edit curve points in the Attribute Editor: 1
Click the avgCurves node heading in the Channel Box.
2
Click the option box (❐) next to its name in the Object pop-up menu.
Click this heading, then click the box beside its name in the Object pop-up menu
344
Using Maya: Modeling
Creating surfaces Stitching surface points
NURBS Modeling
For details about changing the weight factors for curves or isoparms, see “Determining the weighting factors for the input isoparms (edges)” on page 333.
Using Maya: Modeling
345
Creating surfaces Creating boundary surfaces
Creating boundary surfaces Use Surfaces → Boundary to create a three-sided or four-sided surface from three or four curves.
Creating a four-sided boundary surface Before you begin, you need four boundary curves to define the profile of the surface boundaries. You can either marquee-select the four curves, or pick the curves in a specific order. After you select the curves you want to use for the boundary surfaces, select Surfaces → Boundary.
Marquee-selecting the curves If you want to use this method, try to create the curves in the order that you want the boundary surface to be constructed. Keep in mind that the first curve you create defines the U parameter of the resulting surface.
Picking the curves in a specific order Although a specific order is not necessary when selecting the curves, it is recommended that you pick the curves in opposing pair order. That is, the second curve you select should be the curve that is parallel to the first curve you select. This lets you control which pair of curves will be modified and positioned so their end points match with the end points of the second curve pair. Keep in mind that the first selected curve defines the U parameter direction of the resulting surface.
U direction
4
1 2 3
346
Using Maya: Modeling
Creating surfaces Creating boundary surfaces
Creating a three-sided (triangular) boundary surface
Marquee-selecting the curves If you want to use this method to select the curves, it is important to create the curves in a specific order or the results may not be what you intended. Try to create the two curves that meet at the apex first, then create the third curve. Notice the different results in the following illustration. These curves were created first. This curve was created first.
Picking the curves in a specific order Although the direction of the three boundary curves is not important for a triangular boundary surface, the results can differ depending on the order you pick the curves. Remember that the first curve selected defines the U parameter direction of the resulting surface and that the apex always appears where the first curve meets the second curve.
1 2
3 U direction
Using Maya: Modeling
347
NURBS Modeling
Select three curves to define the profile of the surface boundaries, then select Surfaces → Boundary.
Creating surfaces Creating boundary surfaces In the following, the curves are selected so that the U direction is determined by a different picking order.
U direction
3
1
2
Notes A 3-sided surface is actually a 4-sided surface with one side that has zero length. If the end points of two side curves are not exactly matched, then a short straight line segment will result instead of a zero length line. The zero length side occurs at the apex of the triangular surface. The term degenerate surface is often used to describe a surface with a zero edge length. Although degenerate surfaces are fine for visual purposes, they may not be compatible with all manufacturing systems.
348
Using Maya: Modeling
Creating surfaces Creating boundary surfaces
Setting Boundary options NURBS Modeling
Select Surfaces → Boundary - ❐ to open the options window.
Determining the curve order The Curve Ordering options affect the resulting surface depending on what is set and how you select the curves. Automatic/ As Selected
Automatic is the default option setting. When As Selected is the curve order setting, the order in which you select the curves determines the resulting surface. In the following, the first surface is created by marquee-selecting the curves while Automatic is selected. The second surface is created when As Selected is the option setting and you select the curves in a different order.
Using Maya: Modeling
349
Creating surfaces Creating boundary surfaces
If Automatic is selected and you marquee-select the curves, you get this result.
3 If As Selected is selected, pick the curves in a different order to get a different result.
2 4
1
Setting common end points Common End Points
The Common End Points options let you decide whether or not the end points should match before the boundary surface is created. If you select Optional, the surface is created even if the end points don’t match (the ends of the curves don’t match). This is the default. If you select Required, the boundary surface is only built if the end points of the curves match exactly. See the following three-sided boundary surface. Notice how the curve end points are matched.
To make sure the end points match, remember to select a snap mode from the Status Line when drawing your curves.
350
Using Maya: Modeling
Creating surfaces Creating boundary surfaces
To match the end points after you draw the curves: Click to turn a snap mode on in the Status Line, such as Snap to grids.
2
While in component mode, select the edit point or CV you want to move.
3
Select the Move Tool and drag to snap the edit points or CVs to the same position.
NURBS Modeling
1
Click the Snap to grids icon. Select a component mode.
Click to select a point, use the Move Tool and drag to snap the points together.
Setting the end point tolerance If you select Required as the Common End Point option, you can change the End Point Tolerance value of the Local end points. Tolerance
Global tolerance means the Positional value you set in Options → General Preferences → Modeling are used. Positional tolerance is used to determine how close the end points need to be to be considered coincident. The default is Global.
Using Maya: Modeling
351
Creating surfaces Creating boundary surfaces
Local tolerance displays the following where you can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful where you want to change these values often, but don’t want to change the Global tolerance all the time.
Changing the curve point order and tolerance in the Channel Box You can toggle the curve Order or End Point selection by typing on or off in the boxes provided in the Channel Box. You can also set the tolerance of the end points by entering a value. These options are also available in the Attribute Editor.
Setting the curve range Curve Range
352
If you select Complete as the Curve Range, the boundary surface is built along the entire profile (or input) curve. This is the default.
Using Maya: Modeling
Creating surfaces Creating boundary surfaces
If Common End Points is set to Required, set the Curve Range to Complete. If you select Partial, the boundary surface is built along only part of the profile curves. This also enables you to change the curve range for any of the input curves using the Show Manipulator Tool, thus changing the boundary surface.
Editing part of a boundary surface If the curve range is set to Partial in the options window, you can use manipulators to edit the construction curves of the boundary surface. 1
Click the Show Manipulator icon and create the boundary surface.
2
Click one of the subCurve headings in the Channel Box to display the manipulators and edit the input curves.
Keep selecting subCurve headings to adjust the input curves as necessary.
Using Maya: Modeling
353
NURBS Modeling
Note
Creating surfaces Creating boundary surfaces
Choosing the output geometry Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Output Geometry
To change the number of polygons created for the surface when creating polyset data, use the Attribute Editor. The polygonal surface must be selected. Click the nurbsTesselate tab to display and edit the Tessellation Attributes and the Mesh Component Display.
Editing the boundary surface in the Attribute Editor To edit the completed boundary surface, use the Attribute Editor. To open the Attribute Editor, either:
354
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Creating surfaces Creating boundary surfaces
NURBS Modeling
Input Curves
The Attribute Editor for a boundary surface lists the read-only information for the input curves you used to build the surface. Click an arrow button to select an input curve, then click the tab to open its section of the editor. If Partial is the Curve Range in the options window when you create the surface, information for the subCurves is also available. The Order and End Point toggles, as well as the End Point Tolerance slider are included in the options window and the Channel Box. See the option descriptions on page 349 for details.
Using Maya: Modeling
355
Creating surfaces Creating birail surfaces
Creating birail surfaces Use the birail tools to create surfaces by combining three or four free-form curves that intersect. Available tools include Birail 1 Tool, Birail 2 Tool, and Birail 3+Tool. The curves you select can be boundary curves of an existing surface, isoparms, curves-on-surface, or trim boundaries. If you know which options to set before you create the birail surface, open the options window first, then use the tool to create the surface. Click the option box (❐) after the tool name to change the option settings. See the following for details about setting the options for each birail creation method: •
“Setting Birail 1 Tool options” on page 358
•
“Setting Birail 2 Tool options” on page 365
•
“Setting Birail 3+Tool options” on page 369 Alternately, you can create the birail surface with the default options and then open the Attribute Editor to edit the completed surface. See the following for details about the Attribute Editor for each birail creation method.
•
“Editing the single birail in the Attribute Editor” on page 362
•
“Editing the double birail in the Attribute Editor” on page 366
•
“Editing the multi birail surface in the Attribute Editor” on page 370
Tip To successfully build a birail surface, the input curves have to intersect the rail curves. If you are building birail surfaces from curves, make sure the profile curves cross the rail curves before you select the birail tools. Open all views to verify the intersection, or try using the front view.
356
Using Maya: Modeling
Creating surfaces Using the Birail 1 Tool
Using the Birail 1 Tool NURBS Modeling
Use the Surfaces → Birail 1 Tool to construct a surface by sweeping one profile curve along two rail curves. You can also construct the surface by reversing the selection order of the rail curves.
To build a birail surface from a single profile curve: 1
Select Surfaces → Birail 1 Tool.
2
Follow the prompts at the Help Line. Click the curve you want to use as the profile curve, then click the two rail curves. The surface is displayed in the construction history color by default.
3
Press Enter to complete the birail surface. Rail curves
Profile curve
Using Maya: Modeling
357
Creating surfaces Using the Birail 1 Tool
Setting Birail 1 Tool options Set the tool options before you create the birail surface. To open the options window, select Surfaces → Birail 1 Tool - ❐.
To change the options after the birail is created, use the Channel Box or the Attribute Editor. See “Editing the single birail in the Attribute Editor” on page 362 for details.
Controlling the resulting transformation Transform Control
358
As the profile curves are swept along the rails, you can scale them proportionally or non-proportionally while preserving the intersection with the two rail curves. Select either NonProportional or Proportional. NonProportional is the default.
Using Maya: Modeling
Creating surfaces Using the Birail 1 Tool
To change the transformation from proportional to non-proportional:
1
In the top view, create the two rail curves. Select Display → NURBS Components → Edit Points to display the edit points on the curves.
2
Click the Snap to points icon on the Status Line, place the first point of the profile curve, and click Snap to points again to turn snapping off.
3
In the front view, continue to place the points to create the profile curve. Select the Snap to points icon to snap the last point to the last rail curve (remember to turn snapping off afterward).
Using Maya: Modeling
359
NURBS Modeling
Construct the rail curves in the XZ plane. Construct the profile curve so that the internal CVs are at some constant Y. By scaling non-proportionally, the internal CVs of the birail surface also preserve the constant Y as the profile.
Creating surfaces Using the Birail 1 Tool
4
Build the birail surface, then while it is active, select a transform mode from the Channel Box. While the pointer is in the Transform Mode box, click with the right mouse button to select a Transform Mode from the pop-up menu.
The following example shows what happens to the birail surface when you switch between the transform modes.
Non-proportional
Proportional
Blending the profile curves Edge Blending
360
You can use the Edge Blending option, First Edge, only if the profile curve is a surface curve. If First Edge toggled on, the constructed surface is tangent continuous to the surface underlying the profile.
Using Maya: Modeling
Creating surfaces Using the Birail 1 Tool
Rebuilding profile or rail curves
Profile Curves
Since only one profile curve is necessary when building a single birail surface, First Edge is the only available Profile Curves rebuild option.
Rail Curves
For Rail Curves, the First Edge option refers to the first input rail curve you select when you build the surface. The Second Edge option refers to the second, or last, curve you select.
To display rebuild options and edit the profile and rail curves: If you toggle one of the Rebuild Options on, rebuild nodes are inserted between the profile curve or rail curves and the birail surface creation node. This means the profile curve or rail curves can be selected from the Channel Box and rebuilt using the parameters and options provided in the Channel Box or in the Attribute Editor. The following shows the Channel Box and Attribute Editor for a profile curve when rebuild is toggled on.
To access the Attribute Editor for the selected curve: •
Click the option box (❐) beside Rebuild Curve from the History list menu on the Status Line.
•
Click the option box (❐) beside Rebuild Curve from the Input pop-up menu in the marking menu.
Using Maya: Modeling
361
NURBS Modeling
Toggle one of the Rebuild Options on to rebuild a profile curve or rail curve before it is used to create the surface.
Creating surfaces Using the Birail 1 Tool See “Rebuilding curves” on page 199 for details about the options provided in this Attribute Editor.
Choosing the output geometry Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Output Geometry
Editing the single birail in the Attribute Editor To edit the completed single profile birail surface, use the Attribute Editor. To open the Attribute Editor, either:
Transform Mode
362
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The Transform Mode options are included in the options window and the Channel Box.
Using Maya: Modeling
Creating surfaces Using the Birail 1 Tool The Input Profile, and Input Rail 1 and Rail 2 information is read-only. It gives you access to the input curves you used to build the birail surface. Click the arrow buttons to select the curves if you want to edit them.
Tangent Continuity Profile
The Tangent Continuity Profile toggle lets you turn tangent continuity on or off for the input profile curve. You can use this to make the resulting surface tangent continuous to the surface underlying the profile curve. You can also toggle this option on or off in the Channel Box in the Tangent Continuity Profile box.
Note For this toggle to take effect, the profile curve must be a curve-on-surface.
Using Maya: Modeling
363
NURBS Modeling
Input Profile / Input Rails
Creating surfaces Using the Birail 2 Tool
Using the Birail 2 Tool You use the Surfaces → Birail 2 Tool to create a surface by blending two profile curves along two rail curves.
To build a birail surface from two profile curves:
364
1
Select Surfaces → Birail 2 Tool.
2
Follow the prompts at the Help Line. Click the curves you want to use as the profile curves, then click the curves you want to use as the rail curves. The surface is displayed in the construction history color by default.
3
Press Enter to construct the double profile birail surface.
Using Maya: Modeling
Creating surfaces Using the Birail 2 Tool
Setting Birail 2 Tool options
To change the options after the birail is created, use the Channel Box or the Attribute Editor. See “Editing the double birail in the Attribute Editor” on page 366 for details. Most of these options are included in the Birail 1 Tool options window. See “Setting Birail 1 Tool options” on page 358 for details. Since you need two profile curves to create a double profile birail surface, an extra Edge Blending toggle (Second Edge) and profile curve Rebuild Option toggle (Last Edge) is included in this options window. Surface Blend is the only option that is not included in the Birail 1 Tool options window. Using Maya: Modeling
365
NURBS Modeling
You can set the tool options before you create the birail surface. To open the options window, select Surfaces → Birail 2 Tool - ❐.
Creating surfaces Using the Birail 2 Tool
Defining the surface blend The Surface Blend factor value lets you alter the degree of influence the profile curves have on the intermediate profiles of the created surface. For example, a value of 1.0 means the first selected profile curve has a greater influence than the second profile curve. By default, both selected profiles have an equal influence value of 0.5.
Surface Blend
You can also change the Surface Blend value in the Channel Box. While the birail surface is active, click the heading to display the parameters and enter a new value in the Blend Factor box.
Click to display parameters. Enter a new blend value here if necessary.
Editing the double birail in the Attribute Editor To edit the completed double profile birail surface, use the Attribute Editor. To open the Attribute Editor, either:
366
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Creating surfaces Using the Birail 2 Tool
NURBS Modeling
The Transform Mode and Blend Factor options are included in the options window and the Channel Box. See “Controlling the resulting transformation” on page 358 for details about Transform Mode, and “Defining the surface blend” on page 366 about Blend Factor. Input Profile / Input Rail
Because you use four curves to create a double-profile birail surface, the Input Profile and Input Rail information boxes list all of the curves you used as profile and rail curves. This gives you access to the input curves you used to build the birail surface. Click the arrow buttons to select the curves if you want to edit them.
Tangent Continuity Profile
The Tangent Continuity Profile toggles let you turn continuity on or off for the input profile curves. Using this toggle, you can build a tangent continuous surface with the surfaces underlying the profile curves. You can also toggle this option in the Channel Box by typing on or off in the Tangent Continuity Profile boxes. The Tangent Continuity Profile toggles are only valid provided the profile curve is a surface curve (isoparm, trimmed edge, curve-on-surface).
Using Maya: Modeling
367
Creating surfaces Using the Birail 3+ Tool
Using the Birail 3+ Tool You use the Surfaces → Birail 3+ Tool to create a surface by blending multiple profile curves along two rail curves.
To build a birail surface from multiple profile curves:
368
1
Select Surfaces → Birail 3+ Tool
2
Follow the prompts at the Help Line. Select three or more profile curves, then press Enter to confirm your choice.
3
Select the two rail curves. The surface is displayed in the construction history color by default.
4
Press Enter to construct the birail surface.
Using Maya: Modeling
Creating surfaces Using the Birail 3+ Tool
Setting Birail 3+Tool options
To change the options after the birail is created, use the Channel Box or the Attribute Editor. See “Editing the multi birail surface in the Attribute Editor” on page 370 for details. Most of these options are included in the Birail 1 Tool options window. See “Setting Birail 1 Tool options” on page 358 for details. Since you need two profile curves to create a multi profile birail surface, an extra Edge Blending toggle (Second Edge) and profile curve Rebuild Option toggle (Last Edge) is included in this options window.
Using Maya: Modeling
369
NURBS Modeling
You can set the tool options before you create the birail surface. To open the options window, select Surfaces → Birail 3+ Tool - ❐.
Creating surfaces Using the Birail 3+ Tool
Editing the multi birail surface in the Attribute Editor To edit the completed multi profile birail surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Input Profile / Input Rail
Because you use multiple curves to create a multi-profile birail surface, the Input Profile and Input Rail information boxes list all of the curves you used as profile and rail curves. This gives you access to these input curves you used to build the birail surface. Click the arrow buttons to select the curves if you want to edit them.
Tangent Continuity Profile
The Tangent Continuity Profile toggles let you turn continuity on or off across the first to last profile curve.
370
Using Maya: Modeling
Creating surfaces Using the Birail 3+ Tool
For this toggle to take effect, the profile curves must be curves-on-surface. You can also toggle this option in the Channel Box by typing on or off in the Tangent Continuity Profile boxes.
Type on or off
You can also select a different Transform Mode (Proportional or Non proportional) in the Channel Box. While the birail surface is active, select a transform mode from the Channel Box. While the pointer is in the Transform Mode box, click with the right mouse button to select a Transform Mode from the pop-up menu. See “Controlling the resulting transformation” on page 358 for details.
Using Maya: Modeling
371
NURBS Modeling
Note
Creating surfaces Using the Birail 3+ Tool
372
Using Maya: Modeling
NURBS Modeling
8
Editing Surfaces The following topics are described in this chapter. •
“Trimming surfaces” on page 373
•
“Untrimming a trimmed surface” on page 378
•
“Planar trimming” on page 380
•
“Intersecting surfaces” on page 385
•
“Projecting curves” on page 390
•
“Rebuilding surfaces” on page 397
Trimming surfaces Use Edit Surfaces → Trim Tool to trim a surface while retaining specified regions of the surface and discarding others. To trim a surface, you need curves-on-surface to use as trim curves. There are a number of ways to make these curves: •
Project a curve onto a surface using Edit Surfaces → Project Curve.
•
Draw a curve directly onto a surface by making the surface “live”. To do this, pick the surface, then select Modify → Make Live or click the Make Live icon on the Status Line.
•
Intersect surfaces (Edit Surfaces → Intersect Surfaces).
•
Use a fillet operation (such as Edit Surfaces → Circular Fillet) to create the trim curves you need. If you know which options to set before you trim the surface, open the options window first, then use the tool to trim the surface. Click the option box (❐) after the tool name to change the option settings. See “Setting Trim Tool options” on page 375 for details. Alternately, you can trim the surface with the default options and then edit the trimmed surface from the Channel Box or the Attribute Editor. See “Editing a trimmed surface in the Channel Box” on page 376 and “Editing a trimmed surface in the Attribute Editor” on page 377 for details.
Using Maya: Modeling
373
Editing Surfaces Trimming surfaces
To trim a surface: Trim curves (or curves-on-surface) must exist on the surface you want to trim. An easy way to do this is to intersect the surfaces first. This example uses a NURBS plane and NURBS cylinder primitive. The part of the cylinder below the plane is trimmed. 1
Select both surfaces and select Edit Surfaces → Intersect Surfaces. Intersection curves (or trim curves) are displayed.
Trim curve
374
2
Deselect everything. Select Edit Surfaces → Trim Tool and click on the cylinder to display the trim grid.
3
Click on the trim grid in the area of the cylinder you want to keep. In this case, you want to keep the top. Press Enter.
Using Maya: Modeling
Editing Surfaces Trimming surfaces
NURBS Modeling
Important Note You cannot delete CVs on trimmed surfaces that were created without history. If you do, the surface remains untrimmed. Remember to leave history on if you think you may want to modify the trimmed surface by deleting CVs.
Setting Trim Tool options You can set the tool options before you trim the surface. To open the options window, select Edit Surfaces → Trim Tool - ❐.
To change the options after the surface is trimmed, use the Channel Box or the Attribute Editor. See “Editing a trimmed surface in the Channel Box” on page 376 and “Editing a trimmed surface in the Attribute Editor” on page 377 for details.
Selecting the trim state Selected State
If you want to keep the region you trimmed away, select Keep. To discard the region you trimmed away, select Discard. The default is Keep.
Using Maya: Modeling
375
Editing Surfaces Trimming surfaces
Shrinking the surface Shrink Surface
If Shrink Surface is toggled on, the underlying surface shrinks to just cover the retained regions. This permanently changes the surface geometry and cannot be restored by untrimming, but Undo will still work.
Keeping original geometry If Keep Original is toggled on, the original surface is retained after the trim is performed. If the surface and the curve-on-surface were created with construction history, you must keep the original geometry.
Editing a trimmed surface in the Channel Box Once you have trimmed an area out of a surface, you can use the Show Manipulator Tool to display a locator on the surface. You can edit the Locator parameters in the Channel Box. The following shows the Channel Box for a trimmed NURBS sphere.
Click the Show Manipulator icon. Click-drag to edit the trimmed surface area or enter values in the parameter boxes in the Channel Box.
376
Using Maya: Modeling
Editing Surfaces Trimming surfaces
Editing a trimmed surface in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The Attribute Editor for a trimmed surface contains the same attributes as the Channel Box and options window. See “Setting Trim Tool options” on page 375 and “Editing a trimmed surface in the Channel Box” on page 376 for details.
Using Maya: Modeling
377
NURBS Modeling
To edit the trimmed surface, use the Attribute Editor. To open the Attribute Editor, either:
Editing Surfaces Untrimming a trimmed surface
Untrimming a trimmed surface Use Edit Surfaces → Untrim Surfaces to undo previous trim operations. For example, if you trim a surface three times then select Untrim Surfaces, you can return to the original untrimmed surface. When a trimmed surface is untrimmed, all regions of the surface that were previously trimmed away are redisplayed, unless the Shrink Surface option was used in any trimming operation. The Shrink Surface option irreversibly cuts away portions around the surface edges that cannot be seen after the trim operation.
To untrim a surface: 1
Select the trimmed surface that you want to untrim.
2
Select Edit Surfaces → Untrim Surfaces. The trimmed surface is automatically untrimmed and all associated curves-on-surface are also redisplayed.
Setting Untrim options Select Edit Surfaces → Untrim Surfaces - ❐ to open the options window.
Keeping original geometry If you set Keep Original to On, the untrimmed surface is created and the original trimmed surface is retained. If you select Off, the untrimmed surface replaces the trimmed surface. The default is Off.
378
Using Maya: Modeling
Editing Surfaces Untrimming a trimmed surface
Setting the untrim order Select All to remove all trimming information from the surface. All curveson-surface are also re-displayed. All is the default. Select Last to cancel the last trim operation. For example, if a surface had been trimmed three times, this option shows the result as if had only been trimmed the first two times.
Using Maya: Modeling
379
NURBS Modeling
Untrim
Editing Surfaces Planar trimming
Planar trimming Use Edit Surfaces → Planar to create a trim surface from one or more planar curves.
Important Make sure that the curve you want to use in a planar trimming operation is a closed curve, a planar curve, or that multiple curves form a closed region. Open the Outliner window to verify that the curve is closed, planar, or that there is a closed area when using multiple curves. For more details, see “Opening and closing curves and surfaces” on page 133.
To make a trimmed surface from a single closed curve: Click on a closed curve or surface isoparm and select Edit Surfaces → Planar. A trimmed surface is created indicated by the grid that fills the curve. In this example you use the isoparm of a NURBS sphere.
380
Using Maya: Modeling
Editing Surfaces Planar trimming
Setting Planar Trim Surface options NURBS Modeling
Select Edit Surfaces → Planar - ❐ to open the options window.
Selecting the resulting surface degree Degree
Select either Linear (degree 1) or Cubic (degree 3) for the Degree if the output is a NURBS surface. Cubic is the default.
Setting the curve range Curve Range
Set the Curve Range to Complete to create the planar surface along the entire curve. When you set the Curve Range to Partial you can display manipulators on the planar surface with the Show Manipulator Tool and edit the resulting planar surface along part of the input curve. Click the input curve or isoparms’s heading in the Channel Box to display the editable parameters.
Using Maya: Modeling
381
Editing Surfaces Planar trimming
Choosing the output geometry Output Geometry
Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Limitations Planar surfaces must remain planar. Although the boundary of a planar surface can be manipulated to change the shape of the surface, the surface must remain planar at all times. Although a planar surface can include cut-out areas or holes, the curves that define the holes must be co-planar with the main surface.
Creating trimmed surfaces from open curves You do not necessarily need a single boundary curve to create a trimmed surface, however, you do need an enclosed region. This can be created by intersecting several curves. You can create trimmed surfaces using curves with overlapping boundaries. Marquee-select the curves and use Edit Surfaces → Planar to create the trimmed surfaces.
Original curves
Planar Trimmed surface
382
Using Maya: Modeling
Editing Surfaces Planar trimming
Editing the planar surface in the Channel Box
Degree
With the right mouse button, place the pointer in the Degree box and select Cubic or Linear from the pop-up menu. See “Selecting the resulting surface degree” on page 381 for details. The following shows a default cubic degree planar surface, and what happens when you select Linear.
Note Different degree curves can be mixed together. For example, a polygonal curve (degree 1) can be used to define the cut-out area or hole within the boundary of a cubic curve, as long as both curves are co-planar. Keep Outside
Type on or off in the Keep Outside box to specify whether you want the trimmed result on the inside or on the outside of the surface. The following shows the default trimmed surface on the inside (off). This means that the planar trimmed curve (the isoparm in this case) remains on the inside of the surface.
Using Maya: Modeling
383
NURBS Modeling
While the planar surface is active, click it’s heading to display the available parameters.
Editing Surfaces Planar trimming
When you type on, a planar trimmed surface is created outside of the surface and a hole is trimmed away from the center.
Editing the planar surface in the Attribute Editor The Attribute Editor for a planar trimmed surface includes the options you set in the Channel Box and options window, as well as a local tolerance slider. Change the slider value to adjust the trimmed surface’s tolerance.
384
Using Maya: Modeling
Editing Surfaces Intersecting surfaces
Intersecting surfaces To intersect two objects: In the following example, a NURBS primitive plane and cylinder are used as the two surfaces. 1
Marquee-select the two surfaces you want to intersect.
2
Select Edit Surfaces → Intersect Surfaces.
3
A curve-on-surface, or trim curve, is created.
Trim curve
You can now use the Trim Tool (Edit Surfaces → Trim Tool) to trim the top or bottom half of the cone.
Using Maya: Modeling
385
NURBS Modeling
Use Edit Surfaces → Intersect Surfaces to intersect one object with another. This is a quick way to create trim curves for future surface modification.
Editing Surfaces Intersecting surfaces
Note If many surfaces are selected, for example, ten, the last selected surface is the target surface. This means each of the first nine selected surfaces are intersected with the tenth surface.
386
Using Maya: Modeling
Editing Surfaces Intersecting surfaces
Setting Intersect options
Creating a curve-on-surface for a specified surface Create Curves for
If you select First Surface, only the first surface selected (the target surface) receives a curve-on-surface. If you select Both Surfaces, the target surface and the surface selected as the intersecting surface both receive curves-on-surface. This is the default.
Note If you select multiple surfaces, for example 10, the last selected surface is the target surface. This means each of the first nine selected surfaces are intersected with the tenth surface.
Setting the resulting curve type Curves On Surface
The Curves On Surface option creates a curve-on-surface as the intersection curve. This is the default.
3D World
The 3D World option creates a NURBS curve in the 3D world space—this means that the curve is not a curve-on-surface and cannot be used to trim the surface later on.
Using Maya: Modeling
387
NURBS Modeling
Select Edit Surfaces → Intersect Surfaces - ❐ to open the options window.
Editing Surfaces Intersecting surfaces
Note Text cannot be intersected with a target surface because text are curves and you cannot intersect a surface and a curve. To intersect text, you must create the text as trim surfaces. See “Creating and editing text” on page 235 in Chapter 5, “Creating and Editing Objects,” for details.
Setting the tolerance Use Tolerance
The Use Tolerance options let you intersect within a specified tolerance of the default intersection. You can apply tolerance globally or locally. If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling is used.
If you select Local tolerance, the following box displays. Enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful where you want to change these values often, but don’t want to change the Global tolerance all the time.
388
Using Maya: Modeling
Editing Surfaces Intersecting surfaces
Editing the intersection in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. To access the Attribute Editor for an intersection surface, click the arrow beside an Input Surface box.
To access the Attribute Editor for an intersection curve, select the option box (❐) from the Objects menu in the Channel Box.
Using Maya: Modeling
389
NURBS Modeling
The Channel Box and Attribute Editor for an intersected surface display the tolerance you set in the options window. To open the Attribute Editor, either:
Editing Surfaces Projecting curves
Projecting curves Use Edit Surfaces → Project Curve to project a curve or set of curves onto a surface or set of surfaces. This creates curves-on-surface (or trim curves).
To project curves: The following example uses the default option settings. Because it is important which view is active when you use Project Curve, the projection is performed in the front view. See “Making sure the projection works in the active view” on page 392 for more information about the Active View option. 1
Place and scale a NURBS sphere primitive. Click to deselect it.
2
Create a text curve (Primitives → Create Text - ❐) and scale it. Place the text in the center of the sphere. See “Creating and editing text” on page 235 for details about text creation.
front view
390
perspective view
3
While in the front view, marquee-select the text and the primitive.
4
Select Edit Surfaces → Project Curve. Notice how the text is projected onto the primitive in the perspective view.
Using Maya: Modeling
Editing Surfaces Projecting curves 5
Select the original text curve only and press the Backspace key. NURBS Modeling
Setting Project Curve options Select Edit Surfaces → Project Curve - ❐ to open the options window.
Projecting curves in the active view Project Along
Use the Active View and Surface Normal options to specify whether the projection will be normal to the active view or to the surface normal direction. Active View, the default, means that the projection occurs in the direction of the normals in the active view. For example, if the front view is active, the curve is projected along the Z axis (the axis normal to the front view). Using Maya: Modeling
391
Editing Surfaces Projecting curves
Making sure the projection works in the active view If you project curves using the Active View option, you have to decide which view you want active before you use the function. It is important to make sure the selected curve (or set of curves) is projected along the perpendicular (normal) axis of the current view. In the following, the projection was attempted while the perspective view was active. As you can see, the curve is not projected correctly.
Projecting while the front view is active works because the perpendicular direction of the projection is relative to the surface normals of the front view.
392
Using Maya: Modeling
Editing Surfaces Projecting curves
Projecting curves using surface normals If you project curves using the Surface Normal option, you can project a curve onto the selected surface in one view and then use the same curve to project onto additional surfaces in any other view. The active view is not important if you project while this option is selected. If you select Surface Normal, make sure you move the curve to the outside of the surface.
Since the curve lies on the axis of revolution inside the surface, if the curve is inside the surface the projection will either take a long time to complete or it will fail.
Setting the projected curve’s tolerance Use Tolerance
The Use Tolerance options let you project the curve within a specified tolerance of the original curve. You can apply tolerance globally or locally. If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling is used.
If you select Local tolerance, you can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Using Maya: Modeling
393
NURBS Modeling
Surface Normal
Editing Surfaces Projecting curves
Local tolerance is useful where you want to change these values often, but don’t want to change the Global tolerance all the time.
Setting the curve range Curve Range
Set the Curve Range to Complete to project the entire curve onto the surface. Select the Curve Range to Partial to project only part of the curve onto the surface. This creates a “subCurve” history node (initially set to the whole curve) which can then be edited using the Show Manipulator Tool.
Note The Show Manipulator Tool can be used to edit the parameter range of the curve used in the project operation only if the Partial option is selected. No other parameters of the projected curve have associated manipulators.
Editing projected curves in the Channel Box Click the projectCurve heading to display its associated parameters.
394
Using Maya: Modeling
Editing Surfaces Projecting curves
Note If the Project Along mode is set to Surface Normal, the Direction values in the Channel Box have no effect.
Editing part of the projected curve using the Show Manipulator To edit the parameter range of a projected curve with history, select the subCurve history. Click the heading in the Channel Box to select the subCurve history node, then click the Show Manipulator icon on the Status Line to display the manipulators.
Drag the manipulators to edit the subCurve interactively, or enter values in the Min and Max value boxes in the Channel Box or from the Numerical Input line when a manipulator is active.
Using Maya: Modeling
395
NURBS Modeling
Enter values in the boxes to change the X, Y, Z direction of the projection, or adjust the local tolerance value. You can type on to toggle the projection along the surface normals instead of in the active view. These options are also available in the options window and the Attribute Editor. See the option descriptions for details.
Editing Surfaces Projecting curves
Editing projected curves in the Attribute Editor To edit the projected curve, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The options you set in the options window or the Channel Box are displayed. See the option descriptions for details. Input Surface / Input Curve
The Input Surface and Input Curve information is read-only. It gives you access to the history of the surfaces and curves you used to project the curve onto. Click the arrow buttons to select the surface or curve then click the tab to open its section of the editor.
Use Normal
The Use Normal toggle is toggled on if you choose to project the curve along the surface normals.
396
Using Maya: Modeling
Editing Surfaces Rebuilding surfaces
Rebuilding surfaces NURBS Modeling
Use Edit Surfaces → Rebuild Surfaces to modify the surfaces by: •
changing the surface degree (increase or reduce)
or •
changing the surface by adding or removing patches in either or both parametric directions
To rebuild a surface: 1
While the surface geometry you want to rebuild is active, select Edit Surfaces → Rebuild Surfaces.
2
The surface is rebuilt within the best possible and geometric parameters.
Original surface
3
Default rebuild
If necessary, change the settings in the options window, Channel Box, or the Attribute Editor and rebuild the surface again. In the following, a rebuilt birail surface is modified by changing the surface degree in U from 3 Cubic (the default) to 1 Linear in the options window.
Using Maya: Modeling
397
Editing Surfaces Rebuilding surfaces
Keeping the original surface If Keep Original is toggled on in the options window, a new surface is rebuilt on top of the original and becomes the active surface. You can move it and select the original surface to try different option settings. This lets you compare the results and delete the surfaces you don’t want. You can also select this surface from the Channel Box by clicking the heading to display and edit its parameters.
398
Using Maya: Modeling
Editing Surfaces Rebuilding surfaces
Setting Rebuild Surfaces options
Note The Rebuild Surface options window changes to include the options associated with a selected option setting, or hide the options you don’t need.
Changing the surface rebuild type There are various options you can set to rebuild your surfaces to suit your needs. The options window changes depending on the Rebuild Type you select.
Using Maya: Modeling
399
NURBS Modeling
Select Edit Surfaces → Rebuild Surfaces - ❐ to open the options window.
Editing Surfaces Rebuilding surfaces Uniform
Use the Uniform option to rebuild the surface into a uniform knot surface of the required degree and number of spans. If Keep Original is toggled on, you can see the deviation of the resulting surface from the original surface. When you select Uniform, the Number of Spans in the U/V value boxes become available. You can enter a value in the boxes or use the slider bar. When you press the Rebuild button after you change the values, the surface is rebuilt as a uniform knot surface of a specified degree and number of spans.
Reduce
If you select the Reduce option, a knot is removed only if its removal does not cause any of the remaining CVs to move by a distance greater than the tolerance setting. A higher tolerance setting results in a greater span reduction. When you select this option, or the Non-Rational option, (see “NonRational” on page 400), the window changes to hide unnecessary options and adds the Use Tolerance options at the bottom of the window. See “Setting the surface’s tolerance” on page 402 for details.
Match Knots
Another surface is required if you want to use this option. Select Match Knots to rebuild the surface to match the knot values, degree, and number of spans of another surface. The Keep toggles, Corners and CVs, are available when you select this rebuild type.
No Multiple Knots
Select No Multiple Knots to remove all the multiple knots. The resulting surface is of the same degree as the original surface. The Keep toggles are not available when you select this option.
Non-Rational
Select Non-Rational to insert more edit points in the areas of higher curvature. The resulting surface is of the same degree as the original surface. The Keep toggles are not available when you select this option, however the Use Tolerance options are displayed. See “Setting the surface’s tolerance” on page 402 for more information.
Setting the parameter range Parameter Range
The three Parameter Range options are used to specify how U and V parameters are affected during the rebuild. Select 0 to 1 if you want the resulting surface’s U and V parameters to run from 0 to 1. Select Keep if you want the rebuilt surface’s U and V parameter ranges to match those of the original surface.
400
Using Maya: Modeling
Editing Surfaces Rebuilding surfaces
Removing knots in a specific direction Direction
The Direction options, U, V, U and V, are used to determine the parametric direction of the surface in which knots will be removed. For example, if U is selected and the rebuild type is No Multiple Knots, only the multiple knots in the U direction are removed when the surface is rebuilt. U and V is the default.
Selecting elements of the original surface to keep Keep
Rebuilding a surface may change the surface in 3D. Use the Keep options to ensure the rebuilt surface conforms to the input (or original) surface. Toggle Corners on to ensure that the corners of the new surface are at the same 3D point as the original corners.Toggle CVs on to specify whether or not you want to keep the CVs of the original surface.
Changing the number of U and V surface spans Number of Spans U / V
If Uniform is the rebuild type, the number of spans in the resulting surface can be set by the value you enter in the Number of Spans U/V boxes. Use the slider or enter a value.
Changing the surface degree Degree U/V
The degree of the resulting surface is determined by the Degree U or Degree V you select. You can select either 1 Linear, 2, 3 Cubic, 5, or 7. See the description “What is the curve degree?” on page 55 for information on curve degrees. In the following, the surface is rebuilt when 2 is Degree U.
Default 3 Cubic in U
U Degree changed to 2
Using Maya: Modeling
401
NURBS Modeling
Select 0 to # spans if you want the resulting surface’s spans to give you integer knot values. These values make it easier for numerical input. If using the Uniform rebuild type this option always gives you integer knot values. For example, if you want to use Detach and you prefer to type a value, it is easier to enter the number 2 than something like 0.362.
Editing Surfaces Rebuilding surfaces
Setting the surface’s tolerance Use Tolerance
The Use Tolerance options let you rebuild the surface within a specified tolerance of the original surface. You can apply tolerance globally or locally. If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling is used.
Select Local tolerance to display the following box. You can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful where you want to change these values often but don’t want to change the Global tolerance all the time.
Keeping original geometry The Keep Original toggle is used to specify if the original surface is retained after it is rebuilt, or if it is automatically replaced by the new one. When toggled on, the original surface is retained. Keep Original is off by default.
Choosing the output geometry Output Geometry
Select either Nurbs or Polygons for the output geometry type. NURBS surfaces are created by default. See “Converting NURBS to polygons” on page 252 for more information on the Polygons options.
Editing the rebuilt surface in the Channel Box You can also enter values in the parameter boxes provided in the Channel Box to select and edit a specific rebuilt surface.
402
Using Maya: Modeling
Editing Surfaces Rebuilding surfaces
When the surface is rebuilt, if Keep Original is toggled on, the original surface is deselected and the resulting surface is active. If the rebuild is not successful, the temporary surface is not created and the original surface remains active.
Editing the rebuilt surface in the Attribute Editor To edit a rebuilt surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
403
NURBS Modeling
For example, if you rebuild the surface three times and Keep Original is toggled on, a heading for each surface is provided in the Channel Box. Click the heading for the surface you want to edit, and enter new values or select options from the pop-up menus.
Editing Surfaces Rebuilding surfaces The options you set in the options window or the Channel Box are displayed. See the option descriptions for details.
The following additional options are included for a rebuild surface operation: Input Surface
The Input Surface information is read-only. It gives you access to the history of the surfaces you rebuilt. Click the arrow buttons to select the surface then click the tab to open its section of the editor.
Match Surface
If there is more than one surface and Match Knots is selected in the options window, you can also access the Match Surface rebuilt surface.
404
Using Maya: Modeling
Index Numerics 0 to # spans Rebuild Curve parameter range 204 Rebuild Surfaces option 401 0 to 1 Rebuild Curve parameter range 203 Rebuild Surfaces option 400 3D coordinate system 243 3D Delta 3D spacing 255 NURBS to Polygon option 255 3D World Intersect Surfaces option 387
A
axis change direction of 30 change origin of 30 description 29 display indicators 29 in Attribute Editor 29 local, display 29 NURBS primitive, change direction of 214 Axis Definition for NURBS primitives 214 axis manipulators for revolve 280 axis of revolution specify 285 Axis Preset 285 Free 286 Revolve options 285 AxisEndPoint manipulator 212 AxisManips curve editor manipulator 87 axisMidPoint manipulator 212 AxisStartPoint manipulator 212
B Bevel, NURBS 303 Bevel Depth option 311 Bevel Width option 311 change in Attribute Editor 314 change options 308 reverse direction 306 Bias Fillet Curve option 131 Freeform Fillet option 269 Stitch Surface Points 341 Stitch Tool option 335, 338
Using Maya: Modeling
405
Index
Active View Offset Curve option 112 Project Curve option 390, 391, 392 Add Points Tool 88 align curve tangents, with Curve Editor 87 Align Curves 165 change in Attribute Editor 180 change in Channel Box 178 change options 172 Align Surfaces 165 change in Attribute Editor 180 change in Channel Box 178 change options 172 Arc Length Tool 41
arc lengths locator 41 measuring 41 As Selected Boundary option 349 Assign Equal Weights Stitch Surface Points option 340 At Path Extrude option 320 At Profile Extrude option 320 Attach Align Curves option 172 Align Surfaces option 172 Attach Curves change in Attribute Editor 155 change options 154 Attach Surfaces Bevel option 309 change in Attribute Editor 155 change options 154 Attribute Editor accessing 22 edit curves in 79 using for NURBS 22 Auto Reverse Loft option 297 Automatic Boundary option 349 Automatic Blend Direction 275 Fillet Blend Tool option 275 avgCurves node for Stitch Surface Points 344
Index
Birail 1 Tool 357 change in Attribute Editor 362 change options 358 Birail 2 Tool 364 change in Attribute Editor 366 change options 365 Birail 3+ Tool 368 change in Attribute Editor 370 change options 369 birail surfaces creating 356 Birail Tools change in Attribute Editor 362 change in Channel Box 361 change options 358 Blend Fillet Curve option 130 Blend Control Fillet Curve option 130 Blend Edge Stitch Tool option 336 Blend Factor Birail 2 Tool option 366 Blend Points Stitch Tool option 336 blended surface create 271 Blending Stitch Tool options 332 blocking nodes in Attribute Editor 25 Both Bevel option 310 Reverse Surfaces option 197 Both Surfaces Intersect Surfaces option 387 Bottom Side Bevel option 310
406
Using Maya: Modeling
Boundary 346 change in Attribute Editor 354 change in Channel Box 352 change options 349 create four-sided 346 create three-sided 347 boundary normals flip 275 Bounding Box for curves in Attribute Editor 83 Bounding Box attributes 230
C C0 positional continuity 328 Cascade Stitch Node Stitch Surface Points option 340 Cascade Stitch Nodes Stitch Tool option 334 Channel Box editing subCurves in 14 select history node in 13 Checkpoints Density Offset Curve On Surface option 117 Chord Height Ratio NURBS to Polygons option 254 Chord height Ratio and polygon edge 254 Chord Length knot spacing 56 spacing, for Loft 296 Chord length knots for CV curves 67 knots for edit point curves 72 Circle NURBS primitive 218
Circle Sweep manipulator primitives 211 circle sweep manipulator 281 Circular Extend Curve option 103 Fillet Curve option 129 Offset Curve option 113 Circular Arcs Bevel corner option 311 circular curve fillets creating 123 Circular Fillet 259 change in Attribute Editor 265 change options 260 create trim curves 373 Close Loft option 298 Closest End Point Extrude pivot option 320 Common End Points Boundary options 350 Complete curve range Bevel 313 Boundary 352 Extrude 324 Loft 299 Offset Curve 116 Offset Curve On Surface 116 Planar 381 Project Curve 394 Revolve 290 Component Extrude pivot option 320 Component Display for curves, Attribute Editor 82 Components for curves, section of Attribute Editor 82 Concave Bevel edge option 312 Cone NURBS primitive 221
Index
Create Text 235 change in Attribute Editor 242 change options 235 transforming text 237 Cube NURBS primitive 223 Cubic Loft option 297 Planar option 381 Primitive option 215 Revolve option 287 cubic degree 3 curves 66 Curvature Align Curves option 174 Align Surfaces option 174 Project Tangent option 188 Rebuild Curve type 203 curvature continuity align curves with 174 align surfaces with 174 Curvature Scale Align Curves, Surfaces option 177 Project Tangent option 190 Curvature Scale Point manipulator for Project Tangent 191 curve degree description 67 Curve Editing Tool 84 change curve position 84 change curve tangent 84 curve extension, attach 104 curve extension, join 104 curve fillets creating circular 123 creating freeform 126
curve on surface creating 75 creating with intersection 387 CV curve, create with 63 duplicating 141 edit point curve, create with 69 offset 110 using freeform surface fillets 268 Curve Range Bevel options 312, 313 Boundary options 352 change to display manipulators 11 Extrude options 324 Loft options 299 Offset Curve options 116 Planar options 381 Project Curve options 394 Revolve options 290 curve range Partial, for offset curves 116 curve segments deleting 58 curve shape history 81
Index
Connect Breaks Offset Curve options 113 Construction Project Tangent options 188 construction history 250 delete 251 deleting 3 icon 3 use with Attach Curves 148 using 2 Construction Plane 232 options 233 transforming 234 Continuity Align Curves options 173 Align Surfaces options 173 toggles for Stitch Tool 335 continuity positional 328 positional, change for stitch 332 tangent 328 tangent, change for stitch 332 Control Vertex select, from marking menu 65 control vertex 4 Convex Bevel edge option 312 Corners Rebuild Surfaces option, keep 401 Count NURBS to Polygon option 256 tessellate method 256 Create text button 237 Create Curve On Surface Circular Fillet option 261 create curve on surface using circular fillets 261 Create Locator 31
Using Maya: Modeling
407
Index
curves add points to 88 align tangent 87 basic information 53 change degree 66 circular extension 103 create beveled surface with 303 create lofted surface with 293 create revolved surface with 279 create with CVs 62 create with edit points 69 creation methods 54 Cubic, degree 3 55 curve degree 55 CV hardness 90 CVs, transforming 63 degree 1 55 degree 3 55 degree 5 55 degree 7 55 direction 54 duplicating 139 edit in Attribute Editor 79 extend to point 102 extending 100 extrapolate extension 103 Heptic, degree 7 55 insert knots 93 linear extension 103 Linear, degree 1 55 move periodic start point 158 multiplicity for 90 offset 107 offset curves on surface 107 parameter position, change 85 projecting tangents 186 Quadratic, degree 2 55 Quintic, degree 5 55 shape history in Attribute Editor 81 text type 241
408
Using Maya: Modeling
transform in Attribute Editor 80 transform tangent 85 transforming CVs 63 trim curves, creating 75 Curves On Surface Intersect Surfaces option 387 curveShape tab in Attribute Editor 81 Cutting Radius Offset Curve option 114 CV curve chord length knot spacing 67 multiple end knots 68 uniform knot spacing 67 CV Curve Tool 61 CV Hardness 90 change in Attribute Editor 91 change options 90 CV index Stitch Surface Points option 343 CV Position Stitch Surface Points option 343 CVs create curve with 61 deleting surface CVs 59 description 4, 57 Rebuild Curve, Keep toggle 204 Rebuild Surfaces option, keep 401 selecting 57 transforming 63 Cylinder and Show Manipulator 211 NURBS primitive 219
D Degree Planar option 381, 383 Rebuild Curve option 204 Rebuild Surfaces option 401 degree change for curves 66 change for CV curve 67 change for edit point curve 71 change for pencil curve 74 degree 1 linear geometry 215 degree 3 B-spline geometry 215 degree type geometry, changing 215 Delete All by Type construction history 3 Delete by Type construction history 3 Depth Fillet Curve option 130 Freeform Fillet option 269 depth change for Bevel 311 DepthPoint bevel manipulator 306 Detach Curves 156 change in Attribute Editor 162 change options 161 Detach Surfaces 156 change in Attribute Editor 162 change options 161 Direction detached curve direction 163 detached surface direction 163 Rebuild Surfaces options 401 Direction Vector change, for Extrude 319 Extrude options 319
Index
Discard Trim Tool option 375 Display section in Attribute Editor 81 section of Attribute Editor 231 Display attributes 231 Display Local Axis in Attribute Editor 29 display with marking menu 21 Distance Extend Curve option 101 Extrude option 318 distance locator 35 measuring 33 Distance Tool 33 Duplicate Curves 139 change in Attribute Editor 147 change options 146 duplicating curves 139 for trimming 142 duplicating curves on surface 141 duplicating isoparms 139
E
F Fillet Blend Tool 271 change in Attribute Editor 278 change options 274 Fillet Curve 123 change in Attribute Editor 131 change options 128 Circular option 123 Freeform option 123 fillet curves creating circular 123 creating freeform 126 filleting blending surfaces 271 circular surface fillet 259 freeform surface fillets 266 surfaces 259 First Edge Birail Tool options 360 First Surface Intersect Surfaces option 387 Fit B-Spline 120 change options 121 Fit B-spline change in Attribute Editor 122 Fix Boundary Stitch Surface Points 341 Stitch Tool option 335, 338 Flat Extrude style option 317 Flat Shade shading mode 249 flip both boundary normals 275 boundary normals 275 first boundary normal 275 second boundary normal 275 Font changing 236, 237
Using Maya: Modeling
409
Index
Edge Blending Birail Tool options 360 Edge Swap NURBS to Polygons option 256 edit point description 4, 58 selecting 58 edit points create curve with 69 Rebuild Surface, insert more using 400 transforming 70
End Point Boundary toggle 355 end points match for Boundary surfaces 351 End Sweep Angle 214 Revolve option 288 EndParam bevel manipulator 307 Ends Rebuild Curve, Keep toggle 204 EP Curve Tool 69 Extend Curve 100 change in Attribute Editor 106 change options 101 extend curve circular type 103 curve to point 102 extrapolate type 103 in Channel Box 105 linear type 103 start and end points 103 Extend Curve At End 103 Extend Curve option 103 Start 103 extend curve to point 102 Extend Method Extend Curve options 101 Extension Type Extend Curve options 103 Extrapolate Extend Curve option 103 Extrude change in Attribute Editor 326 change options 317 Extrude Height Bevel option 311 Extrude Length Extrude option 318 Extrude, NURBS 316
Index
Fractional Tolerance NURBS to Polygons option 254 Free change axis definition 214 Extrude option 320 Revolve option 286 specify extrude vector 320 Free Axis Preset 285 Freeform Fillet Curve option 129 freeform curve fillets creating 126 Freeform Fillet 266 change in Attribute Editor 270 change options 269 Freeform Type Fillet Curve options 130 Full CV hardness option 91
G G1 tangent continuity 328 General NURBS to Polygons option 255 tessellate method 255 Geometry Average Offset Curve option 112
410
Using Maya: Modeling
Global tolerance for Bevel 314 for Boundary 351 for Circular Fillet 264 for Fillet Blend 276 for Fit B-spline 121 for Freeform Fillet 269 for Intersect Surfaces 388 for Offset Curve 115 for Primitives 216 for Project Curve 393 for Rebuild Curve 202 for Rebuild Surfaces 402 for Revolve 289 Group With Original Duplicate Curves option 146
H height change for primitives 224 height ratio change for primitives 219 HeightPoint bevel manipulator 305 heptic degree 7 curves 66 history delete 3, 251 using 2 History attributes 228 History list menu add subCurves to 17 Complete list 17 history node select from History list 13 select from marking menu 12 select in Channel Box 13 select with Show Manipulator 12 history, construction 250
hull description 54
I Increase by insert isoparms 97 insert knots 97 Input Curve for subCurves 20 Insert Isoparms 93 change in Attribute Editor 98 change options 96 Insert key transform curves 63 Insert Knot 93 change in Attribute Editor 98 change options 96 Interior Blending Align Curves option 182 Align Surfaces option 185 Intersect and trimming, introduction 9 Intersect Surfaces 385 change in Attribute Editor 389 change options 387 create trim curves 373 option window 387 to trim surfaces 385 isoparm 245 isoparms change position, in Channel Box 95 duplicating 139 offset 107
J Join Fillet Curve option 128 join curve extension 104
Index
Join Parameter Align Curves slider 182 Join to Original Extend Curve option 104
K
L Last Untrim Surfaces option 379 length change for primitives 224 Limit Information for curves, in Attribute Editor 81 Limit Information attributes 231
Linear Extend Curve option 103 Loft option 297 Offset Curve option 113 Planar option 381 Primitive option 215 Revolve option 287 live surface create curve on surface 75 local axis display 29 Local tolerance for Bevel 314 for Blend Fillet 277 for Boundary 352 for Circular Fillet 265 for Fit B-spline 121 for Freeform Fillet 269 for Intersect Surfaces 388 for Offset Curve 115 for Primitives 215 for Project Curve 393 for Rebuild Curve 202 for Rebuild Surfaces 402 for Revolve 288 Location Attributes 228 locator arc length, create 41 arc length, move 42 create 31 distance, create 33 distance, move 35 parameter, create 38 parameter, move 39 reposition 31 transform 32 Loft 293 change in Attribute Editor 300 change options 296 create with curves 293 create with surface isoparms 295 degree, changing 297
Using Maya: Modeling
411
Index
Keep Align Curves option 172 Align Surfaces option 172 Attach Curves option 154 Attach Surfaces option 154 Rebuild Curve parameter range 203 Rebuild Curve toggles 204 Rebuild Surfaces option 400 Trim Tool option 375 Keep Original Align Curves option 178 Align Surfaces option 178 Attach Curves option 155 Attach Surfaces option 155 CV Hardness 91 Detach Curves 161 Detach Surfaces 161 Extend Curve 104 Fillet Curve 129 Insert Isoparms 97 Insert Knot 97 Open/Close Curve 135 Project Tangent option 191 Rebuild Curve option 205 Rebuild Surfaces 402 Reverse Curves, Surfaces option 196 Stitch Surface Points option 340 Stitch Tool option 334 Trim Tool option 376 Untrim Surfaces option 378 Keep Outside Planar option 383
knot change position, in Channel Box 95 knot spacing chord length 56 chord length, CVs 67 chord length, edit points 72 parameterization 56 uniform 56 uniform, CVs 67 uniform, edit points 72 knot surface uniform, with Rebuild Surface 400 knot values integer values, Rebuild Surface 401 match, with Rebuild Surfaces 400 knots remove in specific direction 401 knots, multiple remove with Rebuild Surface 400
Index
loop cutting, for offset curves 114 Loop Cutting Offset Curve options 114
M Make Live and trimming, introduction 8 create curve on surface 75 create trim curves 373
412
Using Maya: Modeling
manipulator(s) Align Curves, Surfaces 178 attributes, edit with 22 axis, for revolve 280 AxisManips, for curve editor 87 circle sweep, for revolve 281 Curvature Scale Point, for Project Tangent 191 Curve Editing Tool 84 DepthPoint, for bevel 306 EndParam, for bevel 307 HeightPoint, for bevel 305 marking menu, display 21 param, for circular curve fillets 125 param, for freeform curve fillets 126 parameter position, for curve editor 85 parameters, edit with 21 point position, for curve editor 86 Project Tangent 191 Reverse Curves 196 Rotation, Project Tangent 192 StartParam, for bevel 307 tangent direction, for curve editor 86 Tangent Scale Point, Project Tangent 192 tangent scale, for curve editor 86 WidthPoint, for bevel 306 match end points for Boundary surfaces 351 match knot values with Rebuild Surface 400 Match Knots Rebuild Curve type 202 Rebuild Surfaces option 400
Max Subdivision Density Offset Curve option 115 Measure Arc Length Tool 41 Distance Tool 33 menu 33 Parameter Tool 38 measure arc lengths 41 distances 33 parameters 38 Min/Max parameter values 20 Minimal Edge Length and polygon edge lengths 254 NURBS to Polygon option 254 Model Stats in Attribute Editor 246 Model Stats attributes 229 Modify Boundary Align Curves, Surfaces option 174 Modify Position Align Curves, Surfaces option 174 Modify Tangent Align Curves, Surfaces option 174 Multiple End Knots knots for CV curves 68 Multiple Knots Attach Curves options 154 Attach Surfaces option 154 multiple knots create when attaching 154 remove when attaching 154 remove, with Rebuild Surface 400
Index
Multiplicity change for insert knots 97 CV Hardness options 91 multiplicity change for insert isoparms 97 change, for curves 90
N
O Object pivot point option, primitives 214 Revolve option 287 Object Display for curves, Attribute Editor 83 Object Display attributes 230 Objects NURBS primitives introduction 207 Off Bevel type 310 Offset Curve, no connection 113 offset isoparm 108 Offset Curve 107 accuracy, obtaining 116 change in Attribute Editor 117 change options 112
Offset Curve On Surface 107 change options 117 Offset Distance Offset curve option 113 open lofted surface 298 Open/Close change in Attribute Editor 137 Curves 133 Curves, change options 135 Surfaces 133 Surfaces, change options 135 Optional Boundary option 350 Order Boundary toggle 355 Orientation Extrude options 321 origin 243 Override CV Position Stitch Surface Points option 343
P param manipulators for circular curve fillets 125 for freeform curve fillets 126 parameter locator 38 parameter direction 246 parameter position change for curves 85 Parameter Range Rebuild Curve options 203 Rebuild Surfaces options 400 Parameter Tool 38 Parameter U/V Stitch Surface Points option 342
Using Maya: Modeling
413
Index
No Multiple Knots Rebuild Curve type 202 Rebuild Surfaces option 400 None tolerance for primitives 215 Non-Rational Rebuild Surfaces option 400 Normal Project Tangent option 189 Stitch Surface Points option 342 Normal Direction Offset Curve options 112 normals boundary, flip 275 description 248 display 248 reverse direction 195, 249 reverse, with Circular Fillet 262 Number of Sections 216 Number of Spans 217 Rebuild Curve option 204 Rebuild Surfaces option 400, 401 Number U NURBS to Polygons option 256 Number V NURBS to Polygons option 256
Nurbs Curve History for curves, Attribute Editor 82 NURBS Curves introduction to 53 NURBS Modeling introduction to 1 tips, general 45 NURBS Surface History attributes 228 NURBS surfaces convert to polygons 252 NURBS To Polygons 252 change options 253 NURBS to Polygons change in Attribute Editor 257 NurbsSurfacePoints node For Stitch Surface Points 343
Index
parameter value change in Channel Box 16 display, Parameter Tool 38 Parameterization Loft options 296 parameterization description 56 parameters edit with manipulators 21 Partial select to display manipulators 11 Partial curve range Bevel 313 Boundary 353 Extrude 324 Loft 299 Offset Curve 116 Offset Curve On Surface 116 Planar 381 Project Curve 394 Revolve 290 patches description 245 Path Direction Extrude orientation option 321 Pencil Curve Tool 73 Pivot Extrude options 320 Object, Revolve option 287 Preset, Revolve option 287 pivot point Object, primitives 214 User Defined, primitives 214 pivot points description 26 displaying 26 reposition in Attribute Editor 28 Pivots section in Attribute Editor 81
414
Using Maya: Modeling
Pivots attributes 231 Planar 380 change in Attribute Editor 384 change in Channel Box 383 change options 381 trimming 380 Plane NURBS primitive 225 Point Extend Curve option 102 Point Constraints Stitch Surface Points option 342 Point position curve editor manipulator 86 points per span adjust for offset curve on surface 117 Pole Axis 233 Poly text type 241 polylines degree 1 curves 66 Position Align Curves option 173 Align Surfaces option 173 Stitch Surface Points 342 Stitch Tool option 332 position change for curves 84 Positional Stitch Tool option 338 positional continuity align curves with 173 align surfaces with 173 C0 328 change for stitch 332 Power Animator Attach tip 51 Blend tip 51 Round tip 51 Prepare For Stitch 328
Preserve Shape Open/Close Curve option 135 Preset Revolve option 287 primitives edit NURBS in Attribute Editor 227 NURBS Circle 218 NURBS Cone 221 NURBS Cube 223 NURBS Cylinder 219 NURBS options, setting 213 NURBS Plane 225 NURBS Sphere 213 NURBS, transforming 208 profile curve revolving 279 revolving, edit 282 revolving, transform 283 Profile Curves Birail Tool options 361 Profile Normal Extrude option 319 Extrude orientation option 322 Project Along Project Curve options 391 Project Curve 390 and trimming, introduction 8 change in Attribute Editor 396 change in Channel Box 394 change options 391 create trim curves 373 to trim surfaces 390 Project Tangent 186 change in Attribute Editor 193 change options 188
Index
Q Quads NURBS to Polygons option 253 quintic degree 5 curves 66
R
Rotation manipulator for Project Tangent 192
S Sample Count Stitch Tool option 335, 336 Samples Along Edge Stitch Tool option 334 Second Edge Birail Tool options 361 sections determine amount, for Revolve 289 Segments Revolve option 289 Selected State Trim Tool options 375 Set to insert isoparms 96 insert knots 96
Index
Radius 215 Fillet Curve option 130 radius change for primitives 215 Rail Curves Birail Tool options 361 Ratio of Height to Radius 219 Ratio of Height to Width 224 Ratio of Length to Width 224 Rebuild Curve 199 change in Attribute Editor 206 change in Channel Box 205 change options 200 Curvature rebuild type 203 Match Knots rebuild type 202 No Multiple Knots rebuild type 202 Reduce rebuild type 201 Uniform rebuild type 201 Rebuild Option Birail Tool options 361 Rebuild Surfaces 397 change in Attribute Editor 403 change in Channel Box 402 change options 399 Rebuild Type Rebuild Curves options 201 Rebuild Surfaces options 399 Reduce Rebuild Curve type 201 Rebuild Surfaces option 400
Relative addressing mode 20 Remove Align Curves options 172 Align Surfaces option 172 Attach Curves option 154 Attach Surfaces option 154 Remove Multiple Knots Extend Curve option 104 remove multiple knots using CV hardness 91 Required Boundary option 350 Result Position Extrude options 320 Reverse Align Curves toggle 182 Align Surfaces toggle 184 Reverse Curve change options 196 Loft option 301 Reverse Curves 195 Reverse Direction Project Tangent option 190 Reverse Surface reverse surface normals 250 Reverse Surface Normals Circular Fillet option 262 Reverse Surfaces 195 change in Attribute Editor 198 change options 197 revolution axis specify 285 Revolve 279 change options 285 revolve manipulator 280 Rotate Order change axes, in Attribute Editor 30
Using Maya: Modeling
415
Index
Show Manipulator display manipulators 11 for Bevel 304, 305, 313 for Boundary 353 for circular curve fillets 124 for Circular Fillet (surface) 264 for Detach Curves 161 for Detach Surfaces 161 for duplicate curves 145 for extended curves 105 for Extrude 324 for Fillet Blend Tool 273 for freeform curve fillets 126 for Freeform Fillet (surface) 268 for Loft 298, 299 for offset curves 116 for Planar 381 for Project Curve 395 for Project Tangent 191 for Reverse Curves 196 for Revolve 280, 290 for Stitch Tool 331 for Trim Tool 376 insert isoparms with 98 insert knots with 98 introduction to 11 using with NURBS 11 using with primitives 211 Shrink Surface Trim Tool option 376 Size construction plane option 233 sketching pencil curve method 73 Smooth Shade shading mode 249 Snap to curves icon for distance measure 34
416
Using Maya: Modeling
span 245 change number of, for primitives 217 description 54 Specify Extrude option 319 specify extrude vector 319 Sphere and Show Manipulator 211 NURBS primitive 213 split polygonal surface, NURBS to polygons 256 Standard Fit NURBS to Polygons option 254 tessellate method, NURBS to polygons 254 Start Sweep Angle 214 Revolve option 288 StartParam bevel manipulator 307 Step Count Stitch Tool option 335 Stitch Surface Points 339 change in Attribute Editor 341 change options 340 Stitch Tool 328 change in Attribute Editor 336 change in Channel Box 334 change options 332 surface history, change 336 Straight Bevel corner option 311 Bevel edge option 312
subCurves access from marking menu 18 access, from Attribute Editor 19 add to History list menu 17 creating 14 display using Partial option 15 edit in Attribute Editor 19 editing in Channel Box 14 setting attributes for 20 subdividing primitives 216 Surface Blend Birail 2 Tool option 365, 366 surface CVs reverse direction 197 Surface Degree 215 change, with Rebuild Surfaces 401 Loft options 297 Primitive options 215 Revolve options 287 Surface Direction Open/Close Surface options 136 surface direction 246 surface isoparm offset 107 Surface Normal Project Curve option 391, 393 surface normal direction 248 display 248 introduction 248 reverse direction 195, 249 reversing, with Circular Fillet 262 surface point stitch 339
Index
Swap Align Surfaces toggle 184 Reverse Surfaces option 197 sweep change end sweep angle, primitives 214 change start sweep angle, primitives 214 Sweep Angles Revolve options 288
T
Transform Attributes 230 for curves 80 section of Attribute Editor 231 Transform Control Birail Tool options 358 Triangle NURBS to Polygons option 253 Trim Fillet Curve option 128 text type 241 trim duplicate curves for 142 trimming surfaces 373 untrimming surfaces 378 using circular fillets 261 trim curves and Intersect 385 and Project 390 creating 75 Trim Tool 373 change in Attribute Editor 377 change options 375 Tube Extrude style option 318 Twist Align Surfaces toggle 184 Type text types 241
U U and V divisions 246 U patches 224 U Type NURBS to Polygon option 256 U, V patches change for primitives 224
Using Maya: Modeling
Index
Tangent Align Curves option 173 Align Surfaces option 173 Fillet Curve option 130 Project Tangent option 188 Stitch Tool option 332 tangent align for curves 87 change for curves 84 transform for curves 85 Tangent Align Direction Project Tangent option 189 tangent continuity align curve with 173 align surfaces with 173 change for stitch 332 G1 328 Tangent Continuity Profile Birail 1 Tool option 363 Tangent direction curve editor manipulator 86 Tangent Rotation Project Tangent option 190 Tangent Scale Align Curves, Surfaces options 177 Project Tangent option 190 Tangent scale curve editor manipulator 86
Tangent Scale Point Project Tangent manipulator 192 Tangential Stitch Tool option 338 Tangents Rebuild Curve, Keep toggle 204 tessellate 254 Count method, NURBS to polygons 256 Edge Swap, NURBS to polygons 256 General method, NURBS to polygons 255 methods 254 Standard Fit method 254 text creating 235 transforming 237 transforming a text string 238 transforming individual letters 240 Text Curves 236 text curves creating 235 text type Curves 241 Poly 241 Trim 241 Tolerance Offset Curve option 116 tolerance change for primitives 215 Top Side Bevel option 310 TopPoint manipulator for circular curve fillets 124 transform curves in Attribute Editor 80
417
Index
U/V Project Tangent option 189 Reverse Surfaces option 197 U/V coordinate system 246 Uniform knot spacing, for Loft 296 knot spacing, general 56 knots for CV curves 67 knots for edit point curves 72 Rebuild Curve type 201 Rebuild Surfaces option 400 uniform knot surface with Rebuild Surface 400 Untrim Untrim Surfaces options 379 Untrim Surfaces 378 cancel last trim 379 change options 378 remove all trimming 379 Use Normal Project Curve option 396 Use Tolerance change for primitives 215 for Bevel 313 for Circular Fillet 264 for Fillet Blend Tool 276 for Fit B-Spline 121 for Freeform Fillet 269 for Intersect Surfaces 388 for Offset Curve 115, 116 for Project Curve 393 for Rebuild Surfaces 402 for Revolve 288 User Defined pivot point, reposition 214
V V patches 224 V Type NURBS to Polygons option 256
418
Using Maya: Modeling
W weight factors change for stitch 333 Weighting Factors Stitch Tool option 333 Width change for NURBS Cube 224 width change for Bevel 311 change for NURBS primitives 224 WidthPoint bevel manipulator 306 world coordinate space 243
Y Y-up 243 change orientation 244
Z Z-up 244 change orientation 244
NURBS Modeling
NURBS Modeling 1 NURBS Modeling Modeling basics
1
1
Using construction history
2
Using curves to build surfaces
4
Creating objects using NURBS primitives Creating surfaces
5
5
Editing curves and surfaces
7
Creating locators and measuring distances Using the Show Manipulator Tool
11
Selecting an item’s history node
12
Changing a curve’s parameter range
14
Editing subCurves in the Attribute Editor Editing parameters with manipulators Editing attributes with manipulators Using the Attribute Editor Using axes and pivot points
26
What are pivot points?
26
Creating locators
19 21
22
22
Accessing the Attribute Editor
What is an axis?
10
22
29
31
Using Measure tools
33
Using distance measures
33
Displaying parameter values Measuring arc lengths
38
41
NURBS modeling tips and tricks Tools and actions Workflow tips
45
Modeling tips
47
45
45
Using Maya: Modeling
iii
NURBS Modeling in Maya Contents Using commands
49
Organizational tips Special scripts
50
51
2 Introduction to Curves Curve basics
53
53
Creating the perfect curve
54
Which curve creation method should you use? What are CV curves?
57
What are edit point curves? Deleting curve segments
58
Deleting CVs on a surface
3 Creating curves
58 59
61
Creating curves with CVs
61
Changing the CV curve shape
63
Setting CV Curve Tool options
66
Creating curves with edit points
69
Changing the edit point curve shape Setting EP Curve Tool options Creating curves using a pencil
Creating trim curves
4 Editing Curves
71
73
Setting Pencil Curve Tool options Creating a curve-on-surface
70
74
75 75
79
Editing curves in the Attribute Editor
79
Transforming curves in the Attribute Editor
iv
Using Maya: Modeling
80
54
NURBS Modeling in Maya Contents Accessing the curve’s history Using the Curve Editing Tool
81
84
Changing the parameter position
85
Transforming the curve tangents
85
Aligning the tangent horizontally or vertically Adding points to a curve Adjusting CVs
87
88
90
Inserting knots and isoparms
93
Setting Insert Knot and Insert Isoparm options Extending curves
100
Setting Extend Curve options
101
Offsetting curves and curves on surface Setting Offset Curve options
107
112
Setting Offset Curve On Surface options Fitting cubic geometry to linear geometry Setting Fit B-Spline options Filleting curves
96
117
120
121
123
Creating circular curve fillets
123
Creating freeform curve fillets
126
Setting Fillet Curve options
128
Opening and closing curves and surfaces Setting Close Curve options
135
Setting Close Surface options Duplicating curves and isoparms
135 139
Setting Duplicate Curves options Attaching curves and surfaces
133
146
148
Attaching curves and surfaces with history off
148
Setting Attach Curves and Attach Surfaces options Detaching curves and surfaces
156
Setting Detach Curves and Detach Surfaces options Aligning curves and surfaces
154 161
165
Using Maya: Modeling
v
NURBS Modeling in Maya Contents Aligning Curves
166
Aligning surfaces
169
Setting Align options
172
Changing the order of the alignment
174
Scaling the tangent and curvature alignment Projecting curve tangents
186
Setting Project Tangent options
188
Adjusting the tangent interactively
191
Reversing the curve or surface direction Setting Reverse Curves options
195
196
Setting Reverse Surfaces options Rebuilding curves
177
197
199
Setting Rebuild Curve options
200
5 Creating and Editing Objects Using NURBS primitives
207
207
Creating objects with NURBS primitives Modifying primitives to build objects
208
208
Using the Show Manipulator Tool with primitives Setting primitive options
213
Setting Circle options
218
Setting Cylinder options
219
Setting Cone options
221
Setting Cube options
223
Setting Plane options
225
Editing objects in the Attribute Editor Using a construction plane
227
232
Setting Construction Plane Options Creating and editing text
235
Setting Create Text options
vi
Using Maya: Modeling
235
233
211
NURBS Modeling in Maya Contents
6 Introduction to Surfaces
243
What you need to know about surfaces
243
What is world coordinate space? What is an isoparm?
243
245
What is the U / V surface direction? What are U and V divisions?
246
246
What is a surface normal?
248
What is construction history? Converting NURBS to polygons
250 252
Setting NURBS To Polygons options Choosing a tessellation method
7 Creating surfaces Filleting surfaces
254
259
259
Creating circular surface fillets Setting Circular Fillet options
259 260
Creating free-form surface fillets Setting Freeform Fillet options Blending surfaces
269 274
279
Using the revolve manipulator Editing the input profile curve Setting Revolve options Lofting curves and surfaces Setting Loft options Beveling surfaces
266
271
Setting Fillet Blend Tool options Revolving surfaces
253
280 282
285 293
296
303
Changing the bevel’s dimensions interactively Setting Bevel options
304
308
Using Maya: Modeling
vii
NURBS Modeling in Maya Contents Extruding surfaces
316
Setting Extrude options
317
Preparing to stitch surfaces
328
Creating stitched surfaces
328
Setting Stitch Tool options Stitching surface points
332
339
Setting Stitch Surface Points options Creating boundary surfaces
340
346
Creating a four-sided boundary surface
346
Creating a three-sided (triangular) boundary surface Setting Boundary options Creating birail surfaces
349
356
Using the Birail 1 Tool
357
Setting Birail 1 Tool options Using the Birail 2 Tool
358
364
Setting Birail 2 Tool options Using the Birail 3+ Tool
365
368
Setting Birail 3+Tool options
8 Editing Surfaces Trimming surfaces
369
373
373
Setting Trim Tool options
375
Untrimming a trimmed surface
378
Setting Untrim options Planar trimming
378
380
Setting Planar Trim Surface options Intersecting surfaces
385
Setting Intersect options Projecting curves
387
390
Setting Project Curve options
viii
Using Maya: Modeling
391
381
347
NURBS Modeling in Maya Contents Rebuilding surfaces
397
Setting Rebuild Surfaces options
399
Using Maya: Modeling
ix
NURBS Modeling in Maya Contents
x
Using Maya: Modeling
NURBS Modeling
1
NURBS Modeling This chapter contains short general descriptions of the Maya tools and actions you use to create and edit NURBS curves and surfaces. It also contains information about manipulators, the Attribute Editor and Channel Box, creating locators, and the Measure tools. A compilation of NURBS modeling tips and tricks are included at the end of the chapter. This chapter includes: • • • • • • • • • • • •
“Modeling basics” on page 1 “Using curves to build surfaces” on page 4 “Creating objects using NURBS primitives” on page 5 “Creating surfaces” on page 5 “Editing curves and surfaces” on page 7 “Creating locators and measuring distances” on page 10 “Using the Show Manipulator Tool” on page 11 “Using the Attribute Editor” on page 22 “Using axes and pivot points” on page 26 “Creating locators” on page 31 “Using Measure tools” on page 33 “NURBS modeling tips and tricks” on page 45 See also Chapter 2, “Introduction to Curves” for information on curve basics, Chapter 6, “Introduction to Surfaces,” for information on surface basics, and for information on primitives and text curves, see Chapter 5, “Creating and Editing Objects”
Modeling basics Modeling in 3D is different from the conventional 2D drawing process. Imagine working with wire. You first place wires that determine the basic shape of the object, and then cover the wires with a surface that can be positioned to create motion for an animation. Cover the surface with a skin of almost any material you can think of, set up lights, and take a picture. This is essentially how Maya works. Using Maya: Modeling
1
NURBS Modeling Modeling basics The surface can be shaped and refined in real time using four views. You can build 3D surfaces in many ways. For example, you can start by extruding a 2D curve, revolve it or draw boundaries that define it, and then cut areas out of the constructed surfaces by trimming them. When you are satisfied with the model, you can turn the surface into a photo-realistic image by adding textures, colors, highlights, and backgrounds using the rendering functions and options provided. Use raytracing to add highly accurate reflections, refractions, and shadows for surfaces such as glass and water. And to complete the image, you can add natural phenomena like fog, sky, and sunsets. Non-Uniform Rational B-Splines (NURBS) are a special type of spline you use to create smooth curves and surfaces. The curves and surfaces are defined by a set of control points, which influence the object or shape in their vicinity. The overall object shape is determined by the way the control points are distributed in space. As you move the control points, the curve or surface changes shape and follows the control points in an intuitive way that is easy to work with.
Using construction history Most surface and curve creation tools produce objects with construction history. This means that the original curves or surfaces are still there after a surface is constructed or a curve is modified. By default, a surface with construction history is displayed in dark pink. In the following example, a revolved surface is created from a curve. The curve is selected and then extended using Curves → Extend Curve, thus changing the revolve surface result.
extended curve construction curve
2
Using Maya: Modeling
NURBS Modeling Modeling basics
Construction history on
Construction history off
Now when you create the revolved surface and select the construction curve, you can modify or delete it without changing or deleting the surface.
To delete construction history after a surface is created, select Edit → Delete by Type → History or Delete All by Type → History. The surface reverts to the default inactive color when you select the construction curve.
Attaching curves and surfaces with history off The Attach Curves options window (for both curves and surfaces) contain a toggle that lets you keep the original curves or surfaces after the attach is performed. Keep Original is toggled on by default. Try not to toggle this option off if history is set to on (the Construction History icon in the Status Line). Odd behavior may occur if the attached curve or surface is later modified. Using Maya: Modeling
3
NURBS Modeling
If you want to turn off construction history before you create a surface, click the Construction History On/Off icon from the Status Line.
NURBS Modeling Modeling basics
Animating CVs and construction history If you animate CVs on an object that was created with history, do not delete the object’s history. The CV animation will not be correct and unexpected results will occur.
Using curves to build surfaces Maya provides three curve creation tools. Surfaces can be built from one or more curves using one of these methods:
CV Curve Tool A CV (control vertex) is a point that controls the shape of a curve or surface. The CV Curve Tool is used to create free-form curves. CVs are placed one at a time, and the curve is created when there are sufficient CVs to define at least one span. For a degree 3 curve, at least 4 CVs are needed to create a single span. The CVs can be manipulated using transformation tools to give localized, predictable modifications to the curves and surfaces. See “Creating curves with CVs” on page 61 for details.
EP Curve Tool An edit point is a point that lies on the curve or surface. Use the EP Curve Tool to place points one at a time. The curve is created to interpolate them with one span between each edit point. See “Creating curves with edit points” on page 69 for details.
Pencil Curve Tool The Pencil Curve Tool method is useful for sketching a curve, rather than creating it by placing CVs or edit points. The Pencil method lets you create a curve as easily as drawing a line on a piece of paper. See “Creating curves using a pencil” on page 73 for details.
4
Using Maya: Modeling
NURBS Modeling Modeling basics
Creating objects using NURBS primitives NURBS Modeling
Several simple NURBS objects, such as spheres, cubes, cylinders, cones, and planes, are called primitives. You can create primitives in a single operation by selecting an item from the Primitives → NURBS menu. You can create complex objects by combining, transforming, trimming and cutting, or using surface functions, such as filleting, on these simple shapes. Throughout this book, NURBS primitives are used in various surface construction situations. You can also create text (Primitives → Create Text) using a variety of fonts. You can specify whether the text curves are NURBS, trim curves, or polygons.
Creating surfaces This section includes a brief description of the tools and actions you use to construct surfaces using various methods and how to tailor your creations.
Filleting and blending surfaces Filleting is a fast and easy way to create either a smooth rounded curve between two existing curves or a rounded edge between two surfaces. Use Surface fillets (Surfaces → Circular Fillet and Freeform Fillet) to create an object with rounded edges, or to blend two surfaces together. For example, you can protrude a NURBS cylinder primitive through a flat surface and create a smooth rounded edge where the two intersect. Or you could use the Surfaces → Fillet Blend Tool to join two sphere primitives using a free-form surface fillet and transform the top and bottom to construct a bottle. Surface filleting functions are also used to create the curves-on-surface you need to trim a surface.
Revolving curves Creating a surface of revolution is like using a lathe. First you create a silhouette, or profile, then revolve it.Unlike the lathe, when you use Surfaces → Revolve you can choose whether or not the object completes the revolution. Instead of being limited by a closed 360 degree revolution, you can specify the number of degrees. For instance, if you want the object to be flat on one side, revolve it by 180 degrees. If it needs to fit in a corner, revolve it by 90 degrees.
Using Maya: Modeling
5
NURBS Modeling Modeling basics
Lofting curves and surfaces Lofting is like building a boat. You construct a skeleton of ribs then apply a hull of skin, planks, or metal sheets to the ribs. In other words, you create a series of splines that define the shape of the object, then you loft these splines together. You can use Surfaces → Loft to create an airplane fuselage or wings, or to create intermediate areas between any two surfaces created with boundary curves.
Beveling curves and isoparms Use Surfaces → Bevel to create an extruded surface with a beveled edge from any curve. This lets you create a ledge on a building, for example, or the piping on an upholstered chair.
Extruding surfaces An extrusion is defined by two splines—one spline for the outline of the shape, and the other for the path that the outline follows. Extrusions are like tubing that comes out of a machine. They have an outline that remains consistent throughout their length. To define the path that the extrusion follows, use Surfaces → Extrude.
Stitching surfaces Use Prepare to Stitch to set up your surfaces before a stitching operation is performed. Use the Edit Surfaces → Stitch Tool to stitch, or align, two NURBS surfaces. Use Edit Surfaces → Stitch Surface Points to stitch NURBS surfaces together by selecting points on the surface.
Creating boundary and birail surfaces Use Surfaces → Boundary to create three-sided or four-sided surfaces from three or four curves. A boundary surface has four edges and can have almost any three-dimensional shape. Boundary curves (or profile curves) give you control over the shape when creating smoothly curved, non-planar 3D surfaces. You provide the splines for all the sides, or boundaries, of the surface to be created. The boundary curves define the surface’s profile, and the rail curves define the cross-section, which determines how the splines connect. Boundary curves are useful when creating complex surfaces that are not constant in any of three dimensions, but change across the whole surface.
6
Using Maya: Modeling
NURBS Modeling Modeling basics
NURBS Modeling
You can also use Surfaces → Birail 1 Tool, Birail 2 Tool, and Birail 3+Tool to create surfaces by combining three or four free-form curves that intersect.
Editing curves and surfaces After creating curves and building surfaces, you may want to modify them using specific functions instead of moving points.
Adding points to a curve After a curve is constructed, you may sometimes find that additional points are necessary if you want to move points on a curve. Use Curves → Add Points Tool to add additional CVs or edit points to a curve or curve-onsurface.
Adjusting CVs Use Curves → CV Hardness to adjust CVs to build smoother curves.
Inserting knots and isoparms You may need extra spans on curves or on isoparms on surfaces to provide enough freedom in the curve or surface to be able to create the desired shape. Use Curves → Insert Knot to insert knots to add additional edit points on a curve, or Edit Surfaces → Insert Isoparms to insert isoparms on a surface.
Extending curves Sometimes after you create a curve, you find that it is not long enough to intersect other curves when using another operation (such as a Birail Tool) or you want to use an extension of a particular curve to change a surface (such as a revolved object). Use Curves → Extend Curve to extend a curve or curve-on-surface using a linear, circular, or extrapolation method.
Offsetting curves Use Curves → Offset Curve to create a curve parallel to the original at a specified offset distance. To create a curve-on-surface parallel to the original curve-on-surface, use Curves → Offset Curve On Surface.
Fitting cubic geometry Use Curves → Fit B-Spline to fit a cubic curve to a degree 1 (linear) curve.
Using Maya: Modeling
7
NURBS Modeling Modeling basics
Opening and closing curves and surfaces Use Curves → Open/Close or Edit Surfaces → Open/Close to toggle curves and surfaces open or closed.
Duplicating curves and isoparms Use Curves → Duplicate Curves to transform a curve-on-surface, a boundary curve, or an interior isoparm of an existing surface into a 3D curve.
Attaching curves and surfaces Use Curves → Attach Curves to join two curves by attaching their endpoints to create a single curve. You an also join two surfaces by attaching their edges to create a single surface.
Detaching curves and surfaces Use Curves → Detach Curves or Edit Surfaces → Detach Surfaces to break a curve into two curves, open a currently closed curve, or detach a surface.
Projecting curve tangents Use Curves → Project Tangent to modify a curve’s tangent at an endpoint so that it coincides with the tangent of a surface or two other intersecting curves.
Trimming surfaces Trimmed surfaces let you cut surfaces in three dimensions. Applying one or more trimming curves to an existing surface creates a new surface with areas trimmed away. Use Edit Surfaces → Trim Tool to select the regions of the surface to keep or cut away. To be able to trim a surface, you must have curves-on-surface. There are several ways to create such trim curves:
8
•
Make Live. Draw a curve directly onto a surface by first making the surface “live” (click the Make Live icon on the Status Line), then drawing on the surface using any of the curve creation tools.
•
Project Curve. Project a curve onto a surface using Edit Surfaces → Project Curve.
Using Maya: Modeling
NURBS Modeling Modeling basics •
Trimming planar curves Use Surfaces → Planar to quickly covert a planar curve into a surface. The resulting surfaces look like shapes stamped out of sheet metal.
Intersecting surfaces Use Edit Surfaces → Intersect Surfaces to intersect one object with another. Intersections can also be used to create the curves-on-surface you need to trim a surface.
Filleting curves Use Curves → Fillet Curve to create a bridge between two curves.The resulting curves have the exact amount of roundness required, and the curves do not necessarily have to intersect. There are two ways to construct curve fillets—Circular and Freeform. You select the type you want from the options window (Curves → Fillet Curve - ❐).
Aligning curves and surfaces Use Curves → Align Curves to establish continuity between curves or surfaces. Use manipulators to align the elements interactively.
Reversing the curve or surface direction Use Curves → Reverse Curves and Edit Surfaces → Reverse Surfaces to reverse the sequence (or direction) of CVs on a curve or surface. You can also reverse the surface normals for surfaces and trimmed surfaces.
Rebuilding curves and surfaces Sometimes after a sequence of modeling operations, surfaces grow in complexity and become cumbersome and slow to work with. Use Edit Surfaces → Rebuild Surfaces to change the number of patches or the degree of a surface. This lets you reduce the number of patches on a complex surface. Use Curves → Rebuild Curve to recreate a curve or a curve-onsurface to reduce data and construct smoother curves.
Using Maya: Modeling
9
NURBS Modeling
Intersect. Intersect two surfaces using Edit Surfaces → Intersect Surfaces, or use one of the surface filleting functions. You can optionally create trim curves on the surfaces when using these functions.
NURBS Modeling Modeling basics
Creating locators and measuring distances You can replace primitives with locators to control other objects. For example, you can create these locators, connect them to expressions, and use them as control objects instead of primitives. The main advantage to this is that locators don’t render. This way, you don’t have to remember to turn control objects off before rendering. Also, locators don't slow down your scene. This is another advantage over using spheres or planes as control objects.
Creating locators Use Primitives → Create Locator to create a locator to mark a position in world space. Maya also provides measure tools to measure distances and display parameters on the curves and surfaces you create.
Measuring distances Use Modify → Measure → Distance Tool to measure and display distances between two specified points.
Displaying parameter values Use Modify → Measure → Parameter Tool to display parameter values on curves and surfaces at a specified point.
Measuring arc lengths Use Modify → Measure → Arc Length Tool to measure and display arc lengths on curves and surfaces at a specified point.
10
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Using the Show Manipulator Tool
To access and display manipulators: There are several ways to access and display manipulators using the Show Manipulator Tool. Before you start, make sure construction history is on. 1
For a surface constructed with curves (such as an extruded surface), set Curve Range to Partial in the options window.
Curve Range set to Partial
2
Click the Show Manipulator icon
.
3
In the Channel Box, click the heading for the subCurve you want to edit.
Using Maya: Modeling
11
NURBS Modeling
Some functions display special manipulators that let you tailor a surface or curve after a surface has been created. Use the Show Manipulator Tool to edit the construction history of an operation or sometimes, the attributes of an object itself. In other words, this tool lets you access the input node of an object.
NURBS Modeling Using the Show Manipulator Tool
or For an active object such as a NURBS primitive or a revolved surface, click the Show Manipulator icon and click the item’s heading in the Channel Box.
Selecting an item’s history node The Show Manipulator Tool associates a manipulator with the history node of the operation, therefore, to access the manipulator the history node has to be selected. For example, to edit the parameters of a revolve operation after the revolve has been performed, select the operation’s history node. If you perform several other operations and then want to edit the revolved surface, the manipulators are no longer displayed. You have to select them using one of the following methods.
To select the history node:
12
1
Select the revolved surface.
2
On the keyboard, press the letter “a”, and with the left mouse button clickdrag to Select All History from the marking menu in any view.
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Select All History can display manipulators for multiple history nodes. To edit the node you need, click the headings in the Channel Box to select which one you want to edit, or open the Attribute Editor and select the properties you want to change.
or From the History list menu in the Status Line, select Revolve.
or From the Channel Box, select the history node (revolve1). In the following example, the history nodes for a revolved surface and the curve used to construct it are selected. Click revolve1 to select the history node for the revolved surface.
Using Maya: Modeling
13
NURBS Modeling
Tip
NURBS Modeling Using the Show Manipulator Tool Click subCurve1 to select the history node for the construction curve.
Once the history nodes and the Show Manipulator Tool have been selected, manipulators are displayed on the surface or the construction curve. To interactively edit these nodes, click and drag the manipulators, or change the values in the Channel Box or the Attribute Editor.
Tip Some options windows include a Keep Original toggle. Toggle this on to access the manipulators (for example, Curves → Detach Curves).
Changing a curve’s parameter range A subCurve is created when you select the Partial option as the Curve Range in some of Maya’s options windows. This option lets you select a minimum and maximum parameter value on the curve, and only the part of the curve between those points is used in the creation of the surface. Most surfaces that use a curve as input include this option. A subCurve can also be the construction curve, or input curve, you use to create surfaces, such as revolved or extruded surfaces.
Editing a subCurve in the Channel Box You can edit a subCurve history node interactively using manipulators, or you can enter values in the Channel Box and Attribute Editor. In the following example, you create an extruded surface and modify its subCurves (the input curves, profile, and path, used to create the extruded surface).
14
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
To edit a subCurve from the Channel Box: Before you create the extruded surface, set the Curve Range to Partial in the Extrude options window.
2
Create the extruded surface from a curve and a primitive circle.
3
To display the curve range manipulators on one of the partial input curves (in this case, the path curve, which is subCurve2), click subCurve2 in the Channel Box and select the Show Manipulator Tool (if it is not already selected).
4
To change the parameter value, drag a manipulator handle.
Using Maya: Modeling
15
NURBS Modeling
1
NURBS Modeling Using the Show Manipulator Tool You can also enter values in the Channel Box to change the parameter value without using the manipulator.
5
To edit the input profile curve, click subCurve1.
If you want to perform another function on the extruded surface and later edit the subCurve, you can select the subCurves you need from the Channel Box.
Tip You can also type values in the Numerical Input line for the current manipulator handle if you do not want to leave the Channel Box open. Add the subCurve to the history menu to select it from there instead. See “Adding a subCurve to the History menu” on page 17 for details.
16
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Adding a subCurve to the History menu NURBS Modeling
In order to select a subCurve from the History list menu in the Status Line, you have to add it to the menu first.
To add a subCurve to the History menu: 1
From the bottom of the History list menu, select Complete list.
2
In the History list window, select List from the Filter pop-up menu.
The subCurve is now included in the History list menu.
Using Maya: Modeling
17
NURBS Modeling Using the Show Manipulator Tool This means, instead of selecting the subCurve manipulator from the Channel Box, you can select it from the History list menu on the Status Line. You can also access an Attribute Editor for the subCurves by clicking the option box (❐) beside the heading. See “Editing subCurves in the Attribute Editor” on page 19 for details.
Note Adding a subCurve to the menu is done on a per-object basis, meaning if you create another surface using a partial curve, that subCurve will not appear in the menu.
Accessing a subCurve from the marking menu Once you add the subCurve to the History menu, you can also access it through the marking menu.
To access a subCurve from the marking menu:
18
1
Place the pointer over the surface that was created with the subCurve (such as a revolved surface with a partial curve) while the surface is active.
2
Press the right mouse button and click the triangle beside Inputs to display the pop-up menu.
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Editing subCurves in the Attribute Editor
Once a subCurve has been added to the History list menu, you can also open the Attribute Editor for the subCurve by clicking the option box (❐) beside the Sub Curve heading in either the History list menu from the Status Line or the Inputs pop-up menu from the marking menu.
Using Maya: Modeling
19
NURBS Modeling
Select Object → subCurve1 - ❐ to open the Attribute Editor for a subCurve. (Since some operations require that you use more than one subCurve, the number after a subCurve heading represents the subCurve you want to edit.)
NURBS Modeling Using the Show Manipulator Tool
Setting SubCurve Attributes
Input Curve The Input Curve text box is read-only. Click the arrow beside the box to access the curve you want to edit and to open its Attribute Editor.
Min/Max parameter values The Min Value and Max Value parameter boxes are the same ones you see in the Channel Box. You can enter values here and press the Select button or press Enter to update the subCurve.
Relative Use the Relative toggle to turn the relative addressing mode on or off. Relative is toggled on by default. If toggled off, the mode is absolute, meaning the actual parameter range of the curve is used. If toggled on, the parameter range of the curve is treated as though it were from 0 to 0.
20
Using Maya: Modeling
NURBS Modeling Using the Show Manipulator Tool
Editing parameters with manipulators
For example, to display the manipulators for a NURBS cone primitive from the Channel Box, first select the Show Manipulator icon, then click the cone’s heading (makeNurbCone1):
To display manipulators from the History list menu, drag to the Make Nurb Cone heading and release the mouse button.
To display manipulators from the marking menu, place the pointer over the active NURBS cone, press the right mouse button and drag to select the Make Nurb Cone heading from the Inputs pop-up menu, and release the mouse button.
Using Maya: Modeling
21
NURBS Modeling
To display manipulators for the NURBS sphere, NURBS cylinder, and NURBS cone primitives, select the Show Manipulator Tool while the primitive is active. Then click the object’s heading in the Channel Box, select it from the History list menu in the Status Line, or from the marking menu Inputs pop-up menu. Click-drag the manipulator handles to edit the object.
NURBS Modeling Using the Attribute Editor
Editing attributes with manipulators In some cases, a manipulator is associated with the parameters of an object itself. Examples include texture projection nodes, cameras, polygons, joints, and all light types. To display the manipulators, select the Show Manipulator Tool on one of these active items (or select it before you create the item). See the Animation and Rendering books and the “Polygonal Modeling” section of this book (Chapter 1, “Polygonal Modeling”) to find out more about these manipulators.
Using the Attribute Editor The Attribute Editor is used as an editor for all nodes. This means that surfaces, curves, and any selectable item can be displayed in this one window. You can use the Attribute Editor in addition to the Channel Box to edit various nodes and operations for a specific operation.
Accessing the Attribute Editor Besides selecting Window → Attribute Editor for an active item, there are several ways to access the information you need to edit. The following example shows how to set the options in the Attribute Editor for a filleted curve.
22
Using Maya: Modeling
NURBS Modeling Using the Attribute Editor
To access the Attribute Editor:
Click to select the fillet curve in the view...
... or select the node in the Channel Box.
•
In the Channel Box, select Object → filletCurve1 - ❐.
•
From the History list menu in the Status Line, select Fillet Curve - ❐.
From the Channel Box
•
NURBS Modeling
Select the fillet curve to make it active. Click on the curve, or select its heading from the Channel Box.
From the History list menu
From the marking menu, press and hold the right mouse button while the pointer is over the active curve. Drag to the Inputs pop-up menu, select Fillet Curve - ❐ and release the mouse button.
Using Maya: Modeling
23
NURBS Modeling Using the Attribute Editor
Drag to here and release the mouse button to open the Attribute Editor.
A node’s history section of the editor (in this case, the Curve Fillet History section) includes all the information related to the creation of an item.
24
Using Maya: Modeling
NURBS Modeling Using the Attribute Editor
Curve Parameter values These values correspond to the fillet’s param manipulators you see when the Show Manipulator Tool is selected. These parameter values define the region between the two original curves where the fillet curve is created.
Input Curve This read-only information gives you access to the history of the curves you used to create the fillet. Click the arrow buttons to select an input curve and open its section of the editor.
Other attributes Other curve fillet-related options which are also included in the Fillet Curve options window.
Temporarily blocking (or hiding) a node The Attribute Editor also includes generic information for all nodes. The following describes the Node Behavior section.
If you select Blocking from the Node State pop-up menu, your surface temporarily becomes invisible. This can be very useful when you have complex scenes and want to edit only one facet of a surface. For example, let’s say you have a complex revolved surface and want to edit the curve, but you don’t want to wait while the revolve re-draws. You can select Blocking and edit the curve. To see the results, select the revolve surface’s node (either from the Channel Box or the History list menu), and then select Normal from the Node State pop-up menu in the Attribute Editor.
Using Maya: Modeling
25
NURBS Modeling
In this example, the editor contains the nodes for the input curves and the various options that were set in the options window for a curve fillet, including:
NURBS Modeling Using axes and pivot points
Using axes and pivot points There are various ways you can define where your objects are transformed from. You use the location of the pivot point or axes to transform in a specific direction from a specific point in local or world space.
What are pivot points? Objects are transformed based on a specific point in 3D space known as a pivot. When you rotate a primitive, for example, the pivot point represents the center of the rotation axis; when you scale, the pivot point represents the fixed point around which scaling occurs. By default, the pivot point is set so that the rotational and scale pivots are located at the point of origin for an object (0, 0, 0). The point of origin is the center of the object. A quick way to change an object's pivot when in a transformation tool is to use the Insert key on the keyboard to toggle to and from an edit mode. Edit mode displays a manipulator for moving the pivot. For more details, see the section describing the transformation tools in the Basics book.
To quickly display and reposition pivot points: You can move the pivot point to determine at which point you want to move, scale, or rotate the object from. Use the Insert key on the keyboard to display the pivot point, then use any of the transformation tools. In the following example the Rotate transformation tool is selected. 1
26
While an object is active, select a transformation tool, then press the Insert key. The manipulator appears; use it to move the pivot point.
Using Maya: Modeling
NURBS Modeling Using axes and pivot points Drag the manipulator to move the pivot point.
3
Press the Insert key again to display the rotate manipulator, drag to rotate the object.
NURBS Modeling
2
To display the pivot point from the Attribute Editor: 1
Open the Attribute Editor (Window → Attribute Editor).
2
To display the pivot points for models, toggle Display Rotate Pivot or Display Scale Pivot on in the Pivots section under the object’s transform tab.
Using Maya: Modeling
27
NURBS Modeling Using axes and pivot points
To reposition the pivot point using the Attribute Editor: 1
While the object is active, open the Attribute Editor and toggle Display Rotate Pivot on.
2
In the Local or World Space sections, enter a value for Rotate Pivot and press Enter. In the following example, the pivot is moved 5.0 units in the Z direction in absolute local space. You can now rotate the object from that pivot point location.
Rotate pivot point moved 5.0 in Z
28
Using Maya: Modeling
NURBS Modeling Using axes and pivot points
What is an axis?
Displaying the axis indicators To display the global axes at the origin in the perspective view, select Display → Axes → Origin from the menu bar. To display the local axis in all views for an active object, open the Attribute Editor. In the Display section under the objects’s transform section of the editor, toggle Display Local Axis on.
Using Maya: Modeling
29
NURBS Modeling
An axis is a straight line that indicates the origin and direction. For example, by using two axes, a plane is determined: the XY plane is defined by placing X and Y axes so they intersect at the origin. Three dimensions are determined by using three axes: X, Y, and Z.
NURBS Modeling Using axes and pivot points
Changing the origin and direction of the axes In the Transform Attributes section of the Attribute Editor, you can change the rotation order of the axes for an object by selecting Rotate Order from the pop-up menu. You can also enter values in the Rotate Axis X, Y, or Z boxes to rotate the axes in a specific direction, and to rotate the object around a different axis.
Toggling the axes origin from the Command Line You can also type the following commands in the Command Line to toggle the global axis display on and off in the 3D views.
30
Command
Action
toggleAxis -o true;
displays the axis at the origin
toggleAxis -o false;
hides the axis at the origin
toggleAxis -v true;
displays the axis at the bottom left of each view
toggleAxis -v false;
hides the axis at the bottom left of each view
Using Maya: Modeling
NURBS Modeling Creating locators
Creating locators A locator marks a position in world space. A locator is displayed as a small gnomon; its lines extend in each direction along the X, Y and Z axes (like the directional rods of a sundial). You can use point snapping to snap to a locator position.
To create and move a locator: 1
Select Primitives → Create Locator. A locator is created at the origin.
2
Use the Move Tool to position the locator.
Repositioning the locator in the Attribute Editor You can reposition the locator in local space from the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
31
NURBS Modeling
Use Primitives → Create Locator to create a space or curve locator.
NURBS Modeling Creating locators Click the locatorShape# tab to open that section of the editor. Enter X, Y, or Z values in the Local Position boxes.
You can transform the locator three ways:
32
•
Use the transformation tools.
•
Change the transformation values in the Channel Box.
•
Click the locator# tab in the Attribute Editor and change the Transformation values in that section of the editor.
Using Maya: Modeling
NURBS Modeling Using Measure tools
Using Measure tools NURBS Modeling
The Measure menu includes the Distance Tool, Parameter Tool, and Arc Length Tool. Click the triangle beside Measure in the Modify menu to display the cascading menu.
Using distance measures Use the Measure → Distance Tool to measure and display distances between two specified points.
To display a distance measure: 1
Select Modify → Measure → Distance Tool.
2
Click to select two points in space, or click on a curve or surface to display the distance measure locator.
Using Maya: Modeling
33
NURBS Modeling Using distance measures The following example shows the distance locator when two points are placed on a surface.
This shows the distance locator when one point is placed in world space and the other is placed on the surface.
The following shows the distance locator when two points are placed on a curve.
To snap a distance measure point: If you want to snap a locator to a curve or surface, use the Snap to curves icon and click on the curve or surface. When you move the item, the distance measure updates. This can be especially helpful if you want to measure the distance between two curves.
34
1
Click the Snap to curves icon from the Status Line.
2
Place a point on one curve and another point on the other curve.
Using Maya: Modeling
NURBS Modeling Using distance measures 3
Move one of the curves and the distance measure updates. NURBS Modeling
To move the distance locator: Select the Move Tool, then click to select a locator and drag to where you want to measure the distance between. The distance measure updates interactively.
Using Maya: Modeling
35
NURBS Modeling Using distance measures
Editing the distance locators in the Attribute Editor If you want, you can specify the start and points of the distance measure in X, Y and Z from the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
To specify the start and end points of the distance measure: Click the distanceDimensionShape# tab to open that section of the editor. Enter values in the Start Point and End Point boxes to specify the start and end points of the distance measure in X, Y, and Z.
To reposition the distance locator in local space: Click the locatorShape# tab to open that section of the editor. Enter values in the Local Position boxes to reposition the distance measure in X, Y, or Z.
36
Using Maya: Modeling
NURBS Modeling Using distance measures
NURBS Modeling
Using Maya: Modeling
37
NURBS Modeling Displaying parameter values
Displaying parameter values Use the Measure → Parameter Tool to display parameter values on curves and surfaces at a specified point. This locator also displays the direction of the curve or surface and the normal to the curve or surface at a specified point.
Normal Normal Curve direction Surface direction
To display parameter values on a surface or curve: 1
Select Modify → Measure → Parameter Tool.
2
Click-drag on a curve or surface to display the parameter values at a specified point. For curves, the parameter value in U at the specified point on the curve is displayed.
38
Using Maya: Modeling
NURBS Modeling Displaying parameter values
NURBS Modeling
For surfaces, the parameter value in U and V at the specified point is displayed.
To move the parameter locator: Select the Move Tool, then click-drag a locator over the curve or surface. The parameter values update as you drag.
If you create another locator, the previous locator is dimmed. This means that you can move it later if you need to.
Using Maya: Modeling
39
NURBS Modeling Displaying parameter values
Editing the parameter locators in the Attribute Editor If you want, you can specify the U and V parameters values from the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. Click the arrow beside the Nurbs Geometry box to access the curve or surface whose locator you want to edit.
To specify the U and V parameter values: Click the paramDimensionShape# tab to open that section of the editor. Enter new U and V Param values.
40
Using Maya: Modeling
NURBS Modeling Measuring arc lengths
NURBS Modeling
In the following example, the first figure shows the parameter locator on a surface at the position where it was created. The second figure shows how the locator is modified when you change the U and V Param values.
Measuring arc lengths Use the Measure → Arc Length Tool to measure and display arc lengths on curves and surfaces at a specified point. It also displays the direction of the curve or surface and the normal to the curve or surface at a specified point.
Normal
Surface direction
Normal
Curve direction
To display arc length values on a surface or curve: 1
Select Modify → Measure → Arc Length Tool.
2
Click-drag over a curve or surface to display the parameter values at a specified point. Using Maya: Modeling
41
NURBS Modeling Measuring arc lengths For curves, the distance of the specified point from the start point of the curve is measured.
For surfaces, the specified point from the start point in both the U and V direction is measured.
To move the arc length locator: Select the Move Tool, then click- drag over the curve or surface. The parameter values update as you drag.
If you create another locator, the previous locator is dimmed, meaning you can select to move it later if you wish.
42
Using Maya: Modeling
NURBS Modeling Measuring arc lengths
Editing the arc length locators in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
NURBS Modeling
If you want, you can specify the U and V parameters values from the Attribute Editor. To open the Attribute Editor, either:
Click the arrow beside the Nurbs Geometry box to access the curve or surface for which you want to edit the locator.
To specify the U and V parameter values: Click the arcLengthDimensionShape# tab to open that section of the editor and enter new U and V Param values.
Using Maya: Modeling
43
NURBS Modeling Measuring arc lengths In the following example, the first figure shows the arc length locator on a surface at the position where it was created. The second figure shows how the locator is modified when the U and V Param values are changed.
44
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks
NURBS modeling tips and tricks
Tools and actions Because Maya works on a selection-based mode, picking items is critical to modeling. If you forget what needs to be picked for a tool or an action, hold and drag the mouse button over the menu item. The Help Line displays the type of selection required for the current item.
What is a tool? If something is a tool, it contains the word Tool after its name (for example, Curves → CV Curve Tool). When using a tool, first set the options in the options window, select the tool, and then select the item. After the operation is complete, you can change the object’s attributes in the Channel Box or Attribute Editor if necessary.
What is an action? If something is an action, you have to select the item first and then the action. For example, if you want to create a revolved surface, first select the profile curve you want to use, then select Revolve from the Surfaces menu.
Workflow tips The following are some handy tips and tricks that can help to get you started.
Using marking menus when modeling Select Options → Customize UI → Marking Menus. In the Marking Menus editor, do the following: 1
With the left mouse button, click to select a mouse button style (for example, PA_Style_LMB).
2
Select the Hotbox option from the Use Marking Menu in pop-up menu.
Using Maya: Modeling
45
NURBS Modeling
The following information can be useful to get you started or if you run into problems. A few special tricks are also included.
NURBS Modeling NURBS modeling tips and tricks
3
46
Select the Center option in the Hotbox Region section, and click to turn the Left toggle on in the Mouse Button(s) section.
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks Click Apply Settings to assign a specific series of actions to the left mouse button.
5
Repeat this for the middle and right mouse buttons. Once completed, click Close.
Hiding the Hotbox A Hotbox is available for each of the four menu sets: Animation, Modeling, Dynamics, and Rendering. Marking menus are activated by pressing the space bar and pressing the left, middle, or right mouse buttons. When you press and hold the space bar, the Hotbox is displayed. Now if you press the left mouse button, a set of marking menus is displayed on top of the hotbox. The hotbox can be distracting when it is under the marking menus, so you can disable it if you want to.
To hide the Hotbox: 1
While holding down the space bar, press a mouse button over the Hotbox Controls menu.
2
From the Hotbox Style menu, select Center Zone Only. Selecting this option hides the Hotbox and when you press the space bar and a mouse button, only the marking menus are displayed.
3
To reopen the hotbox, press the space bar and use the left mouse button to select Zones and Menu Rows from the Hotbox Style menu.
Modeling tips Because many of the modeling functions in Maya are command based, the selection order is critical. There are times when you have to select different types of entities, such as isoparms (surface curves) or points on a surface.
Picking mode tips For example, when lofting between a curve and the edge of a plane, you have to select the curve first in object selection mode, and then the plane’s isoparm edge in component selection mode.
Using Maya: Modeling
47
NURBS Modeling
4
NURBS Modeling NURBS modeling tips and tricks
To reduce the number of picking steps: 1
Click the Select by hierarchy and combinations icon, the first mini icon in the row of the Status Bar. To the left of this button, the word Hierarchy is displayed in a box.
2
Click the arrow to the left of this box to display a pull-down menu.
3
Select NURBS to change the selection mode so that you don’t have to know if an isoparm, a curve, or a curve point has to be active to select something. This mode places an override on the selection mode and lets you pick what you want without worrying which mode you are working in. This works well for modeling, but it can be cumbersome to continuously select this option. For this reason, the right mouse marking menu lets you select the kind of component you need when over an active object. You’ll notice throughout this book that various modes of selection are used to let you choose to adopt a method that you’re comfortable with.
Picking and displaying history A quick way to pick and display history, such as a subCurve history node, is to press the “a” key and use the left mouse button to select Select All History from the marking menu in any view.
48
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks
Stepping backwards in construction history Some operations, such as Stitch, Align (with join turned off), and Curve Fillet, produce an intermediate object. This is an invisible copy of the original. To see and select this object, first select the visible result, then press Ctrl i to select the original surface. If you are animating the CVs of an object that has an intermediate object, animate the CVs of the intermediate object for better results.
Deleting CVs on a surface To delete a row of CVs on a surface, select more than one CV in that row, select the hull that corresponds to that row of CVs, then press the Backspace key. Do the same thing if you want to delete a column of CVs on a surface. If you select only a single CV, both the row and the column are deleted.
Using commands The following commands can save you time when using any Maya tool or action.
Assign commands to an alias Use the ‘alias’ MEL command in your favorite shell. It saves lots of typing, especially if you frequently use commands with the same sets of non-default parameters.
Display attribute dependencies Use affectedNet command to set up a dependency graph consisting of nodes that represent the attributes of a specific node (or type of node). Connections represent how the source attribute affects the destination attribute.
Using Maya: Modeling
49
NURBS Modeling
In some cases, there may be multiple history nodes. To edit the node you need, simply click the headings in the Channel Box to select which node you want to edit, or open the Attribute Editor and select the attributes you want to change.
NURBS Modeling NURBS modeling tips and tricks
Prevent offset of CVs on NURBS with clusters If you create a cluster with NURBS CVs in it, and then try to drive other CVs on the same NURBS object using the connectAttr command, the other CVs are offset. To prevent this offset, change this attribute before you make the attribute connection: setAttr .relativeTweak false;
Warning! Do not toggle this attribute on and off at whim as it may produce unwanted results.
Organizational tips The following tips can help when you use the Outliner or Hypergraph windows.
Open the full hierarchy with one click In the Outliner, if you Shift-click the expand/contract triangle, you can open or close the whole hierarchy for the object at one time.
Reorder and reparent in the Outliner With the middle mouse button, drag and drop selected objects onto a group node to reparent it. Drag and drop selected objects at the bottom of the Outliner to reparent it directly under the world.
Reorder and reparent in the Hypergraph Drag and drop one node onto a sibling node in the hypergraph while pressing the Ctrl key to reorder the nodes.
50
Using Maya: Modeling
NURBS Modeling NURBS modeling tips and tricks
Special scripts NURBS Modeling
These special scripts provide you with a fast and easy way to perform operations similar to the Power Animator functionality.
To use Power Animator’s Attach or Blend functionality: Select a NURBS surface isoparm and enter the following in the Command Line: attachBlendCurve
or Select a NURBS surface isoparm (to define the attach direction) and enter: attachBlendSurface
To create a Power Animator Round surface: 1
In a curve tool’s options window, set the Curve Degree to Linear.
2
Turn Snap to grids on in the Status Line and create a linear square curve.
3
Close the curve using Curves → Open/Close Curves.
4
In the Bevel options window (Surfaces → Bevel - ❐), set the following options: Bevel Cap Edge to Convex Bevel Corners to Circular Arcs
5
Click the Bevel button in the options window.
Using Maya: Modeling
51
NURBS Modeling NURBS modeling tips and tricks
6
52
To put a lid on the surface, select the end (square) isoparm of the bevel surface and select Surfaces → Planar.
Using Maya: Modeling
To build a model, you usually start by building curves that are combined to create surfaces. You can create curves with CVs and Edit Points, or draw free-form curves using the Pencil method. See Chapter 3, “Creating curves,” for details about these curve creation methods. The following topics are discussed in this chapter: •
“Curve basics” on page 53
•
“Creating the perfect curve” on page 54
•
“What is the curve degree?” on page 55
•
“What is parameterization?” on page 56
•
“Which curve creation method should you use?” on page 54
•
“What are CV curves?” on page 57
•
“What are edit point curves?” on page 58
•
“Deleting curve segments” on page 58
•
“Deleting CVs on a surface” on page 59
Curve basics Once you create a curve, or a spline, you can build a surface from it. B-splines are a series of polynomial curve segments that join to form one continuous curve. The degree of the polynomials is from 1 to 7. In Maya, you can draw splines to create complex shapes using a variety of editing tools. The following shows the basic elements of a curve.
Using Maya: Modeling
53
NURBS Modeling
2
Introduction to Curves
Introduction to Curves Creating the perfect curve
CV Hull Span Start of curve Edit point
Curve direction
•
The start of the curve is indicated by a small hollow box at the first CV.
•
The curve direction is displayed as a small letter u.
•
A hull is the visual line that connects the CVs.
•
The curve between two edit points is called a span. By modifying one or more spans, you change the shape of the curve.
Creating the perfect curve There are various methods you can use to create your curves. When you create curves, there are certain factors to keep in mind, such as the curve degree, or how many spans you need. The following should help when trying to decide what type of curve you need for a particular project.
Which curve creation method should you use?
CV curve
Edit point curve
Try to create simple curves because they are easier to control. Curves with less CVs are simpler and easier to manipulate.
54
Using Maya: Modeling
Introduction to Curves Creating the perfect curve
Tips Before you place the points to construct a curve, open the options window for the curve tool you want to use. You can set specific options such as the curve degree or whether you want to use uniform or chord knot spacing. If you need more localized control, you can insert knots to add points. See “Inserting knots and isoparms” on page 93 for more information.
What is the curve degree? The higher the curve degree, the smoother the curve, and the greater the number of points needed to define a single curve span. Two points define a linear curve span, three are needed for quadratic curves, and four are required for a cubic curve (the CV Curve Tool default). The following shows a curve constructed with nine points using different curve degrees. The first curve (the default) is used as a guide to show the difference between curve degrees. All the other curves are drawn on top of it for illustrative purposes.
Default degree 3 (Cubic)
Degree 5 (Quintic)
Degree 1 (Linear)
Degree 2 (Quadratic)
Degree 7 (Heptic)
Using Maya: Modeling
55
NURBS Modeling
The main advantage of using an edit point curve is that it interpolates the points you place. In other words, build a curve with edit points if you need it to pass through certain points. When you place CVs, the curve only passes through the end points.
Introduction to Curves Creating the perfect curve Degree 1 curves have sharp corners at the edit points; degree 2 curves are tangent continuous at edit points, but not as smooth. Degree 3 curves are used more often since they work best with most modeling operations and the result is a smooth curve with not too many points.
Tips You need degree 3 or higher to achieve C(2) or G(2) continuity between curves. You cannot change the curve degree from the Attribute Editor. Use the options window.
What is parameterization? Parameterization specifies how knot spacing relates to the U parameter values assigned to edit points. Chord length
If the curve is created with Chord length knot spacing, the parameter value is determined by the position of the point along the length of the curve. An initial parameter value of 0 is assigned to the start of the curve; the value is increased proportionally to the chord length between edit points.
Uniform
If the curve is created with Uniform knot spacing, the parameters have equally spaced values (0, 1, 2, and so on) at edit points. The parameter values of a uniform curve always range from 0 to the total number of spans on the curve. A parameter value of 0 is assigned to the start of the curve; this value is incremented by 1 for each edit point along the curve.
Tip Uniform knot spacing produces a curve with a more predictable parameterization. Chord knot spacing produces a better curvature distribution, and, when used to build surfaces, better texture mapping. Uniform curves have more straightforward parameterization and are used more often than chord length curves. Uniform parameters can be easily subdivided based on edit points; this makes it easier to use Insert Knot if you need to add spans later.
56
Using Maya: Modeling
Introduction to Curves Creating the perfect curve
What are CV curves?
How to select CVs There are two selection modes you can use to select CVs: from the Status Line and from the marking menu.
Selecting CVs from the Status Line While the curve is active, click the Select by component icon on the Status Line, click the Points icon, and select CVs from the pop-up menu.
Selecting CVs from the marking menu Place the pointer over an active curve and press the right mouse button to display the marking menu. Drag to Control Vertex, then click to select the CV or CVs you want to edit.
Using Maya: Modeling
57
NURBS Modeling
A CV is a point that controls the shape of a curve or surface. It is displayed as a small filled box. Use the CV Curve Tool to create these kinds of curves.
Introduction to Curves Creating the perfect curve
What are edit point curves? An edit point is displayed as a small letter x. The areas where polynomials are joined are called edit points (sometimes known as knots). Edit points lie directly on the spline. You can add edit points to an existing curve without affecting its shape. When you add edit points to a curve, you create more spans on the curve. As the number of spans increases, you have more localized control over the curve. Use the EP Curve Tool to create this kind of curve.
How to select edit points Like CVs, edit points can be selected using the Status Line icons or the marking menu.
Selecting edit points from the Status Line While the curve is active, click the Select by component icon on the Status Line, click the Parm Points icon, and select Edit Points from the pop-up menu.
Selecting edit points from the marking menu Place the pointer over an active curve and press the right mouse button to display the marking menu. Drag to Edit Point, then click to select the edit point or edit points you want to edit.
Deleting curve segments To delete curve segments while you are creating a curve, press the Backspace key on the keyboard. To delete curve segments after the curve is created, select the CVs or edit points and then press the Backspace key.
58
Using Maya: Modeling
Introduction to Curves Creating the perfect curve
NURBS Modeling
Note When you create a curve using the Pencil Curve Tool, you cannot delete curve segments by pressing the Backspace key. Instead, once the curve is created, select CVs or edit points (in component selection mode) and then press the Backspace key.
Deleting CVs on a surface To delete a row of CVs on a surface, select more than one CV in that row or select the hull that corresponds to that row of CVs. Do the same thing if you want to delete a column of CVs on a surface. If you select only a single CV, both the row and the column are deleted.
Single CV
Three CVs in the same row.
Using Maya: Modeling
59
Introduction to Curves Creating the perfect curve
60
Using Maya: Modeling
Since curve creation methods are tools, first adjust the option settings in the options window for the tool before you create the curves. If you create the curves with the default option settings, you can later edit the completed curve in the Attribute Editor. The following topics are described in this chapter: •
“Creating curves with CVs” on page 61
•
“Creating curves with edit points” on page 69
•
“Creating curves using a pencil” on page 73
•
“Creating a curve-on-surface” on page 75
Creating curves with CVs A CV is a point that controls the shape of a curve or surface. Use the CV Curve Tool to create free-form curves. You can manipulate CVs using transformation tools to give localized, predictable modifications to your curves and surfaces.
Tip Remember, more CVs doesn’t necessarily mean easier control. You should try to keep the number of isoparms to a minimum.
Before you begin When you construct a curve with CVs, you must place several points to complete the curve, depending on the curve degree setting in the options window. The following example uses the default curve degree of Cubic, degree 3. Since you need one point more than the curve degree, you have to place at least four points to construct the curve. See “About curve degrees” on page 67 for more information.
Using Maya: Modeling
61
NURBS Modeling
3
Creating curves
Creating curves Creating curves with CVs
To create a curve with CVs: 1
Select Curves → CV Curve Tool.
2
Position the pointer in any of the views where you want the curve to begin.
3
Click to place the first CV. The first CV is displayed as a small hollow box that indicates the start point of the curve.
Tip If you hold the mouse button while you click, the CV can be dragged to any location in the view. Release the mouse button to place the CV. 4
Click where you want to place the second CV. This CV is displayed as a small letter u. Once you place the CV, a line joins the two CVs. This is the hull line. The hull line is part of the control polygon and does not represent a curve or curve segment.
5
Click to place a third CV. Another hull line is created to connect the second and third CVs. The curve is not built yet since this is a degree 3 curve (Cubic by default) and you have to place at least four points.
6
Click to place the last and fourth CV. When you place the fourth CV, a curve segment is created that interpolates the first and last CVs.
2
1
3 4
As you continue to place CVs, new curve segments are created and the curve continually updates to interpolate the last CV placed.
62
Using Maya: Modeling
Creating curves Creating curves with CVs
NURBS Modeling
Tip To complete the curve so you can start to place new curve points, press Enter.
To create a CV curve-on-surface: 1
Select the NURBS surface.
2
Click the Make Live icon on the Status Line (or select Modify → Make Live) to make the surface live.
3
Select Curves → CV Curve Tool and place the curve-on-surface CVs directly on the live surface.
Changing the CV curve shape Once a CV curve is drawn, or while you are drawing it, you may want to modify its shape. You can use the transformation tools to move, rotate, or scale CVs to change the shape of your curves.
To change the shape of the curve as you create it: 1
Before you press Enter to complete the CV curve, press the Insert key on the keyboard. This displays a move manipulator, which appears on the CV at the end of the curve by default.
Using Maya: Modeling
63
Creating curves Creating curves with CVs 2
Drag the manipulator to move the CV and to change the curve’s shape.
3
To continue to change the curve’s shape, click with the left mouse button to select another CV and drag the manipulator.
Tip You can marquee-select more than one CV at a time. Remember to press the Insert key to continue placing CVs.
To change the shape of the curve after it is constructed:
64
1
Click the Select by component type icon from the Status Line.
2
Click the Points icon, press the right mouse button to display the pop-up menu, then toggle CVs on.
Using Maya: Modeling
Creating curves Creating curves with CVs
or
3
Click to select the CV (or CVs) you want to move.
4
Select a transformation tool, (in this example, the Move Tool), and drag the manipulator to move the CV.
Using Maya: Modeling
65
NURBS Modeling
While the pointer is over an active CV curve, use the right mouse button and drag to select Control Vertex from the marking menu.
Creating curves Creating curves with CVs
Setting CV Curve Tool options Set the tool options before you create the curve. To open the options window, select Curves → CV Curve Tool - ❐. To change the options after the curve is created, use the Channel Box or the Attribute Editor. See “Editing curves in the Attribute Editor” on page 79 for details.
Changing the curve degree Select a Curve Degree option to specify the curve degree. 1 Linear curves are often referred to as polylines (linear segments), degree 2 curves as quadratics, degree 3 Cubic curves as cubics (the default), degree 5 as quintic, and degree 7 as heptic. The higher the curve degree, the more points you need to define a single curve span. If the number of control points is the same and the curve degree is high, the curve looks as though it has more tension than if the degree is low.
66
Using Maya: Modeling
Creating curves Creating curves with CVs
About curve degrees NURBS Modeling
Each curve segment is defined and controlled by n+1 CVs, where n is the degree of the curve. For example, a curve of degree 5 requires 6 CVs to form a curve segment.
6 1
2
3
4 5
A curve of degree 7 requires 8 CVs.
8 1
2
3
4
5
6 7
Changing the knot spacing The type of knot spacing relates to the U parameter values assigned to CVs (also referred to as parameterization). Select an option for Knot Spacing. Chord length
If you create a curve with Chord length knot spacing, the parameter value depends on the distance along the length of the curve. An initial parameter value of 0 is assigned to the start of the curve, then the value is increased proportionally to the chord length between edit points.
Uniform
If you create a curve with Uniform knot spacing, the parameters have equally spaced values (0, 1, 2, and so on) between edit points. The parameter values of a uniform curve always range from 0 to the total number of spans on the curve. This is the default setting.
Using Maya: Modeling
67
Creating curves Creating curves with CVs
Tip Uniform knot spacing produces a curve with a more predictable parameterization. Chord knot spacing produces a better curvature distribution, and, when used to build surfaces, better texture mapping. See “What is parameterization?” on page 56 for more information about knot spacing. The joints where the curve spans are joined are called knots. Toggle Multiple End Knots on to help control the shape of the curve. The default is on.
Multiple End Knots
Notice how the curve does not go through the end CVs.
Multiple End Knots toggled on
Multiple End Knots toggled off
For more information on editing curves, see:
68
•
“Creating the perfect curve” on page 54.
•
“Using the Curve Editing Tool” on page 84.
•
“Editing curves in the Attribute Editor” on page 79 for information about editing the curve once you have created it.
Using Maya: Modeling
Creating curves Creating curves with edit points
Creating curves with edit points
When constructing a curve with edit points, the edit points are visible while the curve is being constructed. Unlike the CV method where you must place several points to construct the curve, only two edit points are necessary to create the initial curve segment, no matter what degree of curve.
To create an edit point curve: 1
Select Curves → EP Curve Tool.
2
Click in any of the views to place the first edit point. A small letter x is displayed.
3
Click to place the second edit point. When you place the second edit point, you create a curve segment that interpolates the two edit points. Click to place as many edit points as you want. As you plot each additional edit point, a new curve segment is created.
4
To complete the curve so you can start to place new curve points, press Enter. The following shows a curve constructed with four edit points.
1
3 2
4
To create an edit point curve-on-surface: 1
Select the NURBS surface.
2
Click the Make Live icon on the Status Line (or select Modify → Make Live) to make the surface live.
3
Select Curves → EP Curve Tool and place the curve-on-surface points directly on the live surface.
Using Maya: Modeling
69
NURBS Modeling
An edit point is a point that controls the shape of a curve or surface. Use the EP Curve Tool to help define how many spans sit on the curve. Edit point curves are also useful if the curve must go through certain points.
Creating curves Creating curves with edit points
Changing the edit point curve shape Once an edit point curve is drawn, or while you are drawing it, you may want to modify its shape.You can use the transformation tools to move, rotate, or scale edit points to change the shape of your curves.
To change the shape of the curve as you create it: 1
Before you complete the edit point curve, press the Insert key on the keyboard. This displays a move manipulator which appears on the edit point at the end of the curve by default.
2
Drag the manipulator to change the curve’s shape.
3
To continue to change the curve’s shape, click with the left mouse button to select another edit point and drag the manipulator.
Notes You can only select one edit point at a time. This prevents the curve shape from changing too much.
To change the shape of the curve after it is constructed: 1
Click the Select by component type icon.
2
Click the Parm Points icon to display the pop-up menu, then toggle Edit Points on.
or While the pointer is over an active edit point curve, use the right mouse button and drag to select Edit Point from the marking menu. 3
70
Click to select the edit point (or edit points) you want to move. Select a transformation tool (for example, the Move Tool), and drag the manipulator to move the edit point.
Using Maya: Modeling
Creating curves Creating curves with edit points
Setting EP Curve Tool options
To change the options after the curve is created, use the Channel Box or the Attribute Editor. See “Editing curves in the Attribute Editor” on page 79 for details.
Changing the curve degree Select a Curve Degree option to specify the curve degree. 1 Linear curves are often referred to as polylines (linear segments), degree 2 curves as quadratics, 3 Cubic curves as cubics (the default), degree 5 as quintic, and degree 7 as heptic. The higher the curve degree, the more points you need to define a single curve span. If the number of control points is the same and the curve degree is high, the curve looks as though it has more tension than if the degree is low.
Using Maya: Modeling
71
NURBS Modeling
Set the tool options before you create the curve. To open the options window, select Curves → EP Curve Tool - ❐.
Creating curves Creating curves with edit points
Changing the knot spacing The type of knot spacing relates to the U parameter values assigned to edit points (also referred to as parameterization). Select an option for Knot Spacing. Chord length
If you create a curve with Chord length knot spacing, the parameter value depends on the distance along the length of the curve. An initial parameter value of 0 is assigned to the start of the curve, then the value is increased proportionally to the chord length between edit points.
Uniform
If you create a curve with Uniform knot spacing, the parameters have equally spaced values (0, 1, 2, and so on) between edit points. The parameter values of a uniform curve always range from 0 to the total number of spans on the curve. This is the default setting.
Tip Uniform knot spacing produces a curve with a more predictable parameterization. Chord knot spacing produces a better curvature distribution, and, when used to build surfaces, better texture mapping. For more information on editing curves, see:
72
•
“Creating the perfect curve” on page 54.
•
“Using the Curve Editing Tool” on page 84.
•
“Editing curves in the Attribute Editor” on page 79 for information about editing the curve once you have created it.
Using Maya: Modeling
Creating curves Creating curves using a pencil
Creating curves using a pencil To create a curve using a pencil: Sometimes the most natural way to create a curve is to sketch it, rather than placing CVs or edit points. The pencil construction method lets you create a curve as easily as drawing a line on a piece of paper. 1
Select Curves → Pencil Curve Tool.
2
The pointer changes to a small pencil. Position it where you want the curve to begin.
3
Click-drag the pencil to sketch a curve.
4
To stop sketching, release the mouse button. The line is fit with a curve that has chord length parameterization by default.
Sketching in different views As the curve is sketched, the pencil position is sampled as often as possible. Points are kept if they are at least five screen pixels from the previous point. When the mouse button is released and the actual curve is fitted to the points, the curve interpolates the first and last point. If you are sketching in an orthographic view (front, top, or side), two of the coordinates of the spline correspond to those of the current view and the other coordinate is set to 0. If sketching in the perspective view, the curve is created on the ground plane or live surface.
Using Maya: Modeling
73
NURBS Modeling
Use the Curves → Pencil Curve Tool to sketch a curve, rather than create it by placing CVs or edit points.
Creating curves Creating curves using a pencil
Setting Pencil Curve Tool options Set the tool options before you create the curve. To open the options window, select Curves → Pencil Curve Tool - ❐. To change the options after the curve is created, use the Channel Box or the Attribute Editor. See “Editing curves in the Attribute Editor” on page 79 for details.
Changing the curve degree Select a Curve Degree option to specify the curve degree. 1 Linear curves are often referred to as polylines (linear segments), and degree 3 curves as cubics.
Warning! Curves created using a pencil usually have many CVs. Use Curves→Rebuild Curves to smooth out and simplify this type of curve. For more information on editing curves, see:
74
•
“Creating the perfect curve” on page 54.
•
“Using the Curve Editing Tool” on page 84.
•
“Editing curves in the Attribute Editor” on page 79 for information about editing the curve once you have created it.
Using Maya: Modeling
Creating curves Creating a curve-on-surface
Creating a curve-on-surface
Creating trim curves In general, you draw a curve-on-surface to prepare a surface for trimming, or to create a curve to use in subsequent surface construction. You can do this in various ways, including intersecting objects, creating fillets between objects, or projecting curves onto a surface. See “Trimming surfaces” on page 373 for more information on how to use the Edit Surfaces → Trim Tool.
To create a curve-on-surface by placing it onto a live surface: To draw a curve-on-surface, select the surface, then select Modify → Make Live or click the Make Live icon from the Status Line. Use any curve creation tool to draw the curve directly onto the surface. Click the Make Live icon from the Status Line to make an active primitive NURBS plane “live” and draw a curve on the surface.
Trim curve
Trimmed surface
Using Maya: Modeling
75
NURBS Modeling
A curve on surface is a curve that you create directly on a surface. These special curves are created within the UV parameter space of a chosen surface and become part of that surface.
Creating curves Creating a curve-on-surface
To create a curve-on-surface using a surface fillet: 1
In the Circular Fillet options window (Surfaces → Circular Fillet - ❐), toggle Create Curve On Surface on.
2
Pick the surfaces you want to create a fillet between.
3
Select Edit Surfaces → Circular Fillet to create a fillet between the two surfaces.
Trim curves
Trimmed surface
See “Creating trim curves” on page 261 in Chapter 7, “Filleting surfaces,” for information on filleting functions and their associated options.
To create a curve-on-surface by intersecting surfaces: A curve-on-surface is created when you intersect surfaces using Edit Surfaces → Intersect Surfaces. Trim curve
Trimmed surface
See “Intersecting surfaces” on page 385 for more information about Intersect Surfaces and its options window.
76
Using Maya: Modeling
Creating curves Creating a curve-on-surface
To create a curve-on-surface by projecting curves:
Trim curves
NURBS Modeling
Use Edit Surfaces → Project Curve to project curves, such as NURBS text, onto a surface. The projected curves become trim curves. Trimmed surface
See “Projecting curves” on page 390 for more information about Project Curve and its options window.
Using Maya: Modeling
77
Creating curves Creating a curve-on-surface
78
Using Maya: Modeling
NURBS Modeling
4
Editing Curves This chapter includes information about editing curves. It also describes some of the tools you use to edit surfaces built from curves. The following topics are discussed in this chapter: • • • • • • • • • • • • • • • •
“Editing curves in the Attribute Editor” on page 79 “Using the Curve Editing Tool” on page 84 “Adjusting CVs” on page 90 “Inserting knots and isoparms” on page 93 “Extending curves” on page 100 “Offsetting curves and curves on surface” on page 107 “Fitting cubic geometry to linear geometry” on page 120 “Filleting curves” on page 123 “Opening and closing curves and surfaces” on page 133 “Duplicating curves and isoparms” on page 139 “Attaching curves and surfaces” on page 148 “Detaching curves and surfaces” on page 156 “Aligning curves and surfaces” on page 165 “Projecting curve tangents” on page 186 “Reversing the curve or surface direction” on page 195 “Rebuilding curves” on page 199“
Editing curves in the Attribute Editor To edit completed curves and curve-related operations, use the Attribute Editor. The Attribute Editor for curves includes parameters that let you transform the curve and validate the curve’s history, as well as change the way it is displayed. First select the curve you want to edit. To open the Attribute Editor: •
Click the option box (❐) beside its name in the Object pop-up menu in the Channel Box.
Using Maya: Modeling
79
Editing Curves Editing curves in the Attribute Editor •
Select the active curve’s name from the marking menu.
•
Select Window → Attribute Editor.
•
If the curve has history, you can open the Attribute Editor from the History list menu on the Status Line, or from the Inputs pop-up menu in the marking menu.
Transforming curves in the Attribute Editor Click the curve tab to open the transformation sections of the editor.
Transform Attributes Use the Transform Attributes section to enter values to move, rotate, scale, or shear the curve. You can also change the X, Y, Z rotation order or rotate the local axes.
80
Using Maya: Modeling
Editing Curves Editing curves in the Attribute Editor
Pivots
Limit Information Use the Limit Information section to set limits to the transformations of the curve. You toggle the Limit X, Y, or Z boxes on or off and then change the values in the transformation boxes. When you do this, you can only move, rotate, or scale to the unit value you set in the corresponding boxes.
Display In the Display section, you can toggle the display of the local axis, display a selection handle, set a default manipulator (if you use the Show Manipulator Tool), or choose to hide the whole curve or toggle it into a template.
Accessing the curve’s history Click the curveShape tab to open the section of the editor that includes the history for the curve shape.
Click the triangle beside a heading to open that section of the editor. Using Maya: Modeling
81
NURBS Modeling
Use the Pivots section to scale or rotate the world space pivot, and toggle the display of scale and rotate pivots on or off.
Editing Curves Editing curves in the Attribute Editor
Nurbs Curve History The Nurbs Curve History section of the editor lists information for the active curve. This information is read-only. It simply provides you with the curve’s creation data.
Components The Components section is displayed when you select a CV on a curve that is created without history. The parameter boxes list the position of any CVs selected on the curve. This information is also available from the Channel Box.
Attribute Editor
Channel Box
Component Display For curves created with CVs, the Component Display section lets you change parameters to alter the curve’s display.
82
Using Maya: Modeling
Editing Curves Editing curves in the Attribute Editor
Object Display The Object Display section lets you toggle the visibility of the curve on or off, or turn it into a templated or intermediate curve. For example, the curve becomes invisible since it will only be used as a guide for subsequent operations.
Bounding Box The Bounding Box Information section is read-only. It displays the minimum and maximum world space coordinates of a curve along the X, Y and Z axes.
Using Maya: Modeling
83
NURBS Modeling
You can also toggle the display of CVs, edit points, or hulls on or off, and turn off the display of the curve in the Object Display section.
Editing Curves Using the Curve Editing Tool
Using the Curve Editing Tool Once you create a curve, you can open the Channel Box or the Attribute Editor and transform it or change the way it displays. You can also change its shape by transforming the CVs using the transformation tools. The Curve Editing Tool (Curves → Curve Editing Tool) is a shortcut tool. Use it to quickly change the shape of a curve by manipulating the tangent or position of a curve at any point along its length by scaling or rotating the tangent vector. This tool can be used on any modeling curve or animation motion path.
Tips The Curve Editing Tool will not modify the parameterization of the curve (chord or uniform). Use Curves → Rebuild Curves to do this. If you display curve CVs (Display → NURBS Components → CVs) while using the curve editor manipulator, notice how the manipulator changes the tangent by changing the position of the CVs of the curve.
To modify a curve using the curve editor manipulator handles: 1
Select Curves → Curve Editing Tool.
2
Click on the curve you want to modify to display the curve editor manipulator. It has several manipulator handles.
Parameter Position Tangent Scale
Point Position
Tangent Direction
3
84
Click-drag an active manipulator to change a curve point position and tangent alignment.
Using Maya: Modeling
Editing Curves Using the Curve Editing Tool
Changing the parameter position
Tips If you use the middle mouse button to drag the manipulator all the way to the left, it indicates the beginning or start point of the curve. If Snap to points is on when you are using this manipulator, you can snap to edit points on the curve. Click the Snap to points icon on the Status Line to turn snapping on.
Transforming the curve tangents A curve tangent is the slope of the curve at a specific point. Click-drag the manipulators to interactively scale or rotate the curve tangents. When using these manipulators, you can use either the right or middle mouse button to modify the curve tangents. •
Click-drag with the left mouse button to move an active manipulator.
•
Click-drag with the middle mouse button to move an active manipulator relative to the mouse position.
Using Maya: Modeling
85
NURBS Modeling
The parameter position handle of the manipulator determines on which point on the curve the curve editor manipulator is acting. As you move it along the curve, it shows the tangent and scale directions of the curve at that parameter value. Click-drag to slide the parameter position manipulator handle to a new position, or type a new value in the Numerical Input line, then press Enter.
Editing Curves Using the Curve Editing Tool In the following example, the Tangent Scale manipulator handle scales the tangent.
Tangent Scale manipulator
In this example, the Point Position manipulator handle changes the point position.
Point Position manipulator
In this example, the Tangent Direction manipulator handle changes the tangent direction.
Tangent Direction manipulator
86
Using Maya: Modeling
Editing Curves Using the Curve Editing Tool
Aligning the tangent horizontally or vertically NURBS Modeling
The red and blue dashed lines represent the AxisManips. Click once on a dashed line to align the tangent either horizontally or vertically. Click the red dashed line to align the tangent horizontally.
Click the blue dashed line to align the tangent vertically.
Using Maya: Modeling
87
Editing Curves Adding points to a curve
Adding points to a curve After a curve is constructed, you sometimes find that additional points are necessary to move points on a curve. Use the Curves → Add Points Tool to add additional CVs or edit points to a curve or curve-on-surface.
Tip If you want to add points to the start of a curve, first select Curves → Reverse Curves to reverse the curve direction.
To add CVs to a curve: If the curve is created with CVs: 1
Select Curves → Add Points Tool. The CVs are displayed.
2
Click on the curve to add a new CV. Continue clicking to add additional points. The new curve segment is tacked down from where you added the point.
3
Keep clicking to add additional CVs.
Click to add a new CV.
Select the Add Points Tool. CVs are displayed. Click to add additional CVs.
To add edit points to a curve: If the curve is created with edit points: 1
88
While the curve is active, click the Select by component type icon.
Using Maya: Modeling
Editing Curves Adding points to a curve 2
NURBS Modeling
With the right mouse button, click the Parm Points icon and toggle Edit Points on from the pop-up menu.
Tip Make sure the Points icon is not selected, otherwise CVs are selected first.
or While the curve is active, use the right mouse button to select Edit Point from the marking menu. 3
Select Curves → Add Points Tool.
4
Marquee-select the edit point at the end of the curve (the last edit point placed), then click to add a new edit point.
5
The new curve segment is tacked down from where you added the point. Keep clicking to add additional edit points.
Using Maya: Modeling
89
Editing Curves Adjusting CVs
Adjusting CVs Use Curves → CV Hardness to turn multiplicity factors of CVs on or off. See “Setting Insert Knot and Insert Isoparm options” on page 96 for information about changing the multiplicity factors for curve points.
Note CV hardness only works on curves of degree 3 (cubic).
To increase or decrease the CV hardness: 1
While the curve is active, click the Select by component type icon.
2
With the right mouse button, click the Points icon and toggle CVs on from the pop-up menu.
or While the curve is active, use the right mouse button to select Control Vertex from the marking menu. 3
90
Open the CV Hardness options window (Curves → CV Hardness - ❐) and click to turn Multiplicity to Full or Off.
Using Maya: Modeling
Editing Curves Adjusting CVs
Setting the multiplicity to full or off
To change the multiplicity of the interior CVs to go from 1 to 3, select Full. This is the default. To change a multiplicity factor from 1 to 3, there must be at least two CVs on each side of the CV being modified that have a multiplicity factor of 1. To change the multiplicity of the interior CVs to go from 3 to 1, select Off.
Example: smoothing text Select all the CVs and set Multiplicity to Off to quickly remove all the multiple knots on a cubic curve. The following example shows how text is modified by setting the Multiplicity to Off in the options window. 1
In component CV mode, marquee-select the text to pick all CVs.
2
Set the Multiplicity option Off in the options window and click the Apply button. Notice how the text loses its hard edges.
Keeping original geometry Turn the Keep Originals option On to specify whether the original curves or surfaces are retained after you change the multiplicity setting, and to access the Attribute Editor.
Editing the CV hardness in the Attribute Editor Use the Attribute Editor to edit the CV hardness once the operation is complete. Make sure Keep Original is on when you perform the operation to be able to access the Attribute Editor.
Using Maya: Modeling
91
NURBS Modeling
By default, when a cubic curve is created, the end CVs have a multiplicity factor of 3 and the arcs in between have a multiplicity factor of 1. The following options let you change the Multiplicity factors, or turn them off.
Multiplicity
Editing Curves Adjusting CVs To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Input Curve
The Input Curve information is read-only. It gives you access to the history of the curve you changed. Click the arrow button to select the curve and open its section of the editor.
Multiplicity
Enter a value in the Multiplicity box, or use the slider to specify the number of knots you want to insert when adjusting the CVs. See “Selecting the number of knots or isoparms” on page 97 for information about changing the multiplicity factor.
92
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
Inserting knots and isoparms NURBS Modeling
Sometimes you need to add extra spans on curves or more isoparms on a surface so you can edit surfaces to your specifications. Use Curves → Insert Knot to insert additional points on a curve without changing the shape of the curve. Use Edit Surfaces → Insert Isoparms to insert additional isoparms on a surface without changing the shape of the surface.
To insert points on a curve: 1
While the curve is active, select Display → NURBS Components → CVs or Edit Points.
2
Click the Select by component type icon, click the Parm Points icon, and select Curve Points from the pop-up menu.
or While the curve is active, use the right mouse button to select Curve Point from the marking menu. 3
Click on the curve where you want to insert a knot. A point is highlighted where you click.
4
To update the curve, select Curves → Insert Knot.
Using Maya: Modeling
93
Editing Curves Inserting knots and isoparms
Tips To change the location of the new knot before you insert it, hold the mouse button and drag the highlighted point to where you want it. As the location of the knot changes, the parameter value on the Feedback Line updates to indicate the new position of the point on the curve. You can select more than one curve point at a time. Press the Shift key while selecting the curve points then select Curves → Insert Knot.
To insert isoparms on a surface: 1 2
While the surface is active, click the Select by component type icon. With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu. You can also click the Parm Points icon, select Surface Points, then click on a point on the surface.
Parm Points Lines
3
94
or While the surface is active, use the right mouse button to select Isoparm or Surface Point from the marking menu Click-drag an existing isoparm to where you want to add a new isoparm, or select a point on the surface and click-drag, then select Edit Surfaces → Insert Isoparms to insert the new isoparm.
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
Unlike a curve which has only a U parametric direction, a surface has both a U and a V parametric direction. If you are inserting a U directional isoparm, you can only move along the V parametric direction on the surface. If you are inserting a V directional isoparm, you can only move along the U parametric direction on the surface. Look in the Feedback Line to verify your selection. You can select more than one isoparm at a time. Hold the Shift key while selecting the isoparms then select Edit Surfaces → Insert Isoparms.
Positioning knots or isoparms using the Channel Box When you insert a knot, the Channel Box includes a Parameter box from which you can enter values to change the position of the knot.
When you insert an isoparm, the Channel Box includes a Parameter box, as well as a Direction pop-up menu.
Enter a value in the Parameter box to reposition the isoparm. With the pointer over the Direction box, use the left mouse button to insert the isoparm in U or V. A Direction pop-up menu is also available in the Attribute Editor.
Using Maya: Modeling
95
NURBS Modeling
Tip
Editing Curves Inserting knots and isoparms
Setting Insert Knot and Insert Isoparm options To open the options window, select Curves → Insert Knot - ❐ or Edit Surfaces → Insert Isoparms - ❐.
Multiplicity
You can use the Multiplicity options to insert knots or isoparms concurrently or one-by-one.
Inserting knots or isoparms concurrently Select Set to and continue inserting new knots into the curve or isoparms to the surface until you achieve the specified multiplicity value. For example, if multiplicity at a point is 1 and the value in the Multiplicity box is set to 3, two knots are added to achieve a multiplicity of 3 on a CV curve. See also, “Adjusting CVs” on page 90 for more information about turning the multiplicity factors of CVs on or off.
96
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
NURBS Modeling
Set to 3
Notice the extra points.
Click to insert a point and press the Insert button.
Inserting knots or isoparms one-by-one Select Increase by to insert the number of knots specified in the Multiplicity box.
Note These new knots do not change the shape of the curve or surface.
Selecting the number of knots or isoparms Enter a value in the Multiplicity box, or use the slider to specify the number of knots you want to insert.
Keeping original geometry Toggle Keep Original on to determine whether the original curves or surfaces are retained after the insertion, and to let you use the Show Manipulator Tool. Using Maya: Modeling
97
Editing Curves Inserting knots and isoparms
Editing the inserted knot or isoparm position using manipulators If Keep Original is toggled on and you select the Show Manipulator Tool before you insert a knot, a manipulator is displayed at the insert location. Drag this manipulator to reposition the knot.
If you select the Show Manipulator Tool before you insert an isoparm, the isoparm remains highlighted after the insert operation is performed. This means you can drag the isoparm to a new location while the surface is active.
See “Using the Show Manipulator Tool” on page 11 for more information about the Show Manipulator Tool and modeling functions.
Editing the insert in the Attribute Editor To edit an active inserted knot or isoparm, use the Attribute Editor. To open the Attribute Editor, either:
98
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Editing Curves Inserting knots and isoparms
NURBS Modeling
Input Curve/ Surface
The Input Curve or Input Surface information is read-only. It gives you access to the history of the curve or surface isoparm you used. Click the arrow button to select the curve or surface isoparm and open its section of the editor.
Add Knots
The Add Knots toggle is the same as the Multiplicity toggle in the options window. If toggled on, the number of knots you specify (in Number of Knots below) are added. If toggled off, knots are added until the number of knots you specified is achieved.
Parameter
The Parameter section of the editor includes the value you set in the Channel Box. This value is used to reposition the knot on the curve or the isoparm on the surface. See “Positioning knots or isoparms using the Channel Box” on page 95 for details.
Number of Knots
The Number of Knots section lets you specify how many knots or isoparms you want to insert. This is the same as the Multiplicity option in the options window.
Direction
For isoparms, a Direction pop-up menu is available. Use this to insert the isoparm in U or V. You can also select an insert direction from the Channel Box.
Using Maya: Modeling
99
Editing Curves Extending curves
Extending curves Sometimes after you construct a curve you find that it is not long enough to intersect other curves when using another operation (such as a Birail Tool), or that you want to use an extension of a particular curve to change a surface (such as a revolved object). Use Curves → Extend Curve to extend a curve or curve-on-surface using a linear, circular, or extrapolation method.
Note If you extend a curve-on-surface the result will be a NURBS curve (a 3D curve instead of a 2D curve).
To extend a curve: The following example uses the default options — a linear extension at the end point of the curve. Change the options to extend curves to suit your needs. 1
Pick the curve you want to extend.
2
Select Curves → Extend Curve. By default, the extension occurs at the end of the curve at a unit distance of 1.0000. To see the new points on the curve, select Display → NURBS Components→ CVs or Edit Points. In the following example, notice the added points where the curve extension occurs on the CV curve.
Extension
100
Using Maya: Modeling
Editing Curves Extending curves
Setting Extend Curve options NURBS Modeling
To open the options window, select Curves → Extend Curve -❐.
Changing the extension distance Distance is the default Extend Method. You can specify the length of the extension by entering a value in the Distance box below or using the slider.
Distance
Note For Linear extensions, the result is a linear distance. For Circular extensions, the result is an arc length distance. For Extrapolate extensions, the extension curve has an arc length equal to distance.
To change the extension distance: 1
Select the curve and undo the previous extension.
2
Type a new value in the Distance box, then press the Extend button.
Using Maya: Modeling
101
Editing Curves Extending curves The following example shows what happens when you change the default distance value on a curve that was used to create a revolved surface with construction history. Distance changed to 3 Construction curve
Default distance = 1
Press the Extend button to continue extending the curve by the distance you specify.
Extending to a point location Point
Use the Point extend method to extend the curve to the current point location. When you click the Point button, X, Y, and Z point extension boxes are displayed in the options window. By default, the extension occurs to the origin (0, 0, 0). To change the extension distance to or from the last point of the curve, select the curve. Enter a new value in the X, Y, or Z boxes, then press the Extend button.In the following, the extension occurs along the Y axis 10 units away from the default pivot point location (at position 0, 10, 0 in world space).
Construction curve
102
Using Maya: Modeling
Editing Curves Extending curves
Changing the curve extension type
If the curve is already extended, select it and undo the previous extension. Select an Extension Type button, then press the Extend button. Linear
The Linear extension type extends the curve in a straight line. This is the default.
Circular
The Circular extension type extends the curve as an arc.
Extrapolate
When you use Extrapolate, the extension maintains the tangent of the selected curve.
Specifying where to begin the extension Extend Curve At
Set Extend Curve At to Start or End to specify where the extension will occur. The default is End. For example, if you select the Start option, the curve is extended from the start point of the curve.
To change where the extension begins: Select an option for Extend Curve At, then click the Extend button. The following shows a revolved surface with the construction curve highlighted. Both End and Start methods are applied to the same curve. Using Maya: Modeling
103
NURBS Modeling
There are three types of curve extensions for the distance extension method: Linear, Circular, and Extrapolate.
Editing Curves Extending curves
Construction curve
End method selected
Start method selected
start
end
Attaching and detaching the extension Join to Original
Toggle Join to Original on to attach the curve extension to the original curve. The default is on. If toggled off, the curve extension is not attached to the input curve. The input curve and the curve extension are independent objects. You can transform the resulting extension separately.
Original curve
Join to Original on
Join to Original off
Simplifying the extension by removing multiple knots Remove Multiple Knots
Toggle Remove Multiple Knots on to remove all multiple knots that are created when the curve is extended and Join To Original is on. The resulting extended curve is of the same degree as the original curve.
Keeping original geometry If Keep Original is toggled off, the original curve is extended. If toggled on, a copy of the original curve with the extension is created. The default is off.
104
Using Maya: Modeling
Editing Curves Extending curves
Be careful when you toggle Join to Original off. If both Keep Original and Join to Original are toggled off, the extension curve replaces the original curve.
Editing the extension using manipulators If Keep Original is toggled on and you select the Show Manipulator Tool before extending a curve, manipulators are displayed on the curve and a Distance parameter box is displayed in the Channel Box. In the following, dragging the manipulator changes the distance from the default 1.0 to 4.0. Notice the Distance value in the Channel Box.
Drag the manipulator to further extend the curve, or type a distance value in the Channel Box. See “Using the Show Manipulator Tool” on page 11 for more information about the show manipulators.
Using Maya: Modeling
105
NURBS Modeling
Note
Editing Curves Extending curves
Editing the extension in the Attribute Editor To edit an extended curve, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The options you set in the options window or the Channel Box are displayed. See the option descriptions for details. The Attribute Editor for a curve extension includes the following additional parameters: Input Curve
Input Curve information is read-only. It gives you access to the input curve you extended. Click the arrow button to select the curve and open that section of the Attribute Editor.
Input Point
If Point is selected as the Extend Method in the options window, the Input Point parameter boxes are made available.
106
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
Offsetting curves and curves on surface Use Curves → Offset Curve On Surface to create a curve-on-surface parallel to the original curve-on-surface.
To offset a curve: 1
Select the curve you want to offset, then select Curves → Offset Curve.
2
An offset curve is created at a default offset distance of 1.0.
Original curve
Offset Curve selected
3
To change the default offset distance interactively, select the Show Manipulator Tool to display a LengthPoint manipulator on the original curve.
4
Click-drag the manipulator to change the offset curve distance.
You can also change the offset distance from the options window, the Attribute Editor, or the Channel Box.
To offset a surface isoparm: 1
To select the surface isoparm you want to offset, click the Select by component type icon.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
Using Maya: Modeling
107
NURBS Modeling
Use Curves → Offset Curve to create a curve parallel to the original at a specified offset distance.
Editing Curves Offsetting curves and curves on surface
or While the surface is active, use the right mouse button to select Isoparm from the marking menu. 3
Click the isoparm you want to offset.
4
Select Curves → Offset Curve. The isoparm is offset by the default offset distance of 1.0.
If you want, you can now use this isoparm to create a beveled edge to the cylinder. 5
108
While the offset curve is highlighted, select Surfaces → Bevel.
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
NURBS Modeling
Change the offset distance from the options window, Attribute Editor, or the Channel Box. The following shows how to change the offset distance from the Channel Box. 6
To select the offset surface isoparm, open the Outliner or Hypergraph window (Window → Outliner or Hypergraph).
7
Click the heading for the offset curve in the Channel Box and enter a new Distance value for the offset.
Using Maya: Modeling
109
Editing Curves Offsetting curves and curves on surface
To offset a curve-on-surface: 1
Draw a curve-on-surface, or use another method to create a curve-on-surface (see “Creating a curve-on-surface” on page 75 for details). In this example, the surface is live and the curve-on-surface is drawn in the top view.
top view
110
perspective view
2
Select Curves → Offset Curve On Surface while the curve-on-surface is active. The curve-on-surface is offset by a default offset distance value of 1.0.
3
To change the default offset distance interactively, select the Show Manipulator Tool while the offset curve-on-surface is highlighted. Drag the manipulator, or enter a value in the Distance box in the Channel Box.
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
NURBS Modeling
You can now use the Trim Tool (Edit Surfaces → Trim Tool), for example, to trim these sections out of the surface.
Using Maya: Modeling
111
Editing Curves Offsetting curves and curves on surface
Setting Offset Curve options Select Curves → Offset Curve - ❐ to open the options window.
Determining the normal direction Use the Normal Direction options to specify how the offset is calculated. Active View
Active View calculates the offset relative to the original geometry in the active view. Curves are offset in the plane of the active view.
Geometry Average
Geometry Average calculates the offset using a geometry average. This is the default.
112
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
NURBS Modeling
Tip Planar curves are offset in the plane of that curve. 3D curves are offset in 3D. If the original geometry is rotated out of the main planes or construction planes, you can get unexpected results when you create an offset using the Active View normal direction. If this happens, delete the offset geometry and create it again using the Geometry Average calculation.
Changing the offset distance The Offset Distance value is used to specify the distance between the original curve and the offset curve. You can use manipulators and the Channel Box to change the distance between the original curve and the offset curve; you can also change this value in the Offset Distance box or move the slider to obtain the desired offset distance.
Connecting offset curve breaks Breaks can occur in an offset if you attempt to offset a curve with CVs that have a multiplicity greater than 1 or multiple knots. These curves can have sharp corners and the offset curve may therefore break apart at these points. Connect Breaks
The following Connect Breaks options are used to specify how breaks in an offset curve can be adjusted. Use Circular to insert circular arcs between the offset components. Use Linear to connect the offset geometry linearly. If Off is selected, the offset curve remains broken and no action is taken to connect the offset geometry.
Note When Connect Breaks is set to Circular or Linear, multiple knots are inserted on the curve to preserve the curve shape. Any adjustment made to the curve later in the vicinity of the multiple knot locations may result in tangent breaks along the curve.
Using Maya: Modeling
113
Editing Curves Offsetting curves and curves on surface
Curve loop cutting Loop Cutting
Turn Loop Cutting to On or Off to determine whether or not any resulting loops in the offset geometry are trimmed away. Loop Cutting is set to On by default. Offset geometry looping occurs if the offset distance from the original curve exceeds the minimum bend radius (curvature) of the curve being offset. For example, if a curve has a 20mm radius and you try to offset more than 20mm inward, the offset curve crosses over itself and creates a loop.
Loop Cutting off
Loop Cutting on
Setting the cutting radius Cutting Radius
When Loop Cutting is on (the default), the Cutting Radius value is used. If the Cutting Radius value is greater than 0, instead of getting a sharp corner at the point where the loop has been cut, the result is a small arc of the given radius.
Cutting Radius is 0.0
114
Using Maya: Modeling
Cutting Radius is 0.375
Editing Curves Offsetting curves and curves on surface
Subdividing offset geometry The Max Subdivision Density value is a multiplicative factor that specifies the maximum number of times the offset geometry can be subdivided within the current tolerance. The default is 5, which means any single span on the curve could be subdivided up to 5 times.
Applying tolerance globally or locally Use Tolerance
With Use Tolerance, you can select to apply tolerance globally or locally.
Note A few functions include Use Tolerance as a construction operation alternative. For example, you can create a revolved surface with a preset number of spans, or you can toggle Use Tolerance on so that the revolved surface is closer to the actual surface of revolution. If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling to calculate the tolerance is used.
If you select Local tolerance, a box displays where you can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful where you want to change these values often, but don’t want to change the Global tolerance all the time.
Using Maya: Modeling
115
NURBS Modeling
Max Subdivision Density
Editing Curves Offsetting curves and curves on surface
Using tolerance values to place the offset curve accurately The Tolerance value represents the accuracy in which the offset curve is placed at a specified distance. The default is accurate to within 0.05 units. The default unit is in centimeters. Offsetting is an iterative process that continues until the current offset comes within the tolerance value or the maximum subdivision limit is reached.
Tolerance
Setting the curve range If you select Complete as the Curve Range, an offset curve is created along the entire original curve.
Curve Range
Select Partial to create an offset curve on only part of the original curve. This creates a subCurve history node (initially set to the whole curve) which can be edited using the Show Manipulator Tool.
Editing part of an offset curve If Partial is the selected Curve Range in the options window, the parameter range of an offset curve with history can be edited with manipulators. 1
Select the Show Manipulator Tool, then click on the offset curve result to list the subCurve history node in the Channel Box.
2
To display the manipulators, click the heading in the Channel Box to select the subCurve history node. Notice how the original curve turns a gray color.
Drag the manipulators to edit the subCurve interactively, or enter values in the Min Value and Max Value boxes in the Channel Box.
116
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
Setting Offset Curve On Surface options Select Curves → Offset Curve On Surface - ❐ to open the options window.
Most of the options in this options window are the same as the options for Offset Curve. See “Setting Offset Curve options” on page 112 for details. The following describes the one option particular to Offset Curve On Surface.
Checking the offset’s tolerance accuracy You can change the default value of Checkpoints Density to adjust the number of points per span at which the offset curve-on-surface is compared with the original. This lets you check if the offset curve is accurate to the required tolerance.
Editing the offset curves in the Attribute Editor To edit the attributes for a completed offset curve or curve-on-surface, use the Attribute Editor. To open the Attribute Editor, either: Using Maya: Modeling
117
NURBS Modeling
Use the same procedure to edit part of an offset curve-on-surface or surface isoparm.
Editing Curves Offsetting curves and curves on surface •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor for an offset curve contains the attributes for the type of input you used to create the offset.The options you set in the options window or the Channel Box are displayed. See the option descriptions for details.
Input Curve
118
The Input Curve information is read-only. It gives you access to the history of the curves or isoparms you used. Click the arrow buttons to select the input curve or surface isoparm and open its section of the editor.
Using Maya: Modeling
Editing Curves Offsetting curves and curves on surface
Editing offset curves-on-surface in the Attribute Editor NURBS Modeling
The Attribute Editor for offset curves-on-surface differs slightly. Some attributes are not available for an offset curve-on-surface.
Editing subCurves in the Attribute Editor If the Partial option is set as the Curve Range in the options window, the Input Curve box displays the subCurve history node. Click the arrow to access the subCurve and its Attribute Editor. See “Editing subCurves in the Attribute Editor” on page 19 for details.
Using Maya: Modeling
119
Editing Curves Fitting cubic geometry to linear geometry
Fitting cubic geometry to linear geometry Use Curves → Fit B-Spline to fit a cubic curve to a degree 1 (linear) curve.
Tip Typically you use Fit B-spline when importing curves and surfaces from other systems that may import to Maya as degree 1 (linear) geometry. Degree 1 geometry is also quite common when working with digitized data.
To fit a cubic curve: 1
Select the curve or curves to which you want to fit a cubic curve.
2
Select Curves → Fit B-Spline. The fit is based on the tolerance type you select from the options window.
120
Using Maya: Modeling
Editing Curves Fitting cubic geometry to linear geometry
Setting Fit B-Spline options NURBS Modeling
Select Curves → Fit B-Spline - ❐ to open the options window.
Setting the tolerance Use Tolerance
The tolerance determines the degree of accuracy that is maintained between the original and fit or interpolated curves. Select a Use Tolerance option to apply tolerance globally or locally. If set to Global, the fit should be accurate to within 0.010 units. A unit refers to the current unit of linear measure (the default unit of measure is centimeter). The default for Use Tolerance is Global. If set to Local, you can change the default tolerance value in the Positional Tolerance box.
Using Maya: Modeling
121
Editing Curves Fitting cubic geometry to linear geometry
Editing the B-Spline curve in the Attribute Editor To edit a fit b-spline curve, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Input Curve
The Input Curve information is read-only. It gives you access to the original curve you used. Click the arrow button to select the curve and open its section of the editor.
Tolerance
The Tolerance value you set in the options window is displayed. See the option descriptions for details.
122
Using Maya: Modeling
Editing Curves Filleting curves
Filleting curves There are two ways to construct curve fillets: Circular and Freeform. Select the type you want from the options window before you create the fillet. Circular is the default fillet construction type.
Creating circular curve fillets Use circular curve fillets to create curves with the exact amount of roundness you want. The curves do not necessarily have to intersect.
To create a circular curve fillet: 1
Marquee-select two curves.
2
Open the Fillet Curve options window (Curves → Fillet Curve - ❐). Make sure Circular (which is the default) is the selected Construction type.
Tips If you select more than two curves, the last two selected curves are used to create the fillet curve. If creating a circular fillet, make sure the curves are on the ground plane or the same construction plane. You cannot fillet between a NURBS curve and a curve-on-surface, or between two curves on surface on different surfaces. If you do, a fillet is created on the first selected curve between its end points. 3
Select Curves → Fillet Curve to create the curve fillet, or click the Fillet button in the options window.
Using Maya: Modeling
123
NURBS Modeling
Use Curves → Fillet Curve to create a circular bridge between two NURBS curves or two curves on surface.
Editing Curves Creating circular curve fillets
Circular curve fillet
Editing the circular curve fillet with manipulators 1
Select the Show Manipulator Tool and click the filletCurve heading in the Channel Box to display the TopPoint manipulator and two param manipulators for the fillet curve.
TopPoint manipulator
Param manipulators
2
124
Click-drag the TopPoint manipulator to adjust the radius of the circular fillet.
Using Maya: Modeling
Editing Curves Creating circular curve fillets
NURBS Modeling
3
Click-drag the param manipulators to interactively slide the fillet curve along the input curves.
4
In the following example, notice how the values update in the Channel Box when all three manipulators are adjusted.
As you drag a manipulator, the parameter values are also updated in the Feedback Line. If you want, you can enter a numerical value in the Numerical Input line when a manipulator is active.
Using Maya: Modeling
125
Editing Curves Creating freeform curve fillets
Creating freeform curve fillets Use this type of filleting when you want more flexibility in choosing where the fillet occurs. You can specify exact parameter repositioning, or choose to fillet the curve wherever you need to.
To create a freeform curve fillet: 1
Make sure Freeform is the selected Construction type in the options window.
2
Marquee-select the curves you want to create a fillet between.
3
Select Fillet Curve to create the curve fillet.
Editing the freeform curve fillet with manipulators
126
1
Select the Show Manipulator Tool and click the filletCurve heading in the Channel Box to display two param manipulators for the fillet curve.
2
Click-drag the param manipulators to interactively slide the fillet curve along the input curves. Since the fillet curve is not circular, you can drag in any direction.
Using Maya: Modeling
Editing Curves Creating freeform curve fillets
NURBS Modeling
As you drag a manipulator, notice how the parameter values change in the Channel Box and the Feedback Line and how the freeform fillet curve is adjusted. You can also type a numerical value in the Numerical Input line when a manipulator is active.
Using Maya: Modeling
127
Editing Curves Creating freeform curve fillets
Setting Fillet Curve options Select Curves → Fillet Curve - ❐ to open the options window.
Creating and attaching trimmed fillet curves Trim
If Trim is toggled on, the curves selected as the filleting components are automatically trimmed back to the ends of the fillet curve.
Freeform fillet with Trim toggled off. Join
128
Same fillet with Trim toggled on.
The Join toggle is only available when Trim is toggled on. Use this option to join the trimmed curves to the fillet curve.
Using Maya: Modeling
Editing Curves Creating freeform curve fillets
NURBS Modeling
When Join is toggled off, the trimmed curves are not joined to the fillet curve.
When toggled on, both the trimmed curves and the fillet curve are joined.
Keeping original geometry This toggle is only available if the Trim option is toggled on. If Keep Original is toggled on, the original curves that you used to create the fillet are retained. This lets you modify the geometry of the input curves and recreate the fillet. The following shows the same fillet with Trim, Join, and Keep Original toggled on.
Setting the fillet construction type Circular
Select Circular to create fillets with true radii, based on the current Radius value. See “To create a circular curve fillet:” on page 123 for more information.
Freeform
Select Freeform when you need a fillet that is more flexible and less precise. Use this construction method to determine the contact points of the fillet and base components. See “To create a freeform curve fillet:” on page 126 for more information.
Note The Radius option is not available when you select the Freeform fillet construction type.
Using Maya: Modeling
129
Editing Curves Creating freeform curve fillets
Changing the fillet radius The value you enter in the Radius box specifies the radius of the fillet for circular curve fillet construction before the fillet is created. Use the slider or enter a new value, then press the Fillet button in the options window. The radius can also be changed interactively using manipulators (if the Show Manipulator Tool is selected), from the Channel Box, or from the fillet’s Attribute Editor.
Selecting the free-form fillet type The following Freeform Type options are used to specify on which side of a curve a free-form fillet is constructed. Tangent
If Tangent is selected, the fillet is pulled toward the intersection of the tangents of the two curves at the contact points.
Blend
If Blend is selected, the fillet is pulled toward the mid-point of the projected contact points of the two curves. Each contact point is projected onto the tangent of the other curve. The default Freeform Type is Blend.
Blend Control
Use Blend Control to adjust the fillet component. It can be toggled on or off when you use either filleting construction type. If toggled on, Depth and Bias boxes are displayed.
Note If Blend Control is toggled on when constructing circular fillets, the resulting fillet will not be truly circular. The true contact points from the circular fillet are used to create a freeform fillet.
Changing the fillet depth and bias Depth
130
The Depth value controls how much the fillet curve is pulled toward the intersection of the two curves.
Using Maya: Modeling
Editing Curves Creating freeform curve fillets
Depth = 0.5000 Bias = 0.0000 (default)
Depth = 0.0000 Bias = 0.5000
Depth = 0.3500 Bias = 0.3500
Depth = 0.7500 Bias = 0.1000
Editing curve fillets in the Attribute Editor To edit a completed curve fillet, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor for circular curve fillets and freeform curve fillets contain the same attributes. All other options are included in the Fillet Curve options window. See “Setting Fillet Curve options” on page 128 for details.
Using Maya: Modeling
131
NURBS Modeling
The Bias value controls how much the fillet curve is pulled to either of the two curves. See the following examples.
Bias
Editing Curves Creating freeform curve fillets
Input Curve
The Input Curve information is read-only. It gives you access to the history of the curves you used to create the fillet. Click the arrow buttons to select one of these curves if you want to edit it.
Curve Parameters
The Curve Parameter1 and Curve Parameter2 values correspond to the fillet’s param manipulators you see when the Show Manipulator Tool is selected. These parameter values define the region between the two curves where the fillet curve is created.
132
Using Maya: Modeling
Editing Curves Opening and closing curves and surfaces
Opening and closing curves and surfaces To close an open curve: 1
Select the curve you want to close, then select Curves → Open/Close.
2
Select Curves → Open/Close again to re-open the curve.
To create a closed surface from an open curve: 1
Use an open curve as a construction curve and select Surfaces → Revolve.
2
Pick the construction curve and select Curves → Open/Close. The revolved surface is now closed.
Using Maya: Modeling
133
NURBS Modeling
Use Curves → Open/Close or Edit Surfaces → Open/Close to toggle curves and surfaces open or closed.
Editing Curves Opening and closing curves and surfaces
3
You can open it again by selecting the construction curve and clicking Curves → Open/Close.
To open a closed surface:
134
1
Select the surface you want to open.
2
Select Edit Surfaces → Open/Close.
3
To close the open surface, simply select Edit Surfaces → Open/Close to toggle the surface closed.
Using Maya: Modeling
Editing Curves Opening and closing curves and surfaces
Setting Close Curve options NURBS Modeling
Select Curves → Open/Close Curves - ❐ to open the options window.
Preserving the shape of the original curve or surface Use Preserve Shape to determine how the original curve or surface is affected by the Open/Close operation. This option is toggled on by default. Control points are added or deleted as necessary to preserve the shape of the original curve or surface. If toggled off, the selected curve or surface is open or closed without ensuring that the shape of the original is preserved.
Keeping the original geometry Toggle Keep Original on to determine whether the original curves or surfaces are retained after Open/Close is performed.
Setting Close Surface options Select Edit Surfaces → Open/Close Surfaces - ❐ to open the options window.
Using Maya: Modeling
135
Editing Curves Opening and closing curves and surfaces
Changing the surface direction The Surface Direction options, U, V, and Both, let you choose in which direction a surface is opened or closed. The following shows how these options are used to close a beveled curve.
Surface Direction
U
V
Both
Selecting an isoparm to change the close direction You can specifically select in which direction you want to close a surface from the options window, or you can click to select isoparms on the surface. When you do this, you override the Surface Direction setting in the options window.
To select isoparms on an open surface: 1
Click the Select by component type icon.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the surface is active, use the right mouse button to select Isoparm from the marking menu. 3
136
Click on an isoparm in the direction in which you want it to open or close.
Using Maya: Modeling
Editing Curves Opening and closing curves and surfaces
V
NURBS Modeling
U
U/V
Editing the closed shape in the Attribute Editor To edit the opened or closed curve or surface, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
137
Editing Curves Opening and closing curves and surfaces
The Attribute Editor for a closed curve contains the same attributes for curves. See “Editing curves in the Attribute Editor” on page 79 for details. For a closed surface, the options you set in the options window or the Channel Box are displayed. See the option descriptions for details.
138
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
Duplicating curves and isoparms NURBS Modeling
Use Curves → Duplicate Curves to transform a curve-on-surface, a boundary curve, or an interior isoparm of an existing surface into a 3D curve.
To duplicate a surface isoparm: 1
Select the surface on which you want to duplicate an isoparm.
2
Click the Select by component type icon.
3
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the surface is active, use the right mouse to select Isoparm from the marking menu. 4
Click on a surface isoparm that is going in the same direction as the one you want to duplicate.
5
Click-drag the isoparm to the required location, then release the mouse button.
Using Maya: Modeling
139
Editing Curves Duplicating curves and isoparms 6
Select Curves → Duplicate Curves.
7
The selected surface isoparm is duplicated and highlighted, indicating that it is active.
New 3D curve
Open the Hypergraph (Window → Hypergraph) to see the new duplicated curve.
Changing a duplicated isoparm’s direction While the duplicated isoparm is active, use the left mouse button to select either U or V as the Isoparm Direction in the Channel Box or in the curveFromSurfaceIso section of the Attribute Editor. U is the default direction.
140
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
NURBS Modeling
Notes and Tips All transformations of the surface where the original curve is located are combined and applied directly to the CVs of the new duplicated curve. This places the duplicate in the same location in space as the original. If the surface isoparm you want to duplicate is either a U or V directional isoparm, you can only move it along the U or V parametric direction on the surface.
To duplicate a curve-on-surface: The following shows how to duplicate projected text to create a text string which follows the curve of a NURBS sphere. 1
Create and scale a NURBS sphere larger than the default.
2
Use Primitives → Create Text to create text and scale it larger than the default size. See “Creating and editing text” on page 235 for more information.
3
Marquee-select the sphere and the text, then use Edit Surfaces → Project Curve to project the text onto the sphere. See “Projecting curves” on page 390 for more information.
Using Maya: Modeling
141
Editing Curves Duplicating curves and isoparms
4
Select Curves → Duplicate Curves and use the Move Tool to move the duplicated text off the sphere.
To duplicate curves for trimming: Another way you can use duplicate curves on surface is to trim holes from both sides of a surface using the same curve. The following shows how to trim holes out of a NURBS cylinder.
142
1
Create a primitive cylinder at the origin and scale it by 5 in X, Y, and Z.
2
Select the cylinder and select Modify → Make Live to make it a live surface.
3
In the front view, draw a curve on the cylinder (a curve-on-surface). This curve must be a closed curve, so make sure the end points of the curve meet. To close the curve, you can also select the curve, then select Curves → Open/Close Curves.
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
NURBS Modeling
4
Deselect the curve and select Modify → Make Live again to deselect the surface. The curve you just created is highlighted.
5
Select Curves → Duplicate Curves. The curve is duplicated and appears in the lead object color.
6
Click the Snap to grids icon on the Status Line.
7
In the top view use the Move Tool and click-drag to move the duplicated curve to the other side of the surface and rotate it in Y by -180.
8
To move the duplicated curve back onto the cylinder, enter 0, 0, 0 in the Translate X, Y, and Z boxes in the Channel Box or in the Attribute Editor.
9
Select the cylinder and the duplicated curve, then select Edit Surfaces → Project Curves to highlight the projected curve.
Using Maya: Modeling
143
Editing Curves Duplicating curves and isoparms
10 Click to deselect everything. Select Edit Surfaces → Trim Tool, then click on the cylinder as the area to keep. Press Enter to trim the holes out of the surface.
Tip on duplicating a curve-on-surface If you move a curve-on-surface over a surface, it does not necessarily stay the same shape. For example, if you create a circular curve-on-surface and then start sliding it to a region of the surface where the isoparms are closer together, the curve-on-surface becomes squashed and oval shaped.
144
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
Editing part of a duplicated curve 1
While the duplicated curve is active, select the Show Manipulator Tool. Click the heading in the Channel Box to display the manipulators.
2
Drag the manipulators or enter Min or Max values to edit the duplicated surface isoparm.
Using Maya: Modeling
145
NURBS Modeling
To keep the same shape, duplicate the curve-on-surface to make it into a 3D curve. Move it over the surface to place it where you want. You can then project it back onto the surface to create a curve-on-surface and retain the curve’s shape.
Editing Curves Duplicating curves and isoparms
Setting Duplicate Curves options Select Curves → Duplicate Curves - ❐ to open the options window.
Grouping the original curve on or off The Group With Original option is toggled off by default. If you duplicate a curve with Group With Original toggled off, the resulting duplicated curve uses the world space version of the surface and is created with the initial surface’s transformation. If toggled on, the resulting curve uses the local space version of the surface, but is parented under the surface transformation. It may look the same as the isoparm or curve-on-surface, but if you edit the CVs on the resulting curve or apply any kind of transformation to it, you will notice a difference, especially after any subsequent surface transformations. For example, duplicate a cylinder isoparm, move the middle CV of the resulting curve in X, then rotate the cylinder 90 degrees about Z. If the option was toggled on, the center CV of the curve is moved in X. If toggled off, the center CV is moved in Y, which may be the result you need.
146
Using Maya: Modeling
Editing Curves Duplicating curves and isoparms
Editing the duplicated curve in the Attribute Editor
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. A duplicated curve includes the same options and parameters for a curve. See “Editing curves in the Attribute Editor” on page 79 for details.
Using Maya: Modeling
147
NURBS Modeling
To edit a duplicated curve, use the Attribute Editor. To open the Attribute Editor, either:
Editing Curves Attaching curves and surfaces
Attaching curves and surfaces You use Curves → Attach Curves to join two curves by attaching their endpoints to create a single curve. You can also join two surfaces by attaching their edges to create a single surface.
Attaching curves and surfaces with history off The Attach options windows (both for curves and surfaces) contain a toggle that lets you keep the original curves or surfaces after the attach is performed. Keep Original is toggled on by default. Try not to toggle this option off if history is set to on (the Construction History icon in the Status Line); odd behavior can occur if the attached curve or surface is modified later. In the following, two curves are attached using different settings for Keep Original and history. They are then scaled by 0.5 in X, Y, and Z.
Original curves
If history is on and Keep Original is toggled off, the attached curve replaces the first curve. When you scale the resulting attached curve, the scale is applied to the original curve (the one that was replaced) and changes the shape of the curve, thereby changing the attachment. History on, Keep Original off
The attachment looks fine, but when you scale the attached curve, the results are probably not what you expected.
148
Using Maya: Modeling
Editing Curves Attaching curves and surfaces
NURBS Modeling
If you want to scale the attached curve and maintain its shape, make sure construction history is off when Keep Original is toggled off, or both construction history and Keep Original are set to on. History on, Keep Original on
History off, Keep Original off
To attach two curves: 1
Marquee-select the curves you want to attach.
2
Select Curves → Attach Curves to attach the two curves. The curve ends that are closest to each other are attached.
You can also place a curve point to specify the attach location. To place a curve point, use the marking menu or the Select by component type icon.
To place a curve point using the marking menu: 1
Select the first curve, press the right mouse button while the pointer is over the curve and select Curve Point from the marking menu. Using Maya: Modeling
149
Editing Curves Attaching curves and surfaces
150
2
Click on the curve where you want to place the first curve point. A point is displayed at the click location.
3
Shift-select the other curve and release the mouse button.
4
Press the right mouse button while the pointer is over this curve and select Curve Point from the marking menu again.
5
Shift-select and click at the next attach location. Another point is displayed at the click location.
6
Select Curves → Attach Curves to attach the curves.
Using Maya: Modeling
Editing Curves Attaching curves and surfaces
To place a curve point in component mode: Click the Select by component type icon on the Status Line.
2
With the right mouse button, click the Parm Points icon and toggle Curve Points on from the pop-up menu.
3
Click on the first curve to place the first point and Shift-click on the second curve. Points are displayed at each click location.
4
Select Curves → Attach Curves to attach the two curves.
5
To return to object selection mode, click the Select by object type icon on the Status Line.
To attach two surfaces: To specify the attach location for surfaces, use the marking menu or the Select by component type icon. To attach two surfaces, you must select surface isoparms.
Important Note When you select isoparms to attach surfaces, the surfaces are attached depending on the selection order. In the following example, the isoparms are selected in a different order. Notice the difference between the two resulting surfaces. The same applies when attaching two curves.
Using Maya: Modeling
151
NURBS Modeling
1
Editing Curves Attaching curves and surfaces
Pick first
Pick first
To select isoparms using the marking menu: 1
With the pointer positioned over the surface, use the right mouse button to select Isoparm from the marking menu, and click to select an isoparm.
Select isoparm
2
152
Shift-select the other surface and release the mouse button.
Using Maya: Modeling
Editing Curves Attaching curves and surfaces With the pointer positioned over this surface, use the right mouse button to select Isoparm from the marking menu again.
4
Shift-select the second isoparm.
5
To attach the surfaces, select Edit Surfaces → Attach Surfaces.
To select isoparms in component mode: 1
Click the Select by component type icon on the Status Line.
2
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
3
Click on the first isoparm you want to attach, then Shift-select the second isoparm.
4
Select Edit Surfaces → Attach Surfaces to attach the two surfaces.
5
To return to object selection mode, click the Select by object type icon on the Status Line.
Using Maya: Modeling
153
NURBS Modeling
3
Editing Curves Attaching curves and surfaces
Setting Attach Curves and Attach Surfaces options Select Curves → Attach Curves - ❐ or Edit Surfaces → Attach Surfaces - ❐ to open the options window.
Keeping and removing knots Multiple Knots
The Multiple Knots options are used to specify whether the multiple knots at the join point are kept or removed after the attach is done. Use Keep to keep the multiple knots created at the join point as a result of the attach. This is the default. Use Remove to remove the multiple knots at the join point. The shape of the geometry can be changed if required.
154
Using Maya: Modeling
Editing Curves Attaching curves and surfaces
NURBS Modeling
Tip If you construct the initial curves or surfaces carefully, an attach usually produces the desired results without knot insertion. If you perform an attach operation with Multiple Knots set to Remove and then feel you need more localized control, you can reverse it using Edit → Undo, then perform the Attach again with Keep selected.
Keeping original geometry If Keep Original is toggled on, the original curves or surfaces are retained after the attach is performed. See “Attaching curves and surfaces with history off” on page 148 for information.
Editing the attachment in the Attribute Editor You can edit the parameters displayed in the Channel Box and the Attribute Editor for a selected attached curve or attached surface node. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The options you set in the options window or the Channel Box are displayed in the Attribute Editor. See the option descriptions for details. These parameters are the same as the Curves → Align Curves parameters. All Continuity and Scaling options are off by default and should not be toggled on. The Join parameter can be changed to specify a different end of the curve or surface isoparm to use in the attach. See “Editing the alignment using manipulators and the Channel Box” on page 178 and “Editing the alignment in the Attribute Editor” on page 180 for more information about these parameters.
Using Maya: Modeling
155
Editing Curves Detaching curves and surfaces
Detaching curves and surfaces Use Curves → Detach Curves or Edit Surfaces → Detach Surfaces to break a curve into two curves, to open a currently closed curve, or to detach a surface.
To detach a curve: The following shows what happens when you detach part of the construction curve used to create a revolved surface. The revolved surface must be created with the Construction History icon on. 1
Select the original construction curve.
If it is difficult to select the construction curve, open the Hypergraph or Outliner window and select it from there.
156
Using Maya: Modeling
Editing Curves Detaching curves and surfaces Click the Select by component type icon from the Status Line.
3
With the right mouse button, click the Parm Points icon and toggle Curve Points on from the pop-up menu.
or While the pointer is over the active curve, use the right mouse button to select Curve Point from the marking menu. 4
Click where you want to detach the curve. A point appears where you click. This point is the parameter value.
Tip To change the detach location before detaching the curve, click on another point and drag it along the curve. 5
Select Curves → Detach Curves. The construction curve is detached at this parameter value, the detached section of the curve is highlighted, and the revolved surface is reconstructed.
Using Maya: Modeling
157
NURBS Modeling
2
Editing Curves Detaching curves and surfaces
6
To delete the unwanted curve section, deselect everything, select the part of the curve you want to delete and press the Backspace key.
You can also detach at more than one curve point at a time. Shift-click when placing the curve points and select Curves → Detach Curves.
To move a periodic curve’s start point: A periodic curve, such as a NURBS circle or a closed curve, has a start point. You can move this start point using Detach Curves.
158
1
Make sure the Construction History icon is off in the Status Line before you create the curve.
2
With the right mouse button, select Curve Point from the marking menu.
3
Click to determine a detach point, then select Curves → Detach Curves. This moves the start point to the curve point position.
Using Maya: Modeling
Editing Curves Detaching curves and surfaces
start point moved detach point
To detach a surface: 1
Select the surface you want to detach.
2
Click the Select by component type icon.
3
With the right mouse button, click the Lines icon and toggle Isoparms on from the pop-up menu.
or While the pointer is over the active surface, use the right mouse button to select Isoparm from the marking menu. 4
Click on the isoparm where you want to detach the surface.
Using Maya: Modeling
159
NURBS Modeling
start point
Editing Curves Detaching curves and surfaces
5
Select Edit Surfaces → Detach Surfaces. The surface is detached from the isoparm location you specified.
6
You can now transform the detached section of the surface.
You can also detach at more than one isoparm at a time. When you select the isoparms, Shift-click to select more than one isoparm, then select Edit Surfaces → Detach Surfaces.
160
Using Maya: Modeling
Editing Curves Detaching curves and surfaces
NURBS Modeling
Setting Detach Curves and Detach Surfaces options Select Curves → Detach Curves - ❐ or Edit Surfaces → Detach Surfaces - ❐ to open the options window.
Keeping original geometry If Keep Original is toggled on when you perform the detach, the original curve or surface is retained. If you use the Show Manipulator Tool when you perform the detach, a detach curve manipulator is displayed. This manipulator lets you interactively change the parameter value for the detach.
Using Maya: Modeling
161
Editing Curves Detaching curves and surfaces If you later want to change this value with the Show Manipulator Tool, select the detached curve, then select the detach curve node in the Channel Box, and enter a new parameter value.
Editing the detachment in the Attribute Editor The Attribute Editor for a detached curve contains the same attributes for curves. See “Editing curves in the Attribute Editor” on page 79 for details. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor. The Attribute Editor for detached surfaces, however, contains the same attributes you find in the Channel Box. See “Changing the detach direction and position,” that follows for details.
162
Using Maya: Modeling
Editing Curves Detaching curves and surfaces
NURBS Modeling
Input Surface
The Input Surface information is read-only. It gives you access to the history of the surface you detached. Click the arrow button to select the surface and open its section of the editor.
Direction
Use the Direction pop-up menu items to specify the direction of the detachment.
Keeping the geometry in U or V The Keep section lets you specify whether or not original geometry is kept in either U or V when you perform the detachment.
Changing the detach direction and position You can change the direction of the detachment by selecting U or V from the Direction pop-up menu in the Channel Box or Attribute Editor. You can also enter a parameter value to change where the detachment occurs. In the following, a V isoparm is selected, moved, and then detached twice. The first detachment moves the seam of the cone, which is periodic in V.
Using Maya: Modeling
163
Editing Curves Detaching curves and surfaces
If you change the parameter value, the detachment area is increased or decreased. In the following example, the parameter value is increased to 1.5.
To change the detach direction, select U from the Direction pop-up menu to detach the isoparm from a parameter value of 1.5 in the U direction.
164
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Aligning curves and surfaces What is continuity? Continuity between curves or surfaces can be an important factor when you want to create the perfect surface for animation and rendering purposes. Aligning always enforces at least positional continuity, and lets you enforce tangent and curvature continuity. Once the selected elements are aligned, you can adjust the tangent magnitude at the junction of the two elements by setting options or manipulators to give you more control when modifying the aligned elements.
Positional continuity aligns the first CVs along the curves or surface isoparms.
1st CV 2nd CV Tangent continuity uses the second CVs to achieve tangent continuity.
1st CV Curvature continuity uses the third CVs to achieve curvature continuity.
3rd CV
When you use Align, the selected elements are modified to positional continuity based on one option setting, then modified to tangent continuity based on a second option setting. See “Setting Align options” on page 172 for more information.
Using Maya: Modeling
165
NURBS Modeling
Use Curves → Align Curves and Edit Surfaces → Align Surfaces to establish continuity between curves and surfaces.
Editing Curves Aligning curves and surfaces
Important notes The Align options windows (both for curves and surfaces) contain an Attach toggle that lets you attach the original curves or surfaces after the align is performed. Attach is toggled off by default. If this option is on, toggle history off (the Construction History icon in the Status Line) or odd behavior can occur if the aligned curve or surface is modified later. See “Attaching curves and surfaces with history off” on page 148 for examples. If the Attach option is toggled on in the options window, the aligned elements are joined together and you get one result.
Selecting curve points and isoparms to align Align doesn’t always work when you marquee-select curves or surfaces. Select a component (a curve point or a surface isoparm) to reliably define which ends to align.
Aligning Curves To specify the align location for curves, you have to place curve points. Use the Select by component type icon or the marking menu. The following alignment is performed using the default option settings.
To align two curves in component mode:
166
1
Click the Select by component type icon from the Status Line.
2
With the right mouse button, click the Parm Points icon to toggle Curve Points on from the pop-up menu.
3
Click on the first curve to place the first point, and Shift-click on the second curve. Points are displayed at each click location.
4
Select Curves → Align Curves to align the two curves.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
NURBS Modeling
If necessary, you can also select the curve point and drag it to the desired location.
To return to object selection mode, click the Select by object type icon on the Status Line.
To align two curves from the marking menu: 1
Select the first curve, and while the pointer is over the curve select Curve Point from the marking menu.
Using Maya: Modeling
167
Editing Curves Aligning curves and surfaces
168
2
Click on the curve where you want to place the first curve point.
3
Shift-select the other curve and release the mouse button.
4
While the pointer is over this curve, use the right mouse button to select Curve Point from the marking menu again.
5
Shift-click at the next align location. Another point is displayed.
6
Select Curves → Align Curves to align the curves.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
A curve can only be aligned to another free curve. A curve-on-surface can only be aligned to another curve-on-surface, provided it is on the same surface.
Aligning surfaces To specify the align location for surfaces, you have to select surface isoparms. Use the Select by component type icon or the marking menu. The following alignment is performed using the default option settings.
To align surface isoparms in component mode: 1
Click the Select by component type icon.
2
With the right mouse button, click the Lines icon to toggle Isoparms on from the pop-up menu.
3
Click on the isoparms where you want to align the surfaces, then select Edit Surfaces → Align Surfaces.
Using Maya: Modeling
169
NURBS Modeling
Tips
Editing Curves Aligning curves and surfaces
Tips You can also hold the mouse and drag the isoparm to another location if necessary. When aligning a surface to a surface, only surface isoparm boundaries can be modified, although you can align one surface (the one that is modified) to any isoparm on the other surface.
To align surface isoparms from the marking menu: 1
With the pointer positioned over the first surface, use the right mouse button to select Isoparm from the marking menu, and click to select an isoparm.
2
With the pointer positioned over the second surface, use the right mouse button to select Isoparm from the marking menu again.
3
Shift-select the second isoparm.
4
Select Edit Surfaces → Align Surfaces to align the surfaces.
Align limitations
170
•
You cannot align closed/periodic curves or surface boundaries that are closed/periodic.
•
An exact tangent or curvature continuous surface cannot be guaranteed if surfaces are rational (if the weight is not 1.0, the surface is rational).
•
You cannot align a free curve to a curve-on-surface.
•
You cannot align a curve or surface to itself.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Aligning to a trimmed edge
1
Select an isoparm at the edge of the untrimmed surface and one near the trimmed edge of the other surface.
2
Adjust the Join Parameter value in the Channel Box if necessary.
Using Maya: Modeling
171
NURBS Modeling
You cannot align to a trimmed edge; you can only align to surface isoparms. For example, if your surfaces look like the following you can still align the two surfaces, but Align uses the boundary of the underlying surface of the trimmed surface.
Editing Curves Aligning curves and surfaces
Setting Align options Select Curves → Align Curves - ❐ or Edit Surfaces → Align Surfaces - ❐ to open the options window.
See “Editing the alignment using manipulators and the Channel Box” on page 178 to find out how you can adjust some of these parameters in the Channel Box to suit your needs.
Setting attachment options Select Attach if you want to attach the alignment. You can then set the following options:
Attach
Keeping or removing multiple knots Multiple Knots
When objects are joined, Multiple Knots are created at the join parameter. Select Keep to retain these knots. Select Remove to remove as many knots as possible without changing the shape of the object when the attach is performed.
172
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Determining the continuity between intersections
Position
Positional continuity means that the ends of two curves or the edges of two surfaces meet exactly. The following shows how curves are aligned with each Modify Position option (First, Second, and Both). When Keep Original is toggled on, notice how the curves are aligned by comparing the position of the original curves to the aligned curve. The alignment occurs depending on which curve is selected first (white) and last (green).
Both
First (default)
Second
See “Changing the order of the alignment” on page 174 for more information about the order in which you want the curve or surface modified. Tangent
Tangent continuity exists when two elements are placed end to end, but the tangents at the two endpoints also match.
Using Maya: Modeling
173
NURBS Modeling
Continuity means that two curves intersect, or that two surfaces share a boundary. Continuity options let you specify how to achieve continuity for the two elements. See “What is continuity?” on page 165 for more information about continuity.
Editing Curves Aligning curves and surfaces
End point of curves curve 1
curve 2
Curvature
Curvature continuity exists when two elements that meet with tangent continuity also have the same curvature at the joint. When this option is selected, the curvature scale sliders are enabled. See also “Scaling the tangent and curvature alignment” on page 177 for information on increasing or decreasing the tangent magnitude or curvature at the end of a curve.
Changing the order of the alignment You can choose in what order you want the curve or surface modified. The following tables show what is modified when you select the Modify Position, Modify Boundary, and Modify Tangent options, First, Second, or Both, for curves or surfaces.
Changing the Modify Position options
Modify Position
Curves
Surfaces
First
The entire first curve moves so its end point coincides with the start of the second curve.
The entire first surface moves so its end boundary coincides with the start boundary of the second surface. Some adjustments are made to the first surface end boundary CVs.
Only the shape of the first element you select is modified.
174
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Curves
Surfaces
Second
The entire second curve moves so its start point coincides with the end of the first curve.
The entire second surface moves so its start boundary coincides with the end boundary of the first surface. Some adjustments are made to the second surface start boundary CVs.
The entire first and second curves move so that the end points coincide with each other. The CVs at the end points are moved halfway along the line of minimum distance.
The entire first and second surfaces move so that the end boundary of the first surface and the start boundary of the second surface coincide. The adjacent boundary CVs move halfway along the line of minimum distance.
Only the shape of the second element you select is modified.
Both
The shapes of both the first and second elements you select are modified.
Changing the Modify Boundary options
Modify Boundary
Curves
Surfaces
First
The CV at the endpoint of the first curve moves to coincide with the CV at the start point of the second curve.
All the end boundary CVs of the first surface move to coincide with the adjacent start boundary CVs of the second surface.
Only the shape of the first element you select is modified.
Using Maya: Modeling
175
NURBS Modeling
Modify Position
Editing Curves Aligning curves and surfaces
Modify Boundary
Curves
Surfaces
Second
The CV at the start point of the second curve moves to coincide with the CV at the end point of the first curve.
All the start boundary CVs of the second surface move to coincide with the adjacent end boundary CVs of the first surface.
The CVs at the end point of the first curve and the start point of the second curve move to coincide with each other. The CVs at the end points are moved halfway along the line of minimum distance.
All the end boundary CVs of the first surface and the start boundary CVs of the second surface move to coincide with each other. The adjacent CVs move halfway along the line of minimum distance.
Only the shape of the second element you select is modified.
Both
The shapes of both the first and second elements you select are modified.
Changing the Modify Tangent options
Modify Tangent
Curves
Surfaces
First
The tangent at the end of the first curve adjusts to coincide with the tangent at the start of the second curve.
The tangents at the end boundary of the first surface adjust to coincide with the tangents at the start boundary of the second surface.
The tangent at the start of the second curve adjusts to coincide with the tangent at the end of the first curve.
The tangents at the start boundary of the second surface are adjust to coincide with the tangents at the end boundary of the first surface.
Only the shape of the first element you select is modified.
Second
Only the shape of the second element you select is modified.
176
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Note
Scaling the tangent and curvature alignment The values in the Tangent Scale and Curvature Scale boxes increase or decrease the tangent magnitude or curvature at the end of the curve or surface. You can enter a value in the box or drag the slider bar. The following table shows what happens when the tangent and curvature is scaled.
Tangent Scale
Curves
Surfaces
First
The tangent magnitude at the end of the first curve adjusts.
The tangent magnitude at the end boundary of the first surface adjusts.
Only the shape of the second element you select is scaled.
The tangent magnitude at the start of the second curve adjusts.
The tangent magnitude at the start boundary of the second surface adjusts.
Curvature Scale
Curves
Surfaces
First
The curvature at the end of the first curve adjusts.
The curvature at the end boundary of the first surface adjusts.
The curvature at the start of the second curve adjusts.
The curvature at the start boundary of the second surface adjusts.
Only the shape of the first element you select is scaled. Second
Only the shape of the first element you select is scaled. Second
Only the shape of the second element you select is scaled.
Using Maya: Modeling
177
NURBS Modeling
Curvature continuity is applied to the curve or surface that is modified for tangent continuity (see the table above).
Editing Curves Aligning curves and surfaces
Keeping original geometry If Keep Original is toggled off, the original curves or surfaces are replaced with the aligned curves or surfaces. If toggled on, two new curves or surfaces are created and the originals are retained.
Editing the alignment using manipulators and the Channel Box To display manipulators on your curves or surfaces so you can edit the alignment interactively, turn construction history on before performing an alignment, then select the Show Manipulator Tool.
Tangent scale manipulators
Use to adjust Join parameter
If Continuity is set to Curvature and the scale value is more than 0, more manipulators are added. The example on the left shows the manipulators for the default, Curvature Scale First and Second set to 0.0. The example on the right shows the manipulators if the scale values are changed to 2.0
Curvature scale = 0 (default)
Curvature Scale = 2
You can edit the options in the Channel Box for selected items. For example, if you edit the tangent scale parameters in the Channel Box for a curve, notice how the manipulators are adjusted.
178
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
NURBS Modeling
Some of these parameters are also included in the Attribute Editor. See “Editing the alignment in the Attribute Editor” on page 180 for details.
Using Maya: Modeling
179
Editing Curves Aligning curves and surfaces Enter parameter values, or choose items from the Continuity Type pop-up menus using the left mouse button. Type on or off to toggle the Reverse and Swap parameters as well as Tangent and Curvature Continuity. The Direction U parameter determines in which direction the alignment occurs. If off, the alignment occurs in the V direction. See the section describing the Reverse, Swap, and Twist toggles in “Editing aligned surfaces in the Attribute Editor” on page 183.
Editing the alignment in the Attribute Editor The Attribute Editor for Align Curves and Align Surfaces reflect the options you see in the Channel Box and the options window for an aligned curve or an aligned surface. If you aligned curves, the sections of the editor for the Input Curves are accessible. If you aligned surfaces, the sections of the editor for the Input Surfaces are accessible. To open the Attribute Editor, either:
180
•
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Editing aligned curves in the Attribute Editor NURBS Modeling
The Align History section of the editor for a curve alignment includes options you set in the options window or the Channel Box. Input Curve
The Input Curve information is read-only. It gives you access to the history of the curves you aligned. Click the arrow buttons to select an input curve and open its section of the editor.
Using Maya: Modeling
181
Editing Curves Aligning curves and surfaces Positional/ Tangent Continuity
For details on Positional and Tangent Continuity types, see “Determining the continuity between intersections” on page 173.
Join Parameter
The Join Parameter slider becomes available depending on the Positional Continuity Type you select. Use Join Parameter to define the parameter on the first/second item at which the alignment is performed. For example, if Move First is selected for curves, the join parameter defines the point on the second curve where the first one is aligned.
Reverse
For curves, the Reverse toggles specify whether the curves must be reversed before performing the alignment. Remember, Align uses the end point of the first curve and the start point of the second curve.
Interior Blending
The Interior Blending sections are the same as the Tangent Scale options in the options window. The sliders become available depending on which type of continuity you select.
182
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
Editing aligned surfaces in the Attribute Editor NURBS Modeling
The Align History section of the editor for a surface alignment includes options you set in the options window or the Channel Box. Input Surface
The Input Surface information is read-only. It gives you access to the history of the surfaces you aligned. Click the arrow buttons to select an input surface and open its section of the editor. Using Maya: Modeling
183
Editing Curves Aligning curves and surfaces Positional/ Tangent Continuity
For details on Positional and Tangent Continuity types, see “Determining the continuity between intersections” on page 173.
Join Parameter
The Join Parameter slider becomes available depending on the Positional Continuity Type you select. Use Join Parameter to define the parameter on the first/second item at which the alignment is performed.
Reverse/Swap
The Reverse and Swap toggles for surfaces define whether the surfaces have to be reversed and or swapped before performing the alignment (remember, align uses the end of the first surface and the start of the second). The reverse is done in the direction defined by Direction U (on or off) in the Channel Box.
Twist
If Twist is toggled on, the second surface is also reversed in the opposite direction of Direction U. Turn this on if your aligned surface is twisted. For example, if you align the surfaces and the surface boundaries are going in different directions, the following results.
Surface boundaries are not going in the same direction.
When you marquee-select the surfaces, the align result is twisted. Turn Twist on either from the Attribute Editor or in the Channel Box to correct the problem.
184
Using Maya: Modeling
Editing Curves Aligning curves and surfaces
NURBS Modeling
Twist off
Twist on
The other alternative is to check the surface U/V direction before you align the surfaces. Use Edit Surfaces → Reverse Surfaces to reverse the surface directions if necessary. See “Reversing the curve or surface direction” on page 195 for details. Reverse the surface boundary on one of the surfaces.
Align result
Interior Blending
The Interior Blending sections are the same as the Tangent Scale options in the options window. The sliders become available depending on which type of continuity you select.
Using Maya: Modeling
185
Editing Curves Projecting curve tangents
Projecting curve tangents Use Curves → Project Tangent to modify a curve’s tangent at an endpoint so that it coincides with the tangent of a surface or two other intersecting curves. You can also use this method to adjust a curve’s curvature to match a surface curvature, or the curvature where two other curves intersect. For instance, if a curve’s end point is on a surface, use this function to make the curve tangent continuous with either the U or V direction of the surface where the curve touches the surface. Although you can use Align Curves (Curves → Align Curves) to establish tangent plane continuity between construction curves prior to constructing a surface, it can only align curves to curves or surfaces to surfaces. Project Tangent can be used to easily re-establish tangent continuity of a curve with two other curves or with a surface before constructing the next surface.
To project a curve tangent onto a surface:
186
1
Select the surface you want to use for the project tangent, then select the curve that you want to modify.
2
Select Curves → Project Tangent.
Using Maya: Modeling
Editing Curves Projecting curve tangents
In some cases, you cannot project one curve tangent onto two surfaces at different ends of the curve. You must be careful that there are enough interior CVs to avoid any overlap. For instance, if the curve is cubic and you want to project both ends of the curve with curvature continuity, you should make sure that the curve has at least three spans (that is, a total of six CVs).
To project a curve tangent onto curves: 1
When projecting curve tangents, make sure the endpoint of the curve you want to project is located at the intersection of the other curves.
Intersection point
2
Select the curve for which you want to project a tangent first then Shift-select the other curves.
3
The tangent is projected depending on which curve you select last (highlighted in green).
Using Maya: Modeling
187
NURBS Modeling
Note
Editing Curves Projecting curve tangents
Setting Project Tangent options Select Curves → Project Tangent - ❐ to open the options window.
Defining the construction type Construction
The following Construction options lets you determine what construction method is used to project the curve. The default project tangent Construction type is Tangent. The curve is modified by projecting its tangent vector where it intersects the surface onto the tangent plane of the surface. This means that only necessary modifications are made to the start or end of the curve where it intersects the surface. If you select Curvature, the curve is made tangent and curvature continuous with the surface in the direction of the tangent vector. An extra manipulator is displayed on the curve to let you adjust the Curvature Scale value. (The Curvature Scale slider is also displayed in the options window when this option is selected).
188
Using Maya: Modeling
Editing Curves Projecting curve tangents
NURBS Modeling
Setting the tangent align direction Tangent Align Direction
The Tangent Align Direction options provide a convenient way to either: •
reverse the direction of the curve’s tangent vector,
•
automatically align the tangent vector with either the U or V parameter directions of the intersecting surface or two curves. Select either U or V to pick which tangent you want to use for the adjustment. U is the U direction of the surface, or the second selected curve. V is the V direction of the surface, or the third selected curve. Normal is the normal vector of the tangent plane. Select the Normal option to make a curve normal to or perpendicular to a surface or two curves. When selected, the curve is no longer tangent continuous to the surface since it is perpendicular to the surface.
Notes When you select Normal, it becomes the mode you are working in for the current curve modification. To return to the general project tangent operation, select either the U or V tangent align direction. Tangent rotation is not available when the Tangent Align Direction is Normal.
Using Maya: Modeling
189
Editing Curves Projecting curve tangents
Scaling the tangent Tangent Scale
The Tangent Scale slider displays the current tangent scale factor. Scaling the tangent adjusts the length of the tangent vector without changing its direction. You can adjust the tangent scale by clicking and moving the slider, or by entering a value. A negative scale factor reverses the direction of the tangent vector.
Rotating the tangent Tangent Rotation
The Tangent Rotation slider displays the current tangent rotation angle. Adjusting the rotation rotates the tangent vector on the tangent plane defined by the surface intersection. You can adjust the tangent rotation angle by clicking and moving the slider, or by entering a value.
Note If you change the Tangent Rotation value, the curve is no longer tangent to the surface or two other curves.
Adjusting the curvature scale Curvature Scale
Project tangent works by first selecting a curve to modify and then selecting a surface or two other curves that intersect with either of its end points. The curve is modified by projecting its tangent vector where it intersects the surface onto the tangent plane of the surface. If Curvature is selected as the construction type, the curve is made tangent and curvature continuous with the surface or curves in the direction in which the tangent vector is going. Adjusting the Curvature Scale value modifies the curve in such a way that the tangent or curvature doesn’t change at the curve or surface intersection point. For example, if you modify a curve at its end point, the curvature slider moves the third CV from the end of the curve along a line that joins the end two CVs of the curve (for instance, along the tangent vector line). Such a modification doesn’t change the curvature at the end of the curve, it just adjusts the tangent vector.
Reversing the tangent vector direction Reverse Direction
190
Toggle Reverse Direction on or off to change the direction of the tangent vector so that it points in the opposite direction. Reverse Direction simply multiplies the current tangent scale factor by -1.0.
Using Maya: Modeling
Editing Curves Projecting curve tangents
Keeping original geometry
Adjusting the tangent interactively When you select the Show Manipulator Tool after you project a tangent onto a surface, manipulators display as well as editable parameter boxes in the Channel Box. You can click-drag these manipulators to interactively adjust the curvature scale, tangent scale, or tangent rotation of the curve. You can also enter values in the Channel Box, or in the Numerical Input line when a manipulator is active.
Curvature manipulators The manipulators correspond to the Construction method you used in the options window. For example, if the project tangent Construction method is Curvature, an extra manipulator appears.
Curvature Scale Point manipulator
If the Curvature Scale value does not equal 0, the Curvature Scale Point manipulator appears at the specified scale location. In the following, the scale value is 4.0.
Using Maya: Modeling
191
NURBS Modeling
Toggle Keep Original on to keep the original curve after the projection is performed.
Editing Curves Projecting curve tangents
Tangent manipulators The following examples show the manipulators for a Tangent Construction method. Click-drag the Rotation manipulator to rotate the tangent vector.
Rotation manipulator
Click-drag the Tangent Scale Point manipulator to adjust the tangent scale.
Tangent Scale Point manipulator
The same manipulators appear for curves.
Curvature Scale Point manipulator
Rotation manipulator
192
Using Maya: Modeling
Editing Curves Projecting curve tangents
NURBS Modeling
Tangent Scale Point manipulator
Editing the projected tangent in the Attribute Editor To edit a projected tangent, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
Using Maya: Modeling
193
Editing Curves Projecting curve tangents
The Attribute Editor for a projected tangent contains the same attributes you set in the options window and the Channel Box. See the option descriptions for details.
194
Using Maya: Modeling
Editing Curves Reversing the curve or surface direction
Reversing the curve or surface direction
Tip Since motion path curves follow the direction of the curve, you can use Reverse to change the path direction.
To reverse the direction of CVs on a curve: 1
Make sure the curve is active.
2
To display the curve CVs, select Display → NURBS Components → CVs.
3
Select Curves → Reverse Curve. The CVs are reversed along the U parametric direction by default.
Start CV
After Reverse
To reverse the surface normal direction: See “What you need to know about surfaces” on page 243 for more information about the surface direction and surface normals. 1
Make sure the surface is active.
2
To display the surface CVs, select Display → NURBS Components → CVs.
3
Select Edit Surfaces → Reverse Surface. The surface normals are reversed along the U parametric direction by default. See “Changing the direction of surface CVs” on page 197 for more information on how to reverse the surface CV direction.
Using Maya: Modeling
195
NURBS Modeling
Use Curves → Reverse Curves to reverse the sequence (direction) of CVs on a curve. Use Edit Surfaces → Reverse Surfaces to reverse and examine the surface normals for surfaces and trimmed surfaces.
Editing Curves Reversing the curve or surface direction
Setting Reverse Curves options Select Curves → Reverse Curve - ❐ to open the options window.
Keeping original geometry Toggle Keep Original on to determine whether the original curves are retained after a Reverse operation is performed.
To switch start and end CVs using the Show Manipulator Tool:
196
1
Check to make sure Construction History is on in the Status Line or manipulators do not display during the Reverse operation.
2
Select the Show Manipulator Tool, toggle Keep Original on, and then reverse the curve CVs to display a reverse curve manipulator. Click this manipulator to interactively reverse the curve’s start and end CVs.
Using Maya: Modeling
Editing Curves Reversing the curve or surface direction
Setting Reverse Surfaces options
Changing the direction of surface CVs The following is a close-up view of the U and V indicators on a surface.
U and V indicators.
When you reverse the Surface Direction, notice how the indicators change depending on what you choose. Surface Direction
Select U to reverse the CVs along the U parametric direction. U is the default surface direction. Select V to reverse the CVs along the V parametric direction. Select Swap to exchange U and V parameterization. Selecting an item a second time using the same direction restores the original CV sequence. Reversing the sequence of CVs for a surface reverses the surface normals. Select Both to reverse the CVs and normals along both U and V parametric directions.
Using Maya: Modeling
197
NURBS Modeling
Select Edit Surfaces → Reverse Surfaces - ❐ to open the options window.
Editing Curves Reversing the curve or surface direction
To quickly reverse a surface: To quickly reverse a surface in a specific direction, select an isoparm and then select Edit Surfaces → Reverse Surfaces without opening the options window.
Reversed direction
Reversed direction
Reversed direction
Editing the reversed item in the Attribute Editor The Attribute Editor for a reversed curve or surface contains the same curve and surface history attributes for a curve or an object. See “Editing curves in the Attribute Editor” on page 79 and “Editing objects in the Attribute Editor” on page 227 for details.
198
Using Maya: Modeling
Editing Curves Rebuilding curves
Rebuilding curves To rebuild a curve: 1
Click on the curve or marquee-select the curves that you want to rebuild.
2
Select Curves → Rebuild Curve. The curve is rebuilt based on the current option settings. In the following example, the curve is rebuilt with the default settings.
Original curve with CVs
Rebuilt curve
3
Toggle Keep Original on in the options window (it is off by default) and select Display → NURBS Components. Now you can see the CVs or edit points on the curve when you rebuild the curve. This lets you easily verify how the rebuild affects the curve.
4
A new curve is rebuilt on top of the original and becomes the active curve. You can move the new curve and select the original curve to try different option settings. This way you can compare the results and delete the curves you don’t want.
Using Maya: Modeling
199
NURBS Modeling
Use Curves → Rebuild Curve to rebuild a NURBS curve or curve-on-surface to reduce data and construct smoother curves.
Editing Curves Rebuilding curves 5
You can also select the original curve from the Channel Box by clicking the heading to display and edit its parameters if necessary.
Setting Rebuild Curve options Select Curves → Rebuild Curve - ❐ to open the options window.
The Rebuild Curve options window changes to include the options associated with a selected option setting, or to hide the options you don’t need.
200
Using Maya: Modeling
Editing Curves Rebuilding curves
Changing the curve rebuild type
Rebuilding the curve uniformly Uniform
Select Uniform (the default) to rebuild a curve with uniform parameterization. You can change the number of spans and degree of the curve you want to rebuild. The Number of Spans and Degree values become available. You can enter a value in the boxes or use the slider bar. When you press the Rebuild button after you change the values, the curve is rebuilt as a uniform knot curve of the specified degree and number of spans.
Reducing the number of spans on the curve Reduce
If Reduce is selected, a knot is removed only if its removal does not cause any of the remaining CVs to move by a distance greater than the tolerance setting. A higher tolerance setting results in a greater span reduction. See “Setting the curve’s tolerance,” next.
Setting the curve’s tolerance Use Tolerance
If the Rebuild Type is Reduce or Curvature, the Use Tolerance options are displayed in the options window.
These options let you rebuild the curve within a specified tolerance of the original curve. You can select to apply global tolerance or set the specific tolerance for this function.
Using Maya: Modeling
201
NURBS Modeling
There are various options you can set to rebuild your curves to suit your needs. The options window changes depending on the type of rebuild you select.
Editing Curves Rebuilding curves If you select Global tolerance, the Positional value you set in Options → General Preferences → Modeling is used.
Select Local tolerance to display the following box. You can enter a new value to override the Positional tolerance value you set in Modeling Preferences.
Local tolerance is useful when you often want to change these values often, but don’t want to change the Global tolerance.
Matching the rebuilt curve’s geometry to another curve Match Knots
More than one curve is required if you want to use Match Knots. Select Match Knots to rebuild a curve to match the knot values, degree, and number of spans of another curve. The rebuilt curve is matched to the settings of last curve you select (the green curve). The Keep toggles are available when you select this Rebuild Type and the Match Curve input curve information is available in the Attribute Editor. See “Editing the rebuilt curve in the Attribute Editor” on page 206 for details.
Removing multiple knots No Multiple Knots
202
Select No Multiple Knots to remove all of the multiple knots. The resulting curve is the same degree as the original curve. The Keep toggles are not available when you select this option.
Using Maya: Modeling
Editing Curves Rebuilding curves
NURBS Modeling
Tip While rebuilding curves to remove any multiple interior knots, quite often the shape of the curve is lost. If you want to preserve the shape of the curve, enter the following command in the Command Line: setAttr rebuildNodeName.fr false
Rebuilding the curve with more edit points Curvature
Select Curvature to insert more edit points in the areas of higher curvature. The resulting curve is the same degree as the original curve.
The Keep toggles are not available when you select this option, however the Use Tolerance options are displayed. See “Setting the curve’s tolerance” on page 201 for details.
Setting the parameter range Parameter Range
The three Parameter Range options are used to specify how parameters are affected during the rebuild. If 0 to 1 is selected (the default setting), the resulting curve’s parameter ranges from 0 to 1.0. Keep means the rebuilt curve’s parameter range matches that of the original curve.
Using Maya: Modeling
203
Editing Curves Rebuilding curves If 0 to # spans is selected, the resulting curve’s 0 to # spans gives you integer knot values which makes it easier for numerical input. If using the Uniform Rebuild Type, this option always gives you integer knot values. For example, if you want to use Detach Surfaces on an isoparm and you prefer to type a value, it is easier to enter the number 2 than something like 0.362.
Selecting elements of the original curve to keep Keep toggles
The Keep toggles, Ends, Tangents, and CVs, are used to specify whether or not you want to keep the end points, tangents, or CVs of the original curve. The Ends toggle is on by default.
Changing the number of spans on the curve The number of spans in the resulting curve is set by the value you enter in the Number of Spans box.
Number of Spans = 4 (default)
Number of Spans = 2
Number of Spans = 10
Changing the curve degree The Degree of the resulting curve is determined by the U or V degree you select. See the description “What is the curve degree?” on page 55 for information on curve degrees.
204
Using Maya: Modeling
Editing Curves Rebuilding curves
NURBS Modeling
Cubic, degree 3 (default)
Linear, degree 1
Keeping original geometry If Keep Original is toggled on, a new curve is rebuilt on top of the original and becomes the active curve. You can move it and select the original curve to try different option settings. This lets you compare the results and delete the curve you don’t want.
Note If the rebuild is not successful, the temporary curve is not created and the original curve remains active.
Editing the rebuilt curve from the Channel Box When you rebuild a curve, its parameters are displayed in the Channel Box when you click the rebuildCurve heading. These options are also available in the options window and the Attribute Editor. You can enter values in the value boxes, type on or off in the toggle boxes, or select items (Rebuild Type or Degree) from a pop-up menu.
Using Maya: Modeling
205
Editing Curves Rebuilding curves
Editing the rebuilt curve in the Attribute Editor To edit the rebuilt curve’s attributes, use the Attribute Editor. To open the Attribute Editor, either: •
Click the option box (❐) in the Object pop-up menu in the Channel Box.
•
Click the option box (❐) in the History list menu on the Status Line.
•
Click the option box (❐) in the Inputs pop-up menu in the marking menu.
•
Select Window → Attribute Editor.
The options you set in the options window or the Channel Box are displayed. See the option descriptions for details. Input Curve
The Input Curve information is read-only. It gives you access to the history of the original curves you rebuilt. Click the arrow button to select the curve and open its section of the editor.
Match Curve
The Match Curve read-only information is made available only if there is more than one curve and Match Knots is selected in the options window.
206
Using Maya: Modeling
Contents Using Maya: Basics Part 1
Working in Maya
Part 2
Customizing Maya
Part 3
Project and File Management
11
Part 4
Building Objects and Scenes
13
3
7
Using Maya: Rendering 1
Rendering Contents
2
Using Maya: Rendering
Working in Maya 1 Understanding Maya Starting and exiting Maya
7
7
Understanding the Maya window
8
Hiding elements of the Maya window
10
Displaying menus as separate windows Displaying help
11
Working with window options
13
Using sliders and data boxes
13
Setting check boxes and radio buttons Selecting menu item option boxes
14
14
Saving and restoring window options
15
Displaying window tabs and sections
17
2 Using Maya
19
Selecting a menu set Main menu bar
19
21
Selecting a menu Viewing a sub-menu
21 22
Opening an options window View menus Using the Status Line Marking menus
22
23 24
26
Hotkeys and marking menus Hotbox
10
28
29 Using Maya: Basics 3
Working in Maya Contents Displaying recent commands Changing Hotbox settings Changing the view
32
40
Customizing a zone
41
Turning off the hotbox
44
Editing a marking menu Hotkey Editor
31
45
45
What are categories?
48
Creating a hotkey
50
Deleting a hotkey
52
Creating a hotkey for a view menu function Feedback Line
56
Numerical Input Line Command Line
57
57
Playback Range
58
3 Viewing your Scene Working in 3D space
59
59
XYZ coordinate space
59
Orienting the XYZ system World coordinates
62
Local coordinates
62
What is a view?
62
Creating a new camera Moving the camera
Setting a perspective view Using Maya: Basics
63
64
Looking through a camera
4
60
66
65
52
Working in Maya Contents Creating a new perspective view Setting an orthographic view
67
67
Creating a new orthographic view Arranging the views
69
Laying out the views
71
Setting a bookmark
68
72
Creating a bookmark
73
Deleting a bookmark
74
Changing a bookmark’s name What are manipulators?
77
77
Using Maya: Basics 5
Working in Maya Contents
6
Using Maya: Basics
Customizing Maya 1 Using the Tool Shelf and Marking Menus What are shelves?
7
Working With Shelves Modifying Shelves
8
11
Saving Shelves
12
Creating Shelves
12
Displaying hidden Shelves Deleting Shelves
15
15
Renaming Shelves
16
Reordering the shelves
17
Changing the image of an icon Changing the label of an icon Removing a tool or action icon
19 21 22
Adding or changing an overlay label Customizing action MEL code Customizing a marking menu Creating a Marking menu Editing a marking menu
23
24
26
27 32
Assigning a marking menu to a hotkey
41
Associating a MEL script with a menu item Adding sub-menus
2 Preferences Selecting options
7
44
46
49 50 Using Maya: Basics 3
Overview Contents Setting Maya preferences Displaying Maya views
50 51
Toggling Maya display options Setting General Preferences General options
51
54
Select options
56
Display options
58
Manipulator options
62
Modeling options
64
Animation options
65
Kinematics options Units options
67
68
Selecting different packages Open Maya options Setting UI preferences
Shelf options
70
71
Window options
72 74
Layout options
75
Panels options
76
Miscellaneous options Customizing the UI
78
80
Color Preferences
81
General color preference Active color preference Using the Color Chooser
Using Maya: Basics
84 87
90
Color Chooser options
4
51
92
69
Overview Contents
3 Working with UI Editors Specifying tool settings Duplicating a tool
97
Assigning panels
100
95
Renaming and deleting panels Renaming a panel Deleting a panel Creating a new panel Panel layouts
95
101
102 104
104
106
Creating a layout
108
Deleting a layout
110
Scene independent layouts
111
Associating a layout with a scene Maintaining history
111
113
Installing and removing plug-ins Unloading a plug-in
115
119
Using Maya: Basics 5
Overview Contents
6
Using Maya: Basics
Project and File Management 1 Managing your Projects What is a project?
5
5
Locations and categories
6
Specifying file search criteria
7
Using absolute and relative paths Creating a new project
9
Specifying a current project
12
Editing the current project
13
2 Managing your Files Working with paths and directories Using the File Menu
8
15 15
17
Creating a new scene file Opening a scene file
18
19
Opening a project
20
Displaying scene file information Sorting files and directories Supported file formats
22
23
Setting file open options
23
File format options
Saving the current scene Setting Save As option Converting files
21
25
27 28 29
Using Maya: Basics 3
Project and File Management Contents Importing files
29
Importing a scene file
29
Setting import scene options Resolving name clashes Exporting a scene file
31
32
Export selection options Export Plug-ins
30
34
35
Exporting to Alias
35
Exporting to Wavefront (OBJ) Exporting to RenderMan Referencing an external file
36
38
Changing a referenced file Using the Reference Editor
36
39
40
Reference file options Creating a reference Importing a reference
41 42 42
Exporting a selection as a reference
43
Removing a reference from a scene
44
Displaying the contents of a reference Displaying file information Files in the Hypergraph
4
Using Maya: Basics
45 46
45
Building Objects and Scenes 1 Modeling Aids Creating template objects
9 9
Limiting object and component selection
10
Limiting selection by object type
10
Limiting selection by component type Limiting selection to hierarchy items
12 12
Limiting selection to template objects Limiting selection by animation task
13 14
Moving selection limitations to the shelf Snapping objects to items in the workspace Layering a scene
14
15
15
Creating a new layer Selecting a layer
16
17
Renaming a layer
17
Removing a layer
17
Transferring objects to a layer Selecting a layer’s objects Hiding a layer’s objects
18
18 19
Showing a layer’s objects
19
Making templates of objects in a layer Locking a transform tool or manipulator Turning off construction history
19
20
21
Using Maya: Basics 3
Building Objects and Scenes Contents
2 Displaying Objects
23
Displaying Objects and Attributes Setting the grid
23
25
Setting grid options
26
Changing the color of the grid Hiding and showing objects
27
Hiding Geometry
29
Hiding Kinematics
30
Hiding Deformers
32
Object Components NURBS Components
27
33 34
Displaying NURBS components Specifying NURBS Smoothness Specifying Hull options Polygon Components
34
36 38
38
Custom Polygon Display
39
Specifying Fast interaction
41
Camera and light manipulator Displaying Sound
41
42
Changing the Joint Display Size
43
Changing the IK Handle Display Size The View Menu
43
Changing camera settings The Shading Menu
46
Color Index Mode
49
Back Face Culling
49
Hardware Texturing 4
Using Maya: Basics
49
43
43
Building Objects and Scenes Contents Apply Current to All The Lighting Menu The Show Menu
49
49 50
3 Transforming Objects Using the Minibar Move Tool
53
54
54
Moving tips
58
Move Tool options
60
Moving other kinds of objects Rotate Tool
61
62
Changing the rotation order Changing settings
64
65
Animating rotation channels Scale Tool
67
68
Changing the scale pivot Using numerical input
69
69
Combining transformations
70
Using proportional modification
72
Proportional Modification Tool options Show Manipulator Tool
78
Selecting an item’s history node
78
Changing a curve’s parameter range Default Object manipulator Using Make Live
74
80
81
81
Using Maya: Basics 5
Building Objects and Scenes Contents
4 Editing Objects What is instancing? Edit menu
83
83
85
Undoing an action
87
Deleting an object
88
Deleting by type
89
Deleting channels
91
Deleting static channels Deleting expressions
92
Deleting all objects by type Selecting all objects
93
94
Selecting all objects by type Selecting a character
97
Duplicating an object
97
Duplicate options
95
98
Grouping objects together Group options Breaking a group
91
100
101
103
Setting ungroup options Creating an empty group Parent options Unparent options
105
106 107 108
5 Working with General Editors General Editors
111
Using the Filter Action Editor 6
Using Maya: Basics
113
111
Building Objects and Scenes Contents Using Attribute Editors
115
Listing objects in the Attribute Editor Changing the focus
118
Adding an attribute
119
Using the Attribute Spreadsheet Changing an attribute
117
121 121
Setting attributes using the Attribute Editor Managing the layout of information Key
123
128
130
Using the Channel Box
130
Displaying the Channel Box
131
Understanding the Channel Box
132
Displaying object attributes
132
Displaying component attributes Changing the display format Entering values for attributes
134
135
137
Entering an exact value for object attributes Entering values for component attributes Entering a relative value for attributes Entering values using manipulators Entering values with the mouse
137 139
140 141
142
Entering values for attributes with a pop-up menu Setting a key for attributes Locking attribute values Renaming objects
142
143 144
146
Starting the Expression Editor
146
Modifying an object’s history (inputs)
147
Using Maya: Basics 7
Building Objects and Scenes Contents Specifying Performance Settings
6 Outliner
149
151
Understanding the Outliner panel
152
Understanding scene hierarchy terminology Using the Outliner
154
Navigating the Outliner
155
Displaying shape nodes Displaying attributes
156
157
Displaying specific types of nodes Parenting objects
160
160
Selecting and renaming objects Reordering nodes
153
163
164
7 Using MEL Commands and Scripts
8
Using Maya: Basics
167
Image by Emanuel Druckmann
POLYGONAL MODELING VERSION 4
POLYGONAL MODELING 2001,
Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A. All rights reserved. Maya 4 Documentation Team: Steven Brooks, Susan-Belle Ferguson, Lisa Ford, Claude Macri, Susan Park, Diane Ramey, and Linda Rose. Alias is a registered trademark and Alias|Wavefront, the Alias|Wavefront logo, Conductors, Dispatcher, Trax, Wavefront IPR, VizPaint2D, and ZaP!iT are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Maya is a registered trademark and Maya Artisan, Maya Builder, Maya Cloth, Maya Complete, Maya Fur, Maya F/X, Maya Invigorator, Maya Invigorator Lite Edition, Maya Live, Maya Paint Effects, Maya Real Time SDK,and Maya Unlimited are trademarks of Silicon Graphics, Inc., used exclusively by Alias|Wavefront, a division of Silicon Graphics Limited. IRIX and Silicon Graphics are registered trademarks and SGI is a trademark of Silicon Graphics, Inc. Wacom is a trademark of Wacom Co., Ltd. NVidia is a registered trademark and Gforce is a trademark of NVidia Corporation. Inferno and Flame are registered trademarks of Discreet Logic Inc. Linux is a registered trademark of Linus Torvalds. Red Hat is a registered trademark of Red Hat, Inc. Microsoft, Windows NT, and Windows 2000 are trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark, licensed exclusively through X/Open Company, Ltd. All other product names mentioned are trademarks or registered trademarks of their respective owners. Graph Layout Toolkit, 1992-1996 Tom Sawyer Software, Berkeley, California. All Rights Reserved. This document contains proprietary and confidential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, its affiliates, nor their directors, officers, employees, or agents are responsible for punitive or multiple damages or lost profits or other special, direct, indirect, incidental, or consequential damages including any damages resulting from loss of business arising out of or resulting from the use of this material, or for technical or editorial omissions made in this document.
ALIAS|WAVEFRONT ■ 210 KING STREET EAST ■ TORONTO, CANADA M5A 1J7
CONTENTS POLYGONAL MODELING 1
INTRODUCTION TO POLYGONAL MODELING
11
What you have to know about polygons What is a polygon?
11
11
What are polygon components? Tools and actions
11
18
Planar and non-planar polygons
18
Shared and unshared edges, vertices, and UVs Valid and invalid polygonal geometry
2
BASIC POLYGONAL MODELING
19
23
Creating new polygons
23
Using the Create Polygon Tool
23
Create Polygon Tool options Appending to polygons
25
28
Using the Append to Polygon Tool
28
Append to Polygon Tool options Creating polygonal strips
29
33
Making holes using the Create and Append Tools Mirroring Polygonal Objects
35
Polygon Mirror options
35
Displaying polygon count statistics
Cleaning up polygonal data
39
40
Cleanup Polygon options
40
Editing polygons in the Attribute Editor
42
Changing tessellation attributes
43
Changing the component display Displaying the current UV set
43 46
Setting custom polygon display options
47
Using the Component Editor with polygons
POLYGON COMPONENTS
34
37
Copying and pasting UVs, colors, and shaders
3
19
49
51
Selecting polygonal components Retaining a component selection
51 52
POLYGONAL MODELING 3
CONTENTS
Changing component colors
53
Paint-selecting components
53
Transforming polygonal components
53
Moving components using Move Component Using Move Component
53
54
Move Component manipulator
55
Switching between local and global modes Moving UVs
57
Move Component options
57
Deleting polygon components Deleting vertices
59
59
Deleting edges
60
Transferring components
61
Flipping Triangle Edges
61
Reducing Polygon Counts
62
Polygon Reduce Options
4
62
NORMALS AND DISPLAY SETTINGS
65
Moving vertices along their normals Editing polygon normals
66
Setting polygon vertex normals
66
Averaging vertex normals
68
Average Normals options Splitting vertex normals
69
69
Set to Face options
70
Reversing polygonal normals Conforming normals
65
70
72
Softening and hardening polygon edges Soften/Harden Edge options
5
POLYGONAL PRIMITIVES
Creating polygonal primitives
4
75 75
76
Specifying a primitive’s radius
POLYGONAL MODELING
73
75
Basic polygonal primitive objects
Setting primitive options
73
76
56
CONTENTS
Specifying a primitive’s subdivisions
77
Specifying a primitive’s width and height Changing a primitive’s orientation
79
79
Preparing a primitive for texture mapping
80
Editing primitives in the Attribute Editor Creating and editing text
82
Polygonal text settings
6
POLYGONAL BOOLEANS
83
85
Polygonal Boolean operations Boolean types
82
85
86
Union Boolean operation
86
Difference Boolean operation
88
Intersection Boolean operation
89
Editing Booleans with construction history
89
Trimming using polygonal Boolean operations Animating polygonal Boolean operations
7
SETTING GLOBAL TOOL OPTIONS
95
Keeping new faces planar
95
Keeping faces together
97
Installing Smart Command Settings
97
Resetting current command settings
SELECTION OPERATIONS
93
96
Converting the selection mode
8
92
99
101
Growing and shrinking selections Selecting boundaries Selecting a band of edges
101
101 102
Converting the selection to another component Displaying only selected polygonal faces Using selection constraints
103
104
Selecting constraint components Polygon selection constraint options
9
103
CONVERTING NURBS TO POLYGONAL GEOMETRY
104 106 115
POLYGONAL MODELING 5
CONTENTS
Converting NURBS to polygons
115
Using NURBS To Polygons options
116
Choosing a tessellation method
10
TRIANGULATING AND QUADRANGULATING POLYGONS Triangulating polygons
122
EXTRUDING, DUPLICATING, AND EXTRACTING Extruding faces and edges Extruding faces
125
125 125
Extruding edges
127
Duplicating faces Extracting faces
129 129
Keeping faces together
130
Extrude, Duplicate Face, and Extract options
12
MAKING AND FILLING HOLES IN POLYGONS Making holes in polygons
Filling holes with faces
Combining polygons
143
Separating polygons
144
143
144
Separating polygons with merged edges
145
Separating combined polygonal objects
146
147
SPLITTING AND SUBDIVIDING POLYGONS Splitting polygons Splitting shared vertices Subdividing polygons
149
149 152 152
SMOOTHING, BEVELING, AND SCULPTING POLYGONS Smoothing polygons
POLYGONAL MODELING 6
140
COMBINING, SEPARATING, AND COLLAPSING POLYGONS
Collapsing polygons
15
137
142
Separating polygonal shells
14
133
137
Setting Make Hole Tool options
13
121
121
Quadrangulating polygons
11
117
155
155
CONTENTS
Smoothing by modifying the topology Smoothing by averaging vertices
155 158
Emulating subdivision surface workflows Beveling polygons
160
Sculpting polygons
163
Sculpting overview
163
Sculpting operations
163
Setting Sculpt Polygons Tool options Sculpting surfaces
170
Importing attribute maps
171
Flooding sculpted surfaces
171
Sculpting tips and tricks
171
MERGING VERTICES AND EDGES Merging vertices Merging edges
167
170
Sculpting masked surfaces
16
158
173
173 175
Merging edges using the Merge Edge Tool
175
Merging border edges between two polygonal objects Merging multiple edges
17
COLORING POLYGONS
180
183
Applying colors and prelighting
183
Displaying color feedback for color operations Applying color
183
184
Applying colors using generic selection methods Painting vertex color
188
Transferring vertex color
189
Prelighting for polygonal surfaces Prelight advantages
189
190
Setting up a scene to Prelight Prelighting a scene
192
192
Saving your prelighting to texture maps Prelighting examples
195
195
Animation for vertex colors
WORKING WITH BLIND DATA
184
186
Copying and pasting color
18
179
197 199
POLYGONAL MODELING 7
CONTENTS
Defining blind data types
199
Type Editor tab options
200
Editing blind data types
201
Exporting blind data types
202
Viewing template data Applying blind data
202
202
Apply tab options
202
Coloring or querying blind data
203
Color/Query tab options
203
Some notes on coloring and querying blind data Viewing blind data values
19
207
MAPPING UVS FOR POLYGONAL SURFACES About UVs and mapping
209
About UV mapping
210
209
Guidelines for UV arrangement
210
Previewing texture placement
211
Creating UVs based on the camera view Using Best Plane Texturing
211
212
Planar mapping for polygonal surfaces
213
Polygon Planar Projection options
214
Cylindrical and Spherical mapping
216
Cylindrical and Spherical Projection options Automatic mapping
218
Automatic Mapping options
20
220
EDITING UVS FOR POLYGONAL SURFACES UV editing basics
Transforming UVs in the UV Texture Editor 227
Normalize UVs options Unitizing UVs
228
Flipping UVs
228
Flip UVs options Rotating UVs
POLYGONAL MODELING 8
225
225
Normalizing UVs
229
207
228
227
226
216
CONTENTS
Laying out UVs
230
Layout UVs options Relaxing UVs
231
232
Relax UVs options
232
Mapping the UV border
233
Map UV Border options
234
Straightening the UV Border
236
Cutting and sewing UVs
237
Moving and sewing UVs Merging UVs
240
Deleting UVs
241
239
Creating a UV Snapshot to paint a matching texture Copying and pasting UVs Changing the grid
243
244
Displaying the texture
244
Displaying textures for the object or faces Selecting an image to display
245
Changing the image range
245
Displaying images unfiltered
246
Snapping UVs to pixels
246
Creating good UVs on complex models Transferring vertices
246
247
248
Creating and editing UV sets
248
Applying layered textures to UV sets Blend modes
245
245
Setting the texture image ratio
Multitexturing
242
249
256
POLYGONAL MODELING 9
CONTENTS
POLYGONAL MODELING 10
1
INTRODUCTION TO POLYGONAL MODELING This chapter helps to define polygons and their components and basic polygonal terms. As well as the basics, it provides a list of hotkey shortcuts you can use when modeling with polygons. To quickly learn the basics of polygonal modeling, see the Polygonal Modeling lesson in Instant Maya. About the Polygonal Modeling guide The Polygonal Modeling book provides information on modeling with polygons. It also covers related features such as coloring vertices, creating blind data for interactive games, and setting up UVs in preparation for applying a texture to the surface.
WHAT YOU HAVE TO KNOW ABOUT POLYGONS This section discusses some of the basic rules of polygonal modeling and a few tips on how to get the results you want.
What is a polygon? A polygon is an n-sided shape defined by a group of ordered vertices and the edges that are defined by pairs of those vertices. A polygonal object is a collection of polygons (called polygonal faces). Polygonal objects can be either simple shapes, such as polygonal primitives, or you can use the various Maya polygonal tools and operations to build complex models. A polygonal object can be closed, open, and can consist of shells, which are disjointed pieces of geometry. You can also build models using NURBS geometry and turn them into polygonal geometry by selecting NURBS to Polygons from the Polygons menu (see "Converting NURBS to polygons" on page 115).
What are polygon components? Polygons are made up of several components: •
vertices (see "Polygonal vertices" on page 12) POLYGONAL MODELING 11
INTRODUCTION TO POLYGONAL MODELING | 1
•
edges (see "Polygonal edges" on page 15)
•
faces (see "Polygonal faces" on page 12)
•
UVs (see "Polygonal UVs" on page 16)
An edge is the connection between two ordered vertices that defines the Selected edges. side of a polygonal face. A vertex is a point in 3D space. Selected vertices.
Selected faces.
Selected UVs.
A face is a region surrounded by edges.
U and V represent the mapping used to determine how to apply textures to polygons.
Polygonal vertices Polygonal vertices, like a connect-the-dot picture, determine the final outcome of a polygonal model. In the following example, the vertices are selected to show you how these connect to complete the model.
Selected vertices on a polygonal Torus primitive.
Zoomed image of selected vertices on a complex model.
Polygonal faces A face is defined as the region bound by joined edges. A polygonal object is a set of faces. When closed, it forms a solid. This gives you the flexibility to edit and texture a model on a per-face basis. A face is graphically represented as a solid unit with a dot in the center by default. You can use faces in various ways to transform polygonal objects. For example, if you want to create a hollow polygonal cube, simply select the top faces and press the backspace key to delete them.
POLYGONAL MODELING 12
INTRODUCTION TO POLYGONAL MODELING | 1
You can also assign textures to polygonal objects on a face-by-face basis.
To change how you select faces: By default, you select faces by clicking the small box in the center. If you want to be able to select faces by clicking anywhere within the faces: 1
Select Window > Settings/Preferences > Preferences to open the Preferences window.
2
Under the Settings category, click Selection and in the Polygons section, select Whole Face. For more information on customizing your UI (User Interface), see Using Maya: Essentials.
Polygonal face normals The order in which vertices appear determines the direction of the face. The front of a polygon’s face is graphically represented using a vector called the polygon’s normal. A normal is a line representing the direction perpendicular to a polygonal surface, and can be shown at the center of a face, at each vertex on the face, or both.
To find out more about normals, see Chapter 4, “Normals and Display Settings”. Displaying normals from the Polygon Components menu Normals display as fine lines protruding from the model. By default, face normals display. You can change the normal display settings in the Custom Polygons Display window to display both face and/or vertex normals. For details, see "Displaying normals from the Custom Polygon Display window" on page 14. You can display or hide normals using Display > Polygon Components > Normals. The size of the normals that display when you select Normals depends on the last normal size you turned on in the Polygon Components menu (Long Normals, Medium Normals, or Short Normals). POLYGONAL MODELING 13
INTRODUCTION TO POLYGONAL MODELING | 1
Long Normals
Medium Normals
Short Normals
Displaying normals from the Preferences window You can also display normals every time you create a polygonal model by turning on Normals beside Vertices in the Polygons category of the Preferences window (Window > Settings/Preferences > Preferences).
Displaying normals from the Custom Polygon Display window Open the Custom Polygon Display options window to precisely set the size of normals and display them on faces and/or vertices as you work (Display > Custom Polygon Display ❐). Turn on Normals for Vertices and/or Faces, set the Normals Size to what you want, and click the Apply button. Display vertex normals.
Change size of normals.
POLYGONAL MODELING 14
Display face normals.
INTRODUCTION TO POLYGONAL MODELING | 1
Using normals when texturing and coloring polygons When rendering polygons (including displaying them in shaded mode in the modeling window), the normals are used to calculate the way light reflects from the surface. For example, if you apply color or project a texture to only part of the front or outside of a polygonal object, you simply select the faces and reverse the normal direction for those faces to reverse that application to part of the back or inside of the object. To reverse the direction of polygonal normals, select the faces, turn on the vertices normal display in the Custom Polygons Display window, and then select Edit Polygons > Normals > Reverse. Reversing normals when projecting textures In the following example, a texture is projected onto half of a polygonal primitive sphere. Several faces have been selected and their normals reversed. Notice how the texture projects on both sides of the object. Maya projects the texture according to the normal direction.
Normals and texture.
Unobstructed view.
Tip If connected polygons on a surface have opposing normals, the surface may not render as desired. Select Edit Polygons > Normals > Reverse ❐, select Reverse and Propagate, then click Apply to adjust the normal direction. See "Reverse and Propagate" on page 72 for details.
Polygonal edges An edge is a side of a polygonal face defined by two ordered vertices. An edge is represented by a straight line between the two vertices that define it. Edges that bound a single face only are border edges. Edges can be useful when working with disconnected polygonal surfaces. You simply merge the edges together to connect the surfaces. For example, if you create elements of a complex object separately, like the horns of the beast in the following example, you can ‘sew’ them to a larger object by selecting the border edges of the objects and merging them together.
POLYGONAL MODELING 15
INTRODUCTION TO POLYGONAL MODELING | 1
‘Sew’, or merge, these edges to the rest of the body.
Completed model.
You can also use the Polygons > Append to Polygon Tool, click to add to the original polygon, and then select Edit Polygon > Merge Multiple Edges. Select adjacent edges, merge them, and adjust the tolerance between them to create one solid ‘welded’ polygonal surface.
Polygonal UVs Polygonal UVs are points on a polygon that are used by Maya to map a texture onto the polygon. By arranging the UVs, you can position the texture on the polygon. In Maya, polygonal UVs are created optionally. You can create polygonal objects without UVs (for example, by turning the Texture option off or to None when you create primitives), however, UVs are required if you want to assign textures to the object or apply paint or Fur to it. For information about UVs and textures for polygons, see Chapter 19, “Mapping UVs for polygonal surfaces.” Important note about UVs! UVs must be present on an object or the mapped textures will not display or render. UVs will not be present if you inadvertently create an object without UVs or import a model without UVs. To create UVs on objects, select the faces of the object and use any of the mapping tools in the Edit Polygons > Texture menu. You can then use the UV Texture Editor to view and arrange the created UVs. Select the object and use any of the UV creation or editing Texture menu items.
Default component display By default, components display in different colors and sizes to help you identify which picking mode you are in. The following table lists the default display for polygonal components.
Component
Inactive display (unselected)
Active display (selected)
Vertex
small purple boxes
boxes change to yellow
Edge
light blue lines
lines change to light orange
POLYGONAL MODELING 16
INTRODUCTION TO POLYGONAL MODELING | 1
Component
Inactive display (unselected)
Active display (selected)
Face
blue dot in the center of connected edges
area changes to light orange
UV
medium size purple boxes
boxes change to bright green
To change active and inactive colors: 1
Select Window > Settings/Preferences > Colors.
2
Click the Active or Inactive tab.
3
Click the down arrow to open the Component section of the Colors window.
4
Drag the slider beside the component you want to change until you see the color you want. For more information on customizing your UI (User Interface), see Using Maya: Essentials.
Polygonal solids A solid consists of faces which form a closed volume. Each edge in a solid is shared by exactly two faces. A solid always has an inside and outside defined by the direction of the normals. You can create solids either as primitives (spheres, cylinders, cones, cubes, or toruses), by converting open surfaces to closed surfaces, or from non-solid polygonal objects using polygonal operations, such as the Merge Edge Tool (Edit Polygons > Merge Edge Tool).
Polygonal shells A polygonal object consists of one or more shells. An edge can only belong to a single shell. For example, a primitive plane is a polygonal shell. If you delete faces to split the plane in two, two shells are created (each with its own border edge) but the pieces remain connected. If you then separate the shells using Edit Polygons > Separate, the shells become disconnected.
Primitive plane.
Plane split into two shells.
Separated shells.
The following image shows two more examples of shells.
POLYGONAL MODELING 17
INTRODUCTION TO POLYGONAL MODELING | 1
These two pieces are separate shells within the entire mannequin.
These faces make a shell within a piece of the mannequin.
Certain polygon operations work on a shell-by-shell basis, such as Edit Polygons > Normals > Reverse in Reverse and Propagate mode, and Edit Polygons > Separate. See "Reverse and Propagate" on page 72 and "Separating polygonal shells" on page 144 for details.
Tools and actions As with most of Maya’s functionality, the picking order of objects and components depends on whether you are using a tool or an action. With Maya’s polygonal modeling tools, you select the tool first from the menu, then you select the object or component. To make it easier for you to differentiate, all of Maya’s tools have the word Tool after the menu item’s name (as in Polygons > Create Polygon Tool). With actions (or operations), you select the object or component first, then you select the menu item (as in Edit Polygons > Extrude Face).
Planar and non-planar polygons A planar polygon is a polygon whose vertices all lie along the same plane (that is, it lies flat). For example, a triangle is always planar because you cannot bend or twist a polygon with only three vertices describing it. A polygon is non-planar if it has more than three vertices, and those vertices do not lie in the same plane. For example, the following figure shows a polygon plane primitive with two faces bent into non-planar faces. They were made non-planar by moving the corner vertices.
Planar
Non-planar
In most cases, avoid non-planar faces, because unexpected results might occur when you deform a surface with non-planar faces. See the following Tips.
POLYGONAL MODELING 18
INTRODUCTION TO POLYGONAL MODELING | 1
Tips •
You can ensure planarity by setting the Keep New Faces Planar option on in the Tool Options menu, or by turning Ensure Planarity on in the Tool Settings window for the Create Polygon Tool and the Append to Polygon Tool. For details, see "Creating new polygons" on page 23, "Appending to polygons" on page 28, and "Keeping new faces planar" on page 95.
•
Non-planar quads can be fixed using the Split Polygon Tool (see Chapter 14, “Splitting and Subdividing Polygons” for details) and using Polygons > Cleanup (see "Cleaning up polygonal data" on page 40).
•
You can quickly identify which faces are non-planar by turning on Non-planar in the Display > Custom Polygon Display options window.
Shared and unshared edges, vertices, and UVs Within a polygonal object, one or more adjacent faces may share vertices where they meet. If one or more polygons share a vertex, they are connected, or shared. This connectivity information is maintained when transforming or editing polygonal data.
‘Unsharing’ vertices There may be times when you have a completed a polygonal model whose vertices and edges are shared, but you need to modify only one of the faces. To do this, select the face or faces you want to modify, then select Edit Polygons > Extract to ‘unshare’ the vertices and edges of these faces from the rest of the model. To ‘unshare’ vertices selectively, select the vertex or vertices, then select Edit Polygons > Split Vertex. Unshared vertices.
Extracted face.
Split vertex.
Valid and invalid polygonal geometry In Maya, valid polygonal geometry can have 2-manifold topology or it can have nonmanifold topology. A single edge or vertex is not valid geometry. 2-manifold topology basically means you can unfold the geometry so that it lies flat on a plane without overlapping pieces. Nonmanifold topology is illustrated by the following three examples:
POLYGONAL MODELING 19
INTRODUCTION TO POLYGONAL MODELING | 1
Three or more faces share an edge.
Two or more faces share a single vertex but no edge.
Adjacent faces have opposite normals.
In the first example (the “T” shape), more than two faces share an edge. In the second example (the “bowtie” shape), two faces share a single vertex without also sharing an edge. This shape is also possible where two three-dimensional shapes share a vertex (such as two cubes meeting at a single point). In the third example, a single shape has non-contiguous normals (without border edges). This is a less obvious example of nonmanifold geometry. The following operations can produce nonmanifold geometry: •
Extrude Edge
•
Normals > Reverse (reverse normals without extracting geometry)
•
Merge Vertices
•
Delete Face (select the face and press the backspace key)
•
Collapse (Face or Edge) To keep the polygon count down and make tasks such as mapping textures to your objects much easier and quicker, make the pieces of polygonal geometry making up a model fit properly. Avoid creating a polygonal edge that has no face. Also, try to create your polygons so that their normals point in the same direction. Although it is technically valid for the normals to point in opposite directions, textures may not behave as expected. You can automatically make nonmanifold geometry 2-manifold (including the less obvious case of adjacent faces with opposite normals) using Polygons > Cleanup. For more information, see "Cleaning up polygonal data" on page 40.
Edge that has no face.
Normals pointing in opposite directions.
POLYGONAL MODELING 20
Complex polygonal object: vertices/edges do not match up.
INTRODUCTION TO POLYGONAL MODELING | 1
Notes •
Boolean and Reduce operations have no effect on polygonal objects with nonmanifold geometry.
•
Merge Edge operations have no effect on nonmanifold edges, although they work on 2-manifold edges that are part of nonmanifold geometry.
POLYGONAL MODELING 21
INTRODUCTION TO POLYGONAL MODELING | 1
POLYGONAL MODELING 22
2
BASIC POLYGONAL MODELING This chapter shows you how to create polygonal models from scratch using the Create Polygon Tool and provides information about appending to polygons, displaying the polygon count for your polygonal models, copying and pasting colors and shaders, and selecting and editing polygonal components using the Attribute Editor and the Component Editor.
CREATING NEW POLYGONS Use the Create Polygon Tool to create a polygon with only one face. You can create the polygon with holes, and you can relocate the individual points that define an object’s geometry.
Using the Create Polygon Tool Since this is a tool, you should set the options in the options window before you create the polygon if you know what you want. If you forget or don’t know what you want, you can also create a new polygon and edit the result in its Attribute Editor or the Channel Box. To create a new polygon: 1
Select Polygons > Create Polygon Tool.
2
In any view, click the left mouse button to place the first point, or vertex.
3
Click to place the next vertex. Maya creates an edge between the first point and the last point you placed.
POLYGONAL MODELING 23
BASIC POLYGONAL MODELING | 2
4
To close the polygon, place another vertex. A dashed edge connects the three vertices.
5
To complete the new polygon, press Enter.
6
Keep placing vertices to create different polygonal shapes. If you want to immediately create other polygons, press the Y key and continue to place points. To reposition a point:
1
To reposition the last point you placed, press the Insert key on the keyboard. A move manipulator displays.
2
Drag to move the point.
POLYGONAL MODELING 24
BASIC POLYGONAL MODELING | 2
If you are in a Maya snap mode, you can use the middle mouse button to reposition the point in increments. 3
To complete the polygon with the point in the new position and exit insertion mode, press the Insert key again.
Note You cannot add points that create a nonplanar polygon if the Ensure Planarity mode is selected in the option window. For details, see Create Polygon Tool options next for details.
Create Polygon Tool options Select Polygons > Create Polygon Tool ❐ to display the Tool Settings window.
Changing Geometry Options Use these sliders and select from the Texture pop-up menu to adjust the final outcome of the new polygon.
Tip You can set these options before you create your polygon, or you can always change the options as you work. Subdivisions
Use the slider or enter a value to change the number of subdivisions that are distributed along the edges of the polygon being created. The default is 1. Extra vertices are created along the edges. You can manipulate these vertices in subsequent operations.
POLYGONAL MODELING 25
BASIC POLYGONAL MODELING | 2
This is not the same as subdividing polygons using Edit Polygons > Subdivide. When using the Subdivide operation, new faces are created by default. To create new vertices, you have to subdivide the edges specifically (see "Subdividing polygons" on page 152 for details).
Newly created polygon, Subdivisions = 1.
Same polygon subdivided using Edit Polygons > Subdivide, Subdivisions = 1.
Limit Points Specified To
This value specifies how many vertices the new polygon will have. The polygon closes automatically after you place the number of points specified here and you can continue to click to create new polygons in the view without re-selecting the tool. Changing Texture options Select a how texture coordinates (UVs) are created for the new polygon. Normalize/ Unitize
If Normalize is selected, the texture coordinates are scaled to fit into the 0 to 1 texture space. If Unitize is selected, the texture coordinates are placed on the corners and boundary of the 0 to 1 texture space. A polygon with three vertices will have a triangular UV texture map (with sides of equal length), while a polygon with more than three vertices will have a square UV texture map. 3D view.
Texture view. Normalize. Unitize.
See Chapter 20, “Editing UVs for polygonal surfaces” for more information about UVs and textures.
POLYGONAL MODELING 26
BASIC POLYGONAL MODELING | 2
Ensuring planarity when creating polygons Ensure Planarity
By default, any faces you add are in the same plane as the polygonal object you append to. Turn off Ensure Planarity if you want to add faces in another plane using Append to Polygon or if you select the Append Operation. Important! If you click Ensure Planarity in the Tool Settings window, Maya sets the Keep New Faces Planar option on or off in the Tool Options menu. If you click the Keep New Faces Planar option in the Tool Options menu, Maya sets the Ensure Planarity options on or off in the Tool Settings window.
Tip If you select Keep New Faces Planar from the Tool Options menu, the setting is saved to the preferences file when you exit Maya. It applies to all new objects until you change the setting. Switching between operations Create is the default Operation. Select Append if you want to add to the newly created polygon and click to place points on the border edge. Press Enter to complete the polygon.
Editing the new polygon in the Attribute Editor To edit the attributes for newly created polygons, select the polygonal surface you want to edit and use the Attribute Editor.
Poly Create Face History Subdivision
Use the slider or enter a value to change the number of subdivisions that are distributed along the edges of the newly created polygon. The default is 1.
POLYGONAL MODELING 27
BASIC POLYGONAL MODELING | 2 Appending to polygons Vertices These values represent the position of the vertices you placed when creating the polygon. For example, if you placed three vertices (as in the example in the Attribute Editor), only three sets of values display. Change these values and press Enter to move the vertices and change the shape of the polygon.
APPENDING TO POLYGONS The Append to Polygon Tool lets you add a single face to any edge on the border of an open polygonal object. The appended face becomes a connected part of the polygonal object. An appended face automatically conforms to the object’s orientation, no matter how you build the appended face. That means if the original face has an outward facing normal, the new face’s normal also faces outward.
Note You cannot append faces to non-border edges to create nonmanifold geometry.
Using the Append to Polygon Tool Since this is a tool, you should set the options in the options window before you append to a polygon if you know what you want. Otherwise, you can create a new appended polygon and edit the result in its Attribute Editor or the Channel Box. To append a single face to a polygon: 1
Select the polygon you want to append to.
2
Select Polygons > Append to Polygon Tool. The border edges highlight and appear thicker.
Tip To easily see the border edges, open the Attribute Editor for the polygonal object. Click the arrow to open the Mesh Component Display section of the editor and turn on Display Borders. Increase the Border Width if necessary. 3
Click and place a point to select the border edge you want to append to. The edge you select is the first edge of the new face. Several arrows indicate the edge direction.
POLYGONAL MODELING 28
BASIC POLYGONAL MODELING | 2 Appending to polygons
4
Click to add a point in space. A new point appears with a line connecting it to the last point of the selected face edge. Keep placing points. A dashed edge displays as you place points. The dashed edge turns into a real edge when the new face is completed or when you press Enter. Now if you select faces you can see that the new face is connected to the original object.
Place a point in space.
Keep placing points.
Press Enter.
Select faces.
•
You can also add an edge by clicking on another border edge.
•
If you change your mind, press the Backspace and change the order in which you picked edges or placed your points.
Tip As when you create a polygon using the Create Polygon Tool, to reposition the last point you placed, press the Insert key. Use the move manipulator to move the point.To exit Insert mode, press the Insert key again.
Append to Polygon Tool options Select Polygons > Append to Polygon Tool ❐ to display the Tool Settings window.
POLYGONAL MODELING 29
BASIC POLYGONAL MODELING | 2 Appending to polygons
Changing Geometry Options Use these sliders and select from the Texture menu options to adjust the final outcome of the texture coordinates (UVs) on the new polygon.
Tip You can set these options before you create your polygon, or you can always change the options as you work. Subdivision
Use the slider or enter a value to change the number of subdivisions that are distributed along the edges of the polygon being appended. The default is 1. Extra vertices are placed along the edges to create the subdivisions. The following example shows the appended polygon subdivided with a setting of 4. Default Subdivision value of 1.
Subdivision value of 4.
Limit Points Specified To
The value you specify here indicates how many vertices are allowed on the new polygon. If set to 3 or more, you can create polygonal strips. See "To create tri polygonal strips when appending to polygons:" on page 33 for details. Using this option, you can continue to append to polygons without re-selecting the tool. Rotation Angle
This option becomes available while you are placing points to append to the polygon. Use the slider to rotate the new points before you complete the append operation.
POLYGONAL MODELING 30
BASIC POLYGONAL MODELING | 2 Appending to polygons
The newly created face rolls around the first edge you selected. If all the edges can be set on a hinge, the face turns around the reference line. If the edges you select are not aligned, the face will not turn around this reference line. Changing Texture options Select how texture coordinates (UVs) are created for the appended polygon. Normalize/ Unitize
If Normalize is selected, the texture coordinates are scaled to fit into the 0 to 1 texture space, maintaining the shape of the face. If Unitize is selected, the texture coordinates are placed on the corners and boundary of the 0 to 1 texture space. A polygon with three vertices will have a triangular UV texture map (with sides of equal length), while a polygon with more than three vertices will have a square UV texture map. 3D view.
Texture view. Normalize. Unitize.
Appended face.
For more information on UVs and textures, see Chapter 19, “Mapping UVs for polygonal surfaces.” Ensuring planarity when appending to polygons Ensure Planarity
By default, any faces you add are in the same plane as the polygonal object you append to. Turn off Ensure Planarity if you want to add faces in another plane.
POLYGONAL MODELING 31
BASIC POLYGONAL MODELING | 2 Appending to polygons
Ensure Planarity off.
Ensure Planarity on. Same points placed in the same area.
Result in perspective view.
On Off
Important! If you click Ensure Planarity in the Tool Settings window, Maya sets the Keep New Faces Planar option on or off in the Tool Options menu. If you click the Keep New Faces Planar option in the Tool Options menu, Maya sets the Ensure Planarity options on or off in the Tool Settings window.
Tips •
If you select Keep New Faces Planar from the Tool Options menu, the setting is saved to the preferences file when you exit Maya. It applies to all new objects until you change the setting.
•
Select the Non-planar option in the Custom Polygons Display window to verify that your new faces are planar. If they are not, the Non-planar option highlights them. See "Highlighting nonplanar faces" on page 48.
Switching between operations Append is the default Operation. Select Create if you want to create a new polygon.
Editing the appended polygon in the Attribute Editor To edit the attributes for appended polygons, select the polygonal surface you want to edit and use the Attribute Editor.
POLYGONAL MODELING 32
BASIC POLYGONAL MODELING | 2 Creating polygonal strips
Poly Append History Use the slider or enter a value to change the number of subdivisions that are distributed along the edges of the polygon being appended. The default is 1.
Subdivision
Vertices These values represent the position of the vertices you placed when appending to the polygon. For example, if you placed three vertices (as in the example of the Attribute Editor), only three sets of values display. Change these values and press Enter to move the vertices and change the shape of the appended polygon.
CREATING POLYGONAL STRIPS Use the Limit Points Specified To option for the Create Polygon Tool to start tri or quad polygon strips or the Append to Polygon Tool to create tri or quad polygonal strips. To start tri polygonal strips when creating polygons: 1
Before you create a polygon, set the Limit Points Specified To value to 3 in the Create Polygon Tool options window and press Enter.
2
Choose the Create Polygon Tool and click to place three points.
3
The polygon strip closes and now has 3 points.
4
You can now continue to create polygons without re-selecting the tool. Simply click in the 3D view to keep adding points to create a new polygonal strip. To create tri polygonal strips when appending to polygons:
1
Before you append to a polygon, set the Limit Points Specified To value to 3 in the Append to Polygon Tool options window and press Enter.
2
Choose the Append to Polygon Tool and select a border edge.
POLYGONAL MODELING 33
BASIC POLYGONAL MODELING | 2 Making holes using the Create and Append Tools 3
Click where you want your next point. The polygon strip is closed and now has 3 points.
4
You can continue appending to polygons without re-selecting the tool. Select a new border edge and add another point to continue the strip.
Tip You can also create quad strips using either of these methods by increasing the value to 4 and clicking to place an extra point.
MAKING HOLES USING THE CREATE AND APPEND TOOLS Both the Create Polygon Tool and the Append to Polygon tool can be used to create holes. To create holes when creating a new polygon: 1
Place the first point, second point, and the third point.
2
Do not press Enter.
3
Press the Ctrl key and place the points inside the face to create the hole. The subsequent vertices are used to define the hole.
4
Once you have placed the points you need, press Enter to create the hole.
Tip You may find it easier to select faces with holes when face selection is set to Whole Face in the Selection Settings section of the Preferences window. If the face selection is set to Center and the hole is in the center of the face, you may not easily see the center dot to select it.
POLYGONAL MODELING 34
BASIC POLYGONAL MODELING | 2 Mirroring Polygonal Objects
MIRRORING POLYGONAL OBJECTS Polygons > Mirror Geometry duplicates and flips geometry relative to the axis for the bounding box and, if you want, merges it with the original polygon object. To mirror polygonal geometry: 1
Select the geometry you want to mirror.
2
Select Polygons > Mirror Geometry. By default, Maya duplicates and flips the geometry by the positive X axis and merges it with the original polygon.
Polygon Mirror options Click the ❐ next to the Mirror Geometry menu item in the Polygons menu to open the options window.
Mirror direction
Select the direction in which direction you want Maya to mirror the selected polygonal object. By default, the direction is positive X.
POLYGONAL MODELING 35
BASIC POLYGONAL MODELING | 2 Mirroring Polygonal Objects
Original object.
Mirror +X.
Mirror +Y.
POLYGONAL MODELING 36
Mirror -X.
Mirror -Y.
BASIC POLYGONAL MODELING | 2 Displaying polygon count statistics
Mirror +Z.
Mirror -Z.
Change these options and click Mirror if you want to mirror the object in another direction. Merge with the original
When turned on (the default setting), Maya duplicates and flips the original polygon and merges the duplicate polygon with the original polygon. This makes the new polygonal object one shell. When turned off, Maya duplicates and flips the original polygon but does not merge the separate shells.
Mirror +X merged.
Mirror +X separate.
DISPLAYING POLYGON COUNT STATISTICS Turn on the Display > Heads Up Display > Poly Count option to display the polygon count for vertices, edges, faces, and UVs of polygonal objects in the views.
Total polygon count The statistics on the left represent the total polygon count for all visible polygonal objects.
POLYGONAL MODELING 37
BASIC POLYGONAL MODELING | 2 Displaying polygon count statistics
Polygonal count for selected polygons The statistics beside the total polygon count list (displayed in white by default) represent the polygonal count for selected polygonal objects visible (or partially visible) in the view.
Polygonal count for selected components The statistics listed to the far right of the polygon count list represent the count for all selected components on objects that are partly visible in the view.
Changing the statistics by moving the view Since statistics only display for visible objects whether they are selected or not, if you track the view and lose sight of some of those objects, you will not see their counts. This can come in handy if you only want to view one selected object’s polygon count. For game developers, if your perspective camera is set up to match the game camera, you can get a feel for whether you’re getting close to your game engine’s drawing limits from that view.
POLYGONAL MODELING 38
BASIC POLYGONAL MODELING | 2 Copying and pasting UVs, colors, and shaders
All objects visible.
Track the view so that only one object is visible. Notice the decrease in the total polygon count.
Changing the polygon statistics colors You may want to display the polygonal statistics in different colors. These colors correspond to the cameras (the views) and can be changed in the Colors window. To change the color of selected polygon count statistics: 1
Select Window > Settings/Preferences > Colors.
2
Click the Active tab then press the down arrow next to Objects and scroll down to the Cameras color box.
3
Drag the slider to change the color for the statistics for active, or selected, polygons. To change the color of the total polygon count statistics:
1
Select Window > Settings/Preferences > Colors.
2
Click the Inactive tab then press the down arrow next to Objects and scroll down to the Cameras color box.
3
Drag the slider to change the color for the statistics for all polygons.
COPYING AND PASTING UVS, COLORS, AND SHADERS The Edit Polygons > Clipboard Actions menu provides you with a fast and easy way to copy and paste UVs, shaders, and colors from one object to another, or even within the same object, on a per-face basis. Open the Copy options window by clicking the ❐ beside the option name from the Clipboard Actions menu, turn the attributes you want to copy on or off, and click the Apply button. Whatever attributes you turn on or off in any of these options windows applies to all three operations. That means when you are ready to copy and paste, all you have to do is select the menu item.
POLYGONAL MODELING 39
BASIC POLYGONAL MODELING | 2 Cleaning up polygonal data
To copy and paste: UVs and Shaders are selected in the Clipboard Options windows by default. If you want to copy and paste these attributes, you do not have to open the options windows. Start the following procedure at step #2. For details on copying and pasting colors, see "Copying and pasting color" on page 188. 1
Select or deselect the Attributes you want to copy from the Copy Clipboard options windows and click the Apply button. These attributes are now selected or unselected in all three windows.
2
In the view, select the face you want to copy UVs, Shaders, or Colors from.
3
Select Copy from the menu.
4
Now select the faces you want to paste the attributes to.
5
Select Paste from the menu. To clear the clipboard: In the Polygon Clear Clipboard Options window, select the attributes you want to clear and click the Apply button.
CLEANING UP POLYGONAL DATA Cleanup provides you with the ability to remove unwanted geometry such as zero area faces or zero length edges. You can also tessellate faces that may be valid in Maya, but not in your game engine, such as concave faces, or faces with holes. To clean up polygonal geometry: 1
Select the geometry.
2
Select Polygons > Cleanup.
Cleanup Polygon options Click the ❐ next to the Cleanup menu item to open the options window. Change the options to suit your needs, then click Cleanup to perform the operation. General Options section Use these options to specify what parts of the polygonal geometry you want to clean up. Operation
Select one of the following options. Select and Cleanup
POLYGONAL MODELING 40
Use this option to repeatedly clean up the selected polygonal geometry using the same option settings. This is the default.
BASIC POLYGONAL MODELING | 2 Cleaning up polygonal data Select Geometry
Use this option to select geometry that meets the criteria you set, but do not do the clean up.
Select all Polygonal Objects
Turn this option on to clean up all polygonal objects in the scene. The default is off. Construction History
Turn this option on to keep the construction history associated with the polygonal geometry you select. Tessellate Geometry section Use these options to specify the types of faces you want to clean up by tessellating (triangulating). When you create polygonal geometry and use some of the polygonal editing operations, Maya may create some faces with attributes you do not want. The following illustrations show the kinds of problems you can encounter with polygonal faces.
4-sided faces.
Faces with more than 4 sides.
Concave faces.
Faces with holes.
Non-planar faces.
Other section Nonmanifold geometry
Turn this option on to clean up nonmanifold geometry. Select one of the following options to control what happens to the resulting normals. For information on nonmanifold geometry, see "Valid and invalid polygonal geometry" on page 19. Normals and Geometry Geometry Only
Turn on this option to conform normals when cleaning up nonmanifold vertices or edges. Cleans up nonmanifold geometry without changing the resulting normals.
POLYGONAL MODELING 41
BASIC POLYGONAL MODELING | 2 Editing polygons in the Attribute Editor Remove Geometry section Select which geometry you want removed during cleanup and specify the tolerance within which the geometry must be to be removed. You can remove the following: •
edges within a defined length tolerance
•
faces within a defined geometry area tolerance
•
faces within a defined map area tolerance
•
Lamina faces, which are faces that share all edges When you select to remove faces within a set geometry area tolerance (for example, remove faces with areas between 0 and 0.0001), faces are removed by merging vertices. To ensure that this operation removes faces with areas within the defined tolerance, you must set the edge length tolerance for the edge vertices to be merged. If you do not otherwise want to remove edges within the length tolerance, you can turn off the Edges with zero length option after setting the tolerance.
To clean up this face...
...these vertices are merged...
...and this is the result.
...and these vertices are merged...
When you select Lamina Faces for removal, Maya removes faces that share all edges. By removing these types of faces, you can avoid unnecessary processing time, especially when you export the model to a game engine. You might inadvertently create faces with shared edges. For example, suppose you performed Edit Polygons > Duplicate Face with the Separate Duplicate Faces option turned off. You would have two faces on top of each other. If you later merge the vertices of the two faces, they would share the same edges. You could then remove the extra face using Cleanup with Lamina Faces turned on.
EDITING POLYGONS IN THE ATTRIBUTE EDITOR To edit the attributes for polygonal geometry, select the polygonal surface you want to edit and use the Attribute Editor. There are various ways to open the Attribute Editor to edit the result of a polygonal operation on a specific object. The easiest is to select the object, then in the Channel Box click the Object menu and click the ❐ next to the object’s name. For example, if you have created a polygonal primitive sphere and want to edit its attributes, select Objects > pSphere ❐ from the Channel Box. You can also open the Attribute Editor from the marking menu. While the cursor is over the active item, press the right mouse button and select the name of the object from the marking menu. Alternately, you can select Windows > Attribute Editor, or press Ctrl a if the Channel Box is in the right-hand panel of the workspace.
POLYGONAL MODELING 42
BASIC POLYGONAL MODELING | 2 Editing polygons in the Attribute Editor
Changing tessellation attributes Tessellation attributes are used only when rendering a polygonal object with a displacement map. The attributes guide how much the displacement should force further subdivision of the object. Click the arrow to open the Tessellation Attributes section of the Attribute window.
Max Triangles
This is the maximum number of triangles used to represent a surface.
Max Subd
This is the maximum number of levels of subdivisions performed.
Min Screen
This is the minimum screen size of a polygon before stopping the polygon’s subdivision.
Max Uv
This is the maximum U and V an edge can span before further subdivisions.
Min Edge Length
This is the minimum edge length before stopping the polygon’s subdivision.
Max Edge Length
This is the maximum edge length allowed before a subdivision is required.
Changing the component display Click the arrow to open the Mesh Component Display section of the Attribute Editor.
POLYGONAL MODELING 43
BASIC POLYGONAL MODELING | 2 Editing polygons in the Attribute Editor
Display Vertices
Click to switch the display of vertices on the polygonal model on or off.
Vertex Backface Culling
This attribute is turned on by default. If Display Vertices is turned on, you can switch the display of vertices off or on when performing a backface culling operation. Backface Culling
Backface Culling is used to select and only draw what is facing the camera in the 3D view. Select one of the following options. wire
If you select wire, Maya culls the back faces during selection but draws the back faces in wireframe. The main difference between off (the default setting) and wire is that you can still select the back faces in off mode. In wire mode, the back faces are displayed but are unpickable.
hard
If you select hard, Maya culls the back faces but draws only the hard edges, and not the back faces, in wireframe.
POLYGONAL MODELING 44
BASIC POLYGONAL MODELING | 2 Editing polygons in the Attribute Editor
full
Display Borders
If you select full, Maya culls back faces entirely—the back faces are not drawn and cannot be selected.
Turn this on to highlight the polygonal borders and to change their widths.
Default border width 2.0.
Display Edges
Border width set to 4.0.
Select how you want to display polygonal edges. Select to display all edges the same way (standard), soft edges as dotted lines and hard edges as solid lines (softHard), or show hard edges only (makes soft edges invisible).
standard
softHard
onlyHard
Display Center, Display UVs, Display Triangles
Switch Display Center, Display UVs, and Display Triangles on or off to specify which component you want displayed.
POLYGONAL MODELING 45
BASIC POLYGONAL MODELING | 2 Editing polygons in the Attribute Editor
Display Center
Display Triangles
Display UVs
Display Normal
Turn this on to display normals on the polygonal object. When turned on, you can change the size of the normals and beside Normal Type select which normal you want displayed—face normals, vertex normals, or vertex/face normals.
Normal Size
Type the length of the displayed normals. The default is 0.4.
Normal size= 0.2 Normal Type
Select where you want the normals displayed: face (at the center of each face), vtx (at each vertex), and vtxface (at the center of each face and at each vertex).
face Display Non Planar
Normal size=0.4 (default)
vtx (vertex)
vtxface (vertex/face)
Turn this option on to highlight all non-planar faces.
Displaying the current UV set The Current UV Set box displays the name of the current UV set. Do not change the name in this box. Changing it does not change the UV set that UVs for the selection belong to.
POLYGONAL MODELING 46
BASIC POLYGONAL MODELING | 2 Setting custom polygon display options
SETTING CUSTOM POLYGON DISPLAY OPTIONS Using the Custom Polygon Display window, you can set how specific components of your polygons display to enhance the view while you work. For example, if you want to select edges to perform a merge edge operation, select the object, click an option to highlight the border edges, increase the size of the border width, then click the Apply button to enhance the display. Select Display > Custom Polygon Display ❐ to open the window.
Remember to click the Apply button each time you set one of the options for your active objects. If you want to return to the regular display, select Reset Settings from the windows Edit menu then press the Apply button. Displaying vertices and normals display Switch the display of vertices or normals on or off. You can change the size of the normals by setting the Normals Size value. Setting the normals size In the Normals Size box, enter a value or use the slider to specify the normals display size. The range is from 0.2 to 10. Backculling Backculling is used to select and only draw what is facing the camera in the 3D view. In effect, Maya displays vertices in areas where the normal is pointing away from the camera. For details, see "Backface Culling" on page 44. Displaying edges Select to display all edges the same way (Standard), soft edges as dotted lines and hard edges as solid lines (Soft/Hard), or show hard edges only (makes soft edges invisible). Highlighting borders Select to make outside edges thicker (Border Edges) or to display a thick border to highlight the area a texture affects per-polygon or per-vertex.
POLYGONAL MODELING 47
BASIC POLYGONAL MODELING | 2 Setting custom polygon display options Changing the border width You can change the Border Width by dragging the slider or entering a value. Setting the face display Select to display a small square to indicate the face center (Centers), to show the normals at the center of each polygon (Normals), or select Triangles to show all polygons as triangles for display purposes. Highlighting non-planar faces Select Non-planar to highlight all non-planar faces.
Showing item numbers Use the Show Item Numbers options to display index numbers on an object’s vertices, edges, faces, or UVs, depending on which component types you select. If you turn on UVs, the numbers appear in the UV Texture Editor only. Displaying texture coordinates (UVs) and UV topology Turn on the UV and UV Topology options to see the UVs on your object. •
If UVs are shared, they display as single purple dots.
•
If unshared, multiple purple dots display close to the vertex to which a given UV belongs. When you select the UV in the UV Texture Editor, a line displays pointing to the face it belongs to. Turn on the UV Topology option to display and be able to select unshared UVs. 3D view
Selected UV
UV Texture Editor
Selected UV Translated UV
POLYGONAL MODELING 48
BASIC POLYGONAL MODELING | 2 Using the Component Editor with polygons Color operations When Color in Shaded Display is on, you can see the effects of Apply Color, Prelighting, and the Paint Vertex Color Tool while in shaded mode. This option is turned on by default whenever you select these commands. Select a Color Material Channel to refine your application. See Chapter 17, “Coloring Polygons” for details about using these options and the Apply Color operation. Backface Culling Backface Culling is used to select and only draw what is facing the camera in the 3D view. Select one of the following options. Off
Maya turns backface culling off. This is the default.
On
Maya displays backface culling, causing surfaces to appear invisible in areas where the normal points away from the camera. You can improve performance on some systems by toggling on Backface Culling.
Keep Wire
Maya sets backface culling for all surfaces except wireframe outlines.
Keep Hard Edges
Maya sets backface culling for soft edges only. See "Backface Culling" on page 44 for more details.
USING THE COMPONENT EDITOR WITH POLYGONS The Component Editor for polygons contains two tabs that display information on components for polygonal objects: Polygons and AdvPolygons. All displayed values can be edited by typing values into the entry fields. The general Polygons tab of the Component Editor has three columns displaying vertex position in world space—vertex.x, vertex.y, and vertex.z. It also has four columns displaying color information, and three columns displaying normal information (normal.x, normal.y, and normal.z) The normal values displayed are the normals at the vertex level. If the color or normal values are not shared at the vertex level, UnShared appears in the column. These unshared values can be viewed and edited by clicking the AdvPolygons tab which converts the vertex components into vertex-face components and displays the normal and color values at the vertex-face level. All displayed values can be edited by typing values into the entry fields. For more information, see Using Maya: Essentials To view polygonal components in the Component Editor: 1
Select the components in the 3D view you want to list.
POLYGONAL MODELING 49
BASIC POLYGONAL MODELING | 2 Using the Component Editor with polygons
2
Open the Component Editor. Select Window > General Editors > Component Editor.
3
Click the Polygons tab or the AdvPolygons tab.
The first time you select components they are listed in the editor. If you want to list subsequent selections, press the Load Components button at the bottom of the editor.
POLYGONAL MODELING 50
3
POLYGON COMPONENTS This chapter provides information on selecting, transforming, and deleting polygonal components.
SELECTING POLYGONAL COMPONENTS To alter the shape of a polygon and to perform many of the polygon menu operations, you must select components. The main polygon components are: vertices, faces, edges, and UVs. Each component has its own component mode for you to select them. Polygons also have the vertex/face component mode, which lets you select vertices corresponding to individual faces as opposed to the entire vertex. To select components: Switch to the component mode using any of the following methods, then click, Shiftclick, or click-drag to select the components: •
Right-click on the subdivision surface and select Vertex, Edge, Face, or UV from the marking menu. or
•
On the Status Line, click the Select by component type icon, then click one or more of the component-mode icons. or
•
Press a component-mode hotkey: F9 (vertices), F10 (edges), F11 (faces), or F12 (UVs). To select vertex/face components: Using the Vertex/Face selection mode you can control object characteristics at a very fine level. You can change the characteristics of a vertex on a particular face without modifying all the faces connected to the vertex.
Note You can only enter this component mode from the marking menu or by pressing Ctrl-F9.
POLYGONAL MODELING 51
POLYGON COMPONENTS | 3
Other selection tools: There are many other selection operations that let you grow, shrink, and convert your component selection. You’ll find these operations on the Edit Polygons > Selection submenu. For example, to quickly select the edges around a face on the model, you can select the face and choose Edit Polygons > Selection > Convert Selection to Edges. For more information, see Chapter 8, “Selection operations.”
Retaining a component selection You can select a number of components and keep them selected when you change the selection mode. You can then Shift-select the new components so that two types of components are simultaneously selected. You could then, for example, transform two component types at the same time.
To retain a component selection, you must use the marking menu (press the right mouse button and select a component type), or select a component mode from the Status Line. This does not work with the function keys, although it is customizable using the Hotkey editor (see Using Maya: Essentials for details about customizing hotkeys). To retain a specific component selection: 1
Click or marquee-select to choose the components you want to remain selected when you switch to another component mode.
2
Enter another component mode (for instance, press the right mouse button and select Edge from the marking menu to enter the Edge component mode). The components you selected remain highlighted (selected) even though the component mode has changed. The following example shows vertices selected and what happens when you enter the Edge component mode.
3
Press the Shift key to select the edges and add to your selection. Notice how the vertices remain selected.
POLYGONAL MODELING 52
POLYGON COMPONENTS | 3 Transforming polygonal components
Changing component colors You may want your components to display in colors other than the default colors. These colors can be changed in the Colors window. To change the component color: 1
Select Window > Settings/Preferences > Colors.
2
Click the Active or Inactive tab then click the down arrow next to Components.
3
Drag the slider to change the color for active (selected) or inactive polygon components. See Using Maya: Essentials for more information about changing colors and customizing your display.
Paint-selecting components For greater control and speed when selecting, you can use the Paint Selection Tool to select and unselect components by painting over them. When you select Edit > Paint Selection Tool, Maya switches to vertex component mode automatically. To paintselect edges and faces, you must first switch to the appropriate component mode. For more information about paint selecting components, see Using Maya: Painting.
Note You cannot paint-select UVs or the Vertex/Face components.
TRANSFORMING POLYGONAL COMPONENTS You use Maya’s transformation tools, Move, Rotate, and Scale, to transform polygonal objects and components. For example, if you want to animate the lips of a polygonal modeled face to prepare them for sound syncing, you simply select vertices, transform them, and set keyframes to animate the vertices. See Using Maya: Essentials for details about generic Maya transformation tools.
MOVING COMPONENTS USING MOVE COMPONENT Use Edit Polygons > Move Component to translate, rotate, or scale polygonal components.
POLYGONAL MODELING 53
POLYGON COMPONENTS | 3 Moving components using Move Component Move Component creates history nodes. That means that the options you set for particular transformations on particular components are preserved. You can select the transform node for subsequent operations without having to tediously reset the transform values. Move Component also has additional constraints that Maya’s generic transformation tools do not have, such as moving perpendicular along normals.
Using Move Component Once you are in Component selection mode, click to select the specific components you want to transform or marquee-select a number of components. After you select Move Component, you can change the settings for the selected components from the Attribute Editor or from the Channel Box, or use Maya’s Move Component Manipulator handles to interactively transform vertices, faces, or edges. You can also edit the transform values for a particular transform node after a Move Component operation from its Attribute Editor. To move components: The following is a general description on how to use Move Component. Essentially, this operation works the same for each selected component except for UVs—textures must be assigned to the object to be able to see the results. Also, the manipulator displays for selected faces, edges, and vertices. It does not display for UVs in the 3D view, but it does display in the UV Texture Editor. 1
Select the components you want to move.
2
Select Edit Polygons > Move Component.
3
A transform manipulator displays. Drag the manipulator handles to transform the components to suit your needs or change the settings in the Attribute Editor or the Channel Box. The components are transformed in local mode by default. If you want to switch to global mode, click the circle at the end of the line originating from the pivot point. See "Switching between local and global modes" on page 56 for details. The following examples show how components can be moved interactively using Move Component and the manipulator handles.
POLYGONAL MODELING 54
POLYGON COMPONENTS | 3 Moving components using Move Component
Move Vertex (local mode)
Move Vertex (global mode)
Move Faces
Move Edges
Move Component manipulator The manipulator that appears when you use Move Component is the same manipulator that appears when you perform an Extrude, Duplicate, or Extract operation (see "Extruding, Duplicating, and Extracting" on page 125). It is much the same as the standard Maya transform manipulator. Using the manipulator handles, you can interactively transform the selected components. Z Local/Global toggle
Move (translate) Move all axes Y Scale
X Rotate
When you select a translate manipulator handle (the arrows), it highlights in yellow. The same thing happens when you select a scale manipulator handle (the boxes). The square in the center of the manipulator lets you transform the components in all directions at once. If you are in a snap mode, this square becomes a circle. Like the standard Maya transform manipulator, you can also change the pivot of the Move Component manipulator. For details, see Using Maya: Essentials.
Moving The translate arrows of the manipulator handles correspond to the X, Y, and Z axis directions. Click-drag one of these arrows to move the components in the desired axis direction.
POLYGONAL MODELING 55
POLYGON COMPONENTS | 3 Moving components using Move Component
Scaling Click-drag the boxes at the ends of the manipulator handles to scale the components in the desired axis direction.
Rotating Click to select and then drag the circle around the manipulator to rotate the selected component in the desired axis direction. The colors of the lines in the circle correspond to the X, Y, and Z-axis directions.
Switching between local and global modes When using Move Component or after an Extrude, Duplicate or Extract operation, an additional handle displays as part of the Maya transform manipulator. It appears as a line with a circle at the end originating from the pivot point location. In Local mode.
In Global mode.
Click this circle to switch between local and global mode. If you use local coordinates (the default), the dot within the circle is solid. If you use global or world coordinates, the dot is hollow. For information on local and global coordinates, see Using Maya: Essentials. You can also change local and global transform values from the Channel Box. Global transformation attributes reside at the top of the list as with default Maya transformation attributes. Local attributes reside under these attributes.
Local translate along Z normal.
POLYGONAL MODELING 56
POLYGON COMPONENTS | 3 Moving components using Move Component
Global scale X, Y, Z.
These values correspond to the local and global values in the options window. You can enter values in the window and press the Move Vertex button (or whichever component you have selected) to perform the transformation.
Moving UVs •
The manipulator does not display if you use Move Component on UVs in the 3D view, but it does display in the UV Texture Editor.
•
Local coordinate mode is not applicable for UVs.
•
A texture must be assigned to the object to see the results in the 3D view. Once you select the UVs on the object, use the options window or the Channel Box to change the settings and transform the UVs within the area you selected. Use the UV Texture Editor window if you want more control when transforming UVs. See "Transforming UVs in the UV Texture Editor" on page 226 for details.
Move Component options Select Edit Polygons > Move Component ❐ to display the options window for the currently selected component. The options windows for selected components contain most of the same options. For instance, Global Values and Other Values are included in each options window for each selected component. If an option is different for a particular component, it is described separately. Local Values for selected faces Offset
The Offset option is only available for selected faces. Enter a value to offset the edges of transformed faces. This option can be used to produce a bevel effect. In effect, using this option uniformly scales a face.
Note The options window for selected UVs does not contain Local Values.
POLYGONAL MODELING 57
POLYGON COMPONENTS | 3 Moving components using Move Component Translate
This value moves the component locally along the X, Y, or Z axis. Positive or negative values indicate how far the components are moved locally.
Tip: Transforming along a face normal The path you transform along can be perpendicular, or at any other angle to the transformed face. To transform along a face normal, set the Z value for Local Values Translate to 1, and then click the Move Face button. Rotate
This value sets the angle at which you want to rotate the components locally around the X, Y, or Z axis.
Scale
This value scales the components locally along the X, Y, or Z-axis.
Direction
Enter a value to set the location of the X, Y, or Z point in the local axis. Notice how the manipulator handles change accordingly when you change the Y direction value to 4.0.
Default values.
Direction changed to 4.0 in Y.
Global Values Translate
This value moves the components along the X, Y, or Z axis.
Scale
Enter a value to scale the components along the X, Y, or Z axis.
Rotate
This value sets the angle by which you want to rotate the components around the X, Y, or Z axis. Other Values
Random
Enter a value to transform the components randomly varying from a value of 0 to 1.
World Space Coords
Turn on the World Space Coords to use the world coordinate system when you change values randomly. See Using Maya: Essentials for information about World Space Coordinates.
Move Vertex Options — Translate along normal Instead of the generic Translate, Rotate, and Scale transformation values, vertices can be moved along the vertex normals. The value in this box indicates how far the vertices move along the Z axis (or normal).
Move Edge Options — Local center Selecting an item from the Local center pull-down menu repositions the manipulator along the selected edge. Depending on which item you select, all subsequent transforms derive from that position. The default is middle.
POLYGONAL MODELING 58
POLYGON COMPONENTS | 3 Deleting polygon components
Middle
Start
End
DELETING POLYGON COMPONENTS Press the Backspace key to delete selected polygonal components. For example, you can delete the selected edge between two faces and merge the original two faces. The result is a single face, but the vertices shared at the ends of the edge are not deleted.
Note Deleting faces can make your geometry nonmanifold. To correct nonmanifold geometry, perform a cleanup. For details, see "Cleaning up polygonal data" on page 40. To delete polygonal components: 1
Select the type of component you want to delete, for example, faces.
2
Press the Backspace key to delete the components you selected. Select a face or faces.
Press the Backspace key.
Deleting vertices Delete Vertex allows you to simplify your polygonal geometry by deleting interior vertices directly. The faces surrounding the deleted vertex are replaced by a single n-sided polygon with the vertices surrounding the deleted vertex. Quads and triangles are not created in the affected area since the intent is to reduce the geometry. This is equivalent to selecting all the edges surrounding the vertex and deleting them. To delete vertices: 1
Select one or more vertices.
2
Select Edit Polygons > Delete Vertex.
POLYGONAL MODELING 59
POLYGON COMPONENTS | 3 Deleting polygon components The vertices are deleted from the polygonal geometry.
Notes •
Texture coordinates (UVs), color, and blind data will be affected by the operation. Color, shading, and textures may change in appearance.
•
Shader and other set memberships based on vertices and faces are preserved.
•
For polygonal instances, the geometry changes for all instances.
Deleting edges Pressing the backspace key only deletes edges and there may be times when you want to delete the vertices shared at the ends of the edges. Use the Delete Edge operation to delete vertices that are no longer needed To delete unwanted vertices in addition to edges: Select the edges you want to delete, then select Edit Polygons > Delete Edge. These three vertices are deleted when you use Delete Edge.
Same edges deleted using the backspace key.
Selected edges.
Delete error messages Occasionally you may encounter problems when trying to delete edges or vertices. Deleting vertices If you try to use the Delete or backspace keys to delete vertices that are connected to more than two edges, or non-winged, the following error message displays: Error: Non-winged vertices cannot be deleted.
Use Edit Polygons > Delete Vertex on these vertices or select vertices that reside at a corner or are connected to two edges only (winged vertices). This vertex is connected to more than two edges.
POLYGONAL MODELING 60
This vertex is connected to only two edges.
Press the Backspace key.
POLYGON COMPONENTS | 3 Transferring components Deleting edges If you select edges that are border edges, you cannot delete them. The following error message displays: Error: Border Edges cannot be deleted.
Select edges within the border edges to delete them. These are border edges and cannot be deleted.
Select edges within the border edges.
Press the Backspace key.
TRANSFERRING COMPONENTS Use Transfer to transfer vertex positions, UV sets, and/or vertex color between two models with identical topology. To transfer components: 1
Select both the source object and the destination object, in that order.
2
Select Polygons > Transfer ❐.
3
Select the type of information you want to transfer (Vertices, UV Sets, Vertex Color), then click Transfer.
FLIPPING TRIANGLE EDGES Edge placement is often crucial in determining the shape of a polygonal object. Use Flip Triangle Edge to control the orientation of edges of adjacent polygons. You can manually determine the general edge placement within a polygonal shape. For example, the placement or orientation of an edge on a polygonal face could determine the placement of the bridge of a nose or the placement of the cheeks. This option provides a fast way to do the equivalent of deleting an edge, finding the two diametrically opposing vertices and performing a split operation.
Tip Flip Triangle Edge is also known as turn-edge, flip-edge, swap-edge, and rotate-edge. To flip edges: 1
Select one or more edges to flip. The edge should be a shared edge between two triangles.
2
Select Edit Polygons > Flip Triangle Edge. POLYGONAL MODELING 61
POLYGON COMPONENTS | 3 Reducing Polygon Counts
Some edges cannot be flipped The following conditions determine when you cannot turn an edge. You cannot flip edges if: •
Edges are texture borders (in texture space)
•
Edges not connected to two polygons (border edges, including hole borders)
•
Edges have zero length.
REDUCING POLYGON COUNTS You can reduce your polygon count on objects that do not need fine detail.
Before Reduce.
After Reduce.
To reduce the polygon count of an object: 1
Select the objects that you want to reduce.
2
Select Polygons > Reduce ❐ and specify reduce options.
3
Click the Reduce or Apply button.
Polygon Reduce Options Select Polygons > Reduce ❐ to display the options window for the currently selected component. Reduce by (%)
Reduces the number of polygons by the specified amount. The default is 50 percent. (In the Attribute Editor and Channel Box, this option is called Percentage.) Preserve Properties Geometry Border Edges
If a geometric edge is shared by only one polygon then it is a geometric border edge. A connected series of such edges is a geometric border. Turn this option on to preserve the border edge geometry. The default is on. (In the Attribute Editor and Channel Box, this option is called Keep Border.) Border Point Preservation
You must turn off Geometry Border Edges to enable Border Point Preservation. This option specifies how much the reduction preserves or ignores existing vertices along the geometric border. A value of 1 means the reduction preserves the existing border vertices. A value of 0 means the reduction process does nothing to preserve the existing vertices.
POLYGONAL MODELING 62
POLYGON COMPONENTS | 3 Reducing Polygon Counts (In the Attribute Editor and Channel Box, this option is called Border and the value displayed is 1 minus the value entered in the Polygon Reduce Options window.) UV Border Edges
If a map (or UV space) edge is shared by only one map polygon, then it is a map (or UV) border edge. Turn this option on the preserve the UV border. A connected series of such edges is a map (or UV) border. The default is on. (In the Attribute Editor and Channel Box, this option is called Keep Map Border.)
Tip When you tesselate a subdivision surface, UV borders are created on all the created faces. To ensure that Reduce actually reduces, turn off UV Border Edges. Hard Edges
Preserves hard edges. An edge has faces connected to it, and each face has its own normal. An edge is considered to be hard when the edge normals are interpreted as the separate face normals. A soft edge is one that computes the edge’s normals using an averaging of face normals. The weighting for this averaging is determined by the smoothness angle. The default is on. For example, two faces share an edge, and they are at a 90 degree angle to one another. One face is pointing in the X direction and the other in the Y direction. If the edge is marked as being hard, then it appears as a sharp crease. The edge has 2 normals, one pointing in the X direction, the other in Y. If the edge is marked as being soft, it appears as a smooth crease. The edge has 2 normals, and the angle between them is determined by the smoothness angle (which in Maya can be set by the soft/hard edge feature). (In the Attribute Editor and Channel Box, this option is called Keep Hard Edge.) Sharp Geometry Angles
This option specifies how much the reduction preserves or ignores existing areas with sharp angles between faces. A value of 1 means the reduction attempts to preserve areas with sharp angles. A value of 0 means the reduction process does nothing to preserve areas with sharp angles. (In the Attribute Editor and Channel Box, this option is called Line and the value displayed is 1 minus the value entered in the Polygon Reduce Options window.) High Curvature
This option specifies how much the reduction preserves or ignores existing areas with high curvature between edges. A value of 1 means the reduction attempts to preserve areas of high curvature; it concentrates more vertices and edges in those areas. A value of 0 means the reduction process does nothing to preserve areas of high curvature; it distributes vertices and edges evenly. (In the Attribute Editor and Channel Box, this option is called Detail and the value displayed is 1 minus the value entered in the Polygon Reduce Options window.)
POLYGONAL MODELING 63
POLYGON COMPONENTS | 3 Reducing Polygon Counts
POLYGONAL MODELING 64
4
NORMALS AND DISPLAY SETTINGS Maya provides options that you use to view and edit polygonal normals. This includes polygon and vertex level normals. This chapter describes these options and also provides information on how to use the Soften/Harden option to produce a smoothly shaded appearance when you display polygons in Smooth Shaded mode.
MOVING VERTICES ALONG THEIR NORMALS You can precisely move vertices along their normals by dragging the N (normal) manipulator handle or by entering X, Y, or Z values in absolute or relative mode in the Numeric Input Field. To do this you must change the Move Tool’s Move Options to Normal and turn on the Update (UVN) Triad option. A different manipulator displays on the object indicating the U, V, and normal direction.
Vertex moved along Y in world space.
Vertex moved along the normal.
Original position of vertex.
Original position of vertex.
POLYGONAL MODELING 65
NORMALS AND DISPLAY SETTINGS | 4 Editing polygon normals
EDITING POLYGON NORMALS The normal shows the direction of a face. Vertex normals can either be computed from the face normals, or you can set them explicitly. There may be times when the normals may not be correct, for example, if you import a polygonal object created by another modeler.
Face normal.
Vertex normals.
Use the options on the Edit Polygons > Normals menu to help correct poorly oriented normals, or to lock or unlock normals to fine-tune your bump maps, or shading and rendering results. When all the vertex-faces surrounding a vertex have the same normal, the normals are shared. If any face has a different normal, the normals are unshared.
Shared normals at vertex.
Unshared normals at vertex.
SETTING POLYGON VERTEX NORMALS Set Vertex Normal (or Lock Normal) stores the given normal for the vertex (or vertex face). The computed value is ignored thereafter, until the normal is Unlocked. The vertex normals stay fixed in object space, even if the geometry is deformed, or the face normals are reversed. If you use the Set Vertex Normal option, normals do not have to be re-computed every time you move a vertex. By specifying specific option settings in the options window, you can avoid the possibility of normals changing every time you change a vertex position. To set vertex normals for a polygonal operation: 1
To display normals on the vertices, open the Custom Polygons Display window (Display > Custom Polygon Display ❐) and set apply the following:
•
Beside Object Affected select All.
•
Beside Vertices turn on Display and Normals.
2
Select one or more vertices or Vertex/Face components.
POLYGONAL MODELING 66
NORMALS AND DISPLAY SETTINGS | 4 Setting polygon vertex normals
Tip Using Vertex/Face selection you can set normals on a per-vertex per-face basis. 3
Select Edit Polygons > Normals > Set Vertex Normal ❐.
4
Use the options in the option window to set and size normals if necessary, click the Set Normal button, then continue with your transformation.
5
Transform the vertices in X, Y, or Z. If the normals are “locked” they move with the transformation. If they are “unlocked”, they move in the X, Y, or Z direction as you drag. The following example shows what happens when you move vertices and locked and unlock normals on a polygonal plane. Locked normals.
Unlocked normals.
Polygon Set Vertex Normal options By default, Maya locks normals to their existing values. To Unlock normals or to change the X, Y, or Z values, open the options window (click the ❐ next to Set Vertex Normals in the menu). Lock Normals
To change the X, Y, or Z values for normals, turn this option off. The normal values you specify (or if you use the default values) are fixed for each normal associated with the vertex or vertex/face component. This means that if you change a vertex position, normals do not change position.
Unlock Normals
Use this option to unlock locked normals. You can change the X, Y, and Z values, click the Set Normals button and transform the vertices.
X, Y, and Z Values
Enter a value or drag the slider to change the range of the normals associated with the vertices and faces. You can lock or unlock these values using the Lock Normals or Unlock Normals option. X = 0.75
Y = -0.1
Z = 0.75
POLYGONAL MODELING 67
NORMALS AND DISPLAY SETTINGS | 4 Averaging vertex normals Normalize Normal
Regardless of the current normal’s values, clicking this button sets the normals to unit length (or normalizes them). The unit length of a normal is calculated by the point offset from the vertex. You may inadvertently change the X, Y, Z values to ones that change this unit length to something undesirable which could un-normalize the normals (for example, changing X to 1.11).
AVERAGING VERTEX NORMALS Using this operation, you can average vertex or vertex/face normals. You can do the following: •
You can average the vertex-face normals at a single vertex.
•
You can increase the tolerance and average the normals of several vertices in the same region to give the area a flattened look.
•
You can pick vertices on opposite sides of a seam and average them to smooth across the seam.
•
Using a small tolerance, you can select all the vertices along a seam, and each group of close-together vertices will be averaged separately. Depending on which normals are averaged, they may be represented as computed normals (if this can be achieved by softening the related edges), or they may need to be stored explicitly. Average Normals usually results in explicit normals being set, except in cases where exactly the same values for the normals can be achieved by softening or hardening the edges. Averaging normals works in object space, so if you want to average normals across two different shapes, make sure that the path for each shape has the same transforms. To average vertex normals:
1
To display normals on the vertices, open the Custom Polygons Display window (Display > Custom Polygon Display ❐) and apply the following:
•
Beside Object Affected select All.
•
Beside Vertices turn on Display and Normals.
2
Select one or more vertices or Vertex/Face components.
Tip Using Vertex/Face selection lets you set normals on a per-vertex per-face basis. 3
Select Edit Polygons > Normals > Average Normals ❐.
4
Use the options in the option window to average normals if necessary and click the Average Normals button.
POLYGONAL MODELING 68
NORMALS AND DISPLAY SETTINGS | 4 Splitting vertex normals
Average Normals options Select Edit Polygons > Normals > Average Normals ❐ to display the options window. Pre-normalize Normals
Turn this option on so that all the normals in the calculation have a length of 1, and each one contributes equally to the average. This is on by default. If this option is turned off, and if you explicitly set normals where the length is not equal to 1, then the contribution of these normals to the average is weighted by the length of the normal (the new normal will be closer in direction to the longer normals). Distance Tolerance
The vertices within the distance you specify are considered as a group to share a normal which is the average of the normals in the group. So your selected vertices may be divided into several groups, and each group averaged separately. Allow Zero Normals
If two normals of exactly opposite direction are averaged, the result will be a zerolength normal. While this is valid in Maya, it may not be what you want. If this option is turned off, the normals are replaced by user-specified value (see below). Replace Zero Normals By
If Allow Zero Normals is on, this option is disabled. If Allow Zero Normals is off, the normals are replaced by the X, Y, and Z values you specify here. Post-normalize Normals
If Pre-normalize Normals is off, you can keep the length of the normal that resulted from the calculation, or set the length to 1 by turning on Post-normalize Normals. The length may be significant in future invocations of Average Normals. If Prenormalize Normals is on, this option is disabled, since the result will be automatically normalized.
SPLITTING VERTEX NORMALS Use Set to Face to set the vertex normals to the face normals, in effect splitting the vertex normal.
Before Set to Face.
After Set to Face.
Setting the vertex normals to the face normals creates the same effect at that vertex as hardening the adjacent edges (the vertex-face normals will be equal to the face normals). You also have the option of setting these values for the normals explicitly.
POLYGONAL MODELING 69
NORMALS AND DISPLAY SETTINGS | 4 Reversing polygonal normals Set to Face usually results in explicit normals being set, except in cases where exactly the same values for the normals can be achieved by softening or hardening the edges. To split vertex normals: 1
To display normals on the vertices, open the Custom Polygons Display window (Display > Custom Polygon Display ❐) and apply the following:
•
Beside Object Affected select All.
•
Beside Vertices turn on Display and Normals.
2
Select one or more vertices or Vertex/Face components.
Tip Using Vertex/Face selection you can set normals on a per-vertex per-face basis. 3
Select Edit Polygons > Normals > Set to Face.
Set to Face options Select Edit Polygons > Normals > Set to Face ❐ to display the options window with the following option. If turned on (the default), the vertex/face normal value is locked to its current face normal. Otherwise, the edges surrounding the vertex face are hardened if it is possible to do so, and the normals unlocked.
Set User Normal
REVERSING POLYGONAL NORMALS Reversing face normals affects the orientation of the face and causes the face normals to be computed in the opposite direction. Vertex normals are computed from the face normals, so they are affected as well. There are three ways to reverse normals. You can: •
Only reverse face normals.
•
Reverse face normals and vertex normals and then extract the vertices.
•
Reverse face normals and propagate the change to the rest of the normals in the shell. You can reverse face normals one at a time or reverse multiple face normals.
POLYGONAL MODELING 70
NORMALS AND DISPLAY SETTINGS | 4 Reversing polygonal normals
Select faces on hat then select Reverse. Inside hat after Reverse.
To reverse polygonal face normals:
Reverse
1
To display normals on an active object, select Display > Polygon > Components > Normals.
2
Select the faces you want to reverse normals on:
•
To reverse the normals on an entire object, marquee-select the object.
•
To reverse normals on individual faces, press F11 or press the right mouse button and select Face from the marking menu, then click to select the faces whose normals you want to reverse and select Edit Polygons > Normals > Reverse.
3
Select Edit Polygons > Normals > Reverse ❐.
4
Beside Mode, select how you want to reverse normals and click Reverse Normals or Apply. Maya reverses the normals on the selected faces.
Note Reversing normals using this option can make your geometry nonmanifold. To correct nonmanifold geometry, perform a cleanup. For details, see "Cleaning up polygonal data" on page 40. Reverse and Extract
Maya reverses the normals on the selected faces and then extracts, or splits the vertices.
POLYGONAL MODELING 71
NORMALS AND DISPLAY SETTINGS | 4 Conforming normals Reverse and Propagate
Maya reverses the normals on the selected faces and forces all the normals in the shells to which the faces belong to go in the direction of the reversed selection. This can come in handy if you create models where some of the normals are pointing in the opposite direction of the others.
These normals are pointing in the opposite direction of the others.
Select one face, then select Reverse and Propagate.
Shells and propagating normals Propagation can only happen within a shell. A shell is a portion of the mesh that is not connected to the rest of the mesh by any edges, but is self-contained.
Four separate shells make up this mesh.
CONFORMING NORMALS Using the Conform normals option you can make all the normals of selected faces point in a consistent direction (no normals point in opposite directions).
Before Conform.
After Conform.
To conform normals: 1
Select the faces whose normals you want to conform.
POLYGONAL MODELING 72
NORMALS AND DISPLAY SETTINGS | 4 Softening and hardening polygon edges 2
Select Edit Polygons > Normals > Conform. Normals conform to the direction shared by most of the faces.
SOFTENING AND HARDENING POLYGON EDGES Using the Soften/Harden option, you can specify an angle at which the polygonal object is to be smoothed when displayed in Smooth Shaded mode. If the angle between two faces is larger than the smoothing angle, the edge is hard. If the angle between two faces is smaller than the smoothing angle, the edge is soft. If an edge is hardened, the face normals are used for the vertex-faces adjacent to that edge. If an edge is softened, the average of the face normals surrounding the vertex is used.
Note If you import a model that was created as .obj format with vertex normals already specified, you might not be able to soften or harden the resulting edges in Maya. Try unlocking the normals by choosing Edit Polygons > Normals > Set Vertex Normal ❒, and turning on Unlock Normals in the options window. Then soften or harden the edges. To make edges soft or hard: 1
Select an object whose edges you want to soften or harden.
2
Press F10 or press the right mouse button and select Edge from the marking menu.
3
Marquee-select the edges you want to change, or select individual edges.
4
Select Edit Polygons > Normals Soften/Harden ❐.
5
If necessary, change the angle in the options window to soften or harden the edges you want and then click the Soft/Hard button. For example, if you want to render edges hard, you can set the smoothing angle in the options window to 0 degrees. To render soft edges, set the angle to 180 degrees. Edges at the top selected and values reset in option window. All Soft (180)
All Hard (0)
Bottom half is smoother than top half.
Soften/Harden Edge options Select Edit Polygons > Normals > Soften/Harden ❐ to display the options window.
POLYGONAL MODELING 73
NORMALS AND DISPLAY SETTINGS | 4 Softening and hardening polygon edges Angle
Use the slider or enter a value to set the angle. Angles greater than the current value render hard; angles less than the current value render soft.
All Hard
Click this button to set the angle to 0, making all selected edges render hard.
All Soft
Click this button to set the angle to 180 degrees, making all selected edges render soft.
POLYGONAL MODELING 74
5
POLYGONAL PRIMITIVES This chapter introduces you to polygonal primitive objects and shows you how to create polygonal text. There are several ways to use primitives to build objects quickly and easily. Use primitives as a starting point, then use a combination of polygon creation and editing operations to complete a task. Throughout this book you’ll find examples where primitives are used as the base element of a particular task in combination with many of the Maya editing and creation operations.
BASIC POLYGONAL PRIMITIVE OBJECTS The most basic object type is the primitive. Primitives are pure shapes that can be used as the basis of creating more complex models. There are six polygonal primitive objects—Sphere, Cone, Cylinder, Cube, Plane, and Torus.
Creating polygonal primitives You can instantly make simple objects like spheres, cubes, cylinders, cones, planes, and toruses. When you select the polygon primitive from the menu, it displays in all views at the origin of the grid. To create a primitive with the default option settings, select Create > Polygon Primitives and choose the primitive you want to create from the menu. If you are not satisfied with the results, you can always edit the primitive from the Channel Box or its Attribute Editor.
POLYGONAL MODELING 75
POLYGONAL PRIMITIVES | 5 Setting primitive options
SETTING PRIMITIVE OPTIONS Most of the options for polygonal primitives are the same, therefore all options are described for all polygonal primitives in the following sections: •
"Specifying a primitive’s radius" on page 76
•
"Specifying a primitive’s subdivisions" on page 77
•
"Specifying a primitive’s width and height" on page 79
•
"Changing a primitive’s orientation" on page 79
•
"Preparing a primitive for texture mapping" on page 80 If there are special options that do not apply to every primitive, they will be discussed separately. To set primitive options:
1
Click the box (❐) beside the type of primitive you want to create to open the options window (for example, Create > Polygon Primitives > Sphere ❐).
2
Change the option settings and click the Create button to create the primitive. By default, the primitive displays centered at the world coordinate system. You can move it to any location using Maya’s Move tool.
Specifying a primitive’s radius The Radius value specifies the distance from the center of the primitive in all directions. Polygonal primitives that have this option include Spheres, Cylinders, Cones, and Toruses. Adjusting the Radius for these primitives is like changing the width for primitives that do not have circumference (like primitive planes and cubes). Type a value or use the slider bar to specify the primitive’s radius. You can also change these values in the Channel Box or Attribute Editor after you create the primitive.
The following examples show the difference between a Radius value of 1.0 (the default) and what happens when you change this value to 2.0.
POLYGONAL MODELING 76
POLYGONAL PRIMITIVES | 5 Setting primitive options Default=1.0
Radius=2.0
Default=1.0
Radius=2.0
Sphere
Cylinder
Cone
Torus
Using the Section Radius option for a primitive Torus The Section Radius option value specifies the size of the sections that make up a Torus. Change this value to increase or decrease the radius of these sections.
Section Radius=0
Section Radius=1
Using the Twist option for a primitive Torus The Twist option value specifies the twist angle of the torus. Change this value to adjust the distance around the Torus in all directions.
Specifying a primitive’s subdivisions The values you enter in these boxes change the primitive by adding or taking away faces of the polygon. For primitives without caps (or sides) you can only subdivide in the X and Y direction. These include Spheres, Planes, and Toruses. For primitives with caps, you can subdivide in all three directions, X, Y and Z. These include Cones, Cubes and Cylinders.
Using the Subdivisions around Axis (Subdivisions Axis) option For spheres, cylinders, cones, and toruses, this option defines the number of subdivisions there are around the axis defined by the Axis option. This option is also called Subdivisions Axis in the Channel Box and the Attribute Editor.
POLYGONAL MODELING 77
POLYGONAL PRIMITIVES | 5 Setting primitive options
10 Subdivisions around the Y axis.
Perspective view of cone with 10 Subdivisions around Y Axis.
Top view of cone.
Increase or decrease this value to add or take away faces around the axis defined by the Axis option. Subdivisions around Axis (Axis = Y)
Y
Default=20
Value=10
Value=40
Using the Subdivisions along Height (Subdivisions Height) option This option defines the number of subdivisions there are along the axis defined by the Axis option. Height is equivalent to the Y direction by default. This option is also called Subdivisions Height in the Channel Box and the Attribute Editor. Increase or decrease this value to add or take away faces in the Axis direction.
POLYGONAL MODELING 78
POLYGONAL PRIMITIVES | 5 Setting primitive options Subdivisions along Height (Axis = Y) Y
Y Value=10
Value=40
Using the Subdivisions along Depth option When Axis is set to X or Y, depth is equivalent to the Z direction for polygonal cubes. When Axis is set to Z, depth is equivalent to the Y direction. This option is also called Subdivisions Depth in the Channel Box and the Attribute Editor. Increase or decrease this value to add or take away faces along the depth.
Using the Subdivisions on Caps option Caps are the tops, bottoms, or sides of Cones and Cylinders. This option defines the number of subdivisions around the origin of the primitive caps. This option is also called Subdivisions Cap in the Channel Box and the Attribute Editor. Increase or decrease this value to add or take away faces around the caps.
Default=0
Value=2
Default=1
Value=4
Specifying a primitive’s width and height Enter values or use the slider to specify the height or width of a primitive. For polygonal primitive Cones and Cylinders, the Radius value is like the Width of the primitive so only the Height option applies. For primitive Planes and Cubes, both Width and Height values can be adjusted. For a primitive plane, the Width value increases or decreases the plane along the X axis while the Height value increases or decreases the plane along the Z axis.
Changing a primitive’s orientation Be default, a primitive is created along the Y axis. You can change a primitive’s default orientation before you create it by changing the Axis option. You cannot change the orientation for a new primitive from the Channel Box, but you can enter values in the Axis boxes in the Attribute Editor.
POLYGONAL MODELING 79
POLYGONAL PRIMITIVES | 5 Setting primitive options
Preparing a primitive for texture mapping By default, UV values are assigned for texture mapping. If you do not plan to map textures on a polygonal primitive, you can turn off the Texture option in the options window. Texture is on by default. Important note about UVs It is important to make sure UVs are present on an object or you cannot see the mapped textures in the view. This can happen if you inadvertently create a primitive object with the Texture option turned off or set to None. To correct the problem, select the faces of the primitive and use any of the tools in the Edit Polygons > Texture menu. You can then use the UV Texture Editor to view the created UVs. Select the object and use any of the UV creation or editing Texture menu items.
Texture mapping options for primitive Cubes and Cylinders The options window for a polygonal Cube and Cylinder primitive includes a Texture pop-up menu where you can select how you want the texture to cover the primitive when you assign it. This pull-down menu is also available from the Attribute Editor.
Options window.
None
Attribute Editor.
Selecting None is like turning Texture off for polygonal primitive Spheres, Cones, or Toruses.
Normalize the whole object/object
The default setting maps the texture over each face of the primitive and normalizes it so that it covers the entire object.
Normalize each face separately/face
If you select this option, Maya maps the texture to each face separately.
POLYGONAL MODELING 80
POLYGONAL PRIMITIVES | 5 Setting primitive options
Normalize the caps separately/face
For cylinders only. If you select this option, Maya maps the texture separately to each cap of the cylinder.
Texture mapping options for primitive Planes The options window for a polygonal Plane primitive includes a Texture pop-up menu where you can select an item to specify how you want the texture to behave when you transform the plane after it is created. This pop-up menu is also available from the Attribute Editor.
Options window.
None
Attribute Editor.
Selecting None is like turning Texture off for polygonal primitive Spheres, Cones, or Toruses.
Stretch to fit object/Stretch to fit
This is the default setting. When you change the shape of the primitive plane by adjusting the options in the option window or by adjusting the Width and Height in the Channel Box, the texture stretches to fit within the plane’s transformed shape. The following example shows a rock texture mapped to a plane whose Width has been changed to 3.
POLYGONAL MODELING 81
POLYGONAL PRIMITIVES | 5 Creating and editing text
Default plane.
Preserve Aspect ratio/Preserve Aspect Ratio
If you select this option, when you change the Width of the primitive plane, the texture fits uniformly to the new dimensions of the object.
Editing primitives in the Attribute Editor To edit a primitive after you create it, use the Attribute Editor. The Attribute Editor for a polygonal primitive includes the same options and attributes you find in its options window and the Channel Box. To see these attributes, click the tab with the primitive’s name. For example, click the polySphere tab for a polygonal Sphere primitive.
CREATING AND EDITING TEXT The Poly text type creates text as polygons which you can manipulate as you would any other polygonal entity. When this text type is selected, a planar trim curve is created between the curve and tessellate nodes. By default, Maya creates text as NURBS geometry. To create polygonal text: 1
Select Create > Text ❐ to open the Text Curves options window and set the Type option to Poly.
2
Type the text you want to create in the Text box.
3
Change the default font settings if necessary.
4
Change the options settings (see "Polygonal text settings" on page 83 next for details).
5
Click the Create button to create the text. Two instances of the word display—a NURBS (or curve) based text string and a polygonal text string. The polygonal text string is highlighted. Once you move and transform your polygonal text, you can first delete the history on the new text, and then delete the NURBS text if you want to.
POLYGONAL MODELING 82
POLYGONAL PRIMITIVES | 5 Creating and editing text •
To delete the history of the polygonal text, select the text and choose Edit > Delete by Type > History.
•
To delete the NURBS text, select it either in the 3D view or from the Hypergraph and press the Backspace key. To change the default font:
•
If you are working on a UNIX machine, select the font that you want from the menu that appears.
•
If you are working on a Windows machine, do the following steps:
1
At the end of the Font box, click the down arrow and click Select to display the Font window.
2
Select a font from the Font menu, a style from the Font style menu, and a font size from the Size menu, and adjust any other properties you want to change.
3
The type of font you select appears in the Sample box. Click OK when done to select the font and close the Font window.
Polygonal text settings When you create polygonal text, Maya provides options that you can set to display and create your text for subsequent polygonal-type editing. Change any of these options before you create the text.
Polygon Type options Triangles
3-sided polygons are created. This is the default.
Quads
4-sided polygons are created. The following example shows text using the default font and the following settings: •
Polygon text Type – Quads
•
Tessellation Method – Count
•
Count value– 50
POLYGONAL MODELING 83
POLYGONAL PRIMITIVES | 5 Creating and editing text
Tessellation Methods These options are the same ones you set when you convert NURBS geometry to polygonal geometry. See Chapter 9, “Converting NURBS to polygons” for details. For specific information, see "Choosing a tessellation method" on page 117. •
"Standard fit" on page 117
•
"General" on page 118
•
"Count" on page 119
•
"Control Points" on page 119
POLYGONAL MODELING 84
6
POLYGONAL BOOLEANS You use polygonal Boolean operations on objects whose surfaces intersect. The results of these operations produce new geometry based on the subtraction, union, or intersection of the objects.
Note Surfaces do not necessarily have to intersect for a Boolean operation to succeed, although the results may not always be useful.
POLYGONAL BOOLEAN OPERATIONS Boolean operations are a popular and intuitive modeling solution which involves using one shape to act upon another as a volumetric tool. This can be useful for “carving” objects.
Using a sphere to “carve” a cube using the Difference operation
The first object selected is the shape upon which the result is based, and the second selected object is the tool object which operates upon the first one. Boolean operations always generate a new shape node as a result, and if construction history is maintained, the original shapes can be selected in the Channel Box, Hypergraph, or Outliner and manipulated to edit the Boolean operation after the function is completed. NURBS to polygon conversion and Boolean operations Boolean operations require that the tool and original surfaces both be closed in the area where they intersect. Boolean operations are very sensitive to the quality of the surfaces intersecting. NURBS objects converted to polygons (using NURBS To Polygons) may require some editing of converted surfaces to achieve successful Boolean operations.
POLYGONAL MODELING 85
POLYGONAL BOOLEANS | 6 Boolean types Failed Boolean operations Occasionally Boolean operations may fail for topological reasons. The following error message displays: Cannot perform boolean operations for topological reasons.
If this happens, the objects that were selected before performing the (failed) operation become invisible. To return to the original state, undo the last Boolean operation.
BOOLEAN TYPES There are three types of Boolean operations—Union, Difference, and Intersection. Their names describe how the tool object operates on the first selected (or original) object You access the Boolean operations from the Polygons menu.
Union
Difference
Intersection
Note Booleans operations do not work on objects that have zero (or very small) area faces. Before performing a boolean operation, either enlarge these faces or remove them. To select these faces: 1
Select the objects you want to perform the boolean operation on and switch to face component mode.
2
Select Edit Polygons > Selection > Selection Constraints.
3
Beside Constrain, select All Next.
4
Expand Geometry, then expand Area.
5
Turn on Activate and set Min to 0 and Max to 0.0001. The offending faces become highlighted.
You can now enlarge them or remove them.
Union Boolean operation The Union operation merges the original and tool objects, removing surfaces which overlap while retaining the original surface’s shadier information.
POLYGONAL MODELING 86
POLYGONAL BOOLEANS | 6 Boolean types
Tip In a situation where there may be more than one object that you want to use for Boolean operations, it is possible to use the Boolean Union function to join these objects beforehand even if they do not intersect. To perform a polygonal boolean Union operation: 1
Create a polygonal cube. Select Create > Polygon Primitives > Cube. Scale the cube to make it larger than the default size.
2
Create a polygonal cone. Select Create > Polygon Primitives > Cone. Scale the cone to make it larger than the cube.
3
Select the cube, press the Shift key, and select the cone.
4
Select Polygons > Booleans > Union. Notice how the edges of the cube and the cone are now connected and both primitives act as one single object.
Edges of cone and cube are now connected.
If you open the Outliner, you can see the difference before and after the operation.
POLYGONAL MODELING 87
POLYGONAL BOOLEANS | 6 Boolean types
Before Union operation.
After Union operation.
Difference Boolean operation The Difference operation creates a new surface that subtracts the intersecting volume of the tool object from the original object. This operation, in effect, carves the first selected object (the original object) with the tool object.
Note The new surface created will have the same shader characteristics at the component level as the tool object, while the original object retains its original shader information at the component level where it was not effected by the operation. To perform a polygonal boolean Difference operation: 1
Create a polygonal cube. Select Create > Polygon Primitives > Cube.
2
Create a polygonal sphere. Select Create > Polygon Primitives > Sphere.
3
Select the sphere, press the Shift key, and select the cube.
4
Select Polygons > Booleans > Difference.
POLYGONAL MODELING 88
POLYGONAL BOOLEANS | 6 Editing Booleans with construction history
Intersection Boolean operation The Intersection operation creates an object consisting of the volume enclosed by the original and tool objects. As with the Difference operation, the component surface shaders correspond to the shaders of the original objects. To perform a polygonal boolean Intersection operation: 1
Create a polygonal cube. Select Create > Polygon Primitives > Cube.
2
Create a polygonal sphere. Select Create > Polygon Primitives > Sphere.
3
Select the sphere, press the Shift key, and select the cube.
4
Select Polygons > Booleans > Intersection.
EDITING BOOLEANS WITH CONSTRUCTION HISTORY While construction history is maintained for the created geometry, you can access the objects you used for the Boolean operation and edit them in the Channel Box, Attribute Editor, or Hypergraph as well as change the Boolean operation after it has been performed. To switch polygonal Boolean operations from the Channel Box: You can switch between Boolean operations from the Channel Box even after the initial operation has been performed. 1
Click the polyBoolOpt heading for the Boolean operation you want to change.
2
Click with the left mouse button or click the down-pointing arrow to access the pulldown menu.
3
Select a Boolean operation. You can also switch the Boolean type from the Attribute Editor by selecting an operation from its pull-down menu.
POLYGONAL MODELING 89
POLYGONAL BOOLEANS | 6 Editing Booleans with construction history
Note It is important not to assign shaders at the component level if you want to use construction history to transform or animate the original objects of the Boolean operations. Because the components (faces) are created as the Boolean operation is recalculated with each transform, new faces revert to the default shader since the new faces are, for all intents and purposes, new. To edit the original polygons after a Boolean operation: If you want to transform the objects after a Boolean operation, you have to access the history of the objects from the Hypergraph, Outliner, Channel Box, or Attribute Editor. You can then use Maya’s transformation tools or enter values to transform the objects. In the following example, an Intersection operation was performed on two polygonal primitives. 1
After an Intersection Boolean operation, select Windows > Hypergraph to open the Hypergraph.
Notice that the Intersection operation displays the result as one entity. 2
Select the object you want to transform from the Hypergraph. For this example, click to select the pCube then select the Scale tool.
In the view, notice how the object changes color to indicate that you are now working on an object’s history nodes.
POLYGONAL MODELING 90
POLYGONAL BOOLEANS | 6 Editing Booleans with construction history To display the tool object you used when performing the Intersection operation (the cube in this case), all you have to do is select the transform node for the tool object in the Hypergraph, turn Visibility on in the transform node’s Attribute Editor, and interactively edit the objects in the view. 3
Open the Hypergraph and double-click the transform node for the cube. The transform node’s Attribute Editor displays.
4
In the Attribute Editor, click the transform tab (in this case transform1), click the arrow to open the Display section, and turn on Visibility.
Click here to turn Visibility on.
Now you can see the tool object (the cube) and scale it. The Boolean operation constantly updates the original object based on the new transformed tool object.
POLYGONAL MODELING 91
POLYGONAL BOOLEANS | 6 Trimming using polygonal Boolean operations You can also select the vertices on the tool object and transform them to change the original object. In this example, two vertices were selected and moved. Notice how the original object changes as the vertices move.
TRIMMING USING POLYGONAL BOOLEAN OPERATIONS In situations where the model you are working on is a polygonal shape, you can use Boolean operations to perform trim functions. For example, the bathtub in the following example is a polygonal object, and the scene requires that it contain a water surface which is not part of the bathtub data file. To quickly create the water surface, a polygonal cube is positioned in such a way as to “fill” the bathtub object. The bathtub is duplicated to be used as the tool object, and a Difference Boolean operation is then performed on the cube. The result is the volume of the cube within the bathtub. Notice the original bathtub shape has been templated (using Display > Object Display > Template).
The faces which make up the bottom and sides of the result object can also be deleted, leaving a perfectly trimmed surface for use as the water surface. A displacement shader completes the water surface.
POLYGONAL MODELING 92
POLYGONAL BOOLEANS | 6 Animating polygonal Boolean operations
ANIMATING POLYGONAL BOOLEAN OPERATIONS Boolean operations create new geometry when they are performed. When construction history is maintained, the tool and original object’s nodes can be selected and animated, opening up new creative and problem-solving possibilities.
Original object node.
Animated tool object node.
Polygonal shape created by Boolean operation.
POLYGONAL MODELING 93
POLYGONAL BOOLEANS | 6 Animating polygonal Boolean operations
POLYGONAL MODELING 94
7
SETTING GLOBAL TOOL OPTIONS The Polygons > Tool Options menu offers a variety of options that you turn on or off to globally set the results of polygonal operations.
KEEPING NEW FACES PLANAR Turn Polygons > Tool Options > Keep New Faces Planar on if you want to create planar faces each time you create new faces using the Create Polygon Tool and the Append to Polygon Tool. Keep New Faces Planar is off by default. The Tool Settings window for both these tools include the Constraints option, Ensure Planarity, as shown in the Tool Settings window for the Create Polygon Tool.
Ensure Planarity option.
If you click Ensure Planarity in the Tool Settings window, Maya sets the Keep New Faces Planar option on or off in the Tool Options menu. If you click the Keep New Faces Planar option in the Tool Options menu, Maya sets the Ensure Planarity options on or off in the Tool Settings window for both the Create Polygon Tool and Append to Polygon Tool. See "Ensuring planarity when creating polygons" on page 27 and "Ensuring planarity when appending to polygons" on page 31 in Chapter 2, “Basic Polygonal Modeling” for details about the Ensure Planarity option.
POLYGONAL MODELING 95
SETTING GLOBAL TOOL OPTIONS | 7 Keeping faces together
KEEPING FACES TOGETHER Turn Polygons > Tool Options > Keep Faces Together on or off while you are extruding, extracting, or duplicating faces to specify whether you want to retain the edges of each face or the border edges. By default, this option is turned off. If on, Maya automatically sets the option in the Attribute Editor and Channel Box for Edit Polygons > Extrude Face, Extrude Edge, and Duplicate Face, and Edit Polygons > Extract. If off, Maya does not set the option.
Keep Faces Together on If you turn Keep Faces Together on, only the border edges make walls as they are extruded, extracted, or duplicated. Faces connected by their edges create a single tube, with the connected faces as a single roof.
Duplicated faces.
Extruded faces. Extracted faces.
Extruded edges.
Keep Faces Together off If Keep Faces Together is off, each edge makes a wall as it is extruded. Duplicated faces are duplicated separately, and extracted faces are extracted separately. The faces separate from each other and scale from their own center.
POLYGONAL MODELING 96
SETTING GLOBAL TOOL OPTIONS | 7 Converting the selection mode
Extruded faces.
Duplicated faces.
Extracted faces.
Extracted edges.
See "Extruding faces and edges" on page 125, "Duplicating faces" on page 129, and in Chapter 11, “Extruding, Duplicating, and Extracting” for details about using these operations.
CONVERTING THE SELECTION MODE When Polygons > Tool Options > Convert Selection is turned on (the default), and you perform an operation on an object requiring components to be selected, Maya automatically converts the object selection mode to the appropriate component selection mode, and proceeds. For example, if you are in object selection mode and you select a polygonal Plane and try to extrude faces, Maya automatically converts the selection mode to faces, selects all the faces on the selected object, and proceeds. When Convert Selection is turned off, operations work at the object level. If this is not appropriate for the operation, you will get the message: Warning: Try turning the Polygons->ToolOptions-> ConvertSelection ON.
INSTALLING SMART COMMAND SETTINGS If you turn on Polygons > Tool Options > Smart Command Settings (it is turned off by default), when you perform polygonal operations from the Polygons or Edit Polygons menu, Maya installs certain settings based on the kind of action being performed. Maya modifies the following settings:
POLYGONAL MODELING 97
SETTING GLOBAL TOOL OPTIONS | 7 Installing Smart Command Settings •
Display attributes (for instance, displaying normals or border edges)
•
The pick mask (selection mask)
•
Applies selection constraints that make sense for the action After performing an operation, you can return to the previous state either by selecting the Reset to Default Settings from the Tool Options menu item or by performing another action. If you do not want this workflow for subsequent polygonal edits and modifications, turn off Smart Command Settings before you perform your next operation. To display normals using Smart Command Settings: The following example shows how normals display automatically when you turn on Smart Command Settings.
1
Turn on Smart Command Settings in the Polygons > Tool Options menu.
2
Select a few faces on a polygonal model.
3
Select Edit Polygons > Normals > Reverse. The normals automatically display.
If Smart Command Settings is turned off, to see the normals you have to display them by turning on Normals from the Display > Polygonal Components menu or in the Custom Polygon Display window (Display > Custom Polygon Display ❐). To constrain the selection using Smart Command Settings: In this example several holes in a polygonal plane are filled using the Fill Hole operation. 1
Turn Smart Command Settings on.
2
Select Edit Polygons > Fill Hole. The border edges highlight around the hole, you only have to click on one edge to select them all, then select Fill Hole to fill the hole.
POLYGONAL MODELING 98
SETTING GLOBAL TOOL OPTIONS | 7 Resetting current command settings
Border edges highlight around the hole automatically.
Click one edge to select them all.
The hole is filled.
If Smart Command Settings is off, you have to perform two extra steps: •
The border edges around the faces where the hole has been made are not highlighted. To highlight the border edges to be able to see them better, you have to select Display > Polygon Components > Border Edges.
•
To fill the hole, you have to select the edges one-by-one.
RESETTING CURRENT COMMAND SETTINGS Use Polygons > Tool Options > Reset to Default Settings to clear all changes you have made to the actions you performed when using the Smart Command Settings option.
POLYGONAL MODELING 99
SETTING GLOBAL TOOL OPTIONS | 7 Resetting current command settings
POLYGONAL MODELING 100
8
SELECTION OPERATIONS Using Maya’s powerful polygon selection operations in the Edit Polygons > Selection menu, you can constrain the selection of components to a specified area of a polygonal model and perform operations on those components in that specified area only without disturbing the rest of the model. You can also constrain the selection of components to a specified area of a polygonal model so that the operations you perform in that area do not affect the rest of the model.
GROWING AND SHRINKING SELECTIONS Select Edit Polygon > Selection > Grow Selection Region to increase the number of components you initially selected, or Shrink Selection Region to decrease the number of components you have selected. This works on any component type.
Original selection.
Grow Selection Region.
Shrink Selection Region.
See also Selecting boundaries next and "Converting the selection mode" on page 97 in Chapter 7, “Setting Global Tool Options” for details about how to switch between component selections and defining selection boundaries.
SELECTING BOUNDARIES You use Edit Polygons > Selection > Select Selection Boundary to define the boundary of the current selection region. This is a quick way to select the boundaries of whatever is currently selected (faces, vertices, edges, or UVs).
POLYGONAL MODELING 101
SELECTION OPERATIONS | 8 Selecting a band of edges
Faces selected.
Choose Selection Boundary.
SELECTING A BAND OF EDGES Use Edit Polygons > Selection > Select Contiguous Edges to select a contiguous band of edges around your polygonal model. For example, to select the edges along the center of a figure, you can select one edge, choose Select Contiguous Edges, and it will select the rest of the edges in the center automatically.
Edges selected with Select Contiguous Edges
Some practical uses for Select Contiguous Edges include preparation for the Extrude Edge operation and preparation for UV texturing operations that require you to select edges, such as Cut UVs. The automatic selection moves outward in either direction from the edge or edges you selected. It includes each contiguous edge if it is within the constraints of the Select Contiguous Edges options. Select Contiguous Edges options Max 2D Angle, Max 3D Angle
These settings determine how far the selection continues based on the angles between edges. If Maya is considering an edge for selection and it exceeds the specified angles, automatic selection stops. The 2D angle refers to angles made by the surface topology, regardless of the surface’s shape. The 3D angle refers to angles made by the surface’s shape, as measured in world or local space. The following example illustrates how the combination of these settings control the selection.
POLYGONAL MODELING 102
SELECTION OPERATIONS | 8 Converting the selection to another component
Max 2D = 30, Max 3D = 90
The Max 2D Angle is too small for this topology and prevents full selection Edge Count, Edges Either Side
Max 2D = 60, Max 3D = 90
The Max 2D Angle is too large and causes selection of unwanted edges
Max 2D = 45, Max 3D = 90
The Max 2D Angle is just right
Turn on Edge Count to set the Edges Either Side option. Edges Either Side is the number of edges that Maya will select on either side of your original selection. For example, you can avoid selecting too many edges by setting Edges Either Side to a low number and applying Select Contiguous Edges several times until enough edges are selected.
CONVERTING THE SELECTION TO ANOTHER COMPONENT If you selected components (for example, vertices), but want to change the selection to another component type (for, example, faces), use the Convert Selection options on the Edit Polygons > Selection menu. You can convert your selection to faces, edges, vertices, or UVs.
Vertices selected.
Convert Selection to Faces.
To convert a selection: 1
Select the components.
2
Select Edit Polygons > Selection and then select the appropriate Convert Selection option.
DISPLAYING ONLY SELECTED POLYGONAL FACES Using Isolate Select you can simplify your view by displaying only those faces you select. Once you have isolated the faces, you can edit them in any other polygon component mode without viewing the rest of the scene. For more information on Isolate Select, see Using Maya: Essentials.
POLYGONAL MODELING 103
SELECTION OPERATIONS | 8 Using selection constraints
Select faces with Isolate Select off.
Turn on Isolate Select.
Modify components.
Turn off Isolate Select.
To isolate the view to selected faces: 1
Select the faces you want to view in isolation.
2
On the view menu bar, select Show > Isolate Select > View Selected to turn it on. All other faces and components in the scene become hidden in that view. You can now work on these faces in isolation from the other faces and components in the scene. To view all faces:
•
On the view menu bar, select Show > Isolate Select > View Selected to turn it off. All faces and components in the scene display.
USING SELECTION CONSTRAINTS You set and choose selection constraint options from the Polygon Selection Constraint window (Edit Polygons > Selection > Selection Constraints). Depending on what component mode you are in, the window changes accordingly.
Selecting constraint components Depending on whether you select vertices, edges, faces, or UVs, the corresponding options display in the Polygon Selection Constraint window. The following procedure shows the Polygon Selection Constraint window for selected faces. To set selection constraints: 1
Select a polygonal object to apply constraints to.
2
Make sure you are in a component selection mode (see previous).
3
Choose Edit Polygons > Selection > Selection Constraints.
4
Click the arrows to open the sections of the window where you can specify various selection constraint areas and conditions.
POLYGONAL MODELING 104
SELECTION OPERATIONS | 8 Using selection constraints
5
Apply the constraints to the chosen components, then use a tool or operation on those components. See the following example. To constrain specific edges to delete:
1
Make sure you are in the edges component selection mode. (Select the Lines selection mask icon on the Status Line, press the right mouse button and select Poly Edges.)
2
In the Polygon Selection Constraint window, set the options to constrain a selection area. The following example shows a simple selection constraint setup for edges where most of the defaults have stayed the same with the following exceptions:
Constrain mode is Next Selection. Location is Inside.
Distance is from Plane to Px (Point x).
POLYGONAL MODELING 105
SELECTION OPERATIONS | 8 Using selection constraints 3
Once the options are set, marquee-select the plane. Notice only those areas specified in the window are selected.
4
Use Edit Polygons > Delete Edge. Maya deletes only the selected edges. See the following example.
Resetting selection constraint options You may set a number of selection Properties options in the Polygon Selection Constraint window and then want to change your property selection yet retain the values you set in the various sections of the window for other component types. You can turn off all Properties constraints at once without resetting those values by selecting Reset > Disable All at the top-left of the window.
Polygon selection constraint options The Polygon Selection Constraint window changes according to the type of component you select. The following section describes all the options applicable to all component types. Important Tip! To completely reset all the settings in this window, select Polygons > Tool Options > Uninstall Current Settings.
Generic selection constraint options At the very top of the window in the Constraint list, you set up conditions to filter your selection actions in different ways. These options apply to all component modes. Click the option to make your selection. Which constraints will be applied, and to what settings, is determined by the options you set. There are four different modes: Nothing
When on, no selection constraints are used.
Next Selection
When on, the constraints affect only the next selection mode with a technique such as holding the Shift key and clicking the left mouse button.
Current Next
When on, Maya applies the constraint to whatever has already been selected, plus whatever selection you make next.
All Next
When on, Maya applies the constraints to the entire object automatically, plus whatever group you select next.
POLYGONAL MODELING 106
SELECTION OPERATIONS | 8 Using selection constraints
Important! To be sure you are applying constraints, set the Constrain mode to All Next. To avoid any side effects, make sure to turn off other constraints that may affect what you are trying to do unless you also want to apply those other constraints. When you know that you are not applying a constraint, set Constrain to Nothing, meaning the item(s) you are going to select will not be affected by constraints.
Constraint Properties options The following section describes the options you can set for selected components in the properties section of the window. Generic Location properties The following options are applicable to all component types. Location
Off
If selected, this constraint is not taken into account. The Off option means the same for every option in the Properties section.
On Border
If on, the selection constrains to only the items on the perimeter of the current objects.
Inside
This is the default setting for Location properties. Maya selects only the items on the inside of the current objects. It has the reverse effect of On Border.
On Border
Inside
Smoothing properties (for edges only) If you select edges, Smoothing options are made available. These Properties options do not display for any other component type. Smoothing
Hard/Smooth
Click one of these options to constrain the selection to either hard or soft edges. Smooth edges.
Hard edges.
POLYGONAL MODELING 107
SELECTION OPERATIONS | 8 Using selection constraints Constraint Properties for faces In addition to the properties that all component modes share, when you are in the face component mode, Maya provides numerous face-specific properties. For example, you can set options to select faces according to order, planarity, and shape— if a polygon is concave instead of convex—as well as mapping and topology. These are described next. Order
Planarity
Order options are used to set a valid range for the shape of the faces. If the following options are on, Maya constrains the selection to what you specify. Triangles
Maya only selects faces with three edges.
Quads
Maya only selects faces with four edges.
Nsided
Maya only selects faces other than triangles or quads (faces that have more than four edges).
Planar/Nonplanar
Planar selects only planar faces. Non-planar selects only nonplanar faces.
Planar Convexity
Concave/ Convex
POLYGONAL MODELING 108
Non-planar
Concave selects polygons that have at least one interior angle greater than 180 degrees. Convex selects polygons whose interior angles are all less than or equal to 180 degrees.
SELECTION OPERATIONS | 8 Using selection constraints
Interior angles less than 180 degrees.
Interior angle greater than 180 degrees. Concave Domains
Holed/Nonholed
Convex
If you select non-holed, only faces that do not have holes are selected. If you select Holed, only faces in which holes have been created (using the Edit Polygons > Make Hole Tool) are selected.
Holed
Non-holed
Note Holed faces are considered concave. Mapping
Topology
Mapped/ Unmapped
Lamina Nontriangulable
Depending on what you choose, only mapped or unmapped faces are selected. Mapped faces are faces with texture (UV) coordinates—unmapped faces do not have texture (UV) coordinates. A group of faces glued on top of each other are selected. For example, two faces whose normals face each other. Lets you select faces that cannot be triangulated. Use this constraint option to select these problem faces, then repair them using the Split Polygon Tool (Edit Polygons > Split Polygon Tool). See Chapter 14, “Splitting and Subdividing Polygons” for details.
Geometry options The following table lists the various Geometry sections of the Polygon Constraint Selection window. In the window, click the arrow to display the section. The options available depend on the current component mode.
OPTIONS
SET FOR:
PAGE
Area
Faces
111
Neighbors
Vertices and UVs
112
Length
Edges
112
Angle
Edges, vertices, and UVs
112
POLYGONAL MODELING 109
SELECTION OPERATIONS | 8 Using selection constraints
Mapped Area
All components
113
Distance
All components
113
Orientation
Faces, edges, and vertices
113
Visibility
Faces, edges, and vertices
113
Random
All components
114
Changing Min and Max values The Min and Max values for most of the Geometry options correspond to the units of a polygonal face. The values you set constrain the selection to the size of the face that corresponds to those units. The default unit size is in centimeters by default. You can change this in the Preferences window (Window > Settings/Preferences > Preferences, then click the Settings category). In this example, each face of a polygonal primitive plane is four units. You can determine this by looking at the squares of the grid within each face.
1 2 3 4
When you scale some of the faces and subdivide others, the topology changes as do the Min and Max values you can enter to constrain the selection area.
Try setting different Min and Max values for the Area option for faces, for example, to determine which faces fall within the Min/Max criteria determined by the unit size.
POLYGONAL MODELING 110
SELECTION OPERATIONS | 8 Using selection constraints
Min=1, Max=6
Min=2, Max=4
If you set the Area criteria to a Min value of 0 and a Max value of 7, all faces are selected because there are no faces with a unit area less than 0 or greater than 7.
Min=0, Max=7
Important tip! If you want to constrain the selection for a unit area that is very small, such as the area under the eyes on a polygonal modeled face, set the Min and Max values to a small value. The opposite is true if you want to set the constraint area to the cheeks of the face where the faces cover more unit space. Options common to all Geometry sections (Activate and Off) Each section contains an Activate switch or an Off option. •
Click Activate (to turn it on) to tell Maya to acknowledge these option settings when making your selections.
•
Click Off (to turn it on) to tell Maya not to acknowledge these option settings when making your selections. Setting Area options for faces
Maya selects the faces with an area that is within the range specified in the Min and Max boxes. See "Changing Min and Max values" on page 110 for details about using these values.
POLYGONAL MODELING 111
SELECTION OPERATIONS | 8 Using selection constraints Setting Neighbors options for vertices and UVs
Maya selects the vertices with no fewer than the Min number of edges connected to them and no more than the Max number of edges connected to them.
Min=1, Max=0
Min=1, Max=3
Min=4, Max=7
Setting Length options for edges
Maya selects the edges whose lengths are within the range specified in the Min and Max boxes.
Tip Use this selection constraint option after collapsing edges (Edit Polygons > Collapse) to remove the extra tiny edges sometimes produced as a result of converting a NURBS object. Setting Angle options for edges, vertices, and UVs
In the case of edges, Maya selects them according to the Min and Max range you set for the angle between them. In the case of vertices, Maya selects them according to the range you set for the angle between the edges joining them. In the case of UVs, Maya selects them according to the range set for the angle between the edges joining the UVs corresponding to vertices.
Tip This option works only for non-border edges.
POLYGONAL MODELING 112
SELECTION OPERATIONS | 8 Using selection constraints Setting Mapped Area options These options are used to control the area range of components that are flattened out in the UV Texture Editor window. Unsigned
If on, Maya selects all faces whose flattened areas (whether they are positive or negative) are within the minimum and maximum values you set. Unsigned tells Maya to ignore the direction the face normal is facing.
Signed
If on, Maya selects all faces whose normals are pointing in the same direction and whose flattened areas are within the minimum and maximum values you set.
Min/Max values
You can enter the minimum (Min) and maximum value (Max) for this area which lies in the UV plane. The mapped area of a flattened component can be positive or negative. It is positive if the face is seen from the front and negative if seen from the back. Setting Distance options These options are used to set a reference point and a valid range for the distance between the component, (such as the face center) and the point you specify.
Point
The Point option determines whether Maya acknowledges the distance to the origin you specify (the P, or PointX, PointY, or PointZ values).
Axis
The Axis option determines whether Maya acknowledges the distance to the line defined by its origin (P) and its axis (V).
Plane
The Plane option determines whether Maya acknowledges the distance to the plane defined by its origin (P) and its normal (V).
Px, Py, Pz
These values are used to define the location of the point from which you want the selection to extend.
Vx, Vy, and Vz
If Axis is selected, these values define the axis along which the selection is made. If Plane is selected, these values define the normal vector along which the selection is made. Setting Orientation options for faces, edges, and vertices
Orientation
The Orientation option determines whether Maya uses the orientation of the component for the selection.
Direction
The Direction option determines whether Maya uses the direction of the component or the selection. Using this option, even two faces facing opposite each other can be selected.
Vx, Vy, and Vz
These values define the axis along which the selection is made. Setting Visibility options for faces, edges, and vertices These options are used to set a target point and a focal angle for your selections. Maya selects a component if the target point can be viewed from the center of a face with its normal as the viewing axis (the Px, Py, and Pz values) and the angle as the field of vision.
Angle
This value determines a focal angle for selected components.
Px/Py/Pz
The Px value determines the location of the target point in the X axis, the Py value for the Y axis, and the Pz value for the Z axis.
POLYGONAL MODELING 113
SELECTION OPERATIONS | 8 Using selection constraints Setting Random options This value determines how many components to randomly select according to the ratio value you set within the face units. For example, 0=no faces, 1=all faces, or 0.5=50% of the faces.
Ratio
Propagation options You can extend your selection using the propagation options at the bottom of the window. Off
This option is on by default. That means that no extensions are performed.
Shell
Select Shell to extend the selection up to the border of the individual piece within which the selection has been made. This option is useful for objects made from a series of individual pieces such as those produced when you use Polygons > Combine.
Border
Choose Border to select the border of the current selection only.
Tip With Constrain set to All Next, select Inside as the Properties Location and Propagation Shell at the bottom of the Constraints window, then click a single face to selects all the faces that are inside your object.
More, Less, Border buttons These buttons work the same way as the Edit Polygons > Selection menu items, Grow Selection Region, Shrink Selection Region, and Select Selection Boundary. •
Click More to increase the number of components you initially selected.
•
Click Less to decrease the number of components you have selected. This button can be useful if you want to shave off one face around every face in the current selection.
•
Click Border to define the boundary of the current selection region. This is a quick way to select the boundaries of whatever is currently selected (faces, vertices, edges, or UVs).
POLYGONAL MODELING 114
9
CONVERTING NURBS TO POLYGONAL GEOMETRY This chapter shows you how to create polygonal models from NURBS geometry using the NURBS to Polygons operation.
CONVERTING NURBS TO POLYGONS Use Modify > Convert > NURBS To Polygons to convert NURBS surfaces to polygonal geometry. You can convert any NURBS surfaces created in Maya or imported surfaces, including trimmed surfaces. If the NURBS surface has a texture applied to it, this texture is assigned to the new polygonal object. The NURBS to Polygons action bakes the NURBS UV values onto the corresponding polygonal vertices. Use the options in the options window to specify the resulting polygonal output. You can also change the result in the Channel Box or Attribute Editor. To convert NURBS geometry to polygonal geometry: 1
Select the NURBS surface then select Modify > Convert > NURBS To Polygons. A polygonal representation of the surface is created on top of the NURBS surface.
Use Maya’s Move tool to move the new polygonal surface to the side if you want to re-convert the NURBS surface again using different option settings. You can then pick and choose the polygonal surface you want.
POLYGONAL MODELING 115
CONVERTING NURBS TO POLYGONAL GEOMETRY | 9 Using NURBS To Polygons options
Note If you convert the NURBS surface while construction history is on, you can edit the surface and the polygonal surface will be recreated to match the edited NURBS surface. If you convert the NURBS surface while construction history is off, changes you make to the NURBS surface will not be reflected on the polygonal surface (in which case you may want to delete the NURBS surface after creating the polygonal one).
USING NURBS TO POLYGONS OPTIONS Select Modify > Convert > NURBS to Polygons ❐ to open the options window.
Outputting to triangles or quads Type
Select the type of polygons to use when you convert NURBS geometry to polygonal data. If you select Triangle (the default), 3-sided polygons are created. If you select Quads, 4-sided polygons are created.
Triangle polygon type.
Quad polygon type.
Note When you tessellate a trimmed NURBS surface, some 3-sided (triangle) polygons may be created along the trim edge even when the option is set to Quads.
POLYGONAL MODELING 116
CONVERTING NURBS TO POLYGONAL GEOMETRY | 9 Using NURBS To Polygons options
Choosing a tessellation method Tessellation means that you create a set of polygons from NURBS geometry. Each tessellation method provides you with options that let you control the resulting polygonal surface. There are four tessellation methods: Standard fit, General, Count, and Control Points.
Standard fit Standard Fit is the default tessellation method. It is “adaptive” tessellation, meaning that the following options are used to determine when to stop the tessellation. For example, the tessellation stops at the Fractional Tolerance value you set. If there is an edge shorter than the Minimal Edge Length, the tessellation stops on that edge. If the surface is flat enough within the edge (the specified chord/height ratio is small enough), the tessellation stops there. Chord Height Ratio
The Chord Height Ratio is the ratio between the maximum distance of the curve from the polygon edge used to approximate it and the chord length. The chord length is the linear distance between two polygon vertices.
Chord Height Ratio value 0.05.
Chord height Ratio value 0.1 (default).
Valid values range between 0 and 1, where larger values result in fewer polygon vertices. For example, the default value, 0.1, means that the height must be larger than 1/10 of the chord length before additional edit points are created. Fractional Tolerance
The Fractional Tolerance value determines the degree of accuracy maintained between the original surface and the interpolated polygonal surfaces. The default is to be accurate to within 0.01 units, where a unit refers to the current unit of linear measure (the default unit of measure is centimeters). Therefore, at no point will the polygonal surface be more than the tolerance distance away from the original NURBS surface. In this next example, notice how you can enhance the polygonal surface’s accuracy when you change the Fractional Tolerance value from 1 to 0.01.
POLYGONAL MODELING 117
CONVERTING NURBS TO POLYGONAL GEOMETRY | 9 Using NURBS To Polygons options
Value set to 1.0.
Default Fractional Tolerance value (0.01).
Minimal Edge Length
Enter a value or use the Minimal Edge Length slider to set the minimum length of the edges of the triangles or quads that are created. 3D Delta
The 3D Delta value determines the 3D spacing for U and V isoparms on a surface that makes up the initial grid for the tessellation. In the following example, the 3D Delta value is changed from the default 0.1 to 1.0.
3D Delta default value 0.1.
3D Delta value changed to 1.0
General Set the Tessellation Method to General to display the following options. Setting the initial tessellation controls Unless Use Chord Height or Use Chord Height Ratio is turned on, a uniform tessellation is performed. Each span/surface is split into a number of polygons depending on the Number U and V values you set. U Type/V Type
The U Type and V Type pop-up menu items let you specify whether you want to split the surface based on where the spans are (then split each span), or based on the parameterization of the whole surface.
Per Surf U value = 3
Per Surf U value = 20
Number U/Number V
Each span or surface is split into the number of polygons you specify here. POLYGONAL MODELING 118
CONVERTING NURBS TO POLYGONAL GEOMETRY | 9 Using NURBS To Polygons options
Per Span U = 20
Per Span V = 20
Specifying the secondary tessellation controls If Use Chord Height or Use Chord Height Ratio is turned on, you can set a specific value for both the Chord Height and the Chord Height Ratio. A value greater than 0 results in fewer polygon vertices if the ratio on the curve is greater than the current value. For example, the default value, 0.1, means that the height must be larger than 1/10 of the chord length before additional edit points are created. Turn Edge Swap on to produce triangles with the opposite orientation for the final quadrilateral.
Count Set the Tessellation Method to Count to display the following slider. Count slider
Use the Count slider to determine how many polygons the surface can be tessellated into. See the following examples.
Count value = 525
Count value = 150
Control Points This tessellation method converts the NURBS model to polygons while matching the CVs of the original NURBS surface. There are no other options for this operation.
Standard Fit method.
Control Points method.
POLYGONAL MODELING 119
CONVERTING NURBS TO POLYGONAL GEOMETRY | 9 Using NURBS To Polygons options
Notes When you use the Control Points Tessellation Method:
POLYGONAL MODELING 120
•
The Type option you set is ignored and the resulting polygon is in Quads by default.
•
If you convert trimmed NURBS surfaces the surfaces convert as though they were not trimmed.
10
TRIANGULATING AND QUADRANGULATING POLYGONS This chapter provides information on how to triangulate, or break polygons down into triangles and quadrangulate, or merge triangles of a polygonal object into foursided faces.
TRIANGULATING POLYGONS Use Triangulate to break polygons down into triangles. This ensures that all your polygons are planar and without holes. Triangulation ensures proper rendering of non-planar faces.
Before Triangulating.
After Triangulating.
To triangulate faces: 1
Marquee-select the faces you want to triangulate, or press F11 and Shift-click to select individual faces.
2
Select Polygons > Triangulate.
POLYGONAL MODELING 121
TRIANGULATING AND QUADRANGULATING POLYGONS | 10 Quadrangulating polygons
QUADRANGULATING POLYGONS Use Quadrangulate to merge triangles of a polygonal object into four-sided faces. By default, when you convert NURBS geometry to polygonal geometry, the tessellation type is triangles. Although you can change this in the NURBS to Polygon options window before converting, there may be times when you have either forgotten to or have specified triangles for a specific reason, like texturing. This operation lets you change the topology of your model from triangles into quadrangles.
Before Quadrangulating.
After Quadrangulating.
Quadrangulating can also be a good way to clean up polygons or reduce the number of polygonal faces. To quadrangulate polygons: 1
Marquee-select the faces or sets of faces you want to quadrangulate, or press F11 and Shift-click to select individual faces.
2
Select Polygons > Quadrangulate.
Quadrangulate Face options Select Polygons > Quadrangulate ❐ to display the options window. Angle Threshold
Use the slider or type a value to set the limit beyond which two triangles are merged or not (where the limit is defined by the angle between the face normals of adjacent triangles). If Angle Threshold is 0, only co-planar triangles are merged. The maximum angle is 180 degrees. A value of 180 degrees means that all possible pairs of adjacent triangles are converted into four-sided faces.
Keep Face Group Border
Turn this option on to maintain the borders of face sets. If turned off, the borders of face sets can be modified. This option is on by default. Keep Hard Edges
Turn this option on to maintain hard edges. If turned off, hard edges can be deleted between two triangles. This option is on by default.
Keep Texture Border
Maya maintains the borders of texture maps when this option is turned on. If off, the borders of texture maps can be modified. This option is on by default.
POLYGONAL MODELING 122
TRIANGULATING AND QUADRANGULATING POLYGONS | 10 Quadrangulating polygons World Space Coords
If turned on (the default), the specified Angle Threshold value is the angle between the face normals of adjacent triangles in world space. When turned off, the Angle Threshold value is the angle between the face normals of adjacent triangles in local space.
POLYGONAL MODELING 123
TRIANGULATING AND QUADRANGULATING POLYGONS | 10 Quadrangulating polygons
POLYGONAL MODELING 124
11
EXTRUDING, DUPLICATING, AND EXTRACTING This chapter provides information on how to extrude faces and edges, and how to duplicate, and extract faces.
EXTRUDING FACES AND EDGES You can pull faces and edges out from polygonal objects using the Extrude Face and Extrude Edge commands. For details, see: •
"Extruding faces" on page 125
•
"Extruding edges" on page 127
Extruding faces You can extrude faces either interactively or directly through the options window. If you prefer to set the options first and then extrude the faces, select Edit Polygons > Extrude Face ❐, set whatever options you need, and click the Extrude Face button. To extrude faces: In the following examples, faces are extruded interactively using manipulators. 1
Select the faces of the object you want to extrude. Press the right mouse button and select Face from the marking menu or press F11.
•
If you want to extrude all the faces of an object, marquee-select the whole object to highlight the faces.
•
If you want to extrude certain areas of an object, Shift- or Ctrl-click to select those faces only.
•
If you want to extrude, duplicate, or extract multiple faces together, turn on Polygons > Tool Options > Keep Faces Together. You can change this option in the Attribute Editor or Channel Box after performing the extrude.
POLYGONAL MODELING 125
EXTRUDING, DUPLICATING, AND EXTRACTING | 11
Tips •
If you set Keep Faces Together on in the Polygons > Tool Options menu, the options window automatically updates to turn this option on for Extrude, Extract, and Duplicate Face.
•
You can change the way you select faces by setting Select Faces With to Center or Whole in the Selection Preferences window (Window > Settings/Preferences > Preferences, then click Selection).
•
Press Ctrl-Shift to add faces to your selection, Ctrl to remove faces from a selection, and Shift to switch between selections without affecting the rest of the object.
2
Select Edit Polygons > Extrude Face. A manipulator displays, which you can use to interactively extrude the faces. The manipulator handles correspond to the X, Y, and Z directions indicated at the bottom-left of the view. Like the standard transform manipulator, you can move, scale, and rotate with it. You can also change its pivot. Unlike the standard transform manipulator, you can also switch between global and local modes. For more information, see "Switching between local and global modes" on page 56.
3
Drag a manipulator handle to transform the extrusion of the face or faces you selected. The Faces Together option is turned off by default the first time you extrude. Turn this option on if you want to extrude all the faces together. See "Keeping faces together" on page 130 for more information. The following example shows all faces translated and extruded in the Z direction.
Manipulator. Drag to extrude in ZFaces Together off.
Drag to extrude in ZFaces Together on.
Tip If you lose the manipulator display, click the Show Manipulator icon in the Tool Box. The following example shows only one face selected, translated, and extruded in Z.
POLYGONAL MODELING 126
EXTRUDING, DUPLICATING, AND EXTRACTING | 11
If you are not satisfied with the results, press the z key or select Undo from the Edit menu, change the extrusion settings in the Channel Box or Attribute Editor and press Enter.
Extruding edges You can extrude edges either interactively or directly through the options window. If you prefer to set the options first and then extrude the edges, select Edit Polygons > Extrude Face ❐, set whatever options you need, and click the Extrude Edges button.
Note Extruding edges can make your geometry nonmanifold. For information on nonmanifold geometry, see "Valid and invalid polygonal geometry" on page 19. To correct nonmanifold geometry, perform a cleanup. For details, see "Cleaning up polygonal data" on page 40. To extrude edges: In the following examples, edges are extruded interactively using manipulators. 1
Select the edges of the object you want to extrude. Press the right mouse button and select Edge from the marking menu or press F10.
•
If you want to extrude all the edges of an object, marquee-select the whole object to highlight the edges.
•
If you want to extrude certain areas of an object, Shift- or Ctrl-click to select those edges only.
•
If you want to keep together the new faces created by the extrude, turn on Polygons > Tool Options > Keep Faces Together. You can change this option in the Attribute Editor or Channel Box after performing the extrude.
Tips
2
•
If you set Keep Faces Together on in the Tool Options menu, the options window automatically updates to turn this option on for Extrude, Extract, and Duplicate Face.
•
Ctrl-click to add edges to your selection, Shift-click to switch selected or not-selected without affecting the rest of the object.
Select Edit Polygons > Extrude Edge. A manipulator displays, which you can use to interactively extrude the edges. The manipulator handles correspond to the X, Y, and Z directions indicated at the bottom-left of the view. Like the standard transform POLYGONAL MODELING 127
EXTRUDING, DUPLICATING, AND EXTRACTING | 11
manipulator, you can move, scale, and rotate with it. You can also change its pivot. Unlike the standard transform manipulator, you can also switch between global and local modes. For more information, see "Switching between local and global modes" on page 56. 3
Drag a manipulator handle to transform the extrusion of the edges you selected. The Faces Together option is turned off by default the first time you extrude. Turn this option on if you want to extrude all the edges together. See "Keeping faces together" on page 130 for more information. The following example shows all faces translated and extruded in the Z direction.
Manipulator.
Drag to extrude in ZFaces Together off.
Drag to extrude in ZFaces Together on.
Tip If you lose the manipulator display, click the Show Manipulator icon in the Tool Box. The following example shows only one edge selected, translated, and extruded in Z.
If you are not satisfied with the results, press the z key or select Undo from the Edit menu, change the extrusion settings in the Channel Box or Attribute Editor and press Enter.
POLYGONAL MODELING 128
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Duplicating faces
DUPLICATING FACES You can duplicate and transform faces either interactively or directly through the options window. In the following examples, faces are duplicated by setting the options first in the options window and clicking the Duplicate button. To duplicate faces: 1
Select the faces of the object you want to duplicate. Press the right mouse button and select Face from the marking menu or press F11.
•
If you want to duplicate all the faces of an object, marquee-select the whole object to highlight the faces.
•
If you want to duplicate certain areas of an object, click to select those faces only.
2
Select Edit Polygons > Duplicate Face. The selected faces are duplicated and the duplicates transformed according to the options set in the options window. By default, Duplicate also separates the extracted faces. (Separate Extracted Faces is turned on in the options window.) You can also use the manipulator handles to interactively transform the duplicated faces. Like the standard transform manipulator, you can move, scale, and rotate with it. You can also change its pivot. Unlike the standard transform manipulator, you can also switch between global and local modes. For more information, see "Switching between local and global modes" on page 56. This example shows multiple faces duplicated in global mode with faces kept together (see "Keeping faces together" on page 130 for details). The global translate Y value in the options window is set to 5.0.
EXTRACTING FACES When you use Extract, Maya disconnects the selected faces from the original shape, by duplicating the appropriate edges and vertices. The extracted faces become their own shell within the object. This is another way to make holes in the object while retaining the original faces. By default, Extract also separates the extracted faces. (Separate Extracted Faces is turned on in the options window.) Separating the extracted faces creates distinct polygons out of the faces and the original object.
POLYGONAL MODELING 129
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Keeping faces together
To make it easier to see the border edges, open the Custom Polygon Display Options window and beside Highlight, turn Border Edges on (Display > Custom Polygon Display ❐). Increase the Border Width too if necessary. To extract faces: 1
Select the faces of the object you want to extract. Press the right mouse button and select Face from the marking menu or press F11, then Shift- or Ctrl-click to select the faces.
2
Select Edit Polygons > Extract. The selected faces are extracted and the extracted faces transformed according to the options set in the options window. You can also use the manipulator handles to interactively transform the extracted faces. Like the standard transform manipulator, you can move, scale, and rotate with it. You can also change its pivot. Unlike the standard transform manipulator, you can also switch between global and local modes. For more information, see "Switching between local and global modes" on page 56. This example shows four faces extracted in local mode with faces kept together (see "Keeping faces together" on page 130 for details). The Local Translate Z value is set to 1.0.
KEEPING FACES TOGETHER By default, faces and edges are extruded separately, and faces are duplicated and extracted separately. To keep faces or edges together before you perform these operations, turn Keep Faces Together on in the Polygons > Tool Options menu. If you do, the Keep Faces Together option is automatically turned on in the Attribute Editors and Channel Boxes for all three of these operations. If you do not set this option on and decide you want to keep the faces together after you performed the operation, turn Keep Faces Together on in the Attribute Editor, or type the word “on” in the Keep Faces Together box in the Channel Box.
POLYGONAL MODELING 130
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Keeping faces together To extrude, duplicate, or extract multiple faces together: 1
Select all the faces you want to extrude, duplicate, or extract.
2
Turn Keep Faces Together on.
3
Drag the manipulator handles or change the values in the Channel Box to extrude, duplicate, or extract the faces. The following examples show the difference between extruding faces and edges, duplicating faces, and extracting faces with Keep Faces Together set to on and off.
Keep Faces Together off.
Keep Faces Together on.
Extrude Face
Extrude Edge
POLYGONAL MODELING 131
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Keeping faces together
Keep Faces Together off.
Keep Faces Together on.
Duplicate Face
Extract Face
The Duplicate and Extract operations are similar. While Duplicate Face leaves selected faces unchanged and creates a copy of them, Extract breaks off the selected faces where they share vertices with the neighboring unselected faces, creating a hole in the model. If after completing an Extract, you decide you really wanted to Duplicate (you do not want a hole where the faces were extracted), type the word “on” in the Duplicate box in the Channel Box.
POLYGONAL MODELING 132
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Extrude, Duplicate Face, and Extract options
EXTRUDE, DUPLICATE FACE, AND EXTRACT OPTIONS Extrude Face and Extrude Edge share the same option settings. Extract and Duplicate Face also share the same option settings. There are some slight differences, which are noted in the following descriptions. Clicking the Extrude Faces or Extrude Edges buttons to continue extruding Keep clicking the Extrude Faces or Extrude Edges button to continue extruding the polygon using the values you set for one extrusion. See the following Offset example.
First extrusion.
Keep clicking Extrude button.
Clicking the Duplicate button to continue duplicating faces Keep clicking the Duplicate button to continue duplicating faces using the values you set for one duplication.
Separate Extracted Faces
This option is available only for Extract. Turn it on to separate faces automatically after they are extracted. This is the default. If this option is turned off, you’re in component selection mode with all the extracted faces selected. Separate Duplicate Faces
This option is available only for Duplicate Face. Turn it on to separate faces automatically after they are duplicated. This is the default. If this option is turned off, you’re in component selection mode with all the duplicated faces selected. Local Values Offset
Enter a value to offset the edges of the extruded, extracted, or duplicated faces. This option can be used to produce a bevel effect for extrusions, cut-outs around faces using Extract, and to uniformly scale duplicated faces.
Extrude offset of 0.2.
Extract offset of 0.2.
Duplicate offset of 0.04.
POLYGONAL MODELING 133
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Extrude, Duplicate Face, and Extract options Translate
This value moves the extrusion or duplicated face locally along the X, Y, or Z-axis. Positive or negative values indicate how far the extruded or duplicated faces are moved locally.
Tip: Extruding or duplicating along a face normal The path you extrude or duplicate along can be perpendicular, or at any other angle to the extruded or duplicated shape. To extrude or duplicate along a face normal, set the Z value for Local Values Translate to 1, and then click the Extrude or Duplicate button. Rotate
This value sets the angle at which you want to rotate the extruded or duplicated faces locally around the X, Y, or Z-axis.
Scale
This value scales the extrusion or duplicated faces locally along the X, Y, or Z-axis.
Direction
Enter a value to set the location of the X, Y, or Z-point in the local axis. Notice how the manipulator handles change accordingly when you change the Y direction value to 4.0.
Default values.
Direction changed to 4.0 in Y.
Global Values Translate
This value moves the extruded or duplicated faces along the X, Y, or Z-axis.
Rotate
This value sets the angle by which you want to rotate the extruded or duplicated faces around the X, Y, or Z-axis.
Scale
Enter a value to scale the extrusion or duplicated faces along the X, Y, or Z-axis. Other Values
Divisions
For Extrude Face and Extrude Edge only. Enter how many intermediate faces are generated.
Divisions value 1 Random
Enter a value to extrude faces or edges, or extract or duplicate faces randomly varying from a value of 0 to 1. In the following example, faces were extruded with random values of 0, 0.5, and 1.
POLYGONAL MODELING 134
Divisions value 4
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Extrude, Duplicate Face, and Extract options
Random value 0 World Space Coords
Random value 0.5
Random value 1
Turn on the World Space Coords to use the world coordinate system when you change values randomly. See Using Maya: Essentials for information about World Space Coordinates.
Attribute Editor for extrusions, duplications, and extractions To edit the attributes for extruded or duplicated polygons, select the polygonal surface you want to edit and select the appropriate node in the Attribute Editor. For extruded edges and faces, the node is called polyExtrudeFace and polyExtrudeEdge, respectively. For extracted and duplicated faces, the node is called polyChipOff. Extruded polygons and duplicated polygons share the same attributes except for two exceptions: •
An extra option, Duplicate (under the Random attribute in the editor) and at the bottom of the Channel Box for extracted or duplicated faces. See "Additional option—Duplicate" on page 135 for information.
•
The Keep Faces Together option is not available from the options window. See "Additional option—Keep Faces Together" on page 136 and "Keeping faces together" on page 130 for details. This Attribute Editor is for duplicated faces. The options in the Attribute Editor for extracted faces is identical, however the Duplicate option is not available for extracted faces. These Attributes can also be found in the options window and the Channel Box. See the descriptions for information ("Extrude, Duplicate Face, and Extract options" on page 133). Additional option—Duplicate Turn Duplicate on if you want to preserve the original face. Duplicate is turned on for duplicated faces and off for extracted faces. If Duplicate is turned off, the duplication occurs, but the original face is deleted, which is what Extract does — basically the Duplicate Face operation with Duplicate turned off works the same as Extract and vice versa.
POLYGONAL MODELING 135
EXTRUDING, DUPLICATING, AND EXTRACTING | 11 Extrude, Duplicate Face, and Extract options
Duplicate on.
Duplicate off.
Additional option—Keep Faces Together Turn Keep Faces Together on to keep faces together when extruding, extracting, or duplicating faces. This attribute is also accessible from the Channel Box, or you can set this option for all these operations from the Polygons > Tool Options menu. See "Keeping faces together" on page 130 for details. Changing the setting in the Channel Box or Attribute Editor modifies the behavior for the current operation. Changing the setting in the Tool Options menu only affects subsequent operations.
POLYGONAL MODELING 136
12
MAKING AND FILLING HOLES IN POLYGONS This chapter shows you how to make and fill holes in polygonal models.
MAKING HOLES IN POLYGONS You can use the Make Hole Tool to punch a hole in a selected face of a polygon using a second face to shape the hole. You can also create a face with a hole in it using the Create Polygon Tool or the Append Polygon Tool. Making a hole in a face does not increase the number of faces in your polygonal model or change the component indexing for its vertices, edges, or faces. This can be especially important when applying colors-per-vertex, or when importing foreign polygonal objects.
Tip By default, you select a face by clicking the small box in its center. There may be times when the face you want to use to cut a hole lies directly on the plane you want to cut a hole through. Trying to select both face centers might be difficult, and the Make Hole Tool does not work if you marqueeselect the faces. After creating a hole, the face center may be where the hole is, and also difficult to select. To select faces by clicking anywhere within the faces: 1
Select Window > Settings/Preferences > Preferences to open the Preferences window.
2
Under the Settings category, click Selection and in the Polygon Selection section select Whole Face.
For more information on customizing your UI (User Interface), see Using Maya: Essentials.
POLYGONAL MODELING 137
MAKING AND FILLING HOLES IN POLYGONS | 12
To make a hole using a second face and the Make Hole Tool: The following example shows how to punch a hole in a selected face of a cube using a separate face created by duplicating a face of the cube. It also demonstrates how the object you make the hole in can change its shape if you move and transform the face you make the hole with. You could also simply create a hole flat on the plane. 1
Select the cube, press F11 and click to select a face on the cube.
2
Select Edit Polygons > Duplicate Face ❐.
3
Turn off Separate Duplicated Faces and click Duplicate.
4
Scale and rotate the duplicated face and move it slightly off the plane. You can use the manipulator handles for the Duplicate Face tool or use the Maya scale, rotate, and move tools.
5
Select Edit Polygons > Make Hole Tool. Follow the prompts on the Command Line— first select the face you want to make a hole in, then select the face you want to make a hole with. Click this face first. (the face you want to make a hole in) Click this face second. (the face you want to make the hole with)
6
Press Enter to make the hole.
You can also simply duplicate and scale the face without rotating or translating it to make the hole flat to the plane.
POLYGONAL MODELING 138
MAKING AND FILLING HOLES IN POLYGONS | 12
Tips •
You may find it easier to select faces with holes when face selection is set to Whole Face in the Selection Preferences section of the Preferences window. If the face selection is set to Center and the hole is in the center of the face, you may not easily see the center dot to select it.
•
If you want to make a hole using a polygonal face that was not duplicated from the object you are making a hole in, you must combine the face with the object (select both objects and select Polygons > Combine) before using Make Hole.
To make a hole when creating a new polygon: 1
Select Polygons > Create Polygon Tool, or Polygons > Append to Polygon Tool.
2
Click to place the first point, second point, and the third point. Do not press Enter. If you do, you will complete the new polygon.
3
Press the Ctrl key and click to place the points inside the face to create the hole. The subsequent vertices are used to define the hole.
Note You can only place three points inside the face. If you want the hole to have more than three vertices, insert them afterwards by subdividing the edges of the hole. For details, see "Subdividing polygons" on page 152. 4
Once you have placed the points you need, press Enter to create the hole.
POLYGONAL MODELING 139
MAKING AND FILLING HOLES IN POLYGONS | 12
Tip You may find it easier to select faces with holes when face selection is set to Whole Face in the Selection Preferences section of the Preferences window. If the face selection is set to Center and the hole is in the center of the face, you may not easily see the center dot to select it.
Setting Make Hole Tool options You can control how the face stamp affects the shape of the polygonal object you are making a hole in, and how it punches the hole by selecting the Merge mode for the Make Hole Tool. The hole increases or decreases in size depending on the mode you select, but does not lose its shape. You can either change the Merge mode in the options window before you punch holes, or you can change the Merge mode from the Channel Box or the Attribute Editor after you have punched a hole.
Setting the Merge mode before using the Make Hole Tool To change the Merge mode before you use the tool, select Edit Polygons > Make Hole Tool ❐ to open the options window and select a Merge mode.
None
The stamp face projects directly onto the face plane you select. This is the default. First, Middle, and Last merge modes Using the First, Middle, and Last merge modes, the center of the stamp face is made to match with the center of the face the hole is made on.
First
The face selected second is transformed to make the centers match. The first selected face does not get transformed.
Middle
Both the first and the second faces are transformed to make their centers match.
Second
(Or last) The face selected first is transformed to make the centers match. The second selected face does not get transformed. Project Merge modes The Project Merge modes make the hole exactly where the stamp face resides. These modes do not center the hole but align the hole flat with the plane face. They also do not rotate the face to match the center as with the First, Middle, and Second (last) merge modes.
POLYGONAL MODELING 140
MAKING AND FILLING HOLES IN POLYGONS | 12
Project First
The second selected face is projected onto the first and the centers do not match. The face is not rotated, unlike the First merge mode where the face is rotated to match the center.
Project Middle
Both faces are projected onto a plane lying between them; their centers do not necessarily match.
Project Second
(or projLast) The first selected face is projected onto the second (last) selected face and the centers do not match. Merge mode examples The following examples show the difference between using the merge modes.
None
Middle
Project Middle
First
Second (Last)
Project First
Project Second (ProjLast)
Setting the Merge mode after using the Make Hole Tool You can change the Merge Mode in the Channel Box or Attribute Editor after you punch the hole.
POLYGONAL MODELING 141
MAKING AND FILLING HOLES IN POLYGONS | 12 Filling holes with faces
FILLING HOLES WITH FACES Use the Fill Hole to create a face that fills the hole around a selected border edge. This tool can be especially useful when importing foreign polygonal models that may have holes, or to correct and rebuild models that have been damaged when importing. To fill holes in polygons 1
Press F10 and select the border edge where you want to fill the hole.
Tip To highlight border edges, select Display > Polygon Components > Border Edges 2
Select Edit Polygons > Fill Hole. The hole is filled and the Channel Box includes a node called polyCloseBorder.
POLYGONAL MODELING 142
13
COMBINING, SEPARATING, AND COLLAPSING POLYGONS This chapter provides information on how to combine several selected pieces to form a single object, separate an object into distinct objects, and by using Collapse, delete edges or faces and the unwanted vertices connected to those edges to turn an edge into a point.
COMBINING POLYGONS Use Polygons > Combine to combine several selected objects to form a single object.
Before Combine.
After Combine.
When using Combine, avoid creating invalid objects. Invalid objects are those with inconsistent normals across their different parts. Any materials previously assigned to the original objects are maintained when you use Combine. Before combining objects with opposing normals, select the faces with the offending normals and use Edit Polygons > Normals > Reverse to reverse them so all normals are pointing the same way. If normals are not pointing the same way, you will have trouble when it comes time to map textures onto your models.
POLYGONAL MODELING 143
COMBINING, SEPARATING, AND COLLAPSING POLYGONS | 13 Separating polygons To combine polygons: 1
While in object selection mode (press F8), marquee-select the pieces you want to combine into a single object.
2
Select Polygons > Combine. All selected pieces become pieces in one new object. When you click on one of the pieces, the entire object is selected, but the pieces are still at their original coordinates. You can also verify the combine operation in the Hypergraph or Outliner (Window > Hypergraph or Outliner).
SEPARATING POLYGONS The Separate operation separates disjointed polygonal faces into separate objects. That means Separate only works on objects with more than one polygonal shell.
Separating polygonal shells A polygonal shell is a collection of faces that are connected in a single piece—for example, a primitive plane is a polygonal shell.
Since the plane has no border edges within the enclosed shape, you cannot separate it. If you try, you will get the following error message: Error: polySurface has only one piece. Ignored.
To separate a shell, extract or delete some of the faces to create separate border edges and then select Edit Polygons > Separate. To separate a shell: 1
Select the faces within the shell where you want to separate it.
2
You can either press the Backspace key to delete the faces if you do not need them, or select Edit Polygons > Extract. By default, Extract also separates the extracted faces. (Separate Extracted Faces is turned on in the Extract Options window.) If you used Extract, you need only proceed to step #3 if this option was turned off when you performed the Extract.
Note When you use Extract the Move Component manipulator displays, which you can use to relocate the extracted faces. It is not necessary to use any of the manipulator handles.
POLYGONAL MODELING 144
COMBINING, SEPARATING, AND COLLAPSING POLYGONS | 13 Separating polygons When you delete the faces and then select the object, even though they are separate shells, they are still part of a single polygonal object.
3
If you want to select each piece as an object independent of the other, use Edit Polygons > Separate.
Separating polygons with merged edges You cannot separate objects whose edges have been merged. For example, if you merge edges between two polygonal planes and try to separate them later on, you will get the error message: Error: polySurface has only one piece. Ignored.
To separate polygons with merged edges: 1
Select the faces where you merged the edges, and use Edit Polygons > Extract. By default, Extract also separates the extracted edges. (Separate Extracted Faces is turned on in the Extract Options window.) If you used Extract, you need only proceed to step #2 if this option was turned off when you performed the Extract.
2
Press the right mouse button while the cursor is off the object and Select All to select the entire object. Even though you extracted the faces, the object remains connected as one piece.
POLYGONAL MODELING 145
COMBINING, SEPARATING, AND COLLAPSING POLYGONS | 13 Separating polygons
3
Select Edit Polygons > Separate to separate the object. Now when you select the entire object, notice how it separates into two pieces where you extracted the faces at the merged edges.
Separating combined polygonal objects The following example shows how to separate a combined set of polygonal objects. You select two shells whose border edges are not connected.
Combined object.
After Separate.
To separate combined polygonal objects: 1
While in object selection mode (press F8), marquee-select the combined polygonal object you want to separate.
2
Select Edit Polygons > Separate. Maya separates the object into individual pieces. This means you can select one of those pieces and transform it or change it using polygonal modeling tools and operations without disturbing the other pieces. This can come in handy if you want to copy a piece of a model, such as the head in the example, and use it somewhere else. The separation is also verified in the Outliner or Hypergraph (Window > Outliner or Hypergraph).
POLYGONAL MODELING 146
COMBINING, SEPARATING, AND COLLAPSING POLYGONS | 13 Collapsing polygons
COLLAPSING POLYGONS Use Collapse to turn an edge or faces into a point and also to clean small edges.
Collapsing edges.
Collapsing faces.
Select vertices. Notice the point.
Note Collapsing edges or faces can make your geometry nonmanifold. To correct nonmanifold geometry, perform a cleanup. For details, see "Cleaning up polygonal data" on page 40. To collapse edges or faces: 1
Press F10 to enter component mode for edges, or F11 for faces.
2
Select the edges or faces of the polygonal object you want to collapse.
3
Select Edit Polygons > Collapse. The following example shows how you can quickly and easily create the roof of a tower using the Collapse operation.
POLYGONAL MODELING 147
COMBINING, SEPARATING, AND COLLAPSING POLYGONS | 13 Collapsing polygons
POLYGONAL MODELING 148
14
SPLITTING AND SUBDIVIDING POLYGONS This chapter provides information on how to create new vertices and edges by splitting polygons and how to subdivide edges and faces to create sub-edges and new faces.
SPLITTING POLYGONS Use the Split Polygon Tool to create new faces, vertices and edges. This lets you split existing faces into pieces. To split polygons and create new faces and vertices: Points must be placed on at least two edges in order to complete the operation. 1
Select Edit Polygons > Split Polygon Tool.
2
Click on the first edge you want to split.
If you want to move the first split point before you let go of the mouse, drag along the edge. 3
Click on another edge and press Enter or click to place a point inside the face, then place another point on an edge and press Enter.
POLYGONAL MODELING 149
SPLITTING AND SUBDIVIDING POLYGONS | 14
First click. Press Enter. Last click.
First click. Second Click.
4
Last click.
You can use this new face with polygonal operations, such as Extrude. See the following example.
Face created by splitting original face in two pieces.
Face created by splitting inside the original face.
Repositioning points •
To reposition the last created point you placed, hold down the middle mouse button. A small box displays around the point. Drag to re-position it.
•
Press the Insert key to re-position a previously created point. Drag the point to reposition it, then press the Insert key to return to the Split Polygon Tool.
POLYGONAL MODELING 150
SPLITTING AND SUBDIVIDING POLYGONS | 14
Tip To precisely place your points, you can take advantage of the Edge Snapping magnets option in the options window, or if the grid is displayed, click the Snap to Grids icon to turn grid snapping on before you place your points.
Split Tool options Because the faces are split based on the current settings in the options window, you may need to change the tool options before you perform the operation. Select Edit Polygons > Split Polygon Tool ❐ to open the options window. Subdivisions
Drag the slider to change the number of subdivisions you want for each edge of the new face. Vertices are placed along the edge to create the subdivisions. Important! Subdivisions are not created if you split the polygon by placing the second point inside the original face. Your second point must be placed on another edge to create subdivisions. Subdivisions set to 5.
Second point placed inside face. Edge Snapping Snapping Magnets Snapping tolerance
Second point placed on edge.
When on, the pointer snaps to a point along the edges of the face you are splitting. In order to position the pointer freely, turn off Edge Snapping. Specify how many snapping magnets are evenly placed along the edge. The default is one, and it is placed at the middle of the edge. Drag the slider to change the snapping tolerance you want to use for each new edge point you are going to create. The tolerance value can range from 0 to100%. A value of 0 indicates no tolerance. The tolerance controls how sensitive the Split Polygon Tool is to where you click. If you turn on Edge snapping, and click the edge where you want to split it, the pointer will snap to the nearest snapping magnet, endpoint, or midpoint that falls inside the tolerance range and is contiguous to the point on which you clicked.
POLYGONAL MODELING 151
SPLITTING AND SUBDIVIDING POLYGONS | 14 Splitting shared vertices
Tips •
When you want to split an edge at a specific location, you may find it useful to turn off Edge snapping.
•
When you want to split an edge midway between a pair of endpoints, set Snapping tolerance to 100 and place the first point near the middle of the edge. This splits the edge precisely in the middle of the segment with the two endpoints on each side.
SPLITTING SHARED VERTICES You can split a shared vertex into multiple vertices—one for each polygonal face that shares it. This removes connectivity at the vertex, so you can perform independent operations on the split edges. To split a vertex: 1
Select the vertices you want to split.
Note Any selected vertices that are not shared are ignored. 2
Select Edit Polygons > Split Vertex.
SUBDIVIDING POLYGONS Use Subdivide to subdivide an edge into one or more subedges. You can also subdivide a face into one or more faces, creating new faces.
Note You cannot subdivide faces with holes. Also, you cannot subdivide concave faces unless the center point (the average of all the vertices of the face) lies within the interior of the face.
Center point outside the interior. Cannot subdivide.
Center point inside the interior. Can subdivide.
To subdivide a concave face into convex parts, use Edit Polygons > Split Polygon Tool or Polygons > Triangulate. You can also use Triangualate to remove holes.
POLYGONAL MODELING 152
SPLITTING AND SUBDIVIDING POLYGONS | 14 Subdividing polygons To subdivide edges or faces: 1
Select an object whose edges or faces you want to subdivide.
2
Click to select or marquee-select the edges or faces of the polygonal object you want to subdivide. Press F10 to select edges, or press F11 to select faces.
3
Select Edit Polygons > Subdivide. Maya subdivides the edges or faces. Subdivided face
Subdivided edges
The current settings in the option window determine the way the edges or faces are subdivided. You can change the subdivision values and modes in the Channel Box or the Attribute Editor after you have performed the subdivision. To subdivide faces automatically after selection: You can use the Edit > Paint Selection Tool to select and subdivide faces right after you select them. 1
Select a polygon.
2
Select Edit > Paint Selection Tool ❐. The Tool Settings window opens.
3
On the Select tab, turn off Add to Current Selection.
4
Change the pick mask to Poly Faces.
5
Click the Misc tab.
6
In the After Stroke Cmd box, enter: polySubdivideFacet -dv 1 -m 0 -ch 1
7
Paint the faces you want to subdivide. Each painted face subdivides automatically into four faces when you release the mouse button. See Using Maya: Painting for details about the Paint Selection Tool. See also "Paintselecting components" on page 53 in this book for information on how to select components using the Paint Selection Tool.
Setting Subdivision options Select Edit Polygons > Subdivide ❐ to open the options window. The options window that displays depends on which component mode you are in—faces or edges.
Options for face subdivisions.
POLYGONAL MODELING 153
SPLITTING AND SUBDIVIDING POLYGONS | 14 Subdividing polygons What you select decides what gets subdivided. If edges are selected, Maya subdivides edges. If faces are selected, Maya subdivides faces, inserting extra vertices along the edges.
Options for edge subdivisions.
Subdivision Levels
For edges, enter the maximum number of vertices to be inserted in each edge. For faces, enter the number of times each selected face is recursively subdivided. The number of faces created is proportional to 3(x-1) for triangles, or 4(x-1) for quads, where x is the number of subdivision levels. The number of edges on the original face determines the proportion. Mode (for faces)
quads/triangles
Turn quads on to subdivide faces into quads or turn triangles on to subdivide faces into triangles. These options are only available for faces.
Note If you subdivide to triangles, any vertex normals that you set on the faces being subdivided are lost. If you subdivide to quads all normals that you set are preserved. Minimum length Worldspace
Sets the minimum length of each subedge created. This option is only available for edges. This option is only available for edges. When turned on, the specified Subdivision value is the distance between vertices in world space. When turned off, the Subdivisions value is the distance between vertices in local space.
POLYGONAL MODELING 154
15
SMOOTHING, BEVELING, AND SCULPTING POLYGONS This chapter provides information on how to modify the topology of polygonal objects by smoothing out vertices and their connected edges and how to expand each vertex and each edge into a new face by beveling polygons. It also provides information on how to sculpt polygonal models using the Sculpt Polygons Tool.
SMOOTHING POLYGONS There are three methods of smoothing polygons: •
Using Polygons > Smooth. Maya modifies the topology of the polygonal object by smoothing out vertices and their connected edges. See "Smoothing by modifying the topology" on page 155.
•
Using Polygons > Average Vertices. Maya averages the values of the vertices to produce a smoother surface without modifying the topology. This method of smoothing is useful for creating smooth geometry to produce good UVs. "Smoothing by averaging vertices" on page 158.
•
Using the Smooth operation of the Sculpt Polygons Tool to average the values of painted vertices to produce a smoother surface. Like Average Vertices, the Sculpt Polygons Tools does not modify the topology. For more information, see "Sculpting surfaces" on page 170.
Smoothing by modifying the topology Use Polygons > Smooth to smooth polygons by expanding each vertex and each edge into a new face. These faces are either positioned at an offset or scaled towards the original face center. To smooth polygonal faces by modifying the topology: 1
Press F11 or press the right mouse button and select Face from the marking menu.
2
Either marquee-select the entire object, or click to select just the faces you want to smooth.
3
Select Polygons > Smooth.
POLYGONAL MODELING 155
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15
If you select the entire object, the shape of the object changes depending on the Smooth options you set. If you select only some of the faces, only those faces change and the rest of the object maintains its shape.The following examples show the results based on the default option settings.
Select all faces then Smooth.
Select only a few faces then Smooth.
Note Smoothing works with convex and even star-shaped concave faces. However, it can give unwanted results with concave faces when the center point (the average of all the vertices of the face) does not lie within the interior of the face.
Center point outside the interior.
Center point inside the interior.
Polygon Smooth options Select Polygons > Smooth ❐ to open the options window. Set the options and then click the Smooth button to perform the operation. If you are not happy with the results, either press the z key to undo, or change the values in the Channel Box or Attribute Editor for the Smooth operation.
Tip You can repeatedly smooth selected polygonal faces if you keep clicking the Smooth or Apply button in the options window.
POLYGONAL MODELING 156
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15
Subdivision Levels
Use the slider or type a number in the Subdivision Levels box to increase or decrease the number of times Maya performs the smoothing operation. This also increases or decreases the object’s smoothness. The Divisions range is from 1 to 4. The higher the value, the smoother the object.
Select several faces. Continuity
Division set to 1.
Division set to 2.
The value you enter here determines the degree of smoothness.
Continuity set to 0.0.
Continuity set to 0.2.
Continuity set to 0.5.
Preserve Properties Geometry Border Edges
When turned on (the default), this option preserves the properties of the border edges of the geometry.
Before smooth.
Geometry Border Edges on. Geometry Border Edges off.
Selection Border Edges
When turned on (the default), this option preserves the properties of the edges bordering the selected and non-selected faces.
Before smooth.
Selection Border Edges on.
Selection Border Edges off.
POLYGONAL MODELING 157
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15
Keep Tesselation
Turn this option on so that when changes are made to the history nodes, the smooth node does not redo the tesselation, but just repositions the generated vertices.
Smoothing by averaging vertices Use Polygons > Average Vertices to smooth geometry by averaging the values of vertices without changing the topology of the object. This method of smoothing can be used with the Transfer command to easily produce good UVs for texturing. For information on using Average Vertices and Transfer to produce good UVs, see "Creating good UVs on complex models" on page 246.
Note Using the Smooth operation of the Sculpt Polygons tool you can paint vertices to produce the same result. For information on the Sculpt Polygons tool, see "Smoothing" on page 164. To average vertices (smooth them) without changing the topology: 1
Select the vertices you want to smooth.
2
Select Polygons > Average Vertices ❐.
3
Enter the required number of iterations then click Average or Apply. Smaller iteration values produce more subtle results. Because iterations are accumulative, the more iterations you enter, the more smoothing will take place each time you average.
4
Click Average or Apply repeatedly until the desired smoothness is achieved.
Emulating subdivision surface workflows This smoothing tip lets you emulate the workflow for subdividing surfaces. While true subdivision surfaces (available in Maya Unlimited) are preferred—you can have fewer points and different levels of hierarchy—the workflow described in the following example may satisfy your needs. To smooth and modify a polygon as a subdivided surface: 1
Create two polygonal primitive cubes on top of each other.
2
Open the Hypergraph (Window > Hypergraph) and select Options > Display > Shape Nodes to display the cubes’ shape nodes.
3
Select both shape nodes, then click the Up and Downstream Connections icon.
POLYGONAL MODELING 158
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15
Click this icon.
4
Select the arrow between pCubeShape2 and polyCube2 and press the Backspace key to break the connection.
5
Connect the Outmesh of pCubeShape1 to the inMesh of pCubeShape2 as follows:
•
Select pCubeShape1
•
In the Script Editor or on the Command Line, execute polyDuplicateAndConnect
6
In the Hypergraph, select pCubeShape3, then select Smooth from the Polygons menu. The following displays in the 3D view.
7
Because Smooth works on a per-face basis, in this case only six faces, you must modify the input components (the .inputComponents attribute of polySmoothFace1 in the following command) to include all faces that result in the topology changes while modeling. This is done by replacing the original number of faces selected for smoothing by a wild card (“f[*]”). For example, type this command at the Command Line or in the Script Editor:
setAttr polySmoothFace1.inputComponents -type "componentList" 1 "f[*]";
8
Select a face on pCubeShape1 (the unsmoothed cube shape) and Extrude it (Edit Polygons > Extrude Face). Notice how the inner shape is modified when you transform the face using a manipulator handle.
POLYGONAL MODELING 159
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Beveling polygons
Continue to extrude, duplicate, or use any of the Polygon tools and operations to modify the shape.
You can also increase the smoothness of the shape by changing the Division value in the Channel Box or Attribute Editor for the smoothed polygon.
BEVELING POLYGONS Use the Bevel operation to smooth out rough corners and edges.
POLYGONAL MODELING 160
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Beveling polygons Beveling expands each vertex and each edge into a new face. You can position these faces at an offset or scale them towards the original face center using the options in the options window.
Important note about beveling and textures Bevel your object before you assign a texture to it. You will lose the texture coordinates and face material assignments if you bevel a textured object.
Note Beveling works with convex and even star-shaped concave faces. However, it can give unwanted results with concave faces when the center point (the average of all the vertices of the face) does not lie within the interior of the face.
Center point outside the interior.
Center point inside the interior.
To bevel an entire polygonal object: 1
To bevel the entire polygonal object, marquee-select the object you want to bevel, then select Edit Polygons > Bevel. Maya bevels all the edges of the polygonal object based on the current settings in the options window. The following example uses the default settings.
To bevel specific edges of a polygonal object: 1
Press F10 or press the right mouse button and select Edge from the marking menu.
2
Click the edges you want to bevel, then select Edit Polygons > Bevel. Maya bevels only the selected edges based on the current settings in the options window. The following example uses the default settings.
Selected edges.
Result.
POLYGONAL MODELING 161
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Beveling polygons
Tip You can change the way edges are displayed by selecting Display > Custom Polygon Display ❐. In the window, set Edges to Standard, Soft/ Hard, or Only Hard. If necessary, adjust the options in the Channel Box or the Attribute Editor after you perform the operation.
Polygon Bevel options Choose Edit Polygons > Bevel ❐ to open the options window. Set the options and then click the Bevel or Apply button to perform the operation. If you are not happy with the results, either press the z key to undo, or change the values in the Channel Box or Attribute Editor for the Bevel operation. Offset
This value represents the distance between the edge and the center of the face. This is like the radius of the bevel. Use the slider or enter a value to change the offset value.
Offset is 0.1
Offset is 0.2
Offset is 0.3
Values range from 0.2 to 10.0, although smaller values produce better results if World Space is turned off. If World Space is turned on, the specified Offset value is the distance between edges in world space. When turned off, the Offset value is the distance between edges in local space. Roundness
By default, Maya automatically adjusts the rounding to bevel an object based upon the object's geometry. If you select Auto Fit, this option is dimmed. If Auto Fit is not selected, use the slider or enter a value to round the bevel edges.
Segments
The Segments value determines the number of segments created along the edges of the beveled polygon. Use the slider or enter a value to change the number of segments. The default is 1.
Bevel these edges.
Auto Fit
If you select Auto Fit, Maya automatically determines how the bevel fits the object. If selected, you cannot change the Roundness value.
POLYGONAL MODELING 162
Result when Segments value is 4.
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons If turned on, the specified Offset value is the distance between edges in world space. When turned off (the default), the Offset value is the distance between edges in local space.
World Space
SCULPTING POLYGONS This section describes how to use the Sculpt Polygons Tool to sculpt polygonal surfaces. It includes the following topics: •
"Sculpting overview" on page 163.
•
"Sculpting operations" on page 163.
•
"Setting Sculpt Polygons Tool options" on page 167.
•
"Sculpting surfaces" on page 170.
•
"Sculpting masked surfaces" on page 170.
•
"Importing attribute maps" on page 171.
•
"Flooding sculpted surfaces" on page 171.
•
"Sculpting tips and tricks" on page 171.
Sculpting overview In Maya, you can change the shape of polygonal surfaces by moving, rotating, or scaling vertices. Using the Sculpt Polygons Tool, you can produce the same results quickly with the stroke of a brush. Although you are still actually manipulating vertices, the Sculpt Polygons Tool removes that level of detail so you can work directly with the surface. You simply “paint” the surface with the Sculpt Polygons Tool.
Transforming vertices using the Move Tool in component mode.
Transforming vertices using the Sculpt Polygons Tool.
If you want to change the attributes for this tool while you work, you don’t have to leave the Tool Settings window open. Once you are in sculpting mode, you can double-click the icon in the title bar to re-open the Sculpt Polygons Tool settings window.
Sculpting operations You can perform four different operations—push, pull, smooth, and erase. These operations can be selected from the Sculpt Polygons Tool Setting window (Polygons > Sculpt Polygons Tool ❐).
Pushing and pulling Pushing a surface with the Sculpt Polygons Tool is like pushing a lump of clay with your thumb. When you push your thumb into the clay, it transforms the clay, creating an indent the shape and radius of your thumb. POLYGONAL MODELING 163
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons Similarly, when you “push” a polygonal surface in the direction of the surface normal, the surface transforms, creating an indent the shape and radius of the tool. Pulling a surface is like pushing a surface, but in the opposite direction.
Push
Pull
Just as you can push and pull clay in different directions to achieve different effects, you can push and pull surfaces in different directions. The Sculpt Polygons Tool translates vertices in the direction of the tool’s reference vector.
Smoothing You can smooth bumps in your surfaces by painting them with the Sculpt Polygons Tool.
Before smoothing.
After smoothing.
Erasing The Sculpt Polygons Erase operation is like using an eraser. You paint the areas you want to erase and the vertex displacements for those areas return to the displacements in the last updated, or “baked” erase surface. By default, you must manually update the surface. So if you never update the erase surface, the area you erase returns to the original surface (the surface before you started sculpting or the surface when you first opened the scene), no matter how many strokes you’ve applied. If you set the Sculpt Polygons Tool to update automatically after each stroke, the area you erase returns to the surface defined by the last stroke. For details, see "Erase surface" on page 166.
Constructing surfaces Although you should typically try to keep the number of subdivisions to a minimum when you model polygonal surfaces, Maya produces more detailed results the denser the subdivisions. The following two examples were produced using the same brush stroke on surfaces with different subdivision densities.
POLYGONAL MODELING 164
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons
Low subdivision density.
High subdivision density.
Construction history When you sculpt on surfaces with construction history, Maya’s performance can decrease because the construction history may need to be recomputed as you sculpt. Also, you could experience unpredictable results if you later change the history in ways that affect the vertex count. If the construction history is not required, you may want to delete the history before sculpting. The Sculpt Polygons Tool does not create construction history, even when construction history is turned on. To delete construction history for a surface: 1
Select the surface.
2
Select Edit > Delete by Type > History.
Backup surfaces The Sculpt Polygons Tool maintains two “backup” surfaces as you sculpt: •
reference surface
•
erase surface Reference surface Maya uses the reference surface as a basis for any sculpting you do. Initially, it is the surface you start sculpting on. It is only used when the Sculpt Polygons Tool is set to Push or Pull. You cannot displace the reference surface any further than the maximum displacement set for the Sculpt Polygons Tool.
Reference surface.
Sculpted reference surface.
If you want to displace your surface more than the maximum displacement, you can update, or “bake,” your surface and then sculpt on it. When you update the reference surface, the updated surface becomes the new reference surface. Maya gives you the option of updating the reference surface manually, or updating it automatically after every stroke (the default).
POLYGONAL MODELING 165
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons If you do not update your surface, no matter how many brush strokes you make, the displacement will never exceed the maximum displacement. In the following example, the displacement at the intersection point of two strokes does not exceed the maximum displacement set for the tool because the reference surface was never updated. First stroke.
Second stroke.
If you do update your surface, your stroke displacements are additive. In the following example, the reference surface was updated after the first stroke. First stroke.
Second stroke.
Erase surface The Sculpt Polygons Tool uses the erase surface as the basis for selectively undoing any sculpting you do. Like the reference surface, the erase surface is initially the surface you start sculpting on. When you perform an erase operation on your sculpted surface, the erased portions are restored to the erase surface.
Erase surface.
Sculpted surface.
Erased surface.
You can change the erase surface to be the current surface by updating it. When you update the erase surface, the updated surface becomes the new erase surface. You can update the erase surface manually (the default), or update it automatically after every stroke. When you save a scene, then open it, the erase surface is the last sculpted surface.
POLYGONAL MODELING 166
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons
Setting Sculpt Polygons Tool options Before you sculpt a surface, set the options for the Sculpt Polygons Tool. The settings determine the effect you will achieve when you sculpt with the tool. You can define the following tool settings: •
brush stamp profile
•
sculpt operation
•
auto smooth
•
sculpt variables
•
maximum displacement
•
surface updates You can save your tool settings by adding the tool to a shelf. For details, see Using Maya: Painting.
Using the Sculpt Polygons Tool settings window Select the Sculpt Polygons Tool and open the Tool Settings window (Polygons > Sculpt Polygons Tool ❐).
Tip You can define hotkey combinations to change most of the settings without opening the Tool Settings window. For details on setting hotkey combinations, see Using Maya: Painting. This book explains only tool settings that apply to surface sculpting. For details on the tool settings not explained in this book, see “Brush Tool settings (original architecture)” in Using Maya: Painting. Setting the brush stamp profile Radius (U)
If you are using a stylus, set the upper or maximum possible radius for the brush. No matter how hard you press the stylus, the brush radius will not exceed this radius. If you are not using a stylus, this setting defines the radius for the brush. If the brush stamp compensation mode is set to None, the radius is expressed as a percentage of the surface. Otherwise, the brush radius is measured in the working units set for Maya. For details on selecting the stamp compensation mode, see "Brush Tool Settings (original architecture)" in Using Maya: Painting. For details on setting units, see Using Maya: Essentials.
Radius (L)
If you are using a stylus, set the lowest or smallest possible radius for the brush when pressure is applied to the stylus. If you are not using a stylus, this setting is not used.
Opacity
Set the displacement of the stroke relative to the maximum possible displacement. For example, if you set the maximum displacement to 4 cm, and the opacity to 0.5, your brush stroke will have a displacement of 2 cm.
Shape
Click on the shape of the brush. This determines the shape of the area affected by the brush action.
POLYGONAL MODELING 167
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons
For brush shapes that are not uniformly round, you can change the profile alignment. For details, see Using Maya: Painting. Selecting the brush operation Select Push, Pull, Smooth, or Erase (see "Sculpting operations" on page 163). Notice that the brush stamp changes to reflect the operation.
Push
Pull
Smooth
Erase
To remove the letters and gradient marking from the brush stamp, open the Sculpt Surface Tool Settings window, click the Display tab and turn Draw Brush Feedback off.
Tip To change the brush operation from within the modeling view, press the u key on the keyboard and a menu of brush operations appears. Setting autosmoothing Auto Smooth
If you selected Push or Pull as the brush operation, turn Auto Smooth on to smooth the surface automatically after every brush stroke.
Strength
If you turned Auto Smooth on, type the smooth strength in the Strength box. This is the number of times the Sculpt Surface Tool smooths the surface for each push, pull, or smooth stroke. The higher the number, the more smoothing takes place for each brush stroke. Setting sculpt variables In the Sculpt Variables section, select the reference vector. The reference vector controls the direction the vertices move when you push or pull. The brush arrow represents the reference vector.
Normal
The vertices move in the direction of the surface normal.
First Normal
The vertices move in the direction established by the surface normal at the beginning of the stroke.
POLYGONAL MODELING 168
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons
View
The vertices move parallel to the camera view direction.
Tumble the view to see the effect. X Axis
The vertices move in the direction of the X axis only. They do not move along the Y or Z axis.
Y Axis
The vertices move in the direction of the Y axis only. They do not move along the X or Z axis.
Z Axis
The vertices move in the direction of the Z axis only. They do not move along the X or Y axis.
POLYGONAL MODELING 169
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons Setting the maximum displacement Max Displacement
Type the maximum possible depth or height of the brush stroke, or use the slider to select it. Setting surface options
Reference Srf: update on each stroke
To “bake” or update the surface automatically on each stroke, turn Reference Srf: update on each Stroke on. For a description of reference surfaces, see "Reference surface" on page 165. To update the reference surface manually, click Update. Erase Srf: update on each stroke
To update the erase surface automatically on each stroke, turn Erase Srf: update on each Stroke on. For a description of erase surfaces, see "Erase surface" on page 166. To update the erase surface manually, click Update.
Sculpting surfaces Sculpting surfaces in Artisan is as easy as painting. By applying brush strokes to your surface with the Sculpt Polygons Tool, you can transform vertices to achieve a sculpted effect. To sculpt a surface: 1
Select the polygon surface you want to sculpt.
2
Select the Sculpt Polygons Tool (Edit Polygons > Sculpt Polygons Tool) and define tool settings, if required.
3
Drag the brush across the surface.
Note You can update or “bake” the reference surface at any time by clicking the Update button in the Surface section of the Tool Settings window. You may find this useful when you do not have Reference Srf turned on. Similarly, you can update the erase surface. You may find this useful when you do not have Erase Srf turned on.
Tip You can create hotkeys to update the reference surface and update the erase surface without opening the Tool Settings window. For details see Using Maya: Painting.
Sculpting masked surfaces You can create a mask on your surface that is unaffected by any sculpting you do. When you apply brush strokes over the mask, the vertices on the masked area retain their position, regardless of the sculpting operation. For details, see “Restricting an area for painting” in Using Maya: Painting.
POLYGONAL MODELING 170
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons
Importing attribute maps When you import an attribute map to a surface using the Sculpt Polygons Tool, Maya applies the tool settings to the vertices, mapping the greyscale values to the Opacity value set for the tool. In the following example, the Sculpt Polygons Tool is set to Pull with a stroke displacement of 2.
U
V Mapped surface.
U V
Attribute map.
For details, see “Mapping attributes” in Using Maya: Painting.
Flooding sculpted surfaces Flooding a surface is like taking a huge brush and applying its settings to the entire surface. The result depends entirely on the brush settings defined when you perform the flood. When you flood a surface, Artisan displaces each vertex on the reference surface according to the operation, displacement, and reference vector set for the tool. Flooding with the operation set to Smooth is an effective way to smooth the entire surface. Flooding with the operation set to Erase is a quick way of erasing your sculpting and returning the surface to the reference surface. To flood a surface: 1
Select the surface.
2
Select the Sculpt Polygons Tool and open the Tool Settings window.
3
Define the settings you want to apply to the entire surface.
4
In the Stamp Profile section, click the Flood button.
Sculpting tips and tricks You may find the following tips and tricks useful while sculpting. Building sculpting gradually To retain control while sculpting, keep the Opacity and Max Displacement low and build up sculpting gradually.
POLYGONAL MODELING 171
SMOOTHING, BEVELING, AND SCULPTING POLYGONS | 15 Sculpting polygons Progressively smoothing a model To progressively smooth a model, use the Flood button with Smooth as the selected operation, and set the opacity low. Key framing changes made with the Sculpt Polygons Tool By key framing the changes you make with the Sculpt Polygons Tool, threedimensional morphing is easy. 1
Use the Paint Selection Tool to select the vertices that you want to keyframe and go to the first frame in the Time Slider.
2
Turn Auto Key on. Click the key icon at the bottom-right corner of the Maya main window. It displays in red when on.
3
In the Animation menu set, select Animate > Set Key.
4
In Object mode, select the surface.
5
From the Modeling menu set, select the Sculpt Polygons Tool (Polygons > Sculpt Polygons Tool).
6
Move to the required frame and sculpt. The new positions of the vertices are automatically keyframed. Click the play button to see the animation.
7
Repeat step #6 as required.
POLYGONAL MODELING 172
16
MERGING VERTICES AND EDGES By merging vertices and edges, you can fill small holes in your model, join two polygon shells that line up into a single shell, and eliminate duplicate but coincident vertices in your model (thereby reducing its complexity and eliminating interior border edges). This chapter provides information on how to merge vertices and edges on your polygonal models.
MERGING VERTICES You can merge vertices using the Merge Vertices operation. When you merge vertices, coincident edges and their associated UVs are also merged automatically (within the specified threshold). Merged vertices.
Merged vertices.
Coincident edges merged automatically.
Before you begin, there are a few things to remember: •
You must be in component mode to select vertices.
•
You must set the Distance value (the tolerance) before you perform the operation.
POLYGONAL MODELING 173
MERGING VERTICES AND EDGES | 16
Notes Merging vertices can make your geometry nonmanifold. It is important to be aware of the orientation of face normals and the existence of coincident edges when performing this operation, and to consider this possibility when cleaning up a model, or preparing for export. To correct nonmanifold geometry, perform a cleanup. For details, see "Cleaning up polygonal data" on page 40. Merging vertices also merges the corresponding UVs. You may need to remap the UVs after merging vertices. To merge vertices: 1
Press F9 and select the vertices you want to merge.
2
Open the Merge Vertices options window. Select Edit Polygons > Merge Vertices ❒.
3
Change the Distance value in the option window then click the Merge Vertex button. In this example, the Distance value was changed to 0.5, because the vertices were about that far apart.
After you merge the vertices, you can also change the Distance value in the Channel Box or the Attribute Editor.
Merge Vertices options Click the ❐ next to Merge Vertices in the Edit Polygons menu to open the options window.
POLYGONAL MODELING 174
MERGING VERTICES AND EDGES | 16 Merging edges
MERGING EDGES In Maya, you can select boundary edges of a model and merge them (or sew them) to create one common edge. Merging edges can reduce your polygon count. You merge the boundary edges of a model and then delete the interior edges which results in fewer faces. •
Edges can be merged only if they are part of the same polygon mesh.
•
Only boundary edges can be merged. There are two ways to merge edges: using the Merge Edge Tool or the Merge Multiple Edges operation.
Note Edges will not merge if the normals of adjacent faces point in opposite directions. Try either of the following before performing the merge: •
Select either of the adjacent faces and reverse the normals using the Reverse and Propagate mode. For details, see "Reversing polygonal normals" on page 70.
•
Merge the vertices, which will make the object nonmanifold. Perform a Cleanup on the object to remove the nonmanifold geometry and conform the normals. For details, see "Cleaning up polygonal data" on page 40.
Preparing for a merge edge operation To make it easier to distinguish between border edges and interior edges, open the Custom Polygon Display Options window (Display > Custom Polygon Display ❐) and beside Highlight, turn Border Edges on.
Turn on. Enter a value.
Now when you select the object, border edges display as thick lines. If you want, you can change the width of the border edge by using the slider or typing a value in the Border Width box.
Merging edges using the Merge Edge Tool Using the Merge Edge Tool, you select the tool, then select the border edges you want to merge. You can change the merge mode from the options window before you use the tool, or change the settings in the Attribute Editor or Channel box after you perform the operation. The Merge Edge Tool offers three separate merge modes—First, Middle, and Second. Middle is the default merge mode. That means the edges you select to merge are deleted and replaced with an edge that spans the area. The following procedure shows how to merge edges using the default settings. POLYGONAL MODELING 175
MERGING VERTICES AND EDGES | 16 Merging edges To merge edges using the Merge Edge Tool:
Merge these edges...
1
Select Edit Polygons > Merge Edge Tool.
2
At the prompt, click to select the first border edge you want to merge. The next pickable edge displays in purple.
3
At the next prompt, click to select the second edge you want to merge (the purple edge). Do not Shift-click and drag the mouse.
4
If your selections are correct, you can now press Enter to merge the edges, or the backspace key to select another edge.
POLYGONAL MODELING 176
...to produce this poly
MERGING VERTICES AND EDGES | 16 Merging edges
To reduce the poly count of your model: If you are satisfied with the resulting shape of your model after you merged the edges: 1
Select the interior edges you want to delete.
2
Press the Backspace key.
If your object is already texture-mapped and does not fit properly after you delete the edges, select all the faces of the model and use a projection tool from the Edit Polygons > Texture menu to place the texture to fit. See Chapter 19, “Mapping UVs for polygonal surfaces” for details.
Merge Edge Tool options Click the ❐ next to Merge Edge Tool in the Edit Polygons menu to open the options window. You can change these options before you use the tool if you know what you want, or you can change these options from the Channel Box or the Attribute Editor.
POLYGONAL MODELING 177
MERGING VERTICES AND EDGES | 16 Merging edges
Tip To switch between the Channel Box and the Attribute Editor, press Ctrl a. Using the Merge Modes These modes specify where the merged edge results. If First, the merged edge results on the first selected edge, if Middle, the merged edge results in the middle of the two selected edges, and if last (or Second), on the second or last edge selected. First
If you select First, the first edge you click becomes the new edge and the second edge you click is removed.
First edge selected.
First edge selected.
Second edge selected.
New edge.
Second edge selected. New edge.
Middle
If you select Middle, the default, the new edge is equidistant between the first and the second edge and the first and second edges you click are removed.
First edge selected.
First edge selected.
Second edge selected.
New edge.
Second edge selected. New edge.
Second/Last
If you select Second (or Last), the second or last edge you click becomes the new edge and the first edge you click is removed.
POLYGONAL MODELING 178
MERGING VERTICES AND EDGES | 16 Merging edges
First edge selected.
Second edge selected.
First edge selected.
New edge.
Second edge selected. New edge.
Merging border edges between two polygonal objects If you want to merge the border edges of two separate objects or shells, you must unite, or combine, the objects before you use merge edge operations. You then pick the boundary edges when you are ready to merge them. To combine polygonal objects to merge edges: 1
Marquee-select the objects whose edges you want to merge.
2
Select Polygons > Combine to combine both objects into a single object. (The INPUTS section of the Channel box now reads polyUnite and the Hypergraph and Outliner show the two objects as one.)
3
Select the Merge Edge Tool and click the border edges you want to merge, following the prompts. (Do not Shift-click to select the second edge.)
Click first edge...
4
...then click second edge.
Press Enter to merge the edges.
New edge.
POLYGONAL MODELING 179
MERGING VERTICES AND EDGES | 16 Merging edges 5
Continue to select edges if you want to close the shape.
...then press Enter to merge. Click first edge...
... click second edge.
Tip You don’t have to select the tool every time you want to merge the edges. Simply click the Merge Edge Tool icon in the mini bar (the last icon at the right end of the list of icons) to re-activate the operation, or press the y key instead of Enter to remain in the tool and complete the operation.
Merging multiple edges Merge Multiple Edges lets you select more than one edge for a combined set of polygonal meshes and merge them together. You can merge interior edges, border edges and nonmanifold border edges. To merge multiple polygon edges: If you are merging edges between two separate objects, remember to combine the objects first (Polygons > Combine). Because edges are components of a polygonal model, you must select the edges you want to merge while in component mode. 1
Press F10 and click to select the edges you want to merge.
2
Select Edit Polygons > Merge Multiple Edges. Once you perform the merge operation, the edges are merged and the Channel Box and Attribute Editor update.
Merge Multiple Edges options Click the ❒ next to Merge Multiple Edges in the Edit Polygons menu to display the options window.
POLYGONAL MODELING 180
MERGING VERTICES AND EDGES | 16 Merging edges Merge UVs Also
Merges the UVs shared by the edges. If turned off, the UVs are not merged and can be manipulated and edited independent of each other.
Tip If you have a model that is mapped with different textures on either side of where the edges merge, it is a good idea to turn this option off. Threshold
Any edges further apart than this distance will not be merged. Set this value carefully. If it’s too small, no edges will merge. If it’s too large, the operation may merge edges that you do not want attached.
World Space Coords
If turned on (the default), the specified Threshold value is the distance between edges in world space. When turned off, the Threshold value is the distance between edges in local space.
POLYGONAL MODELING 181
MERGING VERTICES AND EDGES | 16 Merging edges
POLYGONAL MODELING 182
17
COLORING POLYGONS This chapter shows you how to color polygons using various methods, and how to prelight your scene.
APPLYING COLORS AND PRELIGHTING The Apply Color, Paint Vertex Color Tool, and Prelight features let you color your polygons on a per-vertex level, as well as prelight and shade your scenes to get them ready for production. You use Apply Color and the Paint Vertex Color Tool to color code polygonal surfaces with non-shading related values (for example, you could color code blind data attributes). You can also use certain types of blending effects such as illumination blending, through operations such as prelighting. See "Prelighting for polygonal surfaces" on page 189 for details.
Displaying color feedback for color operations To display color feedback for a color operation, the following conditions must be met. These conditions are met automatically when you use Apply Color, perform a Prelight operation, or start painting vertex colors. However, if you want to view color-per-vertex on a model that you edited previously, independently of these three operations, you must ensure these conditions are met. •
You must be in a shaded mode (select any of the shaded modes, such as Smooth Shade All, from the Shading menu in the perspective view panel menu).
•
Color in Shaded Display must be turned on and a Color Material Channel must be selected in the Custom Polygon Display Options window. The Color Material Channel options override any existing material channels and replace them with the vertex colors you assign. For all options other than None, lighting affects the object’s shading. The Color Material Channel options are: None
None of the material properties of the shader(s) assigned to the object are used. In this case lighting is also disabled.
Ambient
The ambient material channel of the assigned shader(s) is overridden by the vertex color.
Ambient+Diffuse
The ambient and diffuse material channels of the assigned shader(s) are overridden by the vertex color.
Diffuse
The diffuse material channel of the assigned shader(s) is overridden by the vertex color. This is the default setting. POLYGONAL MODELING 183
COLORING POLYGONS | 17 Applying color Specular
The specular material channel of the assigned shader(s) is overridden by the vertex color.
Emission
The emission material channel of the assigned shader(s) is overridden by the vertex color.
Note These conditions are met automatically when you apply color, perform a Prelight operation, or start painting vertex colors, as long as Edit Polygons > Color > Convert Display is turned on. (This is the default.)
APPLYING COLOR There are three methods for applying color to vertices: •
By selecting the vertices and using the Apply Color operation. For details, see "Applying colors using generic selection methods" on page 184.
•
By painting color on the vertices using the Paint Vertex Color Tool. For details, see "Painting vertex color" on page 186.
•
By copying and pasting color on faces. For details, see "Copying and pasting color" on page 188. The following close-up example shows what happens when you pick multiple vertices and apply a color to them.
This next example shows what happens when you select a single vertex and apply a different color.
Single vertex selected.
Different color applied.
Applying colors using generic selection methods Follow these steps to use the Apply Color operation to apply color to polygons on a per-vertex basis using Maya’s generic selection methods. To apply color to vertices with Apply Color: 1
Select a shading mode, such as Smooth Shade All, from a panel’s Shading menu, or press the number 5 key.
2
Select a vertex or vertices or select the entire object if you want to apply color.
POLYGONAL MODELING 184
COLORING POLYGONS | 17 Applying color
Tip Use the Paint Selection Tool to quickly and easily paint-select vertices. For more information, see "Paint-selecting components" on page 53. 3
Select Edit Polygons > Colors > Apply Colors ❐ to open the Polygons Apply Color Options window.
4
Select an operation to determine how color is applied to the selected vertex or vertices.
5
Change the color values as necessary by clicking the Color swatch and selecting the color from the Color Chooser, or by grabbing the color as follows.
•
Click the eyedropper button beside Grab Color.
•
The cursor changes to the eyedropper icon.
•
Click on any color you want on your monitor. The color you pick is applied to the color swatch in the Polygon Apply Color Options window.
6
Click the Apply Color button
Polygon Apply Color options Operation section The selected option determines which operation is applied to the selected vertex or vertices. Replace
Replaces the selection’s color with the color you define in the Color Value section. This is the default.
Add
Adds the color you define in the Color Value section to the selection.
Subtract
Subtracts the color you define in the Color Value section from the selection.
Remove
Removes the color from the selection. Color Value section
Color
Click the swatch to display the Color Chooser. Use the slider to adjust the value of the swatch color.
Grab Color
Click the eyedropper button to enable the eyedropper, which lets you pick any color on your monitor to define the Color.
Selected Vertex Color
Click this button to change the Color to the color of the selection. Alpha
Sets the alpha channel of the Color, which defines the object’s transparency.
Resulting Color
Displays the actual color that is applied to the selection, taking into account both the Color and the Alpha settings.
POLYGONAL MODELING 185
COLORING POLYGONS | 17 Applying color Color Channel Values section Set Individual Color Channels
Turn this option on to make the Color Channel Values options available and the Color Value options unavailable. You can set the red, green, blue, and alpha (RGBA) values individually by turning on the Set Red, Set Green, Set Blue, and Set Alpha options, respectively, and changing the corresponding values.
Painting vertex color Use the Paint Vertex Color Tool to paint a specified color value and alpha onto polygon vertices. The Paint Vertex Color Tool interface is common to many paint tools in Maya, known collectively as Artisan tools. For general information on the tool settings, see Using Maya: Painting. To paint vertex color on a polygon: 1
Select the surface you want to paint color on.
2
Select Edit Polygons Colors > Paint Vertex Color Tool ❐ to open the Tool Settings window and set the brush radius and shape if necessary.
3
Make sure you are in Projective Paint mode (click the Misc tab in the Tool Settings window).
Note If you are painting on polygonal surfaces in projective paint mode, you cannot reflect paint. To reflect paint, you must be in UV texture paint mode and the UVs on the polygon must be evenly distributed, symmetrical, and not overlapping. For information on setting the paint mode, see Using Maya: Painting. The selected polygonal surface should display in black.
4
Click the color swatch to open the color chooser and select the color you want to use.
POLYGONAL MODELING 186
COLORING POLYGONS | 17 Applying color
5
Click the OK button to validate your choice, then click-drag the brush across the polygon, or to paint the entire surface, click the Flood button in the Tool Settings window.
Tip You can change the attributes for the brush and the color in the Tool Settings window on the fly as you paint and you don’t necessarily have to leave the Tool Settings window open. Once you are in color mode, simply click the icon in the title bar to re-open the Tool settings window.
Using hotkeys to pick and copy color values You can quickly pick color values from a vertex and paint them on another using hotkeys. 1
Select the polygonal surface with the color values you want to pick and select the Paint Vertex Color Tool.
POLYGONAL MODELING 187
COLORING POLYGONS | 17 Applying color 2
Hold down the Pick Color Mode hotkey (default, /), click on the color you want to pick, then release the hotkey.
3
Click-drag the brush across the surface you want to paint with that color.
Painting vertex color on masked vertices You can create a mask on your polygonal surface that is unaffected by any color painting you do. When you apply brush strokes over the mask, the vertices on the masked area retain their color, regardless of the color you paint them.
Masked polygon.
Masked polygon after Flood.
For details on masking surfaces, see Using Maya: Painting.
Mapping color values to vertices Using the Paint Vertex Color Tool you can map color values onto vertices relative to the U/V surface direction. For details on mapping, see “Mapping attributes” in Using Maya: Painting.
Copying and pasting color The Edit Polygons > Clipboard Actions submenu provides you with a fast and easy way to copy and paste colors from one object to another on a per-face basis. The copied color is placed on the clipboard. When you paste, the color on the clipboard is applied to the selected faces. The attributes you turn on or off in the options windows for Copy, Paste, and Clear Clipboard apply to all three operations. That means when you are ready to copy and paste the color, all you have to do is select the menu item. To copy and paste colors: 1
Make sure that both the object you are copying from and the object you are copying to are in smooth shaded mode and that you applied the Custom Polygon Display options to both objects with Color turned on and a Color Material Channel selected.
2
Select Edit Polygons > Colors > Copy ❐, select the Color attribute and click the Apply button (Color is turned off by default. You must turn this attribute on).
3
In the view, select a face that contains the color you want to copy onto another object.
POLYGONAL MODELING 188
COLORING POLYGONS | 17 Prelighting for polygonal surfaces
Selected face.
4
Select Edit Polygons > Clipboard Actions > Copy.
5
Select the faces you want to paste the attributes to.
6
Select Edit Polygons > Clipboard Actions > Paste.
Transferring vertex color Use Transfer to transfer vertex positions, UV sets, and/or vertex color between two models with identical topology. To transfer vertex color: 1
Select both the source object and the destination object, in that order.
2
Select Polygons > Transfer ❐.
3
Select Vertex Color then click Transfer.
PRELIGHTING FOR POLYGONAL SURFACES When you render, Maya takes the material properties of the surface, considers the effect of each light illuminating the surface, and computes a final color for each visible point on the surface. These calculations are complex, and depending on the size of your model and the number of lights in your scene, can take a great deal of time to compute.
POLYGONAL MODELING 189
COLORING POLYGONS | 17 Prelighting for polygonal surfaces When you prelight an object, you perform the rendering calculation in advance and only at each vertex of your object (rather than at every visible point on the surface). Maya stores the resulting colors at each vertex, so at run-time, the color at each vertex of the object displays as though it were illuminated without doing the illumination rendering calculation. You can use the Color in Shaded Display mode to display vertex colors and blend them across each polygon face rather than performing the normal illumination and shading calculations. See "Applying color" on page 184 for details about how to color polygons on a pervertex basis.
Prelight advantages This section describes some of the advantages to prelighting your polygonal models and scenes.
Simplifying the scene If you have a limited amount of resources such as memory storage or computational power, prelighting simplifies the scene to reduce resource limitations in a number of ways: •
Lights can be removed since the lighting and/or shading has been pre-computed and stored with the geometry.
•
Complicated shading networks can be replaced with simple ones since the shading network has been pre-evaluated and the resulting color has been stored with the geometry.
Overcoming platform limitations You may export to a platform that does not support certain shading effects. For example, some graphic APIs only support a limited number of lights, and many platforms have a limited amount of texture memory available. If these lights and textures are pre-evaluated and their effects baked onto the geometry, they can then be removed from the scene.
Exporting and view effects It can be impractical to export the shading network used for software rendering evaluation. Some platforms may be unable to fully achieve the effects available from Maya’s software rendering network. Prelighting provides you with a way to preevaluate shading effects. Basic examples include: •
evaluating a solid texture such as a marble texture
•
evaluating a procedural texture such as a ramp texture Although you can use Maya’s Rendering convert-solid-to-texture functionality, currently special shading effects and textured geometry types cannot be evaluated, including:
•
Textured lights cannot be exported or viewed in 3D views.
•
Polygonal surfaces with texture coordinates that overlap within a surface cannot be shown or exported.
POLYGONAL MODELING 190
COLORING POLYGONS | 17 Prelighting for polygonal surfaces In Maya, the term prelight means the evaluation of materials and lights that have been assigned to a polygonal object at the object’s vertex positions. This is the same as a software rendering evaluation when a pixel value has to be evaluated to render some part of an object. An actual software render is not performed, but the same shading network evaluation is performed.
Sample storage A sample can either be stored as color-per-vertex-per-face, or used to displace the position of a vertex. If stored as a color-per-vertex-per-face color, RGB color and alpha (transparency) is stored. For displacement, the X,Y,Z coordinates of the vertex position changes. Since a sample contains four channels (RGBA), the displacement uses the luminance value of the color. Since Maya supports color-per-vertex per-face, or un-shared colors, prelighting is computed on a per-vertex per-face basis. So for example, if a vertex is connected to N faces, then N shading evaluations are done, one for each vertex-face combination. This is important in order to be able to capture possible different sampling results due to one or more of the following. These possible differences can be called shading discontinuities: •
Different normal-per-vertex per-face: The normal is used to compute shading, so differing normals may give different sample results.
•
Different UV-per-vertex per-face: The texture coordinate is used to compute a texture value for shading, so differing UVs may give different sample results.
•
Hard versus soft edges: A hard edge uses a face normal, while a soft edge uses the vertex normal average.
•
Different shader per connected face: Different material properties on shaders give different sample results. The following shows connected polygons on a single surface—each polygon was mapped with a different shader. Vertex 1 is connected to face 0 and 1 and two samples are computed, one for each connected face, since their shaders differ. The same holds true for vertex 4. Vertex 0,2,3 and 5 are connected to one face so only 1 sample is computed for each.
For shared texture coordinates between faces, software rendering actually only samples a connection at the vertex position once for one of the faces, and then slightly offsets the sample from the initial position for each subsequent face. Since sampling is done on a per-pixel basis this is satisfactory. Per-vertex level sampling must perform a similar action to evaluate different un-shared sample values. In the following example, the selected vertex on the cube has one texture coordinate that is shared (as shown in the texture view on the right).
POLYGONAL MODELING 191
COLORING POLYGONS | 17 Prelighting for polygonal surfaces
For Maya to compute different colors for the three connected faces, different UV values have to be used for the top face to compute a “red” sample value. So, the UV has to be offset by the same amount as used for the software rendering to achieve the desired results. If, however, highly detailed textures are applied to a dense mesh of vertices, the computed sample may be slightly off.
Setting up a scene to Prelight For the best interactive visual display mode that matches software rendering, select None from the Color Material Channel menu in the Custom Polygon Display Options window. When you select None, the object only uses the computed vertex colors to shade the object in a perspective view. That is, the object will not be affected by hardware shading evaluations. For prelighting to work, the scene must have at least one light. However, there is no maximum to the number of lights that can be evaluated.
Prelighting a scene Prelighting can be an iterative process. You may need to repeat the following process to achieve the effect you want, tweaking the prelight options each time. To prelight a scene: 1
Select the objects or object components that you want to prelight.
2
Select Edit Polygons > Colors > Prelight ❐. The Polygon Prelight Options window opens.
3
Set the desired prelight options and click Prelight.
4
Repeat steps #1 to #3 for the other objects in your scene that you want to prelight. To view the scene with prelighting:
1
Hide the lights in the scene.
2
Select Display > Custom Polygon Display ❐.
3
Beside Color Material Channel, select Emission then click Apply. Maya displays an approximation of the texture and color per vertex information. To see the actual prelighting, you must output the scene to your display engine.
Polygon Prelight options The Prelight menu item can be found in the Edit Polygons > Colors menu. Click the ❐ to open the options window.
POLYGONAL MODELING 192
COLORING POLYGONS | 17 Prelighting for polygonal surfaces By default all options are turned off, and the Sample scale factor is set to 1.0. Sample selected faces only
You can select objects and or any type of polygonal component of an object. This includes vertices, edges, faces, and UV / map component types. By default Maya examines each component type to determine which vertices have been selected and the selected vertices are then sampled. If Sample selected faces only is turned on, Maya examines each component type to determine which complete faces have been selected. The selected faces are then sampled. For example, if a face has four vertices, and only three of them are selected: •
if Sample selected faces only is off, three vertices are used for sampling.
•
if Sample selected faces only is on, no sampling will be performed since the face is considered to be only partially selected.
Sample using face normals
This option uses the corresponding face normals for sampling regardless of whether Sample selected faces only is off, or whether the edge is hard or soft. Compute shadow maps
Turn this on if you want shadows to be computed. A software rendering Shadow Pass occurs, which outputs a set of depth shadow maps, and then uses these maps during a sample evaluation. It is equivalent to doing the following in Maya rendering: •
Set Shadow Pass on in Render Globals.
•
Select each light and turn Compute shadow maps on.
•
Select each light and turn Write maps on, then turn Reuse and Read maps off.
•
Perform a software render with the current active view camera.
•
Select each light and turn Write and Reuse maps off, then turn Read maps on.
•
Read in the shadow maps, and use them during sampling.
Override shadow map options on lights
This option is available only if Compute shadow maps is on. If Override shadow map options on lights is turned on, shadows will be computed for each light, even if Use Depth Map Shadows is turned off for the lights. Reuse computed shadow maps
To re-use computed shadow maps, turn Compute shadow maps on. Turn this option on to skip the Shadow Pass computation (Compute Shadow maps above). This lets you use statically created shadows, and/or computes shadows just once for future adjustments of the prelight operation or the software rendering. Ignore mapped channels on surface shaders
Turn this option on to turn on Ignore when Rendering for each channel of the surface shader.
POLYGONAL MODELING 193
COLORING POLYGONS | 17 Prelighting for polygonal surfaces Sample incoming illumination only
If this option is selected, only incoming illumination lighting is computed. This option is useful if you want to use this information for your own shading computations. It is also useful if you want to sample lighting effects, such as when a light’s color has been mapped (see "Combining prelighting effects" on page 197 for more details). Note that the lights in your scene must have a Decay Rate for this option to have an effect. Displace geometry
Using sampled shading values to displace geometry is not a prelighting effect, but is related to using sampling data to modify attributes on an object’s geometry. The positions of the vertices selected to sample are displaced along their normals by the sampled data value amount. The normal used for displacement is the vertex normal used for rendering. You can see this normal in a perspective view by turning on the Vertices Normals option in the Custom Polygon Display Options window (Display > Custom Polygon Display ❐).
Notes
Store shared values Sample scale factor
•
Sample using face normals is disabled when this option is turned on. That is because performing a displacement for each face of a vertex cannot be done, which would be attempted if Sample using face normals was available.
•
Rendering > Lighting/Shading > Displacement to Polygon achieves much the same effect (although it can only be applied to the entire object).
If there are multiple vertices are selected, turn this option on to average the values at the vertices and store the average value. The scale factor is useful if you want to brighten or darken colors before storage, or to adjust the amount of displacement to be performed. It is possible to scale the sample before applying it to the geometry (meaning, you can store color or displace a point). For colors, a negative scale factor is ignored. For geometric displacement, the scale factor is taken into consideration regardless of whether it is positive or negative.
Note A value between 0.0 and 1.0 is usually applied to each channel of a sample, though values greater than 1.0 can be used. Clamp minimum RGBA value Clamp maximum RGBA value
Turn on these options to clamp the minimum and maximum RGBA values so that the values are forced to be within the range you set.
POLYGONAL MODELING 194
COLORING POLYGONS | 17 Prelighting for polygonal surfaces
Saving your prelighting to texture maps After prelighting your scene you may want to save the prelighting as texture maps and then apply the texture maps to the surface shaders. To save prelighting to a texture map: 1
Select the object with the prelighting.
2
Select Edit Polygons > Colors > Paint Vertex Color Tool ❐. The Tool Settings window opens.
3
Click the Map tab.
4
In the Export Attribute Map section, select a location and type a name for the texture file in the Map Name box. Set the other options as appropriate. For details, see the “Using Artisan Paint Tools” chapter of Using Maya: Essentials.
5
Click Resave.
Prelighting examples All examples shown have hardware material display disabled for the modeling view. This next example shows a torus which has been assigned to a Phong shader and mapped with a sky environment texture map.
Using shadows for the sampling process Two spotlight shadow maps were used for evaluation in this example. A ramp texture is mapped to the plane and one of the sphere’s associated shaders, while the second sphere is mapped with a checker texture.
POLYGONAL MODELING 195
COLORING POLYGONS | 17 Prelighting for polygonal surfaces
Software rendering versus prelighting This next example shows the same scene rendered using software rendering. Since the same shading evaluation is used in Prelight, the results are similar. There are differences because Prelight is sampling at a per-vertex level while software rendering is performed at a per-pixel level, but all relevant visual cues are there for prelighting.
Prelighting lights This example shows the result of sampling only the incoming illumination. The plane geometry has no texture applied to it at all. The texture mapping has instead been applied to the two spotlights in the scene.
Note This effect cannot be pre-visualized or exported in hardware or software rendering without first prelighting.
Using Displace Geometry A mountain texture has been assigned to the shader associated with the plane geometry. Higher luminance values result in greater displacement of the original plane, as seen in the white sections of the resulting geometry.
POLYGONAL MODELING 196
COLORING POLYGONS | 17 Animation for vertex colors
Combining prelighting effects This example shows how a number of separate prelights can be used to combine a number of effects onto a scene. A spotlight’s color channel has been mapped with a red and white checker texture. The polygonal plane has sampled twice with Sample incoming illumination turned on: once for color and once for displacement information. The torus and the plane both have a ramp texture assigned to them, but Sample incoming illumination has not been selected for the torus. Shadows were computed for the first sampling of the plane (using the Compute shadows option), and then Reuse computed shadow maps was turned on for each subsequent prelight operation.
ANIMATION FOR VERTEX COLORS You can animate colors that are assigned per vertex. For example, you can create an animation of blood color dripping down a wall or of a crystal changing from dull to glowing green. The colors per vertex feature appears only in the scene view with Shading > Smooth Shade All on. To animate vertex colors: 1
Before beginning, make sure the object has some construction history. If it does not have construction history, the colors per vertex feature will fail to set a key. You can quickly create history on a model by choosing Edit Polygons > Move Component, but moving nothing.
POLYGONAL MODELING 197
COLORING POLYGONS | 17 Animation for vertex colors 2
On a given frame, assign colors to selected vertices. The color assignment operations are under the Edit Polygons > Colors menu, such as Apply Color and the Paint Vertex Color Tool.
3
Choose Edit Polygons > Color > Set Vertex Color Key. (You cannot use any other keyframing method.) If you receive the warning “Active objects have no keyable attributes,” you must first apply a color. You cannot set a keyframe if there is no color assigned. If you receive the warning “Current manipulator and active objects have no keyable attributes,” you must add construction history to the object; see step 1.
4
Repeat steps 2 and 3 for additional frames. To delete vertex color animation: In the Channel Box or Hypergraph, select the polyColorPerVertex node and delete it.
Warning If you choose Delete by type > History on a model with vertex color animation, Maya also deletes the color per vertex animation.
Effect on performance When you animate vertex colors, Maya creates animation curves for each vertex per face. For this reason, playback performance slows down significantly if you animate too many vertices. Try to limit the number of vertices you animate. Another alternative is to delete the static animation curves.
POLYGONAL MODELING 198
18
WORKING WITH BLIND DATA You can use Maya’s Blind Data Editor to define the blind data types you need, and then apply the blind data to objects or components in your scene. The blind data editor also allows you to query your scene for blind data of a specific type or set of values and use false coloring to visualize what blind data is assigned to each objects.
Note You can also use blindDataType, polyQueryBlindData, and polyBlindData MEL commands to work with blind data. For details, see the MEL Command Reference (online only).
DEFINING BLIND DATA TYPES You must define blind data types (or templates) before you can apply blind data to your polygonal components (vertices, edges, and faces) or objects. (You can also apply blind data to NURBS patches using “face”, but you cannot false color it.) Types of data include: •
int
•
float/double
•
boolean
•
string
•
binary The template needs to have a unique Type id and both long and short Attribute name for setting and retrieving the data. Multiple attributes can be defined within the same template. You can do this in the Type Editor tab of the blind data editor. To define new blind data types:
1
Select Window > General Editors > Blind Data Editor. The Blind Data Editor opens.
2
Click the Type Editor tab, and define the data type in the fields.
3
Click Save to create the data type and save it.
POLYGONAL MODELING 199
WORKING WITH BLIND DATA | 18
You can create new blind data type templates by choosing New in the Type Editor tab.
Type Editor tab options Id
Must be a unique integer which specifies which blind data type you’re working with.
Note Subdivision surfaces (available in Maya Unlimited) use blind data to store hierarchical edit information when converting from a subdivision surface to a poly proxy object. The Id numbers between 65119000–65119999 are reserved for this purpose. Do not assign them to your blind data types. Name Association type
A word or string (with no spaces) that will help you remember what the blind data types are. It must be unique. Describes what the blind data is attached to. Valid choices from this editor are Face, Vertex, Object, or Any. If you select Any you have to choose what you want to apply the data to when you are applying it. If you select Face, Vertex, or Object, the data is assigned only to that type of component or object (and selected objects/components are converted to this type). If the component type you are going to be applying this data to is always going to be the same, it’s a good idea to select it here so that Maya will know how to treat your selection when applying, coloring, or querying components.
Free Set
Turn this option on if you want to be able to set the value manually (according to the appropriate data type). Turn it off to use only the values that have been explicitly defined as Presets (see "Presets" on page 201).
New Attr
When you first enter a new type, only one attribute is presented to you. To create a blind data type that has more than one attribute (for example, two ints), click New Attr.
Long Name
Type the long name for the attribute you are defining, such as “message.” It can contain, but not start with, numeric characters.
Note The names vertexBlindData, faceBlindData, edgeBlindData, fbd, vbd, and ebd are reserved for the parent attribute of the corresponding types and cannot be used for attribute names for those components. Short Name
Type the short name for the attribute you’re defining, such as “msg” for message. This name must be 3 characters or less and can contain, but not start with, numeric characters. For object blind data, choose unique long and short names for the blind data type, making sure they are different from any attribute name on the object to which you are going to apply the blind data. For component blind data, the names must be unique within the DG node. To see all the long names of attributes on a shape, type:
POLYGONAL MODELING 200
WORKING WITH BLIND DATA | 18
listAttr pPlaneShape1;
To see all the short names of attributes on a shape, type: listAttr -sn pPlaneShape1
Select which type of data the attribute is. Valid choices are:
Data Type
double
A floating point decimal number. This choice is equivalent to a float type.
int
An integer.
hex
This is a special case of integer in which hex values are used to represent the data. Using this type, you can pack a large number of binary values into one integer.
boolean
True or false (1 or 0) only.
string
An ascii string of text.
binary
An arbitrary stream of data, stored as text.
This option is available only if you have a numeric data type selected (double, int, or hex) and if Free Set is turned on. Turn on Ranged to restrict the data to an upper and lower range. When you turn it on, the Min and Max boxes appear for you to specify the upper and lower range.
Ranged
Presets You use Presets to set up values you can quickly select by name instead of having to know which values to use. They provide a means for enumerating integral or (in the case of the hex type) flag values, that let you quickly set frequently-used data and, if Free Set is turned off, restricting what values you can apply to data. Click this button to create a new preset; when you do, several input boxes appear. There is one box for the Name of the preset and one box for each attribute in this blind data type. Click Delete to remove presets you do not want.
New Preset
Once you have entered all of the data, click the Save button to save this blind data type to the scene so that you can apply data using it as a template.
Editing blind data types You can edit blind data types. To edit a blind data type: 1
Select the blind data type you want from the list of data types in the Type Editor tab. You can edit the Name, Association type, and Free Set values. You can also edit and add new Presets.
2
Click Save to save the changes.
Note You can use blind data templates created outside of the Type Editor within the Blind Data Editor. If you do, however, it is a good idea to edit that type within the Type Editor (select its Id from the list of data types) so that the Apply and Color/Query sections of the Blind Data Editor know how to handle the data.
POLYGONAL MODELING 201
WORKING WITH BLIND DATA | 18 Applying blind data
Exporting blind data types You can export blind data types. This is useful if you are going to use the same blind data in multiple scenes. To export blind data types: Click Export to export all of the blind data types to a file.
Viewing template data You can save the blind data template information in your scene to a text file and then print it for the level designer or programmer to review. Programmers can parse this text file and use it directly in the game engine if they want. To save blind data template information: After you create and save all your blind data templates, click Text Dump and save the file.
APPLYING BLIND DATA After you define and edit blind data types, you can apply them to objects or polygonal components. To apply blind data types: 1
In the Blind Data Editor, click the Apply tab.
2
Select the blind data type you want to apply from the list.
3
Select or enter the value you want to apply to the selected objects or components. If there are presets defined for the selected blind data type, you can select the value with the radio buttons.
Apply tab options Assoc Type
If the selected blind data type already has a particular association type assigned to it, then this option is available and the data will only be applied to that component type (or, if the type is object, to the whole object). Otherwise, if the type was Any, this option is not available and you should select the association type you want to apply your data to. The default is face. Selected components are converted to the Assoc Type before the data is applied.
Apply Type
If the data types of the selected blind data type are not all either int or double, this menu is unavailable. Possible values are Absolute, Offset, and Scale. Absolute
The value is applied to the data. If selected components or objects already have blind data of this type, the values are overwritten.
Offset
The values are added to the data that is assigned to the selected components or objects. If no data exists on a selected component or object, no data is applied. If the attribute being affected is Ranged, the values are clamped at the minimum and maximum values.
POLYGONAL MODELING 202
WORKING WITH BLIND DATA | 18 Coloring or querying blind data Scale
The existing data associated with the selected components or objects is multiplied by this value. If no data exists, none is applied. If the attribute is Ranged, the values will also be clamped.
Selects the Artisan Paint Selection Tool and opens the Tool Settings window. This tool only works if you have a blind data type selected and if the association type is face or vertex. The component pick mask is switched to the association type selected for this blind data type, and the data is applied on every mouse release.
Paint values
Color data on apply
When turned on, the selected components are false colored after the apply is done according to how you have color set up in the Query/Color tab.
COLORING OR QUERYING BLIND DATA You can also false color or query based on a particular value or range of values. To color or query blind data: 1
Right-click in the Tab/Id field and select the blind data.
2
Turn on the check box to the right of the Tag/Id to enable the values for the row. The Select value section displays below the row, providing you with several different options for the color or query action.
3
In the Value box, type values for the attribute(s) for this type.
4
In the Select value section, select which type of value you want to color or query for a particular type.
Color/Query tab options Use this tab to false color and query polygonal objects and components based on criteria you set up. There are several levels through which you can look at the data. The first is a high level view of what components or objects have the specified blind data assigned to them, regardless of value.
Note The colors show the sequence of queries that were performed, and do not get updated by subsequent changes to blind data. If the object’s topology changes, colors may no longer be accurate. Tag/Id
To complete the Tag/Id fields, right-click in the field to bring up a popup of the available types, or type in the fields.
Set Color
In the following illustration, Set Color goes through the selection list and colors components that have floorType blind data red, wallType blind data green, and ceilingType blind data blue. If any components have two or more of the specified types assigned, the components (or objects) are colored with the Clash Color, in this case, light blue. Components that have none of the specified types are colored with the None color, which is black in this case.
POLYGONAL MODELING 203
WORKING WITH BLIND DATA | 18 Coloring or querying blind data
Tip To see the colors in the illustrations in this section, view the online help.
Query
Click Query to select the components (or objects) which would be colored if you had chosen Set Color. Note that if any of the row conditions are satisfied, the component or object is selected.
Note To use a row in the Color/Query operation, turn on the check box to the left of the Tag/Id field. Disabling a row is useful if you do not want to use a particular type or value but may want it later. Remove Color
Click Remove Color to remove color from the components that have the listed blind data types. Select value options When you enable the values for a row, this section displays below the row, providing you with the following options for the color or query action.
discrete value
Select this option to color or query one value for a particular type.
discrete range
Select this option to color or query a range of values for a particular type. In the following illustration, components with the blind data type floorType with a value of 0 (corresponding to preset: normal) are colored red. Components with blind data type damage and values between 75 and 100 are colored green. Components with both floorType and damage blind data are colored with the Clash color.
POLYGONAL MODELING 204
WORKING WITH BLIND DATA | 18 Coloring or querying blind data
Continuous
Integer or double data can also be colored with grayscale values. Select continuous from the drop down menu, and select min and max values and colors to use in coloring the data. In the following illustration, the blind data type floorRoughness is displayed. Components which have a value of 0 are colored black, those with values of 1 are colored white, and those in between will have the appropriate grayscale. Values less than 0 or greater than 1 are colored yellow, the Out of Range color. The None color is blue to differentiate between components with 0 floorRoughness and components that have no floorRoughness assigned at all.
POLYGONAL MODELING 205
WORKING WITH BLIND DATA | 18 Coloring or querying blind data
When using the continuous type, query works as if discrete range were selected; any components that have blind data with values between the min value and the max values are added to the selection list. Hex
You can also color and query with the hex type if the blind data type selected consists of hex data.
POLYGONAL MODELING 206
WORKING WITH BLIND DATA | 18 Viewing blind data values When the selected Compare Type is Set, components with the selected value(s) set are colored or selected. If it is Not Set, only components with the value not set are colored or selected. If set to Equal, only values which equal the selected value are colored or selected.
Some notes on coloring and querying blind data Although you can examine multiple types of blind data at one time, you are only allowed one type of Color/Query action. The possible types are: •
Binary: either the data is assigned or not
•
Discrete: either a discrete value or discrete range
•
Continuous: use grayscale values for coloring
•
Hex: use bit operations on the values If you have rows with different types, the operation will fail. Association type and selection type are also important in this regard: If all the rows have blind data types that are specifically tied to a particular association, your selection is converted to this selection type. If, however, any of the rows have Any as the Association Type, or if the rows do not match (one row’s blind data has Face Association Type and another’s Association Type is Vertex), the selection will not be converted and the components and objects selected are queried or colored in their present state.
VIEWING BLIND DATA VALUES You can look at the values of assigned blind data in the View tab of the Blind Data Editor. The View tab shows the data assigned to the lead component or object for all blind data types defined in your scene. The Name of the lead component or object displays at the top of the tab, followed by columns indicating the blind data Id, the name of the attribute, and the value. If there is no data assigned to the component for a particular type the value column is blank for that row.
POLYGONAL MODELING 207
WORKING WITH BLIND DATA | 18 Viewing blind data values
POLYGONAL MODELING 208
19
MAPPING UVS FOR POLYGONAL SURFACES
Before you create shading for your polygonal surface, you must set up UVs on your model. This chapter and the next chapter describe how to do this.
ABOUT UVS AND MAPPING UVs are points that correspond to polygon vertices and provide the information needed to apply textures to the object. Polygons require specific arrangement of the UVs so that textures look correct when applied to the surface material. Although Maya creates UVs by default, in many cases, you’ll need to rearrange UVs because the default arrangement will not match the modeling changes you make. Typically, you arrange UVs after you have completed your modeling and before you assign textures to the model. UVs are arranged in a 2D coordinate system called texture space. You can see the texture space coordinates in Maya’s UV Texture Editor (formerly called Texture View). For example, the following illustration shows the default UV arrangement for the model of a fish. When a texture is assigned using this default UV arrangement, the result is haphazard.
Fish model
Default UVs for fish model
Default texture appearance
In this example, you can use Maya operations to rearrange the UVs into a pattern that more closely resembles the fish model. The new arrangement applies the texture more evenly around the model. See the following illustration.
POLYGONAL MODELING 209
MAPPING UVS FOR POLYGONAL SURFACES | 19
UVs rearranged for model
New texture appearance
About UV mapping To begin rearranging UVs, you first need to assign them to the surface, known as mapping UVs. You’ll learn how to map UVs in this chapter. Polygonals have their own mapping and editing operations, separate from the subdivision surface operations. There are numerous mapping operations available, under the Edit Polygons > Texture menu. These operations are also available from the UV Texture Editor, under the Polygons menu. To create a UV mapping arrangement that works best for your model, you may need to map several times, using various mapping operations, until you find a mapping arrangement that is suitable. See the following guidelines.
Guidelines for UV arrangement Knowing how to arrange UVs is somewhat of an art form. The best arrangement depends on the types of textures you will apply and also on whether you are creating rendered images or models for interactive games. A full description of UV arrangement is out of the scope of this guide. At a minimum, though, you should consider these guidelines: Keep UVs within the 0 to 1 texture coordinates The UV Texture Editor displays a grid marking the coordinates for UVs. You should keep UVs within the 0 to 1 coordinates because Maya automatically fits textures into these coordinates. If UVs extend beyond the 0 to 1 range, the texture will appear to repeat around the corresponding vertices. The exception is when you want the texture to repeat on the surface, such as a brick texture along the model of a wall. By default, the UV mapping operations automatically fit UVs within the 0 to 1 coordinates. Avoid overlapping UV mesh pieces As the prior illustration of the fish model shows, UV points have interconnecting lines that form a mesh. If meshes overlap in the UV Texture Editor, the texture will appear to repeat on the corresponding vertices. In general, you should avoid overlapping UVs, unless you want the the texture to repeat. For example, if you want the arms of a character to share the same texture pattern, you can place the UV mesh corresponding to one arm on top of the mesh corresponding to the other arm, using the Move tool.
POLYGONAL MODELING 210
MAPPING UVS FOR POLYGONAL SURFACES | 19 Creating UVs based on the camera view The Planar Mapping operation often results in overlapping UV mesh pieces, but you can easily separate the meshes using the Layout UVs operation, as described in Chapter 20, “Editing UVs for polygonal surfaces.”
Previewing texture placement If you want visual feedback while you modify UVs, you can assign a dummy shader before assigning the final texture. By turning on Assign Shader to Each Projection, a defaultPolygonShader with a checker texture is created in Hypershade. If you do not need to pre-adjust your texture maps, turn off Assign Shader to Each Projection (off by default). You simply assign your texture to selected faces then use any of the mapping techniques to adjust it. The extra defaultPolygonShader is not created in Hypershade when this option is turned off. To assign shaders to each projection: 1
Turn on Assign Shader to Each Projection on in the Edit Polygons > Texture menu.
2
Select a face on the model.
3
Select a mapping technique, such as Planar Mapping. The mapping manipulator as well as a checker texture displays on the face. A checker shader is also created in Hypershade.
3D view.
Hypershade.
Tip The defaultPolygonShader uses a checker texture by default. You can assign another texture to the default shader and rename it if you want to. For instance, if you know you will be mapping a stone texture to many objects, import your stone file texture to the default shader and change the defaultPolygonShader name to stones.
CREATING UVS BASED ON THE CAMERA VIEW The results of the Create UVs Based on Camera operation depends on the current view of the camera. When you select the operation, UVs are computed based on the projection of the faces on the view plane. This means that the geometry you see in the perspective view window and the result you see in the UV Texture Editor window after selecting the option are identical in shape.
POLYGONAL MODELING 211
MAPPING UVS FOR POLYGONAL SURFACES | 19 Using Best Plane Texturing To create UVs based on the camera: 1
Select the faces on which you want to create UVs. Press F11 or press the right mouse button and select Face from the marking menu, then click on the faces.
2
Select Edit Polygons > Texture > Create UVs Based on Camera. Maya creates UVs and maps the texture to the faces you selected.
UVs created.
UV Texture Editor.
To create a new UV set with the UVs you create based on camera, select Edit Polygons > Texture > Create UVs Based on Camera ❐, turn on Create New UV Set and type a new set name in the UV Set Name box, then click Apply.
USING BEST PLANE TEXTURING The Best Plane Texturing operation computes the UVs based on the plane you define, and applies the textures to the selected faces. To create UVs using Best Plane Texturing: 1
Select the faces for which you want to create UVs.
2
Select Edit Polygons > Texture > Best Plane Texturing Tool.
3
Make sure your cursor is in the 3D view. At this point, you can follow the prompts in the Help Line if the Help Line is displayed. The following steps take you through the prompts.
4
Select one or more faces on which you want to map the texture. You cannot marquee-select the faces—you must select the faces one by one, or select the faces before using the operation.
POLYGONAL MODELING 212
MAPPING UVS FOR POLYGONAL SURFACES | 19 Planar mapping for polygonal surfaces
5
Press Enter once you have selected the faces you need, or select more faces if necessary then press Enter when done.
6
You are now prompted to select vertices. Use the marking menu technique. Press the right mouse button, select Vertex from the marking menu, then click to select one vertex or Shift-click to select several vertices.
7
Press Enter to create the UVs where you clicked the vertices and to map the texture.
UVs created.
PLANAR MAPPING FOR POLYGONAL SURFACES Use Planar Mapping to create a texture map by projecting UVs at the vertices of an object onto a plane. To project a planar texture map: The following example shows you how to map a planar texture using Smart Fit and the Fit to Best Plane or Fit to Bounding Box options. You can also use the manipulator handles to fit the texture to your needs. 1
Press F11 or press the right mouse button and select Face from the marking menu, then marquee-select the entire object or click to select the faces you want to map.
POLYGONAL MODELING 213
MAPPING UVS FOR POLYGONAL SURFACES | 19 Planar mapping for polygonal surfaces 2
Select Edit Polygons > Texture > Planar Mapping ❐ to open the Polygon Planar Projection Options window.
3
Make sure Smart Fit is turned on. If it is not on, the Fit to Best Plane or Fit to Bounding Box options cannot be used.
4
Click Fit to Best Plane or Fit to Bounding Box.
5
Click the Project button. A manipulator displays.
Wireframe
6
Smooth shaded
Front view.
Back view.
If you’d like to change the scale of the resulting UV mesh, resize the projection manipulator on the model by dragging one of the corners. If the manipulator doesn’t appear, select subdPlanarProj in the Channel Box.
Click-drag to change width (U).
Default Fit to Best Plane. Click crossed lines and drag rotate manipulator to rotate map.
Click-drag to change width (U) and height (V).
You can also rotate the manipulator by clicking the red crossed lines, which reveals the Show Manipulator tool. Click the light blue circle around the Show Manipulator handle to activate the rotate handles.
Polygon Planar Projection options Select Edit Polygons > Texture > Planar Mapping ❐ to open the options window.
POLYGONAL MODELING 214
MAPPING UVS FOR POLYGONAL SURFACES | 19 Planar mapping for polygonal surfaces Smart Fit turned on By default, Smart Fit is turned on, which automatically positions the projection manipulator. If you prefer to specify exact values for the projection manipulator, you can turn off Smart Fit and change the values in the Projection Center, Rotation, Width, and Height settings instead. See "Smart Fit turned off" on page 215. Fit to Best Plane
Fit to Bounding Box
Mapping direction
If you want to map UVs for a portion of the object’s faces, you can turn on Fit to Best Plane and the projection manipulator snaps to an angle and rotation aimed directly at the selected faces. This option works best when you are mapping UVs to all or most of an object’s faces. It snaps the projection manipulator to fit within the object’s bounding box. With this option on, you must choose one of the Mapping direction options to establish the orientation of the projection manipulator. Choose an axis so that the projection manipulator is aimed at the majority of the object’s faces. For example, a turtle model sitting on the grid would have most of its faces pointing toward the Y axis, while a horse model standing on the grid would have most of its faces pointing toward the X or Z axis. If most of the model’s faces point somewhere that is not directly along the X, Y, or Z axis, you can choose Camera. This option positions the projection manipulator based on the current active view.
Insert Before Deformers
The Insert Before Deformers option is relevant when the polygonal object has a deformation applied to it. If the option is turned off and the deformation is animated, the texture placement is affected by the change in vertex positions. This leads to “swimming” textures. Turning this option on applies the texture placement to the polygonal object before the deformation is applied to it. Basically, the texture placement dependency graph node is inserted before the deformer dependency graph nodes and the texture “sticks” to the geometry even after the deformation. Image Center
This value represents the center of the projected UVs. Changing this value translates the center accordingly.
Image Rotation
This value changes the angle at which UVs are rotated in the 2D window. Drag the slider or enter a value to rotate the image.
Image Scale
This value represents the width (U) or the height (V) of the 2D map relative to the 2D center point.
Keep Image Ratio
Create New UV Set
Turn this option on to retain the width to height ratio of the image so that the image does not distort.Turn it off so that the mapped UVs fill the 0 to 1 coordinates in the UV Texture Editor. Turn this option on to create a new UV set and place the UVs created by the projection in that set. Change the name in the UV Set Name box. Smart Fit turned off If Smart Fit is turned off, you can enter values to change the Projection Center, Rotation and Scale. These values correspond to the manipulator handles that display when you map your texture onto the polygon. POLYGONAL MODELING 215
MAPPING UVS FOR POLYGONAL SURFACES | 19 Cylindrical and Spherical mapping After you project a texture, you can change these values from the Channel Box or the Attribute Editor, or use the corresponding manipulator handles to interactively adjust the map. Projection Center
The projection center defines the point of origin in the X, Y, or Z axis from where you can project a texture map. By default, this is the center of the selected faces in the X, Y, or Z axis.
Projection Rotation
Type a value to rotate the projection in the 3D view around the X, Y, or Z axis which subsequently rotates the texture.
Projection Scale
Scaling a projection enlarges or reduces the height (V) and width (U) of the projection relative to the 3D projection axis.
CYLINDRICAL AND SPHERICAL MAPPING •
Use Cylindrical Projection mapping to create a texture map by projecting UVs at the vertices of the object to a cylindrical shape wrapped around the object.
•
Use Spherical Projection to create a texture map by projecting UVs at the vertices of the object to a spherical shape wrapped around the object. To project a cylindrical or spherical texture map:
1
Press F11, or press the right mouse button and select Face from the marking menu, then marquee-select the entire object or click to select the faces you want to map.
2
Click the ❐ beside Edit Polygons > Texture > Cylindrical or Spherical Mapping to open the options window.
3
Adjust the settings in the options window if necessary.
4
Click the Project button. A manipulator displays on the selected faces.
Cylindrical projection manipulator.
5
Spherical projection manipulator.
To fit the texture to suit your needs, drag the manipulator handles to adjust the texture placement on the polygonal faces, or change the settings in the Channel Box or Attribute Editor.
Cylindrical and Spherical Projection options The Cylindrical and Spherical mapping options windows share the same options.
POLYGONAL MODELING 216
MAPPING UVS FOR POLYGONAL SURFACES | 19 Cylindrical and Spherical mapping Smart Fit on Smart Fit is turned on by default. This automatically fits the texture and the manipulator onto the polygonal model. Insert Before Deformers
This option is turned on by default. The Insert Before Deformers option is relevant when the polygonal object has deformation applied to it. If the option is turned off and the deformation is animated, the texture placement is affected by the change in vertex positions. This leads to “swimming” textures. Turning this option on applies the texture placement to the polygonal object before the deformation is applied to it. Basically, the texture placement dependency graph node is inserted before the deformer dependency graph nodes and the texture “sticks” to the geometry even after the deformation. Image Center
This value represents the center of the projected UVs. Changing this value translates the center accordingly.
Image Rotation
This value changes the angle at which UVs are rotated in the 2D window. Drag the slider or enter a value to rotate the image.
Image Scale
This value represents the width (U) or the height (V) of the 2D map relative to the 2D center point.
Create New UV Set
Turn this option on to create a new UV set and place the UVs created by the projection in that set. Change the name in the UV Set Name box. Smart Fit off If Smart Fit is turned off, you can enter values to change the Projection Center, Rotation, Scale, or Scale Height. These values correspond to the manipulator handles that display when you map your texture onto the polygon. After you project a texture, you can change these values from the Channel Box or the Attribute Editor, or use the corresponding manipulator handles to interactively adjust the map.
Projection Center
Projection Rotation
The projection center defines the point of origin in the X, Y, or Z axis which is the center of the application of the projection. By default, this is (0, 0, 0) if Smart Fit is not turned on. Type a value to rotate the projection in the 3D view around the X, Y, or Z axis which subsequently rotates the texture.
Projection Horizontal Sweep
Use the slider or type a value to scale the projection around the polygonal object. This value corresponds to the Projection Scale Aperture handles on the manipulator. For instance, pull the Projection Scale Aperture handles all the way around the object until they meet. This is equivalent to entering 360 in the box. Projection Height
Scaling a projection enlarges or reduces the height (V) of a map relative to the 3D projection axis.
POLYGONAL MODELING 217
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
AUTOMATIC MAPPING Use Automatic Mapping to create a texture map by simultaneously projecting UVs onto multiple planes. This technique is very useful in cases where the simple planar, cylindrical, or spherical projections would result in severe distortion of UVs in some areas (as is often the case in more complex models). Automatic Mapping maps the model to multiple disjoint pieces in texture space. Automatic Mapping is most useful for standard (not combed) Fur and the 3D Paint Tool in projection mode. For both of these features, the small UV mesh pieces created by Automatic Mapping work fine. In other cases, you may want to combine the small UV mesh pieces into larger pieces, for example, combining pieces that correspond to fingers together with the mesh of the palm. It’s easier to create file textures for the model when the UVs of adjacent faces are combined in a logical way. To combine pieces, you use the Merge and Sew UVs operation, as described in Chapter 20, “Editing UVs for polygonal surfaces.” In the following example, the planar, cylindrical, and spherical projections all have overlapping UVs, and the cylindrical and spherical projections are distorted. The automatic mapping projection automatically cut the overlapping areas of the UV mesh and laid them out within the 0 to 1 texture space.
POLYGONAL MODELING 218
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
Polygonal model.
Planar Projection. (Overlapping and distorted UVs.)
Cylindrical Projection. (Overlapping and distorted UVs.)
POLYGONAL MODELING 219
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
Spherical Projection. (Overlapping and distorted UVs.)
Automatic Mapping. (UVs cut and laid out in the 0 to 1 texture space.)
Although the mesh is typically broken into many small pieces, and some of the texture space is wasted, you can use the Move and Sew UVs command to join the pieces together (see "Moving and sewing UVs" on page 239). You can also use the transformation tools in the UV Texture Editor to make better use of the texture space. To project UVs from multiple planes automatically: 1
Open the UV Texture Editor window (Window > UV Texture Editor) so you can view the projection.
2
To clearly see the 0 to 1 texture space, change the texture Grid to 1, if it is not already (View > Grid ❐). This is particularly important for Fur and the 3D Paint Tool, which both require the mapping to be positioned entirely within this space.
3
In the modeling view, select the faces you want to map (usually the entire model).
4
Select Edit Polygons > Texture > Automatic Mapping ❐.
5
Select the required settings, then click Project or Apply.
Automatic Mapping options Planes
Select the number of planes you are projecting from. The more planes used, the less distortion occurs and the more pieces created. You can choose a projection based on shapes with 4, 5, 6, 8 or 12 planes.
POLYGONAL MODELING 220
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
4 planes Optimize
12 planes
Less Distortion
Projects all planes equally. While this method provides the best projection for any face, you may end up with more pieces. It is particularly useful if you have a symmetrical model and you want the pieces of the projection to be symmetrical.
Fewer pieces
Projects each plane until the projection encounters a projection angle that is not ideal. This can result in larger pieces, and fewer of them. This is the default.
Fewer pieces
Select where you want the pieces of the UV mesh to lie in the texture space. Along U
Positions the pieces along the U axis.
Into Square
Positions the pieces within the 0 to 1 texture space. This is the default.
Along U Scale
8 planes
Select how you want the projection optimized.
Less distortion Layout
6 planes
5 planes
Into Square
Select how you want the pieces of the UV mesh scaled within the texture space. None
Performs no scaling.
Uniform
Scales the pieces to fit the 0 to 1 texture space without changing the aspect ratio. This is the default.
Stretch to Square
Stretches the pieces to fit the 0 to 1 texture space. The pieces may become distorted.
POLYGONAL MODELING 221
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
Uniform
Stretch to Square
Insert Before Deformers
The Insert Before Deformers option is relevant when the polygonal object has a deformation applied to it. If the option is turned off and the deformation is animated, the texture placement is affected by the change in vertex positions. This leads to “swimming” textures. Turning this option on applies the texture placement to the polygonal object before the deformation is applied to it. Basically, the texture placement dependency graph node is inserted before the deformer dependency graph nodes and the texture “sticks” to the geometry even after the deformation. Spacing Presets
Maya puts a bounding box around each piece and lays out the pieces so that the bounding boxes are very close together. If the pieces end up positioned exactly next to each other, two UVs on different pieces can share the same pixel and when painting with the 3D Paint Tool, overscanning can also cause the paint to spill onto the adjacent piece.
To avoid this situation, ensure that there is at least a pixel between the bounding boxes by selecting a spacing preset from this menu. Select a preset that corresponds to your texture map size. If you don’t know the size, select a smaller map, which will result in a larger spacing between adjacent pieces in UV space. (The smaller your map in pixels, the bigger the UV spacing must be between bounding boxes.) Select Custom to set the size of the space as a percentage of the map size (in the Percentage Space box). Percentage Space Create New UV Set
If you select Custom beside Spacing Presets, enter the size of the space between bounding boxes as a percentage of the map size. Turn this option on to create a new UV set and place the newly created UVs in that set. Type the name of the set in the UV Set Name box.
POLYGONAL MODELING 222
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
Note After performing an Automatic Mapping projection, you can modify the Planes, Optimize, Layout, and Scale settings for the projection in the Channel Box. However, do not modify these settings after painting a texture or applying Fur—the UVs may change drastically.
POLYGONAL MODELING 223
MAPPING UVS FOR POLYGONAL SURFACES | 19 Automatic mapping
POLYGONAL MODELING 224
20
EDITING UVS FOR POLYGONAL SURFACES
After you map UVs, you are ready to edit them further. This chapter describes the UV editing operations for polygons. For editing UVs on subdivision surfaces, see Using Maya: Subdivision Surfaces Modeling.
UV EDITING BASICS The UV Texture Editor (Window > UV Texture Editor) is the main tool for editing UVs. When you edit UVs, be aware of the following basic usage: Menus for polygonal surfaces There are separate menus for polygons and subdivision surfaces; use the menu items under the Polygons menu, not the Subdivs menu. These items are also available in the Edit Polygons > Texture menu. Selecting components Editing UVs requires you to select a variety of components, including faces, edges, and UVs. The easiest method for selecting components in the UV Texture Editor is to right click in the editor and select the component type from the marking menu. You can also convert from one selected component to another. For example, if you have faces selected, you may want to convert the selection to UVs in order to move them, because you cannot use the Move tool on faces. To convert component selection, choose from the following options on the Select menu: •
Convert Selection to Faces
•
Convert Selection to Edges
•
Convert Selection to Vertices
•
Convert Selection to UVs On the Select menu, you can also extend your selection using the Select Contained Faces and Select Connected Faces menu items:
•
Select Contained Faces—selects all faces within a border of UVs or edges that you select.
POLYGONAL MODELING 225
EDITING UVS FOR POLYGONAL SURFACES | 20 Transforming UVs in the UV Texture Editor •
Select Connected Faces—selects faces that share the UVs or edges you select. Zooming the view You can dolly in or out and track the view using the same keyboard and mouse shortcut you would use in the scene view. For example, press the Alt key and the middle and left mouse buttons to zoom in or out. You can also quickly focus the view by selecting View > Frame All or Frame Selection. Viewing contained or connected faces If you want to isolate and view only certain faces, you can turn on View Contained Faces or View Connected Faces under the View menu.
•
View Contained Faces—selects all faces within a border of UVs or edges that you select.
•
View Connected Faces—selects faces that share the UVs or edges you select. The following illustration shows examples for each setting.
Selected UVs.
Selecting UV mesh pieces or borders For transforming UV mesh pieces you can easily select a piece by selecting a single component (UV, vertex, edge, or face) and choosing Select > Select Shell. For other UV editing operations, you may need to select the border of a UV mesh piece. Select a single component (UV, vertex, edge, or face) and choose Select > Select Shell Border.
TRANSFORMING UVS IN THE UV TEXTURE EDITOR You can reposition UVs and UV mesh pieces using the Move, Scale, and Rotate tools. For example, you can move a UV mesh piece so that it occupies another part of the texture space and, consequently, another part of the texture you assign to the model. To transform components: 1
Select the UVs you want to move. If you want to move an entire mesh piece, select all UVs in that mesh.
2
Select the Move, Rotate, or Scale tool and transform the components.
POLYGONAL MODELING 226
EDITING UVS FOR POLYGONAL SURFACES | 20 Normalizing UVs
Notes You can move the pivot point of the Move, Rotate, and Scale tools. Press the Insert key, move the pivot, and press Insert again. You can transform the selected UVs by entering coordinates. Use either the rel (relative) or abs (absolute) entry box on the Status Line (it doesn’t matter which you choose). For example, you can scale UVs exactly 2 times by selecting the Scale tool and entering 2 in the numeric entry box. When you apply a texture, an image of it appears by default. If you then move mesh pieces to align with the image, you can automatically snap the UVs to image pixels by turning on Image > Pixel Snap.
NORMALIZING UVS When you normalize UVs, you fit them into the 0 to 1 texture space. To normalize UVs: 1
Select the faces for which you want to normalize the UVs.
2
Select Edit Polygons > Texture > Normalize UVs ❐, or in the UV Texture Editor, select Polygons > Normalize UVs ❐.
3
Select how you want the UVs normalized and click Apply.
Normalize UVs options Use the options in the option window to Normalize the texture coordinates (UVs).
Before Normalize.
Collectively
Select Collectively to normalize the UVs for all selected faces collectively. That means the texture coordinates for all selected faces are “collectively” fit to the 0 to 1 texture space. This is the default setting.
POLYGONAL MODELING 227
EDITING UVS FOR POLYGONAL SURFACES | 20 Unitizing UVs Each face separately
Select Each face separately to normalize the UVs for each selected face separately. That means the texture coordinates for each selected face are fit to a boundary of 0 to 1.
Preserve Aspect Ratio
Turn this option on to scale the UVs uniformly along U and V. Turn this option off (the default setting) to stretch the texture to fit by scaling U and V non-uniformly. When you normalize texture coordinates, you scale the UVs of the selected faces. If Preserve Aspect Ratio is on, the scaling is guaranteed to be uniform on both the U and V axes. If turned off, the scaling is different for the U and V axes.
UNITIZING UVS Use the Unitize UVs option to place the UVs of the selected faces on the boundary of the 0 to 1 texture space. Select Edit Polygons > Texture > Unitize UVs, or in the UV Texture Editor, select Polygons > Unitize UVs. To create a new UV set with the unitized UVs, click the ❐ beside the Unitize UVs option, turn on Create New UV Set and type the name of the set in the UV Set Name box, then click Apply.
FLIPPING UVS By flipping UVs, you can flip the texture placement on selected faces. To flip UVs: 1
In the 3D view, select the faces you want to flip the texture for.
2
Select Edit Polygons > Texture > Flip UVs ❐, or in the UV Texture Editor, select Polygons > Flip UVs ❐.
3
Select the desired Flip options and click Apply.
Flip UVs options Direction
Select which direction to flip the UVs of the selected faces: horizontally or vertically. Horizontal is the default.
POLYGONAL MODELING 228
EDITING UVS FOR POLYGONAL SURFACES | 20 Rotating UVs Coordinate
Select Global to flip the UVs in global UV space in the 0 to 1 texture space axis. Select Local to flip the UVs within the bounding box of the selected faces. Local is the default.
Selected faces before flip.
UVs flipped Horizontal, Local.
UVs flipped Vertical, Local.
Image Range in UV Texture Editor set to -1
Selected faces before flip.
UVs flipped Horizontal, Global.
UVs flipped Vertical, Global.
ROTATING UVS Use the Rotate UVs option to rotate the selected UVs by the angle specified in the option box. This is the same as rotating UVs interactively with a manipulator. This menu option makes it easy to save commonly-used rotations (such as +/-90 degrees) to the shelf for frequent use.
POLYGONAL MODELING 229
EDITING UVS FOR POLYGONAL SURFACES | 20 Laying out UVs
Selected UVs rotated 45 degrees.
To rotate UVs: 1
Select the UVs you want to rotate.
2
Select Edit Polygons > Texture > Rotate UVs ❐, or in the UV Texture Editor, select Polygons > Rotate UVs ❐.
3
Enter the rotation angle and click Rotate or Apply.
LAYING OUT UVS Use Layout UVs to lay out overlapping pieces of an existing UV mesh (optionally, cutting them if necessary) so that they no longer overlap, either along U or into a square. (Automatic Mapping does this automatically for new mappings.) For example, you could perform regular planar mapping on a character, and then use the Layout UVs command to separate any overlapping pieces—this typically separates the front and back pieces intact. Although in most cases, other smaller pieces will also be produced, you can sew them back together using the Move and Sew UVs command (see "Moving and sewing UVs" on page 239). You can also scale or stretch the UVs to fit within the 0 to 1 texture space, and flip and reverse pieces.
Planar mapping.
After Layout UVs.
To lay out existing UVs on an overlapping UV mesh: 1
Open the UV Texture Editor window (Window > UV Texture Editor) so you can view the projection.
2
To clearly see the 0 to 1 texture space, change the texture Grid to 1 if it is not already (View > Grid ❐). This is particularly important for Fur and 3D-paint, which both require the mapping to be positioned entirely within this space.
POLYGONAL MODELING 230
EDITING UVS FOR POLYGONAL SURFACES | 20 Laying out UVs 3
In the modeling view, select the faces with UVs you want to lay out.
4
Select Edit Polygons > Texture > Layout UVs ❐.
5
Select the required options, then click Layout UVs.
Layout UVs options The default settings give the best results in most situations. Separate
Flip Reversed
Select how you want to cut, or separate overlapping pieces of the UV mesh. Off
Does not separate overlapping pieces of the mesh. Only the Scale option has an effect.
Folds
Separates only pieces where the surface normals of overlapping pieces point opposite directions. This method is faster, especially for larger models, however, you may be left with overlapping UVs.
All Intersecting
Separates all pieces where the UVs overlap. This is the default.
Turn this option on to flip pieces of the UV mesh that have normals pointing in opposite directions.
Original polygon
Flip Reversed off
Flip Reversed on
Tip If your model is symmetrical (for example, a character’s face), you can save texture space by turning this option off and superimposing the pieces of UV mesh so they occupy the same texture space. Rotate for Best Fit
When turned on, allows some UV mesh pieces to be rotated by 90 degrees to maximize the space between the 0 to 1 coordinates. If turned off, Layout UVs does not rotate UV mesh pieces.
Layout
Select where you want the pieces of the UV mesh to lie in the texture space.
Scale
None
Does not lay out pieces after they have been cut. Some pieces may lie on top of others.
Along U
Positions the pieces along the U axis. This is the default.
Into Square
Positions the pieces within the 0 to 1 texture space.
Select how you want the pieces of the UV mesh scaled within the texture space. None
Performs no scaling.
Uniform
Scales the pieces to fit the 0 to 1 texture space without changing the aspect ratio. This is the default. POLYGONAL MODELING 231
EDITING UVS FOR POLYGONAL SURFACES | 20 Relaxing UVs Stretch to Square
Stretches the pieces to fit the 0 to 1 texture space. The pieces may become distorted.
Map Size Presets
Maya puts a bounding box around each piece and lays out the pieces so that the bounding boxes are very close together. If the pieces end up positioned exactly next to each other, two UVs on different pieces can share the same pixel and when texture painting, overscanning can also cause the paint to spill onto the adjacent piece.
To avoid this situation, ensure that there is at least a pixel between the bounding boxes by selecting a spacing preset from this menu. Select a preset that corresponds to your texture map size. If you don’t know the size, select a smaller map, which will result in a larger spacing between adjacent pieces in UV space. (The smaller your map in pixels, the bigger the UV spacing must be between bounding boxes.) Select Custom to set the size of the space as a percentage of the map size (in the Percentage Space box). If you select Custom beside Map Size Presets, enter the size of the space between bounding boxes as a percentage of the map size.
Space
RELAXING UVS Use Relax UVs to automatically untangle and even out UVs, while retaining a fixed border or fixed UVs. This is extremely useful for untangling UV meshes when used in combination with Map UV Border. To relax UVs: 1
Select a UV within the UV mesh.
2
Select Edit Polygons > Texture > Relax UVs ❐.
3
Select the required options, then click Relax or Apply. You may need to click Relax again until you achieve the desired results.
Relax UVs options Edge Weights
Select how the UV relax affects edges. Uniform
Attempts to make all of the edges the same length. This is the default.
World Space
Attempts to retain the original world-space angles (subject to the restrictions of the pinned border).
Pin UVs Use the following options to relax only selected parts of the UV mesh. POLYGONAL MODELING 232
EDITING UVS FOR POLYGONAL SURFACES | 20 Mapping the UV border Pin UV Border
Turn this option on to maintain the position of the border UVs. This is the default.
Pin UV Border, before Relax UVs. Pin Selected UVs
Pin Unselected UVs
Pin UV Border, after applying Relax UVs several times.
Turn this option on to maintain the position of selected UVs. For example, if you want more texture space for an area on a face with very dense UVs, you could select these UVs, scale them up, pin them, then relax the rest of the UVs to eliminate any overlapping you may have introduced during the scale. Turn this option on to maintain the position of the unselected UVs. This option is useful for relaxing only the selected UVs.
Pin Unselected UVs, before Relax UVs.
Pin Unselected UVs, after applying Relax UVs several times.
Stopping Conditions Max Iterations
Enter the number of relaxation iterations that will be performed on the UVs—ideal UV relaxation is subjective and iterative.
MAPPING THE UV BORDER With Map UV Border, you can automatically force the border of a UV mesh to a square or circle shape fitting within the 0 to 1 texture space, optionally maintaining a proportion of the original world space relationships between the edges (Shape Detail). This is very useful for untangling borders, prior to using a tool such as Relax UVs to untangle the interior UVs. In the following example, UVs were cut along the inside and back of a torus, creating a UV border. The UV border was mapped to a square, then relaxed to eliminate overlapping UVs.
POLYGONAL MODELING 233
EDITING UVS FOR POLYGONAL SURFACES | 20 Mapping the UV border
UVs on torus cut to create UV border.
Planar mapping of torus with cut UVs. Selected UV will map to origin.
UVs mapped to square.
Relaxed UVs.
To map a UV border: 1
Select a UV on the border.
Note The UV you select maps to a point on the diagonal of the 0 to 1 texture space. It maps as closely as it can to the origin while containing the UV mesh in the 0 to 1 space. 2
Select Edit Polygons > Texture > Map UV Border ❐, or in the UV Texture Editor, select Polygons > Map UV Border ❐.
3
Select the required options, then click Map. Remember that you are only dealing with the border—don’t worry about how tangled the interior UVs appear. You can untangle the interior UVs using the Relax UVs tool (see "Relaxing UVs" on page 232).
Map UV Border options Border Target Shape
Select the shape you want to map the UV border to (Circle or Square). The Square option makes best use of texture space, but can result in faces having zero or very little texture space around the edges of the mesh. The Circle option is less likely to produce this type of problem, but uses texture space less efficiently.
POLYGONAL MODELING 234
EDITING UVS FOR POLYGONAL SURFACES | 20 Mapping the UV border
These UV border mappings produce overlapping UVs, which can be fixed using the Relax UVs tool.
UV border mapped to square.
UV border mapped to circle.
Preserve Shape Detail Automatic
Turn on Automatic to map the UV border automatically using a Shape Detail value (see next) that approximates the best use the texture space while maintaining the world-space relationships between edges.
Shape Detail
Turn off Automatic and use the slider or enter a value between 0 and 1 to control the blend of the border with the specified shape. A value of 0 produces a border closest to the specified shape. A value of 1 produces a border that closely represents the world-space relationships between edges, but can result in concave areas along the border—these will produce overlapping interior UVs once relaxed. Border Target Shape = Circle.
Concave areas produce overlapping borders. In this situation, reduce the Shape Detail value.
Shape Detail 1.0.
Relaxed.
Reducing the Shape Detail value eliminates the overlapping borders while attempting to minimize distortion.
Shape Detail 0.3.
Relaxed.
A Shape Detail value of 0 eliminates the overlapping borders, forcing them into the set shape.
Shape Detail 0.
Relaxed.
POLYGONAL MODELING 235
EDITING UVS FOR POLYGONAL SURFACES | 20 Straightening the UV Border
STRAIGHTENING THE UV BORDER Use Straighten UV Border to untangle the border of a UV texture shell, such as an edge that loops around itself. Straighten UV Border provides more control than the Map UV Border operation. (Both of these operations are used in preparation for the Relax UVs operation, which works better if the texture border is untangled.)
Before you straighten the border: For best results, we recommend you do the following before using Straighten UV Border. •
Turn on construction history so you can change the curvature options after the operation.
•
Choose Display > Custom Polygon Display ❒, and turn on Texture Borders so you can see the texture border. To straighten selected border UVs:
1
Right click in the UV Texture Editor and choose UV.
2
Select UVs around the tangled UV border. Your selection can include UVs within the shell because Straighten UV Border only affects the border UVs. In some cases, it is difficult to select the UVs you want to straighten without selecting other UVs you want to leave unaffected. In these cases, you can leave a gap in your selection and use the Fill Gaps in Selection option to straighten the UVs you could not select.
3
Choose Edit Polygons > Texture > Straighten UV Border.
4
In the Channel Box or Attribute Editor, open the polyStraightenUVBorder node and adjust the options as needed. By adjusting the attributes on the node, you can interactively see the results. See the following descriptions. Straighten UV Border options
Curvature
Pushes the selected border area outward or inward by the specified amount. A value of zero forces the edge to be straight. Each Curvature unit is .01 on the UV coordinate scale.
POLYGONAL MODELING 236
EDITING UVS FOR POLYGONAL SURFACES | 20 Cutting and sewing UVs Maya curves the border outward or inward depending on whether the value is positive or negative. However, you cannot tell in advance whether to use positive or negative. With the polyStraightenUVBorder node opened in the Channel Box or Attribute Editor, try positive and negative values and check the results in the UV Texture Editor. Preserve Length Ratio
Controls the size of UV texture edges when straightened. Set to one, Maya preserves the original edge lengths. Set to zero, Maya averages the lengths. Values between zero and one change the length proportionally. Blend Original Shape
Affects the shape of the straightened border by blending it with the original border shape. You can use this setting to constrain the effect of the above two settings. Set to one, Maya keeps the original shape and overrides the other settings. Set to zero, Maya does not consider the original shape when straightening. Values between zero and one proportionally blend the original shape with the curvature created by the other settings. Fill Gaps in Selection, UV Gap Tolerance
These settings help you straighten UVs that are missing from your selection because they are difficult to select. The following illustration shows an example.
Problem: selection includes extraneous UVs that you do not want to straighten (shown encircled).
Alternative: Select a smaller area of the border and...
...apply Straighten UV Border with Fill Gaps in Selection turned on.
The UV Gap Tolerance setting is the threshold of when Maya selects and straightens the unselected UVs. For example, if there are three unselected UVs in the middle of two selected UVs, UV Gap Tolerance must be 3 or higher in order for Maya to select and straighten the middle UVs.
CUTTING AND SEWING UVS You cut UVs to separate the UV map along selected edges. You can then manipulate the pieces separately.
POLYGONAL MODELING 237
EDITING UVS FOR POLYGONAL SURFACES | 20 Cutting and sewing UVs
Before UVs cut at selected edges.
After UVs cut at selected edges. Pieces of UV mesh were moved to separate them.
You sew UVs so that all UVs along the edges are merged, creating a single UV shell.
Before UVs sewn at selected edges.
After UVs sewn at selected edges.
To cut UVs: 1
To help you differentiate between texture border edges (produced by cutting UVs) and ordinary edges, select the object, turn on the Texture Borders option in the Custom Polygons Display Options window and increase the Border Width.
2
Press F10 and either click on a single edge or Shift-select the edges you want to cut.
3
Select Edit Polygons > Texture > Cut UVs, or Polygons > Cut UVs in the UV Texture Editor. Cut edges become texture borders. You can now manipulate the texture pieces separately.
Note A single edge cannot be cut unless it touches a border.
POLYGONAL MODELING 238
EDITING UVS FOR POLYGONAL SURFACES | 20 Moving and sewing UVs
Tip Use the Select > Select Shell in the UV Texture Editor to select a piece of UV mesh after cutting. To sew UVs: 1
To help you differentiate between texture border edges (produced by cutting UVs) and ordinary edges, select the object, turn on the Texture Borders option in the Custom Polygons Display Options window and increase the Border Width.
2
Press F10 and either click on a single edge or Shift-select the edges you want to sew.
3
Select Edit Polygons > Texture > Sew UVs or Polygons > Sew UVs in the UV Texture Editor.
MOVING AND SEWING UVS Use Move and Sew UVs to sew together separate pieces of the UV mesh by merging selected edges and moving one piece (the smaller one) of the mesh to the other (the larger one). You can quickly join separate pieces of the UV mesh produced by Automatic Mapping or Layout UVs back to their neighboring UVs. There are two methods of moving and sewing UVs: manual and automatic. With the manual method, you must select the edges you want to join. With the automatic method, smaller pieces are moved and sewn automatically. You define how small the pieces should be. Manual Move and Sew.
Selected edges (common).
Before Move and Sew.
After Move and Sew.
POLYGONAL MODELING 239
EDITING UVS FOR POLYGONAL SURFACES | 20 Merging UVs Automatic Move and Sew.
Before Move and Sew UVs.
After Move and Sew UVs (moved and sewed only those meshes with fewer than 50 pieces.)
To move and sew pieces of UV mesh manually: 1
Select the edges you want to join. The common edges are highlighted in the texture view and in the modeling view.
2
Select Edit Polygons > Texture > Move and Sew UVs ❐.
3
Turn off Limit Piece Size.
4
Click Apply. To move and sew pieces of UV mesh automatically:
1
Select all the pieces.
2
Select Edit Polygons > Texture > Move and Sew UVs ❐.
3
Turn on Limit Piece Size and select the maximum number of faces a piece of the UV mesh can have to be moved and sewn.
4
Click Apply.
Tip After performing a Move and Sew operation, you can select the history node (polyMapSewMove) in the Channel Box and adjust the Number of Faces until you achieve the results you want.
MERGING UVS Use Merge UVs to merge together separate UV mesh pieces (shells). Merge UVs has a similar effect to Sew UVs. However, Merge UVs is better suited to merging shells when the polygon has nonmanifold geometry. For example, suppose you have three mesh pieces that all share an edge because the geometry is nonmanifold (see the illustration below). Using Merge UVs, you can combine two of the mesh pieces without affecting the other. If you used Sew UVs in this example, all mesh pieces would be combined because they all share an edge.
POLYGONAL MODELING 240
EDITING UVS FOR POLYGONAL SURFACES | 20 Deleting UVs
UVs and surface before Merge UVs
After Merge UVs—notice the texture border on the surface is gone
To merge UVs: 1
To see the texture border, choose Display > Custom Polygon Display ❒, and turn on Texture Borders.
2
Right click in the UV Texture Editor and choose UV.
3
Select UVs from separate mesh pieces. Merge UVs only merges the UVs that share the same vertex. There is also a maximum distance you can set to control which UVs in your selection become merged (see the next step for details).
4
Choose Texture > Merge UVs. As an option, you can set a maximum distance in the Merge UVs option box. Turn on Use Distance Threshold and set Distance to the maximum distance between UVs, measured in UV units. Any UVs in your selection that exceed this distance will not be merged.
DELETING UVS Use Delete UVs to remove UVs from an object. Deleting UVs removes them permanently until you re-create them using any of the UV creation methods. To delete UVs: 1
Select the faces for which you want to delete the UVs.
POLYGONAL MODELING 241
EDITING UVS FOR POLYGONAL SURFACES | 20 Creating a UV Snapshot to paint a matching texture
2
Select Edit Polygons > Texture > Delete UVs, or in the UV Texture Editor, Polygons > Delete Mapping. The UVs are removed.
Because the selected faces have no UVs, textures cannot be applied to them unless UVs are re-created using any of the UV creation methods.
CREATING A UV SNAPSHOT TO PAINT A MATCHING TEXTURE After you edit UVs in the UV Texture Editor, you can export an image of the UV mesh pieces with the UV Snapshot operation. Then you can open the UV snapshot in a Paint Effects canvas or a painting program, such as Adobe Photoshop®, and paint a texture that exactly matches the UVs. Before you save a snapshot, have the final UV arrangement complete and fitted within the 0 to 1 coordinate range. The snapshot image is limited to this range. To save a snapshot, select the object or a component and choose Polygons > UV Snapshot in the UV Texture Editor. In the window that opens, complete the following settings. File Name
You can save the file anywhere in or out of your project. Maya automatically assigns the file extension based on the image format you select.
Size X, Size Y
Sets the dimensions of the exported image. Use the same dimensions you want for the file texture you are about to create. If you are not sure, use the default size; you can scale the exported image later in your paint program.
Keep Aspect Ratio
Color Value
The aspect ratio is the ratio of Size X to Size Y. With it turned on, you can change one size slider and Maya automatically adjusts the other size value to keep the same ratio. If you need to change the aspect ratio, turn off this option temporarily and adjust one of the sizes. Sets the color of the UV patches in the exported image. The background of the snapshot is black; therefore, the Color Value should be white or another contrasting color. You can click the box to open the Color Chooser.
POLYGONAL MODELING 242
EDITING UVS FOR POLYGONAL SURFACES | 20 Copying and pasting UVs Anti-alias Lines
Controls whether lines in the output image have anti-aliasing.
Image Format
Use an image format that your paint program can read. If you require an alpha channel while painting, use TIFF or a similar format.
COPYING AND PASTING UVS Use the Copy UVs and Paste UVs menu items to copy and paste UVs from one object onto another object. To copy and paste UV texture coordinates onto faces: The following example shows a polygonal primitive cube and primitive plane that have been mapped with a file texture. A face from the cube is selected and copied to a face on the plane and then flipped to fit the face. 1
Select the face of the cube you want to copy to the face of the plane.
2
In the UV Texture Editor window, select Polygons > Copy UVs.
3
Select a face on the plane.
4
In the UV Texture Editor window, select Polygons > Click Paste UVs.
POLYGONAL MODELING 243
EDITING UVS FOR POLYGONAL SURFACES | 20 Changing the grid
Use the Flip UVs options to apply the texture correctly if necessary. See "Flipping UVs" on page 228 for details.
CHANGING THE GRID You can turn the UV Texture Editor grid on and off with the View > Grid menu item. You can also change the following grid options: Length and Width
Controls the overall size of the grid, measured in UV coordinates. The Length and Width is set to 1 (one) by default, because you typically want UVs to fit within the 0 to 1 range and this setting clearly shows the 0 to 1 range.
Grid Lines Every
Sets the spacing between grid lines. Grid lines appear in increments based on the decimal value you specify. This setting affects where UVs snap if you use the Snap to Grid feature.
Subdivisions
Sets the number of lines between each grid line. By default, subdivision lines do not show; you must turn on Subdivision Lines for them to appear.
Display Axes, Grid Lines, Subdivision Lines, Labels
Displays or hides items within the grid.
DISPLAYING THE TEXTURE To see the texture in the UV Texture Editor, turn on Display Image in the Image menu. There are a number of texture display options:
POLYGONAL MODELING 244
EDITING UVS FOR POLYGONAL SURFACES | 20 Displaying the texture
Displaying textures for the object or faces Once you have assigned a texture to your model, turn on Image > Display Image to see how the UVs align with the texture image. Displaying on a per-object level In the modeling view, select the object for which you want to display the texture. The texture for the selected object displays in the grid area in the UV Texture Editor. Displaying on a per-face level Select the face for which you want to display the texture. The texture for the selected face displays in the grid area in the UV Texture Editor.
Note If the texture quality is poor or if parts of the texture do not display correctly, you can modify the display quality with the Hardware Texturing settings in the Attribute Editor for the material node. If you are using a file texture, the best display mode for the Texture quality setting is Default. (The other settings, such as High, are best for procedural textures.)
Selecting an image to display If you have multiple textures applied to object, you can choose which texture you want to display. Select Image > Selected Images and select from the list of the textures that you applied.
Setting the texture image ratio You can display rectangular file textures images. To enable this feature, turn on Image > Use Image Ratio. For example, if you assign a 256 x 512 image of a logo onto a surface, turn on Use Image Ratio so you can see the image in it’s proper ratio.
Note The UV Texture Editor will scale images into a square display if you reposition the file texture.
Changing the image range Use the settings in the Image Range options window to change how much of the texture displays (select Image > Image Range ❒). Minimum U/V and Maximum U/V
You can explicitly set the size of the image by setting these options, or you can select one of the presets. Presets
Select one of the preset image ranges and click Apply. None
The texture space is defined by the Minimum and Maximum U and V values.
POLYGONAL MODELING 245
EDITING UVS FOR POLYGONAL SURFACES | 20 Creating good UVs on complex models Grid Size
The texture fills the extent of the grid (defined in the Grid Options window.) In the following example, the Extent value was set to 2 in the Grid Options window.
Unit Size
The texture fills the 0 to 1 (or unit) texture space.
Displaying images unfiltered By default, images display filtered so that pixels blend into each other for a smoother quality. You can display images unfiltered so that when you zoom in you can see each pixel clearly. With pixels clearly displayed, you can use the Pixel Snap option (see next) to snap UV points to precise points on the texture. To display images unfiltered, turn on Display Unfiltered in the Image menu of the UV Texture Editor.
Filtered image display.
Unfiltered image display.
Snapping UVs to pixels For greater control over UVs when you translate them, you can snap them to pixels (like snapping to a grid). To snap UVs to pixels: 1
Turn on Image > Pixel Snap.
2
Zoom in on the texture so you can see the pixels.
3
Select the UV you want to snap to a specific pixel and select the transformation tool.
4
Drag the UV. It will snap to the closest pixel corner.
CREATING GOOD UVS ON COMPLEX MODELS Use Average Vertices to smooth geometry so that good UVs are simpler to produce. (For example, the wrinkles on a model of a finger would likely result in overlapping UVs because the angle necessary for a good projection changes continuously.) You can then transfer the good UVs back to the original model using the Transfer command. To average vertices for mapping without changing the model’s topology: 1
Duplicate the original model.
2
On the duplicate model, select the vertices you want to smooth.
3
Select Polygons > Average Vertices ❐.
4
Enter the required number of iterations then click Apply.
POLYGONAL MODELING 246
EDITING UVS FOR POLYGONAL SURFACES | 20 Creating good UVs on complex models 5
Click Apply repeatedly until the desired smoothness is achieved.
6
Project the UVs onto the smoothed duplicate model using any of the projection methods under Edit Polygons > Texture.
7
Use the new Transfer command (see next) to apply the UVs to the original model.
Transferring vertices Use Transfer to transfer vertex positions, UV sets, and/or vertex color between two models with identical topology. To create good UVs, you can incorporate the Transfer tool into your workflow by first duplicating the original model, manipulating the vertices so that it is more suitable for projection using a method that does not change the topology (for example, using Average Vertices, or the Sculpt Polygons tool), projecting the UVs on the modified model, then using Transfer to copy them back to the original model. Smoothed Duplicate of complex model.
Complex model.
Planar projection of smoothed duplicate.
Good UVs created using Map UV Border and Relax UVs.
Good UVs transferred back to original model and smoothed duplicate deleted.
To transfer UVs: 1
Select both the source object and the destination object, in that order.
POLYGONAL MODELING 247
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing 2
Select Polygons > Transfer ❐.
3
Select the type of information you want to transfer (Vertices, UV Sets, Vertex Color), then click Transfer.
MULTITEXTURING Multitexturing is the layering and blending of multiple textures on an object, potentially using a distinct UV set for each layer. Although it is not necessary that each texture contains its own set of UVs, it is often an important part of multitexturing.
Creating and editing UV sets You can create and edit multiple UV sets for working with multitextured objects which can be viewed in hardware shaded display mode as well as software rendered. You can create a new UV set when you do the UV mapping or you can create an empty UV set independently of a projection. To create a new UV set when you project a map: In the projection option box, turn on Create New UV Set and type a name for the set in the UV Set Name box. To create a new empty UV set: 1
Select the object, then select Edit Polygons > Texture > Create Empty UV Set ❐.
2
In the Create UV Set Name box, type the name of the empty set and click Create. To set a UV set to be current (select the set):
•
Right-click on the object and drag down and select UV Sets > UVsetName, where UVsetName is the name of the UV set you are selecting. or
•
In the UV Texture Editor, select Image > UV Sets > UVsetName, where UVsetName is the name of the UV set you are selecting. or
•
Select the object, then select Window > Relationship Editor > UV Linking > UVCentric and click on the UV set name. or
1
Select the object, then select Edit Polygons > Texture > Set Current UV Set ❐.
2
In the UV Set Name box, type the name of the UV set you are making current. To rename a UV set:
1
Select the set you want to rename.
2
Select Edit Polygons > Texture > Rename Current UV Set ❐.
3
In the New UV Set Name box, type the new name for the set and click Rename Current or Apply.
POLYGONAL MODELING 248
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing To copy values from one set to another existing set: 1
Select the set you want to copy from.
2
Select Edit Polygons > Texture > Copy Current UV Set ❐.
3
In the UV Set Name to Copy to box, type the name of the UV set you want to copy the UVs of the selected set to. To delete a UV set:
1
Select the set you want to delete.
2
Select Edit Polygons > Texture > Delete Current UV Set.
Applying layered textures to UV sets Use the Layered Texture node to manage multiple textures. You can drag and drop file textures onto this node using the middle mouse button, and RGB and alpha connections are automatically made. You can alternatively drag textures from Hypershade into the Layered Texture’s Attribute Editor. The following workflow shows you how to create UV sets, layer textures, and how to manage the correspondence between texture layers and UV sets. To create UV sets:. 1
In the top view, create a polygonal plane, scale it larger than the default, and select it.
Tip From the top view panel’s menu, select Shading > Smooth Shade All and Hardware Texturing to see the results when you have completed the texture assignment. 2
Select Edit Polygons > Texture > Planar Mapping ❐ to open the Planar Projections Options window.
3
Set the Mapping Direction to Camera, turn on Create New UV Set, and enter lightUVs as the set name, then click the Project button.
POLYGONAL MODELING 249
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing
Set Camera as the Mapping Direction.
Turn on then enter the new UV set name.
The plane should now display the projection map manipulators.
4
Select Window > Relationship Editors > UV Linking > UV-Centric.
5
Click map1 to make it current.
6
Select Edit > Rename UV Set and enter brickUVs in the Rename UV Set options window.
POLYGONAL MODELING 250
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing
The Relationship Editor displays both UV sets.
7
Make sure brickUVs is selected in the Relationship Editor.
8
Select half the faces on the plane and then select Edit Polygons >Texture > Unitize UVs to tile the UVs for the brickUVs UV set. To create texture layers:
1
In Hypershade, use the middle-mouse button to click-drag the Layered Texture swatch from the Visor panel onto the material swatch in Hypershade and connect it to one of the material’s attributes (such as Color. Select Color from the material swatch’s pop-up menu).
or Select Create > Textures > Other > Layered Texture, click in Hypershade and middle-mouse-button drag the texture swatch over the material swatch to connect it to an attribute.
POLYGONAL MODELING 251
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing 2
Double-click the Layered Texture swatch in Hypershade to open its Attribute Editor. In the Layered Texture’s Attribute Editor, map the Color to a file texture (for example, some kind of brick or stone texture you may have). Rename this texture brickTexture.
Result in the view panel.
Click to map a 2D file texture to the Color attribute.
Hypershade view.
3
Click in the top-most area of the Layered Texture Attributes section of the Attribute Editor to create a second layer and click the box next to Color to map it to another file texture. Rename this texture lightTexture.
Note You can use any file texture and not necessarily a light map. See "Example 2" on page 255.
POLYGONAL MODELING 252
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing
Click in this section to add another layer. Click to map a 2D file texture to the Color attribute.
Result in the view panel.
Hypershade view.
4
In the lightTexture’s Attribute Editor, open the Effects section and turn on Invert to invert the lightTexture.
Result in the view panel.
Turn Invert on.
5
In the Layered Texture’s Attribute Editor, click the lightTexture swatch and set the Blend Mode to Illuminate (or Subtract).
POLYGONAL MODELING 253
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing
Select the Illuminate or Subtract Blend Mode.
Hypershade view.
6
Click the brickTexture swatch and make sure the Blend Mode is None (the default). The order of layers within the Layered Texture Attribute Editor is important since you want the light file texture to blend on top of the brick texture. Make sure the brickTexture is first (the right-most texture). To connect the UVs to the textures:
1
Open the Relationship Editor in UV-Centric mode (Window > Relationship Editors > UV Linking > UV - Centric).
2
Select the plane to update the Relationship Editor.
3
Click the lightUVs UV Set in the left column, and click the texture items in the right column to compare results. See the following examples.
POLYGONAL MODELING 254
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing Example 1 Shows brick UVs used to map brick texture and light map UVs used to light map texture.
Shows light map UVs used to map both textures.
Example 2 These next few images show what happens when you change the overlaying texture by mapping another file and selecting the lightUVs set in the Relationship Editor.
Double-click the texture swatch to open its Attribute Editor and select another file texture. Rename the new file texture.
POLYGONAL MODELING 255
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing
Blend modes Textures can be blended with the texture below them using the Texture Blend attribute in the Layered Texture’s Attribute Editor. The Blend Mode specifies how the currently selected layer blends with the layers behind it. The following blend modes are available. None
The foreground texture covers up the background texture entirely.
Over
The foreground texture is applied like a decal to the background. The blending of the decal is determined by the foreground alpha.
In
The result is the background texture cut in the shape of the foreground alpha.
Out
The result is the opposite of In. It is as if the shape of the foreground alpha has been cut out of the background.
Add
The foreground color is added to the background color as if being projected on the background through a slide projector.
Subtract
The foreground color is subtracted from the background color.
Multiply
The result color is the foreground color multiplied by the background color.
Difference
The result color is the difference between the foreground color and the background color.
Lighten
The result color of each pixel is the background color or foreground color, whichever is lighter.
Darken
The result color of each pixel is the background color or foreground color, whichever is darker.
POLYGONAL MODELING 256
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing Saturate
The result color is the background color with saturation increased in proportion to the foreground alpha.
Desaturate
The result color is the background color with saturation decreased in proportion to the foreground alpha.
Illuminate
The result color is the background color mixed with the foreground color, brighter where the foreground color is bright and darker where the foreground color is dark. It is as if the foreground texture represents the light falling on the background.
POLYGONAL MODELING 257
EDITING UVS FOR POLYGONAL SURFACES | 20 Multitexturing
POLYGONAL MODELING 258
INDEX 3D Delta NURBS to Polygons option 118 3D morphing Sculpt Polygons Tool 172
A Activate toggle in Selection Constraint window 111 Add attribute 185 All Hard edges Soften/Harden option 74 All Soft edges Soften/Harden edges 74 Allow Zero Normals attribute 69 Alpha attribute 185 Ambient material channel color per vertex 183 Ambient + Diffuse material channel color per vertex 183 Angle Selection Constraint option 112, 113 Angle edges Soften/Harden edges 74 Angle Threshold Quadrangulate polygons option 122 Append to Polygon Tool description 28 options 29 Apply Color operation description 184 Apply Type attribute 202 Area Selection Constraint option 111 Assign Shader to Each Projection 211 Assoc Type attribute 202 Association type attribute 200 attribute maps importing, sculpting polygons 171 attributes polygonal, editing in Attribute Editor 42
Auto Fit Bevel option, polygons 162 Auto Smooth Sculpt Polygon Tool option 168 Automatic Mapping options 220 Automatic mapping 218 Average Normals 68 Average Normals options 69 Average Vertices 158 Axis Selection Constraint option 113 setting orientation for polygonal primitives 79
Border Point Preservation attribute 62 Border Target Shape map UV border option 234 borders display with Smart Command Settings 98 display, changing 45, 47 boundaries defining, selecting components 101 brush operations Sculpt Polygon Tool 168
ANIMATION
Numerics
C B backculling description 47 Backface Culling description, polygons 44, 47, 49 full, polygons 45 hard, polygons 44, 49 modes, for polygons 44, 49 vertex display, polygons 44 wire, polygons 44, 49 backup surfaces sculpting polygons 165 Best Plane Texturing 212 Bevel (polygons) description 160 options 162 blind data applying 202 editing types 201 exporting 202 presets 201 querying 203 troubleshooting 207 types 199 Blind Data Editor 199 Boolean operations (polygonal) animating 93 description 85 Difference 88 editing, with construction history 89 Intersection 89 trimming 92 Union 86 visibility, toggle on 91 Border Selection Constraint option 114
Chord Height Ratio NURBS to Polygons option 117 Cleanup option 40 Cleanup Polygon options 40 Clipboard Actions description 39, 188 Collapse (polygons) description 147 Collapse polygons edges or faces 147 Collectively normalize UVs 227 Color attribute 185 Color data on apply attribute 203 color interpolation color per vertex 183 Color Material Channel options, Custom Polygon Display 183 color-per-vertex introduction 183 using 184 colors change for polygon components 53 copy and paste 188 copy and paste for polygons 39 options, in Custom Polygon Display window 183 Paint Vertex Color Tool 186 Prelight 189 using Apply Color 183 colors per vertex feature 197 Combine (polygons) description 143
POLYGONAL MODELING 259
INDEX
Component Editor for polygons description 49 components change color of 53 changing display attributes for 43 definition 11 deleting 59 display, changing 43 display, default 16 moving, using Move Component 53 retaining selection for 52 set selection constraints for 101, 104, 113, 114 vertex/face 51 Compute shadow maps prelight option 193 Concave Constrain Properties option 108 Conform normals 72 Constrain Properties Concave option 108 Convex option 108 for edges 107 for faces 108 Holed option 109 Lamina option 109 Mapped option 109 Non-holed option 109 Non-planar option 108 Non-triangulable option 109 Nsided option 108 Planar option 108 Quads option 108 Triangles option 108 Unmapped option 109 construction history 165 polygonal Booleans, editing with 89 when sculpting polygons 165 Construction History attribute 41 Continuity Smooth option, polygons 157 Continuous attribute 205 Control Points tessellation method 119 Convert Selection description 97 Convex Constrain Properties option 108 copy UVs, colors, shaders 39
POLYGONAL MODELING 260
Copy options window description 39 Copy UVs 243 Count tessellation method 119 count (polygons) change display colors for 39 display for selected components 38 display for selected polygons 38 display in view 38 display polygon count 37 Create New UV Set automatic mapping option 222 cylindrical, spherical mapping option 217 Create Polygon Tool 23 description 23 options 25 Create UVs Based on Camera 211 culling backface, polygons 44, 47, 49 Current Next Constraint Mode option 106 Current UV Set 46 Custom Polygon Display backculling 47 backface culling 49 borders, display 45, 47 edges, display 45, 47 faces, display 45, 47 non-planar faces, highlight 48 normals, display 47 numbers, display on components 48 texture coordinates, display 48 UVs, display 48 vertices, display 47 window 19, 47 Cut Textures description 237 cylindrical mapping description 216 image center, changing 215, 217 image rotation angle, change 215, 217 image scale (width, height), change 215, 217 options 216 projection options 217 Smart Fit, snapping projection 217
D Data Type attribute 201 Delete Edge 60 description 60 Delete Mapping operation 241 Delete Vertex option 59 deleting components 59 error messages, for components 60 texture maps 241 vertices 51 Difference Boolean operation (polygonal) 88 Diffuse material channel color per vertex 183 Direction Duplicate Face option 134 Extract option 134 Extrude option 134 Move Component option 58 Selection Constraint option 113 Discrete Range attribute 203 Discrete Value attribute 203 displace points, when prelighting 194 Displace geometry prelight example 196 prelight option 194 displacement for brush stroke Sculpt Polygon Tool 170 Display Image 245 Display Poly Count 37 Distance Tolerance attribute 69 Duplicate Duplicate Face option 135 Extract option 135 Duplicate Face description 129 options 133
E Each face separately normalize UVs 228 Edge Count 103 Edge Snapping Split Polygon Tool option 151
INDEX
Edge Swap NURBS to Polygons option 119 Edge Weights relax UVs option 232 edges collapse 147 constrain properties for 107 constrain selection, example 105 create new by splitting polygons 149 definition 15 display, changing 45, 47 extruding 127 flipping 61 hard 73 hard, keep when quadrangulating polygons 122 hard, selecting only 107 illegal 62 merge multiple 180 merging 175, 179 set selection constraints for 112 smooth, selecting only 107 soft 73 soft, selecting only 107 subdividing 152 Edges Either Side 103 Emission material channel color per vertex 184 Ensure Planarity Append to Polygons option 31 Create Polygon Tool option 27 faces, keeping planar 95 erase sculpting polygons 164, 166, 170 Erase Srf update option Sculpt Polygon Tool 170 Extract (polygons) description 129 options 133 Extrude (polygons) options 133 Extrude Edge description, polygons 127 Extrude Face description, polygons 125
F
G
faces collapse 147 create new by splitting polygons 149 definition 12 deleting 59 display with Smart Command Settings 98 display, changing 48 duplicating 129 extracting 129 extruding 125 face normals, definition 13 filling holes in 142 keeping together 96, 130 making holes in 137 non-planar, definition 18 planar, definition 18 planar, keeping 95 quadrangulate 122 removing if all edges shared 42 set selection constraints for 108, 109, 111, 113 single, create 23 subdividing automatically after selection 152 triangulate 121 Fill Holel description 142 First Normal Sculpt Polygon Tool option 168 Fit to Best Plane planar mapping option 215 Fit to Bounding Box planar mapping option 215 flip edges 61 Flip Reversed layout UVs option 231 Flip Triangle Edge option 61 Flip UVs 228 Flood Sculpt Polygon Tool option 171 font changing for polygonal text 83 Fractional Tolerance NURBS to Polygons option 117 Free Set attribute 200 full Backface Culling option 45
General NURBS to Polygons option 118 tessellation 118 Geometry Constrain Properties options 109 geometry polygonal, displaced during prelight 194 Geometry Border Edges 157 Geometry Border Edges attribute 62 Global Values options for Duplicate Face 134 for Extract 134 for Extrude 134 for Move Component 58 Grab Color attribute 185 grid options for UV Texture Editor 244 Grow Selection Region description 101 select components 101
H hard Backface Culling option 44 hard edges keep when quadrangulating polygons 122 Hard Edges attribute 63 Heads Up Display 37 height set for polygonal primitives 79 Hex attribute 206 High Curvature attribute 63 history construction sculpting polygons 165 with Booleans (polygonal) 89 Holed Constrain Properties option 109 holes filling 142 making 137 making, with Append to Polygon Tool 34, 139 making, with Create Polygon Tool 34, 139
POLYGONAL MODELING 261
INDEX
hotkeys for applying colors 187
I Id attribute 200 Image Center cylindrical, spherical mapping option 215, 217 image range changing in UV Texture Editor 245 Image Rotation cylindrical, spherical mapping option 215, 217 Image Scale cylindrical, spherical mapping option 215, 217 importing attribute maps sculpting polygons 171 Insert Before Deformers Automatic Mapping option 222 Planar Mapping option 215 Spherical Mapping option 217 Insert key using when subdividing polygons 150 Inside Constrain Properties option 107 Intersection Boolean operation (polygonal) 89 invalid polygonal geometry 19 Isolate Select 103
K Keep Face Group Border Quadrangulate polygon option 122 Keep Faces Together description 96 Duplicate Face option 130, 136 Extract option 130, 136 Extrude option 130, 136 Keep Hard Edges Backface Culling option 49 Quadrangulate polygons option 122 Keep New Faces Planar description 95 Keep Tesselation 158
POLYGONAL MODELING 262
Keep Texture Border Quadrangulate polygons option 122 Keep Wire Backface Culling option 49
L Lamina Constrain Properties option 109 lamina face removal 42 Layout automatic mapping option 221 layout UVs option 231 Layout UVs 230 Layout UVs options 231 Length options for selection constraints 112 lighting compute incoming prelight 194 pre-evaluate 189 prelighting 196 Limit Points Specified To Append to Polygon option 30 Create Polygon Tool option 26 creating polygonal strips 33 local and global modes using Move Component 56 Local Values options for Duplicate Face 133 for Extract 133 for Extrude 133 for Move Component 57 Location Constrain Properties options 107 Long Name attribute 200
M Make Hole Tool description 137 merge modes 140 manipulators for Move Component 55 Map Size Presets layout UVs option 232 Map UV Border 233 Mapped Constrain Properties option 109
Mapped Area Selection Constraint options 113 mapping cylindrical and spherical 216 planar 214 Mapping direction planar mapping option 215 mapping textures cylindrical 216 planar 213 masked polygonal surfaces sculpting 170 masked vertices paint color on 188 material channel Ambient color per vertex 183 Ambient + Diffuse color per vertex 183 Diffuse color per vertex 183 Emission color per vertex 184 Specular color per vertex 184 Max 2D, 3D Angle 102 Max Iterations relax UVs option 233 merge edges 175 edges, first 178 edges, last 178 edges, middle 178 edges, multiple 180 edges, second 178 modes for merging edges 178 modes, when making holes 140 two polygons 179 vertices 173 Merge Edge Tool description 175 First mode 178 Middle mode 178 modes, description 177 options 177 Second (last) mode 178 Merge Multiple Edges description 180 options 180 Worldspace option 181 Merge UVs 240 Merge UVs Also 181
INDEX
Merge Vertices description 173 options 174 UVs merged 174 Merge with the original option 37 Minimal Edge Length NURBS to Polygons option 118 Minimum length Subdivide (edges) option 154 MinMax values changing, for constraint selection 110 Mirror Direction option 35 Mirror Geometry option 35 mirroring polygons 35 morphing key framing changes, Sculpt Polygons Tool 172 Move and Sew UVs 239 Move Component 53 description 54 Global Values options 58 Local Values options 57 manipulator 55 Move Edge options, Local center 58 Move Vertex options, translate along normal 58 options, general 57 Other Values options, Random 58 Move Edge options for Move Component 58 Move Face options for Move Component 57 Move Tool Triad options, when moving normals 65 Move Vertex options for Move Component 58 Move Component, Translate along normal 58 moving a projection cylindrical, spherical 217 planar 216
N Name attribute 200 Neighbors options for selection constraints 112 New Attr attribute 200
New Presets attribute 201 Next Selection Constraint Mode option 106 Non-holed Constrain Properties option 109 Nonmanifold geometry cleanup option 41 nonmanifold geometry 19, 28, 127, 174 Non-planar Constrain Properties option 108 custom polygon display option 48 highlight non-planar faces 48 non-planar faces definition 18 highlight 48 Non-triangulable Constrain Properties option 109 non-winged vertices description 60 Normal Sculpt Polygon Tool option 168 Normalize each face separately, for polygonal primitives 80 texture option creating new polygons 26, 31 UVs 227 whole object, for polygonal primitives 80
normals conforming 72 definition 13 display with Smart Command Settings 98 display, changing 46, 47 display, custom 14 display, general preferences 14 face normals, definition 13 locking 67 moving, in absolute and relative modes 65 normalize 68 reversing 70 reversing and propagating 72 reversing, introduction 15 setting 67 shells, when reversing 72 size, changing 46, 47 splitting 69 texturing/coloring, introduction 15 type, changing 46 unlocking 67 vertex 66, 68 vertex, splitting 69 X, Y, Z, change range of 67 Normals menu Reverse 70 Reverse and Propagate 72 Set Vertex Normal 66 Soften/Harden 73 Nsided Constrain Properties option 108 Number U/Number V NURBS to Polygons options 118 numbers displaying on components 48 NURBS to Polygons 3D delta 118 and Booleans (polygonal) 85 change in Attribute Editor 32 Chord Height Ratio 117 Control Points tessellation 119 Count tessellation 119 description 115 Fractional Tolerance 117 General tessellation 118 Minimal Edge Length 118 options 116 Quadrangulate 116 Standard Fit tessellation 117 Triangles 116
POLYGONAL MODELING 263
INDEX
O Offset Bevel option, polygons 162 Duplicate Face option 133 Extract option 133 Extrude option 133 Move Component option 57 On Border Constrain Properties option 107 Opacity Sculpt Polygon Tool option 167 Optimize automatic mapping option 221 Orientation option for selection constraints 113 orientation setting for polygonal primitives 79 Other Values options for Duplicate Face 134 for Extract 134 for Extrude 134 for Move Component 58
P Paint Selection Tool selecting polygonal components 53 Paint values attribute 203 Paint Vertex Color Tool description 186 paste colors, for polygons 39 shaders, for polygons 39 UVs 39 Paste UVs 243 Percentage Space automatic mapping option 222 pick mask change with Smart Command Settings 98 Pin Selected UVs relax UVs option 233 Pin Unselected UVs relax UVs option 233 Pin UV Border relax UVs option 233 Pin UVs relax UVs options 232 pixels, snapping UVs to 246
POLYGONAL MODELING 264
Planar Constrain Properties option 108 planar faces definition 18 planar mapping description 213 options 214 projection options 214 Smart Fit, snapping projection 215 using 213 planar trim curve create for polygonal text 82 planarity ensuring 27, 31 Plane Selection Constraint option 113 Planes option 220 Point define selection location of for polygons 113 Selection Constraint option, polygons 113 Poly Count 37 Poly text type 82 polyColorPerVertex 198 polygon count change display colors for 39 display 37 display for selected components 38 display for selected polygons 38 display in view 38 display total count 37 Polygon Cylindrical Projection options window 216 Polygon Mirror options 35 Polygon Planar Projection options window 214 Polygon Prelight options window 192 polygon primitives creating 75 Polygon Reduce options 62 Polygon Selection Constraint window 104 Polygon Set Vertex Normal window 67 Polygon Spherical Projection options window 216 Polygon Type options for polygonal text 83
polygonal primitives options 76 setting axis (orientation) for 79 setting radius for 76 setting subdivisions for 77 setting texture mapping for 80 setting texture mapping off 80, 81 setting width and height for 79 polygons 3D spacing 118 appending to 28 beveling 161 border, selection constraint for 114 components, definition 11 convert NURBS to 115 creating new 23 edges, definition 15 editing in Attribute Editor 42 face normals, definition 13 faces, definition of 12 flooding, sculpting 171 grow selection 101 introduction to 11 invalid and valid geometry 19 masked, sculpting 170 non-planar faces, definition 18 planar faces, definition 18 quadrangulate 122 reducing counts 62 sculpting 163, 170 set polygon count, NURBS to Polygons 119 shared, definition 19 shells, definition 17 shells, selection constraint for 114 shrink selection 101 smoothing 155 texture coordinates, definition 16 triangulate 121 units, constrain selection 110 unshared, definition 19 UVs, definition 16 vertices, definition 12 Post-normalize Normals attribute 69 prelighting 189 combining effects 197 Sample selected faces only 193 Sample using face normals 193 Pre-normalize Normals attribute 69
INDEX
Preserve Aspect Ratio normalize UVs 228 texture mapping, polygonal primitive plane 82 Preserve Shape Detail map UV border options 235 primitives edit polygonal in Attribute Editor 82 polygonal, creating 75 polygonal, options 76 polygonal, setting axis (orientation) for 79 polygonal, setting radius for 76 polygonal, setting subdivisions for 77 polygonal, setting texture mapping for 80 polygonal, setting texture mapping off 80, 81 polygonal, setting width and height for 79 projection cylindrical, spherical mapping options 217 planar mapping options 214 snap to best plane 215 snap to bounding box 215 snapping to faces 215 Projection Center cylindrical, spherical mapping option 217 planar mapping option 216 Projection Height cylindrical mapping option 217 Projection Horizontal Sweep cylindrical, spherical mapping option 217 Projection Rotation cylindrical, spherical mapping option 217 planar mapping option 216 Projection Scale planar mapping option 216 Projection Scale Height cylindrical, spherical mapping option 217 spherical mapping option 217 propagating and reversing normals 72 pulling sculpting polygons 164 pushing sculpting polygons 163
Px, Py, Pz Selection Constraint option 113
Q Quadrangulate (polygons) description 122 when converting from NURBS 116 Quadrangulate polygons options 122 quads Constrain Properties option 108 NURBS to Polygons option 116 option for subdividing faces 154
R Radius Sculpt Polygon Tool option 167 setting for polygonal primitive 76 Random Duplicate Face option 134 Extract option 134 Extrude option 134 Move Component option 58 Selection Constraint option 114 Ranged attribute 201 Ratio Selection Constraint option 114 Reduce by (%) attribute 62 reducing polygons 62 reference surface sculpting polygons 165 reference vector setting, sculpting polygons 168 Relax UVs options 232 relaxing UVs 232 Remove attribute 185 Remove Geometry options 42 Replace attribute 185 Replace Zero Normals By attribute 69 reposition points, when creating polygons 24 points, when splitting polygons 150 Reset to Default Settings 99 Resulting Color attribute 185
Reuse computed shadow maps prelight option 193 Reverse and Extract option 71 Reverse and Propogate option 72 Reverse normals description 70 Reverse option 71 reversing and propagating normals 72 Rotate Duplicate Face option 134 Extract option 134 Extrude option 134 Move Component option 58 Rotate UVs option 229 rotating a projection cylindrical, spherical 217 planar 216 Rotation Angle Append to Polygon option 30 Roundness Bevel option, polygons 162
S Sample incoming illumination only prelight option 194 Sample scale factor prelight option 194 Sample selected faces only prelight option 193 Sample using face normals prelight option 193 sampling data, when prelighting 194 process, using shadows for prelighting 195 shading values prelighting 194 Scale automatic mapping option 221 Duplicate Face option 134 Extract option 134 Extrude option 134 layout UVs option 231 Move Component option 58 scale factor for prelighting 194 scaling a projection around object, cylindrical, spherical 217 height 217 planar 216
POLYGONAL MODELING 265
INDEX
Sculpt Polygon Tool 168 description 163 erase surface 170 options 167 reference surface 170 reference vectors 168 sculpt variables 168 shape option 167 sculpting polygons building gradually 171 flooding 171 masked polygonal surfaces 170 pulling polygons 164 pushing polygons 163 tips and tricks 171 variables 168 Segments Bevel option, polygons 162 Select all Polygonal Objects attribute 41 Select and Cleanup attribute 40 Select Connected Faces 226 Select Contained Faces 225 Select Contiguous Edges 102 Select Geometry attribute 41 Selected Vertex Color attribute 185 Selection (polygonal) converting polygonal component selection 101 growing selection region 101 selecting selection boundary 101 shrinking selection region 101 using constraints 104 Selection Border Edges 157 Selection Boundary description 101 Selection Constraints Activate toggle 111 description 104 Off radio button 111 options 106 resetting 106 set MinMax values for 110 setting 104 Separate Duplicate Faces option 133 Separate Extracted Faces option 133 Separate layout UVs option 231 Separate polygons combined 146 description 144 with merged edges 145
POLYGONAL MODELING 266
Set Individual Color Channels attribute 186 Set to Face 70 Set to Face options 70 Set User Normal attribute 70 Set Vertex Color Key 198 Set Vertex Normal description 66 Sew Textures description 237 shaders assign placeholder shaders 211 copying, pasting for polygons 39 shadow maps compute, for prelighting 193 re-use, for prelighting 193 Shape Detail map UV border option 235 Shape option Sculpt Polygon Tool 167 shared edges, vertices, UVs definition 19 Sharp Geometry Angles attribute 63 Shell Selection Constraint option 114 shells definition 17 separating 144 when reversing normals 72 Short Name attribute 200 Shrink Selection Region description 101 select components 101 Signed options for selection constraints 113 Smart Command Settings description 97 uninstalling 99 Smart Fit cylindrical, spherical mapping toggle 217 planar mapping toggle 215 Smooth (polygons) and Sculpt Polygons Tool 164 decrease smoothness 157 degree of smoothness 157 description 155 increase smoothness 157 options 156
Smoothing Constrain Properties options 107 smoothing Artisan Sculpt Polygons Tool 164 Average Vertices 158 Snapping Magnets Split Polygon Tool option 151 Snapping tolerance Split Polygon Tool option 151 snapshot for UVs 242 Soften/Harden edges All Hard edges 74 All Soft edges 74 Angle edges 74 description 73 window 73 software rendering and prelighting 196 solids polygonal, definition 17 Space layout UVs option 232 Spacing Presets automatic mapping option 222 Specular material channel, color per vertex 184 spherical mapping change image center 215, 217 change image rotation angle 215, 217 change image scale (width, height) 215, 217 description 216 options 216 projection options 217 Smart Fit, snapping projection 217 Split Polygon Tool description 149 options 151 Split Vertex 152 split vertex normals 69 splitting polygons 149 stamp profile, Sculpt Polygon Tool 167 Standard Fit tessellation method 117 Stopping Conditions relax UVs options 233 Straighten UV Border 236
INDEX
Strength Sculpt Polygon Tool option 168 Stretch to fit texture mapping, polygonal primitive plane 81 strips polygonal, creating 33 Subdivide description 152 faces, automatically after selection 152 options 153 Subdivision Levels Smooth option, polygons 157 Subdivide polygons option 154 subdivision surfaces 158 Subdivisions Append to Polygon Tool option 30, 33 Create Polygon Tool option 25, 27 Split Polygon Tool option 151 subdivisions setting for polygonal primitives 77 Subtract attribute 185 surfaces backup, sculpting polygons 165 erase, sculpting polygons 170 options for Sculpt Polygon Tool 170 swap-edge 61
T Tag/Id attribute 203 Tessellate Geometry options 41 tessellation Control Points method 119 Count method 119 description 117 changing attributes 43 Edge Swap toggle 119 General method 118 methods, for polygonal text 84 methods, NURBS to polygons 117 Standard Fit method 117 text creating, polygonal 82 texture border keep when quadrangulating polygons 122
texture Coordinates setting for polygonal primitives 80 texture coordinates displaying 48 setting appending to polygons 31 creating new polygons 26 UVs, definition 16 texture mapping 209 automatic 218 cutting and sewing 237 cylindrical 216 delete maps 241 for polygonal primitive cubes and cylinders 80 for polygonal primitive planes 81 laying out UVs 230 moving and sewing UVs 239 options for polygonal primitives 80 planar 213 preserve aspect ratio for polygonal primitive plane 82 relaxing UVs 232 setting for polygonal primitives 80 setting off for polygonal primitives 80, 81 spherical 216 stretch to fit for polygonal primitive plane 81 UV border 233 texture placement visual feedback for 211 Texture View renamed 209 textures display in UV Texture Editor 245 Insert Before Deformer option 215 Threshold 181 Tool Options (polygonal) Convert Selection 97 Keep Faces Together 96 Keep New Faces Planar 95 Smart Command Settings 97 Translate Duplicate Face option 134 Extract option 134 Extrude option 134 Move Component option 58
Triangles Constrain Properties option 108 NURBS to Polygons option 116 option for subdividing faces 154 Triangulate when converting from NURBS 116 Triangulate (polygons) description 121 Triangulate polygons faces 121 turn-edge 61
U U Type NURBS to Polygons option 118 Union Boolean operation (polygonal) 86 Unitize texture option creating new polygons 26, 31 UVs 228 units polygonal, constrain selection 110 Unmapped Constrain Properties option 109 unshared edges, vertices, UVs 19 Unsigned options for selection constraints 113 Use Chord Height Ratio NURBS to Polygons option 118 Use Image Ratio 245 UV Border Edges attribute 63 UV Snapshot 242 UV Texture Editor usage 225
POLYGONAL MODELING 267
INDEX
UVs and Merge Vertices 174 and merging edges 181 automatic mapping 218 copy and paste for polygons 39 create UVs based on camera view 211 create UVs based on plane 212 creating 209 definition 16 displaying 48 flip 228 laying out 230 mapping border 233 moving with Move Component 57 moving and sewing 239 normalize 227 normalize, collectively 227 normalize, per-face 228 normalize, preserve aspect ratio 228 on complex models 246 relaxing 232 rotating 229 set selection constraints for 112 snapping to pixels 246 unitize 228 untangling 232
V V Type NURBS to Polygons option 118 valid polygonal geometry 19 variables, when sculpting 168 vertex colors Custom Polygon Display 183 vertex normals splitting 69 vertex, averaging 68 vertex/face selection 51
POLYGONAL MODELING 268
vertices append to polygon option Attribute Editor 33 apply color to 184, 186 create new by splitting polygons 149 create polygon tool option in Attribute Editor 28 definition 12 deleting 51, 59 display with Smart Command Settings 98 display, changing 44 map color values to 188 masked, paint color on 188 merging 173 move when sculpting 168 set selection constraints for 112 smoothing 158 splitting shared 152 View Sculpt Polygon Tool option 169 View Connected Faces 226 View Contained Faces 226 Visibility options for selection constraints 113 visibility toggle on for Boolean operations (polygonal) 91 Vx, Vy, Vz Selection Constraint option axis 113
W width setting for polygonal primitives 79 winged vertices 60 wire Backface Culling option 44 Worldspace and merging multiple edges 181 when beveling polygons 163 when duplicating faces 135 when extracting polygons 135 when extruding polygons 135 when moving components 58 when quadrangulating polygons 123 when subdividing polygons 154
X X Axis Sculpt Polygon Tool option 169
Y Y Axis Sculpt Polygon Tool option 169
Z Z Axis Sculpt Polygon Tool option 169
Maya PowerModeler
™
Maya PowerModeler gives artists ultimate flexibility and control when building sophisticated models. Precise Control Maya PowerModeler an
ADVANCED MODULE for MAYA the next-generation 3D software for creating high quality character animation & visual effects
With PowerModeler added to Maya’s extensive range of modeling tools, modelers can create real-world props and sets where adherence to specific values is critical. For example, maintaining the radii of multiple rounded edges that meet at a rounded corner.
Advanced Modeling Methods
Model entire scenes in PowerModeler.
PowerModeler is packed with tools that support the construction of complex geometry. These advanced modeling methods have evolved from Alias|Wavefront’s leading industrial design applications. Now artists can gain intuitive control when creating geometry using “curve networks”: a way of defining shapes by creating cross section curves along both the length and width of an object. As the curves are being modified, curve networks maintain userdefined continuity across the surfaces resulting in superb definition of shape – even after edits.
Booleans With PowerModeler, artists can create effects where the interaction of one shape causes the removal of part of another. Examples include the impression left in soft clay after an object has been pressed into it, or the result of two objects being merged together. PowerModeler provides the advanced NURBS functionality to create these complex Boolean effects.
World Renown Even the most intricate objects can be modeled in PowerModeler. Models like
More Tools for
3 D M i n d s
this take full advantage of the NURBS modeling tools offered in PowerModeler, creating incredibly realistic props.
PowerModeler is the same NURBS technology as PowerAnimator, recognized as the industry-leading modeling tool.
IMAGE CREDITS: Front from top: ©KRAFT. Image courtesy of Curious Pictures. T. Olson, Rollerblade, Inc. Back: T. Stone
T E C H N I C A L Fa c t s & F e a t u r e s
BOOLEANS Form shells from NURBS surfaces, and apply subtract, intersect and union operations across multiple NURBS models. Use PowerModeler to create accurate and
ALIGN
believable surfaces that can be imported
N-SIDED
into your Maya scene or brought to life by
Modify two curves or surfaces to achieve continuity. Create surfaces by blending up to eight bounding curves.
REBUILD SURFACE
Maya’s animation tools.
An interactive tool for surface fitting.
CURVE NETWORKS Create surfaces from networks of curves and automatically maintain user-specified continuity relationships with adjacent surfaces as you edit the curves. BIRAIL
Create surfaces by sweeping one or more curves along two path curves.
SWEPT
Create surfaces by sweeping a curve along a path.
CURVE & SURFACE SMOOTHING Interactively modify curves or surfaces to achieve a more even curvature distribution. UNITED STATES FIELD OFFICES ATLANTA BOSTON CHICAGO DALLAS DAYTON DETROIT HOUSTON LOS ANGELES MINNEAPOLIS NEW YORK SAN FRANCISCO SEATTLE WASHINGTON
Tel: 770.393.1881 Tel: 617.270.0606 Tel: 847.397.5280 Tel: 972.789.2950 Tel: 937.258.7441 Tel: 248.737.3500 Tel: 713.780.9292 Tel: 310.914.1566 Tel: 612.339.5820 Tel: 212.268.4900 Tel: 415.596.7000 Tel: 206.287.5600 Tel: 703.631.4800
Fax: 770.393.2705 Fax: 617.270.0608 Fax: 847.397.6067 Fax: 972.789.2951 Fax: 937.258.7449 Fax: 248.737.3506 Fax: 713.780.9296 Fax: 310.914.1580 Fax: 612.339.5939 Fax: 212.563.9418 Fax: 415.596.7002 Fax: 206.667.9049 Fax: 703.227.8595
I NTER NA TI O NA L F I EL D O F F I C ES AUSTRALIA BELGIUM FRANCE GERMANY HONG KONG ITALY JAPAN LATIN AMERICA MALAYSIA SINGAPORE UNITED KINGDOM
Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel: Tel:
61.2.9956.3819 32.9.266.1212 33.1.44.92.81.60 49.89.31.70.20 852.2519.4412 39.39.605.8272 81.3.3470.8282 1.305.919.8200 60.3.209.4703 65.435.0458 44.1494.441.273
Fax: 61.2.9437.6574 Fax: 32.9.266.1210 Fax: 33.1.44.92.81.61 Fax: 49.89.31.70.2199 Fax: 852.2827.4227 Fax: 39.39.605.8281 Fax: 81.3.3470.8288 Fax: 1.305.919.8300 Fax: 60.3.209.4705 Fax: 65.536.8502 Fax: 44.1494.449.289
G L O B A L H E A D Q U A RT E RS 210 King Street East Toronto Ontario Canada M5A 1J7 TOLL FREE: TEL: FAX: E-MAIL: WEB:
800.447.2542 416.362.9181 416.369.6140 [email protected] www.aw.sgi.com
© 1998 Alias|Wavefront, a division of Silicon Graphics Limited, all rights reserved. Alias|Wavefront, Maya, the Maya logo, Tools For 3D Minds, and PowerModeler are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Silicon Graphics is a registered trademark of Silicon Graphics, Inc. All other trademarks mentioned herein belong to their respective owners.
Rendering Basics
Rendering Basics 1 Introduction to Rendering Rendering a frame
9
9
Rendering activities table
16
2 Using the Multilister Quick tour of the Multilister
19 19
Using Drag-and-drop connections
22
Drag-and-drop within the Multilister
22
Drag-and-drop: Multilister to attribute editor Assigning shading groups to objects Creating and texturing shading groups Opening related windows and editors Using the Shading Group tool
23 24 26
27
Shading Group tool options
28
Assigning shading groups to components Multilister menus
29
File menu
29
Edit menu
31
Select menu
34
Window menu
36
Tool bar
28
33
Display menu Filter menu
22
36 39
Using Maya: Rendering
3
Rendering Basics Contents
3 Lighting a Scene
41
How lights work in Maya Creating lights Linking lights
42
43 51
Using the Light Linking tool Light types
52
54
Ambient lights
54
Directional lights Point lights
55
Spot lights
57
Common light attributes
55
59
Intensity Sample section Common Attributes Shadows section
59
59 60
4 Rendering an Animation Rendering an animation
61
61
Animation attributes (Render Globals) Output Extensions
62
62
Special Effects (Render Globals)
63
Resolution attributes (Render Globals: defaultResolution)
4
Using Maya: Rendering
64
Rendering Basics Contents Image file formats
64
5 Using the Shading Group Editor Understanding the Shading Group Editor Creating shading groups Selecting shading groups
67
69 70
Adding items to a shading group
71
Removing items from a shading group Renaming shading groups
67
71
72
Changing the color assignment Using the Shading Groups Editor
72 73
Menu items in common with the Set Editor
74
Using Maya: Rendering
5
Rendering Basics Contents
6 Using the Connection Editor Loading the Connection Editor Navigating a node network Making connections
75
76
76
78
Breaking connections
84
Connection Editor menu and button options
85
7 Using the Relationship Panel Selecting objects and lights Light linking
90
90
Assigning shading groups to objects
8 Rendering Flags
93
95
Selecting objects, textures, and materials Setting Rendering Flags
99
Batch rendering from the command line Batch rendering within Maya
102
10 Using Image Planes Creating a camera
105
Attaching an image plane
107
Using the Multilister
107
Using drag and drop
Using Maya: Rendering
95
96
9 Batch Rendering
6
89
109
105
99
Rendering Basics Contents Loading an image
110
Deleting image planes
110
Loading a scene in the image plane Image plane attributes
111
113
Placement attributes for attached image planes Placement attributes for fixed image planes Image plane fit
115
115
Image plane crop
115
11 Partial Image Rendering Rendering part of an image Test settings menu
114
117
117
119
12 Animating Render Node Attributes Animating render node attributes
121
121
Using Maya: Rendering
7
Rendering Basics Contents
8
Using Maya: Rendering
Rendering an image or a scene is the final stage of creation in Maya, and can be an iterative, experimental process. Rendering is not a linear activity. Similarly, this book is not designed to be read from front to back; rather you can jump from chapter to chapter and section to section easily. Use the online version for moving quickly from topic to topic. The procedure below will help get you acquainted with the basic activity of rendering a single frame. This chapter also contains a table of rendering activities that outline a typical rendering workflow, and provides cross references to relevant information. This chapter contains the following sections: •
“Rendering a frame” on page 9
•
“Rendering activities table” on page 16
Rendering a frame Rendering a frame in Maya is an immediate gratification activity. It starts by creating or importing objects, texturing them, and lighting them. When you are ready to bring the scene into the photo-realistic world, you’re ready to render. This section walks you through the basics of opening a scene and rendering it. If you do not have a scene to open, create a few objects and lights and save them. Then follow along in this procedure with your own file. By the end of it, you will be acquainted with some of the important windows and editors that you use during rendering activities.
To render a frame: 1
Select File → Open Scene.
Using Maya: Rendering
9
Rendering Basics
1
Introduction to Rendering
Introduction to Rendering Rendering a frame 2
Choose the scene you want to open and click Open. The scene opens, and you can see objects, lights, and all the scene components. Objects will not always be wireframes when you open a scene; Maya saves the state of your scene when you exit, so when you start Maya again, everything is the way you left it.
A newly opened scene, with all the objects displayed as wireframes
10
Using Maya: Rendering
Introduction to Rendering Rendering a frame 3
In the view’s Shading menu, select Smooth Shade All. Rendering Basics
The objects are shaded in the view to give you a better idea of their shapes and spacial relationships.
Tip You can also use Shading → Hardware Texturing, which displays shades objects in the views with the shading group that are assigned to them. Using Hardware Texturing is resource intensive, and may impact Maya’s performance.
Shading the objects gives you a better idea of their size, shape, and spacial relationships to one another
Using Maya: Rendering
11
Introduction to Rendering Rendering a frame 4
Select Windows → Multilister. The Multilister is displayed.
In the Multilister you can see rendering node connections, like which shading groups are assigned to which objects, which lights are connected to which shading groups, and so on. You can also make and break connections in the Multilister.
12
Using Maya: Rendering
Introduction to Rendering Rendering a frame 5
Double-click a shading group icon to open its attribute editor. Rendering Basics
You adjust a node’s attributes in its attribute editor. In this case, Color-Based Transparency is turned on, and Fast Drop Off is turned on. 6
Close the attribute editor.
Using Maya: Rendering
13
Introduction to Rendering Rendering a frame 7
Select Render → Render Globals to open the Render Globals window.
The Render Globals window contains many tuning settings for the renderer, among them are: Image Format, Output Extensions, Animation settings, and Special Effects like Film Gate and Environment Fog. 8
Close the Render Globals window.
9
Select Window → Rendering Editors → Render View. The Render View is displayed. The Render View is where your rendered frame is displayed. The menus in the Render view are for setting up how the Render View displays rendered images.
14
Using Maya: Rendering
Introduction to Rendering Rendering a frame 10 Select Settings → Resolution, and choose one of the resolution options. Rendering Basics
This is the resolution the image is rendered at.
11 Select Render → Render → persp.
Using Maya: Rendering
15
Introduction to Rendering Rendering activities table Maya renders the frame. The image is displayed in the Render View. The rendering will take time to complete, depending on how complex or simple the elements in the scene are.
The rendered image remains displayed in the Render View until the next time you render an image. If you close the Render View, the image will still be there the next time you open it. The image is saved to disk so you can keep the image if you want. Save options and image file format options are found in Render Globals.
Rendering activities table This section contains a table of links and cross-references that will help you find detailed information about rendering activities. Use the following table to familiarize yourself with the contents of the Maya renderer.
16
Rendering Activity
Relevant Topics
Opening a scene or files
Chapter 2, “Using the Multilister”
Using Maya: Rendering
Introduction to Rendering Rendering activities table
Relevant Topics
Using rendering editors
Chapter 2, “Using the Multilister”
Rendering Basics
Rendering Activity
Chapter 6, “Using the Connection Editor” Chapter 7, “Using the Relationship Panel” Chapter 8, “Rendering Flags” Chapter 3, “Using the Render View Window” Lighting the scene
Chapter 3, “Lighting a Scene” Chapter 6, “Creating Effects with Materials” Chapter 2, “Optimizing Maya’s Renderer”
Texturing
Chapter 6, “Creating Effects with Materials” Chapter 2, “Creating 2D Textures” Chapter 3, “Creating 3D Textures” Chapter 4, “Creating Environment Textures” Chapter 5, “Creating Materials” Chapter 7, “Creating Effects with 2D Textures” Chapter 8, “Creating Effects with 3D Textures” Chapter 9, “Creating Effects with Environment Textures” Chapter 11, “Using the Color Utilities”
Using Maya: Rendering
17
Introduction to Rendering Rendering activities table
Rendering Activity
Relevant Topics
Test Rendering
Chapter 2, “Optimizing Maya’s Renderer” Chapter 3, “Using the Render View Window”
Raytracing
Chapter 1, “Raytracing” Chapter 2, “Optimizing Maya’s Renderer”
18
Depth-map shadows
Chapter 4, “Using Depth Map Shadows”
Tuning the render settings
Chapter 2, “Optimizing Maya’s Renderer”
Rendering an animation
Chapter 4, “Rendering an Animation”
Batch rendering a final scene
Chapter 9, “Batch Rendering”
Cameras and image planes
Chapter 10, “Using Image Planes”
Using Maya: Rendering
The Multilister is one of the central windows in Maya in which you perform operations on rendering nodes. Through the Multilister you can create, delete, assign, and connect rendering nodes. This chapter describes the concept of the Multilister, and provides procedures about how to use the Multilister. This chapter contains the following sections: •
“Quick tour of the Multilister” on page 19
•
“Using Drag-and-drop connections” on page 22
•
“Assigning shading groups to objects” on page 23
•
“Creating and texturing shading groups” on page 24
•
“Opening related windows and editors” on page 26
•
“Using the Shading Group tool” on page 27
•
“Assigning shading groups to components” on page 28
•
“Multilister menus” on page 29
Quick tour of the Multilister When you open the Multilister you are in Highlight mode (Select → Highlight Mode). The Select tool on the left side is the default tool when you open the Multilister. This tool lets you select swatches in the Multilister and then perform actions on them, such as assigning shading groups to objects in the views, connecting materials to objects, opening attribute editors, and so on.
Using Maya: Rendering
19
Rendering Basics
2
Using the Multilister
Using the Multilister Quick tour of the Multilister
Multilister tools Shading group swatch Double-click to re-name
Active tab
Multilister menus
Active lister
Click to expand a swatch
Drag to resize the lister
Highlight List and Selection List When you select a swatch or swatches in the Multilister, a yellow border appears around the selction(s). (You can select multiple, nonadjacent swatches by using the Shift key and adjacent objects by dragging.) The Highlight List contains all the swatches highlighted in yellow. Some menu items depend on you selecting objects in this manner. Your Highlight List can include swatches from different tabs in the Multilister. You can work in both the Multilister and the views at the same time. For example, one way to connect a shading group to an object in a view is to first select the object in the view (this adds the object to the Maya Selection List), and then highlight a swatch in the Multilister (which adds the swatch to the Multilister Highlight List). The Multilister Highlight List and the Maya Selection List are two distinct lists, each containing different data.
20
Using Maya: Rendering
Using the Multilister Quick tour of the Multilister
The active tab The Multilister is actually several listers combined into one window. Think of listers in terms of the tabs you see in the Multilister when you first open it. The active tab appears on top of the others, outlined in a blue border (blue is the default color). As you move the cursor from lister to lister in the Multilister, and click in each region, you will notice the blue border outlines the lister that you click in. The active tab is the one that will be affected when you perform certain actions in the Multilister, for example, when you set Display options.
Render-node swatches There are three swatches in the General tab by default when you open the Multilister. These swatches, which are visual representations of nodes that carry specific attributes, are applied to newly created objects in your scene. For example, when you create a sphere, the sphere is assigned to the initialShadingGroup, which is by default a gray Lambert shading group. Swatches update every time you make a change in the swatch’s node network, so you can see the results of your changes immediately. Swatches are more than visual representations. They also provide a convenient way into the attribute editors of the nodes. For example, if you create a Spot light, a Spot light swatch is created in the Multilister. When you want to adjust any of the Spot light’s attribute, for example if you want to adjust the Cone Angle, double-click on the Spot light swatch to display the light’s attribute editor. You can expand and collapse swatches. Since the shading group is the highest level rendering node, that is, it is the visual culmination of all the nodes in a render node network, you may want to see a node that is connected to the shading group. By clicking on the expand button, you can quickly see which nodes are connected in a network. Double-click on any of the nodes in a network to display the attribute editor. Collapse the nodes to clean up the look of the Multilister.
Using Maya: Rendering
21
Rendering Basics
You can add items in the Multilister to the Selection List, but to do this you must turn off Highlight Mode (in the Multilister, Select → Highlight Mode). When Highlight Mode is turned off, swatches you select in the Multilister are added to the Maya Selection List, not to the Multilister Highlight List, and they are outlined in blue instead of yellow.
Using the Multilister Using Drag-and-drop connections
Using Drag-and-drop connections One of the most basic and powerful ways of connecting an attribute of one node to the attribute of another node is using the middle mouse button to drag-and-drop. Connections can occur between any two compatible attributes in Maya, that is, between two compatible input and output attributes. When you perform a drag-and-drop connection, Maya makes a default connection for you.
Drag-and-drop within the Multilister To drag-and-drop a texture onto a Phong shading group: Select a texture and use the middle mouse button to drag the texture onto a shading group to connect them. The texture is mapped to the shading group, and the result is displayed in the Multilister.
Use the middle mouse button to drag the texture onto the shading group.
Note Drag-and-drop between two swatches in the Multilister creates only basic, default connections between the color channels of the nodes. If you attempt a drag-and-drop connection that does not involve the color channels of the nodes, the Connection Editor is displayed, which lets you make arbitrary connections.
Drag-and-drop: Multilister to attribute editor You can drag-and-drop from the Multilister to a node’s attribute editor, to make non-default connections. This is a very fast way to make arbitrary connections. When you drag a node from the Multilister to an attribute editor, black boxes are displayed around compatible attributes in the attribute editor. You can drop the node from the Multilister on any compatible attribute in the attribute editor.
22
Using Maya: Rendering
Using the Multilister Assigning shading groups to objects
To drag-and-drop: Multilister to attribute editor: Double-click a shading group to open its attribute editor.
2
In the Multilister, use the middle mouse button to drag a texture onto a compatible attribute in the shading group’s attribute editor. Releasing the mouse button completes the connection.
Rendering Basics
1
Assigning shading groups to objects To assign a shading group to an object: 1
Select the object or objects in the modeling view. In the Multilister, select the shading group you want assigned, then choose Edit → Assign.
Tip To reduce the time you spend assigning shaders to objects, you can change the default shader so that every time you create an object the default shader is assigned to it. Select the shader you want. Choose Edit → Set Default Shading Group. All objects created after that will be assigned this look. You can change the default look in this way at any time. 2
Click the Shading Group button, and then select a shader. Objects with the assigned look are selected in the modeling views.
3
To assign this look to other objects, select the objects in the modeling views.
Shading Group button
Tip The Shading Group tool has two modes, shading-centric and geometrycentric. You can change the mode by double-clicking the Shading Group button, and selecting the mode you prefer in the Tool Properties window.
Using Maya: Rendering
23
Using the Multilister Creating and texturing shading groups
Creating and texturing shading groups A node is the basic building block of a look that you can assign to an object or objects. A look is the visual culmination of one or many networked nodes. When many nodes are networked together and contribute dynamically to a look, they become a shading group.
To create a shading group, texture, or light: 1
Go to the Multilister, and choose Edit → Create. The Create Render Node window is displayed, listing all the options.
Materials, Textures, Lights, and Utilities are all nodes. When you create a node, an associated icon appears in the Multilister. Toggle on With Shading Group to create a shading group of networked nodes that you can apply to an object or objects.
2
Select the tab for the kind of node you want to create. For example, if you want to create a blinn shading group, select the Materials tab. At least one new icon is created every time you create a new node. Use With Shading Group to create a shading group automatically when you create a node. For example, if you plan to assign a shading group to an object in your scene, toggle ON With Shading Group and Maya will create a shader node and a texture node and network them so you can assign the entire shading group to an object or objects.
3
Click Blinn to create a blinn shading group. A blinn icon is displayed in the Multilister.
24
4
Close the Create Render Node window.
5
To see the parameters of the blinn shading group, double-click on its icon in the Multilister.
Using Maya: Rendering
Using the Multilister Creating and texturing shading groups
Tip Use Node Inputs and Node Outputs buttons to quickly move to a shader’s input nodes or output nodes without leaving the attribute editor.
Node Input and Node Output buttons
6
In the Multilister, choose Edit → Create. The Create Render Node window is displayed.
7
Under the Textures tab in the Create Render Node window, choose between 2D, 3D, and Environment textures. Click the texture you want. A texture shading group icon appears in the Multilister. If you expand the shading group icon with the arrow in the bottom right of the icon, you’ll see a placement node, which defines how the texture is placed on the object. The texture swatch display will also reflect the placement parameters.
Using Maya: Rendering
25
Rendering Basics
The blinn’s attribute editor is displayed. When you change the blinn’s attributes, the results are reflected in the icon in the Multilister.
Using the Multilister Opening related windows and editors
8
Close the Create Render Node window.
Opening related windows and editors The Multilister brings together many functions in Maya. For example, if you want to see which connections created a shading group, you can highlight the shading group and then open any one of several windows that can provide you with information about the node. You can open the following windows from within the Multilister: •
Attribute Spread Sheet
•
Connection Editor (see Chapter 6, “Using the Connection Editor”)
•
Shading Groups Editor (see Chapter 5, “Using the Shading Group Editor”)
•
Hypergraph
To view a connection in the Hypergraph: Highlight a shading group in the Multilister. Select Window → Hypergraph Highlighted. The Hypergraph is displayed, showing the node you selected, plus its upstream and downstream connections.
26
Using Maya: Rendering
Using the Multilister Using the Shading Group tool
Using the Shading Group tool
•
You can change the tool’s properties (double-click on the tool to open its Tool Properties window) and use the tool in the Multilister.
To assign a shading group to an object: 1
Select the tool in the Multilister.
2
Click a shading group swatch. Blue highlighting surrounds the selected swatch and the objects that are assigned to the shading group are highlighted in white in the modeling window.
3
To assign a shading group to a nonhighlighted object, select the object in the modeling window.
Tip To unassign a shading group, select a highlighted object in the modeling window.
Using Maya: Rendering
27
Rendering Basics
You use the Shading Group tool to see what objects are assigned to shading groups, and to assign shading groups to objects. This tool appears in the Multilister with the following icon:
Using the Multilister Assigning shading groups to components
Shading Group tool options
Shading-centric mode This is the default mode. When you click on a shading group in the Multilister, assigned objects are highlighted in white in the modeling window.
Geometry-centric mode When you select an object in the modeling window, the shading group that is assigned to the object is highlighted in the Multilister.
Assigning shading groups to components You can use the Select by component type tool to select portions of an object and make them components of the object. For example, you can select an area of a polymesh sphere. You can then assign a shading group to the selected area or component. Once you select an area, it behaves as if it were a component.
To select and assign components of objects:
28
1
Make a polymesh sphere.
2
In the Multilister, make two shading groups, a Phong and a Blinn. In their attribute editors, pick different colors for each shading group.
Using Maya: Rendering
Using the Multilister Multilister menus Add two directional lights to the scene, so the polymesh sphere is lit from two different directions.
4
Click the Select by component type tool then click the Facets tool. Clickdrag to select the entire polymesh sphere. Then click-drag the area you want to turn into a component.
Note You can select only complete polygons (or facets) in a polyset. 5
In the Multilister, select one of the shading groups you created earlier. Choose Edit → Assign. You assigned the selected shading group to the selected component of the polymesh sphere.
6
Click the ShadingGeometryRelationshipTool in the Multilister, and select the default shading group. The other component of the polymesh sphere is selected in the modeling window.
7
Choose the Select tool from the Tool Palette, and click once in the perspective window.
8
In the Multilister, select the second shading group you made earlier, and choose, Edit → Assign.
9
In the render panel, press the right mouse button and select Render → persp. You can assign a different shading group to either component by using the Shading Group tool to select and deselect shading groups.
Multilister menus Some menu items require you to first add a swatch or swatches to the Multilister Highlight List. See “Highlight List and Selection List.”
File menu The File menu contains options that read and write information to disk, including Multilister preferences.
Using Maya: Rendering
29
Rendering Basics
3
Using the Multilister Multilister menus
Import Reads elements from another file and loads them into the current file. Items in this menu open a file browser to a specific directory within the current project. You can point the file browser to any directory. Texture/Material/ Shading Group...
Opens a file browser to the current project’s textures directory.
Light
Opens a file browser to the current project’s lights directory.
Render Scenes...
Opens a file browser to the current project’s render directory.
Export Highlighted Exports the contents of the active lister’s Highlight List into a new file. The file browser opens to its best guess directory, but can browse to any directory, or cancel, before exporting.
Export as The same as Export Highlighted, except you can choose the project directory where you want to save the file. Texture/Material/ Shading Group...
File browser opens to the current project’s textures directory.
Light...
File browser opens to the current project’s lights directory.
Render Scene...
File browser opens to the current project’s render directory.
Preferences Multilister preferences include: the number and location of tabs, their labels, filters, sort information, new cell placement, pin state, whether work area and toolbar are showing, and window proportions of the visible listers. Information not included in preferences settings: default shading group, Highlight List, work area proportion if it is not showing, work area contents (contents are only lost between Maya sessions). Save Multilister
Saves the Multilister’s current preferences.
Revert To Default
Returns the multilister to its default preferences. This is useful when you open a project that contains someone else’s preferences.
30
Using Maya: Rendering
Using the Multilister Multilister menus
Edit menu Rendering Basics
Contains options that edit parts of the current scene, usually affecting specific nodes within the Multilister and objects in Maya’s Selection List.
Assign Assigns an object or objects in the modeling view to a highlighted shading group in the Multilister. You must have a shading group highlighted and geometry selected for this option to work.
Create... Displays the Create Render Node window, from which you create materials, textures, lights, and rendering utilities.
Keyframe Set a key on the highlighted object or objects. This options has one submenu for each highlighted node, which contains the node’s keyable attributes. Choosing one sets the key.
Delete Highlighted Deletes all nodes in the Multilister Highlight List.
Delete Unused Deletes all nodes in the Multilister that are not assigned or connected to shading groups. This includes shading groups, materials, textures, utilities, and image planes.
Delete By Type Deletes specific types of objects. All in Tab
Deletes every node in the active tab.
Textures
Deletes every texture node.
Shading Groups and Materials
Deletes all shading groups and materials.
Lights
Deletes all lights.
Using Maya: Rendering
31
Using the Multilister Multilister menus
Set Default Shading Group Sets the highlighted shading group as the default shading group. All new geometry is shaded with the default shading group. Changing the default shading group does not change the color of existing geometry, only geometry created after the change. The default shading group is not a Multilister preference, and is not saved when you end the Maya session.
Map Displacement Requires that a single shading group is highlighted. Displays the Create Render Node window and maps the node you create as a displacement shader on the shading group.
Map Surface Requires that a single shading group is highlighted. Displays the Create Render Node window and makes a default connection between the shading group or its material and the node.
Map Volume Requires that you highlight a single shading group. Displays the Create Render Node window and makes a default connection between the shading group or the volume shader itself and the node.
Particle Age Map Contains options for shading software-rendered particles. Useful for using a ramp texture to define the color of a particle over the course of its life. Requires either a single particle cloud material, or a single particle cloud and an existing texture. Color
Lets you create a texture or use an existing texture to define the color of a particle as a function of the particle’s age.
Incandescence
Lets you create a texture or use an existing texture to define the incandescence of a particle as a function of the particle’s age.
Transparency
Lets you create a texture or use an existing texture to define the transparency of a particle as a function of the particle’s age.
32
Using Maya: Rendering
Using the Multilister Multilister menus
Convert Solid Texture
Link To Object Requires that you highlight a 3D TexturePlacement and select geometry in the view. Creates a connection between the placement and the geometry so that translating the object will not result in the object swimming through the texture.
Note If you deform the object, this option will not prevent the swimming.
Select menu The Select menu contains options that manipulate the Selection List or the Multilister Highlight List.
Select Assigned Requires you to highlight one or more shading groups. Selects the geometry that is assigned to the highlighted shading group.
Highlight Selected Highlights any nodes in the active tab that are connected to the selected geometry in the view.
Select Default Shaded Selects all geometry currently shaded by the default shading group. Also highlights the default shading group.
Highlight Mode When turned on, nodes selected in the Multilister are added to the Highlight List. When turned off, nodes selected in the Multilister are added to Maya’s Selection List.
Using Maya: Rendering
33
Rendering Basics
Requires a 3D texture on the Highlight List and surfaces on the Selection List. Takes a 3D texture and creates file textures, one for each mappable surface on the object. Useful to prevent an animated object from swimming through a 3D texture.
Using the Multilister Multilister menus
Note You can use the Shift and Ctrl keys to select multiple, nonadjacent nodes in the Multilister tabs.
Display menu Expand/Collapse Contains options for changing the expand/collapse state of the highlighted nodes. Expand
Expands all highlighted nodes.
Expand Al
Expands all nodes.
Collapse
Collapses all highlighted nodes.
Collapse All
Collapses all nodes.
Swatch Primitive Changes the swatch primitive of materials only. Shading groups are always spheres, and textures are always flat planes. Ball
Changes all material swatch primitives to a ball shape.
Box
Changes all material swatch primitives to a box shape.
Cone
Changes all material swatch primitives to a cone shape.
Tube
Changes all material swatch primitives to a tube shape.
Swatch Quality Affects the sampling rate and the render time of all swatches. The default is Low.
Tabs Contains options concerning the creation, deletion, and location of tabs in the Multilister. To rename a tab, double-click the tab label, type a new name, then press Enter. Create
34
Creates a new tab and puts it in the top tab group.
Using Maya: Rendering
Using the Multilister Multilister menus Creates a new tab and puts it in the top tab group. Allows the filter to be specified before creating the tab.
Move Tab Up
Deletes the active tab from the bottom group and adds it to the top.
Move Tab Down
Deletes the active tab from the top group and adds it to the bottom.
Remove
Deletes the active tab on the top group.
Rendering Basics
Create Filtered
New Items First Places newly created nodes in the top-left corner of the Multilister. By default, new items go in the bottom-right corner of the Multilister.
Always Sort When new nodes are created, they appear in their sorted positions.
Sort If Always Sort is turned off, Sort will sort all nodes in the active tab using the Sort By option.
Sort By Name
Sorts nodes alphabetically, by name.
Type
Sorts nodes alphabetically, by node type.
Reverse Order
Sorts nodes in reverse alphabetical order, from Z to A.
Show Toolbar Shows/hides the column of buttons on the left side of the Multilister.
Show Work Area Shows/hides the work area, which is a clipboard-like area at the bottom of the Multilister. The work area is a lister, and you can use the middle mouse button to drag nodes to and from it as in any other lister in the Multilister.
As Icons Displays nodes as icons or swatches, arranged from top left to lower right, in the Multilister. This is the default display.
As List Displays nodes as columns of text in the Multilister. Using Maya: Rendering
35
Using the Multilister Multilister menus
As Columns Displays nodes as icons or swatches, arranged in columns, in the Multilister.
Window menu All the options in this menu display other windows that relate to nodes in the highlighted in the Multilister.
Attribute Editor... Displays the attribute editor for the first node on the Highlight List.
Attribute Spread Sheet... Displays the Attribute Spread Sheet containing all nodes on the Highlight List.
Connection Editor... Displays the Connection Editor. You can load the Connection Editor by using the middle mouse button to drag swatches from the Multilister to the panels of the Connection Editor.
Connect Highlighted... Displays the Connection Editor with the first highlighted node on the left and the second highlighted node on the right. If more than two nodes are highlighted, only the first two are loaded. If less than two nodes are highlighted, the Connection Editor does not open.
Shading Groups Editor... Displays the Shading Groups Editor.
Hypergraph Highlighted... Displays the Hypergraph, and shows up- and downstream connections of the highlighted node.
Filter menu The Filter menu contains options that affect the contents of the active tab.
36
Using Maya: Rendering
Using the Multilister Multilister menus
Reload Rendering Basics
Removes the current contents and reloads the tab with all nodes that the tab’s filter allows.
Show Selected Removes all nodes that are connected to the currently selected geometry in the view.
Show Highlighted Removes all nodes that are not highlighted.
Hide Highlighted Removes all nodes that are highlighted.
Hide All Removes all nodes from the tab.
Always Filter When turned on, displays only new nodes that pass the current filter. When turned off, any new rendering node created is displayed. The default is on.
Apply Filter Applies only if Always Filter is turned off. Applies the tab’s filter to the contents of the tab.
Basic filter Displays only shading groups, lights, textures, and utilities.
Materials filter Displays all nodes attached to the material classifier node. By default, this filter applies to all nodes in the Materials tab in the Create Render Node window.
Texture filter Displays all nodes attached to the texture classifier node. By default, this filter applies to all nodes in the Textures tab in the Create Render Node window. Using Maya: Rendering
37
Using the Multilister Multilister menus
Using Image Files filter Displays all nodes that have that currently use an image file somewhere in their history.
Shading Groups Show All
Displays all shading groups, materials, and textures connected to shading groups.
Show All with Textures
Displays shading groups and their textures.
Show All with Lights
Displays shading groups and light nodes.
Lights Show Lights
Displays all lights that are in the scene.
Show Linked
Displays only linked lights.
Show Exclusive
Displays only exclusive lights.
Show Non Exclusive
Displays only lights that are part of the defaultLightList.
Show Non Illuminating
Displays only lights that are being ignored.
Cameras Displays cameras and image planes.
Image Planes Displays only image planes.
Utilities Displays all nodes attached to the utility classifier node. By default, this filter applies to all nodes in the Utilities tab in the Create Render Node window.
All Types Displays shading groups, lights, materials, textures, and render utility nodes.
Other This is a list of other pre-made filters, which have descriptive labels.
38
Using Maya: Rendering
Using the Multilister Multilister menus
Highlight into Work Area
Tool bar Pin button When pressed, new nodes added to the Multilister do not appear in the pinned tab. When you unpin the tab, all the nodes are displayed.
Folder View Same as Display → As Icons.
List View Same as Display → As List.
Columns View Same as Display → As Columns.
Update Button When pressed, prevents all swatches in the Multilister from updating when upstream changes are made. This is particularly useful when you are making many changes to the nodes and you do not want to wait for the Multilister to update after every change. When turned off, the Multilister swatches update normally, whenever you make an upstream change to a node.
Work Area Button Same as Display → Show Work Area.
Using Maya: Rendering
39
Rendering Basics
Loads all nodes in the Highlight List into the work area. The Work Area is a convenient place to organize nodes you work with often or nodes that are conceptually connected.
Using the Multilister Multilister menus
40
Using Maya: Rendering
The Lighting menu contains light-related commands. You can choose from four kinds of lights: Ambient, Directional, Point, and Spot. To create a light, select Lighting → Ambient. After you create a light, you can edit its attributes, its orientation, and you can create effects with them.
Ambient
Spot
Point
Directional
To edit a light’s attributes, double-click on the light’s swatch in the Multilister. The light’s attribute editor is displayed. You can watch the changes interactively in the attribute editor’s Intensity Sample. This chapter contains the following sections: •
“How lights work in Maya” on page 42
•
“Creating lights” on page 43
•
“Linking lights” on page 51
•
“Light types” on page 54
•
“Common light attributes” on page 59
Note When you render, you must have at least one light in the scene so the renderer can pick up the objects. If you render a scene with no lights, the rendering will be completely black.
Using Maya: Rendering
41
Rendering Basics
3
Lighting a Scene
Lighting a Scene How lights work in Maya
Tip Use only as many lights as necessary to achieve the look you want. Rendering many lights will increase rendering time. Make sure lights are linked and exclusive, and that the scene is as efficient as possible. See Chapter 2, “Optimizing Maya’s Renderer.”
How lights work in Maya To render an object, you must assign the object to a shading group that is linked to at least one light. In Maya, lights are linked to shading groups, not to objects. You can designate a light in three ways.
As part of the defaultLightList By default, every time you create a light, Maya puts it in the defaultLightList, which links the light to all the shading groups in the scene. When you create a new shading group, all the lights in the defaultLightList are assigned to it.
The defaultLightList
Ignored If you create a shading group that you don’t want all the lights in the defaultLightList to shine on, you can tell the shading group to ignore specific lights. You do this using the Light Linking tool (see “Linking lights” on page 51). You can link a light to as many or as few shading groups as you want.
42
Using Maya: Rendering
Lighting a Scene Creating lights
exclusive If you create a light, and want it to shine only on a particular shading group or shading groups, you can make the light exclusive (see “Linking lights” on page 51). When you make a light exclusive, the light is removed from the defaultLightList, and when you create new shading groups, the light will not light them; it only lights the shading group or groups you link it to.
Note When you make a light exclusive, it is removed from the defaultlightlist. It will not shine on anything until you link it to a shading group or groups.
This light is exclusive (it is no longer part of the defaultLightList), and it is linked to the Lambert shading group
Creating lights When you place a light in the modeling window, a light swatch appears in the Multilister. Each light type has a unique swatch. Using Maya: Rendering
43
Rendering Basics
Ambient light is ignored by the Lambert shading group, and it is linked to the Phong shading group via the defaultLightList.
Lighting a Scene Creating lights
To light an object: 1
Create an object or open a scene (File → Open Scene).
2
Choose Lighting → Create Spot Light (or Directional, Point, or Ambient). The light is displayed at the origin of the views.
3
44
Position the light using the Move tool.
Using Maya: Rendering
Lighting a Scene Creating lights Choose Shading → Smooth Shade All to shade the objects in the active view.
5
Choose Lighting → Use All Lights to see the effect the lights in your scene have on the objects.
Rendering Basics
4
As you move objects or lights in the view, the lighting changes, giving you a rough idea of how the rendered image will look.
Note Surfaces with very few spans (for example, when there is one span each in the U and V directions) at low resolution, may not appear to be affected by selecting Use All Lights. To correct this, increase the number of spans on the surface.
Using Maya: Rendering
45
Lighting a Scene Creating lights 6
Select the light in the persp view, and choose Panels → Look Through Selected.
The view changes so you are looking through the light you selected in the view. You can change the position of the light using the Track, Dolly, and Tumble tools. This is a good technique for positioning lights accurately. Select Panels → Perspective → persp to return to the persp view.
To adjust the color of a light: You can change the color of any light, or map file to the color channel of any light. 1
Select the light in a modeling view.
2
Open the Multilister by choosing Window → Multilister.... The Multilister is displayed.
46
Using Maya: Rendering
Lighting a Scene Creating lights 3
Double-click the icon of the light you want to edit. Rendering Basics
The light’s attribute editor is displayed.
Click to open the Color Chooser window
Using Maya: Rendering
47
Lighting a Scene Creating lights 4
Click the Color swatch in the Light Attributes section of the light’s attribute editor. The Color Chooser window is displayed.
Drag in the color wheel to select the color you want.
5
48
Choose a color by dragging in the color wheel, or by adjusting the Hue, Saturation, and Value sliders or the Red, Green, Blue, and Alpha sliders.
Using Maya: Rendering
Lighting a Scene Creating lights 6
Click OK. Rendering Basics
The color of the light changes, and you can see the new color in the Intensity Sample at the top of the light’s attribute editor. The light’s new color is also evident on the shaded objects in your modeling views because you turned on Lighting → Use All Lights.
To make a light cast shadows: You have to tell Maya to cast shadows in your scene. Since casting shadows takes more time to render, the default for casting shadows is off. However, if you plan to use shadows, you can create them using one of two ways: •
To create shadows without raytracing, turn on Use Depth Map Shadows in the Depth Map Shadow Attributes section of the attribute editor. The advantage of using depth-map shadows is that you can reduce rendering time. See Chapter 4, “Using Depth Map Shadows.”
•
To create shadows with raytracing, you need to turn on Use Ray Trace Shadows in the Ray Trace Shadow Attributes section of the light’s attribute editor and turn on Enable Raytracing in the Raytracing section of the Render Globals as described in the following section.
1
In the Multilister, double-click the light that you want to cast shadows. The light’s attribute editor is displayed.
Using Maya: Rendering
49
Lighting a Scene Creating lights 2
In the Raytrace Shadow Attributes section of the Shadows section in the light’s attribute editor, turn on Use Raytrace Shadows.
The Raytrace Shadow attributes are enabled, and you can adjust the number of samples, the radius (in spot light), and limits. The default shadow color is black, but you can change the color by clicking the Shadow Color swatch. 3
Close the attribute editor.
4
Choose Render → Render Globals...., and go to the defaultRenderQuality tab. The Render Quality attributes are displayed.
50
Using Maya: Rendering
Lighting a Scene Linking lights 5
Rendering Basics
Toggle on Enable Raytracing in the Raytracing section, and close the attribute editor.
Now, when you render, your light will cast shadows. 6
Select Window → Rendering Editors → Render View..., and render the view.
Linking lights After you place lights in a scene, you’ll want to link them to objects as a first step towards creating light effects. When you create a light, by default it belongs to the defaultLightList, which means that it is linked to all shading groups in the scene. You can make a light exclusive, so it shines only on a particular object or objects. Making a light exclusive removes it from the defaultLightList. To make a light exclusive, double-click on the light’s swatch in the Multilister, and click exclusive in its attribute section.
Note When you render, you must have at least one light in the scene so the renderer can pick up the objects. If you render a scene with no lights, the rendering will be completely black.
Using Maya: Rendering
51
Lighting a Scene Linking lights
Using the Light Linking tool To link lights using the Light Linking tool: 1
Create some objects and lights.
2
Assign shading groups to the objects.
3
Open the Multilister. Double-click the Light Linking tool (see “Light Linking tool options” on page 53) to open its Tool Properties window. Select lightcentric. You can also use the geometry-centric mode, but the procedure below assumes you are using light-centric. Close the Tool Properties window.
4
In the Multilister, click the Light Linking tool. The shading group that was last selected in this mode, as well as its linked lights, are outlined in blue.
5
Click a shading group swatch to see which objects are assigned to it and which lights are linked to it. Objects that are assigned to it get selected in the views. In the Multilister, linked light swatches are outlined in blue. To link a light to a shading group, select the shading group and click the light you want to link to it. This shading group has two lights linked to it.
To unlink a light from a shading group, select the shading group, then click the light you want to unlink. This shading group has only one light linked to it.
52
Using Maya: Rendering
Lighting a Scene Linking lights To link lights to the selected shading group, do one of the following:
•
Click on lights in a modeling view that are not highlighted to link them to the selected shading group. The lights are selected.
•
Click on light swatches in the Multilister to link them to the selected shading group. The linked light swatches become outlined in blue.
To unlink lights using the Light Linking tool: To unlink lights from the selected shading group, do one of the following: •
Click on selected (linked) lights in the modeling window to break the link between the light and the selected shading group. The light is de-selected.
•
Click on a light’s swatch in the Multilister to break the link between the light and the selected shading group. The unlinked light swatch is no longer outlined in blue.
Light Linking tool options You can change the tool’s properties (double-click on the tool to open its Tool Properties window) and use the tool in the Multilister.
Shading-centric mode
This is the default mode. In the Multilister, click on a shading group. In the modeling window you’ll see which geometry and lights are linked to the selected shading group.
Light-centric mode
In the modeling window, select a light. In the Multilister, you’ll see which shading group or groups the selected light is connected to.
Using Maya: Rendering
53
Rendering Basics
6
Lighting a Scene Light types
Light types When you open a light’s attribute editor, you can view and change all its attributes. Each light attribute editor has an Intensity Sample so you can view the effects of your changes interactively as you make them.
Ambient lights Ambient lights are similar to Point lights except that only a portion of the illumination emanates from the point. The remainder of the illumination comes from all directions and lights everything uniformly.
Ambient Light attributes Ambient Shade Use Ambient Shade to define the omnidirectional component of the ambient light. By setting Ambient Shade to 0.0, ambient light comes from all directions, and surfaces will show no depth definition and appear flat shaded. If set to 1.0, the ambient light comes solely from the position of the light and objects show definite edge contrast. The Ambient Shade default is 0.45.
54
Using Maya: Rendering
Lighting a Scene Light types
Directional lights
Note Because directional lights have a direction but no obvious source, using secondary rays by raytracing can give the effect of casting shadows on objects ‘behind’ the light’s apparent location in a scene. ‘
Point lights Point lights are like incandescent light bulbs—they throw off light in all directions.
Note When you are using depth-map shadows with a Point light, you can control the direction in which the light casts shadows. You do this by setting the appropriate Dmap settings in the Depth Map Shadow Attributes section of the light’s attribute editor. For example, if you use a point light to shine on a table, and you only want the light to cast shadows on objects on the table surface, only turn on the Use X- Dmap.
Using Maya: Rendering
55
Rendering Basics
Directional lights have color, intensity, and direction, but no obvious source in the scene. For example, the sun can be considered a directional light since it is far enough away from Earth that light rays emanating from it are effectively parallel. Directional lights do not decay with distance.
Lighting a Scene Light types
Decay Decay Rate Controls how quickly the light fades with distance. It can be set to a value from 0 to 3. The default setting is 0. Decay Setting
Effect
0
Light reaches everything since there is no decay.
1
Light intensity is decreased in direct (linear) proportion to the distance.
2
Light intensity is decreased inversely proportional to the square of the distance. This is how light decays in the real world.
3
Light intensity is decreased proportional to the cube of the distance. This results in light decaying faster than in the real world.
Light Effects Light Fog
Creates a lightFog node, and connects it to the point light. Fog geometry appears in the modeling window, connected to the light. The lightFog attribute editor is displayed, and you set the light fog attributes.
Fog Type
You can set Normal, Linear, or Exponential fog types. See “Light Fog.”
Fog Radius
Sets he radius of the fog. The default value is 1.0.
Fog Intensity
Sets the intensity of the fog. The default is 1.0.
Light Glow
Creates an opticalFX node in the Multilister and connects it to the point light. The opticalFX attribute editor is displayed, and you set the light glow attributes. See
56
Using Maya: Rendering
Lighting a Scene Light types
Spot lights Spot Light attributes
Cone Angle
Value that represents the measure in degrees of the angle from edge to edge of the spotlight’s beam. The valid slider range is 0.5 to 1 79.5. The default value is 40.
Penumbra Angle
Provides an alternate way to control the dropoff of the spotlight’s intensity towards the edge of the cone. The value is defined in degrees relative to the spot light’s spread. The intensity of the spotlight falls off linearly between the angle specified in Spread, and the Spread angle and Penumbra are added together. For example, a Spread of 50 degrees and a Penumbra of 10 degrees would mean that the spotlight had an effective spread of 60 (50 + 10) degrees, but the intensity of the spotlight would dropoff to 0.0 between the angles of 50 and 60 degrees. A negative penumbra maintains the effective spread angle as specified. For example, a Spread of 50 degrees with a Penumbra of -10 means that the spot light has an effective spread of 50 degrees and the intensity of the spot light would dropoff to 0.0 between the angles of 40 and 50 degrees.
Using Maya: Rendering
57
Rendering Basics
Spot lights cast light in one direction only, emanating from a point in a cone.
Lighting a Scene Light types Dropoff
Controls the rate at which light intensity decreases from the center to the edge of the spotlight beam. The valid range is from 0 to ∞. The range usually used is from 0 to 50. Values of 1.0 and less give practically identical results, that is no discernible intensity decrease along the radius of the beam. The default value is 0.0, which means there is no dropoff.
Tip Penumbra, an independent effect, can appear to have superficially similar results, but is more intuitive to control.
Barn Doors Doors or shutters fitted on the spot light, which let you create a square spot effect. The default value for all four barn doors is 20. The value represents the angle measured from the center of the spot light to the position of the barn door. The range of values is between -30 and 30. Barn Doors toggle
Activate barn doors when toggled on. The default is off.
Spotlight Preview Display Displays the shape that the spotlight will cast as seen, for example, on a wall. The shape changes when you change the values of the light’s cone angle, barn doors, and so on.
Decay Regions Use Decay Regions toggle
Toggles Decay Regions on and off. The default is off.
Region 1/2/3
Controls decay in three regions, Region1, Region2, and Region3.
Start Distance1
Defines how far out from the center of the volume the decay starts.
End Distance1
Defines how close to the center of the volume the decay gets.
Light Effects Light Fog
Creates a lightFog node, and connects it to the point light. Fog geometry appears in the modeling window, connected to the light. The lightFog attribute editor is displayed, and you set the light fog attributes.
Fog Type
Sets Normal, Linear, or Exponential fog types. See “Light Fog.”
Fog Radius
Sets the radius of the fog. The default value is 1.0.
58
Using Maya: Rendering
Lighting a Scene Common light attributes Sets the intensity of the fog. The default is 1.0.
Light Glow
Creates an opticalFX node in the Multilister and connects it to the point light. The opticalFX attribute editor is displayed, and you set the light glow attributes.
Intensity Curve
Use in conjunction with decay, as a measurement tool, or as an animation curve, with distance versus intensity.
Color Curves
Same as Intensity Curve, but with color instead of light intensity.
Common light attributes All lights have several common attributes that appear in each light’s attribute editor.
Intensity Sample section The interactive Intensity Sample displays how light attribute settings affect the selected light. When you change a value in the attribute editor, you immediately see the result in the swatch display.
Common Attributes Intensity
Defines the brightness of the light. The default is 1.0. Setting a light to 0.0 means that no light is produced. Setting a light to a negative value means that the light is removed from a scene in the area of the light’s influence.
Tip Negative intensity can be used to reduce or remove hotspots or glare. Color
Represents the color of the light. The default is white.
Tip Use the slider next to the Color box to adjust the gray value of the color in the Color box. To change the color of the light, click the color swatch next to the light’s Color attribute label. The Color Chooser window opens. Click on the color palette or enter Hue, Saturation, and Value values. Click Apply to see the result in the attribute editor’s swatch. Click OK to close the Color Chooser.
Using Maya: Rendering
59
Rendering Basics
Fog Intensity
Lighting a Scene Common light attributes You can map a texture on to the Color of a light. Click Map... to open the Create Render Node window. Add a texture node by clicking the appropriate texture button. You can add a 2D, 3D, or environment texture. exclusive
When toggled on (indicated by a check mark), objects that are linked to the light are illuminated. When toggled off, the light is non-exclusive, and is part of the defaultLightList. The default is off.
Shadows section Raytrace Shadow attributes Shadow Radius
Used for creating soft shadows. Defines the size of the light for shadowing purposes only. Shadows are generated to match a globe-shaped light source, using the specified radius. For example, a light with a small shadow radius will produce a harder, high-contrast shadow because the light rays do not “spill under” objects; whereas a larger shadow radius lets light “spill under” objects, creating less of a distinction between what is illuminated and what is in shadow. This results in softer shadows.
Shadow Samples
The number of shadow samples used to calculate a soft shadow. For example, if you have a light with a large Shadow Radius but a small Shadow Samples setting, the resulting shadow will not take advantage of the light’s large Shadow Radius.
Ray Depth Limit
The number of shadow rays required to make a shadow evident. For example, if a light does not cast the shadow you expect, the camera may be detecting several reflections and/or refractions so that it doesn’t know where to cast the shadow. In this case, calculate the number of reflections and/or refractions this light is creating, starting from the place on the object where you expect a shadow to appear. The number of reflections and/or refractions you count, plus one, is the number to use as the Ray Depth Limit in order to get the shadow you expect. See Chapter 2, “Optimizing Maya’s Renderer,” and “Raytracing shadows.”
Depth map shadow attributes See Chapter 4, “Using Depth Map Shadows.”
60
Using Maya: Rendering
Rendering an animation requires more setup than simply rendering individual frames. Once a scene is saved, you must tell Maya to render it as an animation in the Render Globals attribute editor. You can select among standard animation render options such as start/end frames, file formats, extensions, and padding. This chapter contains the following sections: •
“Rendering an animation.”
•
“Image file formats.”
Rendering an animation To render an animation: 1
Open an animation scene, and make sure it is saved.
2
Set the render quality for the scene (see Chapter 2, “Optimizing Maya’s Renderer”).
3
Open the Render Globals attribute editor, and in the defaultRenderGlobals tab, open the Renderable Objects + Cameras section. You can choose to render all the objects in your scene or just the active ones. You also must choose an image format (see Chapter 2, “Optimizing Maya’s Renderer”).
4
Select the view(s) you want to render (front, perspective, side, top). If you select more than one view, each one you choose will be rendered.
5
In the Animation section, turn on Animation.
6
Select one of the two kinds of Animation Range:
Start/End
Uses the first and last frames in your scene as the start/end frames in the animation.
Render Globals
Uses the Start Frame and End Frame and By Frame Step that you indicate.
Using Maya: Rendering
61
Rendering Basics
4
Rendering an Animation
Rendering an Animation Rendering an animation You can also specify a Start Extension, By Extension, and Extension Padding, but these are optional. If you do not modify the extension, Maya will apply the default extension scheme, by number of frames in the animation. 7
Batch render the animation (see Chapter 9, “Batch Rendering”). For information on how to view a scene after you render it, see Chapter 1, “The fcheck utility.”
Animation attributes (Render Globals) Animation
Renders a sequence of frames when turned on. When turned off, only one frame is rendered.
Animation Range
Must be used with Animation toggle turned on. You can choose between setting your own Start Frame and End Frame in Render Globals, or you can use Start/End, which uses the first and last frames in the Timeline.
Start Frame
The frame you want to be the first frame in a sequence.
End Frame
The frame you want to be the last frame in a sequence.
By Frame Step
The step or interval of frames in the sequence.
Modify Extension
When turned on, lets you change the extension of the rendered frames to anything you want.
Start Extension
The start extension number when you use Modify Extension.
By Extension
The step or interval of frames in the sequence when you use Modify Extension.
Extension Padding
Any frame padding you choose to use.
Motion Blur
Turns on motion blur attributes, which are used to tune aliasing (see “Antialiasing” on page 19).
Motion Blur By Frame
See “Anti-aliasing” on page 19.
Output Extensions Use Maya File Name
Uses the name of the scene as the prefix in each rendered frame’s name.
Use Frame Ext
Must be used in conjunction with User Input in the Out Format Control menu. Can be any format extension you choose.
62
Using Maya: Rendering
Rendering an Animation Rendering an animation
Rendering Basics
Note When naming files for an animation, avoid using periods. Instead use underscores. For example, use xxx_yyy.sgi.1
instead of xxx.yyy.sgi.1
Out Format Control As Output Format
Uses the default Maya output format.
None
Does not use a format extension.
User Input
Lets you specify any out format you choose.
Output Format Ext
User Input must be Selected. You can use any extension you want, for example, .pix.
Field Ext Control
Lets you specify None, or the standard .o and .e field extensions, or custom field extensions.
Odd/Even Field Ext
o and e are the default values, but you can use any characters you want to distinguish the even and odd fields.
Special Effects (Render Globals) Ignore Film Gate
When turned off, the film gate is respected if it intersects the viewport. When turned on, the film gate is ignored and every pixel is rendered.
Gamma Correction
Gamma correction value.
Composite
See “Compositing rendered images.”
Composite Threshold
See “Compositing rendered images.”
Clip Final Shaded Color
See “Compositing rendered images.”
Environment Fog
See “Env Fog.”
Enable Depth Maps
See “Turning depth map shadows on and off.”
Using Maya: Rendering
63
Rendering an Animation Image file formats
Resolution attributes (Render Globals: defaultResolution) Aspect Lock
When turned on locks, the aspect ratio between the resolution width and height, so that if one is modified, the other maintains the correct aspect.
Width/Height
The image resolution width and height.
Lock Device Aspect Ratio
When turned off, makes sure that there is no squeeze in the outputted image.
Device Aspect Ratio
The resolution must squeeze the image into this aspect ratio, which may be different from the resolution’s aspect ratio.
Fields
Specifies if you are going to use fields.
Odd Field First
Specifies if an odd field is first.
Zeroth Scanline
Specifies if the top or bottom is going to be used as the zeroth field.
Image file formats The Image Format menu in the Render Globals attribute editor contains the list of formats available for image file output. The default format is Maya IFF, but you can output to any file format listed in this menu. All formats, unless otherwise indicated below, put Depth into a single file in the /depth directory. GIF
Graphics Interchange Format is a data stream-oriented file format used to define the transmission protocol of LZW-encoded bitmap data. GIF images may be up to eight bits (256 colors) in depth and are always compressed.
SoftImage
RGB plus Alpha in one file, which goes in the /images directory.
RLA
A Wavefront image file format that is an indexed scanline file. RGB, Alpha, and depth all go into one file. Images with this format are stored in the / images directory. This format is also recognized by Composer.
Tiff
Tag Image File Format, contains RGB plus Alpha in one file, which goes in the /images directory. Maya generates tiff files that use TIFF-5.0 LZW compression. To generate uncompressed tiff files, set the following environment variable before starting Maya: setenv IMF_TIFF_COMPRESSION none
64
Using Maya: Rendering
Rendering an Animation Image file formats
Tiff16
Same as Tiff, but supports 16 bits per color component.
SGI
RGB and RGBA, in a single file in the /images directory.
Alias Pix
Three different file destinations possible: RGB into the /images directory; Alpha into the /mask directory; and depth into /depth directory.
Maya IFF
RGB, Alpha, and depth all go into one file. Images with this format are stored in the /images directory. This format is also recognized by Composer.
Warning RGB plus Depth is not recognized by Composer. JPEG
Joint Photographic Experts Group, a standard of the data compression of still pictures, usually with pictures coded to the CCIR 601 standard. JPEG uses DCT and offers data compression of between 5 and 100 times. Three levels of processing are defined: baseline; extended; and lossless encoding.
EPS
Encapsulated PostScript file format.
Maya16 IFF
Same as Maya IFF, but supports 16 bits per color component.
Cineon
The Cineon image file format, in which no mask is generated.
Quantel
The Quantel image file format outputs to YUV. Only NTSC and PAL resolutions are supported (720X486; 720X576); any other resolution defaults to IFF. Valid YUV field images will not be created by Maya, even though you can tell Maya to create YUV fields.
Warning The Quantel file format has only 220 levels, which makes it very sensitive when viewed on an RGB monitor.
Using Maya: Rendering
65
Rendering Basics
Uncompressed tiff files should be used when you intend to read the images into applications which require uncompressed images such as ZaP!It. Uncompressed tiff files should also be used when files are being generated for Studio, Power Animator, or any other application that supports the tiff 4.0 specification.
Rendering an Animation Image file formats
Notes When you are outputting to Composer or Zapit!, before you render you must type the following in a UNIX shell: setenv MAYA_REVERSE_FILEFORMAT_EXT
If you render to an 8-bit/pixel format, the final color is jittered slightly to reduce quantization artifacts. To turn this off, type the following in a UNIX shell: setenv MAYA_NO_JITTER_FINAL_COLOR
66
Using Maya: Rendering
The Shading Groups Editor gives you control over which geometric objects or their components are assigned to separate shading groups. This editor is primarily used for assigning polygonal facets to separate shading groups. This chapter contains the following sections: •
“Understanding the Shading Group Editor” on page 67
•
“Creating shading groups” on page 69
•
“Selecting shading groups” on page 70
•
“Adding items to a shading group” on page 71
•
“Removing items from a shading group” on page 71
•
“Renaming shading groups” on page 72
•
“Changing the color assignment” on page 72
•
“Using the Shading Groups Editor” on page 73
•
“Menu items in common with the Set Editor” on page 74
Understanding the Shading Group Editor Shading groups can be created in the Shading Groups Editor or in the Multilister. When you create a shading group, you can automatically see it in relation to other shading groups. The Shading Groups Editor works differently from the Set Editor. Shading groups cannot overlap one another—a shading group cannot include all or part of the geometry contained in another shading group. This means that components such as facets can belong only to a single shading group at a time. Unlike the Set Editor, it is easy to tell which facets are in which shading group. This is an important distinction vis-à-vis the Set Editor. Thus, the Shading Groups Editor fits well into the modeling and rendering workflow—the simple materials assigned to the shading groups of an object during modeling can easily be reassigned to more complex materials for the Using Maya: Rendering
67
Rendering Basics
5
Using the Shading Group Editor
Using the Shading Group Editor Understanding the Shading Group Editor final rendering. Using the Shading Groups Editor also makes it easy to complete the material assignments for final rendering because the parts of the geometry to be assigned a particular material. By default, all components of an object that do not belong to a shading group are gathered in a global group called the initial shading group. You can freely use the components in this holdall as the basis for creating further shading groups. So a component can belong either to the initial shading group or to a separate shading group but not to two shading groups at the same time. Unfortunately, removing items from a shading group using the Set Editor does not return them to the initial shading group. If that's all you need, though, the Set Editor works well. When you remove an item from a shading group using the Set Editor, the item does not show through in the modeling view whereas when you remove an item from a shading group using the Shading Groups Editor, an outline of where the removed item was appears and is therefore easier to notice.
This mesh has four shading groups assigned to four different parts.
So a facet has only one material assigned to it.
68
Using Maya: Rendering
Using the Shading Group Editor Creating shading groups
So the use of shading groups is a good choice if you want to visually distinguish the different parts of a model before further refining the material assignment for final rendering. As you make your model, you will notice certain parts that you’ll want to develop further; perhaps it’s the skin, eyebrows, lips, or clothes. Consider creating a shading group for each part you will be modeling. Using the Shading Groups Editor allows you to quickly identify one part of your model from another without waiting to render it because each part of your model belongs to a separate shading group.
Creating shading groups You first make a geometric object such as a polygon. For example, the shading group shown here was created from a polygonal plane primitive. You then arrange parts of the object into the shading group you want.
To create a shading group: 1
Select an object whose components you want to group as a single unit.
2
Select a component. For example, click the Select by component type button and click the right mouse button on the Facets button to select Facets from the pop-up menu (F11) or click the right mouse button on the object in a view and select Facet from the pop-up menu.
3
In a view, click and drag the left mouse button over the components such as facets that you want to form the shading group. Initially, all components are in the initial shading group and you usually select components in it for making new shading groups. However, if the components you select are already part of another shading group, then you can use Edit → Create Shading Group (force) to force these components to belong to the new shading group, removing them from the original shading group.
4
Open the Shading Groups Editor window by selecting Window → Rendering Editors → Shading Groups Editor or Window → Shading Groups Editor from the Multilister.
Using Maya: Rendering
69
Rendering Basics
Tip
Using the Shading Group Editor Selecting shading groups If no shading group has been created in your scene yet, you will see only the initial shading group item in the list. 5
Select Edit → Create Shading Group. The facets become a single group and are automatically shaded in the modeling view provided that the shaded display mode is turned on (select Shading → Smooth Shade All from the view menu bar or press 5). Because the Assign Color to New Groups option is on by default, the shading group is automatically colored in the modeling view.
Selecting shading groups You can select shading groups with or without their contents depending on the mode you choose.
To select without contents: 1
Select Window → Rendering Editors → Shading Groups Editor to display the Shading Groups Editor window.
2
Select Mode → Select. A list of shading groups is displayed. Then you can select a particular shading group to do some operation on it, for example shading groups can be renamed as their number increase or you can modify attributes of the shading group in the Attribute Editor (Window → Attribute Editor).
To select by contents: 1
Select Window → Rendering Editors → Shading Groups Editor to display the Shading Groups Editor window.
2
Select Mode → Select Contents. The list of all available shading groups appears in the Shading Groups Editor window.
3
Click a shading group you want in the list and its contents is displayed in the modeling view. You can also select the contents of consecutive shading groups by pressing Shift.
70
Using Maya: Rendering
Using the Shading Group Editor Adding items to a shading group
To display and edit shading groups by contents: Select Window → Rendering Editors → Shading Groups Editor to display the Shading Groups Editor window.
2
Select Mode → Editing.
3
Click the triangle to the left of a shading group to see its contents. When the triangle is pointing down, the shading group is expanded and you can view and edit each of the members in the shading group.
Adding items to a shading group To add items to a shading group: 1
Select a component. For example, click the Select by component type button and click the right mouse button on the Facets button to select Facets from the pop-up menu (F11) or click the right mouse button on the object in a view and select Facet from the pop-up menu. You can add only polygonal facets or whole objects to a shading group.
2
In a view, click and drag the left mouse button over the components such as facets that you want to add to the shading group.
3
In the Shading Group Editor, click the name of the shading group.
4
Select Edit → Add items.
5
The selected items are added to the shading group and are no longer in the initial shading group. By selecting Add Items (force), you can force items to be added to a shading group.
Removing items from a shading group The shading group is eliminated but the geometry is not.
To remove items from a shading group: The items you remove from the shading group you are editing are put back in the initial shading group. 1
Select a component. Using Maya: Rendering
71
Rendering Basics
1
Using the Shading Group Editor Renaming shading groups For example, click the Select by component type button and click the right mouse button on the Facets button to select Facets from the pop-up menu (F11) or click the right mouse button on the object in a view and select Facet from the pop-up menu. 2
In a view, click and drag the left mouse button over the components such as facets that you want to remove from the shading group.
3
In the Shading Group Editor, click the name of the shading group.
4
Select Edit → Remove items.
5
The selected items are removed from the shading group and put back into the initial shading group.
Renaming shading groups You can rename any existing shading groups.
To rename a shading group: 1
Click the name of the shading group This highlights the shading group.
2
Select Edit → Rename Shading Group. A window appears where you can enter a new name.
3
Enter new name for the shading group. The renamed shading group will now be available in the Shading Groups Editor window.
Changing the color assignment Shading groups are automatically colored. By default, Assign Color to New Groups in the Options menu is turned on.
To change the color: More varied effects can be created by assigning the shading group to a material such as a Phong. 1
72
With both the facets you want to group in the modeling view and the shader engine in the Multilister selected, use Edit → Assign in the Multilister.
Using Maya: Rendering
Using the Shading Group Editor Using the Shading Groups Editor
2
To see the color or the texture map on the shading group in a modeling view, select Shading → Hardware Texturing (press 6).
3
To change the color of the shading group, click the Color of the material under the Common Material Attributes section of the Phong material for example and then choose the desired color from the color chooser. With the shading group attributes showing the Attribute Editor (select Mode → Select and then Window → Attribute Editor), you can re-assign another material to the shading group.
Assigning a single material to many shading groups One slick thing you can do with the Assign Color to New Groups in the Options menu is turn it off. Say you have 100 objects in your scene and you want each object to be lit using a separate light without having to assign 100 materials to 100 separate shading groups. Turn off Options → Assign Color to New Groups and use Edit → Create Shading Group as you normally would. As you create shading groups, they are all assigned to a single material such as a Phong. By default, this is the material assigned to the initial shading group. When you are ready to use the light lists or other properties, you can get all those objects lit using the light lists of the different shading groups even though only a single material is used for all the shading groups.
Using the Shading Groups Editor Clicking the left mouse button on items in the menu bar gives you access to the commands. You can also access these commands by clicking the right mouse button within the window to display the pop-up menus.
Mode menu Once you select a shading group, you can select one of three modes for manipulating it: Editing
Lets you modify the selected shading group.
Select Contents
Shows the geometry assigned to a shading group.
Using Maya: Rendering
73
Rendering Basics
The newly created shading group is assigned for example to the color of the material you assign or to any texture you want.
Using the Shading Group Editor Using the Shading Groups Editor Select
Selects shading groups.
Edit menu Choose any of the following: Create Shading Group
Includes the selected polygonal facets into a shading group unless the selected items are already assigned to a non-default shading group.
Create Shading Group (force)
Forces selection in the newly created shading group even if it is already assigned to a shading group other than the initial shading group. Because a component can belong to only one shading group at a time, the items are removed from the original shading group and placed in the new shading group that you are going to create.
Add Items
Adds selected items to the shading group that is currently selected.
Add Items (force)
Adds selected components to the currently active shading group even if they are already in a shading group other than the initial shading group. Because a component can belong to only one shading group at a time, the items are removed from the original shading group and placed in the new shading group that you are adding to.
Remove Items
Removes selected items from the currently selected shading group and puts them back in the initial shading group.
Delete Shading Group
Deletes the selected shading group.
Rename Shading Group
Renames the selected shading group.
Shading Group Attributes
Displays the Attribute Editor.
Options menu Assign Color to New Groups
Each time you create a new shading group, it is colored, making it easy to distinguish from other shading groups.
Menu items in common with the Set Editor Because the rest of the menu options are the same as for the Set Editor, see the Sets part of the Using Maya: Hypergraph, Sets & Expressions book for details on sets.
74
Using Maya: Rendering
Rendering Basics
6
Using the Connection Editor This chapter contains the following sections: •
“Loading the Connection Editor” on page 76.
•
“Navigating a node network” on page 76
•
“Making connections” on page 78.
•
“Breaking connections” on page 84.
•
“Connection Editor menu and button options” on page 85. The Connection Editor presents node network information in a side-by-side layout, which allows you to view two nodes that are connected in a node network. You can make and break shading network connections in the Connection Editor. This editor is particularly useful for fine-tuning a shading network. The Connection Editor is the best a tool for making non-default connections because you can easily and quickly traverse from node to node in a network. You can configure the Connection Editor to show you a node’s outputs or inputs, which means you can make connections in either direction in a node network. In the Connection Editor, you can navigate up a network to a fork, and then navigate down a different prong, as in the case where you have a texture outputting to two shading groups.
This view of the Hypergraph shows a checker texture node outputting to two shading groups. Using the Connection Editor, you can navigate and make connections anywhere along the node’s network.
Using Maya: Rendering
75
Using the Connection Editor Loading the Connection Editor
Loading the Connection Editor Before you can make or break connections between two networked nodes, you need to load the Connection Editor with the node network. There are four ways to load the Connection Editor:
From the Multilister In the Multilister, use the middle mouse button and Shift-drag one node onto another node (for example, drag a texture onto a shader). This action loads the two nodes to the left and right sides of the editor, respectively.
Drag from Multilister to Connection Editor In the Multilister, use the middle mouse button to drag a node into the left or right side of the Connection Editor.
Drag from one side to the other In the Connection Editor, use the middle mouse button to drag a node from one side to the other.
Using the Reload Left/Right buttons Loads the currently selected node into the left or right side of the editor.
Navigating a node network When you load a networked shading node into the left or right side of the Connection Editor, you can navigate up or down the node network, using either the navigating buttons or the right mouse button.
Using the Navigating buttons The navigating buttons load the node upstream or downstream from the currently loaded node. For example, when you load a networked shading node into the left side of the Connection Editor, you can use the right mouse button to click the right navigating button and see all the nodes that the selected node outputs to.
76
Using Maya: Rendering
Using the Connection Editor Navigating a node network
Using the right mouse button You can click the right mouse button over a connected attribute to display a menu of connected nodes. Selecting one of the nodes loads the node into the Connection Editor. For example, if you have a Ramp texture connected to several shading groups, you can click the right mouse button over the ramp’s Out Color and see the nodes that are in the network. Selecting one of the nodes loads it into the right side of the editor. Position the pointer over the Out Color attribute text, and use the right mouse button to display a list of the nodes that are in the network. Selecting one of the nodes in the list loads the node into the Inputs side of the Connection Editor.
Using Maya: Rendering
77
Rendering Basics
Use the right mouse button to click over the right navigating button to see all the downstream nodes in the network.
Using the Connection Editor Making connections
Making connections You can explicitly connect any two compatible attributes using the Connection Editor. For example, you can connect a particular texture attribute to a particular material attribute. When you highlight an attribute in the Output side, all the compatible (or valid) attributes are listed on the Input side. Non-compatible attributes are disabled, as shown below.
Noncompatible attribute Compatible attribute
78
Using Maya: Rendering
Using the Connection Editor Making connections
Rendering Basics
Note Some attributes are compound, meaning that several attributes together form a larger attribute (for example, Out Color is a compound attribute that is made up of Out Color R, Out Color G, and Out Color B). Just because a compound attribute is disabled, does not mean that the attributes that form it are also disabled. You must can expand the compound attribute to see if all the attributes within it are disabled or compatible.
Making connections: The procedure You have the option of making connections either manually or automatically. See “Options menu” on page 85.
To make connections using the Connection Editor: 1
In the Multilister, press Shift and use the middle mouse button to drag a texture onto a shading group (see “Quick tour of the Multilister” on page 19). The Connection Editor appears and displays the output attributes of the texture and the input attributes of the shading group.
2
Click on any attribute on the Output side of the editor. The Input side displays all the valid attribute connections that can be made. Nonvalid Input connections are disabled. Using Maya: Rendering
79
Using the Connection Editor Making connections 3
Click on any valid attribute on the Input side of the editor. The highlighted text changes from normal to bold-italics, indicating that the connection is made.
The checker texture is the upstream node, and it provides the output attributes to the shading group node. You can change the direction of the connections shown by clicking the from → to button.
When you make a connection between an output attribute and an input attribute, the input attribute text changes from normal to bold-italics.
80
Using Maya: Rendering
Using the Connection Editor Making connections
Making connections: an example
1
Create a phong shading group, a checker texture, and a ramp texture using the Create Render Node window (in the Multilister, select Edit → Create...).
2
Use the middle mouse button to drag the checker texture onto the phong shading group.
The phong shading group icon changes to reflect the checker texture’s input.
Using Maya: Rendering
81
Rendering Basics
To connect ramp outcolor to checker color1:
Using the Connection Editor Making connections 3
Expand the phong shading group so you can see the phong material icon and the checker texture icon.
Click here to expand the phong shading group’s icon.
4
Press Shift and use the middle mouse button to drag the ramp texture icon in the Textures tab onto the checker texture in the General tab. The Connection Editor is displayed, with the ramp attributes on the left (Output side) and checker attributes on the right (Input side).
Tip You can also use the middle mouse button and drag the ramp texture onto the checker texture in the Textures tab of the Mulitilister.
82
Using Maya: Rendering
Using the Connection Editor Making connections 5
Click on the ramp’s Out Color attribute.
Click here to see the checker’s valid input connections from the ramp. These are the checker’s valid input connection attributes for the ramp’s Out Color.
Using Maya: Rendering
83
Rendering Basics
The compatible (or valid) attribute connections you can make to the checker texture are enabled.
Using the Connection Editor Breaking connections 6
Click the checker texture’s Color1 attribute to connect it to the ramp texture’s Out Color.
The checker’s Color1 attribute text changes from normal to bold-italics, indicating that the connection between it and the ramp’s Out Color is made.
The result is that the ramp’s Out Color is mapped to the checker’s Color1 input.
Breaking connections You break connections the same way you make them. You have the option of breaking connections either manually or automatically. (see “Options menu” on page 85).
To break a connection using the Connection Editor: 1
Open the Connection Editor by pressing the Shift key and using the middle mouse button to drag a texture onto a shading group. The Connection Editor is displayed.
2
84
Select the Output attribute of the connection you want to break.
Using Maya: Rendering
Using the Connection Editor Connection Editor menu and button options The Input attribute of the connection is highlighted. Click on the highlighted text of the Input attribute to break the connection. The text changes from bold-italics to normal when the connection is broken.
Tip To make or break connections manually, select Options and toggle OFF Auto-connect. The Break and Make buttons become enabled, and you can use them to manually make and break connections. You can also break connections in the attribute editor, by placing the right mouse button over the label of the attribute you want to disconnect, and selecting Break Connection.
Connection Editor menu and button options Options menu Auto-connect
When toggled on, lets you make and break connections automatically by clicking on input attributes. When toggled off, lets you make and break connections manually by selecting attributes and using the Break and Make buttons to make and break connections.
Left/Right Side Filters menu Show Readable
Lists all the readable attributes (attributes that are outputs or both outputs and inputs).
Show Outputs Only
Lists only the node’s output attributes.
Show Inputs Only
Lists only the node’s input attributes.
Show NonKeyable
When toggled off, shows only the node’s keyable attributes. When toggled on, shows both keyable and non-keyable attributes.
Show Connected Only
Lists only the node’s connected attributes.
Show Hidden
When toggled off, hidden attributes are not shown. When toggled on, both hidden and visible attributes are shown. Using Maya: Rendering
85
Rendering Basics
3
Using the Connection Editor Connection Editor menu and button options
Reload Left/Right buttons Load the currently selected node(s) into the left or right side of the editor.
from → to button Changes the direction in which you make connections. By default, node outputs appear on the left side with node inputs on the right. Clicking the from → to button reverses this setup. The from → to button changes the direction in which you make connections.
When the direction of the connection is from the left side to the right side, outputs are shown on the left and inputs are shown on the right side of the editor.
When the direction is reversed, inputs are shown on the left and outputs are shown on the right. Notice that the checker’s valid Inputs are different than its valid outputs.
Node network navigating buttons Navigating buttons
86
Using Maya: Rendering
Using the Connection Editor Connection Editor menu and button options
For example, if you have a phong material loaded in the right side of the editor, and you click the downstream button, the phong material gets loaded in the left side of the editor, and the phong shading group node is loaded into the right side.
Tip You can click the right mouse button over the Navigating buttons to see what other nodes are connected in the node network, and to navigate to those nodes.
Clear All Removes all the nodes from both sides of the Connection Editor.
Remove Removes the node(s) from the side of the Connection Editor that was last selected. You can traverse upstream or downstream from the remaining node after you remove a node. Using Maya: Rendering
87
Rendering Basics
Load the next node in the node network into the Input and Output sides of the editor.
Using the Connection Editor Connection Editor menu and button options
Break Allows you to manually break connections. Options → Auto-connect must be turned off in order for this button to work.
Make Allows you to manually make connections. Options → Auto-connect must be turned off in order for this button to work.
88
Using Maya: Rendering
The Relationship Panel (Lighting → Relationship Panel) is a text-based tool that performs functions similar to the Light Linking and Shading Group tools located in the Multilister.
The Relationship Panel has many of the same features as the Outliner (Windows → Outliner, see Using Maya: Basics). In addition, you can use the Relationship Panel to select objects and lights in your scene. You can also create shading groups in the Relationship Panel. The chapter contains the following sections •
“Selecting objects and lights” on page 90
•
“Light linking” on page 90
•
“Assigning shading groups to objects” on page 93
Using Maya: Rendering
89
Rendering Basics
7
Using the Relationship Panel
Using the Relationship Panel Selecting objects and lights
Selecting objects and lights As with the Outliner, you can select objects and lights by using the Relationship Panel.
To select objects and lights: 1
Create a scene that has objects and lights.
2
Select Lights → Relationship Panel. Objects and lights in your scene are displayed on the left side of the panel. You can filter the left side of the panel so you only see the nodes you want to see (see the Outliner, in Using Maya: Basics).
3
Click on a light or an object. The light or object gets selected in the view. You can select many lights and objects at once by dragging over the ones you want to select (use Shift or Ctrl to select multiple, nonadjacent objects).
Light linking There are two ways to link lights in the Relationship Panel: using Single Selection or Multiple Selection.
To link lights using Single Selection: 1
90
Select List → Single Selection (you can also use the right mouse button in the right side of the panel).
Using Maya: Rendering
Using the Relationship Panel Light linking 2
Select Mode → Light Lists.
This object is connected to the initialShadingGroup Highlighted labels indicate that lights are linked to an object Click to unlink No highlight indicates light is not linked Click to link
3
Click the text of a light on the right side to link it to the object. Click again to unlink it.
Note Remember, lights are connected to shading groups, not to objects, so the objects you see listed on the left side are actually objects that are assigned to shading groups.
To link lights using Multiple Selection: 1
Select List → Multiple Selection (you can also use the right mouse button in the right side of the panel).
2
Select Mode → Light Lists.
Using Maya: Rendering
91
Rendering Basics
On the left side of the panel, lights and objects are displayed. When you select an object on the left side, the selected object and all the lights in the scene are displayed on the right side.
Using the Relationship Panel Light linking 3
Select one or multiple objects on the left side of the panel (use Shift or Ctrl to select multiple, nonadjacent objects). The objects are displayed on the right side of the panel. When you expand them, the lights that are linked to them are displayed.
Expand to see lights connected to objects. Use the middle mouse button to drag a light to an object.
4
92
To link a light to a shading group, use the middle mouse button to drag a light from the left side onto the text of the object on the right side. You can also drag lights from object to object on the right side of the panel. To unlink lights, select the light, then use the right mouse button to select Edit → Remove Items.
Using Maya: Rendering
Using the Relationship Panel Assigning shading groups to objects
Assigning shading groups to objects Rendering Basics
You can create shading groups and assign them to objects in the Relationship Panel.
To create a shading group: 1
Select Lighting → Relationship Panel.
2
Select List, and turn on All Shading Groups.
3
In the Relationship Panel, select Edit → Create Shading Group (you can also use the right mouse button in the right side of the panel). The new shading group is displayed on the right side of the panel, labeled Set1, Set2, and so on. You can change the label by double-clicking on it, and typing a new name. Press Enter to accept the new name. You can assign the shading group to an object (see below).
To assign a shading group to an object: 1
Select List → Multiple Selection, and turn on All Shading Groups, so you can see all the shading groups you create and those already created.
2
Select Mode → Shading Lists.
Using Maya: Rendering
93
Using the Relationship Panel Assigning shading groups to objects 3
Select an object on the left side of the panel, for example, a nurbsShpere. Use the middle mouse button to drag the object onto a shading group’s text in the right side of the panel. You may have to expand the shading group to see the object. The shading group is now assigned to the object. To unassign a shading group, highlight the object on the right side of the panel, and use the right mouse button to select Edit → Remove Items.
94
Using Maya: Rendering
Rendering Flags Selecting objects, textures, and materials
Rendering Basics
8
Rendering Flags The Rendering Flags window (Window → Rendering → Editors Render Flags) lets you select objects, textures, lights, materials, and so on. You can also set the attributes for these nodes.
This chapter contains the following sections: •
“Selecting objects, textures, and materials” on page 95
•
“Setting Rendering Flags” on page 96
Selecting objects, textures, and materials You can select objects, lights, dynamics, cameras, textures, and materials. The procedure is the same for all.
To select objects: 1
Open a scene.
2
Select Window → Rendering Editors → Rendering Flags.
3
In the Show menu, select the node category you want to display, for example, Objects. The objects in your scene are displayed on the left side of the panel.
4
Select an object by clicking its label. Using Maya: Rendering
95
Rendering Flags Setting Rendering Flags The object is selected in the views. You can select multiple, nonadjacent objects using the Shift or Ctrl keys. The object’s flags, or attributes, are displayed on the right side of the panel.
Setting Rendering Flags You can set rendering flags, or attributes of objects, lights, dynamics, cameras, textures, and materials. The panel is similar to the Outliner (see Outliner in Using Maya: Basics).
To set attributes: 1
Open a scene.
2
Select Window → Rendering Editors → Rendering Flags
3
In the Show menu, select the node category you want to display, for example, Objects. The objects in your scene are displayed on the left side of the panel.
4
Select an object by clicking its label. The object is selected in the views. You can select multiple, non-adjacent objects using Shift or Ctrl keys. The object’s flags, or attributes, are displayed on the right side of the panel.
5
96
On the right side of the panel, you can turn attributes on or off and set numerical values.
Using Maya: Rendering
Rendering Flags Setting Rendering Flags
Rendering Basics
Note You can also set rendering attributes in the Spreadsheet, in render node attribute editors, and in the Channel Editor.
Using Maya: Rendering
97
Rendering Flags Setting Rendering Flags
98
Using Maya: Rendering
Rendering Basics
9
Batch Rendering This chapter contains the following sections: •
“Batch rendering from the command line” on page 99
•
“Batch rendering within Maya” on page 102 Batch rendering allows you to render a series of images in an animation. Use the batch render option when you are ready to render an entire animation using the full power of your workstation. The batch renderer does not require the use of Maya’s user interface. Since batch rendering consumes memory, we do not recommend that you perform batch rendering concurrently with an interactive Maya session. You can batch render within Maya or from the UNIX command line.
Batch rendering from the command line Ideally, perform your batch rendering on a dedicated machine from the command line. This allows you to continue working in Maya on another machine while you perform the batch render. You can specify a number of options from the command line. See the table on the following pages for a complete list of batch render options.
To batch render from the command line: At the command prompt, type: Render
where is (generally) a Maya ASCII or Maya Binary file, and is one or more of the options in the following table:
Use...
For...
-s
start frame for the rendered animation sequence
-e
end frame for the rendered animation sequence
Using Maya: Rendering
99
Batch Rendering Batch rendering from the command line
Use...
For...
-b
by frame for the rendered animation sequence
-be
by extension (or step) for the output image frame file name extension
-se
starting number for output image frame extensions
-rd
the directory to store pix/depth file
-im
image file output name
-p
image file output name (identical to -im)
-me
append Maya filename to image name
-mf
append image file format to image name
-d
depth file output name
-ar
aspect ratio for the rendered image
-sa
shutter angle for motion blur (1-360)
-uf
use the tessellation file cache
-oi
dynamically detects similarly tessellated surfaces
-rut
reuse render geometry to generate depth maps
-edm
enable depth map usage
-ert
enable raytracing
-rfl
maximum raytracing reflection level
-rfr
maximum raytracing refraction level
-sl
maximum raytracing shadow ray depth
-eaa
the anti-aliasing quality of EAS (Abuffer). One of: highest, high, medium, or low
-ufil
in on, use the multi-pixel filtering, otherwise use single-pixel filtering
-ss
global number of shading samples per surface in a pixel
100
Using Maya: Rendering
Batch Rendering Batch rendering from the command line
For...
-mss
maximum number of adaptive shading samples per surface in a pixel
-mvs
number of motion blur visibility samples
-mvm
maximum number of motion blur visibility samples
-vs
global number of volume shading samples
-pss
number of particle visibility samples
-rct
red channel contrast threshold
-gct
green channel contrast threshold
-cct
pixel coverage contrast threshold (default is 1.0/8.0)
-cam
all subsequent -im -p -d -ar -sa flags apply only to
-g
gamma value
-ifg
use the film gate for rendering
-ih
height of image in pixels
-iw
width of image in pixels
-mm
allows you to specify the maximum memory used by the renderer
-mb
motion blur on/off
-mbf
motion blur by frame
-of
output image file format (one of the following: gif, si soft softimage, rla wave wavefront, tiff tif, tiff16 tif16, sgi rgb, alias als pix, iff tdi explore, jpeg jpg, eps)
-pad
number of digits in the output image frame extension
-verbose
perform the render verbosely if on
-x
set the X resolution of the final image
-y
set the Y resolution of the final image
-xl
set the X subregion left pixel boundary of the final image
Using Maya: Rendering
Rendering Basics
Use...
101
Batch Rendering Batch rendering within Maya
Use...
For...
-xr
set the X subregion right pixel boundary of the final image
-yl
set the Y subregion low pixel boundary of the final image
-yh
set the Y subregion high pixel boundary of the final image
Batch rendering within Maya Use Batch Render to batch render small or test scenes from within Maya. For larger scenes, batch render from the command line (see “Batch rendering from the command line” on page 99). For information on how to view a scene after you render it, see Chapter 1, “The fcheck utility.”
To batch render from within Maya: 1
Choose Render → Batch Render The Batch Render window is displayed.
2
Enter the name of a Maya file you want to have written from to batch render, and click Batch Render. By default, Maya renders the animation images into the /images directory. The status of the rendering appears in the status bar in the lower right corner of the Maya window.
To batch render on a remote machine:
102
1
Save your scene.
2
Select Render → Batch Render - ❐.
3
Type the name of the machine on which you intend to render.
Using Maya: Rendering
Batch Rendering Batch rendering within Maya Select a Rendering CPU, either Local or Remote (this determines which machine’s processor is used).
5
Click Batch Render. The Batch Render (default) window is displayed.
6
Type the name of the file you want to batch render. If you type the same name you saved in Step 1, Maya will prompt you to confirm you want to overwrite that file. Type a new name if you want to render the file under a different name.
7
Click Batch Render. Watch the status line for the status information about the render.
To view the batch render: Choose Render → Show Batch Render. The view render window is displayed. You can now watch individual frames of a batch render during the rendering process.
To cancel the batch render: Choose Render → Cancel Batch Render. Maya prompts you to confirm. You can cancel a batch render at any time.
Using Maya: Rendering
103
Rendering Basics
4
Batch Rendering Batch rendering within Maya
104
Using Maya: Rendering
You can attach image planes to a perspective camera in an animation to create depth of field in a scene. You can also attach them to an orthographic camera and use them for modeling or rotoscoping. An image plane is useful only once you attach it to a camera. Start by creating a camera for the scene, then create an image plane and attach it to the camera you created. This chapter contains the following sections: •
“Creating a camera” on page 105
•
“Attaching an image plane” on page 107
•
“Loading an image” on page 110
•
“Deleting image planes” on page 110
•
“Loading a scene in the image plane” on page 111
•
“Image plane attributes” on page 113
Creating a camera You can create one, two, and three-node cameras in Maya. With a one-node camera, you can animate the orientation and position. With a two-node camera, you can animate the position and look at point of the camera.
To create a one-node camera: You can create cameras within Maya in one of two ways: From the Primitives menu
Select Primitives → Create Camera. A camera appears at the origin in the views, with the translate manipulators displayed so you can immediately position the camera where you want it.
Using Maya: Rendering
105
Rendering Basics
10
Using Image Planes
Using Image Planes Creating a camera
From the Panels menu
•
In a view, select Panels → Perspective → New. A camera is created, and you are automatically looking through the new camera, so the view is labeled persp1. To look through the default persp view so you can see the camera you just created, select Panels → Perspective → persp. You can translate the new camera by entering X, Y, and Z values in the translate fields of the Channel Box.
To create a two-node camera: 1
Select Primitives → Create Camera - ❐. The Create Camera Options window is displayed.
106
2
In the Animation Options section, select the Two node radio button.
3
Click Create, and then click Close.
Using Maya: Rendering
Using Image Planes Attaching an image plane
Attaching an image plane Rendering Basics
You can use 2D, 3D, and Environment textures with image planes.
Note Using a 3D or Environment texture with an image plane may cause the texture to swim if the camera is animated. To resolve this, you must link the texture to the camera, so the texture follows the camera in the animation. To link the texture to the camera, parent the place3dTexture node to the animated camera.
Using the Multilister To attach an image plane to a camera: 1
Create a camera for the scene.
2
Select Window → Multilister to open the Multilister, then go to the Cameras tab. You will see the CameraShape or perspShape2 icon for the camera that you just created.
3
Double-click the new camera icon to open the camera’s attribute editor.
Using Maya: Rendering
107
Using Image Planes Attaching an image plane 4
In the Environment section, click Create next to Image Plane.
The image plane’s attribute editor appears, and an icon for the image plane appears in the Multilister. The icon is black, indicating that there is no image currently loaded in the image plane. The image plane you create is attached to the camera you created. You must load an image or a texture. For more information on loading an image or a texture, see “Loading an image” on page 110.
Tip To attach an orthographic image plane for modeling purposes, click the Fixed radio button next to Image Plane in the Image Plane Attributes section of the image plane’s attribute editor. To attach a perspective image plane, click the Attached To Camera radio button.
Note You can change the name of the camera by using the attribute editor or by double-clicking the text under the icon in the Multilister and then entering a new name.
108
Using Maya: Rendering
Using Image Planes Attaching an image plane
Using drag and drop Rendering Basics
To attach an image plane using drag and drop: 1
Create a camera for the scene.
2
In the Mulitilister, use the right mouse button → Edit → Create. The Create Render Node window is displayed.
3
Go to the Utilities tab, then click Image Plane in the Image Planes section. An image plane icon is displayed in the Textures and Cameras tabs in the Multilister.
4
Use the middle mouse button to drag the image plane icon onto a camera icon in the Cameras tab.
Using Maya: Rendering
109
Using Image Planes Loading an image The image plane is connected to the camera. You must load an image or a texture.
Loading an image To load an image into an image plane: 1
Create a camera and attach an image plane to it.
2
Double-click the image plane icon in the Multilister to open the image plane’s attribute editor.
3
In the Image Plane Attributes section, click Browse next to Image Name, select the image file (or type the path and name of the image file in the field), and click Open. The image you selected appears in the Image Plane Sample in the imagePlane attribute editor and in the image plane icon in the Multilister. You can adjust the Coverage, Size, Offset, Depth, Center, Width and Height attributes of the image plane in the Placement section of the attribute editor.
Tip To see the image on the image plane in your views, select Shading → Smooth Shade All.
Deleting image planes To delete an image plane: 1
In the Multilister, go to the Cameras tab, and select the image plane you want to delete. The dotted yellow line surrounding the cameral icon indicates that the selected image plane is attached to that camera.
110
Using Maya: Rendering
Using Image Planes Loading a scene in the image plane 2
Use the right mouse button → Edit → Delete Highlighted. Rendering Basics
The image plane is deleted from the Multilister and from the views.
Note You can also delete an image plane by using the Select by component type button. Select the image plane you want to delete in a view, then press Delete. The image plane is deleted from the views and from the Multilister.
Loading a scene in the image plane To load a scene in the image plane: 1
Create a camera for the scene (see “To create a one-node camera:” on page 105).
2
Attach an image plane to the camera (see “To attach an image plane using drag and drop:” on page 109).
3
In the Placement section of the image plane’s attribute editor, change the Depth to 20 from 100.
4
In the Image Plane Attributes section, click Browse next to Image Name, or type in the path and file name of the image you want to load.
Using Maya: Rendering
111
Using Image Planes Loading a scene in the image plane When you are rotoscoping, you must enter one image file from a series of image files that are part of a scene or animation. The image is displayed in the Image Plane Sample in the attribute editor.
Tip To see the image on the image plane in your views, select Shading → Smooth Shade All. 5
Toggle on Use Frame Extension. The Frame Extension box is enabled.
6
112
In the Timeline, make sure you start on time 1 (see Using Maya: Animation).
Using Maya: Rendering
Using Image Planes Image plane attributes In the image plane attribute editor, set a key for time 1 by clicking the right mouse button over the Frame Extension label, and selecting Set key.
8
In the Timeline, go to the last time. For example, if the Timeline has 24 seconds, go to time 24.
9
Enter the number of the last image in the series on the Frame Extension box. The image plane in the view updates, displaying the image file you just entered.
10 Set a key. You can play the animation by clicking the Play button in the Timeline.
Image plane attributes Display
Selects where you see the image plane from: looking through camera or in all views.
Display Mode
Selects the image plane’s display mode: one of: None, Outline, RGB, RGBA, Luminance, Alpha. Using Maya: Rendering
113
Rendering Basics
7
Using Image Planes Image plane attributes Color Gain
The color gain.
Color Offset
The color offset.
Alpha Gain
Scale factor for the alpha channel.
Image Plane
Determines where the image plane is created, either Attached to Camera or Fixed.
Type
Either Image File or Texture.
Image Name
If you use an image file, you can browse for the name, or enter the name in the Image Name field.
Use Frame Extension
Off by default. When on, you can use a Frame Extension number.
Frame Extension
The frame extension number.
Texture
Maps a texture to the image plane if you click Map. The texture is not displayed in the views, and its placement is a texture placement, not the placement of the image plane. Use the > button to navigate to the upstream node. Click the Map button a second time to break a connection and/or make a new connection.
Placement attributes for attached image planes An attached image plane moves relative to the camera. This is the default image plane created on perspective cameras. Size
The width and height of the image plane as measured in the camera’s film back (inches). The image plane will be clipped if the size is greater than the camera’s film aperture.
Squeeze Correction
Horizontal stretch to apply. Can be used to compensate for lens squeeze ratio and device squeeze ratio when image plane matching.
Offset
The width and height to offset the center of the image plane in the camera’s film back.
Depth
The distance the image plane is from the camera’s eye point along the view vector.
114
Using Maya: Rendering
Using Image Planes Image plane attributes
Placement attributes for fixed image planes
Center
The center position of the image plane in world space.
Width
The width of the image plane in world space.
Height
The height of the image plane in world space.
Image plane fit Fill
Ensures the image fills the entire coverage rectangle (defined by image plane’s size if the image plane is attached, or the width and height if the image plane is fixed). The image aspect ratio is maintained. The image may extend horizontally or vertically past the coverage rectangle.
Best
Ensures the image fits inside the entire coverage rectangle. The image aspect ratio is maintained.
Horizontal
Ensures the horizontal width of image is inside the coverage rectangle. The image aspect ratio is maintained, and the image may extend vertically past the coverage rectangle.
Vertical
Ensures the vertical height of the image is inside the coverage rectangle. The image aspect ratio is maintained, and the image may extend horizontally past the coverage rectangle.
To Size
The image will fill the entire coverage rectangle and the image aspect ratio is not maintained (the image will be stretched).
Image plane crop Allows the user to extract a sub-region from the input image. Coverage X
Specifies the number of horizontal pixels to include in the sub-region.
Coverage Y
Specifies the number of vertical pixels to include in the sub-region.
Coverage Origin X
Horizontal offset in pixels to the bottom left corner of the sub-region.
Coverage Origin Y
Vertical offset in pixels to the bottom left corner of the sub-region.
Using Maya: Rendering
115
Rendering Basics
A fixed image plane is independent of the camera, and occupies a fixed position in world space. The image plane automatically orients itself to face the camera when the camera moves, and is well suited for tracing. Fixed image planes are created by default for orthographic cameras.
Using Image Planes Image plane attributes
116
Using Maya: Rendering
Partial image rendering lets you render a specific part of an image, for example, if you adjust a parameter and want to see the effect on a particular part of an image, without rendering the whole image again. This can save time during the testing stages of your rendering. This chapter contains the following sections: •
“Rendering part of an image” on page 117
•
“Test settings menu” on page 119
Rendering part of an image To render part of an image, you must start with a rendered image in the Render View window.
To render part of an image 1
Open the Render View window, and render an image (use the right mouse button → Render → persp). Wait for the image to be completely rendered.
Using Maya: Rendering
117
Rendering Basics
11
Partial Image Rendering
Partial Image Rendering Rendering part of an image 2
Make any changes to the parameters of the object or scene you are working on.
3
Using the left mouse button, drag a marquee around the part of the previous image you want to render.
A red marquee is displayed around the part of the image you want to render. 4
118
Use the right mouse button → Test settings → Test resolution → Render Globals (256x256).
Using Maya: Rendering
Partial Image Rendering Test settings menu 5
Use the right mouse button → Render region.
Test settings menu The Test Settings menu contains items to help you customize your test render scenarios. Set the test resolution for the Render View window.
Test resolution
•
Camera panel
•
Render globals (256x256)
•
50% globals (128x128)
•
25% globals (64x64)
•
10% globals (25x25)
Auto resize
Prevents the Render View window from resizing the image each time you render.
Auto render region
When this is set, renders the image as soon as you finish dragging a marquee in the Render View window.
Redo last takes region
Renders the last region that was rendered.
Using Maya: Rendering
119
Rendering Basics
Only the part within the red marquee is rendered. The rest of the image is still displayed in the Render View window.
Partial Image Rendering Test settings menu Show region
120
Displays the red marquee in the Render View window. The marquee disappears when you render at full resolutions, so to see the marquee, you must use Show region.
Using Maya: Rendering
Rendering Basics
12
Animating Render Node Attributes You can animate render nodes and their attributes (for example, a light’s intensity or a texture’s bump value) in Maya. Animating render node attributes has a simple workflow, and can be done in a few simple steps.
Animating render node attributes The following example describes how to animate the Intensity of a light. The same procedure works for all render node attributes, whether you’re animating a texture, a bump map, or a the Density attribute of an Environment Fog shader.
To animate a light’s Intensity attribute: 1
Create a Spotlight and open its attribute editor.
Use the right mouse button → Set Key to set a key for the Spotlight’s Intensity attribute.
2
In a modeling view, click the timeline to establish a frame (see Using Maya: Animation). Using Maya: Rendering
121
Animating Render Node Attributes Animating render node attributes 3
In the Spot Light Attributes section of the Spotlight’s attribute editor, position the cursor over the Intensity label, then use the right mouse button → Set Key. A key tick is created in the timeline, indicating that a key has been set for the Intensity.
122
4
Click the timeline again in another frame.
5
Set another key for the Intensity attribute by repeating Step 3.
Using Maya: Rendering
Index A
B Ball Swatch Primitive 34 Barn Doors 58 Barn Doors toggle 58 Basic filter Filter menu 37 Batch Render cancel 103 view 103 Batch Rendering command line 99 in Maya 102 on remote machine 102 options 99 Box swatch primitive 34 Break 88
button options Connection Editor 84 buttons from to 86 Make Connection Editor 88 Navigating 76 Pin 39 Reload Left/Right 86 Shading Group 23 Use Depth Map Shadows 49 By Extension 62 By Frame Step 62
C camera creating 105 Cameras Filter menu 38 cameras Panels menu 106 Primitives menu 105 cancel Batch Render 103 casting shadows 49 Clear All 87 Clip Final Shaded Color 63 Collapse Expand/Collapse 34 Collapse All Expand/Collapse 34 collapse swatches in Multilister 21 Color Edit menu 32 light attributes 59 Particle Age Map 32
Using Maya: Rendering
Ind ex
active tab 21 adding to shading groups 71 All in Tab Edit menu 31 All Types Filter menu 38 Alpha Gain 114 Always Filter Filter menu 37 Always Sort Display menu 35 Ambient lights, 54 animating render nodes 121 animating attributes 121 animation attributes 62 rendering 61 Animation attributes 62 Animation Range 62 Apply Filter Filter menu 37 As Columns Display menu 36 As Icons Display menu 35 As List Display menu 35 As Output Format 63 Aspect Lock 64 Assign Edit menu 31
assigning colors to shading groups 72 shading groups 23 shading groups to single material 73 Attribute Editor drag connections 22 Window menu 36 attribute editor opening 13 Attribute Spread Sheet Window menu 36 attributes animating 121 animation 62 Image Planes 114 image planes 113 spot lights 57 Auto-connect 85
123
Index
color assignment of shading groups 72 lights 46 Color Chooser 48 Color Curves 59 color editor 48 Color Gain 114 Color Offset 114 Columns View Multilister tools 39 command line Batch Rendering 99 components assigning 28 Composite 63 Composite Threshold 63 Cone swatch primitive 34 Cone Angle 57 Connect Highlighted Window menu 36 Connection Editor breaking connections 84 loading 76 making connections 78 using 75 Window menu 36 Connection Editor menu 84, 85 connections breaking Connection Editor 84 making Connection Editor 78 making in Connection Editor 79 Convert Solid Texture Edit menu 33 Create Edit menu 31 tab 34
124
Using Maya: Rendering
Create Ambient Light 44 Create Directional Light 44 Create Filtered tab 35 Create Point Light 44 Create Render Node window 24 Create Spot Light 44 creating cameras 105 lights 43 shading groups 69, 93
D Decay 56 and directional lights, 55 Decay Rate 56 Decay Regions 58 defaultLightList 42 Delete By Type Edit menu 31 Delete Highlighted Edit menu 31 Delete Unused Edit menu 31 deleting image planes 110 shading groups 74 Device Aspect Ratio 64 Directional lights, and decay, 55 Display 113 options 21 Display menu 34 Display Mode 113 displaying shading groups 70
drag connections in Attribute Editor 22 connections in Multilister 22 image planes image planes drag 109 to make connections 22 Dropoff 58
E Edit menu 31 editing shading groups 73 Enable Depth Maps 63 End Distance1 58 End Frame 62 Environment Fog 63 exclusive 43, 60 Expand Expand/Collapse 34 expand swatches 21 Expand All Expand/Collapse 34 Expand/Collapse Display menu 34 Export as File menu 30 Export Highlighted File menu 30 Extension Padding 62
F Field Ext Control 63 Fields 64 File menu 29
Index
Filter menu 36 Fog Intensity 56, 59 Radius 56, 58 Type 56, 58 Folder View Multilister tools 39 Frame Extension 114 from to button 86
G Gamma Correction 63 General tab 21
H Hide All Filter menu 37 Hide Highlighted Filter menu 37 Highlight into Work Area Filter menu 39 Highlight List 20 Highlight Mode 19, 21 Select menu 33 Highlight Selected Select menu 33 Hypergraph viewing connections 26 Hypergraph Highlighted 26 Window menu 36
Ignore Film Gate 63 Ignored lights 42
K Keyframe Edit menu 31
L Left/Right Side Filters menu 85 Light File menu 30
Light... File menu 30 Light Effects 56, 58 Light Fog 56, 58 Light Glow 56, 59 light linking Relationship Panel 90 Lighting a Scene 41 Lights Edit menu 31 lights adjusting color 46 creating 43 defaultLightList 42 exclusive 43 ignored 42 in Maya 42 spot lights 57 Lights, ambient, 54 directional, and decay, 55 point, 55 spot, 57 Link To Object Edit menu 33 List View Multilister tools 39 loading Connection Editor 76 image planes 111 Lock Device Aspect Ratio 64 Look Through Selected 46
M
Ind ex
I
image 107 loading image planes 110 rendering partial 117 Image Name 114 Image Plane 114 attributes Texture 114 Type 114 image plane attaching 107 loading a scene 111 loading an image 110 image plane attributes 113 Image Planes Filter menu 38 using 105 image planes deleting 110 Incandescence Particle Age Map 32 initialShadingGroup 21, 68 Input Connection Editor 78 Intensity 59 Intensity Curve 59 Intensity Sample 41, 59
Make button Connection Editor 88 making connections dragging 22
Using Maya: Rendering
125
Index
Map Displacement Edit menu 32 Map Surface Edit menu 32 Map Volume Edit menu 32 Materials filter Filter menu 37 menus Connection Editor 84, 85 Edit 31 File 29 Left/Right Side Filters 85 Multilister 29 Options 85 right mouse button Connection Editor 77 Modify Extension 62 motion blur 62 By Frame 62 Move Tab Down Tabs 35 Move Tab Up Tabs 35 Multilister drag connections 22 image plane 107 menus 29 quick tour 19 using 19 Multiple Selection light linking 91 Relationship Panel 91
N navigating node networks 76 Navigating buttons 76, 86
126
Using Maya: Rendering
Negative intensity of lights 59 networks node navigating 76 New Items First Display menu 35 None Render Globals 63
Penumbra Angle 57 Pin button Multilister tools 39 Point lights, 55 Preferences File menu 30 Primitives menu cameras 105
O
R
Odd Field First 64 Odd/Even Field Ext 63 one-node camera creating 105 options Batch Rendering 99 Options menu 85 Other Filter menu 38 Out Format Control 63 Output Connection Editor 78 Output Extensions 62 Output Format Ext 63
Ray Depth Limit 60 raytrace shadow attributes 60 Region 1/2/3 58 Relationship Panel assigning shading groups 93 light linking 90 Multiple Selection 91 Single Selection 90 using 89 Reload Filter menu 37 Reload Left/Right buttons 86 Remove 87 Tabs 35 removing from shading groups 71 renaming shading groups 72 Render Globals opening 14 Scene File menu 30 View using 14 Render region 119
P Panels menu creating cameras 106 partial image rendering 117 Partial Image Rendering using 117 Particle Age Map Color, Incandescence, Transparency 32 Edit menu Color 32
Index
Render Scene File menu 30 rendering an animation 61 frames 9 rendering activities table 16 rendering attributes animating 121 rendering flags 95 Revert To Default File menu 30 right mouse button menu Connection Editor 77
S
Show All with Textures 38 Show Connected Only 85 Show Exclusive 38 Show Hidden 85 Show Highlighted Filter menu 37 Show Inputs Only 85 Show Lights 38 Show Linked 38 Smooth Shade All 11, 45 Sort Display menu 35 Sort By Display menu 35 Spot lights, 57 Spot Light attributes 57 Spotlight Preview Display 58 Start Distance1 58 Start Extension 62 Start Frame 62 Start/End 61 starting Shading Groups Editor 69 Swatch Primitive Display menu 34 Swatch Quality Display menu 34 Swatches 21 swatches render-node 21
T Ind ex
Save Multilister File menu 30 Select tool 19 Select Assigned Select menu 33 Select Default Shaded Select menu 33 Select menu 33 selecting shading groups 70 Selection List 20 Set Default Shading Group Edit menu 32 Set Key animating render attributes 122 Shading Group button 23 shading group editor 67 Shading Group tool using 27
Shading Groups 38 Filter menu 38 shading groups and single material 73 assigning 23 Relationship Panel 93 assigning to components 28 creating 69, 93 definition of 67 deleting 74 displaying 70 editing 73 selecting 70 selecting contents only 70 selecting without contents 70 texturing 24 Shading Groups and Materials Edit menu 31 Shading Groups Editor 67 how to start 69 Shading Groups Editor... Window menu 36 Shading menu 45 Shadow Radius 60 Shadow Samples 60 shadows casting 49 making 49 Show Non Exclusive 38 Non Illuminating 38 Non-Keyable 85 Outputs Only 85 Readable 85 Selected Filter menu 37 Work Area Display menu 35 Show All 38 Show All with Lights 38
Tabs Display menu 34 Texture filter Filter menu 37
Using Maya: Rendering
127
Index
Texture/Material/Shading Group File menu 30 Textures Edit menu 31 texturing shading groups 24 timeline 121 toggles With Shading Group 24 Tool bar 39 tools Shading Group 27 Transparency Particle Age Map 32 Tube Swatch Primitive 34 two-node camera creating 106
V
U
Z
Update Button Multilister tools 39 Use All Lights using 45 Use Decay Regions toggle 58 Use Depth Map Shadows button 49 Use Frame Ext 62 Use Frame Extension 114 Use Maya File Name 62 User Input 63 using Use All Lights 45 Using Image Files filter Filter menu 38 Utilities Filter menu 38
Zeroth Scanline 64
128
Using Maya: Rendering
view Batch Render 103 batch render 103 viewing connections Hypergraph 26
W Width/Height 64 Window menu 36 windows Create Render Node 24 in Multilister 26 With Shading Group toggle 24 Work Area Button Multilister tools 39
Rendering Basics
Rendering Basics 1 Introduction to Rendering Rendering a frame
9
9
Rendering activities table
16
2 Using the Multilister Quick tour of the Multilister
19 19
Using Drag-and-drop connections
22
Drag-and-drop within the Multilister
22
Drag-and-drop: Multilister to attribute editor Assigning shading groups to objects Creating and texturing shading groups Opening related windows and editors Using the Shading Group tool
23 24 26
27
Shading Group tool options
28
Assigning shading groups to components Multilister menus
29
File menu
29
Edit menu
31
Select menu
34
Window menu
36
Tool bar
28
33
Display menu Filter menu
22
36 39
Using Maya: Rendering
3
Rendering Basics Contents
3 Lighting a Scene
41
How lights work in Maya Creating lights Linking lights
42
43 51
Using the Light Linking tool Light types
52
54
Ambient lights
54
Directional lights Point lights
55
Spot lights
57
Common light attributes
55
59
Intensity Sample section Common Attributes Shadows section
59
59 60
4 Rendering an Animation Rendering an animation
61
61
Animation attributes (Render Globals) Output Extensions
62
62
Special Effects (Render Globals)
63
Resolution attributes (Render Globals: defaultResolution)
4
Using Maya: Rendering
64
Rendering Basics Contents Image file formats
64
5 Using the Shading Group Editor Understanding the Shading Group Editor Creating shading groups Selecting shading groups
67
69 70
Adding items to a shading group
71
Removing items from a shading group Renaming shading groups
67
71
72
Changing the color assignment Using the Shading Groups Editor
72 73
Menu items in common with the Set Editor
74
Using Maya: Rendering
5
Rendering Basics Contents
6 Using the Connection Editor Loading the Connection Editor Navigating a node network Making connections
75
76
76
78
Breaking connections
84
Connection Editor menu and button options
85
7 Using the Relationship Panel Selecting objects and lights Light linking
90
90
Assigning shading groups to objects
8 Rendering Flags
93
95
Selecting objects, textures, and materials Setting Rendering Flags
99
Batch rendering from the command line Batch rendering within Maya
102
10 Using Image Planes Creating a camera
105
Attaching an image plane
107
Using the Multilister
107
Using drag and drop
Using Maya: Rendering
95
96
9 Batch Rendering
6
89
109
105
99
Rendering Basics Contents Loading an image
110
Deleting image planes
110
Loading a scene in the image plane Image plane attributes
111
113
Placement attributes for attached image planes Placement attributes for fixed image planes Image plane fit
115
115
Image plane crop
115
11 Partial Image Rendering Rendering part of an image Test settings menu
114
117
117
119
12 Animating Render Node Attributes Animating render node attributes
121
121
Using Maya: Rendering
7
Rendering Basics Contents
8
Using Maya: Rendering
Rendering an image or a scene is the final stage of creation in Maya, and can be an iterative, experimental process. Rendering is not a linear activity. Similarly, this book is not designed to be read from front to back; rather you can jump from chapter to chapter and section to section easily. Use the online version for moving quickly from topic to topic. The procedure below will help get you acquainted with the basic activity of rendering a single frame. This chapter also contains a table of rendering activities that outline a typical rendering workflow, and provides cross references to relevant information. This chapter contains the following sections: •
“Rendering a frame” on page 9
•
“Rendering activities table” on page 16
Rendering a frame Rendering a frame in Maya is an immediate gratification activity. It starts by creating or importing objects, texturing them, and lighting them. When you are ready to bring the scene into the photo-realistic world, you’re ready to render. This section walks you through the basics of opening a scene and rendering it. If you do not have a scene to open, create a few objects and lights and save them. Then follow along in this procedure with your own file. By the end of it, you will be acquainted with some of the important windows and editors that you use during rendering activities.
To render a frame: 1
Select File → Open Scene.
Using Maya: Rendering
9
Rendering Basics
1
Introduction to Rendering
Introduction to Rendering Rendering a frame 2
Choose the scene you want to open and click Open. The scene opens, and you can see objects, lights, and all the scene components. Objects will not always be wireframes when you open a scene; Maya saves the state of your scene when you exit, so when you start Maya again, everything is the way you left it.
A newly opened scene, with all the objects displayed as wireframes
10
Using Maya: Rendering
Introduction to Rendering Rendering a frame 3
In the view’s Shading menu, select Smooth Shade All. Rendering Basics
The objects are shaded in the view to give you a better idea of their shapes and spacial relationships.
Tip You can also use Shading → Hardware Texturing, which displays shades objects in the views with the shading group that are assigned to them. Using Hardware Texturing is resource intensive, and may impact Maya’s performance.
Shading the objects gives you a better idea of their size, shape, and spacial relationships to one another
Using Maya: Rendering
11
Introduction to Rendering Rendering a frame 4
Select Windows → Multilister. The Multilister is displayed.
In the Multilister you can see rendering node connections, like which shading groups are assigned to which objects, which lights are connected to which shading groups, and so on. You can also make and break connections in the Multilister.
12
Using Maya: Rendering
Introduction to Rendering Rendering a frame 5
Double-click a shading group icon to open its attribute editor. Rendering Basics
You adjust a node’s attributes in its attribute editor. In this case, Color-Based Transparency is turned on, and Fast Drop Off is turned on. 6
Close the attribute editor.
Using Maya: Rendering
13
Introduction to Rendering Rendering a frame 7
Select Render → Render Globals to open the Render Globals window.
The Render Globals window contains many tuning settings for the renderer, among them are: Image Format, Output Extensions, Animation settings, and Special Effects like Film Gate and Environment Fog. 8
Close the Render Globals window.
9
Select Window → Rendering Editors → Render View. The Render View is displayed. The Render View is where your rendered frame is displayed. The menus in the Render view are for setting up how the Render View displays rendered images.
14
Using Maya: Rendering
Introduction to Rendering Rendering a frame 10 Select Settings → Resolution, and choose one of the resolution options. Rendering Basics
This is the resolution the image is rendered at.
11 Select Render → Render → persp.
Using Maya: Rendering
15
Introduction to Rendering Rendering activities table Maya renders the frame. The image is displayed in the Render View. The rendering will take time to complete, depending on how complex or simple the elements in the scene are.
The rendered image remains displayed in the Render View until the next time you render an image. If you close the Render View, the image will still be there the next time you open it. The image is saved to disk so you can keep the image if you want. Save options and image file format options are found in Render Globals.
Rendering activities table This section contains a table of links and cross-references that will help you find detailed information about rendering activities. Use the following table to familiarize yourself with the contents of the Maya renderer.
16
Rendering Activity
Relevant Topics
Opening a scene or files
Chapter 2, “Using the Multilister”
Using Maya: Rendering
Introduction to Rendering Rendering activities table
Relevant Topics
Using rendering editors
Chapter 2, “Using the Multilister”
Rendering Basics
Rendering Activity
Chapter 6, “Using the Connection Editor” Chapter 7, “Using the Relationship Panel” Chapter 8, “Rendering Flags” Chapter 3, “Using the Render View Window” Lighting the scene
Chapter 3, “Lighting a Scene” Chapter 6, “Creating Effects with Materials” Chapter 2, “Optimizing Maya’s Renderer”
Texturing
Chapter 6, “Creating Effects with Materials” Chapter 2, “Creating 2D Textures” Chapter 3, “Creating 3D Textures” Chapter 4, “Creating Environment Textures” Chapter 5, “Creating Materials” Chapter 7, “Creating Effects with 2D Textures” Chapter 8, “Creating Effects with 3D Textures” Chapter 9, “Creating Effects with Environment Textures” Chapter 11, “Using the Color Utilities”
Using Maya: Rendering
17
Introduction to Rendering Rendering activities table
Rendering Activity
Relevant Topics
Test Rendering
Chapter 2, “Optimizing Maya’s Renderer” Chapter 3, “Using the Render View Window”
Raytracing
Chapter 1, “Raytracing” Chapter 2, “Optimizing Maya’s Renderer”
18
Depth-map shadows
Chapter 4, “Using Depth Map Shadows”
Tuning the render settings
Chapter 2, “Optimizing Maya’s Renderer”
Rendering an animation
Chapter 4, “Rendering an Animation”
Batch rendering a final scene
Chapter 9, “Batch Rendering”
Cameras and image planes
Chapter 10, “Using Image Planes”
Using Maya: Rendering
The Multilister is one of the central windows in Maya in which you perform operations on rendering nodes. Through the Multilister you can create, delete, assign, and connect rendering nodes. This chapter describes the concept of the Multilister, and provides procedures about how to use the Multilister. This chapter contains the following sections: •
“Quick tour of the Multilister” on page 19
•
“Using Drag-and-drop connections” on page 22
•
“Assigning shading groups to objects” on page 23
•
“Creating and texturing shading groups” on page 24
•
“Opening related windows and editors” on page 26
•
“Using the Shading Group tool” on page 27
•
“Assigning shading groups to components” on page 28
•
“Multilister menus” on page 29
Quick tour of the Multilister When you open the Multilister you are in Highlight mode (Select → Highlight Mode). The Select tool on the left side is the default tool when you open the Multilister. This tool lets you select swatches in the Multilister and then perform actions on them, such as assigning shading groups to objects in the views, connecting materials to objects, opening attribute editors, and so on.
Using Maya: Rendering
19
Rendering Basics
2
Using the Multilister
Using the Multilister Quick tour of the Multilister
Multilister tools Shading group swatch Double-click to re-name
Active tab
Multilister menus
Active lister
Click to expand a swatch
Drag to resize the lister
Highlight List and Selection List When you select a swatch or swatches in the Multilister, a yellow border appears around the selction(s). (You can select multiple, nonadjacent swatches by using the Shift key and adjacent objects by dragging.) The Highlight List contains all the swatches highlighted in yellow. Some menu items depend on you selecting objects in this manner. Your Highlight List can include swatches from different tabs in the Multilister. You can work in both the Multilister and the views at the same time. For example, one way to connect a shading group to an object in a view is to first select the object in the view (this adds the object to the Maya Selection List), and then highlight a swatch in the Multilister (which adds the swatch to the Multilister Highlight List). The Multilister Highlight List and the Maya Selection List are two distinct lists, each containing different data.
20
Using Maya: Rendering
Using the Multilister Quick tour of the Multilister
The active tab The Multilister is actually several listers combined into one window. Think of listers in terms of the tabs you see in the Multilister when you first open it. The active tab appears on top of the others, outlined in a blue border (blue is the default color). As you move the cursor from lister to lister in the Multilister, and click in each region, you will notice the blue border outlines the lister that you click in. The active tab is the one that will be affected when you perform certain actions in the Multilister, for example, when you set Display options.
Render-node swatches There are three swatches in the General tab by default when you open the Multilister. These swatches, which are visual representations of nodes that carry specific attributes, are applied to newly created objects in your scene. For example, when you create a sphere, the sphere is assigned to the initialShadingGroup, which is by default a gray Lambert shading group. Swatches update every time you make a change in the swatch’s node network, so you can see the results of your changes immediately. Swatches are more than visual representations. They also provide a convenient way into the attribute editors of the nodes. For example, if you create a Spot light, a Spot light swatch is created in the Multilister. When you want to adjust any of the Spot light’s attribute, for example if you want to adjust the Cone Angle, double-click on the Spot light swatch to display the light’s attribute editor. You can expand and collapse swatches. Since the shading group is the highest level rendering node, that is, it is the visual culmination of all the nodes in a render node network, you may want to see a node that is connected to the shading group. By clicking on the expand button, you can quickly see which nodes are connected in a network. Double-click on any of the nodes in a network to display the attribute editor. Collapse the nodes to clean up the look of the Multilister.
Using Maya: Rendering
21
Rendering Basics
You can add items in the Multilister to the Selection List, but to do this you must turn off Highlight Mode (in the Multilister, Select → Highlight Mode). When Highlight Mode is turned off, swatches you select in the Multilister are added to the Maya Selection List, not to the Multilister Highlight List, and they are outlined in blue instead of yellow.
Using the Multilister Using Drag-and-drop connections
Using Drag-and-drop connections One of the most basic and powerful ways of connecting an attribute of one node to the attribute of another node is using the middle mouse button to drag-and-drop. Connections can occur between any two compatible attributes in Maya, that is, between two compatible input and output attributes. When you perform a drag-and-drop connection, Maya makes a default connection for you.
Drag-and-drop within the Multilister To drag-and-drop a texture onto a Phong shading group: Select a texture and use the middle mouse button to drag the texture onto a shading group to connect them. The texture is mapped to the shading group, and the result is displayed in the Multilister.
Use the middle mouse button to drag the texture onto the shading group.
Note Drag-and-drop between two swatches in the Multilister creates only basic, default connections between the color channels of the nodes. If you attempt a drag-and-drop connection that does not involve the color channels of the nodes, the Connection Editor is displayed, which lets you make arbitrary connections.
Drag-and-drop: Multilister to attribute editor You can drag-and-drop from the Multilister to a node’s attribute editor, to make non-default connections. This is a very fast way to make arbitrary connections. When you drag a node from the Multilister to an attribute editor, black boxes are displayed around compatible attributes in the attribute editor. You can drop the node from the Multilister on any compatible attribute in the attribute editor.
22
Using Maya: Rendering
Using the Multilister Assigning shading groups to objects
To drag-and-drop: Multilister to attribute editor: Double-click a shading group to open its attribute editor.
2
In the Multilister, use the middle mouse button to drag a texture onto a compatible attribute in the shading group’s attribute editor. Releasing the mouse button completes the connection.
Rendering Basics
1
Assigning shading groups to objects To assign a shading group to an object: 1
Select the object or objects in the modeling view. In the Multilister, select the shading group you want assigned, then choose Edit → Assign.
Tip To reduce the time you spend assigning shaders to objects, you can change the default shader so that every time you create an object the default shader is assigned to it. Select the shader you want. Choose Edit → Set Default Shading Group. All objects created after that will be assigned this look. You can change the default look in this way at any time. 2
Click the Shading Group button, and then select a shader. Objects with the assigned look are selected in the modeling views.
3
To assign this look to other objects, select the objects in the modeling views.
Shading Group button
Tip The Shading Group tool has two modes, shading-centric and geometrycentric. You can change the mode by double-clicking the Shading Group button, and selecting the mode you prefer in the Tool Properties window.
Using Maya: Rendering
23
Using the Multilister Creating and texturing shading groups
Creating and texturing shading groups A node is the basic building block of a look that you can assign to an object or objects. A look is the visual culmination of one or many networked nodes. When many nodes are networked together and contribute dynamically to a look, they become a shading group.
To create a shading group, texture, or light: 1
Go to the Multilister, and choose Edit → Create. The Create Render Node window is displayed, listing all the options.
Materials, Textures, Lights, and Utilities are all nodes. When you create a node, an associated icon appears in the Multilister. Toggle on With Shading Group to create a shading group of networked nodes that you can apply to an object or objects.
2
Select the tab for the kind of node you want to create. For example, if you want to create a blinn shading group, select the Materials tab. At least one new icon is created every time you create a new node. Use With Shading Group to create a shading group automatically when you create a node. For example, if you plan to assign a shading group to an object in your scene, toggle ON With Shading Group and Maya will create a shader node and a texture node and network them so you can assign the entire shading group to an object or objects.
3
Click Blinn to create a blinn shading group. A blinn icon is displayed in the Multilister.
24
4
Close the Create Render Node window.
5
To see the parameters of the blinn shading group, double-click on its icon in the Multilister.
Using Maya: Rendering
Using the Multilister Creating and texturing shading groups
Tip Use Node Inputs and Node Outputs buttons to quickly move to a shader’s input nodes or output nodes without leaving the attribute editor.
Node Input and Node Output buttons
6
In the Multilister, choose Edit → Create. The Create Render Node window is displayed.
7
Under the Textures tab in the Create Render Node window, choose between 2D, 3D, and Environment textures. Click the texture you want. A texture shading group icon appears in the Multilister. If you expand the shading group icon with the arrow in the bottom right of the icon, you’ll see a placement node, which defines how the texture is placed on the object. The texture swatch display will also reflect the placement parameters.
Using Maya: Rendering
25
Rendering Basics
The blinn’s attribute editor is displayed. When you change the blinn’s attributes, the results are reflected in the icon in the Multilister.
Using the Multilister Opening related windows and editors
8
Close the Create Render Node window.
Opening related windows and editors The Multilister brings together many functions in Maya. For example, if you want to see which connections created a shading group, you can highlight the shading group and then open any one of several windows that can provide you with information about the node. You can open the following windows from within the Multilister: •
Attribute Spread Sheet
•
Connection Editor (see Chapter 6, “Using the Connection Editor”)
•
Shading Groups Editor (see Chapter 5, “Using the Shading Group Editor”)
•
Hypergraph
To view a connection in the Hypergraph: Highlight a shading group in the Multilister. Select Window → Hypergraph Highlighted. The Hypergraph is displayed, showing the node you selected, plus its upstream and downstream connections.
26
Using Maya: Rendering
Using the Multilister Using the Shading Group tool
Using the Shading Group tool
•
You can change the tool’s properties (double-click on the tool to open its Tool Properties window) and use the tool in the Multilister.
To assign a shading group to an object: 1
Select the tool in the Multilister.
2
Click a shading group swatch. Blue highlighting surrounds the selected swatch and the objects that are assigned to the shading group are highlighted in white in the modeling window.
3
To assign a shading group to a nonhighlighted object, select the object in the modeling window.
Tip To unassign a shading group, select a highlighted object in the modeling window.
Using Maya: Rendering
27
Rendering Basics
You use the Shading Group tool to see what objects are assigned to shading groups, and to assign shading groups to objects. This tool appears in the Multilister with the following icon:
Using the Multilister Assigning shading groups to components
Shading Group tool options
Shading-centric mode This is the default mode. When you click on a shading group in the Multilister, assigned objects are highlighted in white in the modeling window.
Geometry-centric mode When you select an object in the modeling window, the shading group that is assigned to the object is highlighted in the Multilister.
Assigning shading groups to components You can use the Select by component type tool to select portions of an object and make them components of the object. For example, you can select an area of a polymesh sphere. You can then assign a shading group to the selected area or component. Once you select an area, it behaves as if it were a component.
To select and assign components of objects:
28
1
Make a polymesh sphere.
2
In the Multilister, make two shading groups, a Phong and a Blinn. In their attribute editors, pick different colors for each shading group.
Using Maya: Rendering
Using the Multilister Multilister menus Add two directional lights to the scene, so the polymesh sphere is lit from two different directions.
4
Click the Select by component type tool then click the Facets tool. Clickdrag to select the entire polymesh sphere. Then click-drag the area you want to turn into a component.
Note You can select only complete polygons (or facets) in a polyset. 5
In the Multilister, select one of the shading groups you created earlier. Choose Edit → Assign. You assigned the selected shading group to the selected component of the polymesh sphere.
6
Click the ShadingGeometryRelationshipTool in the Multilister, and select the default shading group. The other component of the polymesh sphere is selected in the modeling window.
7
Choose the Select tool from the Tool Palette, and click once in the perspective window.
8
In the Multilister, select the second shading group you made earlier, and choose, Edit → Assign.
9
In the render panel, press the right mouse button and select Render → persp. You can assign a different shading group to either component by using the Shading Group tool to select and deselect shading groups.
Multilister menus Some menu items require you to first add a swatch or swatches to the Multilister Highlight List. See “Highlight List and Selection List.”
File menu The File menu contains options that read and write information to disk, including Multilister preferences.
Using Maya: Rendering
29
Rendering Basics
3
Using the Multilister Multilister menus
Import Reads elements from another file and loads them into the current file. Items in this menu open a file browser to a specific directory within the current project. You can point the file browser to any directory. Texture/Material/ Shading Group...
Opens a file browser to the current project’s textures directory.
Light
Opens a file browser to the current project’s lights directory.
Render Scenes...
Opens a file browser to the current project’s render directory.
Export Highlighted Exports the contents of the active lister’s Highlight List into a new file. The file browser opens to its best guess directory, but can browse to any directory, or cancel, before exporting.
Export as The same as Export Highlighted, except you can choose the project directory where you want to save the file. Texture/Material/ Shading Group...
File browser opens to the current project’s textures directory.
Light...
File browser opens to the current project’s lights directory.
Render Scene...
File browser opens to the current project’s render directory.
Preferences Multilister preferences include: the number and location of tabs, their labels, filters, sort information, new cell placement, pin state, whether work area and toolbar are showing, and window proportions of the visible listers. Information not included in preferences settings: default shading group, Highlight List, work area proportion if it is not showing, work area contents (contents are only lost between Maya sessions). Save Multilister
Saves the Multilister’s current preferences.
Revert To Default
Returns the multilister to its default preferences. This is useful when you open a project that contains someone else’s preferences.
30
Using Maya: Rendering
Using the Multilister Multilister menus
Edit menu Rendering Basics
Contains options that edit parts of the current scene, usually affecting specific nodes within the Multilister and objects in Maya’s Selection List.
Assign Assigns an object or objects in the modeling view to a highlighted shading group in the Multilister. You must have a shading group highlighted and geometry selected for this option to work.
Create... Displays the Create Render Node window, from which you create materials, textures, lights, and rendering utilities.
Keyframe Set a key on the highlighted object or objects. This options has one submenu for each highlighted node, which contains the node’s keyable attributes. Choosing one sets the key.
Delete Highlighted Deletes all nodes in the Multilister Highlight List.
Delete Unused Deletes all nodes in the Multilister that are not assigned or connected to shading groups. This includes shading groups, materials, textures, utilities, and image planes.
Delete By Type Deletes specific types of objects. All in Tab
Deletes every node in the active tab.
Textures
Deletes every texture node.
Shading Groups and Materials
Deletes all shading groups and materials.
Lights
Deletes all lights.
Using Maya: Rendering
31
Using the Multilister Multilister menus
Set Default Shading Group Sets the highlighted shading group as the default shading group. All new geometry is shaded with the default shading group. Changing the default shading group does not change the color of existing geometry, only geometry created after the change. The default shading group is not a Multilister preference, and is not saved when you end the Maya session.
Map Displacement Requires that a single shading group is highlighted. Displays the Create Render Node window and maps the node you create as a displacement shader on the shading group.
Map Surface Requires that a single shading group is highlighted. Displays the Create Render Node window and makes a default connection between the shading group or its material and the node.
Map Volume Requires that you highlight a single shading group. Displays the Create Render Node window and makes a default connection between the shading group or the volume shader itself and the node.
Particle Age Map Contains options for shading software-rendered particles. Useful for using a ramp texture to define the color of a particle over the course of its life. Requires either a single particle cloud material, or a single particle cloud and an existing texture. Color
Lets you create a texture or use an existing texture to define the color of a particle as a function of the particle’s age.
Incandescence
Lets you create a texture or use an existing texture to define the incandescence of a particle as a function of the particle’s age.
Transparency
Lets you create a texture or use an existing texture to define the transparency of a particle as a function of the particle’s age.
32
Using Maya: Rendering
Using the Multilister Multilister menus
Convert Solid Texture
Link To Object Requires that you highlight a 3D TexturePlacement and select geometry in the view. Creates a connection between the placement and the geometry so that translating the object will not result in the object swimming through the texture.
Note If you deform the object, this option will not prevent the swimming.
Select menu The Select menu contains options that manipulate the Selection List or the Multilister Highlight List.
Select Assigned Requires you to highlight one or more shading groups. Selects the geometry that is assigned to the highlighted shading group.
Highlight Selected Highlights any nodes in the active tab that are connected to the selected geometry in the view.
Select Default Shaded Selects all geometry currently shaded by the default shading group. Also highlights the default shading group.
Highlight Mode When turned on, nodes selected in the Multilister are added to the Highlight List. When turned off, nodes selected in the Multilister are added to Maya’s Selection List.
Using Maya: Rendering
33
Rendering Basics
Requires a 3D texture on the Highlight List and surfaces on the Selection List. Takes a 3D texture and creates file textures, one for each mappable surface on the object. Useful to prevent an animated object from swimming through a 3D texture.
Using the Multilister Multilister menus
Note You can use the Shift and Ctrl keys to select multiple, nonadjacent nodes in the Multilister tabs.
Display menu Expand/Collapse Contains options for changing the expand/collapse state of the highlighted nodes. Expand
Expands all highlighted nodes.
Expand Al
Expands all nodes.
Collapse
Collapses all highlighted nodes.
Collapse All
Collapses all nodes.
Swatch Primitive Changes the swatch primitive of materials only. Shading groups are always spheres, and textures are always flat planes. Ball
Changes all material swatch primitives to a ball shape.
Box
Changes all material swatch primitives to a box shape.
Cone
Changes all material swatch primitives to a cone shape.
Tube
Changes all material swatch primitives to a tube shape.
Swatch Quality Affects the sampling rate and the render time of all swatches. The default is Low.
Tabs Contains options concerning the creation, deletion, and location of tabs in the Multilister. To rename a tab, double-click the tab label, type a new name, then press Enter. Create
34
Creates a new tab and puts it in the top tab group.
Using Maya: Rendering
Using the Multilister Multilister menus Creates a new tab and puts it in the top tab group. Allows the filter to be specified before creating the tab.
Move Tab Up
Deletes the active tab from the bottom group and adds it to the top.
Move Tab Down
Deletes the active tab from the top group and adds it to the bottom.
Remove
Deletes the active tab on the top group.
Rendering Basics
Create Filtered
New Items First Places newly created nodes in the top-left corner of the Multilister. By default, new items go in the bottom-right corner of the Multilister.
Always Sort When new nodes are created, they appear in their sorted positions.
Sort If Always Sort is turned off, Sort will sort all nodes in the active tab using the Sort By option.
Sort By Name
Sorts nodes alphabetically, by name.
Type
Sorts nodes alphabetically, by node type.
Reverse Order
Sorts nodes in reverse alphabetical order, from Z to A.
Show Toolbar Shows/hides the column of buttons on the left side of the Multilister.
Show Work Area Shows/hides the work area, which is a clipboard-like area at the bottom of the Multilister. The work area is a lister, and you can use the middle mouse button to drag nodes to and from it as in any other lister in the Multilister.
As Icons Displays nodes as icons or swatches, arranged from top left to lower right, in the Multilister. This is the default display.
As List Displays nodes as columns of text in the Multilister. Using Maya: Rendering
35
Using the Multilister Multilister menus
As Columns Displays nodes as icons or swatches, arranged in columns, in the Multilister.
Window menu All the options in this menu display other windows that relate to nodes in the highlighted in the Multilister.
Attribute Editor... Displays the attribute editor for the first node on the Highlight List.
Attribute Spread Sheet... Displays the Attribute Spread Sheet containing all nodes on the Highlight List.
Connection Editor... Displays the Connection Editor. You can load the Connection Editor by using the middle mouse button to drag swatches from the Multilister to the panels of the Connection Editor.
Connect Highlighted... Displays the Connection Editor with the first highlighted node on the left and the second highlighted node on the right. If more than two nodes are highlighted, only the first two are loaded. If less than two nodes are highlighted, the Connection Editor does not open.
Shading Groups Editor... Displays the Shading Groups Editor.
Hypergraph Highlighted... Displays the Hypergraph, and shows up- and downstream connections of the highlighted node.
Filter menu The Filter menu contains options that affect the contents of the active tab.
36
Using Maya: Rendering
Using the Multilister Multilister menus
Reload Rendering Basics
Removes the current contents and reloads the tab with all nodes that the tab’s filter allows.
Show Selected Removes all nodes that are connected to the currently selected geometry in the view.
Show Highlighted Removes all nodes that are not highlighted.
Hide Highlighted Removes all nodes that are highlighted.
Hide All Removes all nodes from the tab.
Always Filter When turned on, displays only new nodes that pass the current filter. When turned off, any new rendering node created is displayed. The default is on.
Apply Filter Applies only if Always Filter is turned off. Applies the tab’s filter to the contents of the tab.
Basic filter Displays only shading groups, lights, textures, and utilities.
Materials filter Displays all nodes attached to the material classifier node. By default, this filter applies to all nodes in the Materials tab in the Create Render Node window.
Texture filter Displays all nodes attached to the texture classifier node. By default, this filter applies to all nodes in the Textures tab in the Create Render Node window. Using Maya: Rendering
37
Using the Multilister Multilister menus
Using Image Files filter Displays all nodes that have that currently use an image file somewhere in their history.
Shading Groups Show All
Displays all shading groups, materials, and textures connected to shading groups.
Show All with Textures
Displays shading groups and their textures.
Show All with Lights
Displays shading groups and light nodes.
Lights Show Lights
Displays all lights that are in the scene.
Show Linked
Displays only linked lights.
Show Exclusive
Displays only exclusive lights.
Show Non Exclusive
Displays only lights that are part of the defaultLightList.
Show Non Illuminating
Displays only lights that are being ignored.
Cameras Displays cameras and image planes.
Image Planes Displays only image planes.
Utilities Displays all nodes attached to the utility classifier node. By default, this filter applies to all nodes in the Utilities tab in the Create Render Node window.
All Types Displays shading groups, lights, materials, textures, and render utility nodes.
Other This is a list of other pre-made filters, which have descriptive labels.
38
Using Maya: Rendering
Using the Multilister Multilister menus
Highlight into Work Area
Tool bar Pin button When pressed, new nodes added to the Multilister do not appear in the pinned tab. When you unpin the tab, all the nodes are displayed.
Folder View Same as Display → As Icons.
List View Same as Display → As List.
Columns View Same as Display → As Columns.
Update Button When pressed, prevents all swatches in the Multilister from updating when upstream changes are made. This is particularly useful when you are making many changes to the nodes and you do not want to wait for the Multilister to update after every change. When turned off, the Multilister swatches update normally, whenever you make an upstream change to a node.
Work Area Button Same as Display → Show Work Area.
Using Maya: Rendering
39
Rendering Basics
Loads all nodes in the Highlight List into the work area. The Work Area is a convenient place to organize nodes you work with often or nodes that are conceptually connected.
Using the Multilister Multilister menus
40
Using Maya: Rendering
The Lighting menu contains light-related commands. You can choose from four kinds of lights: Ambient, Directional, Point, and Spot. To create a light, select Lighting → Ambient. After you create a light, you can edit its attributes, its orientation, and you can create effects with them.
Ambient
Spot
Point
Directional
To edit a light’s attributes, double-click on the light’s swatch in the Multilister. The light’s attribute editor is displayed. You can watch the changes interactively in the attribute editor’s Intensity Sample. This chapter contains the following sections: •
“How lights work in Maya” on page 42
•
“Creating lights” on page 43
•
“Linking lights” on page 51
•
“Light types” on page 54
•
“Common light attributes” on page 59
Note When you render, you must have at least one light in the scene so the renderer can pick up the objects. If you render a scene with no lights, the rendering will be completely black.
Using Maya: Rendering
41
Rendering Basics
3
Lighting a Scene
Lighting a Scene How lights work in Maya
Tip Use only as many lights as necessary to achieve the look you want. Rendering many lights will increase rendering time. Make sure lights are linked and exclusive, and that the scene is as efficient as possible. See Chapter 2, “Optimizing Maya’s Renderer.”
How lights work in Maya To render an object, you must assign the object to a shading group that is linked to at least one light. In Maya, lights are linked to shading groups, not to objects. You can designate a light in three ways.
As part of the defaultLightList By default, every time you create a light, Maya puts it in the defaultLightList, which links the light to all the shading groups in the scene. When you create a new shading group, all the lights in the defaultLightList are assigned to it.
The defaultLightList
Ignored If you create a shading group that you don’t want all the lights in the defaultLightList to shine on, you can tell the shading group to ignore specific lights. You do this using the Light Linking tool (see “Linking lights” on page 51). You can link a light to as many or as few shading groups as you want.
42
Using Maya: Rendering
Lighting a Scene Creating lights
exclusive If you create a light, and want it to shine only on a particular shading group or shading groups, you can make the light exclusive (see “Linking lights” on page 51). When you make a light exclusive, the light is removed from the defaultLightList, and when you create new shading groups, the light will not light them; it only lights the shading group or groups you link it to.
Note When you make a light exclusive, it is removed from the defaultlightlist. It will not shine on anything until you link it to a shading group or groups.
This light is exclusive (it is no longer part of the defaultLightList), and it is linked to the Lambert shading group
Creating lights When you place a light in the modeling window, a light swatch appears in the Multilister. Each light type has a unique swatch. Using Maya: Rendering
43
Rendering Basics
Ambient light is ignored by the Lambert shading group, and it is linked to the Phong shading group via the defaultLightList.
Lighting a Scene Creating lights
To light an object: 1
Create an object or open a scene (File → Open Scene).
2
Choose Lighting → Create Spot Light (or Directional, Point, or Ambient). The light is displayed at the origin of the views.
3
44
Position the light using the Move tool.
Using Maya: Rendering
Lighting a Scene Creating lights Choose Shading → Smooth Shade All to shade the objects in the active view.
5
Choose Lighting → Use All Lights to see the effect the lights in your scene have on the objects.
Rendering Basics
4
As you move objects or lights in the view, the lighting changes, giving you a rough idea of how the rendered image will look.
Note Surfaces with very few spans (for example, when there is one span each in the U and V directions) at low resolution, may not appear to be affected by selecting Use All Lights. To correct this, increase the number of spans on the surface.
Using Maya: Rendering
45
Lighting a Scene Creating lights 6
Select the light in the persp view, and choose Panels → Look Through Selected.
The view changes so you are looking through the light you selected in the view. You can change the position of the light using the Track, Dolly, and Tumble tools. This is a good technique for positioning lights accurately. Select Panels → Perspective → persp to return to the persp view.
To adjust the color of a light: You can change the color of any light, or map file to the color channel of any light. 1
Select the light in a modeling view.
2
Open the Multilister by choosing Window → Multilister.... The Multilister is displayed.
46
Using Maya: Rendering
Lighting a Scene Creating lights 3
Double-click the icon of the light you want to edit. Rendering Basics
The light’s attribute editor is displayed.
Click to open the Color Chooser window
Using Maya: Rendering
47
Lighting a Scene Creating lights 4
Click the Color swatch in the Light Attributes section of the light’s attribute editor. The Color Chooser window is displayed.
Drag in the color wheel to select the color you want.
5
48
Choose a color by dragging in the color wheel, or by adjusting the Hue, Saturation, and Value sliders or the Red, Green, Blue, and Alpha sliders.
Using Maya: Rendering
Lighting a Scene Creating lights 6
Click OK. Rendering Basics
The color of the light changes, and you can see the new color in the Intensity Sample at the top of the light’s attribute editor. The light’s new color is also evident on the shaded objects in your modeling views because you turned on Lighting → Use All Lights.
To make a light cast shadows: You have to tell Maya to cast shadows in your scene. Since casting shadows takes more time to render, the default for casting shadows is off. However, if you plan to use shadows, you can create them using one of two ways: •
To create shadows without raytracing, turn on Use Depth Map Shadows in the Depth Map Shadow Attributes section of the attribute editor. The advantage of using depth-map shadows is that you can reduce rendering time. See Chapter 4, “Using Depth Map Shadows.”
•
To create shadows with raytracing, you need to turn on Use Ray Trace Shadows in the Ray Trace Shadow Attributes section of the light’s attribute editor and turn on Enable Raytracing in the Raytracing section of the Render Globals as described in the following section.
1
In the Multilister, double-click the light that you want to cast shadows. The light’s attribute editor is displayed.
Using Maya: Rendering
49
Lighting a Scene Creating lights 2
In the Raytrace Shadow Attributes section of the Shadows section in the light’s attribute editor, turn on Use Raytrace Shadows.
The Raytrace Shadow attributes are enabled, and you can adjust the number of samples, the radius (in spot light), and limits. The default shadow color is black, but you can change the color by clicking the Shadow Color swatch. 3
Close the attribute editor.
4
Choose Render → Render Globals...., and go to the defaultRenderQuality tab. The Render Quality attributes are displayed.
50
Using Maya: Rendering
Lighting a Scene Linking lights 5
Rendering Basics
Toggle on Enable Raytracing in the Raytracing section, and close the attribute editor.
Now, when you render, your light will cast shadows. 6
Select Window → Rendering Editors → Render View..., and render the view.
Linking lights After you place lights in a scene, you’ll want to link them to objects as a first step towards creating light effects. When you create a light, by default it belongs to the defaultLightList, which means that it is linked to all shading groups in the scene. You can make a light exclusive, so it shines only on a particular object or objects. Making a light exclusive removes it from the defaultLightList. To make a light exclusive, double-click on the light’s swatch in the Multilister, and click exclusive in its attribute section.
Note When you render, you must have at least one light in the scene so the renderer can pick up the objects. If you render a scene with no lights, the rendering will be completely black.
Using Maya: Rendering
51
Lighting a Scene Linking lights
Using the Light Linking tool To link lights using the Light Linking tool: 1
Create some objects and lights.
2
Assign shading groups to the objects.
3
Open the Multilister. Double-click the Light Linking tool (see “Light Linking tool options” on page 53) to open its Tool Properties window. Select lightcentric. You can also use the geometry-centric mode, but the procedure below assumes you are using light-centric. Close the Tool Properties window.
4
In the Multilister, click the Light Linking tool. The shading group that was last selected in this mode, as well as its linked lights, are outlined in blue.
5
Click a shading group swatch to see which objects are assigned to it and which lights are linked to it. Objects that are assigned to it get selected in the views. In the Multilister, linked light swatches are outlined in blue. To link a light to a shading group, select the shading group and click the light you want to link to it. This shading group has two lights linked to it.
To unlink a light from a shading group, select the shading group, then click the light you want to unlink. This shading group has only one light linked to it.
52
Using Maya: Rendering
Lighting a Scene Linking lights To link lights to the selected shading group, do one of the following:
•
Click on lights in a modeling view that are not highlighted to link them to the selected shading group. The lights are selected.
•
Click on light swatches in the Multilister to link them to the selected shading group. The linked light swatches become outlined in blue.
To unlink lights using the Light Linking tool: To unlink lights from the selected shading group, do one of the following: •
Click on selected (linked) lights in the modeling window to break the link between the light and the selected shading group. The light is de-selected.
•
Click on a light’s swatch in the Multilister to break the link between the light and the selected shading group. The unlinked light swatch is no longer outlined in blue.
Light Linking tool options You can change the tool’s properties (double-click on the tool to open its Tool Properties window) and use the tool in the Multilister.
Shading-centric mode
This is the default mode. In the Multilister, click on a shading group. In the modeling window you’ll see which geometry and lights are linked to the selected shading group.
Light-centric mode
In the modeling window, select a light. In the Multilister, you’ll see which shading group or groups the selected light is connected to.
Using Maya: Rendering
53
Rendering Basics
6
Lighting a Scene Light types
Light types When you open a light’s attribute editor, you can view and change all its attributes. Each light attribute editor has an Intensity Sample so you can view the effects of your changes interactively as you make them.
Ambient lights Ambient lights are similar to Point lights except that only a portion of the illumination emanates from the point. The remainder of the illumination comes from all directions and lights everything uniformly.
Ambient Light attributes Ambient Shade Use Ambient Shade to define the omnidirectional component of the ambient light. By setting Ambient Shade to 0.0, ambient light comes from all directions, and surfaces will show no depth definition and appear flat shaded. If set to 1.0, the ambient light comes solely from the position of the light and objects show definite edge contrast. The Ambient Shade default is 0.45.
54
Using Maya: Rendering
Lighting a Scene Light types
Directional lights
Note Because directional lights have a direction but no obvious source, using secondary rays by raytracing can give the effect of casting shadows on objects ‘behind’ the light’s apparent location in a scene. ‘
Point lights Point lights are like incandescent light bulbs—they throw off light in all directions.
Note When you are using depth-map shadows with a Point light, you can control the direction in which the light casts shadows. You do this by setting the appropriate Dmap settings in the Depth Map Shadow Attributes section of the light’s attribute editor. For example, if you use a point light to shine on a table, and you only want the light to cast shadows on objects on the table surface, only turn on the Use X- Dmap.
Using Maya: Rendering
55
Rendering Basics
Directional lights have color, intensity, and direction, but no obvious source in the scene. For example, the sun can be considered a directional light since it is far enough away from Earth that light rays emanating from it are effectively parallel. Directional lights do not decay with distance.
Lighting a Scene Light types
Decay Decay Rate Controls how quickly the light fades with distance. It can be set to a value from 0 to 3. The default setting is 0. Decay Setting
Effect
0
Light reaches everything since there is no decay.
1
Light intensity is decreased in direct (linear) proportion to the distance.
2
Light intensity is decreased inversely proportional to the square of the distance. This is how light decays in the real world.
3
Light intensity is decreased proportional to the cube of the distance. This results in light decaying faster than in the real world.
Light Effects Light Fog
Creates a lightFog node, and connects it to the point light. Fog geometry appears in the modeling window, connected to the light. The lightFog attribute editor is displayed, and you set the light fog attributes.
Fog Type
You can set Normal, Linear, or Exponential fog types. See “Light Fog.”
Fog Radius
Sets he radius of the fog. The default value is 1.0.
Fog Intensity
Sets the intensity of the fog. The default is 1.0.
Light Glow
Creates an opticalFX node in the Multilister and connects it to the point light. The opticalFX attribute editor is displayed, and you set the light glow attributes. See
56
Using Maya: Rendering
Lighting a Scene Light types
Spot lights Spot Light attributes
Cone Angle
Value that represents the measure in degrees of the angle from edge to edge of the spotlight’s beam. The valid slider range is 0.5 to 1 79.5. The default value is 40.
Penumbra Angle
Provides an alternate way to control the dropoff of the spotlight’s intensity towards the edge of the cone. The value is defined in degrees relative to the spot light’s spread. The intensity of the spotlight falls off linearly between the angle specified in Spread, and the Spread angle and Penumbra are added together. For example, a Spread of 50 degrees and a Penumbra of 10 degrees would mean that the spotlight had an effective spread of 60 (50 + 10) degrees, but the intensity of the spotlight would dropoff to 0.0 between the angles of 50 and 60 degrees. A negative penumbra maintains the effective spread angle as specified. For example, a Spread of 50 degrees with a Penumbra of -10 means that the spot light has an effective spread of 50 degrees and the intensity of the spot light would dropoff to 0.0 between the angles of 40 and 50 degrees.
Using Maya: Rendering
57
Rendering Basics
Spot lights cast light in one direction only, emanating from a point in a cone.
Lighting a Scene Light types Dropoff
Controls the rate at which light intensity decreases from the center to the edge of the spotlight beam. The valid range is from 0 to ∞. The range usually used is from 0 to 50. Values of 1.0 and less give practically identical results, that is no discernible intensity decrease along the radius of the beam. The default value is 0.0, which means there is no dropoff.
Tip Penumbra, an independent effect, can appear to have superficially similar results, but is more intuitive to control.
Barn Doors Doors or shutters fitted on the spot light, which let you create a square spot effect. The default value for all four barn doors is 20. The value represents the angle measured from the center of the spot light to the position of the barn door. The range of values is between -30 and 30. Barn Doors toggle
Activate barn doors when toggled on. The default is off.
Spotlight Preview Display Displays the shape that the spotlight will cast as seen, for example, on a wall. The shape changes when you change the values of the light’s cone angle, barn doors, and so on.
Decay Regions Use Decay Regions toggle
Toggles Decay Regions on and off. The default is off.
Region 1/2/3
Controls decay in three regions, Region1, Region2, and Region3.
Start Distance1
Defines how far out from the center of the volume the decay starts.
End Distance1
Defines how close to the center of the volume the decay gets.
Light Effects Light Fog
Creates a lightFog node, and connects it to the point light. Fog geometry appears in the modeling window, connected to the light. The lightFog attribute editor is displayed, and you set the light fog attributes.
Fog Type
Sets Normal, Linear, or Exponential fog types. See “Light Fog.”
Fog Radius
Sets the radius of the fog. The default value is 1.0.
58
Using Maya: Rendering
Lighting a Scene Common light attributes Sets the intensity of the fog. The default is 1.0.
Light Glow
Creates an opticalFX node in the Multilister and connects it to the point light. The opticalFX attribute editor is displayed, and you set the light glow attributes.
Intensity Curve
Use in conjunction with decay, as a measurement tool, or as an animation curve, with distance versus intensity.
Color Curves
Same as Intensity Curve, but with color instead of light intensity.
Common light attributes All lights have several common attributes that appear in each light’s attribute editor.
Intensity Sample section The interactive Intensity Sample displays how light attribute settings affect the selected light. When you change a value in the attribute editor, you immediately see the result in the swatch display.
Common Attributes Intensity
Defines the brightness of the light. The default is 1.0. Setting a light to 0.0 means that no light is produced. Setting a light to a negative value means that the light is removed from a scene in the area of the light’s influence.
Tip Negative intensity can be used to reduce or remove hotspots or glare. Color
Represents the color of the light. The default is white.
Tip Use the slider next to the Color box to adjust the gray value of the color in the Color box. To change the color of the light, click the color swatch next to the light’s Color attribute label. The Color Chooser window opens. Click on the color palette or enter Hue, Saturation, and Value values. Click Apply to see the result in the attribute editor’s swatch. Click OK to close the Color Chooser.
Using Maya: Rendering
59
Rendering Basics
Fog Intensity
Lighting a Scene Common light attributes You can map a texture on to the Color of a light. Click Map... to open the Create Render Node window. Add a texture node by clicking the appropriate texture button. You can add a 2D, 3D, or environment texture. exclusive
When toggled on (indicated by a check mark), objects that are linked to the light are illuminated. When toggled off, the light is non-exclusive, and is part of the defaultLightList. The default is off.
Shadows section Raytrace Shadow attributes Shadow Radius
Used for creating soft shadows. Defines the size of the light for shadowing purposes only. Shadows are generated to match a globe-shaped light source, using the specified radius. For example, a light with a small shadow radius will produce a harder, high-contrast shadow because the light rays do not “spill under” objects; whereas a larger shadow radius lets light “spill under” objects, creating less of a distinction between what is illuminated and what is in shadow. This results in softer shadows.
Shadow Samples
The number of shadow samples used to calculate a soft shadow. For example, if you have a light with a large Shadow Radius but a small Shadow Samples setting, the resulting shadow will not take advantage of the light’s large Shadow Radius.
Ray Depth Limit
The number of shadow rays required to make a shadow evident. For example, if a light does not cast the shadow you expect, the camera may be detecting several reflections and/or refractions so that it doesn’t know where to cast the shadow. In this case, calculate the number of reflections and/or refractions this light is creating, starting from the place on the object where you expect a shadow to appear. The number of reflections and/or refractions you count, plus one, is the number to use as the Ray Depth Limit in order to get the shadow you expect. See Chapter 2, “Optimizing Maya’s Renderer,” and “Raytracing shadows.”
Depth map shadow attributes See Chapter 4, “Using Depth Map Shadows.”
60
Using Maya: Rendering
Rendering an animation requires more setup than simply rendering individual frames. Once a scene is saved, you must tell Maya to render it as an animation in the Render Globals attribute editor. You can select among standard animation render options such as start/end frames, file formats, extensions, and padding. This chapter contains the following sections: •
“Rendering an animation.”
•
“Image file formats.”
Rendering an animation To render an animation: 1
Open an animation scene, and make sure it is saved.
2
Set the render quality for the scene (see Chapter 2, “Optimizing Maya’s Renderer”).
3
Open the Render Globals attribute editor, and in the defaultRenderGlobals tab, open the Renderable Objects + Cameras section. You can choose to render all the objects in your scene or just the active ones. You also must choose an image format (see Chapter 2, “Optimizing Maya’s Renderer”).
4
Select the view(s) you want to render (front, perspective, side, top). If you select more than one view, each one you choose will be rendered.
5
In the Animation section, turn on Animation.
6
Select one of the two kinds of Animation Range:
Start/End
Uses the first and last frames in your scene as the start/end frames in the animation.
Render Globals
Uses the Start Frame and End Frame and By Frame Step that you indicate.
Using Maya: Rendering
61
Rendering Basics
4
Rendering an Animation
Rendering an Animation Rendering an animation You can also specify a Start Extension, By Extension, and Extension Padding, but these are optional. If you do not modify the extension, Maya will apply the default extension scheme, by number of frames in the animation. 7
Batch render the animation (see Chapter 9, “Batch Rendering”). For information on how to view a scene after you render it, see Chapter 1, “The fcheck utility.”
Animation attributes (Render Globals) Animation
Renders a sequence of frames when turned on. When turned off, only one frame is rendered.
Animation Range
Must be used with Animation toggle turned on. You can choose between setting your own Start Frame and End Frame in Render Globals, or you can use Start/End, which uses the first and last frames in the Timeline.
Start Frame
The frame you want to be the first frame in a sequence.
End Frame
The frame you want to be the last frame in a sequence.
By Frame Step
The step or interval of frames in the sequence.
Modify Extension
When turned on, lets you change the extension of the rendered frames to anything you want.
Start Extension
The start extension number when you use Modify Extension.
By Extension
The step or interval of frames in the sequence when you use Modify Extension.
Extension Padding
Any frame padding you choose to use.
Motion Blur
Turns on motion blur attributes, which are used to tune aliasing (see “Antialiasing” on page 19).
Motion Blur By Frame
See “Anti-aliasing” on page 19.
Output Extensions Use Maya File Name
Uses the name of the scene as the prefix in each rendered frame’s name.
Use Frame Ext
Must be used in conjunction with User Input in the Out Format Control menu. Can be any format extension you choose.
62
Using Maya: Rendering
Rendering an Animation Rendering an animation
Rendering Basics
Note When naming files for an animation, avoid using periods. Instead use underscores. For example, use xxx_yyy.sgi.1
instead of xxx.yyy.sgi.1
Out Format Control As Output Format
Uses the default Maya output format.
None
Does not use a format extension.
User Input
Lets you specify any out format you choose.
Output Format Ext
User Input must be Selected. You can use any extension you want, for example, .pix.
Field Ext Control
Lets you specify None, or the standard .o and .e field extensions, or custom field extensions.
Odd/Even Field Ext
o and e are the default values, but you can use any characters you want to distinguish the even and odd fields.
Special Effects (Render Globals) Ignore Film Gate
When turned off, the film gate is respected if it intersects the viewport. When turned on, the film gate is ignored and every pixel is rendered.
Gamma Correction
Gamma correction value.
Composite
See “Compositing rendered images.”
Composite Threshold
See “Compositing rendered images.”
Clip Final Shaded Color
See “Compositing rendered images.”
Environment Fog
See “Env Fog.”
Enable Depth Maps
See “Turning depth map shadows on and off.”
Using Maya: Rendering
63
Rendering an Animation Image file formats
Resolution attributes (Render Globals: defaultResolution) Aspect Lock
When turned on locks, the aspect ratio between the resolution width and height, so that if one is modified, the other maintains the correct aspect.
Width/Height
The image resolution width and height.
Lock Device Aspect Ratio
When turned off, makes sure that there is no squeeze in the outputted image.
Device Aspect Ratio
The resolution must squeeze the image into this aspect ratio, which may be different from the resolution’s aspect ratio.
Fields
Specifies if you are going to use fields.
Odd Field First
Specifies if an odd field is first.
Zeroth Scanline
Specifies if the top or bottom is going to be used as the zeroth field.
Image file formats The Image Format menu in the Render Globals attribute editor contains the list of formats available for image file output. The default format is Maya IFF, but you can output to any file format listed in this menu. All formats, unless otherwise indicated below, put Depth into a single file in the /depth directory. GIF
Graphics Interchange Format is a data stream-oriented file format used to define the transmission protocol of LZW-encoded bitmap data. GIF images may be up to eight bits (256 colors) in depth and are always compressed.
SoftImage
RGB plus Alpha in one file, which goes in the /images directory.
RLA
A Wavefront image file format that is an indexed scanline file. RGB, Alpha, and depth all go into one file. Images with this format are stored in the / images directory. This format is also recognized by Composer.
Tiff
Tag Image File Format, contains RGB plus Alpha in one file, which goes in the /images directory. Maya generates tiff files that use TIFF-5.0 LZW compression. To generate uncompressed tiff files, set the following environment variable before starting Maya: setenv IMF_TIFF_COMPRESSION none
64
Using Maya: Rendering
Rendering an Animation Image file formats
Tiff16
Same as Tiff, but supports 16 bits per color component.
SGI
RGB and RGBA, in a single file in the /images directory.
Alias Pix
Three different file destinations possible: RGB into the /images directory; Alpha into the /mask directory; and depth into /depth directory.
Maya IFF
RGB, Alpha, and depth all go into one file. Images with this format are stored in the /images directory. This format is also recognized by Composer.
Warning RGB plus Depth is not recognized by Composer. JPEG
Joint Photographic Experts Group, a standard of the data compression of still pictures, usually with pictures coded to the CCIR 601 standard. JPEG uses DCT and offers data compression of between 5 and 100 times. Three levels of processing are defined: baseline; extended; and lossless encoding.
EPS
Encapsulated PostScript file format.
Maya16 IFF
Same as Maya IFF, but supports 16 bits per color component.
Cineon
The Cineon image file format, in which no mask is generated.
Quantel
The Quantel image file format outputs to YUV. Only NTSC and PAL resolutions are supported (720X486; 720X576); any other resolution defaults to IFF. Valid YUV field images will not be created by Maya, even though you can tell Maya to create YUV fields.
Warning The Quantel file format has only 220 levels, which makes it very sensitive when viewed on an RGB monitor.
Using Maya: Rendering
65
Rendering Basics
Uncompressed tiff files should be used when you intend to read the images into applications which require uncompressed images such as ZaP!It. Uncompressed tiff files should also be used when files are being generated for Studio, Power Animator, or any other application that supports the tiff 4.0 specification.
Rendering an Animation Image file formats
Notes When you are outputting to Composer or Zapit!, before you render you must type the following in a UNIX shell: setenv MAYA_REVERSE_FILEFORMAT_EXT
If you render to an 8-bit/pixel format, the final color is jittered slightly to reduce quantization artifacts. To turn this off, type the following in a UNIX shell: setenv MAYA_NO_JITTER_FINAL_COLOR
66
Using Maya: Rendering
The Shading Groups Editor gives you control over which geometric objects or their components are assigned to separate shading groups. This editor is primarily used for assigning polygonal facets to separate shading groups. This chapter contains the following sections: •
“Understanding the Shading Group Editor” on page 67
•
“Creating shading groups” on page 69
•
“Selecting shading groups” on page 70
•
“Adding items to a shading group” on page 71
•
“Removing items from a shading group” on page 71
•
“Renaming shading groups” on page 72
•
“Changing the color assignment” on page 72
•
“Using the Shading Groups Editor” on page 73
•
“Menu items in common with the Set Editor” on page 74
Understanding the Shading Group Editor Shading groups can be created in the Shading Groups Editor or in the Multilister. When you create a shading group, you can automatically see it in relation to other shading groups. The Shading Groups Editor works differently from the Set Editor. Shading groups cannot overlap one another—a shading group cannot include all or part of the geometry contained in another shading group. This means that components such as facets can belong only to a single shading group at a time. Unlike the Set Editor, it is easy to tell which facets are in which shading group. This is an important distinction vis-à-vis the Set Editor. Thus, the Shading Groups Editor fits well into the modeling and rendering workflow—the simple materials assigned to the shading groups of an object during modeling can easily be reassigned to more complex materials for the Using Maya: Rendering
67
Rendering Basics
5
Using the Shading Group Editor
Using the Shading Group Editor Understanding the Shading Group Editor final rendering. Using the Shading Groups Editor also makes it easy to complete the material assignments for final rendering because the parts of the geometry to be assigned a particular material. By default, all components of an object that do not belong to a shading group are gathered in a global group called the initial shading group. You can freely use the components in this holdall as the basis for creating further shading groups. So a component can belong either to the initial shading group or to a separate shading group but not to two shading groups at the same time. Unfortunately, removing items from a shading group using the Set Editor does not return them to the initial shading group. If that's all you need, though, the Set Editor works well. When you remove an item from a shading group using the Set Editor, the item does not show through in the modeling view whereas when you remove an item from a shading group using the Shading Groups Editor, an outline of where the removed item was appears and is therefore easier to notice.
This mesh has four shading groups assigned to four different parts.
So a facet has only one material assigned to it.
68
Using Maya: Rendering
Using the Shading Group Editor Creating shading groups
So the use of shading groups is a good choice if you want to visually distinguish the different parts of a model before further refining the material assignment for final rendering. As you make your model, you will notice certain parts that you’ll want to develop further; perhaps it’s the skin, eyebrows, lips, or clothes. Consider creating a shading group for each part you will be modeling. Using the Shading Groups Editor allows you to quickly identify one part of your model from another without waiting to render it because each part of your model belongs to a separate shading group.
Creating shading groups You first make a geometric object such as a polygon. For example, the shading group shown here was created from a polygonal plane primitive. You then arrange parts of the object into the shading group you want.
To create a shading group: 1
Select an object whose components you want to group as a single unit.
2
Select a component. For example, click the Select by component type button and click the right mouse button on the Facets button to select Facets from the pop-up menu (F11) or click the right mouse button on the object in a view and select Facet from the pop-up menu.
3
In a view, click and drag the left mouse button over the components such as facets that you want to form the shading group. Initially, all components are in the initial shading group and you usually select components in it for making new shading groups. However, if the components you select are already part of another shading group, then you can use Edit → Create Shading Group (force) to force these components to belong to the new shading group, removing them from the original shading group.
4
Open the Shading Groups Editor window by selecting Window → Rendering Editors → Shading Groups Editor or Window → Shading Groups Editor from the Multilister.
Using Maya: Rendering
69
Rendering Basics
Tip
Using the Shading Group Editor Selecting shading groups If no shading group has been created in your scene yet, you will see only the initial shading group item in the list. 5
Select Edit → Create Shading Group. The facets become a single group and are automatically shaded in the modeling view provided that the shaded display mode is turned on (select Shading → Smooth Shade All from the view menu bar or press 5). Because the Assign Color to New Groups option is on by default, the shading group is automatically colored in the modeling view.
Selecting shading groups You can select shading groups with or without their contents depending on the mode you choose.
To select without contents: 1
Select Window → Rendering Editors → Shading Groups Editor to display the Shading Groups Editor window.
2
Select Mode → Select. A list of shading groups is displayed. Then you can select a particular shading group to do some operation on it, for example shading groups can be renamed as their number increase or you can modify attributes of the shading group in the Attribute Editor (Window → Attribute Editor).
To select by contents: 1
Select Window → Rendering Editors → Shading Groups Editor to display the Shading Groups Editor window.
2
Select Mode → Select Contents. The list of all available shading groups appears in the Shading Groups Editor window.
3
Click a shading group you want in the list and its contents is displayed in the modeling view. You can also select the contents of consecutive shading groups by pressing Shift.
70
Using Maya: Rendering
Using the Shading Group Editor Adding items to a shading group
To display and edit shading groups by contents: Select Window → Rendering Editors → Shading Groups Editor to display the Shading Groups Editor window.
2
Select Mode → Editing.
3
Click the triangle to the left of a shading group to see its contents. When the triangle is pointing down, the shading group is expanded and you can view and edit each of the members in the shading group.
Adding items to a shading group To add items to a shading group: 1
Select a component. For example, click the Select by component type button and click the right mouse button on the Facets button to select Facets from the pop-up menu (F11) or click the right mouse button on the object in a view and select Facet from the pop-up menu. You can add only polygonal facets or whole objects to a shading group.
2
In a view, click and drag the left mouse button over the components such as facets that you want to add to the shading group.
3
In the Shading Group Editor, click the name of the shading group.
4
Select Edit → Add items.
5
The selected items are added to the shading group and are no longer in the initial shading group. By selecting Add Items (force), you can force items to be added to a shading group.
Removing items from a shading group The shading group is eliminated but the geometry is not.
To remove items from a shading group: The items you remove from the shading group you are editing are put back in the initial shading group. 1
Select a component. Using Maya: Rendering
71
Rendering Basics
1
Using the Shading Group Editor Renaming shading groups For example, click the Select by component type button and click the right mouse button on the Facets button to select Facets from the pop-up menu (F11) or click the right mouse button on the object in a view and select Facet from the pop-up menu. 2
In a view, click and drag the left mouse button over the components such as facets that you want to remove from the shading group.
3
In the Shading Group Editor, click the name of the shading group.
4
Select Edit → Remove items.
5
The selected items are removed from the shading group and put back into the initial shading group.
Renaming shading groups You can rename any existing shading groups.
To rename a shading group: 1
Click the name of the shading group This highlights the shading group.
2
Select Edit → Rename Shading Group. A window appears where you can enter a new name.
3
Enter new name for the shading group. The renamed shading group will now be available in the Shading Groups Editor window.
Changing the color assignment Shading groups are automatically colored. By default, Assign Color to New Groups in the Options menu is turned on.
To change the color: More varied effects can be created by assigning the shading group to a material such as a Phong. 1
72
With both the facets you want to group in the modeling view and the shader engine in the Multilister selected, use Edit → Assign in the Multilister.
Using Maya: Rendering
Using the Shading Group Editor Using the Shading Groups Editor
2
To see the color or the texture map on the shading group in a modeling view, select Shading → Hardware Texturing (press 6).
3
To change the color of the shading group, click the Color of the material under the Common Material Attributes section of the Phong material for example and then choose the desired color from the color chooser. With the shading group attributes showing the Attribute Editor (select Mode → Select and then Window → Attribute Editor), you can re-assign another material to the shading group.
Assigning a single material to many shading groups One slick thing you can do with the Assign Color to New Groups in the Options menu is turn it off. Say you have 100 objects in your scene and you want each object to be lit using a separate light without having to assign 100 materials to 100 separate shading groups. Turn off Options → Assign Color to New Groups and use Edit → Create Shading Group as you normally would. As you create shading groups, they are all assigned to a single material such as a Phong. By default, this is the material assigned to the initial shading group. When you are ready to use the light lists or other properties, you can get all those objects lit using the light lists of the different shading groups even though only a single material is used for all the shading groups.
Using the Shading Groups Editor Clicking the left mouse button on items in the menu bar gives you access to the commands. You can also access these commands by clicking the right mouse button within the window to display the pop-up menus.
Mode menu Once you select a shading group, you can select one of three modes for manipulating it: Editing
Lets you modify the selected shading group.
Select Contents
Shows the geometry assigned to a shading group.
Using Maya: Rendering
73
Rendering Basics
The newly created shading group is assigned for example to the color of the material you assign or to any texture you want.
Using the Shading Group Editor Using the Shading Groups Editor Select
Selects shading groups.
Edit menu Choose any of the following: Create Shading Group
Includes the selected polygonal facets into a shading group unless the selected items are already assigned to a non-default shading group.
Create Shading Group (force)
Forces selection in the newly created shading group even if it is already assigned to a shading group other than the initial shading group. Because a component can belong to only one shading group at a time, the items are removed from the original shading group and placed in the new shading group that you are going to create.
Add Items
Adds selected items to the shading group that is currently selected.
Add Items (force)
Adds selected components to the currently active shading group even if they are already in a shading group other than the initial shading group. Because a component can belong to only one shading group at a time, the items are removed from the original shading group and placed in the new shading group that you are adding to.
Remove Items
Removes selected items from the currently selected shading group and puts them back in the initial shading group.
Delete Shading Group
Deletes the selected shading group.
Rename Shading Group
Renames the selected shading group.
Shading Group Attributes
Displays the Attribute Editor.
Options menu Assign Color to New Groups
Each time you create a new shading group, it is colored, making it easy to distinguish from other shading groups.
Menu items in common with the Set Editor Because the rest of the menu options are the same as for the Set Editor, see the Sets part of the Using Maya: Hypergraph, Sets & Expressions book for details on sets.
74
Using Maya: Rendering
Rendering Basics
6
Using the Connection Editor This chapter contains the following sections: •
“Loading the Connection Editor” on page 76.
•
“Navigating a node network” on page 76
•
“Making connections” on page 78.
•
“Breaking connections” on page 84.
•
“Connection Editor menu and button options” on page 85. The Connection Editor presents node network information in a side-by-side layout, which allows you to view two nodes that are connected in a node network. You can make and break shading network connections in the Connection Editor. This editor is particularly useful for fine-tuning a shading network. The Connection Editor is the best a tool for making non-default connections because you can easily and quickly traverse from node to node in a network. You can configure the Connection Editor to show you a node’s outputs or inputs, which means you can make connections in either direction in a node network. In the Connection Editor, you can navigate up a network to a fork, and then navigate down a different prong, as in the case where you have a texture outputting to two shading groups.
This view of the Hypergraph shows a checker texture node outputting to two shading groups. Using the Connection Editor, you can navigate and make connections anywhere along the node’s network.
Using Maya: Rendering
75
Using the Connection Editor Loading the Connection Editor
Loading the Connection Editor Before you can make or break connections between two networked nodes, you need to load the Connection Editor with the node network. There are four ways to load the Connection Editor:
From the Multilister In the Multilister, use the middle mouse button and Shift-drag one node onto another node (for example, drag a texture onto a shader). This action loads the two nodes to the left and right sides of the editor, respectively.
Drag from Multilister to Connection Editor In the Multilister, use the middle mouse button to drag a node into the left or right side of the Connection Editor.
Drag from one side to the other In the Connection Editor, use the middle mouse button to drag a node from one side to the other.
Using the Reload Left/Right buttons Loads the currently selected node into the left or right side of the editor.
Navigating a node network When you load a networked shading node into the left or right side of the Connection Editor, you can navigate up or down the node network, using either the navigating buttons or the right mouse button.
Using the Navigating buttons The navigating buttons load the node upstream or downstream from the currently loaded node. For example, when you load a networked shading node into the left side of the Connection Editor, you can use the right mouse button to click the right navigating button and see all the nodes that the selected node outputs to.
76
Using Maya: Rendering
Using the Connection Editor Navigating a node network
Using the right mouse button You can click the right mouse button over a connected attribute to display a menu of connected nodes. Selecting one of the nodes loads the node into the Connection Editor. For example, if you have a Ramp texture connected to several shading groups, you can click the right mouse button over the ramp’s Out Color and see the nodes that are in the network. Selecting one of the nodes loads it into the right side of the editor. Position the pointer over the Out Color attribute text, and use the right mouse button to display a list of the nodes that are in the network. Selecting one of the nodes in the list loads the node into the Inputs side of the Connection Editor.
Using Maya: Rendering
77
Rendering Basics
Use the right mouse button to click over the right navigating button to see all the downstream nodes in the network.
Using the Connection Editor Making connections
Making connections You can explicitly connect any two compatible attributes using the Connection Editor. For example, you can connect a particular texture attribute to a particular material attribute. When you highlight an attribute in the Output side, all the compatible (or valid) attributes are listed on the Input side. Non-compatible attributes are disabled, as shown below.
Noncompatible attribute Compatible attribute
78
Using Maya: Rendering
Using the Connection Editor Making connections
Rendering Basics
Note Some attributes are compound, meaning that several attributes together form a larger attribute (for example, Out Color is a compound attribute that is made up of Out Color R, Out Color G, and Out Color B). Just because a compound attribute is disabled, does not mean that the attributes that form it are also disabled. You must can expand the compound attribute to see if all the attributes within it are disabled or compatible.
Making connections: The procedure You have the option of making connections either manually or automatically. See “Options menu” on page 85.
To make connections using the Connection Editor: 1
In the Multilister, press Shift and use the middle mouse button to drag a texture onto a shading group (see “Quick tour of the Multilister” on page 19). The Connection Editor appears and displays the output attributes of the texture and the input attributes of the shading group.
2
Click on any attribute on the Output side of the editor. The Input side displays all the valid attribute connections that can be made. Nonvalid Input connections are disabled. Using Maya: Rendering
79
Using the Connection Editor Making connections 3
Click on any valid attribute on the Input side of the editor. The highlighted text changes from normal to bold-italics, indicating that the connection is made.
The checker texture is the upstream node, and it provides the output attributes to the shading group node. You can change the direction of the connections shown by clicking the from → to button.
When you make a connection between an output attribute and an input attribute, the input attribute text changes from normal to bold-italics.
80
Using Maya: Rendering
Using the Connection Editor Making connections
Making connections: an example
1
Create a phong shading group, a checker texture, and a ramp texture using the Create Render Node window (in the Multilister, select Edit → Create...).
2
Use the middle mouse button to drag the checker texture onto the phong shading group.
The phong shading group icon changes to reflect the checker texture’s input.
Using Maya: Rendering
81
Rendering Basics
To connect ramp outcolor to checker color1:
Using the Connection Editor Making connections 3
Expand the phong shading group so you can see the phong material icon and the checker texture icon.
Click here to expand the phong shading group’s icon.
4
Press Shift and use the middle mouse button to drag the ramp texture icon in the Textures tab onto the checker texture in the General tab. The Connection Editor is displayed, with the ramp attributes on the left (Output side) and checker attributes on the right (Input side).
Tip You can also use the middle mouse button and drag the ramp texture onto the checker texture in the Textures tab of the Mulitilister.
82
Using Maya: Rendering
Using the Connection Editor Making connections 5
Click on the ramp’s Out Color attribute.
Click here to see the checker’s valid input connections from the ramp. These are the checker’s valid input connection attributes for the ramp’s Out Color.
Using Maya: Rendering
83
Rendering Basics
The compatible (or valid) attribute connections you can make to the checker texture are enabled.
Using the Connection Editor Breaking connections 6
Click the checker texture’s Color1 attribute to connect it to the ramp texture’s Out Color.
The checker’s Color1 attribute text changes from normal to bold-italics, indicating that the connection between it and the ramp’s Out Color is made.
The result is that the ramp’s Out Color is mapped to the checker’s Color1 input.
Breaking connections You break connections the same way you make them. You have the option of breaking connections either manually or automatically. (see “Options menu” on page 85).
To break a connection using the Connection Editor: 1
Open the Connection Editor by pressing the Shift key and using the middle mouse button to drag a texture onto a shading group. The Connection Editor is displayed.
2
84
Select the Output attribute of the connection you want to break.
Using Maya: Rendering
Using the Connection Editor Connection Editor menu and button options The Input attribute of the connection is highlighted. Click on the highlighted text of the Input attribute to break the connection. The text changes from bold-italics to normal when the connection is broken.
Tip To make or break connections manually, select Options and toggle OFF Auto-connect. The Break and Make buttons become enabled, and you can use them to manually make and break connections. You can also break connections in the attribute editor, by placing the right mouse button over the label of the attribute you want to disconnect, and selecting Break Connection.
Connection Editor menu and button options Options menu Auto-connect
When toggled on, lets you make and break connections automatically by clicking on input attributes. When toggled off, lets you make and break connections manually by selecting attributes and using the Break and Make buttons to make and break connections.
Left/Right Side Filters menu Show Readable
Lists all the readable attributes (attributes that are outputs or both outputs and inputs).
Show Outputs Only
Lists only the node’s output attributes.
Show Inputs Only
Lists only the node’s input attributes.
Show NonKeyable
When toggled off, shows only the node’s keyable attributes. When toggled on, shows both keyable and non-keyable attributes.
Show Connected Only
Lists only the node’s connected attributes.
Show Hidden
When toggled off, hidden attributes are not shown. When toggled on, both hidden and visible attributes are shown. Using Maya: Rendering
85
Rendering Basics
3
Using the Connection Editor Connection Editor menu and button options
Reload Left/Right buttons Load the currently selected node(s) into the left or right side of the editor.
from → to button Changes the direction in which you make connections. By default, node outputs appear on the left side with node inputs on the right. Clicking the from → to button reverses this setup. The from → to button changes the direction in which you make connections.
When the direction of the connection is from the left side to the right side, outputs are shown on the left and inputs are shown on the right side of the editor.
When the direction is reversed, inputs are shown on the left and outputs are shown on the right. Notice that the checker’s valid Inputs are different than its valid outputs.
Node network navigating buttons Navigating buttons
86
Using Maya: Rendering
Using the Connection Editor Connection Editor menu and button options
For example, if you have a phong material loaded in the right side of the editor, and you click the downstream button, the phong material gets loaded in the left side of the editor, and the phong shading group node is loaded into the right side.
Tip You can click the right mouse button over the Navigating buttons to see what other nodes are connected in the node network, and to navigate to those nodes.
Clear All Removes all the nodes from both sides of the Connection Editor.
Remove Removes the node(s) from the side of the Connection Editor that was last selected. You can traverse upstream or downstream from the remaining node after you remove a node. Using Maya: Rendering
87
Rendering Basics
Load the next node in the node network into the Input and Output sides of the editor.
Using the Connection Editor Connection Editor menu and button options
Break Allows you to manually break connections. Options → Auto-connect must be turned off in order for this button to work.
Make Allows you to manually make connections. Options → Auto-connect must be turned off in order for this button to work.
88
Using Maya: Rendering
The Relationship Panel (Lighting → Relationship Panel) is a text-based tool that performs functions similar to the Light Linking and Shading Group tools located in the Multilister.
The Relationship Panel has many of the same features as the Outliner (Windows → Outliner, see Using Maya: Basics). In addition, you can use the Relationship Panel to select objects and lights in your scene. You can also create shading groups in the Relationship Panel. The chapter contains the following sections •
“Selecting objects and lights” on page 90
•
“Light linking” on page 90
•
“Assigning shading groups to objects” on page 93
Using Maya: Rendering
89
Rendering Basics
7
Using the Relationship Panel
Using the Relationship Panel Selecting objects and lights
Selecting objects and lights As with the Outliner, you can select objects and lights by using the Relationship Panel.
To select objects and lights: 1
Create a scene that has objects and lights.
2
Select Lights → Relationship Panel. Objects and lights in your scene are displayed on the left side of the panel. You can filter the left side of the panel so you only see the nodes you want to see (see the Outliner, in Using Maya: Basics).
3
Click on a light or an object. The light or object gets selected in the view. You can select many lights and objects at once by dragging over the ones you want to select (use Shift or Ctrl to select multiple, nonadjacent objects).
Light linking There are two ways to link lights in the Relationship Panel: using Single Selection or Multiple Selection.
To link lights using Single Selection: 1
90
Select List → Single Selection (you can also use the right mouse button in the right side of the panel).
Using Maya: Rendering
Using the Relationship Panel Light linking 2
Select Mode → Light Lists.
This object is connected to the initialShadingGroup Highlighted labels indicate that lights are linked to an object Click to unlink No highlight indicates light is not linked Click to link
3
Click the text of a light on the right side to link it to the object. Click again to unlink it.
Note Remember, lights are connected to shading groups, not to objects, so the objects you see listed on the left side are actually objects that are assigned to shading groups.
To link lights using Multiple Selection: 1
Select List → Multiple Selection (you can also use the right mouse button in the right side of the panel).
2
Select Mode → Light Lists.
Using Maya: Rendering
91
Rendering Basics
On the left side of the panel, lights and objects are displayed. When you select an object on the left side, the selected object and all the lights in the scene are displayed on the right side.
Using the Relationship Panel Light linking 3
Select one or multiple objects on the left side of the panel (use Shift or Ctrl to select multiple, nonadjacent objects). The objects are displayed on the right side of the panel. When you expand them, the lights that are linked to them are displayed.
Expand to see lights connected to objects. Use the middle mouse button to drag a light to an object.
4
92
To link a light to a shading group, use the middle mouse button to drag a light from the left side onto the text of the object on the right side. You can also drag lights from object to object on the right side of the panel. To unlink lights, select the light, then use the right mouse button to select Edit → Remove Items.
Using Maya: Rendering
Using the Relationship Panel Assigning shading groups to objects
Assigning shading groups to objects Rendering Basics
You can create shading groups and assign them to objects in the Relationship Panel.
To create a shading group: 1
Select Lighting → Relationship Panel.
2
Select List, and turn on All Shading Groups.
3
In the Relationship Panel, select Edit → Create Shading Group (you can also use the right mouse button in the right side of the panel). The new shading group is displayed on the right side of the panel, labeled Set1, Set2, and so on. You can change the label by double-clicking on it, and typing a new name. Press Enter to accept the new name. You can assign the shading group to an object (see below).
To assign a shading group to an object: 1
Select List → Multiple Selection, and turn on All Shading Groups, so you can see all the shading groups you create and those already created.
2
Select Mode → Shading Lists.
Using Maya: Rendering
93
Using the Relationship Panel Assigning shading groups to objects 3
Select an object on the left side of the panel, for example, a nurbsShpere. Use the middle mouse button to drag the object onto a shading group’s text in the right side of the panel. You may have to expand the shading group to see the object. The shading group is now assigned to the object. To unassign a shading group, highlight the object on the right side of the panel, and use the right mouse button to select Edit → Remove Items.
94
Using Maya: Rendering
Rendering Flags Selecting objects, textures, and materials
Rendering Basics
8
Rendering Flags The Rendering Flags window (Window → Rendering → Editors Render Flags) lets you select objects, textures, lights, materials, and so on. You can also set the attributes for these nodes.
This chapter contains the following sections: •
“Selecting objects, textures, and materials” on page 95
•
“Setting Rendering Flags” on page 96
Selecting objects, textures, and materials You can select objects, lights, dynamics, cameras, textures, and materials. The procedure is the same for all.
To select objects: 1
Open a scene.
2
Select Window → Rendering Editors → Rendering Flags.
3
In the Show menu, select the node category you want to display, for example, Objects. The objects in your scene are displayed on the left side of the panel.
4
Select an object by clicking its label. Using Maya: Rendering
95
Rendering Flags Setting Rendering Flags The object is selected in the views. You can select multiple, nonadjacent objects using the Shift or Ctrl keys. The object’s flags, or attributes, are displayed on the right side of the panel.
Setting Rendering Flags You can set rendering flags, or attributes of objects, lights, dynamics, cameras, textures, and materials. The panel is similar to the Outliner (see Outliner in Using Maya: Basics).
To set attributes: 1
Open a scene.
2
Select Window → Rendering Editors → Rendering Flags
3
In the Show menu, select the node category you want to display, for example, Objects. The objects in your scene are displayed on the left side of the panel.
4
Select an object by clicking its label. The object is selected in the views. You can select multiple, non-adjacent objects using Shift or Ctrl keys. The object’s flags, or attributes, are displayed on the right side of the panel.
5
96
On the right side of the panel, you can turn attributes on or off and set numerical values.
Using Maya: Rendering
Rendering Flags Setting Rendering Flags
Rendering Basics
Note You can also set rendering attributes in the Spreadsheet, in render node attribute editors, and in the Channel Editor.
Using Maya: Rendering
97
Rendering Flags Setting Rendering Flags
98
Using Maya: Rendering
Rendering Basics
9
Batch Rendering This chapter contains the following sections: •
“Batch rendering from the command line” on page 99
•
“Batch rendering within Maya” on page 102 Batch rendering allows you to render a series of images in an animation. Use the batch render option when you are ready to render an entire animation using the full power of your workstation. The batch renderer does not require the use of Maya’s user interface. Since batch rendering consumes memory, we do not recommend that you perform batch rendering concurrently with an interactive Maya session. You can batch render within Maya or from the UNIX command line.
Batch rendering from the command line Ideally, perform your batch rendering on a dedicated machine from the command line. This allows you to continue working in Maya on another machine while you perform the batch render. You can specify a number of options from the command line. See the table on the following pages for a complete list of batch render options.
To batch render from the command line: At the command prompt, type: Render
where is (generally) a Maya ASCII or Maya Binary file, and is one or more of the options in the following table:
Use...
For...
-s
start frame for the rendered animation sequence
-e
end frame for the rendered animation sequence
Using Maya: Rendering
99
Batch Rendering Batch rendering from the command line
Use...
For...
-b
by frame for the rendered animation sequence
-be
by extension (or step) for the output image frame file name extension
-se
starting number for output image frame extensions
-rd
the directory to store pix/depth file
-im
image file output name
-p
image file output name (identical to -im)
-me
append Maya filename to image name
-mf
append image file format to image name
-d
depth file output name
-ar
aspect ratio for the rendered image
-sa
shutter angle for motion blur (1-360)
-uf
use the tessellation file cache
-oi
dynamically detects similarly tessellated surfaces
-rut
reuse render geometry to generate depth maps
-edm
enable depth map usage
-ert
enable raytracing
-rfl
maximum raytracing reflection level
-rfr
maximum raytracing refraction level
-sl
maximum raytracing shadow ray depth
-eaa
the anti-aliasing quality of EAS (Abuffer). One of: highest, high, medium, or low
-ufil
in on, use the multi-pixel filtering, otherwise use single-pixel filtering
-ss
global number of shading samples per surface in a pixel
100
Using Maya: Rendering
Batch Rendering Batch rendering from the command line
For...
-mss
maximum number of adaptive shading samples per surface in a pixel
-mvs
number of motion blur visibility samples
-mvm
maximum number of motion blur visibility samples
-vs
global number of volume shading samples
-pss
number of particle visibility samples
-rct
red channel contrast threshold
-gct
green channel contrast threshold
-cct
pixel coverage contrast threshold (default is 1.0/8.0)
-cam
all subsequent -im -p -d -ar -sa flags apply only to
-g
gamma value
-ifg
use the film gate for rendering
-ih
height of image in pixels
-iw
width of image in pixels
-mm
allows you to specify the maximum memory used by the renderer
-mb
motion blur on/off
-mbf
motion blur by frame
-of
output image file format (one of the following: gif, si soft softimage, rla wave wavefront, tiff tif, tiff16 tif16, sgi rgb, alias als pix, iff tdi explore, jpeg jpg, eps)
-pad
number of digits in the output image frame extension
-verbose
perform the render verbosely if on
-x
set the X resolution of the final image
-y
set the Y resolution of the final image
-xl
set the X subregion left pixel boundary of the final image
Using Maya: Rendering
Rendering Basics
Use...
101
Batch Rendering Batch rendering within Maya
Use...
For...
-xr
set the X subregion right pixel boundary of the final image
-yl
set the Y subregion low pixel boundary of the final image
-yh
set the Y subregion high pixel boundary of the final image
Batch rendering within Maya Use Batch Render to batch render small or test scenes from within Maya. For larger scenes, batch render from the command line (see “Batch rendering from the command line” on page 99). For information on how to view a scene after you render it, see Chapter 1, “The fcheck utility.”
To batch render from within Maya: 1
Choose Render → Batch Render The Batch Render window is displayed.
2
Enter the name of a Maya file you want to have written from to batch render, and click Batch Render. By default, Maya renders the animation images into the /images directory. The status of the rendering appears in the status bar in the lower right corner of the Maya window.
To batch render on a remote machine:
102
1
Save your scene.
2
Select Render → Batch Render - ❐.
3
Type the name of the machine on which you intend to render.
Using Maya: Rendering
Batch Rendering Batch rendering within Maya Select a Rendering CPU, either Local or Remote (this determines which machine’s processor is used).
5
Click Batch Render. The Batch Render (default) window is displayed.
6
Type the name of the file you want to batch render. If you type the same name you saved in Step 1, Maya will prompt you to confirm you want to overwrite that file. Type a new name if you want to render the file under a different name.
7
Click Batch Render. Watch the status line for the status information about the render.
To view the batch render: Choose Render → Show Batch Render. The view render window is displayed. You can now watch individual frames of a batch render during the rendering process.
To cancel the batch render: Choose Render → Cancel Batch Render. Maya prompts you to confirm. You can cancel a batch render at any time.
Using Maya: Rendering
103
Rendering Basics
4
Batch Rendering Batch rendering within Maya
104
Using Maya: Rendering
You can attach image planes to a perspective camera in an animation to create depth of field in a scene. You can also attach them to an orthographic camera and use them for modeling or rotoscoping. An image plane is useful only once you attach it to a camera. Start by creating a camera for the scene, then create an image plane and attach it to the camera you created. This chapter contains the following sections: •
“Creating a camera” on page 105
•
“Attaching an image plane” on page 107
•
“Loading an image” on page 110
•
“Deleting image planes” on page 110
•
“Loading a scene in the image plane” on page 111
•
“Image plane attributes” on page 113
Creating a camera You can create one, two, and three-node cameras in Maya. With a one-node camera, you can animate the orientation and position. With a two-node camera, you can animate the position and look at point of the camera.
To create a one-node camera: You can create cameras within Maya in one of two ways: From the Primitives menu
Select Primitives → Create Camera. A camera appears at the origin in the views, with the translate manipulators displayed so you can immediately position the camera where you want it.
Using Maya: Rendering
105
Rendering Basics
10
Using Image Planes
Using Image Planes Creating a camera
From the Panels menu
•
In a view, select Panels → Perspective → New. A camera is created, and you are automatically looking through the new camera, so the view is labeled persp1. To look through the default persp view so you can see the camera you just created, select Panels → Perspective → persp. You can translate the new camera by entering X, Y, and Z values in the translate fields of the Channel Box.
To create a two-node camera: 1
Select Primitives → Create Camera - ❐. The Create Camera Options window is displayed.
106
2
In the Animation Options section, select the Two node radio button.
3
Click Create, and then click Close.
Using Maya: Rendering
Using Image Planes Attaching an image plane
Attaching an image plane Rendering Basics
You can use 2D, 3D, and Environment textures with image planes.
Note Using a 3D or Environment texture with an image plane may cause the texture to swim if the camera is animated. To resolve this, you must link the texture to the camera, so the texture follows the camera in the animation. To link the texture to the camera, parent the place3dTexture node to the animated camera.
Using the Multilister To attach an image plane to a camera: 1
Create a camera for the scene.
2
Select Window → Multilister to open the Multilister, then go to the Cameras tab. You will see the CameraShape or perspShape2 icon for the camera that you just created.
3
Double-click the new camera icon to open the camera’s attribute editor.
Using Maya: Rendering
107
Using Image Planes Attaching an image plane 4
In the Environment section, click Create next to Image Plane.
The image plane’s attribute editor appears, and an icon for the image plane appears in the Multilister. The icon is black, indicating that there is no image currently loaded in the image plane. The image plane you create is attached to the camera you created. You must load an image or a texture. For more information on loading an image or a texture, see “Loading an image” on page 110.
Tip To attach an orthographic image plane for modeling purposes, click the Fixed radio button next to Image Plane in the Image Plane Attributes section of the image plane’s attribute editor. To attach a perspective image plane, click the Attached To Camera radio button.
Note You can change the name of the camera by using the attribute editor or by double-clicking the text under the icon in the Multilister and then entering a new name.
108
Using Maya: Rendering
Using Image Planes Attaching an image plane
Using drag and drop Rendering Basics
To attach an image plane using drag and drop: 1
Create a camera for the scene.
2
In the Mulitilister, use the right mouse button → Edit → Create. The Create Render Node window is displayed.
3
Go to the Utilities tab, then click Image Plane in the Image Planes section. An image plane icon is displayed in the Textures and Cameras tabs in the Multilister.
4
Use the middle mouse button to drag the image plane icon onto a camera icon in the Cameras tab.
Using Maya: Rendering
109
Using Image Planes Loading an image The image plane is connected to the camera. You must load an image or a texture.
Loading an image To load an image into an image plane: 1
Create a camera and attach an image plane to it.
2
Double-click the image plane icon in the Multilister to open the image plane’s attribute editor.
3
In the Image Plane Attributes section, click Browse next to Image Name, select the image file (or type the path and name of the image file in the field), and click Open. The image you selected appears in the Image Plane Sample in the imagePlane attribute editor and in the image plane icon in the Multilister. You can adjust the Coverage, Size, Offset, Depth, Center, Width and Height attributes of the image plane in the Placement section of the attribute editor.
Tip To see the image on the image plane in your views, select Shading → Smooth Shade All.
Deleting image planes To delete an image plane: 1
In the Multilister, go to the Cameras tab, and select the image plane you want to delete. The dotted yellow line surrounding the cameral icon indicates that the selected image plane is attached to that camera.
110
Using Maya: Rendering
Using Image Planes Loading a scene in the image plane 2
Use the right mouse button → Edit → Delete Highlighted. Rendering Basics
The image plane is deleted from the Multilister and from the views.
Note You can also delete an image plane by using the Select by component type button. Select the image plane you want to delete in a view, then press Delete. The image plane is deleted from the views and from the Multilister.
Loading a scene in the image plane To load a scene in the image plane: 1
Create a camera for the scene (see “To create a one-node camera:” on page 105).
2
Attach an image plane to the camera (see “To attach an image plane using drag and drop:” on page 109).
3
In the Placement section of the image plane’s attribute editor, change the Depth to 20 from 100.
4
In the Image Plane Attributes section, click Browse next to Image Name, or type in the path and file name of the image you want to load.
Using Maya: Rendering
111
Using Image Planes Loading a scene in the image plane When you are rotoscoping, you must enter one image file from a series of image files that are part of a scene or animation. The image is displayed in the Image Plane Sample in the attribute editor.
Tip To see the image on the image plane in your views, select Shading → Smooth Shade All. 5
Toggle on Use Frame Extension. The Frame Extension box is enabled.
6
112
In the Timeline, make sure you start on time 1 (see Using Maya: Animation).
Using Maya: Rendering
Using Image Planes Image plane attributes In the image plane attribute editor, set a key for time 1 by clicking the right mouse button over the Frame Extension label, and selecting Set key.
8
In the Timeline, go to the last time. For example, if the Timeline has 24 seconds, go to time 24.
9
Enter the number of the last image in the series on the Frame Extension box. The image plane in the view updates, displaying the image file you just entered.
10 Set a key. You can play the animation by clicking the Play button in the Timeline.
Image plane attributes Display
Selects where you see the image plane from: looking through camera or in all views.
Display Mode
Selects the image plane’s display mode: one of: None, Outline, RGB, RGBA, Luminance, Alpha. Using Maya: Rendering
113
Rendering Basics
7
Using Image Planes Image plane attributes Color Gain
The color gain.
Color Offset
The color offset.
Alpha Gain
Scale factor for the alpha channel.
Image Plane
Determines where the image plane is created, either Attached to Camera or Fixed.
Type
Either Image File or Texture.
Image Name
If you use an image file, you can browse for the name, or enter the name in the Image Name field.
Use Frame Extension
Off by default. When on, you can use a Frame Extension number.
Frame Extension
The frame extension number.
Texture
Maps a texture to the image plane if you click Map. The texture is not displayed in the views, and its placement is a texture placement, not the placement of the image plane. Use the > button to navigate to the upstream node. Click the Map button a second time to break a connection and/or make a new connection.
Placement attributes for attached image planes An attached image plane moves relative to the camera. This is the default image plane created on perspective cameras. Size
The width and height of the image plane as measured in the camera’s film back (inches). The image plane will be clipped if the size is greater than the camera’s film aperture.
Squeeze Correction
Horizontal stretch to apply. Can be used to compensate for lens squeeze ratio and device squeeze ratio when image plane matching.
Offset
The width and height to offset the center of the image plane in the camera’s film back.
Depth
The distance the image plane is from the camera’s eye point along the view vector.
114
Using Maya: Rendering
Using Image Planes Image plane attributes
Placement attributes for fixed image planes
Center
The center position of the image plane in world space.
Width
The width of the image plane in world space.
Height
The height of the image plane in world space.
Image plane fit Fill
Ensures the image fills the entire coverage rectangle (defined by image plane’s size if the image plane is attached, or the width and height if the image plane is fixed). The image aspect ratio is maintained. The image may extend horizontally or vertically past the coverage rectangle.
Best
Ensures the image fits inside the entire coverage rectangle. The image aspect ratio is maintained.
Horizontal
Ensures the horizontal width of image is inside the coverage rectangle. The image aspect ratio is maintained, and the image may extend vertically past the coverage rectangle.
Vertical
Ensures the vertical height of the image is inside the coverage rectangle. The image aspect ratio is maintained, and the image may extend horizontally past the coverage rectangle.
To Size
The image will fill the entire coverage rectangle and the image aspect ratio is not maintained (the image will be stretched).
Image plane crop Allows the user to extract a sub-region from the input image. Coverage X
Specifies the number of horizontal pixels to include in the sub-region.
Coverage Y
Specifies the number of vertical pixels to include in the sub-region.
Coverage Origin X
Horizontal offset in pixels to the bottom left corner of the sub-region.
Coverage Origin Y
Vertical offset in pixels to the bottom left corner of the sub-region.
Using Maya: Rendering
115
Rendering Basics
A fixed image plane is independent of the camera, and occupies a fixed position in world space. The image plane automatically orients itself to face the camera when the camera moves, and is well suited for tracing. Fixed image planes are created by default for orthographic cameras.
Using Image Planes Image plane attributes
116
Using Maya: Rendering
Partial image rendering lets you render a specific part of an image, for example, if you adjust a parameter and want to see the effect on a particular part of an image, without rendering the whole image again. This can save time during the testing stages of your rendering. This chapter contains the following sections: •
“Rendering part of an image” on page 117
•
“Test settings menu” on page 119
Rendering part of an image To render part of an image, you must start with a rendered image in the Render View window.
To render part of an image 1
Open the Render View window, and render an image (use the right mouse button → Render → persp). Wait for the image to be completely rendered.
Using Maya: Rendering
117
Rendering Basics
11
Partial Image Rendering
Partial Image Rendering Rendering part of an image 2
Make any changes to the parameters of the object or scene you are working on.
3
Using the left mouse button, drag a marquee around the part of the previous image you want to render.
A red marquee is displayed around the part of the image you want to render. 4
118
Use the right mouse button → Test settings → Test resolution → Render Globals (256x256).
Using Maya: Rendering
Partial Image Rendering Test settings menu 5
Use the right mouse button → Render region.
Test settings menu The Test Settings menu contains items to help you customize your test render scenarios. Set the test resolution for the Render View window.
Test resolution
•
Camera panel
•
Render globals (256x256)
•
50% globals (128x128)
•
25% globals (64x64)
•
10% globals (25x25)
Auto resize
Prevents the Render View window from resizing the image each time you render.
Auto render region
When this is set, renders the image as soon as you finish dragging a marquee in the Render View window.
Redo last takes region
Renders the last region that was rendered.
Using Maya: Rendering
119
Rendering Basics
Only the part within the red marquee is rendered. The rest of the image is still displayed in the Render View window.
Partial Image Rendering Test settings menu Show region
120
Displays the red marquee in the Render View window. The marquee disappears when you render at full resolutions, so to see the marquee, you must use Show region.
Using Maya: Rendering
Rendering Basics
12
Animating Render Node Attributes You can animate render nodes and their attributes (for example, a light’s intensity or a texture’s bump value) in Maya. Animating render node attributes has a simple workflow, and can be done in a few simple steps.
Animating render node attributes The following example describes how to animate the Intensity of a light. The same procedure works for all render node attributes, whether you’re animating a texture, a bump map, or a the Density attribute of an Environment Fog shader.
To animate a light’s Intensity attribute: 1
Create a Spotlight and open its attribute editor.
Use the right mouse button → Set Key to set a key for the Spotlight’s Intensity attribute.
2
In a modeling view, click the timeline to establish a frame (see Using Maya: Animation). Using Maya: Rendering
121
Animating Render Node Attributes Animating render node attributes 3
In the Spot Light Attributes section of the Spotlight’s attribute editor, position the cursor over the Intensity label, then use the right mouse button → Set Key. A key tick is created in the timeline, indicating that a key has been set for the Intensity.
122
4
Click the timeline again in another frame.
5
Set another key for the Intensity attribute by repeating Step 3.
Using Maya: Rendering
Index A
B Ball Swatch Primitive 34 Barn Doors 58 Barn Doors toggle 58 Basic filter Filter menu 37 Batch Render cancel 103 view 103 Batch Rendering command line 99 in Maya 102 on remote machine 102 options 99 Box swatch primitive 34 Break 88
button options Connection Editor 84 buttons from to 86 Make Connection Editor 88 Navigating 76 Pin 39 Reload Left/Right 86 Shading Group 23 Use Depth Map Shadows 49 By Extension 62 By Frame Step 62
C camera creating 105 Cameras Filter menu 38 cameras Panels menu 106 Primitives menu 105 cancel Batch Render 103 casting shadows 49 Clear All 87 Clip Final Shaded Color 63 Collapse Expand/Collapse 34 Collapse All Expand/Collapse 34 collapse swatches in Multilister 21 Color Edit menu 32 light attributes 59 Particle Age Map 32
Using Maya: Rendering
Ind ex
active tab 21 adding to shading groups 71 All in Tab Edit menu 31 All Types Filter menu 38 Alpha Gain 114 Always Filter Filter menu 37 Always Sort Display menu 35 Ambient lights, 54 animating render nodes 121 animating attributes 121 animation attributes 62 rendering 61 Animation attributes 62 Animation Range 62 Apply Filter Filter menu 37 As Columns Display menu 36 As Icons Display menu 35 As List Display menu 35 As Output Format 63 Aspect Lock 64 Assign Edit menu 31
assigning colors to shading groups 72 shading groups 23 shading groups to single material 73 Attribute Editor drag connections 22 Window menu 36 attribute editor opening 13 Attribute Spread Sheet Window menu 36 attributes animating 121 animation 62 Image Planes 114 image planes 113 spot lights 57 Auto-connect 85
123
Index
color assignment of shading groups 72 lights 46 Color Chooser 48 Color Curves 59 color editor 48 Color Gain 114 Color Offset 114 Columns View Multilister tools 39 command line Batch Rendering 99 components assigning 28 Composite 63 Composite Threshold 63 Cone swatch primitive 34 Cone Angle 57 Connect Highlighted Window menu 36 Connection Editor breaking connections 84 loading 76 making connections 78 using 75 Window menu 36 Connection Editor menu 84, 85 connections breaking Connection Editor 84 making Connection Editor 78 making in Connection Editor 79 Convert Solid Texture Edit menu 33 Create Edit menu 31 tab 34
124
Using Maya: Rendering
Create Ambient Light 44 Create Directional Light 44 Create Filtered tab 35 Create Point Light 44 Create Render Node window 24 Create Spot Light 44 creating cameras 105 lights 43 shading groups 69, 93
D Decay 56 and directional lights, 55 Decay Rate 56 Decay Regions 58 defaultLightList 42 Delete By Type Edit menu 31 Delete Highlighted Edit menu 31 Delete Unused Edit menu 31 deleting image planes 110 shading groups 74 Device Aspect Ratio 64 Directional lights, and decay, 55 Display 113 options 21 Display menu 34 Display Mode 113 displaying shading groups 70
drag connections in Attribute Editor 22 connections in Multilister 22 image planes image planes drag 109 to make connections 22 Dropoff 58
E Edit menu 31 editing shading groups 73 Enable Depth Maps 63 End Distance1 58 End Frame 62 Environment Fog 63 exclusive 43, 60 Expand Expand/Collapse 34 expand swatches 21 Expand All Expand/Collapse 34 Expand/Collapse Display menu 34 Export as File menu 30 Export Highlighted File menu 30 Extension Padding 62
F Field Ext Control 63 Fields 64 File menu 29
Index
Filter menu 36 Fog Intensity 56, 59 Radius 56, 58 Type 56, 58 Folder View Multilister tools 39 Frame Extension 114 from to button 86
G Gamma Correction 63 General tab 21
H Hide All Filter menu 37 Hide Highlighted Filter menu 37 Highlight into Work Area Filter menu 39 Highlight List 20 Highlight Mode 19, 21 Select menu 33 Highlight Selected Select menu 33 Hypergraph viewing connections 26 Hypergraph Highlighted 26 Window menu 36
Ignore Film Gate 63 Ignored lights 42
K Keyframe Edit menu 31
L Left/Right Side Filters menu 85 Light File menu 30
Light... File menu 30 Light Effects 56, 58 Light Fog 56, 58 Light Glow 56, 59 light linking Relationship Panel 90 Lighting a Scene 41 Lights Edit menu 31 lights adjusting color 46 creating 43 defaultLightList 42 exclusive 43 ignored 42 in Maya 42 spot lights 57 Lights, ambient, 54 directional, and decay, 55 point, 55 spot, 57 Link To Object Edit menu 33 List View Multilister tools 39 loading Connection Editor 76 image planes 111 Lock Device Aspect Ratio 64 Look Through Selected 46
M
Ind ex
I
image 107 loading image planes 110 rendering partial 117 Image Name 114 Image Plane 114 attributes Texture 114 Type 114 image plane attaching 107 loading a scene 111 loading an image 110 image plane attributes 113 Image Planes Filter menu 38 using 105 image planes deleting 110 Incandescence Particle Age Map 32 initialShadingGroup 21, 68 Input Connection Editor 78 Intensity 59 Intensity Curve 59 Intensity Sample 41, 59
Make button Connection Editor 88 making connections dragging 22
Using Maya: Rendering
125
Index
Map Displacement Edit menu 32 Map Surface Edit menu 32 Map Volume Edit menu 32 Materials filter Filter menu 37 menus Connection Editor 84, 85 Edit 31 File 29 Left/Right Side Filters 85 Multilister 29 Options 85 right mouse button Connection Editor 77 Modify Extension 62 motion blur 62 By Frame 62 Move Tab Down Tabs 35 Move Tab Up Tabs 35 Multilister drag connections 22 image plane 107 menus 29 quick tour 19 using 19 Multiple Selection light linking 91 Relationship Panel 91
N navigating node networks 76 Navigating buttons 76, 86
126
Using Maya: Rendering
Negative intensity of lights 59 networks node navigating 76 New Items First Display menu 35 None Render Globals 63
Penumbra Angle 57 Pin button Multilister tools 39 Point lights, 55 Preferences File menu 30 Primitives menu cameras 105
O
R
Odd Field First 64 Odd/Even Field Ext 63 one-node camera creating 105 options Batch Rendering 99 Options menu 85 Other Filter menu 38 Out Format Control 63 Output Connection Editor 78 Output Extensions 62 Output Format Ext 63
Ray Depth Limit 60 raytrace shadow attributes 60 Region 1/2/3 58 Relationship Panel assigning shading groups 93 light linking 90 Multiple Selection 91 Single Selection 90 using 89 Reload Filter menu 37 Reload Left/Right buttons 86 Remove 87 Tabs 35 removing from shading groups 71 renaming shading groups 72 Render Globals opening 14 Scene File menu 30 View using 14 Render region 119
P Panels menu creating cameras 106 partial image rendering 117 Partial Image Rendering using 117 Particle Age Map Color, Incandescence, Transparency 32 Edit menu Color 32
Index
Render Scene File menu 30 rendering an animation 61 frames 9 rendering activities table 16 rendering attributes animating 121 rendering flags 95 Revert To Default File menu 30 right mouse button menu Connection Editor 77
S
Show All with Textures 38 Show Connected Only 85 Show Exclusive 38 Show Hidden 85 Show Highlighted Filter menu 37 Show Inputs Only 85 Show Lights 38 Show Linked 38 Smooth Shade All 11, 45 Sort Display menu 35 Sort By Display menu 35 Spot lights, 57 Spot Light attributes 57 Spotlight Preview Display 58 Start Distance1 58 Start Extension 62 Start Frame 62 Start/End 61 starting Shading Groups Editor 69 Swatch Primitive Display menu 34 Swatch Quality Display menu 34 Swatches 21 swatches render-node 21
T Ind ex
Save Multilister File menu 30 Select tool 19 Select Assigned Select menu 33 Select Default Shaded Select menu 33 Select menu 33 selecting shading groups 70 Selection List 20 Set Default Shading Group Edit menu 32 Set Key animating render attributes 122 Shading Group button 23 shading group editor 67 Shading Group tool using 27
Shading Groups 38 Filter menu 38 shading groups and single material 73 assigning 23 Relationship Panel 93 assigning to components 28 creating 69, 93 definition of 67 deleting 74 displaying 70 editing 73 selecting 70 selecting contents only 70 selecting without contents 70 texturing 24 Shading Groups and Materials Edit menu 31 Shading Groups Editor 67 how to start 69 Shading Groups Editor... Window menu 36 Shading menu 45 Shadow Radius 60 Shadow Samples 60 shadows casting 49 making 49 Show Non Exclusive 38 Non Illuminating 38 Non-Keyable 85 Outputs Only 85 Readable 85 Selected Filter menu 37 Work Area Display menu 35 Show All 38 Show All with Lights 38
Tabs Display menu 34 Texture filter Filter menu 37
Using Maya: Rendering
127
Index
Texture/Material/Shading Group File menu 30 Textures Edit menu 31 texturing shading groups 24 timeline 121 toggles With Shading Group 24 Tool bar 39 tools Shading Group 27 Transparency Particle Age Map 32 Tube Swatch Primitive 34 two-node camera creating 106
V
U
Z
Update Button Multilister tools 39 Use All Lights using 45 Use Decay Regions toggle 58 Use Depth Map Shadows button 49 Use Frame Ext 62 Use Frame Extension 114 Use Maya File Name 62 User Input 63 using Use All Lights 45 Using Image Files filter Filter menu 38 Utilities Filter menu 38
Zeroth Scanline 64
128
Using Maya: Rendering
view Batch Render 103 batch render 103 viewing connections Hypergraph 26
W Width/Height 64 Window menu 36 windows Create Render Node 24 in Multilister 26 With Shading Group toggle 24 Work Area Button Multilister tools 39
Sets
Sets Contents
Sets 2 Sets
5
How you can use sets Understanding sets
6 7
Sets you create
8
Shading group sets created by Maya
9
Deformer and skin point sets created by Maya Understanding edit modes
13
Creating, selecting, and removing sets Creating a set
11
13
13
Selecting a set Removing a set
15 16
Creating sets for easy object selection Choosing set display formats Editing set membership
16
17
22
Adding set members
22
Removing set members
24
Adding or removing deformer and skin point set members Pruning deformer set membership Moving skin points to a different set Editing point weights
25
28 28
33
Painting point weights
37
Options for modifying point weight numbers
38
Selecting and keying point weight attributes
39
Altering the display of sets
40
Expanding and collapsing sets Filtering sets from display
40
40
Displaying sets associated with selected objects
41
Using Maya: Hypergraph, Sets & Expressions
3
Sets Contents Using bookmarks to display sets Understanding partitions Partitions you create
44
47 47
Partitions created by Maya
48
Creating, displaying, and removing partitions Adding and moving sets to partitions
4
Using Maya: Hypergraph, Sets & Expressions
51
49
1
Sets A set is a collection of objects or components. For example, a set might include geometric objects, NURBS CVs, polygonal vertices, lattice points, polygonal facets, or other items. Any item you can select can be in a set. In some instances, Maya creates sets for you as you work with objects. For example, when you add a cluster to several CVs of a NURBS cone, Maya makes a set of the CVs. You can edit and tune such sets to control the area affected by deformation. Sets
You can also create a custom set so you can work on its items with a single action. For instance, you can create a set of NURBS objects, then hide or display them as a single entity.
You can edit and tune sets to control deformation of one or more objects.
This chapter has the following topics: •
“How you can use sets” on page 6
•
“Understanding sets” on page 7
•
“Understanding edit modes” on page 13
•
“Creating, selecting, and removing sets” on page 13
•
“Choosing set display formats” on page 17 Using Maya: Hypergraph, Sets & Expressions
5
Sets How you can use sets •
“Editing set membership” on page 22
•
“Editing point weights” on page 33
•
“Altering the display of sets” on page 40
•
“Understanding partitions” on page 47
•
“Creating, displaying, and removing partitions” on page 49
•
“Adding and moving sets to partitions” on page 51
How you can use sets Here are the ways you can use sets: •
adjusting deformer, skin, and flexor deformation
•
adjusting the weight of cluster, cluster flexor, and skin points
•
simplifying selection of objects or components that you regularly select or have difficulty selecting in the workspace.
•
assigning objects to shading groups for rendering
•
moving objects from one layer to another If you apply a deformer or skin to a geometric object, Maya creates a set for the geometry’s CVs, vertices, or points. You can add or remove set members to alter the effect of the deformer or skin. See Using Maya: Animation for details on deformers and skins. For clusters and cluster flexors, you can apply different weights to the set members to increase or decrease deformations at specified points. For skin, you can apply different weights to the set members to increase or decrease skin deformation around the joints. You can create your own set of objects or components for easier selection and transformation. For instance, suppose you need to repeatedly select the same few CVs around the eye of a cyclops to animate the eye. Rather than struggle to select the CVs with a selection box, you might create a set named cyclops_eye for the CVs, then select the set by clicking the set name in a convenient set editing tool named the Set Editor. When you create a shading group with the Multilister, Maya creates a set that represents the shading group. You can work with such sets rather than the Multilister to conveniently assign shading groups to objects. See Using Maya: Rendering for details on shading groups.
6
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding sets When you create a layer, Maya creates a set that represents it. You can work with sets rather than layer menu entries to quickly move members from one layer to another. See Using Maya: Basics for details on layers. When you add a field to vertices, CVs, or edit points, Maya creates a set named after the field, for instance, uniformFieldShape1Set. The set members are the vertices, CVs, or edit points to which you added the field. You can add or remove the set members to alter the effect of the field. See Using Maya: Dynamics for details on fields.
Understanding sets
To start the Set Editor: From the main Maya menu, choose Window→General Editors→Set Editor. The Set Editor appears:
Menu bar Tool bar Sets
Items for editing point weights
Scale and move the window as needed. You can also display the Set Editor in a workspace panel by choosing Panels→Panel→Set Editor. This lets you see the Maya user interface and the Set Editor without having to reposition the windows.
Using Maya: Hypergraph, Sets & Expressions
7
Sets
It’s easiest to learn about sets by examining the display of the Set Editor, the main tool for working with sets. You can launch the Set Editor by selecting it from the main menu or with other common techniques such as the Hotbox.
Sets Understanding sets The menu bar has entries for working with sets, while the tool bar has icons for commonly used menu bar selections. To see the menu selection an icon represents, drag the pointer over the icon and look in the blue help box at the bottom of the Maya window. The name of the menu selection appears there. The bottom part of the Set Editor has items for editing point weights. See “Editing point weights” on page 33 for details.
Note Unless instructions in this chapter state otherwise, make all menu choices from the Set Editor’s menu bar.
Sets you create When you create a set, the Set Editor displays the set’s name and contents. You can apply an operation to a set to affect all its members.
Example Suppose you create three NURBS spheres. You can put the spheres in a set as follows: 1
Select the spheres in the workspace, Outliner, or elsewhere.
2
From the Set Editor, choose Edit→ Create Set. The Set Editor displays the newly created set: ‘
By default, Maya gives the set the name set1 or something similar. To use your own name rather than the default, choose Edit→ Create Set-❒. The Set Editor lists all sets in the scene. The initialShadingGroup and initialParticleSE are default sets that exist in every scene. The following topic gives more details on these sets. 3
Click the triangle next to the set to expand its contents. If you don’t see triangles in the Set Editor, turn on Mode→Editing first.
8
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding sets
Click here to expand or collapse the set.
4
To select the objects in the set, but not the set itself, turn on Mode→Select Contents.
5
Click the set name.
Sets
The set contains nurbsSphere1, nurbsSphere2, and nurbsSphere3. Items indented below a set name are its members. You can select the set to do operations on each of its members.
This selects the three spheres that are members of the set. With the sphere members selected, you can do operations such as: •
hide them from the workspace view
•
translate, rotate, and scale
•
start the Attribute Editor, so all three spheres are available for editing there Subsequent topics provide more details on working with sets.
Shading group sets created by Maya A new, empty scene has two sets by default: initialShadingGroup and initialParticleSE. These sets control the default shading of objects added to the scene. When you add a geometric object to the scene, the object becomes a member of the initialShadingGroup set by default. The shading group colors its members a dull gray. (You can see the default gray color of such objects in the workspace by choosing Shading→Smooth Shade All.) If you create a sphere, for instance, Maya adds the sphere to the initialShadingGroup set.
Using Maya: Hypergraph, Sets & Expressions
9
Sets Understanding sets
Member of the set initialShadingGroup
Maya keeps a newly added geometric object in the initialShadingGroup set until you create and assign a different shader to the object. Maya then relocates the object to a set it creates for the shading group you created. You typically won’t do anything directly with the initialShadingGroup set. It’s for Maya’s internal use as you make shading choices.
Example Suppose you use the Multilister to create a Phong material. When you create the node, Maya creates a set named phong1SG. This set represents the Phong shading group. Suppose further you use the Multilister to assign phong1SG to a geometric object named nurbsSphere1. Maya moves the object from the initialShadingGroup to the phong1SG set.
Member of phong1SG
The object receives its surface shading from the options you set in the Attribute Editor for the phong1SG node.
10
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding sets If you were to add a particle object to a scene, it would become part of the initialParticleSE shading group set. This set has the same purpose as initialShadingGroup, only it controls the default shading characteristics of particles rather than geometry. An object can be part of only one shading group set—whether initialShadingGroup, the initialParticleSE, or one you create. By looking at the members of the shading group sets, you can see which objects are shaded by the shading groups you’ve added to your scene. To try out various shaders on different objects, use the middle-mouse button to drag objects from one shading group set to another.
Sets
For more details on working with shading group sets, see the Shading Groups Editor documentation in Using Maya: Rendering. The Shading Groups Editor is a set editor tailored to shading objects.
Deformer and skin point sets created by Maya When you attach a deformer to an object, Maya creates a set from the object’s points. When you bind skin to a skeleton, Maya creates two or more sets for the skin points attached to the joints. See Using Maya: Animation for details on deformers and skin points.
Example Suppose you create a NURBS cone, select several CVs, then choose Deformations→Cluster from the Animation menu to apply a cluster:
Apply cluster to these points
Maya creates a set named cluster1Set or something similar by default. Using Maya: Hypergraph, Sets & Expressions
11
Sets Understanding sets
Applying a cluster creates a set
The set contains the points in the cone controlled by the cluster. In such sets, you can alter deformations by adding and removing points or by editing point weights of existing members. For example, you can add corresponding points from a newly added cone in the scene. The added points deform with the existing points as you translate, rotate, or scale the cluster handle.
Subsequent topics provide details on how to alter object deformations by editing sets.
12
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding edit modes
Understanding edit modes The Set Editor has several editing modes. The modes are important as you create, edit, and remove sets and their members. Usage
Editing
Select, add, move, and remove set members.
Select
Select a set, not its members—to remove or rename the set. You cannot add or remove members in this mode.
Select Contents
Select a set’s members without selecting the set itself. You cannot add or remove members in this mode.
Paint Percentages
Change the weight of cluster, cluster flexor, and skin points. This mode works only when you display NURBS component sets with List by Object in table format. See “Painting point weights” on page 37.
Sets
Mode
If you list partitions rather than sets, Select Contents and Paint Percentages are invalid modes. See the note in “Creating, displaying, and removing partitions” on page 49.
Creating, selecting, and removing sets The following topics describe how to create, select, and remove a set. Note that binding skin or adding a deformer or flexor to an object automatically creates one or more sets. You need not create a set for such objects. See “Understanding sets” on page 7 for details.
Creating a set You can create a set of geometric objects, CVs, vertices, polygonal facets, or other items.
To create a set with a default name: 1
Select the objects or items in the workspace, Outliner, or elsewhere. Using Maya: Hypergraph, Sets & Expressions
13
Sets Creating, selecting, and removing sets For example, after displaying the CVs of an object, use a selection box to select the CVs. If you don’t select any objects, an empty set will be created in the next step. You can add to an empty set later. 2
From Maya’s main menu, choose Edit→Sets→Create Set. or From the Set Editor, choose Edit→Create Set. The set appears with a default name in the Set Editor.
To create a set and name it: 1
Select the objects or items in the workspace, Outliner, or elsewhere.
2
From Maya’s main menu, choose Edit→Sets→Create Set-❒. or From the Set Editor, choose Edit→Create Set-❒. The Create Set Options menu appears.
3
Enter the name of the set in the Name text box. For example, enter nurbsObjects.
14
Using Maya: Hypergraph, Sets & Expressions
Sets Creating, selecting, and removing sets Other options in the window let you add the set to a partition. See “Adding and moving sets to partitions” on page 51 for details. 4
Click Apply. The set appears with the chosen name in the Set Editor.
To rename a set: 1
In the Set Editor, turn on Mode→Select.
2
Click the name of the set.
3
Change the set’s name in the Channel Box, Attribute Editor, or elsewhere.
Selecting a set You can select a set or the contents of a set. You must select a set to remove or rename the set. You must select the contents of the set to apply an action to each member of the set.
To select a set: 1
In the Set Editor, turn on Mode→Select.
2
Click the name of the set. You can also select the set in the Outliner or Hypergraph’s dependency graph view. To display sets in the Outliner so you can select them, turn off Show→DAG Objects Only. To display sets in the Hypergraph’s dependency graph view, select the object shape node associated with the set and choose Graph→Up and Downstream Connections. Using Maya: Hypergraph, Sets & Expressions
15
Sets
If a set or other item in the scene already has the specified name, the new set name will be appended with a number. For example, entering top results in top1, because top is the name of a camera that exists in every scene by default.
Sets Creating, selecting, and removing sets
To select a set’s contents only: 1
In the Set Editor, turn on Mode→Select Contents.
2
Click the name of the set. This selects the contents of the set, but not the set.
Removing a set You can remove a set or the contents of a set. Removing a set is useful for removing set names you’re no longer using.
To remove a set: 1
In the Set Editor, turn on Mode→Select.
2
Click the name of the set.
3
Check that only the set name is the selected object, for example, by examining the Channel Box or Outliner. Make sure no objects are selected in the workspace.
4
Press your keyboard’s Backspace key. This removes the set, but not its contents.
To remove a set’s contents only: 1
In the Set Editor, turn on Mode→Select Contents.
2
Click the name of the set.
3
Press your keyboard’s Backspace key. This removes the items from the set.
Creating sets for easy object selection You can create a set of joints, geometry, CVs, materials, or other items for quick selection in the main menu. You might want to do this, for instance, so you can select different animation characters quickly without having to start the Set Editor. This is also useful for selecting items not visible in the workspace, for instance, invisible objects.
To create the set: 1
16
Select the objects or items.
Using Maya: Hypergraph, Sets & Expressions
Sets Choosing set display formats 2
From Maya’s main menu, choose Edit→Sets→Create Quick Select Set. A window prompts for a set name.
3
Enter the set name for the items. This creates the set and puts its name in the cascading menu to the right of Edit→Quick Select Set.
To select the items in the set: From Maya’s main menu, choose Edit→Quick Select Set and the name of the set. This selects the items in the set, not the set itself. Sets
Choosing set display formats For sets of object components such as CVs and polygonal vertices, you can display set contents in the Set Editor in these convenient formats: •
Default list—components listed without additional headings for the objects they’re part of
•
List by object—components listed under the object they’re part of For sets made of NURBS CVs, you can also list by object in a concise table. The following example shows the differences between the display formats.
Example Suppose you create a curve named TopCurve with four CVs, and a similar curve named BottomCurve with four CVs.
2 0 TopCurve 1
3 1
3 BottomCurve
0 2
Using Maya: Hypergraph, Sets & Expressions
17
Sets Choosing set display formats To display the CVs, select the curves, and from the main menu, choose Display→NURBS Components→CVs. Internally, Maya numbers the CVs of each curve as 0, 1, 2, and 3 (but doesn’t display the numbers in the workspace). Suppose you select CVs 2 and 3 of both curves, then create a set named rightCVs. (See “Creating, selecting, and removing sets” on page 13 for instructions on creating sets.) You might do this, for example, because you want to adjust the shape of both lines identically with the corresponding CVs.
2 0
1
3 1
3
0 2
Select these CVs, then create a set named rightCVs.
To display set contents as the default list: 1
In the Set Editor, turn on Mode→Editing. This mode lets you examine, select, add, move, and remove set members.
2
Expand the contents of rightCVs.
TopCurveShape.cv[2] and [3] represents CVs 2 and 3 of TopCurve. BottomCurveShape.cv[2] and [3] represents CVs 2 and 3 of BottomCurve.
18
Using Maya: Hypergraph, Sets & Expressions
Sets Choosing set display formats This is the default listing of sets. Each set member has its name listed under the set name. This is the most concise way to show sets and their members. You don’t need to understand Maya’s identification scheme for set members. For example, it’s not essential to know why Maya names certain members of TopCurveShape as TopCurveShape.cv[2] and TopCurveShape.cv[3]. You’ll typically work with set members by selecting the desired object or point in the workspace, not by selecting its name in the Set Editor.
To list by object: 1
In the Set Editor, select Options→List by Object. The following set contents appear: Sets
The set now shows two object headings, one for TopCurveShape and one for BottomCurveShape. Note that the icons to the left of the object headings appear only for sets made of CVs. 2
Expand each object heading by clicking the triangles.
The Set Editor displays the same information as for the default list, but with a different format. The CV set members are grouped under a heading for the object they’re part of. There are four CVs in the set. Two CVs in the set are part of the object TopCurveShape and two are part of the object BottomCurveShape.
Using Maya: Hypergraph, Sets & Expressions
19
Sets Choosing set display formats Because the rightCVs set is made of NURBS CVs, you can also display set members in a table format. The CV location in the table corresponds to their physical location in the object.
To list by object in table format: 1
Make sure Options→List by Object is selected.
2
Click the List/Table icon next to each set name to display it in table format. This icon appears only for NURBS curves and surfaces. Click the List/Table icon
The set appears in table mode:
3
Expand the sets and scroll the window as necessary. The table format shows all CVs of each curve. The CVs that are set members are represented by the gray boxes. The CVs that aren’t set members are the empty black boxes. The 0, 1, 2, 3 in the row are the U parameters of the curves. There are no V parameters for the curves because they have only a single dimension (U) in parameter space. You can select any CV by clicking the box that represents it. For example, if you click the box under 3 for TopCurveShape, you also select TopCurveShape’s CV number 3 in the workspace. You can drag through adjacent boxes to select several members or nonmembers of a set.
20
Using Maya: Hypergraph, Sets & Expressions
Sets Choosing set display formats The ability to select nonmembers of a set in table format is helpful if you have an object with CVs that are hard to select in the workspace. 4
To change from table format back to the previous list, click the List/Table icon again. This toggles between the table and list. For details on choosing which sets are displayed in the Set Editor, see “Altering the display of sets” on page 40.
Note If you display a set of CVs of a NURBS surface such as a plane, you’ll see the U and V parameters that identify each CV. An example follows: Sets
V parameters
U parameters
3 2 1 0 0
2 1 U parameters
3
V parameters
It’s not essential to understand Maya’s U and V identification scheme for CV set members. You’ll typically work with set members by selecting the desired CV in the workspace, not by selecting its U and V parameter in the Set Editor. See Using Maya: Modeling to learn more about U and V parameters.
Using Maya: Hypergraph, Sets & Expressions
21
Sets Editing set membership
Editing set membership You can add or remove members of a set with the Set Editor or the Edit Membership Tool. The advantage of the Set Editor is that it: •
includes a formatted list of set members and associated objects
•
displays U and V parameters of NURBS curve and surface CVs
•
lets you edit the weight of cluster, cluster flexor, and skin points The advantage of the Edit Membership Tool is that you can add and remove set members in the workspace without using another window or panel. This is ideal for quickly altering membership of sets Maya creates for deformers and skin. See “Adding or removing deformer and skin point set members” on page 25 for details.
Adding set members The following steps show how to add set members with the Set Editor.
To add set members: 1
In the workspace, select the items you want to add.
2
Maker sure Mode→Editing is on.
3
Click the name of the set.
4
Choose Edit→Add Items.
Tips You can use standard Motif selection techniques in the Set Editor:
22
•
Use the middle mouse button to drag a member from one set to another.
•
Use Ctrl-middle mouse button to copy a member from one set to another.
•
Drag through several items to select them.
•
Shift-click to extend the selection through the item clicked.
•
Ctrl-click a member to add or remove it from existing selection. Note that Ctrl-clicking to add a member to the selection deselects any item in the workspace that isn’t in the set.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Example Suppose you put several CVs of a cone into a set name TopCVs.
CVs in set TopCVs
Sets
You can add several more of the Cone’s CVs to TopCVs as follows: 1
Select the CVs you want to add to the set.
Selected CVs to be added to the set.
2
In the Set Editor, turn on Mode→Editing.
3
Click the name of the set.
4
Choose Edit→Add Items. Using Maya: Hypergraph, Sets & Expressions
23
Sets Editing set membership Maya adds the items to the set.
Tip To edit related CVs of a NURBS object, turn on Component/Hull selection, then select a hull. To turn on Component/Hull selection, turn on these icons in the Status Line: (Select by component type) and
(Hulls)
Removing set members The following steps show how to remove set members with the Set Editor.
To remove set members: 1
In the Set Editor, turn on Mode→Editing.
2
In the Set Editor or workspace, select the items you want to remove from the set. If you select an item in the workspace that’s in two or more sets, doing the following step removes the item from all the sets.
3
24
Select Edit→Remove Items.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Adding or removing deformer and skin point set members The Edit Membership Tool provides the simplest way to add and remove members of deformer and skin point sets. See “Deformer and skin point sets created by Maya” on page 11 for information on such sets. In the following steps, we use the term points to refer generally to NURBS CVs, polygonal vertices, and lattice points.
To add or remove with the Edit Set Membership tool From the Animation menu, select Deformations→Edit Membership Tool.
2
Select the set as follows:
•
For a skin point set, select the associated joint (in the workspace or Outliner).
•
For a deformer set, select the associated influence object. For a cluster, for instance, select the cluster handle. See the Basic Deformers part of Using Maya: Animation for information on influence objects.
•
For a blend shape set, select the associated target or blendShape node.
•
For other types of sets, select the set in the Set Editor. See “Selecting a set” on page 15 for details.
Sets
1
Maya highlights the set members in the workspace. For a deformer set, the influence object is also highlighted, but is not the selected object.
Using Maya: Hypergraph, Sets & Expressions
25
Sets Editing set membership Maya also lists the set name in the Help line as in the following example.
Highlighted members
Name of selected set
3
To add to the set, Shift-click the points (or objects) you want to add. To add points from a different object, you must select the points without the Shift key first, then Shift-click the points again to add them to the set.You can also Shift-drag a selection box around the points. To remove from the set, Ctrl-click to select the points (or objects). You can also Ctrl-drag a selection box around the points.
4
26
Click a different menu entry to quit the Edit Membership tool.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Note If you bind skin to a skeleton and add a flexor, the Set Editor displays a set name for the flexor. This type of set has sets embedded under it, as in this example: You must expand these sets and edit their points here.
Sets
You can’t edit the points here.
The embedded sets joint2Set1 and joint1Set1 appear twice in the Set Editor. You must edit the members where they aren’t embedded. To quickly find the appropriate sets, select the embedded set names and choose List→Update Now. To edit the weights of the members, display the unembedded sets in table format with Options→List by Object on. Bookmark the embedded sets before doing Update Now if you want to display them again later.
Using Maya: Hypergraph, Sets & Expressions
27
Sets Editing set membership
Pruning deformer set membership The set used by a deformer often has members that aren’t deformed when you manipulate the deformer. You can remove the unaffected members to speed transformation and animation of the deformer.
To prune the deformer set: 1
Select the influence object of the deformer. For a cluster, for instance, select the cluster handle. See the Basic Deformers part of Using Maya: Animation for information on influence objects.
2
From the Animation menu, select Deformations→Prune Membership and the type of deformer.
Note Prune Membership removes deformer members whose position in the current frame is the same as their undeformed position. Pruning might ruin the deformer animation of the members that had not yet moved at the time of pruning. Because a typical blend shape operation has weights of 0 (unmoving points) for some target shapes at any instant, pruning membership would likely ruin the blend shape deformations. For this reason, there is no menu entry for pruning the membership of blend shape deformers. You can do this only with a MEL blendShape command. See the MEL documentation for details. If you unintentionally prune members, you can choose Edit→Undo to undo pruning, or you can add the members to the set again.
Moving skin points to a different set When you bind skin to a skeleton, Maya puts the skin points in sets named for each joint that has a bone originating from it. The skin point sets are also called joint cluster sets because Maya adds a cluster for each joint that controls skin deformation. You can move skin points from one set to another to tune deformation in the region where you bend or rotate the joint.
28
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership Working with skin points in sets differs slightly from other deformer sets. To prevent undesirable skin deformations as you bend joints, Maya prevents skin points from being in two sets at the same time. When you put a member of one set into another, Maya removes the member from its old set. See “Understanding partitions” on page 47 for details.
Example Suppose you create a skeleton made of three joints. Maya names the joints of the skeleton joint1, joint2, and joint3 by default. You then use the IK Handle Tool to add an IK handle to the skeleton’s joint chain. Finally, you create a cylinder with 12 sections and 12 spans to be used as the skeleton’s skin, then bind the cylinder to the skeleton. Sets
joint1
joint1’s bone Skin
joint2 joint2’s bone joint3
When you bind the skin to the skeleton, Maya creates two sets named joint1Set1 and joint2Set1 (or something similar). The joint1Set1 set includes the points for the skin attached to the bone originating from joint1. The joint2Set1 set includes the points for the skin attached to the bone originating from joint2. The Set Editor lists these set names and their contents. Because joint3 has no bone, it has no set of skin points.
Using Maya: Hypergraph, Sets & Expressions
29
Sets Editing set membership If you turn on Shading→Smooth Shade All and translate the IK handle to bend joint2, the skin might deform like this:
The following steps show how to move skin points from one set to another to alter skin deformation as a joint bends.
To move skin points to a different set: 1
Turn on Shading→Wireframe. This display mode is best for examining skin points.
2
Select joint1 in the Outliner, workspace, or elsewhere.
3
Choose Deformations→Edit Membership Tool. When this tool is selected, the members of the set associated with the selected object are highlighted in the workspace and Set Editor. In this example, the members of joint1Set1 are displayed in yellow in the workspace and white in the Set Editor.
30
Using Maya: Hypergraph, Sets & Expressions
Sets Editing set membership
Members of joint1Set1
To see the members of joint2Set1, select joint2.
Sets
4
Members of joint2Set1
Because the Edit Membership Tool is selected, the members of joint2Set1 become highlighted in the workspace and Set Editor. The Edit Membership Tool lets you move points from the joint1Set1 to the joint2Set1.
Using Maya: Hypergraph, Sets & Expressions
31
Sets Editing set membership 5
Use Shift-left mouse button to drag a selection box around joint1Set1’s two lowest (not selected) circles of points.
Select these two circles of points
This moves the selected points from joint1Set1 to joint2Set1. The new set members become highlighted in yellow in the workspace. With the points attached to a different set, the skin deforms differently when you transform the IK handle to bend the joint.
Original deformation
Deformation after regrouping points
Because you moved skin points from joint1Set1 to joint2Set1, bending joint2 causes the skin to crease higher above the joint.
32
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights You can also remove points from a set with the Edit Membership Tool. With the joint selected, Ctrl-click to remove the points. If you remove points from a set, the skin points have no attachment to any bone. The points won’t deform when you transform the joints in the skeleton. You’ll need to add them to a skin point set to make the associated skin deform appropriately. The altered deformation in this example is, of course, excessive—not something you would likely strive for in a character animation. The example simply shows how to alter skin deformation by adjusting set membership.
Editing point weights When you apply a cluster to some or all of an object’s points, transforming the cluster handle deforms the shape controlled by the points. When you bind skin or add a cluster flexor to a skeleton, transforming a joint deforms the shape controlled by the points. The Set Editor lets you tune the weight of such points. For example, suppose you add a cluster to a cone. You can fine tune the weights of the cluster points so that when you translate the cluster handle, the points at the base of the cone move less than the points at the tip of the cone. A point with a weight of 1 moves 100% when you translate the cluster. A point with weight 0 doesn’t move at all. A point value between these weights moves proportionally to its percentage of 1. For example, a point with a weight of 0.40 moves 40% as much as a point having a weight of 1. You can also give points a negative weight. When you move the cluster handle, negative points move in the opposite direction of the other points in the cluster. You might do this, for instance, to make a belly dancer’s hips swing one way as the rest of her body moves another way.
Using Maya: Hypergraph, Sets & Expressions
33
Sets
As you work on your own characters, experiment by adding and removing different points near the crease of the skin. You’ll be able to create subtle improvements in deformation. For details on using the Edit Membership Tool, see “Adding or removing deformer and skin point set members” on page 25.
Sets Editing point weights
Weight 0.5
Weight 1
Translating the cone moves points with weight 0.5 half as much as points with weight 1.
Skin points also have weights. When you bind skin to a skeleton, Maya puts the skin points in sets. The skin points have a default weight of 1. You can edit the weight of skin points to control the extent to which skin deforms when you bend a joint. Skin point weights affect the movement of attached skin as follows: Point weight
Resulting skin movement
1
Same as joint
0
None
Between 0 and 1
Percentage of joint movement
Less than 0
Opposite direction of joint movement (percentage)
More than 1
Exaggerates skin movement
To set the weight of cluster or skin points: 1
Select Window→General Editors→Set Editor.
2
From the Set Editor, turn off Options→List by Object. This step is optional, as described in the tip at the end of this topic.
3
Expand the set representing the cluster or skin points. By default, a cluster point set has the name cluster1Set or something similar.
34
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights Note that you can filter sets from the Set Editor to display only cluster and skin point sets. See “Filtering sets from display” on page 40. By default, skin point sets have the names joint2Set1, joint2Set1, and so on. 4
Turn on
(Select by component type) in the main menu area.
5
Turn on (Points), then right mouse-click to make sure CVs, Poly Vertices, or Lattice Points are enabled for selection (as appropriate).
6
In the workspace, select the desired points. For example, you might select these points of a clustered cone: Sets
Selected points
The corresponding points in the Set Editor turn white to indicate they’re selected. 7
Scroll the window as needed to see the point members. The selected set members are highlighted in white in the Set Editor. Boxes to the right of the members show the points having a weight of 1. The points have a default weight of 1.
Using Maya: Hypergraph, Sets & Expressions
35
Sets Editing point weights
Note that you can select points by clicking members in the Set Editor rather than in the workspace. If you click a member, the affected point and surface geometry is highlighted in the workspace. For NURBS objects, there isn’t necessarily a one-to-one correlation between set members and points visible in the workspace. For example, if you drag a selection box around the top point of a cone, several members in the set light up. This is because you’ve actually selected several points superimposed at the top of the cone. Because of the internal structure of NURBS geometry, points are often superimposed around edges or end positions. 8
Enter the weight in the Edit box, or drag the thumbwheel.
Thumbwheel
Reset
Edit box
The weight you enter applies to all selected points. The Set Editor shows the new point weights in the boxes next to the points. 9
In the workspace, transform the cluster’s handle or skeleton’s IK handle to see if your weight choices have the desired results.
10 Adjust the weights as needed.
36
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights See “Options for modifying point weight numbers” on page 38 for details on options that help you enter weights for groups of points.
Tip You can also assign weights to the points when you display sets with List by Object turned on (in list or table format). The technique is the same as the preceding steps. Selected set members in the Set Editor are highlighted with a white background in each display format. For complex clusters having many set members, it’s easiest to see all set members with List by Object and table format selected. Table format is available only for NURBS CV members.
You can set the weight for adjacent points in the Set Editor with a technique that’s similar to painting. The method is ideal for testing the affect of various weights on different points. You can paint point weights only when you display NURBS CV component sets with List by Object in table format.
To paint point weight values in boxes: 1
Turn on Options→List by Object.
2
Click
(List/Table icon) to display the set contents in table format.
Using Maya: Hypergraph, Sets & Expressions
37
Sets
Painting point weights
Sets Editing point weights An example set in table format follows:
Note that the black table entries are unusable members of the set. 3
Choose Mode→Paint Percentages.
4
Enter a value in the Edit box of the Set Editor.
5
Drag through the desired boxes. Each box you drag through receives the weight you entered in the Edit box.
6
Repeat the last two steps to paint other boxes with a different value. See the following topic for options that help you enter weights for points.
Options for modifying point weight numbers There are several options next to the Set Editor’s thumbwheel that might help you enter weights for groups of points:
38
Absolute
When on, the Set Editor gives the point the exact weight shown in the Edit box. This is the default setting.
Scale
When on, the Set Editor multiplies the weight of the selected point by the number shown in the Edit box. When you paint weights, Ctrl-dragging divides the weight of the selected point by the number shown in the Edit box.
Using Maya: Hypergraph, Sets & Expressions
Sets Editing point weights When on, the Set Editor adds the number in the Edit box to the existing weight of the selected point. When you paint weights, Ctrl-dragging subtracts the number in the Edit box from the existing weight of the selected point.
Shift
(Reset)
Resets the thumbwheel value. When Absolute is on, clicking the Reset icon resets the thumbwheel to the home value of the selected weight. The home value is the value a weight has when you click the weight or enter a new value in the Edit Box.
Sets
Suppose you click a weight that has a value of 0.25, then drag the thumbwheel to change its value to 0.5. When you click the Reset icon, the weight becomes its original value 0.25. When Scale is on, clicking the Reset icon resets the thumbwheel value to 1. When Shift is on, clicking the Reset icon resets the thumbwheel value to 0.
Selecting and keying point weight attributes You can select weight attributes and key their values for clusters, cluster flexors, and skin points. Note that you key attributes on a cluster; Maya stores weights with a cluster, not the associated geometry.
To select the weight attribute of points: 1
Choose Mode→Editing.
2
In the workspace or Set Editor, choose the points whose weight attribute you want to keyframe.
3
Select Edit→Select Weight Attribute(s).
To key the weight attribute of points: 1
Move the Time Slider’s current time indicator to the desired frame.
2
Select the weight attribute of the points.
3
Enter the weight value in the Set Editor’s edit box. See “Editing point weights” on page 33 for details.
4
Select Edit→Key Selected Weight(s). Using Maya: Hypergraph, Sets & Expressions
39
Sets Altering the display of sets 5
Choose Edit→Select Weight Attribute(s) if you want to:
•
see the red key marker in the Time Slider resulting from the keyed weights
•
load the keyed weight into the Graph Editor
Altering the display of sets The Set Editor, by default, displays all sets in your scene. The following topics describe options for narrowing or broadening the number of sets displayed, so you spend less time scrolling and expanding sets.
Expanding and collapsing sets You can expand or collapse all sets in the Set Editor. You can also expand all sets automatically as they appear in the Set Editor.
To expand all sets: Choose List→Expand All Frames.
To collapse all sets: Choose List→Collapse All Frames.
To expand all sets automatically: Choose Options→Auto Expand Frames.
Note If you display a lengthy set with List by Object in the list format, a scroll bar appears to the left of set members. The scrolling area displays eight members by default. To display more members, choose Options→Object List Length. Enter the number in the Mini Scroll Bar Length window, then close the window.
Filtering sets from display The Set Editor displays all sets in the scene by default. If the display seems crowded with entries, you can omit types of sets from the display, for instance, rendering sets.
40
Using Maya: Hypergraph, Sets & Expressions
Sets Altering the display of sets
To filter categories of set types from the Set Editor display: In the Set Editor, choose List→Filters and the type of set. Clarification of several Filters menu entries follows: Meaning
All Regular Sets
All sets other than those Maya creates automatically.
All Render Sets
Default and added shading groups.
All Deformer Sets
Default and added sets for each type of deformer. Turning this option off lets you filter specific types of deformer sets listed below the option in the Filters menu.
Joint Cluster Sets
Skin point sets. (If you add a cluster flexor to bound skin, Maya creates a set that contains one or two embedded sets. The embedded sets are existing skin point sets. See the note on page 27.)
Joint Lattice Sets
Joint lattice flexor sets.
Lattice Sets
Lattice sets and bone lattice flexor sets.
Sculpt Sets
Sculpt sets and sculpt flexor sets.
Other menu entries are self-explanatory.
To filter individual set types from the Set Editor display: In the Set Editor, choose List→Filters→Item Filters→ and the type of item. The set types in the list are mainly types of rendering sets. See the documentation for the MEL itemFilter command for details on how you can add items to this list.
Displaying sets associated with selected objects The Set Editor has several options for displaying sets associated with selected objects or items.
Using Maya: Hypergraph, Sets & Expressions
41
Sets
Menu entry
Sets Altering the display of sets
To display sets associated with selected objects: 1
Select the objects or items.
2
Choose List→Update Now. The Set Editor displays sets whose members are in the selected objects. If you selected a deformer influence object such as a joint or lattice, the Set Editor also displays the associated deformer set. No other sets appear, including the default initialShadingGroup and initialParticleSE sets. If no objects are selected before using Update Now, the Set Editor displays no sets.
Example Suppose you’ve applied clusters to several NURBS objects in your scene. You want to edit the points of a cluster you’ve attached to a cylinder, but you don’t know which of the cluster sets is appropriate.
The set might be any of these sets.
Do the following steps to find and display the appropriate set:
42
1
Turn on
(Select by component type) in the main menu area.
2
Turn on (Points), then right mouse-click enabled for selection.
3
Select some or all CVs that are part of the cylinder’s cluster set.
Using Maya: Hypergraph, Sets & Expressions
to make sure CVs are
Sets Altering the display of sets 4
Choose List→Update Now. The set appears by itself in the Set Editor. If no objects are selected before using Update Now, the Set Editor displays no sets.
Sets
5
Expand the set to work on its members.
To display sets associated with selected objects repeatedly: Turn on Options→Auto Update. Each time you select an object or item, the Set Editor displays the sets associated with the selected object. If no objects are selected, the Set Editor displays no sets. Note that the Set Editor cannot be in Editing mode and Auto Update mode at the same time.
Tip If the Set Editor displays a set you want to keep in view, turn off Auto Update while the set is in view.
To add sets to the existing display: 1
Select the objects or items.
2
Choose List→Add Selected to List. The Set Editor displays sets associated with the selected objects in addition to any sets already in the Set Editor.
To return to the display of all sets in the scene: Choose List→All Sets.
Using Maya: Hypergraph, Sets & Expressions
43
Sets Altering the display of sets This displays all sets in the scene, including those in partitions. See “Understanding partitions” on page 47.
To scroll directly to set members associated with selected objects: 1
Choose Options→List by Object. This lists sets by object. Scrolling directly to set members associated with selected objects is possible only with List by Object selected.
2
Expand the set containing the members you want to see.
3
Select the set members in the workspace.
4
Choose List→Scroll Frames to Selection. The Set Editor displays the members at the top of the list of set members. With this option off, set members are displayed in an ordered list. You might need to scroll through a lengthy list to find the selected members.
To scroll directly to set members each time you select: 1
Choose Options→List by Object. This lists sets by object. Scrolling directly to selected set members works only with List by Object selected.
2
Choose Options→Auto Scroll to Selection. When you select set members in the workspace, the Set Editor displays the members at the top of the list of set members.
Using bookmarks to display sets You can bookmark sets in the Set Editor to display them conveniently later. This is useful when it’s hard to navigate the Set Editor because it contains many sets. Bookmarking is also useful for grouping sets together to examine them at the same time.
To bookmark sets: 1
Display only the desired set or sets in the Set Editor. For example, select a member of the set in the workspace, then choose List→Update Now to display only the selected set.
2
44
Select Bookmarks→Add Bookmark.
Using Maya: Hypergraph, Sets & Expressions
Sets Altering the display of sets A bookmark gets a default name, for example, bookmark, bookmark1, and so on. The name appears at the bottom of the Bookmarks menu.
To name a bookmark before creating it: 1
Display only the desired set or sets in the Set Editor. For example, select a member of the set in the workspace, then choose List→Update Now to display only the selected set.
2
Select Bookmarks→Add Bookmark-❒. A window appears and prompts for the bookmark name.
3
Enter a bookmark name. Sets
To return to a bookmark: Select Bookmarks→ and the name of the bookmark from the menu.
Example Suppose you create a bookmark named Eyeballs when the Set Editor displays only two sets, LeftEye and RightEye. Selecting Bookmarks→Eyeballs displays the LeftEye and RightEye sets:
To delete a bookmark: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Delete Bookmark. Using Maya: Hypergraph, Sets & Expressions
45
Sets Altering the display of sets
To rename a bookmark: 1
Select Bookmarks→Bookmark Editor. The Bookmarks window appears, showing all bookmarks you’ve added.
2
Click the name of the bookmark.
3
Select Edit→Rename Bookmark. A window appears and prompts for the bookmark name.
4
Enter the new name. You can also rename a bookmark by selecting Bookmarks→name-❒, where name is the name of the bookmark. A prompt appears and lets you enter the new name.
Note If you create a bookmark in the Set Editor or Graph Editor, a bookmark name appears among the set names when you display all sets in the Set Editor. This is because a bookmark is actually a set. If you expand a bookmark name, you’ll see the names of the bookmarked sets embedded under it. The same sets appear in the Set Editor display elsewhere, not embedded under the bookmark name. You must work directly with the members of a set where they aren’t embedded. To quickly display the appropriate unembedded set, select the set name, and choose List→Update Now. To edit the weights of the members, display the unembedded sets in table format with Options→List by Object on.
Edit the members of the balls set here. You can’t edit the members below BallsBookmark.
46
Using Maya: Hypergraph, Sets & Expressions
Sets Understanding partitions
Understanding partitions A partition is a collection of related sets. The sets in a partition can have no overlapping members. As you create shading groups, bind skin, and do a few other tasks, Maya creates partitions. It does this to keep the sets separate where an operation would be hindered by overlapping members. You can also create custom partitions to keep your own sets separate.
Partitions you create
Example Suppose you’re animating a cartoon character’s nose as he smiles and laughs. You’ve added a cluster to several CVs for adjusting the nose as he smiles and another cluster to different CVs for adjusting the nose as he laughs. Creating the two clusters creates a set for each group of CVs. Occasionally you want to move CVs from one set to the other, to alter the deformations that occur as you transform the clusters. When you move the CVs from one set to the other set, they remain in the first set. You might not want the CV’s presence in the first set because they add undesirable deformations as you transform the cluster. To avoid this problem, you can create a partition and put both sets in it. The partition prevents one set from having members of another set. When you move the CVs from the first set to the second set, they’re automatically removed from the first set. You can also add a partition to prevent clusters from having overlapping members when you add the cluster with Deformations→Cluster-❒. See the Basic Deformers part of Using Maya: Animation for details.
Using Maya: Hypergraph, Sets & Expressions
47
Sets
When you use the Create Set menu entry to create a set, its members can, by default, exist in any other set you’ve created. In some instances, you might want to prevent two sets from having overlapping members. You can do this by creating a partition and putting the sets in it.
Sets Understanding partitions
The LaughCVs and SmileCVs sets in the NoseParts partition cannot have overlapping members.
Partitions created by Maya Maya creates partitions in cases where objects or items must be kept separate for correct operation. A new scene has two partitions by default: •
layerPartition
•
renderPartition The layerPartition includes sets named for layers you create. See Using Maya: Basics for details on creating layers. The renderPartition contains the shading group sets explained in “Shading group sets created by Maya” on page 9.
48
Using Maya: Hypergraph, Sets & Expressions
Sets Creating, displaying, and removing partitions Because you can apply only one shading group per object or per polygonal facet, the rendering partition ensures you can’t accidentally render a single object or polygonal facet with two shading groups. If you bind skin to a skeleton, Maya also creates a partition. The partition has the name joint1skinPartition or something similar. It contains all the skin point sets in your scene. The partition prevents you from assigning skin points to two different joints, which would result in undesirable skin deformations when you manipulate a skeleton If create a deformer with the Exclusive option, Maya creates a partition named deformPartition by default. The partition contains all deformer point sets in your scene. It prevents you from assigning points to two different sets, which might result in undesirable deformations when you manipulate the deformers.
Creating, displaying, and removing partitions The following procedures describe how to create, display, and remove partitions. Note that there are only two valid operation modes when you display partitions in the Set Editor. •
Editing mode lets you move a set from one partition to another.
•
Select mode lets you select the partition to rename or remove it, or add sets to it.
To create a partition: 1
Make sure no objects or other items are selected.
2
Select any sets you want to put in the partition. See “Selecting a set” on page 15 for details.
Using Maya: Hypergraph, Sets & Expressions
49
Sets
Because Maya creates partitions for you when it makes sense to do so, you’ll rarely need to create your own partitions. Still, if you find a situation where you need create one, you can do so as described in the next topic.
Sets Creating, displaying, and removing partitions 3
To create a partition with a default name, choose Edit→Sets→Create Partition. (This completes the procedure.) or To name the partition when you create it, choose Edit→Sets→Create Partition-❒ and continue with these steps:
4
Enter the name of the partition in the Name text box of the Partition Options menu.
5
Click Apply. See the following procedure to display the partition in the Set Editor. Note that you can also create a partition from the Set Editor with Edit→Create Partition-❒.
To display partitions: 1
From the Set Editor, choose List→Partitions. The partitions appear in the Set Editor.
2
To see the sets a partition contains, turn on Mode→Editing and expand the partition. You can move a set from one partition to another in this display mode, but you can’t move or edit set members. To return to the display of sets only, choose List→Sets. This displays all sets in the scene, including those in partitions.
To remove a partition, but not its contents: 1
From the Set Editor, choose List→Partitions. The partitions appear in the Set Editor.
2
In the Set Editor, turn on Mode→Select.
3
Click the name of the partition.
4
Press your keyboard’s Backspace key. This removes the partition, but not the sets that are in the partition.
50
Using Maya: Hypergraph, Sets & Expressions
Sets Adding and moving sets to partitions
Adding and moving sets to partitions The following procedures describe how to add and move sets to partitions:
To add a set to an existing partition when you create the set: 1
Select the objects or items to be put in the set.
2
From Maya’s main menu, choose Edit→Sets→Create Set-❒. or From the Set Editor, choose Edit→Create Set-❒. The Create Set Options menu appears. Enter the name of the set in the Name text box.
4
To add the set to a partition turn on Try to Add or Force to Add.
Sets
3
If the partition already has a set containing elements of the selected object, when you select Try to Add, Maya doesn’t add the member and instead displays a warning message to the Script Editor. If you select Force to Add, Maya adds the member to the set after removing the member from the set it’s already part of. 5
After you turn on either option in the prior step, choose the name of the partition from the Partition menu.
6
Click the Apply button. Maya puts the set in the selected partition.
To move a set from one partition to another: 1
Choose List→Partitions.
2
Expand the partitions as necessary to see the set.
3
With the middle-mouse button, drag the set to the desired partition. Use Ctrl-middle mouse button to copy a set from one partition to another.
To move a set to an empty partition: 1
Select List→Sets.
2
Select Mode→Select.
3
Click the set to be moved into a partition.
Using Maya: Hypergraph, Sets & Expressions
51
Sets Adding and moving sets to partitions 4
Select List→Partitions.
5
Select Mode→Editing.
6
Click the destination partition to select it.
7
Select Edit→Add Items. Maya puts the set in the selected partition.
52
Using Maya: Hypergraph, Sets & Expressions
Index A Absolute option 38 adding members to deformer sets 25 set members 22 sets to a partition 51 Auto Scroll to Selection 44 Auto Update 43 automatically created sets 5
B blend shapes sets associated with 25 bookmarks creating 45 deleting 45 embedded names 46 naming 45 renaming 46 returning to 45
C
D default list of sets 17, 19 naming of sets 8 shading of objects 9 deformation skin 6, 28 deformers adding set members to 25 adjusting operation of 6 pruning membership 28 removing members 25 sets 6, 11, 25 deformPartition 49 deleting bookmarks 45 displaying additional sets in Set Editor 43 all sets in a scene 43 partitions 50 dragging members to a new set 22
editing point weights 33 set membership 22 editing modes in Set Editor 13, 18 embedded bookmark names 46 set editing not allowed 27 set names 46 entering weights in Edit box 36 expanding all sets 40 set contents 8
F filtering types of sets 40 Force to Add 51
I icons in Set Editor 8 indentation of sets 9 initialParticleSE 9, 11 initialShadingGroup 9, 10
J joint1Set1 29 joint1skinPartition 49
E Edit box 36 Edit Membership Tool 22, 25, 31
Index
character sets creating and selecting 16 cluster default set names 34 sets 6, 12 weights of points 33 cluster1Set set 11 collapsing all sets 40 sets 9
creating and naming a partition 49 and naming a set 14 bookmarks 45 character sets 16 set with default name 13 CVs selecting in table format 20 set member IDs 18
K keying weight attribute values 39
Using Maya: Hypergraph, Sets & Expressions
53
Index
L layerPartition 48 layers moving sets to 7 List/Table icon 20 listing by object 17, 19 table format 20
M menu bar Set Editor 8 Motif selection techniques 22 moving sets to another partition 51 skin point members 28, 30
N NURBS CVs superimposed in workspace 36
O object list changing scroll bar length 40 overlapping set members preventing 47
R removing deformer set members 25 partitions 50 set contents 16 set members 24 removing points with Edit Membership Tool 33 renaming bookmarks 46 renderPartition 48 resetting weights 39
S
P Paint Percentages mode 13 painting point weights 37
54
partitions adding sets 51 creating and naming 49 default 48 definition of 47 displaying 50 moving sets 51 removing 50 points cluster 12 definition 25 highlighting in Set Editor 35 selecting in Set Editor 36 pruning membership of deformer sets 28
Scale option 38 scroll bar length changing 40 Scroll Frames to Selection 44 scrolling directly to selected members 44
Using Maya: Hypergraph, Sets & Expressions
Select Contents mode 13 Select mode 13 selected objects displaying set members of 41 selecting character sets 16 CVs in table format 20 nonmembers in table format 21 points in Set Editor 36 set contents 9, 16 set without contents 14, 15 weight attributes 39 selecting objects simplifying with sets 6 selection techniques Motif 22 Set Editor menu bar 8 starting 7 tool bar icons 8 set members correlation with NURBS CVs 36
Index
simplifying selection with 6 skin point 6, 11, 29 U and V parameter IDs 21 user-created 5, 6 shading groups sets Maya creates for 10 Shift option 39 skin altering location of creasing 32 tuning deformation 28, 30 using sets with 6 skin points default names of 35 moving membership 28, 30 set comparison with deformer sets 29 sets 11, 25 weights 34 starting Set Editor 7
W weights cluster point 33 editing 33 entering in Edit box 36 keying 39 negative values 33 painting values 37 selecting attributes 39 set member 6 setting cluster or skin point 34 skin point 34
T table format selecting nonmembers 21 set display in 17, 20 thumbwheel 39 triangle for expanding sets 8 Try to Add 51
U U and V parameters in set member IDs 21 Update Now 42 user-created sets 5, 6
Using Maya: Hypergraph, Sets & Expressions
Index
sets 9, 10 adding members 22 adding to Set Editor display 43 altering display 40 associated with skin points 25 automatically created 5 blend shape 25 cluster 6 cluster1Set 11 collapsing 9 collapsing all 40 creating and naming 14 creating with default name 13 CV member IDs 18 default listing 17, 19 default naming of 8 definition 5 deformer 6, 11, 25 displaying all 43 displaying selected object members 41 Editing mode 13, 18 embedded names 27, 46 expanding a set’s contents 8 expanding all 40 filtering types of 40 indentation 9 initialParticleSE 9, 11 listing by object 19 listing by object in table format 17, 20 member weights 6 Paint Percentages mode 13 preventing overlapping members 47 removing contents only 16 removing members 24 Select Contents mode 13 Select mode 13 selecting contents only 9, 16 selecting without contents 14, 15 shading group 10
55
Maya Tutorials - Realistic Snow
Page 1 de 3
HIGHEND3D > Maya > Tips & Tutorials
Realistic Snow by Inti ([email protected])
1. Create a NURBS surface and deform it a bit to get a nice-looking bumpy terrain. Create a camera
[Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Test Center - Tools - Tips & Tutorials - Users Links
2. Open the Hypershader. Create a Blinn node and edit it as shown below:
I highlighted in red the attributes that need to be edited. Don't forget the slight blueish Ambience, because snow is always a bit blue when in sunlight. Also add a light bump (on the example, I use the Turbulence texture, available in the highend3d.com library. Rename the blinn1 as snowBlinn. 3. Next, create a 2D Fractal texture and edit it as follows:
http://www.highend3d.com/maya/tutorials/snow/
14/07/01
Maya Tutorials - Realistic Snow
Page 2 de 3
This texture (fractal1) will simulate the ice crystals that glitter when lit. I use the 2D Fractal node cause it has a Time attribute that allows to phase it. You must also check the Animated box. The phase depends on the value of the Time attribute. This attribute will be later linked to the camera's position using an expression. Also check the Invert box. 4. Remap the fractal1 node (click the shown:
Insert button in the Color Remap field), and edit the Ramp as
This is to have stronger glitters (the fractal alone is too soft, because of its high Threshold). 5. Connect the outAlpha of the RemapRamp1 to the SpecularRollOut of the snowBlinn. You could also link the outColor to the SpecularColor, the result is the same. This is what you should see in the Hypershade:
Render the scene:
http://www.highend3d.com/maya/tutorials/snow/
14/07/01
Maya Tutorials - Realistic Snow
Page 3 de 3
6. This is close to what we want to get, but if we move the camera, the glitters stay at the same place. Now we're creating a very simple expression that links the camera's translation attributes to the fractal1's Time value. If you kept the same names given to the objects along this tutorial, you can copy-paste the following expression. Otherwise you'll have to edit it yourself to make it fit your scene.
fractal1.time = (camera1.tx + camera1.ty + camera1.tz) / 3; Here I map the average of the camera's 3 XYZ translations to the Time attribute. But feel free to use another value than 3, to control the glittering speed. 7. That's it! If you animate the camera, the snow will glitter as the view changes. As a final touch, you can also put a special attribute instead of the 3 in the expression, so that you have more control of the glittering speed.
Scene File
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board
Contact Us
Advertise
Produced by Will McCullough. Copyright © 1997-2001 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/snow/
14/07/01
The Hobbit Guy: Dave K's Poly Head Modeling Tutorial
Dave K's Poly Head Modeling Tutorial By Dave Komorowski www.thehobbitguy.com
Index Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15
http://www.thehobbitguy.com/tutorials/polymodeling/index.html [5/14/2002 3:07:55 PM]
The Hobbit Guy
http://www.thehobbitguy.com/index.html [5/14/2002 3:08:06 PM]
The Hobbit Guy: Gallery
Gallery 1 Gallery 2 Gallery 3 Gallery 4 Animation
http://www.thehobbitguy.com/Gallery.html (1 of 2) [5/14/2002 3:08:11 PM]
The Hobbit Guy: Gallery
http://www.thehobbitguy.com/Gallery.html (2 of 2) [5/14/2002 3:08:11 PM]
The Hobbit Guy: Resume
David K. Komorowski 1401 West Paces Ferry Rd. NW, Apt 1105 Atlanta, GA 30327 [email protected] http://www.theHobbitGuy.com
Objective
To secure a position as a digital modeler/animator in a company that believes in the
Education
Art Institute of Philadelphia in Philadelphia, PA
highest of quality, and stays on the cutting edge of technology.
Associates Degree in Specialized Technology December 1994 Major: Industrial Design
http://www.thehobbitguy.com/Resume.html (1 of 2) [5/14/2002 3:08:13 PM]
The Hobbit Guy: Resume
Academic Honors, GPA 3.95
Software
Maya, 3D Studio Max, Character Studio, Photoshop,
Experience
-Fathom Studios (2000-Present)
Deep Paint 3D,Premiere, *Paint
Sculptor, Modeler and Animator for feature film project (www.delgo.com)
-Atlanta College of Art (2001-Present) Maya modeling instructor -GE Power Systems University Multimedia (1996-2000) Responsible for creating graphics and animations for video, CD and web training
-Animated Arts (1998) Created animations for Dow Insulation sales presentation video
-EN Productions (1997) Created animations and graphics for NY State training video
-Ulterior Motif (1994-1996) Constructed props for corporate events
-Liss Brothers (1994-1996) Illustrated catalogue for 1995-96 product line
-Universal Armorer (1993) Sculpted fantasy model kit
References
Available upon request
http://www.thehobbitguy.com/Resume.html (2 of 2) [5/14/2002 3:08:13 PM]
The Hobbit Guy: Tutorials
http://www.thehobbitguy.com/Tutorials.html (1 of 2) [5/14/2002 3:08:14 PM]
The Hobbit Guy: Tutorials
Poly Modeling Tutorial
More to come
More to come
http://www.thehobbitguy.com/Tutorials.html (2 of 2) [5/14/2002 3:08:14 PM]
More to come
The Hobbit Guy: Links
Modeling
Lighting
Cool Sites
Tom Capizzi the Human Head Spiraloid Forum Bay Raitt Sub-D resource Page Great French Modeler Taron Bay Raitt's digital sculpting techniques Great Modeling Reference
Frank Sabia Pixho Pepe Land
Highend 3D Internet Movie Database Lord of the Rings Movies The One Ring.net CG Channel AWN VFX pro Maya
Texturing Aging Metal Skin Painting Animation
2d Artists Yanick Dusseault Doug Chiang Daren Bader Feng Zhu Justin Sweet
Chrono Photography Muybridge Animation Meat Animation Foundation Michael Comet Carlos Baena Keith Lango
http://www.thehobbitguy.com/Links.html (1 of 2) [5/14/2002 3:08:15 PM]
The Hobbit Guy: Links
Angie Jones
http://www.thehobbitguy.com/Links.html (2 of 2) [5/14/2002 3:08:15 PM]
The Hobbit Guy
http://www.thehobbitguy.com/ [5/14/2002 3:08:17 PM]
Dave K's Poly Head Modeling Tutorial page 1
<> Ok… I've put this off for a long time, so I've finally decided to sit down and write a tutorial on modeling. After going through tutorial after tutorial on modeling in poly's/sub-d's, I've come up with a workflow that works very well for me and hopefully you too. My co-workers jokingly call it "the Dave Way" . First off you should have a side and front view of the object (sometimes top too, but I don't need one in this case because most of my detail can be defined in the front and side). When creating these pictures it's a good idea to use graphpaper so that you can make sure your detail is lined up horizontally.
Once your pictures are drawn, scan them in and save them as jpegs (it's a good Idea to make them no larger than 400 pixels wide. The larger your images are, the more memory they will take up and it will slow your progress). Then create a project directory in maya and save your images in your source images folder. The next thing you're going to want to do is create 2 planes. One facing the front view and one facing the side view. Create a material for each of your drawings and assign them to the appropriate plane. Turn the transparency of the materials down to about .5, then assign the 2 planes to a layer. Assigning them to a layer will allow you to do 2 things... 1.) it will allow you to reference the planes so that you don't accidentally select them while you are modeling 2.) it will allow you to make them visible and invisible at the click of a button.
http://www.thehobbitguy.com/tutorials/polymodeling/page01.htm (1 of 3) [5/14/2002 3:08:19 PM]
Dave K's Poly Head Modeling Tutorial page 1
Once you have all that out of the way, you are ready to start modeling.
Using your create polygon tool (located under polygons>create polygon tool), draw a silhouette outline of your picture in the side view. If you misplace a point while placing them down you can always hit the backspace key to undo the point or press the insert key to edit its placement.
http://www.thehobbitguy.com/tutorials/polymodeling/page01.htm (2 of 3) [5/14/2002 3:08:19 PM]
Dave K's Poly Head Modeling Tutorial page 1
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page01.htm (3 of 3) [5/14/2002 3:08:19 PM]
Dave K's Poly Head Modeling Tutorial page 2
<>
(located under edit After you've created your polygon silhouette, the next thing you're going to want to do is subdivide it using your split polygon tool polygons>split polygon tool). The trick to keep in mind here is to follow the contours of your drawing while keeping the amount of subdivisions down to a minimum. The more subdivisions you put in on this step, the more points you will have to move in the future. Keeping your subdivisions low while placing them in points of detail will make your modeling go much smoother.
1.) Start out by creating the contour that defines your eye and cheek bone. You should end it off at the bottom of the chin.
2.) Then create a split in the opposite direction that begins on the ridge of the nose, goes through the center of the eye, and ends in the back of the head.
3.) Now is probably a good time to define the jaw line. Take this split up through the top of the head. When placing your splits, try and stay halfway between the two outer edges (this will create a cleaner mesh in the end).
4.) Next, define the line where the mouth will be. Then bring it to the back of the head (notice how I'm placing my edges half-way between the outer edges).
http://www.thehobbitguy.com/tutorials/polymodeling/page02.htm (1 of 3) [5/14/2002 3:08:22 PM]
Dave K's Poly Head Modeling Tutorial page 2
5.) Then split up the top of the head a little by drawing an edge from front to back.
6.) Define the lower edge of the brow by running an edge from front to back.
7.) Next define the snout by running an edge from the nose to the bottom of 8.) Break up the neck a little by running an edge half-way between your two outer the jaw. edges.
http://www.thehobbitguy.com/tutorials/polymodeling/page02.htm (2 of 3) [5/14/2002 3:08:22 PM]
Dave K's Poly Head Modeling Tutorial page 2
9.) Next, define the outer radial of your mouth by creating an edge that meets with the corner of the mouth.
10.) Finally... split up your mesh a little more so that you have even spacing between your edges..
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page02.htm (3 of 3) [5/14/2002 3:08:22 PM]
Dave K's Poly Head Modeling Tutorial page 3
<> Once you have subdivided your mesh you will need to clean it up a little. You might have created more points than necessary and we want to keep our points to a minimum so that it will be easier to edit further up the road. To do this you must first select all the verticies within your silhouette. Leave the border edges alone for now they are still needed to define the shape of your object. Also slelect the inside verts of the neck border leaving the outer 2 alone.
Then press the delete key on your keyboard. This will clean up any hanging verts leaving only the ones that exist at intersections. Once your mesh has been cleaned up, again select all the inside verts (including the ones on the inside of the neck)
http://www.thehobbitguy.com/tutorials/polymodeling/page03.htm (1 of 4) [5/14/2002 3:08:30 PM]
Dave K's Poly Head Modeling Tutorial page 3
Next thing we want to do is bring this model into the third dimension. We do this by simply going to the front viewport and pulling the selected points toward the the outer edge of your drawing.
To give you more of a sense of form while modeling, it is a good idea to create an instance of your object. An instance is an object that shares the same shape node but has a different transform node. Making it an exact duplicate of your original geometry just at a different point in space. Therefore, any changes you make on one side will take place on the other instantaniously. http://www.thehobbitguy.com/tutorials/polymodeling/page03.htm (2 of 4) [5/14/2002 3:08:30 PM]
Dave K's Poly Head Modeling Tutorial page 3
To create your instance, go to edit>duplicate and open your options dialog box. Check -1 on the scale X direction, then under geometry type check instance.
Now you have the beginnings of your head... not much to look at now but it soon will be.
http://www.thehobbitguy.com/tutorials/polymodeling/page03.htm (3 of 4) [5/14/2002 3:08:30 PM]
Dave K's Poly Head Modeling Tutorial page 3
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page03.htm (4 of 4) [5/14/2002 3:08:30 PM]
Dave K's Poly Head Modeling Tutorial page 4
<> When modeling, I find it easier to see my wireframe while I'm working. To view your wireframe in your viewport go to shading>shade options>wireframe on shaded. To start shaping your object, start grabbing verts and begin moving them only in the X direction. Use your front view as a guide. For example...go to your side viewport and grab the point that defines the corner of your mouth and then move it in the X direction to where the corner of the mouth is in the front viewport. Don't worry if your mesh looks really rough at this stage, that's the way it's supposed to be, we're just roughing out the form of the head at this point. Think of this process as if you were carving from stone. First you start out really rough to get the form of your object, then you go in and define the forms a little better... and then (but no sooner) you go in and create details.
Next look at the point where your eye is in your side viewport, make sure that it is directly in the center of your eye in the front viewport. Then create a diamond shape with your split polygon tool will begin the radial of your eye socket.
http://www.thehobbitguy.com/tutorials/polymodeling/page04.htm (1 of 3) [5/14/2002 3:08:37 PM]
. This
Dave K's Poly Head Modeling Tutorial page 4
Then subdivide the diamond one step further so that you may better define the socket of the eye. As you split your edged try and split as close to the center as possible.
To visualize the eye better, create a nurbs sphere and place it in world space according to your front and side viewports. This doesn't have to be your final eye... just a place holder so that we can form the eyelids around it correctly.
http://www.thehobbitguy.com/tutorials/polymodeling/page04.htm (2 of 3) [5/14/2002 3:08:37 PM]
Dave K's Poly Head Modeling Tutorial page 4
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page04.htm (3 of 3) [5/14/2002 3:08:37 PM]
Dave K's Poly Head Modeling Tutorial page 5
<> In your front viewport move the points of the eye radial so that they fit to your drawing. Then in your shaded perspective view pull those points one at a time in the Z direction until they ride the surface of the nurbs sphere.
These points will define the eye lids of your head. The next thing your going to want to do is create another radial around the lid to help define that shape a little more.
http://www.thehobbitguy.com/tutorials/polymodeling/page05.htm (1 of 4) [5/14/2002 3:08:40 PM]
Dave K's Poly Head Modeling Tutorial page 5
Grab the verts of this radial and push and pull them in space until you get a good looking eyelid. Our guy is still a little rough but he's shaping up quickly. It's good to work as light as possible to define your shapes quickly. Don't go overboard trying to add in detail... that will come later. Right now just concentrate on creating the form of the head.
http://www.thehobbitguy.com/tutorials/polymodeling/page05.htm (2 of 4) [5/14/2002 3:08:40 PM]
Dave K's Poly Head Modeling Tutorial page 5
Next thing we will work on is the nose. To start out, draw an edge starting at the upper lip going straight up passing through where the center of the nostril will be and continuing up into the forehead.
As you add in new edges, you should push and pull the points to define your shape better and make it http://www.thehobbitguy.com/tutorials/polymodeling/page05.htm (3 of 4) [5/14/2002 3:08:40 PM]
Dave K's Poly Head Modeling Tutorial page 5
rounder. <>
http://www.thehobbitguy.com/tutorials/polymodeling/page05.htm (4 of 4) [5/14/2002 3:08:40 PM]
Dave K's Poly Head Modeling Tutorial page 6
<> Next, we will have to create an intersecting edge to create a point that will define the center of the nostril. Start the edge at the beginning of the upper lip and carry it through to the bottom of the nose. When you run an edge to define a point of detail, always try and run it so that it conforms to the natural flow of the face. Think of the way the muscles and folds of skin flow and try to run the edges that way, this will help you define your edge loops. Notice how I run mine so it follows the natural curve of the face. Also keep in mind that when you draw these edges you are trying to stay directly between your two outer edges.
The next step is to start to draw in the radial of the nostril. Draw a diamond around the nostril center.
http://www.thehobbitguy.com/tutorials/polymodeling/page06.htm (1 of 3) [5/14/2002 3:08:46 PM]
Dave K's Poly Head Modeling Tutorial page 6
Sub-divide the nostril just as you did with the eye so that you can make it rounder and give more detail to that area.
Then push and pull these points to define the nostril a little better. Notice I'm not adding too much detail to these areas before I move on to the next area.I'm just defining the shape a little, then moving to the next area that needs a little more definition. The reason for this is that if I need to rearrange the direction in which my edges go later... it will be much easier to do with less detail.
http://www.thehobbitguy.com/tutorials/polymodeling/page06.htm (2 of 3) [5/14/2002 3:08:46 PM]
Dave K's Poly Head Modeling Tutorial page 6
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page06.htm (3 of 3) [5/14/2002 3:08:46 PM]
Dave K's Poly Head Modeling Tutorial page 7
<> Next, we'll go in and define the shape of the lips a little better by adding another radial inside the existing one. This will give us the information needed to define the roundness of the lips.
Next, add some information to the lower lip, going in the opposite direction, all the while splitting the edges evenly.
Push and pull the points you just created to give more roundness to the lip. Our guy is really starting to shape up. With very little effort we've begun to define the shape of his head quite nicely. The main thing to keep in mind (and I can't stress it enough) is to work rough and loose. Try not to get caught up in http://www.thehobbitguy.com/tutorials/polymodeling/page07.htm (1 of 2) [5/14/2002 3:08:50 PM]
Dave K's Poly Head Modeling Tutorial page 7
adding too much detail... that will come in time. It makes it a lot easier to define your shapes when you only have to move a few points as opposed to moving a bunch of them.
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page07.htm (2 of 2) [5/14/2002 3:08:50 PM]
Dave K's Poly Head Modeling Tutorial page 8
<> In the next few steps we will clean up our mesh by making our edgeloops a little more defined and add detail where we need it. First off, I'd like to talk about edgeloops and what makes a good clean mesh. Our ultimate goal is to make a single mesh that consists mainly of quads (4 sided polys) that flow with the natural curvature of the face. Ideally, you should be able to pick any face on your mesh and follow it around a path that conforms to the flow of the face. This is called an edge loop. If you follow your path and it suddenly stops due to either a three or five sided poly, you're loop has been broken and you should clean that area up. Here is a picture indicating the loops of the head I'm modeling. The radials are in red and the opposite direction in blue.
If you create your edgeloops correctly, adding detail and deforming your mesh for facial poses will be a breeze. Try and remove any three or five sided polys as you work. It's better to get rid of them at this stage then to wait too long and try and get rid of them when you have a lot of detail. Next, I'm going to start adding in some more detail and clean up my mesh along the way. I'll add in a ring around the eye to help define the eye socket and cheekbone, then I'll add an edge from the center of the eye to the tip of the nose. This will help define both the tearduct and the roundness of the nose. And finally I add in an edge to break up a five sided poly near the mouth and clean up my mesh a little.
http://www.thehobbitguy.com/tutorials/polymodeling/page08.htm (1 of 3) [5/14/2002 3:08:54 PM]
Dave K's Poly Head Modeling Tutorial page 8
Next, I'll add in another loop to the eye to define the crease where the eye meets the brow. Then I'll throw in a couple loops to help define the roundness of the upperlip and the shape of the chin. As I add these loops, I might need to get rid of existing edges to create a continous loop with no three or five sided polys. Use the delete edge tool ( go to edit polygons>delete edge) to remove unwanted edges, then redraw your edges in the corect manner using the split polygon tool.
Then I'll split up the eye a little to better define the roundness of the lid, plus I can use the rest of the edge to help define the brow and cheekbone.
http://www.thehobbitguy.com/tutorials/polymodeling/page08.htm (2 of 3) [5/14/2002 3:08:54 PM]
Dave K's Poly Head Modeling Tutorial page 8
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page08.htm (3 of 3) [5/14/2002 3:08:54 PM]
Dave K's Poly Head Modeling Tutorial page 9
<> Next, I will throw in a few more edges around the corner of the eye to create the tearduct. These edges will also help define the wrinkles on the ridge of the nose. I'll also throw in another edge around the bottom of the brow to help make it more distinct. Then, I split up the faces under the nose to create more information for the upper lip and cheek bone.
Now that we have the shape of the eyelid pretty well defined, we can go ahead and create the eyesocket for this guy. Start off by creating a loop just inside the eyelid loop. This will define the thickness of the eyelid.
Next, create two more loops, an inner ring and an outer ring. These will be used to create the depth of the http://www.thehobbitguy.com/tutorials/polymodeling/page09.htm (1 of 3) [5/14/2002 3:09:04 PM]
Dave K's Poly Head Modeling Tutorial page 9
eye socket.
Grab all the points of the inner ring and push them back in the Z direction (into the head) then take all the points of the outer ring and scale them informally to create the underside of the eyelid. If some of these points penetrate the outer surface, just simply move the points back in space. Now you should have a fairly descent looking eye socket.
http://www.thehobbitguy.com/tutorials/polymodeling/page09.htm (2 of 3) [5/14/2002 3:09:04 PM]
Dave K's Poly Head Modeling Tutorial page 9
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page09.htm (3 of 3) [5/14/2002 3:09:04 PM]
Dave K's Poly Head Modeling Tutorial page 10
<> Next I'll split the eyes, brow, cheek and mouth to further the detail. While I do this, I'm getting rid of any triangles and five sided polys that I come accross by running them into the newly formed edge. This also strengthens my edgeloop.
Notice the difference between these 2 steps. Notice how the loop now fits nicely around the brow, eye and cheek whereas before it didn't.
http://www.thehobbitguy.com/tutorials/polymodeling/page10.htm (1 of 3) [5/14/2002 3:09:10 PM]
Dave K's Poly Head Modeling Tutorial page 10
Now that I've got the loop around the eye cleaned up, it's time to go in and fix the loop around the nose. Notice how I have a lot of triangles and the edges aren't exactly flowing with the curve of the laugh line. I'll fix this by running some new edges in the right direction and deleting out the old ones. Notice how the laugh line is now clearly defined.
Next, finish off the loops at the top of the head. Bring the edges down through the back of the neck to give that area more definition. You can also add on some of the edges that define the muscles of the brow. Then, split up the lower lip a little so that we can begin working on the inside of the mouth.
http://www.thehobbitguy.com/tutorials/polymodeling/page10.htm (2 of 3) [5/14/2002 3:09:10 PM]
Dave K's Poly Head Modeling Tutorial page 10
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page10.htm (3 of 3) [5/14/2002 3:09:10 PM]
Dave K's Poly Head Modeling Tutorial page 11
<> To begin creating the inside of the mouth, first draw a radial loop just outside the edge that defines the center of the mouth. Make sure you split the edges at the corner of the mouth instead of taking the edge to a single central point. If you split the edges you will be left with quads and this is what we want.
Next, select all of the inside faces you just created.
http://www.thehobbitguy.com/tutorials/polymodeling/page11.htm (1 of 4) [5/14/2002 3:09:15 PM]
Dave K's Poly Head Modeling Tutorial page 11
Then, press the delete key on your keyboard to remove them. This will create an opening in the mouth if you have split the corner correctly, you will have nothing but quads left over. If you have done it wrong, you will have triangles at the corner. If you do... fix them up by drawing in new edges so all you have is quads before proceeding to the next step
Next, go to your side viewport and view your model in wireframe. This will allow us to see where we are going to place the inside of the mouth.
http://www.thehobbitguy.com/tutorials/polymodeling/page11.htm (2 of 4) [5/14/2002 3:09:15 PM]
Dave K's Poly Head Modeling Tutorial page 11
Using your ep curve tool (go to create>ep curve tool) trace out 3 curves that define the inside of your mouth. One from the upper lip back to the throat, another from the lower lip back to the throat and a third beginning at the corner of the mouth, going half-way through the other two curves, all the way back to the throat.
<> http://www.thehobbitguy.com/tutorials/polymodeling/page11.htm (3 of 4) [5/14/2002 3:09:15 PM]
Dave K's Poly Head Modeling Tutorial page 11
http://www.thehobbitguy.com/tutorials/polymodeling/page11.htm (4 of 4) [5/14/2002 3:09:15 PM]
Dave K's Poly Head Modeling Tutorial page 12
<> Next, go into your perspective viewport and move the center curve in the X direction to the corner of the mouth.
Now that we have our curves in place, we need to create a surface out of them. I could simply loft them but this would give me unpredictable results and put isoparms wherever Maya feels like. I want to have more control and be able to direct the iso's where I want them to go. So next we are going to force the Iso's to go the way we want them to. The next illustration shows the direction I want the Iso's to go.
http://www.thehobbitguy.com/tutorials/polymodeling/page12.htm (1 of 4) [5/14/2002 3:09:23 PM]
Dave K's Poly Head Modeling Tutorial page 12
So... with that direction in mind... I right click over my curves and select curve point from the marking menu. I select the points where the red lines in the above illustration intersect the curves. This will leave a little yellow dot that indicates where we are going to cut our curve later. If you hold down shift while selecting the other curves you can perform this action on multiple curves at once. Notice how the yellow dots line up directly with the red lines in the above illustration.
http://www.thehobbitguy.com/tutorials/polymodeling/page12.htm (2 of 4) [5/14/2002 3:09:23 PM]
Dave K's Poly Head Modeling Tutorial page 12
Once you have selected all your curve points, you should cut your curves. You can do this by simply going to edit curves>detach curves . Now wherever you had a yellow dot, the curve should be cut, leaving you with a bunch of little curves. These curves are still not ready to loft yet. We must do one more thing first... rebuild our curves so that we have an even amount of isoparms on each surface when we loft them.
To do this... select all your curves and go to edit curve>rebuild curve and open your options dialog box. Set the number of spans to 3 and hit the "rebuild" button in the lower left of the box to apply.
Now we are ready to loft our surfaces. You might want to go to your viewport settings and turn off your polygon display to make this step easier (show>polygons). Start by selecting the top curve in front (upper lip), then holding down shift, select the next curve in the middle, then last but not least, select the bottom curve (lower lip). Then to loft them, go to surfaces>loft . Repeat this pocess for the rest of the curves.
http://www.thehobbitguy.com/tutorials/polymodeling/page12.htm (3 of 4) [5/14/2002 3:09:23 PM]
Dave K's Poly Head Modeling Tutorial page 12
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page12.htm (4 of 4) [5/14/2002 3:09:23 PM]
Dave K's Poly Head Modeling Tutorial page 13
<> Once you have created all of your lofts you should attach each surface together. First, select the the first surface, then (holding down shift) select the second surface. Then, using the attach surfaces command (go to edit nurbs> attach surface) attach them together. Repeat this step until you have a single solid nurbs surface.
Now all we have left to do is match the nurbs surface to the inside of the mouth. In order to do this we will need to match the information up. Ignoring the center edge and the mouth corner edge... count the number of edges that make up your upper lip. In this case we have edges.
http://www.thehobbitguy.com/tutorials/polymodeling/page13.htm (1 of 4) [5/14/2002 3:09:31 PM]
Dave K's Poly Head Modeling Tutorial page 13
In order to match up the edges with the inside of the mouth, you must insert 8 isoparms from the center edge to the mouth corner edge. In order to do this, right click over the nurbs surface and select "Isoparm" from the marking menu. Select an edge and drag. You will see a yellow line appear, this is not actually an isoparm... it's just a marker indicating where you want to put an isoparm. Holding down the shift button you can insert as many yellow lines as you need. After you have created 8 evenly spaced yellow lines, you need to create isoparms out of them. To do this, simply go to edit nurbs>insert isoparms
and the information will be added for you.
When you are done repeat this step for the lower lip as well.
http://www.thehobbitguy.com/tutorials/polymodeling/page13.htm (2 of 4) [5/14/2002 3:09:31 PM]
Dave K's Poly Head Modeling Tutorial page 13
Finally we have a surface for the inside of the mouth. The next thing we need to do is convert it to polygons so that we can attach it to the rest of the head. To do this select your nurbs surface, then go to modify>convert>nurbs to polygons and open the options dialog box. Under "Type" select quads Under "Tesselation Method" select general In the Initial Tesselation Controls section... for "U Type" select "Per Span # of Iso Params" for "Number U" select "1" for "V Type" select "Per Span # of Iso Params" for "Number V" select "1" Then press the tesselate button in the lower right to convert it to polys.
http://www.thehobbitguy.com/tutorials/polymodeling/page13.htm (3 of 4) [5/14/2002 3:09:31 PM]
Dave K's Poly Head Modeling Tutorial page 13
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page13.htm (4 of 4) [5/14/2002 3:09:31 PM]
Dave K's Poly Head Modeling Tutorial page 14
<> Now that you have a polygon version of your mouth you can delete the other nurbs components used to make this surface. Before you can connect the two shapes into a single mesh you should snap the verticies of the inner mouth shape to those of the mouth on the head. Go into component mode and select one of the verts of the inner mouth edge. Holding down V for vertex snap move it to the corresponding vert on the head shape. Repeat this step untill both edges are perfectly lined up.
Now that you have both edges lined, up the first step is to combine your geometry. Select both pieces to join them. This will make Maya treat your 2 pieces of geomety as then go to polygon>combine one piece. However, there still is a border edge seperating the 2 pieces. This will be evident when you go to smooth your mesh. If there is a border edge a huge seam will appear. To view your border edge, go to display>custom polygon display and open the options dialog box. In the "Highlight" section, check border edges and in the "Border Width" section, put the slider to 5. Click apply and close. This will draw your border edge a little thicker than the other edges to help you see what your doing when you start to merge edges.
http://www.thehobbitguy.com/tutorials/polymodeling/page14.htm (1 of 3) [5/14/2002 3:09:36 PM]
Dave K's Poly Head Modeling Tutorial page 14
The next thing you're going to want to do is merge your border edges together. To do this, select your mesh and go to edit polygons>merge multiple edges and open the options dialog box.. Set your threshold to .01. This is important because if you set this number too high, it can merge your mouth shut. Press apply to merge edges. If there are some edges that didn't merge try setting it to .02 and go up from there until all your mouth edges are merged.
If your mouth didn't merge at all... you might have your normals flipped. If this is the case, go into component mode and select one face from either the head or the inside of the mouth, then go to edit polygons>normals>reverse and open the options dialog box. Set the mode to "reverse and propogate", then hit apply. This will flip the normals on the offending section, then you should be able to merge your seams.
http://www.thehobbitguy.com/tutorials/polymodeling/page14.htm (2 of 3) [5/14/2002 3:09:36 PM]
Dave K's Poly Head Modeling Tutorial page 14
When you are done you should have a single piece of geometry with no seam.
<>
http://www.thehobbitguy.com/tutorials/polymodeling/page14.htm (3 of 3) [5/14/2002 3:09:36 PM]
Dave K's Poly Head Modeling Tutorial page 15
<smooth
.
Looks like this guy only needs one more thing to be complete... Wrinkles :) . Right now he looks a little smooth. To create wrinkles while maintaining perfect "quadness" is a cool little trick.
Find the edge at which you wish to create a wrinkle.
Along that edge draw another edge just Next divide the faces in the center, a little offset to it and connect at the leaving the triangles at the ends alone. corners. This will make quads out of everything.
Then pull the center edge inward to create your wrinkle.
Try smoothing your object to see the result.
http://www.thehobbitguy.com/tutorials/polymodeling/page15.htm (1 of 3) [5/14/2002 3:09:49 PM]
Dave K's Poly Head Modeling Tutorial page 15
Here is the version where I added in some wrinkles.
And here is the final version after all the detail has been added.
http://www.thehobbitguy.com/tutorials/polymodeling/page15.htm (2 of 3) [5/14/2002 3:09:49 PM]
Dave K's Poly Head Modeling Tutorial page 15
Happy Modeling :). Dave K. <
http://www.thehobbitguy.com/tutorials/polymodeling/page15.htm (3 of 3) [5/14/2002 3:09:49 PM]
INSTANT MAYA UNLIMITED VERSION 4
INSTANT MAYA UNLIMITED
2001, Alias|Wavefront, a division of Silicon Graphics Limited. Printed in U S A. All rights reserved. Stuart Little image: Image courtesy of Sony Pictures Imageworks. Columbia/TriStar. All rights reserved.
Alias is a registered trademark and Alias|Wavefront, the Alias|Wavefront logo, Conductors, and ZaP!iT are trademarks of Alias|Wavefront, a division of Silicon Graphics Limited. Maya is a registered trademark and Maya Builder, Maya Cloth, Maya Complete, Maya Fur, Maya Live, Maya Paint Effects, and Maya Unlimited are trademarks of Silicon Graphics, Inc., used exclusively by Alias|Wavefront, a division of Silicon Graphics Limited. IRIX and Silicon Graphics are registered trademarks and SGI is a trademark of Silicon Graphics, Inc. Wacom is a trademark of Wacom Co., Ltd. NVidia is a registered trademark and Gforce is a trademark of NVidia Corporation. Linux is a registered trademark of Linus Torvalds. Red Hat is a registered trademark of Red Hat, Inc. Microsoft, Windows NT, and Windows 2000 are trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark, licensed exclusively through X/Open Company, Ltd. SoftImage is a registered trademark of SoftImage, Inc. Inferno and Flame are registered trademarks of Discreet Logic Inc. All other product names mentioned are trademarks or registered trademarks of their respective owners. Graph Layout Toolkit, 1992-1996 Tom Sawyer Software, Berkeley, California. All Rights Reserved. This document contains proprietary and confidential information of Alias|Wavefront, a division of Silicon Graphics Limited, and is protected by Federal copyright law. The contents of this document may not be disclosed to third parties, translated, copied, or duplicated in any form, in whole or in part, or by any means, electronic, mechanical, photocopying, recording or otherwise, without the express written permission of Alias|Wavefront, a division of Silicon Graphics Limited. The information contained in this document is subject to change without notice. Neither Alias|Wavefront, a division of Silicon Graphics Limited, its affiliates, nor their directors, officers, employees, or agents are responsible for punitive or multiple damages or lost profits or other special, direct, indirect, incidental, or consequential damages including any damages resulting from loss of business arising out of or resulting from the use of this material, or for technical or editorial omissions made in this document.
ALIAS|WAVEFRONT ■ 210 KING STREET EAST ■ TORONTO, CANADA M5A 1J7
CONTENTS ABOUT INSTANT MAYA UNLIMITED
7
Obtaining the lesson CD
7
Documentation conventions
8
Before you do the lessons
1
SUBDIVISION SURFACES
8
9
Preparing for the lesson
9
Lesson: Modeling a hand
10
Create a subdivision surface from a polygonal cube Create faces to be extruded as fingers Extrude the faces as fingers Create the thumb
12
14
15
Adjust the overall shape and cut an arm hole at the wrist Refine the fingers
Crease the edge of the nail Beyond the lesson
CLOTH
18
18
Create more precision in the fingernail region
2
10
20
22
24
25
About cloth animation
25
Pose and animate the character Construct the garment
26
Fit the garment onto the character Animate the cloth About the lessons
26
27 27
Preparing for the lessons Lesson 1: Making a Shirt Get started
26
28 29
29
Create the panels
29 INSTANT MAYA UNLIMITED 3
CONTENTS
Create the garment
31
Seam all panels to the garment
32
Create and edit a property for the garment
34
Make the 3D character a collision object Run a cloth simulation
36
Increase the garment’s resolution Change the Collision Offset Beyond the lesson
37 38
38
Lesson 2: Making Pants Get started
35
39 39
Create front and back curves
39
Create front and back panels
41
Create the garment
42
Seam the panels
43
Increase the resolution of specific panels Create the collision object Run the simulation
44
Beyond the lesson
46
44
Lesson 3: Exporting & Importing Garments Export the garments
44
47
47
Open the animation scene and import the shirt Position the shirt
49
Create a collision object and run a simulation Import and position the pants
Transfer the pants to the shirt’s solver Add mesh constraints
50
50
Create a collision object and run a simulation
Adjust the shirt
48
51
52
52
53
Run the simulation from dress-up pose to start of walk cycle
INSTANT MAYA UNLIMITED 4
54
CONTENTS
Save the initial state of the garments
55
Run the simulation for the walk cycle
56
Eliminate interpenetration Beyond the lesson
3
FUR
56
57
59 Preparing for the lesson
59
Lesson: Applying fur to a surface
60
Add a light and create a sphere
60
Create fur on the surface and modify the fur attributes Render the scene and refine attribute settings Beyond the lesson
4
LIVE
61
63
64
67 Understanding Live
67
Preparing for the lessons
70
Load and set up the images Lesson 1: Track and solve
71
72
Review the shot and plan tracking Start tracking a flower
73
74
Evaluate the flower1 track Track a fence corner
77 78
Delete tracking and track the end of fenceCorner Import other track points
82
Decide if you are ready to solve Solve the shot
83
84
Evaluate the solution
86
Solve again with more track points Beyond the lesson
80
88
90
INSTANT MAYA UNLIMITED 5
CONTENTS
Lesson 2: Solving with survey data Create a Distance constraint
91 91
Create a Plane constraint for the ground Register the solution
92
93
Create a fence Plane constraint and register the solution Evaluate the solution with imported geometry Beyond the lesson
INSTANT MAYA UNLIMITED 6
98
96
94
ABOUT INSTANT MAYA UNLIMITED Instant Maya Unlimited explains the fundamentals of Maya Unlimited in a set of brief lessons. If you are new to Maya, this book is your fastest starting point. If you are an existing user, it’s also the fastest starting point for learning any feature you haven’t had time to learn yet. There is one chapter for each major feature group. It’s important that you understand the material in the first lesson of Instant Maya before reading Instant Maya Unlimited. Thereafter, you can read chapters in Instant Maya Unlimited in any order. The lessons guide you through fundamental concepts rather than advanced techniques. To learn technique, visit www.aliaswavefront.com for details on training courses, videos, and Web-based tutorials. With Maya, you can complete most tasks with one of several techniques. To speed up your learning, this book shows the quickest technique to learn. For comprehensive coverage of the features you learn in Instant Maya Unlimited, see the online Maya Unlimited documentation. The chapters in Instant Maya Unlimited have counterpart sections in the online Maya Unlimited. If you prefer reading Maya Unlimited on paper, see the Maya 4 Documentation and Lessons CD for corresponding PDF files formatted for printing. For a list of keyboard shortcuts (hotkeys), see the Maya Quick Reference card.
Obtaining the lesson CD To do some of the more advanced lessons, you need to use the Maya 4 Documentation and Lessons CD, which contains Maya files we created for your use in the lessons. This CD is included in the Maya package.
INSTANT MAYA UNLIMITED 7
Documentation conventions In this book, the following conventions apply: •
UNIX means IRIX or Linux.
•
Windows means Windows NT or Windows 2000.
Before you do the lessons If you have already used Maya 4.0 or have a prior version of Maya installed, consider restoring the default factory settings before you begin the lessons. This will ensure the lessons work as described. To restore the factory settings without losing any custom settings you’ve created, do these steps: 1
Make sure Maya is not running.
2
Rename your existing user prefs directory to a new name, such as myprefs. The prefs directory path is:
•
(UNIX) ~username/maya/4.0/prefs
•
(Windows NT) drive:\WINNT\Profiles\username\maya\4.0\prefs
•
(Windows 2000) MyDocuments\username\maya\4.0\prefs If you have a previous version of Maya installed, such as 3.0, also rename that prefs directory to a new name, such as myprefs.
3
Start Maya and do the desired lessons.
4
To restore your custom settings after doing the lessons, exit Maya, rename the directory back to prefs, and start Maya again.
INSTANT MAYA UNLIMITED 8
1
SUBDIVISION SURFACES Modeling with subdivision surfaces is an easy way to create intricate objects such as human hands. It offers the best techniques of NURBS and polygonal modeling, and includes several unparalleled features. Like NURBS surfaces, subdivision surfaces are smooth and can be shaped using relatively few control vertices. Like polygonal surfaces, you can extrude areas of a surface to add appendages or other irregular shapes. For instance, you can extrude four fingers and a thumb from a palm-shaped object. An important distinction of subdivision surfaces is that you can build a perfectly smooth, complex object, for instance a dog, from a single primitive. There’s no need to create separate pieces and stitch them together, as is often necessary with NURBS surfaces. There are no seams that can break apart during animation. With a subdivision surface, you can modify its shape at various levels of detail to suit your needs. If you are creating a thumb, for instance, you alter its entire diameter by scaling a small number of vertices. If you next want to create a lumpy knuckle, you switch to a higher number of vertices at the desired region and drag vertices into the desired shape. You can switch between the different levels of detail as often as necessary.
PREPARING FOR THE LESSON To ensure the lesson works as described, do these steps before beginning: 1
Consider reading Chapter 2, “Polygonal Modeling” in Instant Maya. Working with polygonal modeling tools is essential to becoming proficient in subdivision surface modeling.
2
Create a new scene.
INSTANT MAYA UNLIMITED 9
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
3
Select the Modeling menu set. Unless otherwise noted, the directions in this chapter for making menu selections assume you’ve already selected the Modeling menu set.
LESSON: MODELING A HAND In the following lesson, you’ll create a cartoon character’s hand.
Create a subdivision surface from a polygonal cube You begin the lesson by creating a polygonal cube. You’ll convert this cube to a subdivision surface that will be the foundation of the hand. The reason for starting with a polygonal surface and converting it to a subdivision surface is that you can thereafter edit the object’s shape with more versatility. You can edit with subdivision surface tools and polygonal tools. 1
Select Create > Polygon Primitives > Cube ❒. In the options window, select Edit > Reset Settings. Then enter the following values and click the Create button. Width: 8 Height: 2.5 Depth: 8 The resulting polygonal cube is roughly proportional to the palm of a hand.
2
Rename the cube, pCube1, as LeftHand.
INSTANT MAYA UNLIMITED 10
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
3
To convert the polygonal cube to a subdivision surface, select Modify > Convert > Polygons to Subdiv.
4
Press 3 on your keyboard (to select Display > Subdiv Surface Smoothness > Fine). Also press 5 (to select Shading > Smooth Shade All).
With the Smoothness set to Fine, you can see that the conversion to a subdivision surface creates a rounded, smooth shape. By pressing 3, the subdivision surface is displayed more precisely in the scene view. This gives a closer approximation of what the surface will look like when you create a rendered image of the scene. As an alternative, you could have chosen a rough smoothness (press 1) so that Maya processes your editing changes in the scene view more quickly. Regardless of the smoothness in the scene view, surfaces always are displayed precisely in rendered images of the scene. 5
Select Subdiv Surfaces > Polygon Proxy Mode.
INSTANT MAYA UNLIMITED 11
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
The wireframe cube looks the same as the original polygonal cube. The new cube is called a polygonal proxy for the subdivision surface. You can use polygonal modeling tools to edit the shape of the polygonal proxy, which indirectly alters the shape of the subdivision surface. Unlike working with an actual polygonal object, your modifications result in perfectly smooth surface changes rather than faceted changes.
Create faces to be extruded as fingers Next, you’ll use polygonal modeling techniques to split a face into multiple faces to be extruded as fingers. 1
With LeftHand still selected, select Edit Polygons > Split Polygon Tool. You’ll use this tool to split the front face of the proxy into several faces to be extruded into fingers.
2
In the front view, click the point on the top edge as shown in the following figure, then click the corresponding point directly below it on the bottom edge. If the line between the points isn’t perfectly straight, use the middle mouse to drag the second point to the correct position. Press Enter.
Click these points and press Enter
INSTANT MAYA UNLIMITED 12
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
This splits the face into two faces. You’ll extrude the left face into a finger later. 3
Repeat the preceding two steps as necessary to split the face as follows:
Repeat the steps for these points. Then repeat for the remaining faces.
Notice how splitting the face into multiple faces alters the shape of the subdivision surface. The front part of the subdivision surface now resembles the proxy shape more. If you were to split the front face several more times, especially near the outer edges, the subdivision surface would sharpen and resemble the proxy shape even more. More faces means finer control, often at the expense of making the surface harder to work with. With the added faces, the subdivision surface looks a bit like the palm of a hand. You’ll build upon this shape to create a left hand with palm facing downward and fingers extruded outward. You’ll extrude the wide faces into fingers, and you’ll leave the narrow faces as webbing between the fingers.
Fingers will be extruded outward
INSTANT MAYA UNLIMITED 13
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
Extrude the faces as fingers Next, you’ll extrude faces into fingers. 1
In a perspective view, right-click LeftHand and select Face from the marking menu. This lets you select faces.
2
Select the right-most face by dragging a selection box around the tiny box at its center. (The subsequent illustration shows which face to select.)
3
Select Edit Polygons > Extrude Face.
4
Drag the blue arrow manipulator outward a little to create the lowest segment of the smallest finger. (The blue arrow turns yellow when selected.)
5
Repeat the prior two steps to create the middle segment of the smallest finger. Then repeat the prior two steps once again to create the top segment and complete the finger. By creating three segments for a finger, you mimic a real finger’s natural structure. The borders between the segments have vertices (not displayed currently) that let you reshape those regions, for instance, to create knuckles.
INSTANT MAYA UNLIMITED 14
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
6
Similarly, extrude the ring, middle, and index fingers from the appropriate wide faces. Don’t extrude the three small faces that lie between the wide spaces. Leave them in position to allow for webbing between the fingers.
Tip Do not be concerned if the hand you create does not match the lesson’s illustrations. Your goal in this lesson is to learn the workflow of subdivision surfaces, not to perfect your modeling technique. If you are intent on making the hand somewhat realistic, you can create fingers with natural proportions easily. First, select the top camera in the Outliner. In the Channel Box, set the top camera’s Rotate X, Y, and Z attributes to -90, 180, and 0. In the top view, dolly until the size of the subdivision surface roughly matches your palm. With your palm against the screen, drag each extrusion to the end of the corresponding finger segment of your hand.
Create the thumb Next, you’ll extrude a thumb as you did for the fingers. The following steps are abbreviated. See the preceding pages for details on the described tools, if necessary. 1
Select LeftHand. (Make sure it is highlighted in green in the scene view. If it is not green, select LeftHand in the Outliner.)
INSTANT MAYA UNLIMITED 15
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
2
Use Edit Polygons > Split Polygon Tool to split the side face in the thumb region into three faces. While splitting, make sure the middle face is larger than the outer faces:
This face must be larger than the faces on each of its sides
3
Extrude the middle face and drag it directly outward. Click the surrounding blue circle and use the rotate manipulator to aim it in a direction appropriate for a thumb.
4
Extrude three times more to create each segment of the thumb. Use the extrusion manipulator to rotate, move, and scale each extrusion to create the desired shape of a thumb. Use the following figure as a guideline. Again, it’s unnecessary to match the illustration or create a realistic thumb for this lesson. The extrusion manipulator is easy to figure out by clicking and dragging its various elements. If necessary, you can also use the conventional Move, Scale, and Rotate Tools to reshape the faces that control the thumb’s shape.
INSTANT MAYA UNLIMITED 16
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
5
In the scene view, right-click LeftHand and select Vertex from the marking menu. The purple vertices at the corners of the faces control the adjacent region of the hand.
6
Make coarse adjustments to various parts of the hand by repositioning the vertices with the Move, Scale, and Rotate Tools. The Move Tool works on individual vertices or groups of vertices. Rotate and Scale works on two or more vertices. Undo any changes you don’t like. Try to create the approximate thickness, length, and curvature of a cartoon character’s hand and fingers. There’s no need for perfection. You’ll refine the fingers later. An example hand follows. (You might be satisfied with a simpler shape.)
INSTANT MAYA UNLIMITED 17
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
Adjust the overall shape and cut an arm hole at the wrist In the next steps, you’ll cut a hole in the wrist where you might choose to attach an arm. Though you won’t create and attach an arm in this lesson, it’s useful to learn the technique for future use. 1
Select the face at the wrist and press Delete to create a hole where you could attach an arm.
2
Scale the four vertices that surround the hole and scale them inward to narrow the wrist region of the hand.
Refine the fingers Now you’ll refine the shape of the fingers by working at a level of detail not possible in Polygon Proxy mode. 1
Select LeftHand.
2
Select Subdiv Surfaces > Standard Mode. This switches to a mode that lets you modify the surface at various levels of detail to suit your needs.
3
In the scene view, right-click LeftHand and select Vertex from the marking menu.
INSTANT MAYA UNLIMITED 18
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
This displays 0s on the surface in the same positions as the vertices in Polygon Proxy mode. In fact, the 0s are vertices. The number 0 refers to the level of detail you are capable of editing. The 0 level is identical to the coarse control possible in Polygon Proxy mode by manipulating the vertices. You can move, rotate, and scale the 0s to alter the shape of the surface just as you did for vertices in Polygon Proxy mode. 4
Right-click the surface and select Display Level > 1. Though the 1s are displayed in the same regions as the 0s were previously, there are many more 1s displayed. The 1s are also vertices, and their increased presence means you can refine the shape with more subtlety.
5
Refine the shape of the fingers, thumb, and hand as desired by selecting various level 1 vertices and moving, scaling, and rotating them with the transformation tools. (Scaling and rotating has effect only if you select two or more vertices.) It’s essential to tumble the camera from various perspectives to make sure you’ve selected only the desired vertices.
INSTANT MAYA UNLIMITED 19
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
To return to level 0 to alter the shape with fewer vertices, right-click the surface and select Display Level > 0. Each level has advantages. Level 1 allows finer control because there are more vertices. Level 0 allows control of broader regions, and it’s often easier to select the desired vertices since there are fewer of them. It’s common to switch back and forth between levels repeatedly in a work session. The hand has level 2 vertices at various locations, for instance, at the webbing between the fingers. You can also work at that level of detail if desired (select Display Level > 2).
Create more precision in the fingernail region By default, a subdivision surface displays up to three levels of detail (0, 1, and possibly 2). The 0 level is the least refined. You can increase the level of detail for a selected region to at most 13 levels. Though increasing the number of levels allows more precision, it also slows Maya processing. You’ll accomplish most of your modeling needs at levels 0, 1, and 2. If you display level 2 vertices on the hand, you’ll notice that there are no level 2 vertices near the fingertips. To create the indentation of a finger nail, you need more vertices than levels 0 and 1 provide. In the next steps, you’ll add level 2 vertices at a fingertip so you can create a fingernail. 1
Switch to level 1.
2
Right-click the surface and select Edge from the marking menu.
3
Shift-click to select the edges that surround the region where you’ll shape a nail.
Shift-select the edges that surround the fingernail region
INSTANT MAYA UNLIMITED 20
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
4
To increase the amount of detail at the selected edges, select Subdiv Surfaces > Refine Selected Components. Additional surface curves appear in the fingernail area, indicating you can edit with more precision.
5
In the view, right-click LeftHand and select Vertex from the marking menu. This displays additional level 2 vertices in the fingertip region.
6
Select Modify > Transformation Tools > Move Tool ❒. In the Tool Settings window, turn on Normal, then close the window. You can thereafter use the Move Tool manipulator to move vertices in a direction normal (perpendicular) to the surface.
7
Select the vertices in the nail region.
8
Drag the Move Tool’s N manipulator down slightly to form the depression of a fingernail bed.
INSTANT MAYA UNLIMITED 21
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
Drag the N manipulator downward to create the depression of a nail bed
Crease the edge of the nail One of the unique features of subdivision surfaces is that it’s easy to create a crease or ridge on a smooth surface. You’ll do this in the next steps. 1
Switch to Edge selection mode and shift-click the edges around the nail to select them. (It might be easier to see the desired edges by first selecting Shading > Wireframe.)
2
After you select the edges, select Subdiv Surfaces > Full Crease Edge/Vertex.
INSTANT MAYA UNLIMITED 22
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
3
To create a ridge at the edge of the nail, switch to Vertex selection mode and select the level 2 vertices on the skin at the perimeter of the previously selected edges. Move them up so that the skin’s juncture with the nail forms a slight ridge.
4
Now experiment on your own by moving individual vertices to shape the nail and surrounding region as desired. A few suggestions follow:
•
In Smooth Shade display mode (Shading > Smooth Shade All), certain vertices might be below the shaded surface and therefore impossible to select and move. To display and select such vertices, switch to wireframe shading (Shading > Wireframe). After selecting the vertices, return to Smooth Shade display mode so you will be able to more easily see the results of moving them.
•
You might get better results using the Move Tool’s default World setting rather than the Normal setting made in a prior step. To return to the default setting, select Modify > Transformation Tools > Move Tool ❒. In the Tool Settings window, click Reset Tool, and then close the window.
•
To extend the front of the nail past the skin with a sharp edge, add a second crease on the edges below the tip of the nail. (With the appropriate edges selected, select Subdiv Surfaces > Full Crease Edge/Vertex.) You might also want to add an additional level of vertices at the edges. (With the appropriate vertices selected, select Subdiv Surfaces > Refine Selected Components.) After you crease the edges and add the extra vertices, you can make the nail’s edge overhang the skin below it by dragging the vertices at the nail tip out and away from the finger. Then tuck the row of vertices below the overhanging vertices in the opposite direction. An example of a completed nail follows:
INSTANT MAYA UNLIMITED 23
SUBDIVISION SURFACES | 1 Lesson: Modeling a hand
5
If you want more practice, repeat the procedure for the rest of the nails.
6
When finished, select Modify > Transformation Tools > Move Tool ❒. In the Tool Settings window, click Reset Tool, and then close the window. This returns the Move Tool to its default settings. This will avoid confusion if you do other lessons in this book.
Beyond the lesson Modeling with subdivision surfaces is an easy way to create intricate, smooth objects such as human hands and faces. The ability to create extrusions, subtle surface alterations, and sharp edges means there are innumerable types of objects you can model. There are many features not covered in this lesson. For instance, you can: •
convert a NURBS surface to subdivision surface.
•
convert a subdivision surface to a polygonal surface.
•
create subdivision surface primitive shapes from the Create > Subdiv Primitives menu: Sphere, Cube, Cylinder, Cone, Plane, and Torus. With these shapes, you can quickly start your subdivision surface model without converting from polygons or NURBS surfaces.
•
attach two subdivision surfaces to form a single surface, for instance, to merge a hand and an arm.
•
create a mirrored copy of a subdivision surface.
INSTANT MAYA UNLIMITED 24
2
CLOTH With Maya’s Cloth feature, you can model garments and simulate natural cloth behavior on an animated 3D character. You can also apply dynamic effects such as wind or turbulence to the cloth. In addition to creating clothing for characters, you can create and animate sheets, bedding, drapery, flags, and other fabric goods. This chapter includes these lessons: •
“Lesson 1: Making a Shirt” on page 29
•
“Lesson 2: Making Pants” on page 39
•
“Lesson 3: Exporting & Importing Garments” on page 47
ABOUT CLOTH ANIMATION To create and animate clothing, you do the following general steps: •
Pose and animate the character
•
Construct the garment
•
Fit the garment onto the character
•
Animate the cloth
INSTANT MAYA UNLIMITED 25
CLOTH | 2 About cloth animation
Pose and animate the character Before you construct a garment, you position the character in a dress-up pose at the scene’s start frame. The dress-up pose minimizes wrinkling and other undesired effects when you fit the garment. You animate the character to create the transition from the dress-up pose to its starting position, for instance, to the first step of a walk cycle. A typical duration for the transition is 20 frames—longer if the starting pose differs significantly from the dress-up pose. Finally, you complete the character’s animation from the starting pose onward.
Construct the garment When you begin creating a garment, you use the surface of your 3D character as a mannequin, much like a tailor uses a mannequin. Using the dress-up pose as a guide, you draw curves to form the outline of a garment. From these curves you create panels. The panels are similar to actual fabric patterns that are sewn together to make a finished garment. When you seam the panels together, you create a garment.
Fit the garment onto the character To fit the garment, you make the character a collision object, then run a cloth simulation for a single frame—the dress-up pose frame. As the simulation runs, the garment drapes onto the character. Subtle adjustments to the garment’s position occur continuously as the simulation runs. You stop the simulation at a desirable position, then save the position as the initial position.
INSTANT MAYA UNLIMITED 26
CLOTH | 2 About the lessons
You can use constraints and dynamic fields to influence the settling of the cloth. For example, you can pull out wrinkles or pin portions of the garment to specific places on the character. You can set various attributes of the cloth to change the physical behavior of the cloth. You can also create different types of fabric and affect the physical behavior of the garment. You can use different fabrics in the same garment, such as a baseball jacket with leather sleeves.
Animate the cloth First, you play the animation from the dress-up pose to the animation start pose. This runs the simulation for the frames played, which animates the garment’s motion along the way. You do this to create a natural look for the garment at the beginning of the animation segment you’re creating. Next, you change the frame range to span only the animation segment you will render, not the frames from the dress-up pose to the animation start pose. You won’t use the positioning of the garment prior to this point, so you save its current position for use at the start of the new frame range. You play the animation to run the simulation of the cloth’s motion for the desired animation segment. To enhance the results, you run the simulation several times with various attribute settings. You can modify the garment’s appearance and motion using constraints, dynamic forces, or keys.
ABOUT THE LESSONS In many production groups, it’s typical for an animation specialist to animate the character in one scene while a cloth specialist constructs and fits the garments to a copy of the character in another scene. The fitted garments are then exported to the animation scene, where the cloth specialist positions them on the character and runs the cloth simulation for the animation. The following lessons use this workflow. In the first two lessons, you’ll drape a shirt and pants on a stationary 3D character. In the last lesson, you’ll import a shirt and pants into a scene containing an animated version of the same 3D character. You’ll position the shirt and pants on the character, then INSTANT MAYA UNLIMITED 27
CLOTH | 2 Preparing for the lessons
run a cloth simulation that causes the cloth to wrinkle and deform as the character moves. Because the lessons collectively illustrate a complete cloth workflow, it’s best to do them in the order presented. Keep in mind that, in your own work, you can create the garments and animate the character in a single scene.
PREPARING FOR THE LESSONS To ensure the lesson works as described, do these steps before beginning: 1
Make sure you understand basic concepts of polygonal modeling, animation, and character setup.
2
Select the Cloth menu set. If Cloth doesn’t appear in the menu set selection menu, select Window > Settings/Preferences > Plug-in Manager. In the Plug-in Manager window, click the loaded checkbox for CpClothPlugin.so (UNIX) or CpClothPlugin.mll (NT). Close the Plug-in Manager window. Maya loads Cloth and adds the Cloth menu set. Unless otherwise noted, the procedures in this book assume the Cloth menu set is selected.
3
Select Window > Settings/Preferences > Preferences. Click the Timeline category and set Playback Speed to Play every frame. This setting is necessary for the cloth simulation to work correctly. Click the Save button.
4
Obtain the Cloth lesson data from the Maya 4 Documentation and Lessons CD. You can either copy the following directory from the CD or work from it directly: UnlimitedLessonData/Cloth/scenes
We provide a completed scene for each of the lessons in this chapter. If you want to see the expected results of the lessons, you can open the scenes from UnlimitedLessonData/Cloth/scenes on the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files. The scene filenames end with Final.mb, for instance, importFinal.mb.
INSTANT MAYA UNLIMITED 28
CLOTH | 2 Making a Shirt
LESSON 1: MAKING A SHIRT In this lesson, you’ll create a shirt and fit it onto a stationary character.
Get started In this lesson, you’ll work with a scene we created for your use. 1
Before beginning the lesson, do the steps in “Preparing for the lessons” on page 28.
2
Open the scene UnlimitedLessonData/ Cloth/scenes/shirtStart.mb. You can open the scene from the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files. This scene provides a polygonal model, named jackie, and the curves for creating the panels of the shirt.
Create the panels In the next steps, you’ll create panels to be assembled as a shirt.
Create the front vest panel 1
In the Outliner, open the shirtPattern group.
2
Select curvesBack and press Ctrl-h to hide the curves. You’ll work only with the front curves for the next several steps, so it’s helpful to hide the back curves to reduce clutter in the scene. Note that the pink color of jackie’s wireframe indicates that jackie is displayed as a template—an object that is visible, but not selectable in the view. We made jackie a template so you can’t select it unintentionally.
3
In the Outliner, select and hide jackie to reduce clutter in the scene.
4
Select the curves that represent the front vest part of the shirt. You can select the curves in any order. If you want to use the Outliner, open the curvesFront group and select curve1 through curve5 and curve9 through curve13.
INSTANT MAYA UNLIMITED 29
CLOTH | 2 Making a Shirt
Front panel
The curves form a closed loop and lie in the same plane. The end of one curve is where the next curve begins. Curves must meet these requirements to be used for creating a panel. 5
Select Cloth > Create Panel. The Cloth Panel icon is displayed, indicating you’ve created a panel.
Create the front sleeve panels 1
Panel icon
Select the curves for the right sleeve and create a panel. (In the Outliner, these are curve3, and curve6 through curve8.)
Right sleeve
2
Select the curves for the left sleeve and create a panel. (In the Outliner, these are curve11, and curve 14 through curve16.)
3
In the Outliner or view, select panel1, panel2, and panel3.
4
Select Edit > Group to group the panels.
5
Name the group panelsFront, then parent panelsFront under shirtPattern.
INSTANT MAYA UNLIMITED 30
CLOTH | 2 Making a Shirt
We provided shirtPattern group in the scene to help you organize your curves and panels. Grouping and parenting objects in this way is not necessary when creating a garment. However, organizing the elements of your garment makes it easier to locate them in the Outliner if the need arises. Grouping also makes it easy to hide or display a number of related elements.
Create the back vest panel 1
Hide panelsFront and curvesFront, as you won’t be working with them for awhile.
2
In the Outliner, select curvesBack and select Display > Show > Show Selection. You’ll use these curves to create the back part of the shirt.
3
Select the curves that represent the back vest part of the shirt. To use the Outliner, open the curvesBack group and select the following curves:
•
curve17 through curve20
•
curve24 through curve27
•
curve31
4
Select Cloth > Create Panel to create a panel.
Create the back sleeve panels 1
Select the curves for the right sleeve. To use the Outliner, select curve18 and curve21 through curve23. Select Cloth > Create Panel.
2
Select the curves for the left sleeve. To use the Outliner, select curve25, and curve28 through curve30. Select Cloth > Create Panel. You now have three panels for the back of your shirt.
3
Group the three panels and name the group panelsBack.
4
For the sake of scene organization, parent panelsBack under shirtPattern.
Create the garment Now that you’ve created all the panels, you’re ready to create the garment. A garment is a collection of panels. 1
Select Display > Show > Show Cloth > All. This displays all curves and panels that exist in the scene.
INSTANT MAYA UNLIMITED 31
CLOTH | 2 Making a Shirt
2
In a perspective view, rotate the camera so you can see the front and back panels.
3
Select the middle front panel, being careful not to select a curve in addition.
4
Select Cloth > Create Garment. This creates a polygonal mesh garment named cloth1. It also creates a stitcher node, called cpStitcher, which lets you create seams between panels.
5
Press the 5 key to see the panel in smooth shaded mode.
6
In the Channel Box, click on cpStitcher and set the Base Resolution to 200. This tessellates the cloth into smaller subdivisions. The higher the Base Resolution, the finer the tessellation. Finer tessellation means the surface allows finer shape alterations. The lower the Base Resolution, the faster the processing. As with other attributes described in this lesson, experience will guide your choice of values.
7
In the Outliner, change the name of cloth1 to shirt.
Seam all panels to the garment To include all panels of the shirt in the garment, you seam them to a panel in the garment. Currently the garment has only one panel—the middle front panel. When you seam a panel that’s not in the garment to a panel in the garment, the new panel is added to the garment and the mesh is tessellated again. You can seam a panel only to a panel in the garment. You cannot seam to a panel that’s not in the garment. You create seams much like you would sew seams in a shirt pattern. You create side seams, shoulder seams, and sleeve seams. If two panels share a curve, for instance, a front sleeve panel and the adjacent front vest panel, you pick the curve between them and create a seam. If two panels do not share a curve, for instance, a back sleeve panel and a front sleeve panel, you select the appropriate pair of edge curves and create the seam. The technique will become clear in the following steps.
INSTANT MAYA UNLIMITED 32
CLOTH | 2 Making a Shirt
1
Display the panel in wireframe mode. (Click in the view and press 4.)
2
In the Outliner, open the curvesFront and curvesBack groups.
3
Select curve11 and select Cloth > Create Seam. This seams together two panels that share the same curve.
4
In the Outliner, select the single curve or pair of curves listed below, then select Cloth > Create Seam to seam the panels together. Selection
Create seam here
Action
curve3
.
Create Seam
curve6
curve21
Create Seam
curve18
.
Create Seam
curve25
.
Create Seam
curve8
curve23
Create Seam
curve2
curve17
Create Seam
curve4
curve19
Create Seam
curve10
curve24
Create Seam
curve14
curve28
Create Seam
curve15
curve29
Create Seam
curve12
curve26
Create Seam
As you do this, observe how the resulting seams and panels differ based on which curve or curves you select. After you finish creating the seams, you can display all seams by selecting Display > Show > Show Cloth > Seams. The icons for seams between panels resemble stitches or ruler marks. A single row of stitch marks exists for a seam made between panels that share a curve. Two separated rows of stitch marks exist for a seam made between panels that do not share a curve, one row at each of the curves selected before you created the seam.
INSTANT MAYA UNLIMITED 33
CLOTH | 2 Making a Shirt
The easiest way to know if you’ve seamed the entire garment is to examine the garment in shaded mode. The garment will have no unintended gaps between the panels.
Create and edit a property for the garment Cloth properties define how the cloth behaves as it moves, whether during the simulation or as the underlying object is animated. By default, each panel is connected to a property called cpDefaultProperty. However, you can create as many properties as you want and apply any property to any panel. In the next steps, you’ll create a property for the shirt and edit a pair of the many attributes available. 1
In the Outliner, select all the panels, but not the panelFront or panelBack group nodes.
2
Select Simulation > Properties > Create Cloth Property. This creates a new property node and assigns it to the selected panels.
3
In the Channel Box, rename cpProperty to cpPropertyShirt.
Tip To see which property node affects a panel, select the panel, and in the Channel Box you’ll see the property node listed under INPUTS. 4
Set the U Bend Resistance and the V Bend Resistance attributes to 5.0. These attributes control how much the cloth resists flexing. The default value is 10. Lower values increase the flexibility of the cloth. In this lesson, you use the same value for both attributes so the cloth resists flexing uniformly. In some situations, it’s useful to set the two attributes to different values to make the cloth flex more in one surface direction than the other. To know which surface direction is U and which is V, examine the v notch in the panel icon. The v notch points in the V direction. U is perpendicular to the V direction.
INSTANT MAYA UNLIMITED 34
CLOTH | 2 Making a Shirt
Make the 3D character a collision object To have cloth interact with a surface, you must make the surface a collision object before you run the simulation. A collision object can be a polygonal or NURBS surface. If you use a NURBS surface, Maya converts it to a polygonal surface. In the next steps, you’ll make jackie a collision object. (Jackie is a polygonal object.) 1
In the Outliner, select jackie.
2
From the main menus, select Display > Show > Show Selection to display jackie.
3
Untemplate jackie by selecting Display > Object Display > Untemplate. This will let you see the cloth deform against jackie’s surface more clearly.
4
With jackie still selected, select Cloth > Create Collision Object.
5
In the Channel Box, set Collision Offset to 0.2. This specifies how far Maya strives to keep the cloth away from the collision object during the simulation. It’s likely that parts of the garment will pass slightly through the Collision Offset distance occasionally during the simulation. When the garment pokes through, Maya repels the garment back above the surface again. If a garment pokes through too much or too often, increase the Collision Offset and run the simulation again.
6
In the Channel Box, set Collision Depth to 0.7. The Collision Depth sets the maximum distance any part of the cloth can penetrate the collision object and still be repelled back above the surface of the collision object. If a garment passes the Collision Depth threshold, the collision object won’t repel the cloth and allows it to pass through entirely. If this occurs, try a higher Collision Depth value and run the simulation again. Set the Collision Depth to a value no larger than half the depth of the collision object. In this context, depth means the distance between any opposing surfaces of the collision object.
INSTANT MAYA UNLIMITED 35
CLOTH | 2 Making a Shirt
Run a cloth simulation Running a simulation refers to the processing that Maya does to position and shape the cloth on the collision object. The part of Maya that performs the simulation is the cloth solver. It assembles information on the cloth, any bodies it interacts with, and any fields or constraints applied to the cloth. Before you run the simulation, you’ll set the Solver Scale attribute to enhance the realism of the shirt’s deformation during the simulation. 1
In the Outliner, select shirtPattern and press Ctrl-h to hide the seams.
2
In the Outliner, select shirt.
3
In the Channel Box, click cpSolver1 and set Solver Scale to 10. The scene view size of the garment and 3D character influences the way a garment behaves. For instance, a tiny shirt hangs differently than a giant shirt. Jackie is about 16 grid units (centimeters) in height. To make the cloth behave as a real-life shirt, you need to increase the Solver Scale to compensate for its small size. A value of 10 causes Maya to process the cloth as if it were positioned on a model 160 centimeters tall—roughly the size of a real person.
4
Go to the start time. Otherwise, after you run the simulation, the cloth will return to its original undraped position when you go to the start time.
5
To run a simulation, select Simulation > Start Simulation. This relaxes (drapes) the shirt to the 3D character. The cloth wiggles slightly long after it snugs up against the character. This occurs because the cloth solver continuously recalculates the position of the cloth against the collision object in case any new movement or force influences the objects.
6
When the cloth settles into a desirable position, press Esc to stop the simulation. Note that you can use Undo to return to the garment to its pre-simulation state.
INSTANT MAYA UNLIMITED 36
Draped State
CLOTH | 2 Making a Shirt
Note If you play the scene, Maya runs the simulation for the entire animation time range, by default. As time changes, the cloth’s motion is cached so you can later scrub the Time Slider to examine the cloth’s appearance at various frames. The animation plays faster after caching because Maya uses disk-stored cloth positions for each frame. If you decide to see the results of the simulation with different attribute settings, you must first delete the cache. Generally, you run the simulation by playing the animation only after you’ve draped the garment onto a stationary character with Simulation > Start Simulation. With Simulation > Start Simulation, known as a local simulation, animation time does not advance. You use a local simulation to drape the garment onto a stationary character.
Increase the garment’s resolution In the next steps, you’ll run the simulation a few times after setting higher values for the garment’s Base Resolution (tessellation). The garment drapes more naturally at a higher resolution, but processing takes longer. By running the simulation a few times with increasing resolution, the simulation times are shorter and the cloth deforms more smoothly. 1
Select the shirt and display the Attribute Editor.
2
Click the cpStitcher tab.
3
Turn on Fit to Surface. After you’ve run a simulation, it’s necessary to turn on Fit to Surface before you change the Base Resolution of a garment, add seams, or modify the shape of a panel by editing its original curves. Otherwise, the garment’s shape distorts.
4
Set the Base Resolution to 300.
5
Select Simulation > Start Simulation. When the shirt relaxes, press Esc.
6
Set the Base Resolution to 400.
INSTANT MAYA UNLIMITED 37
CLOTH | 2 Making a Shirt
7
Select Simulation > Start Simulation. When the shirt relaxes, press Esc.
Change the Collision Offset Now you’ll decrease the Collision Offset and run the simulation again. This brings the shirt closer to the skin. 1
Select jackie. Set the Collision Offset to 0.1.
2
Select Simulation > Start Simulation.
3
When the shirt relaxes, press Esc.
4
To see what the cloth looks like with a shader applied, you can assign it a material that we created for your use in the lesson.
•
Select the shirt. Select the Rendering menu set. Select Lighting/Shading > Assign Existing Material > shirtMtl. Press 5 to turn on smooth shading.
High resolution cloth
Beyond the lesson The behavior of cloth is controlled primarily by attributes in the collision object’s shape node and by the cpSitcher, cpSolver, and cpProperty nodes. Most attributes that affect cloth, such as Shear Resistance, require experimentation to find the best setting. This lesson provided curves already shaped into the outline of a shirt. When you create your own curves for clothing, position the curves close to the body without intersecting it. You position a group of curves in front of the model and another in back of the model as shown in this lesson. If you modify the original curves after you create a garment, the garment updates automatically.
INSTANT MAYA UNLIMITED 38
CLOTH | 2 Making Pants
Before you draw the curves, you must consider the shape of the panels you plan to create. In general, it’s necessary to create a panel for each part of the garment that you want to look or behave uniquely. For instance, to create a woolen jacket with leather sleeves, the sleeves need to be panels separate from the vest. For help in planning panels, consider buying a pattern from a fabric store. When you work on your own garments, it’s best to start by running the simulation with default option settings. Later, you run the simulation a few times with different settings until you achieve the garment look you’re seeking.
LESSON 2: MAKING PANTS In this lesson, you’ll make a pair of pants and fit it onto a stationary character. You’ll also learn how to refine specific panels of the pants.
Get started In this lesson, you’ll work with a scene we created for your use. 1
Before beginning the lesson, do the steps in “Preparing for the lessons” on page 28.
2
Open the scene UnlimitedLessonData/Cloth/ scenes/pantsStart.mb. You can open the scene from the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files. This scene includes jackie’s model and some curves you’ll use to make the pants. We provided the curves so you can focus on developing a garment rather than on creating curves. The model has been templated to make picking curves easier. This lesson does not explain concepts and menu items described in the prior lesson. If you don’t understand a term in this lesson, see the prior lesson.
INSTANT MAYA UNLIMITED 39
CLOTH | 2 Making Pants
Create front and back curves The scene you just opened includes the curves for half a pair of pants. In the next steps, you’ll duplicate the curves for the other half of the pants. Later in the lesson, you’ll create panels from the curves and seam the panels together to form the pants.
Front curves 1
In the Outliner, note the pantsPattern group. This group includes two groups: curvesBack and curvesFront. Hide the curvesBack group because you won’t work with them until later.
2
Open the curvesFront group so that all the curves in it are listed.
3
Select curve2 through curve9.
4
Select Edit > Duplicate ❒. From the options window, select Edit > Reset Settings, then continue as follows.
5
Set Scale for the X-axis to -1. When you complete the Duplicate operation in a later step, the duplicate curves will be created in corresponding positions along the negative X-axis. This mirrors the left leg in the right leg position.
6
For Geometry Type, turn on Instance. Instancing the curves makes modifying the pants easier; if you adjust the left leg, the right leg is adjusted identically.
7
Click the Duplicate button.
INSTANT MAYA UNLIMITED 40
CLOTH | 2 Making Pants
8
Hide the curvesFront group. You won’t work with them until later.
Back curves
1
In the Outliner, select the curvesBack group. Select Display > Show > Show Selection.
2
In the Outliner, open the curvesBack group so that all the curves in it are listed.
3
Select curve12 through curve19.
4
Select Edit > Duplicate. This uses the same Duplicate options that you used before. (Scale for the X-axis is -1, Geometry Type is Instance).
5
Hide the curvesBack group.
Create front and back panels In the next steps, you’ll create panels to be assembled as pants.
Create front panels 1
Select jackie in the Outliner then hide jackie to reduce scene clutter (Ctrl-h).
2
Display curvesFront in the scene view. (Select it in the Outliner and select Display > Show > Show Selection.) With the curves in curvesFront, you can create five panels: one waistband panel, two hip panels, and two leg panels.
3
In the Outliner, select the curves below, then select Create > Create Panel.
INSTANT MAYA UNLIMITED 41
CLOTH | 2 Making Pants
Selection
Action
curve3, 4, 5, 21, 22, 23
Cloth > Create Panel
curve1, 2, 3, 6
Cloth > Create Panel
curve1, 20, 21, 24
Cloth > Create Panel
curve6, 7, 8, 9
Cloth > Create Panel
curve24, 25, 26, 27
Cloth > Create Panel
4
Group the panels and name the group panelsFront.
5
Parent panelsFront under the pantsPattern group. Grouping parts of the garment simplifies finding them in the Outliner if the need arises.
6
Hide panelsFront and curvesFront. You won’t use them in the next steps.
Create back panels 1
Display curvesBack in the scene view.
2
In the Outliner, open the curvesBack group to list the curves. Select the following curves in the Outliner, then select Cloth > Create Panel. Selection
Action
curve16, 18, 19, 32, 34, 35 Cloth > Create Panel curve11, 15, 16, 17
Cloth > Create Panel
curve11, 31, 32, 33
Cloth > Create Panel
curve12, 13, 14, 17
Cloth > Create Panel
curve28, 29, 30, 33
Cloth > Create Panel
3
Select panel6 through panel10.
4
Group the panels and name the group panelsBack.
5
Parent panelsBack under the pantsPattern group.
INSTANT MAYA UNLIMITED 42
CLOTH | 2 Making Pants
Create the garment In the next steps you’ll create a garment from one of the panels so that you can thereafter seam the other panels to the garment. The panel you use to create the initial garment is arbitrary. 1
Select Display > Show > All.
2
In the Outliner, open the panelsFront group to list the front panels.
3
Select panel4. Select Cloth > Create Garment.
4
In the Outliner, rename cloth1 as pants.
5
With pants still selected, click cpStitcher in the Channel Box. Set the Base Resolution to 250.
Seam the panels Now you’ll seam the remaining panels into the garment. 1
In the Outliner, open the curvesFront and curvesBack groups to list the curves. In the Outliner, select the single curve or pair of curves listed below, then select Cloth > Create Seam to seam the adjacent panels together. Selection
Action
curve6
Create > Seam
curve3
Create > Seam
curve21
Create > Seam
curve1
Create > Seam
curve24
Create > Seam
curve8,14
Create > Seam
curve2,15
Create > Seam
curve4,18
Create > Seam
curve17
Create > Seam
curve16
Create > Seam
curve7,12
Create > Seam
INSTANT MAYA UNLIMITED 43
CLOTH | 2 Making Pants
2
Selection
Action
curve11
Create > Seam
curve32
Create > Seam
curve33
Create > Seam
curve25,28
Create > Seam
curve26,30
Create > Seam
curve20,31
Create > Seam
curve22,34
Create > Seam
Press 5 to smooth shade the pants. The garment will have no holes or gaps between the panels if you’ve seamed all the panels.
Increase the resolution of specific panels You can increase the resolution of specific panels to have regions of the garment deform more precisely than others during the simulation. 1
Select panel1 and panel6. These are the two panels that control the shape of the waistband.
2
In the SHAPES section of the Channel Box, set the Resolution Factor to 1.7. With the increased resolution, the waistband becomes smoother.
Create the collision object To have the pants interact with jackie, you must make jackie a collision object before you run the simulation. 1
Hide pantsPattern.
2
In the Outliner, select jackie and select Display > Object Display > Untemplate.
3
With jackie selected, select Cloth > Create Collision Object.
4
In the Channel Box, set Collision Offset to 0.1 and Collision Depth to 0.5.
INSTANT MAYA UNLIMITED 44
CLOTH | 2 Making Pants
Run the simulation In the following steps, you’ll run the simulation repeatedly with various option settings.
Set solver and property options Solver and property attributes control how the pants deform during the simulation. 1
Select Simulation > Solvers > cpSolver1 ❒ to display the solver attributes.
2
Set the Solver Scale to 10.
3
Select Simulation > Properties > cpDefaultProperty ❒.
4
Set U and V Bend Resistance to 20.
5
You can optionally deselect jackie so that the surface is easier to see.
6
Select Simulation > Start Simulation. When the pants fit well, press the Esc key to stop the simulation. Do not be concerned if there are small spots where jackie pokes through the pants. You’ll fix this at the end of the lesson.
Add and edit properties for specific panels In the next steps you’ll assign a property to selected panels, then set property attributes that affect the behavior of the panels. 1
Select Display > Show > Show Cloth > Panels.
2
Select panel1 and panel6, in the Outliner. These are the two waistband panels.
3
Select Simulation > Properties > Create Property. This creates a new property node and assigns it to the selected waistband panels.
4
In the Channel Box, rename the cpProperty node to cpPropertyBelt, then set the U Scale to 0.8. The U Scale value of 0.8 scales down the waistband panel in the U direction, which causes the cloth in the waistband to tighten. This takes effect only after you run the simulation again. INSTANT MAYA UNLIMITED 45
CLOTH | 2 Making Pants
5
Select the two panels at the butt, panel7 and panel8 in the Outliner.
6
Select Simulation > Properties > Create Property and name the property cpPropertyRear.
7
In the Channel Box settings for cpPropertyRear, set the U and V Scale to 1.1. When you run the simulation, the cloth in the butt region a bit more loosely.
8
Select Simulation > Start Simulation. When the pants fit well, press the Esc key.
Increase the Base Resolution You might have noticed small regions where jackie pokes through the pants. This is a common when you run a simulation for a garment with relatively coarse tessellation. In the next steps you’ll eliminate the interpenetration by increasing the tessellation of the pants. 1
Select the pants. In the Attribute Editor, click the cpStitcher tab.
2
Set the Base Resolution to 300 and turn on Fit To Surface.
3
Select Simulation > Start Simulation. When the pants fit well, press the Esc key.
4
If you want to see what the cloth looks like with a shader applied, you can assign it a material we created for your use in the lesson.
•
Select the pants. Select the Rendering menu set. Select Lighting/Shading > Assign Existing Material > pantsMtl to assign the material to the pants. Press 5 to turn on smooth shading.
Beyond the lesson The steps for creating pants are roughly the same as for creating a shirt. Regardless of the type of garment you create, you can have specific panels look and behave differently when simulated. Interpenetration is a common result of using a low Base Resolution. However, it’s best to start with a low Base Resolution because the simulation runs faster. By increasing the Base Resolution slightly with subsequent
INSTANT MAYA UNLIMITED 46
CLOTH | 2 Exporting & Importing Garments
simulations, you’ll spend less time waiting for lengthy simulations. Using repeated simulations after making small adjustments to option settings is also beneficial because it reduces the chance of the garment looking unnatural.
LESSON 3: EXPORTING & IMPORTING GARMENTS In this lesson, you’ll export the pants and shirt from previous scenes. Then you’ll import the pants and shirt into a scene where jackie is animated from a dress-up pose to a complete walk cycle. You’ll position the shirt and pants on jackie and run the simulation of the cloth for the entire frame range.
Export the garments You’ll begin the lesson by exporting a shirt and pants. If you completed the prior lessons, the shirt and pants will look familiar. Before beginning, do the steps in “Preparing for the lessons” on page 28. This lesson does not explain concepts and menu items described in the prior lessons. If you don’t understand a term in this lesson, see the prior lessons.
Export the shirt 1
Open the scene UnlimitedLessonData/Cloth/scenes/shirtFinal.mb. You can open the scene from the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files. The scene contains a shirt that was created by running a simulation on jackie.
2
Select the shirt. Make sure nothing else is selected.
3
Select File > Export Selection ❒. From the options window, select Edit > Reset Settings, make sure History is turned on, then click Export Selection. With History on, Maya exports the cloth solver that controlled the shirt’s simulation in shirtFinal.mb. You must include the solver because you’ll run the simulation of the shirt again in the scene where you import it. In scenes
INSTANT MAYA UNLIMITED 47
CLOTH | 2 Exporting & Importing Garments
where you don’t plan to redo simulation of an imported garment, such as a stationary tablecloth, you can leave History turned off to avoid importing the solver. 4
Do one of the following, depending on your operating system:
•
(Windows) In the Export Selection window, click the down arrow in the top box to display the pull-down menu and select Current scenes.
•
(UNIX) In the Export Selection window, select File > Go to Current scenes.
5
Enter the name shirtExport and click Export Selection. This creates a scene file named shirtExport.mb.
Export the pants 1
Open the scene UnlimitedLessonData/Cloth/scenes/pantsFinal.mb. You can open the scene from the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files. The scene contains a pair of pants that was created by running a simulation on jackie.
2
Select the pants.
3
Select File >Export Selection. This export operation uses the same options you set the last time you used File > Export Selection ❒.
4
Do one of the following, depending on your operating system:
•
(Windows) In the Export Selection window, click the down arrow in the top box to display the pull-down menu and select Current scenes.
•
(UNIX) In the Export Selection window, select File > Go to Current scenes.
5
Enter the name pantsExport and click Export Selection. This creates a scene file named pantsExport.mb.
Open the animation scene and import the shirt 1
Open the scene UnlimitedLessonData/Cloth/scenes/importStart.mb. You can open the scene from the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files.
INSTANT MAYA UNLIMITED 48
CLOTH | 2 Exporting & Importing Garments
Notice that jackie has the same dress-up position and scale as in the export scenes. This is a requirement for importing exported garments. In this scene, however, jackie has been moved and rotated away from the origin. In this lesson, you’ll move and rotate the imported garments to fit them properly on jackie. 2
Make sure the frame range is -20 to 118.
3
Play the scene to become familiar with the animation. In frames -20 to 1, jackie makes a transition from the dress-up pose to the start position of the walk cycle. In frames 1 to 118, jackie is animated in a walk cycle.
4
Go to the start time of the animation (frame -20).
5
Select File > Import ❒. From the options window, select Edit > Reset Settings, turn on Use Namespaces, then click the Import button. The option settings cause Maya to rename all imported objects, solvers, and other nodes so they cannot clash with existing names in the scene.
6
Do one of the following, depending on your operating system:
•
(Windows) In the Import Selection window, click the down arrow in the top box to display the pull-down menu and select Current scenes.
•
(UNIX) In the Import Selection window, select File > Go to Current scenes.
7
Select shirtExport.mb and click Import. This imports the shirt.
8
In the Outliner, select shirtExport:shirt. In the Channel Box, notice the names shirtExport:cpSolver1 and shirtExport:cpStitcher1. Because of the options you selected in the Import options window, Maya added shirtExport: as a prefix to the cpSolver1 and cpStitcher1 nodes that were imported from the shirtExport.mb file. This ensured that the names would be unique after being imported to importStart.mb.
INSTANT MAYA UNLIMITED 49
CLOTH | 2 Exporting & Importing Garments
Position the shirt The imported shirt is positioned at the origin. You need to position the shirt on jackie. 1
Move and rotate the shirt so it fits well on jackie. Press 5 to turn on smooth shading so you can see where the shirt penetrates the skin. A perfect fit is not necessary. Running the simulation will push out the shirt. However, make sure the positioning is close to these values: Translate X: 9.93 Translate Y: 0.1 Translate Z: -9.98 Rotate Y: -24
2
In the Channel Box, click shirtExport:cpSolver1. Set the Start Frame to -20 in the INPUTS section of the Channel Box. When you run the simulation, it will start from frame -20.
3
From the Cloth menu set, select Simulation > Save as Initial Cloth State. Maya will use the current shirt position and shape at the start of the animation (frame -20).
Create a collision object and run a simulation You need to make jackie a collision object so the shirt drapes on jackie when you run the simulation. 1
Select jackie.
2
Select Cloth > Create Collision Object.
3
In the Channel Box, set the Collision Offset to 0.16 and the Collision Depth to 0.2. Ignore Warning: Cycle... messages after you make jackie a collision object. To prevent such messages, enter cycleCheck -e off in the Command Line.
4
Select Simulation > Start Simulation. Within a minute or so, the shirt drapes nicely on jackie without interpenetration. Press Esc when you are satisfied with the shirt’s display.
INSTANT MAYA UNLIMITED 50
CLOTH | 2 Exporting & Importing Garments
Import and position the pants Next, you’ll import the pants and position them on jackie. 1
Hide the shirt. The name of the shirt is shirtExport:shirt.
2
Select File > Import. The importing will occur with the same options used when you imported the shirt.
3
Do one of the following, depending on your operating system:
•
(Windows) In the Import Selection window, click the down arrow in the top box to display the pull-down menu and select Current scenes.
•
(UNIX) In the Import Selection window, select File > Go to Current scenes.
4
Select pantsExport.mb and click Import. This imports the pants.
5
Move and rotate the pants on jackie so they fit as well as possible. The pants are named pantsExport:pants. A suitable position is at: Translate X: 10 Translate Y: 0 Translate Z: -10 Rotate Y: -30
6
With the pants selected, click pantsExport:cpSolver1 in the Channel box. Set the Start Frame to -20. When you run the simulation, it will start from frame -20.
7
Select Simulation > Save as Initial Cloth State. Maya will use the current position and shape of the pants at the start of the animation (frame -20).
Create a collision object and run a simulation When you imported the shirt and pants, Maya also imported a pants solver and a shirt solver. The names of the solvers, pantsExport:cpSolver1 and shirtExport:cpSolver1, are listed under the menu Simulation > Solvers >. Currently, the solvers have no effect on the pants and shirt because you have not connected them to jackie in this scene. (The solvers were previously connected to a different jackie in the exported scenes.)
INSTANT MAYA UNLIMITED 51
CLOTH | 2 Exporting & Importing Garments
In the next steps, you’ll make jackie a collision object that interacts with the pants during simulation. You’ll also run a simulation to correct jackie’s interpenetration of the pants. 1
Select Simulation > Solvers > pantsExport:cpSolver1. This makes the pantsExport:cpSolver1 solver the current solver.
2
Select jackie.
3
Select Cloth > Create Collision Object.
4
Select the pants. Selecting the pants specifies which solver you want to use. Even though shirtExport:cpSolver1 has no effect because it’s not connected to jackie, you must still select the pants to make pantsExport:cpSolver1 operate when you run the simulation. If a scene has two or more solvers, only one can operate at a time during a local simulation. Selecting the pants specifies which solver operates. (You need to do this even if one of the solvers is not connected.)
5
Select Simulation > Start Simulation.
6
Press Esc when you are satisfied with the pants.
Transfer the pants to the shirt’s solver For the shirt to drape over the pants and not just jackie, both garments need to be connected to the same solver. To do this, you’ll transfer the pants to the shirt’s solver. Be aware that if two garments do not touch and you do not expect them to touch during an animation, they don’t need to share a solver. 1
Select Simulation > Solvers > shirtExport:cpSolver1. This makes the shirt’s solver current.
2
With the pants selected, select Simulation > Transfer Garment. This transfers the pants to the shirt’s solver. To confirm that the pants are controlled by the shirt solver, check that shirtExport:cpSolver1 is displayed in the INPUTS section of the Channel Box.
3
In the Command Line, enter:.
INSTANT MAYA UNLIMITED 52
CLOTH | 2 Exporting & Importing Garments
delete pantsExport:cpSolver1
This deletes the pants solver, which is no longer needed.
Add mesh constraints To prevent the pants from sliding down as jackie walks, you’ll use mesh constraints to hold the pants on jackie’s waist. This works like a belt. 1
Select jackie and select Display > Object Display > Template.
2
Press the right mouse button over the pants and select Vertex.
3
Select the top row of vertices on the pants. Use Shiftselect to add vertices to the selection (or to remove vertices).
4
In the Outliner, Ctrl-click jackie. This adds jackie to the selection without deselecting the vertices.
5
Select Constraints >Mesh to create the mesh constraints. Mesh constraint icons appear on the pants, showing where the pants are constrained to jackie.
6
Hide the mesh constraints. Because the mesh constraints are currently selected, you can hide them by pressing Ctrl-h. In case you want to display the constraints later, be aware that the mesh constraints are indented under pantsExport:pants.
Adjust the shirt Next, you’ll have Maya drape the shirt over the pants without interpenetration. 1
Untemplate jackie.
2
Show (unhide) the shirt. Notice the pants poking through the shirt.
INSTANT MAYA UNLIMITED 53
CLOTH | 2 Exporting & Importing Garments
3
Hide jackie to reduce screen clutter.
4
Template the pants so you can’t pick any of its vertices.
5
With the pointer over the shirt, press the right mouse button and select Vertex.
6
Select all vertices that overlap the pants and additionally a small band of nonoverlapping vertices above the pants. If you can’t see the overlapping region clearly, press 4 for wireframe display, then dolly into the view.
Move vertices outward
7
Use the Move and Scale tools to move the vertices away from the pants with plenty of clearance. Avoid creating sharp edges on the surface of the shirt.
8
Select the shirt and select Simulation > Update Cloth State. This updates the solver with the new positions of the vertices. This is essential for the next simulation to work correctly.
9
Select Simulation > Properties > shirtExport:cpPropertyShirt ❒. Enter a Thickness of 1.5 and a Thickness Force of 3.5. The Thickness specifies the collision offset of the cloth when it collides with itself and other cloth objects. Thickness Force sets how much force Maya uses to maintain the Thickness collision offset during cloth-to-cloth collisions. The default values for Thickness and Thickness Force are 0.2 and 1. The higher values you use in this step help keep the shirt further away from the pants when you run the simulation.
10 Show jackie and untemplate the pants. 11 With the shirt selected, select Simulation > Start Simulation. If you are using Maya on UNIX, press Esc when you are satisfied with the shirt’s appearance. If you are using a Windows workstation, select Simulation > Stop Simulation rather than press the Esc key. After the simulation, if the shirt is in a position where it penetrates the pants, select Edit > Undo to return the shirt to its previous position. In the area where the shirt moved under the pants, move the vertices further away from the pants. Then select the shirt, Simulation > Update Cloth State, and Simulation > Start Simulation.
INSTANT MAYA UNLIMITED 54
CLOTH | 2 Exporting & Importing Garments
Run the simulation from dress-up pose to start of walk cycle In the next steps, you’ll run the simulation from the dress-up pose to the beginning of the walk cycle. You do this to create a natural look for the pants and shirt at the beginning of the walk cycle. Later, you’ll run the simulation for the walk cycle. 1
In the Time Slider, set the end time to 1 and make sure the start time is -20.
2
Select Simulation > Solvers > shirtExport:cpSolver1 ❒. Set the following attributes: Start Frame: -20 Frame Samples: 2 Relax Frame Length: 0 The Frame Samples value sets how often the solver does cloth calculations during the simulation. Higher values increase precision but with longer processing. By default, a simulation is a two-part process. First, the solver fits the garments to the character without the effect of gravity. Second, it fits the garments with the addition of gravity. The Relax Frame Length value specifies the length of time that Maya fits the garment to jackie before gravity’s effect begins. Generally, the larger the number of frames, the closer the fit. Because the gravity alone will fit a shirt to the character suitably, you set the Relax Frame Length to 0.
3
Walk cycle start pose
Select the shirt. Select Simulation >Delete Cache. Whenever you change cloth properties or other attributes that affect the garment, you must delete the cache before you run the simulation. Otherwise the results of the simulation won’t reflect your changes.
4
Select Window > Settings/Preferences > Preferences. Click the Timeline category. Set Looping to Once. With Looping set to Once, Maya doesn’t needlessly play the animation after you run the simulation.
INSTANT MAYA UNLIMITED 55
CLOTH | 2 Exporting & Importing Garments
5
Go to the start of the playback range and play the animation. Playing the animation runs the simulation from frame -20 to 1. At frame 1, the shirt and pants lie naturally on jackie at the beginning of the walk cycle.
Save the initial state of the garments In the preceding steps, you created the desired look of the pants and shirt at the start of the walk cycle. In the next steps, you’ll save the current positioning of the pants and shirt as their position at the start time of the animation. 1
Select the shirt.
2
Select Simulation > Save as Initial Cloth State.
3
Select the pants.
4
Select Simulation > Save as Initial Cloth State.
Run the simulation for the walk cycle Now you’ll run the simulation for the walk cycle. 1
Set the Time Slider’s start and end times to 1 and 118. This is the frame range where you’ll run the simulation.
2
Select shirtExport:cpSolver1 and set the Start Frame to 1. This value specifies the frame at which the solver starts the simulation during playback.
3
Select Simulation > Delete Cache.
4
Play the animation. This runs the simulation for the walk cycle. After the simulation runs, the cloth’s motion is cached, so you can scrub the Time Slider to evaluate the look of the cloth at various frames. Playback is also faster. If you decide to simulate again with different attribute settings, you must first delete the cache. Otherwise, scrubbing and playback will use the cloth motion from the prior simulation. Note that when you cache a cloth simulation, the directory where the scene exists will contain a file with the extension .mcc, for example, pantsFinal.mcc. This file contains the caching information for the scene. If you no longer use the cache for a scene, you can delete the file.
INSTANT MAYA UNLIMITED 56
CLOTH | 2 Exporting & Importing Garments
Eliminate interpenetration If you examine the garments closely at various frames, you might see spots where jackie penetrates the pants or where the pants penetrate the shirt. Eliminating the problem requires experimentation. Try one of the following solutions, then select Simulation > Delete Cache and play the animation. If the interpenetration problem persists, try another solution, delete the cache, and play the animation again.
Solutions •
Select jackie and increase the Collision Offset a small amount, for instance, from 0.16 to 0.17.
•
For interpenetration between the pants and shirt, select Select Simulation > Properties > shirtExport:cpPropertyShirt ❒. Increase the Thickness and Thickness Force a small amount. For example, change Thickness from 1.5 to 1.6, and change Thickness Force from 3.5 to 3.7.
•
Select the garment that has been penetrated. In the Attribute Editor, click the garment’s cpStitcher tab. Increase the Base Resolution a small amount, for instance, from 300 to 330, and make sure Fit To Surface is turned on. Increasing the Base Resolution slows the simulation considerably. As a quick fix to a few frames before rendering, you can drag vertices of a garment into a satisfactory position and simply render the offending frames.
Beyond the lesson In this lesson, you ran the simulation once for the transition from the dressup pose to the start of the walk cycle, and once for the walk cycle. The reason you split the simulation into two parts was to avoid repeating simulation of completed frames needlessly. Your goal for running a simulation up to the start of the walk cycle is to have the shirt and pants look natural in their initial position where the character begins the walk cycle. After you’ve accomplish this, there’s no need to simulate the prior frames again. When you run the simulation for the walk cycle, you typically need to experiment with various attribute values and run the simulation several times.
Other cloth features Using Maya: Cloth explains other features. For instance, you can: •
Use the mouse to paint cloth stiffness, wrinkling, and other effects. INSTANT MAYA UNLIMITED 57
CLOTH | 2 Exporting & Importing Garments
•
Use constraints and dynamic fields to influence the way the garment drapes on the character. For example, you can pull out wrinkles or you can pin portions of the garment to places on the character.
•
Set various attributes to create different types of fabric that affect the behavior of the garment.
•
Use different fabrics in the same garment, such as a baseball jacket with leather sleeves.
•
Attach subassemblies such as collars.
Using stationary cloth In some scenes, you might want to use a cloth object that doesn’t change position or shape during playback. For example, you might want to include an unmoving tablecloth. To create stationary cloth, you need to: 1
Run the simulation and stop it when the cloth has the desired shape.
2
Save the current shape as the initial cloth shape.
3
You can do either of the following:
•
Delete the cache. Select the appropriate solver and set its Start Frame attribute higher than the scene’s time range. This prevents simulation during subsequent playback. If you don’t do this step, the cloth changes shape a bit as the simulation runs.
or •
Export the cloth object with History turned off, and import it into the desired scene.
4
To practice creating a stationary tablecloth on your own, use the scene UnlimitedLessonData/Cloth/scenes/tableClothStart.mb. You can open the scene from the Maya 4 Documentation and Lessons CD or from the drive where you copied the Instant Maya data files. This scene has a table and a group of four curves you can use to make the tablecloth. The four curves are connected as a square above the table. Though garments such as shirts and pants need many panels seamed together, a simple garment such as a tablecloth needs only one panel.
INSTANT MAYA UNLIMITED 58
CLOTH | 2 Exporting & Importing Garments
The scene also includes a material named tableClothMtl that you can assign to the cloth for a more realistic display.
INSTANT MAYA UNLIMITED 59
CLOTH | 2 Exporting & Importing Garments
INSTANT MAYA UNLIMITED 60
3
FUR With the Fur feature, you can create fur and short hair on NURBS and polygonal surfaces. You can set fur attributes such as color, width, length, baldness, opacity, curl, and direction for entire surfaces or specific regions. To bring fur to life, you can keyframe effects like growing fur or changing color. For a more natural appearance, you can also add movement to fur with keyframes and dynamics, for example, wind and gravity. This chapter has the following topics: •
“Preparing for the lesson” on page 59
•
“Lesson: Applying fur to a surface” on page 60
PREPARING FOR THE LESSON To ensure the lesson works as described, do these steps before beginning: 1
Create a new scene.
2
Select the Rendering menu set. Unless otherwise noted, the directions in this chapter for making menu selections assume you’ve already selected the Rendering menu set.
3
If you don’t see a Fur menu next to the Paint Effects menu, do these additional steps:
•
Select Window > Settings/Preferences > Plug-in Manager.
•
In the Plug-in Manager, locate the Fur plug-in and turn on the loaded checkbox. Wait for the check mark to appear in the checkbox, then close the Plug-in Manager. Notice that Maya added the Fur menu next to the Paint Effects menu.
INSTANT MAYA UNLIMITED 59
FUR | 3 Lesson: Applying fur to a surface
LESSON: APPLYING FUR TO A SURFACE In this lesson, you’ll learn essential Fur features by making a fuzzy ball:
Add a light and create a sphere You begin the lesson by creating a light, a sphere, and a gold material for the sphere. Later in the lesson, you’ll apply fur to the sphere. 1
Select Create > Lights > Directional Light. Enter -50 for the light’s Rotate X value, and 20 for its Rotate Y value. Move the light far away from the center of the grid so that it’s easy to select after you add a sphere there. A directional light’s orientation, not position, affects the aim of the lighting.
2
Select Lighting > Use All Lights so that the scene is lit by the directional light rather than the default light. The directional light will display the fur more clearly than the default light.
3
Create a polygonal sphere with a radius of 8. Name it Ball.
4
To display the Ball with smooth shading, select Shading > Smooth Shade All.
5
Right-click the Ball and select Materials > Assign New Material > Lambert from the marking menu.
6
Click the Color box to display the Color Chooser, choose a gold color, then click the Accept button. Close the Attribute Editor.
INSTANT MAYA UNLIMITED 60
FUR | 3 Lesson: Applying fur to a surface
Create fur on the surface and modify the fur attributes The next steps show how to attach fur and edit the fur attributes. 1
With Ball selected, select Fur > Attach Fur Description > New. This attaches a new default fur description to the selected surface. A fur description defines all the attributes for the fur, for example, fur color, width, length, baldness, opacity, curl, density, and so on. The spikes are known as the fur feedback—a rough approximation of how the fur will look when rendered.
2
In the scene view, click a spike to select the fur feedback node. (Select a spike at the perimeter of sphere so you don’t unintentionally select the sphere also.)
3
In the INPUTS section of the Channel Box, select FurDescription1. Rename FurDescription1 as ballFurDescription. This gives the fur description a name that’s easier to remember than the default name. Enter these attribute values: Length: 3 Inclination: 0.4 Scraggle: 0.4 Polar: 0.75
INSTANT MAYA UNLIMITED 61
FUR | 3 Lesson: Applying fur to a surface
Length sets the fur’s length, in grid units. Scraggle sets the crookedness of the fur. A value of 0 creates no crookedness, while 1 creates maximum crookedness. Inclination sets how the fur slopes or leans. A value of 0 is fully erect (normal to the surface), while 1 is flat (tangent to the surface at the root). Polar sets how much the fur is rotated about the surface normal. 0 creates -180 degree rotation, 0.5 creates no rotation, and 1 creates 180 degree rotation. 4
In the SHAPES section of the Channel Box, set the Fur Accuracy to 1. Fur Accuracy sets how closely the fur’s display in the scene view resembles the fur when rendered. A value of 1 displays best accuracy, 0 least accuracy. With a value of 1, you can see the effect of scraggle and curl without having to render. High values slow Maya operation speed.
5
To edit the fur description attributes, select Fur > Edit Fur Description > ballFurDescription.
6
Set the Base Color and Tip Color by clicking each color box and selecting the color from the Color Chooser. For example, choose a yellow-gold for the Base Color and a orange-gold for the Tip Color.
7
Enter 0.75 for Tip Opacity and 0.01 for Tip Width. Tip Opacity sets the transparency of the ends of the hair. A value of 0 is transparent, while 1 is completely opaque. Tip Width sets the width of each hair at the tip.
8
To have the fur’s color in the scene view approximate the fur when rendered, select one of the spikes to select the fur feedback node. In the SHAPES section of the Channel Box, enter on for Color Feedback Enable.
INSTANT MAYA UNLIMITED 62
FUR | 3 Lesson: Applying fur to a surface
Render the scene and refine attribute settings To see the fur in full detail, you need to render the scene. 1
Select Window > Rendering Editors > Render Globals. Expand the Resolution section of the Render Globals window, then select 640x480 for Presets. When you test render the scene, the resulting image size (640 by 480) will be large enough to see fine detail.
2
Select Render > Render Current Frame.
The fur looks too sparse. Fortunately, only a few easy steps are necessary to increase the fur density. 3
Select a spike that represents the fur.
INSTANT MAYA UNLIMITED 63
FUR | 3 Lesson: Applying fur to a surface
4
In the INPUTS section of the Channel Box, click ballFurDescription.
5
Enter 30000 for Density. This specifies the number of hairs on the surface. The higher the value, the thicker the fuzz.
6
In the Render View window, select Render > Redo Previous Render.
7
Experiment with other attribute values and use Render > Redo Previous Render as necessary.
Beyond the lesson Before exploring how to apply the lesson, it’s worthwhile to review the general steps of using fur: •
Create the desired lights.
•
Attach a fur description to the surface.
•
Modify fur attributes.
•
Animate fur attributes (optional, not shown in this lesson).
•
Add movement to fur (optional, not shown in this lesson).
•
Set up fur shading effects (optional, not shown in this lesson).
•
Render the scene.
•
Refine attribute settings and render again. In the lesson, you attached a new fur description to a single selected surface. You can also attach a fur description to multiple selected surfaces, for instance, a cat’s body, legs, and head.
INSTANT MAYA UNLIMITED 64
FUR | 3 Lesson: Applying fur to a surface
Though not covered in the lesson, it’s often useful to alter the fur attributes using the Paint Fur Attributes Tool. With this tool, you paint values for fur attributes on a specific region. For example, you can paint length values on part of a surface to make the painted patch of fur longer than the rest of the fur. With this tool, you can even paint the direction of the fur as if you are using a comb. You can also attach more than one fur description to a surface. For example, you can add an additional fur description to a surface around a cat’s nose for its whiskers. Though not included in the lesson, you can keyframe changes you make to fur attributes to animate effects such as growing fur or changing fur color. You can add movement to fur with attractors and dynamics. Using attractors, you manually keyframe fur movement. Using dynamics, you make the fur react to forces, for example, wind and gravity. You can also use dynamics to cause fur to react to movement of the attached surface, for example, as occurs when a dog shakes its hair. Finally, you can create fur shadowing effects by adding and setting fur light attributes on the lights in your scene.
INSTANT MAYA UNLIMITED 65
FUR | 3 Lesson: Applying fur to a surface
INSTANT MAYA UNLIMITED 66
4
LIVE Live simplifies match moving—where you match the camera or object movement of a live-action shot. This chapter includes the following lessons: •
“Lesson 1: Track and solve” on page 72
•
“Lesson 2: Solving with survey data” on page 91
UNDERSTANDING LIVE Suppose you must replace a live-action fence with a fence modeled in Maya. In the live-action shot, the camera sweeps around the fence. You can use Live to animate a Maya camera that sweeps around your modeled fence in the same way. When you render the Maya fence from this camera, it will have the same camera perspective as the live-action fence. You can therefore composite them together precisely.
Live-action shot of fence
Matching Maya camera view and modeled fence
INSTANT MAYA UNLIMITED 67
LIVE | 4 Understanding Live
Live can also match the movement of objects in the live-action shot. Suppose you want to replace the hat of a moving, live-action person with a cartoon hat created in Maya. You can use Live to create 3D locators that follow the movement of certain points on the live-action hat. You then attach a hat created in Maya to these moving points, so that the rendered Maya hat follows the movements of the live-action person. The steps for matching object movement are about the same as matching the camera. To use Live, you do the following major tasks in order:
Setup You begin by loading digital images of the live-action shot. In this lesson, you’ll use images scanned from film footage. Images appear on an image plane. This plane is part of the Maya camera. It displays images as part of a background.
Track In this task, you mark a variety of points within the images, such as the center of a flower or a mark on the fence, and have Maya track how they change position from frame to frame.
INSTANT MAYA UNLIMITED 68
LIVE | 4 Understanding Live
Solve In this task, you run a solver program that computes an animated camera, based on the movement of the track points.
Fine Tune This is an optional task where you can make frame-by-frame adjustments to the camera position. (This task is rarely used and is not covered by this lesson.)
INSTANT MAYA UNLIMITED 69
LIVE | 4 Preparing for the lessons
PREPARING FOR THE LESSONS In the following lessons, you will create a match move for live footage of a sweeping shot of a backyard and fence. In the second lesson, you will load a fence created in Maya to evaluate how well the Maya camera movement matches the live-action camera. To ensure the lesson works as described, do these steps before beginning: 1
Make sure you understand the basic usage of the animation playback controls. See the chapter entitled “Animation” in Instant Maya to learn about these controls.
2
Select Window > Settings/Preferences > Preferences. Click the Timeline category under Settings and make sure the Playback Speed is set to Play every frame. Animation plays more accurately with this setting.
3
Locate the Live lesson data on the Maya 4 Documentation and Lessons CD. It exists on the CD in this location: UnlimitedLessonData/Live
You can work from the CD directly or copy the directory to the local work area of your choice. If you copy the directory, you need about 300 Mbytes of free disk space. 4
If Live doesn’t appear in the menu set selection menu, select Window > Settings/Preferences > Plug-in Manager. In the Plug-in Manager, locate mayalive.so (UNIX) or mayaLive.mll (Windows) and click the loaded checkbox. Wait about 20 seconds for the operation to finish, then close the Plug-in Manager.
5
Select the Live menu set. All instructions in this lesson assume you have the Live menu set selected.
6
Choose Scene > New Matchmove. When you create a new matchmove scene, Live places the Setup control panel at the bottom of the standard Maya window. There are different control panels for each of the main tasks: Setup, Track, Solve, and Fine Tune. The control panel is where you control most of the Live operations.
INSTANT MAYA UNLIMITED 70
LIVE | 4 Preparing for the lessons
Setup control panel
Also notice Live creates a camera and an image plane in your scene. This is the camera Live animates. The image plane serves as the background plate when you look through the camera. It is where the images for the live shot will appear once you’ve loaded them.
Load and set up the images You begin the lesson by loading digital images of a live-action sequence. You’ll work with images we created for your use. 1
In the Setup control panel, click the Browse button next to the Full Res Image box.
2
Navigate to the UnlimitedLessonData/Live directory and select any image file from the list, such as shot1BG.rgb.0001.
3
Click the Open button. Live loads the entire image sequence, from shot1BG.rgb.0001 to shot1BG.rgb.0240.
INSTANT MAYA UNLIMITED 71
LIVE | 4 Track and solve
4
From the Predefined Filmbacks list (on the Setup control panel), choose 35mm Full Aperture. Filmback is the aspect ratio (width/height) of the exposed film negative used during filming. Before using Live, you need to find out which filmback was used during filming. Without it, Live cannot determine the correct angle of view (camera aperture) and focal length.
Note If the images do not appear on the image plane, you may need to adjust the image cache settings. Click the Cache option on the far left to display the cache settings. Set Texture Method to Image. If the images still do not appear, try selecting None.
LESSON 1: TRACK AND SOLVE This lesson guides you through the main tasks in Live: tracking and solving. Tracking provides Live with information about the way objects in the shot appear to move. Just as objects move in your field of view when you walk by them, the way objects move in the camera view gives Live information on how the camera moved during filming. You’ll track points for various spots, such as a mark on the fence. To track a point, you mark each spot in the image and have Live run a tracker that automatically follows the point’s movement from frame to frame. The result is called a track point. Later, in the solve task, Live will animate a Maya camera based on the track point movement.
INSTANT MAYA UNLIMITED 72
LIVE | 4 Track and solve
Review the shot and plan tracking Which spots should you track? To answer this question, do these steps: 1
Open the Track control panel by clicking the menu on the far left of the control panel and choosing Track. Pull-down menu
Above the Track control panel, Live displays preset view panels. The view panels match the needs of tracking. The following illustration labels these panels, shown the way they might look at the end of the lesson. pointCentered view
shotCamera view Track Summary
Track control panel
2
Play the shot and watch it in the shotCamera view panel. Don’t worry if the playback seems jerky, because you are only getting a rough look at how the camera moves. In fact, you can skip through the frames quickly by dragging in the Time Slider.
INSTANT MAYA UNLIMITED 73
LIVE | 4 Track and solve
Note Playing shots can be slow because the images require a lot of memory. To speed up playback, Live has settings for creating an image cache (Setup Cache control panel). Image cache is an allocation of system memory dedicated to storage and retrieval of images so that they play back faster. For this lesson, the default image cache settings usually suffice. The following figure gives recommendations on which points to track (you will have a total of 15 in the end). You will track two of the points and import the other points from a prepared file.
Points far from the camera
Points visible for a long duration and in the area where the replacement fence model will be
Points close to the camera and spread across the film set
Start tracking a flower In the next steps, you will track the motion of a flower. Tracking points on the ground is common practice and the flowers are easy targets to track. 1
Go to frame 1.
2
Click the Create button in the Track control panel. Live places a track box in the center of the shotCamera view, ready for you to reposition. If you don’t see a full-color image of the scene in the view, go one frame forward in the Time Slider and go back to the start time to refresh the view.
INSTANT MAYA UNLIMITED 74
LIVE | 4 Track and solve
3
Before you reposition the track box, enter flower1 in the Name box in the Track control panel. We recommend you name track points for future reference.
4
In the Track control panel, click the track box tool so you can reposition the track box.
Track box tool
If you switch to another tool, such as rotate, remember to select the track box tool again if you thereafter need to move track boxes. 5
In the shotCamera view, drag the track box down to the fourth clump of flowers from the right.
Fourth clump of flowers from the right
This pair of flowers is good to track because it is visible in all frames. Strive to track points that are visible for a large number of frames.
INSTANT MAYA UNLIMITED 75
LIVE | 4 Track and solve
6
In the pointCenteredCamera view, drag the image until the track box crosshair is centered over the flower closest to the fence. Dragging in this panel has the opposite effect from the shotCamera view, because you are actually panning the camera, not moving the track box. Fence
Flower
Notice that the track box resizes if you drag the edges. For this track point, keep the boxes at the default size. Choose Edit > Undo if you resize it accidentally. The point you are tracking is at the center of the track box cross-hair. To track this point, Live uses the pattern of pixels defined by the inner box. The outer box is the range Live searches for the target pattern.
Cross-hair defines the target point The inner box defines the pixel pattern Live matches The outer box defines the range Live searches for the target pattern
7
Make sure Tracking Direction is set to Forward. During the course of creating track points, you will change this setting often. Depending on the situation, you might track Forward, Backward, or Bidirectional.
8
Click the Start Track button. First a progress dialog box appears, then a movie of the track point. These point-centered movies are important tools for evaluating how closely the track point stays on target (see the following steps).
INSTANT MAYA UNLIMITED 76
LIVE | 4 Track and solve
Progress window
Movieplayer
Evaluate the flower1 track Making sure the track point stays on target will help later when you solve. Don’t worry if the connection between tracking and solving is not clear yet. For now, simply identify major tracking errors by following these steps: 1
Review the movie file that Live generates at the end of tracking. Identify any areas where the cross-hair slips noticeably from the original position on the flower. This takes some judgment. Since the flower changes shape over time, you must visualize where the original point would be as the camera perspective changes. If the cross-hair appears to stay within two pixels of the original target point, you have tracked the flower successfully. If the cross-hair moves completely off the flower or the tracking stops before it reaches the last frame, you must track again. Delete the track point (click Delete in the Track control panel), return to frame 1, position the track box cross hair exactly in the center of the flower closest to the fence, and click Start Track.
2
Close the Movieplayer window.
INSTANT MAYA UNLIMITED 77
LIVE | 4 Track and solve
3
Look at the graph in the Track Summary panel. This graph shows how closely Live matched the track box’s pixel pattern on each frame. Specifically, Live compares each frame and the frame before it to see how well they match. Green is a good match, yellow is a warning, and red is a stronger warning.
As illustrated, the green region drops over time, leaving the graph mostly yellow toward the end. This is a normal occurrence, caused by the changing pixel pattern of the point you tracked. In this case, you can ignore the yellow color, because the main evaluation tool—the movie file—indicates the track is on target.
Note The curvy blue (or red) line next to the track point is a trace line. It is an optional tracking feature you will not use in this lesson.
Track a fence corner Now that you’ve tracked one point successfully, you’ll continue with tracking a different spot in the image sequence. In general, you keep tracking points until you have enough to solve. (You will learn how to make this determination later in the lesson.) The point you are about to track demonstrates what to do if the spot falls out of view midway in the shot. 1
Go to frame 1.
2
Click Create and drag the track box over the bottom corner of the far right fence post. If you have trouble dragging the track box, click the track box tool again:
INSTANT MAYA UNLIMITED 78
LIVE | 4 Track and solve
Fence corner
3
In the PointCenteredCamera view, position the track box to match the following illustration.
Knowing where to position the track box involves two important factors. One factor is the pattern framed by the inner target box. This pattern must have at least some contrast and must be distinct from the surrounding region that is framed by the outer box. By having a distinct pattern within the inner target, you will prevent the tracker from jumping off target and onto a similar pattern. Another important factor is where you place the cross-hair. You want it to be over a spot that you can recognize in later frames when the pattern changes. By aligning the vertical cross-hair line with the post edge and the horizontal cross-hair line with the bottom of the post, you can identify this same spot in later frames. 4
Enter fenceCorner in the Name setting.
INSTANT MAYA UNLIMITED 79
LIVE | 4 Track and solve
5
Click Start Track. The tracker stops around frame 60 or 80 because the corner falls out of view. The track box also moves off target toward the end. You will correct both of these tracking problems in the next steps.
Delete tracking and track the end of fenceCorner Because the fence corner disappears from view in the middle of the shot, you need to skip several frames and track from where it reappears. First, you need to remove the bad tracking data where the track box moves off target. 1
To delete the bad tracking at the end, you use the Track Summary panel (the panel below the pointCenteredCamera view). To see fenceCorner’s tracking graph better, click the Track Summary panel and tap the space bar.
2
You need to select and remove the tracking data after frame 52—the last frame still on track. To identify this frame in the graph, move to frame 52 in the Time Slider. In the Track Summary panel, a black bar shows the location of frame 52.
3
In the Track Summary panel, draw a selection box from right to left around the end of fenceCorner’s graph. Do not select beyond the black bar that indicates frame 52. Also, be careful to select only the frames for fenceCorner, not flower1.
4
In the Track Summary panel, choose Edit > Delete Region. Live removes the bad tracking data from fenceCorner. Deleting regions where the track is off target is crucial to successfully solving your shots. Whenever you find difficulty tracking a point for a specific segment of frames, consider deleting the tracking data.
5
Tap the space bar to shrink the Track Summary panel.
6
Move to frame 143, where the fence corner reappears in view. In the following steps, you will continue to track from this frame to the end of the shot.
INSTANT MAYA UNLIMITED 80
LIVE | 4 Track and solve
You’ll skip tracking a large amount of frames for the fenceCorner point (the ones in the middle of the graph), which is common practice when creating track points. In general, track as many frames as possible for each point and skip, retrack, or delete any frames where the tracker does not stay on target. 7
Reposition the track box over the fence corner. In the pointCenteredCamera view, align the vertical cross-hair line with the edge of the fence post and the horizontal cross-hair line with the bottom of the post.
8
Shorten the track box’s inner target box by clicking the inner target box’s bottom edge and dragging up as shown below. The tracker will not work if the target area extends beyond the image.
9
In the Track control panel, click Start Track. If the tracker successfully tracks to the last frame, you’ll see a graph similar to the following illustration. (The second track area will be mostly green or all green in the Track Summary.)
INSTANT MAYA UNLIMITED 81
LIVE | 4 Track and solve
If the tracker fails to create a graph similar to the above illustration, three actions might have occurred: •
The tracker stays stuck at the same frame and the animation frame doesn’t advance
•
The tracker stops before the final frame
•
The tracker drifts off target Whichever of these actions occurred, repeat the previous step, but this time shorten the track box’s inner target box.
Import other track points To reduce the repetition of tracking many more points, you’ll import additional track points for the scene from a file we created for your use in this lesson. 1
Choose Track > Import Tracked Points.
2
Navigate to the UnlimitedLessonData/Live/points directory and open fence_1.txt. This imports the track point data for seven more points. (The track data was created using the Track > Export Tracked Points operation.) Ordinarily, you will not need to use the export and import operations; they are intended for situations where you start over with a new scene but want to retain track information.
INSTANT MAYA UNLIMITED 82
LIVE | 4 Track and solve
Decide if you are ready to solve Are there enough track points for you to solve the camera movement? Follow these instructions to see how you make this decision. 1
In the Track Summary panel, choose View > Frame All.
2
For each frame, make sure there are at least four points with graphed tracked data. Experience has shown that four points is the minimum average you need to solve a shot. In the middle frames, such as frame 135, there is less track data. However, on this frame and all frames in the middle, there are at least four.
3
Look for large areas of red in each track point’s graph. Small areas of red are okay. A track point’s graph does not have to be completely green in order to solve. In general, if you do find a large area of red for a point, either retrack over the region or select it in the Track Summary graph and choose Edit > Delete Region.
4
As a preventive measure, look for blue tick marks in the graphs for flower1 and fenceCorner—the track points you created. A blue tick mark indicates you moved the track box for that frame. You may have moved it accidentally—for example, if you clicked on the track box to select it. Click on the blue tick mark to go to that frame. Then, in the pointCenteredCamera view, compare the frames next to this frame. A shift as small as one pixel can cause problems when you solve. If you see a sudden shift between the frames, go to that region in the Track Summary graph, select two or three frames (you can simply estimate), and choose Edit > Delete Region.
INSTANT MAYA UNLIMITED 83
LIVE | 4 Track and solve
5
Look at the Ready to Solve bar at the bottom of the Track Summary. It’s mostly green and yellow, with little red. The red area is mostly in the middle because there is less track data there. However, since you meet the minimum number of points, it’s worth trying to solve. You can always add more track points later.
Solve the shot The solver is the part of Live that animates a Maya camera. You rarely obtain a correct solution the first time you run the solver. You will need to evaluate the solution and make improvements to the track data until the solver can create a correct solution. 1
Open the Solve control panel by clicking the control panel menu on the far left and choosing Solve. The Solve control panel has a different arrangement of view panels than the ones you used for tracking. You will learn about these other panels as you continue with the lesson.
Perspective view
shotCamera view
Locator Summary
Graph Editor
Solve control panel
INSTANT MAYA UNLIMITED 84
LIVE | 4 Track and solve
2
In the Solve control panel, click the Solve button to begin the solve process. This process will take several minutes to complete. (You do not need to go to frame 1 when you solve; Live solves for all frames by default.) Notice the column of buttons next to the Solve button, with Start at the top and Register at the bottom. These buttons run the solver in stages—the same stages that it performs when you click Solve. Running the solver in stages is only for advanced use; you can ignore these buttons for now. When the solver finishes, the solution, called solution_rf, appears in the solution list on the Solve control panel. Because you will run the solver several times, Live keeps a list of each solve attempt. A solution consists of an animated camera and locators, which appear as crossed lines in the perspective view. Locators are marks in the world space that you can use as reference points when modeling. Each locator corresponds to a track point and has the same name, plus the suffix “_3D,” such as fenceCorner_3D. The following illustration shows an example solution with these parts labeled. Note that images do not appear on the image plane in the perspective view because this view is in wireframe mode.
Solved camera
Locators
Image plane
INSTANT MAYA UNLIMITED 85
LIVE | 4 Track and solve
Evaluate the solution Now you must determine if the solution correctly matches the camera movement. If correct, the solution locators will be arranged like the points from the actual film set. For example, the points along the fence should be aligned along a plane. Also, Maya’s camera will move around the locators in a way similar to the real camera movement. 1
Check the Overall Pixel Slip in the Solve control panel. The Overall Pixel Slip is a general indicator of the solution’s accuracy. Overall means it is an average for all points on all frames. Pixel slip measures how well each 3D locator matches with the track point in the background— as viewed through the solved camera. For example, if flower1 and flower1_3D appear separated by one pixel on all frames, the pixel slip is 1.0. The lower the pixel slip, the more accurate the solution. Ideally, Overall Pixel Slip should be less than 2. But this doesn’t mean the solution will mimic the live footage camera movement satisfactorily. In the next steps, you’ll find out whether it does. If Overall Pixel Slip reads “poor” or a number higher than 2, you need to fix a problem in your track points. Return to the Track control panel and repeat the instructions “Decide if you are ready to solve” on page 83. In particular, do step 4. Then solve again. If you still cannot reach a solution below 2, we recommend you continue the lesson using a scene we have prepared for you. Choose File > Open Scene, navigate to the UnlimitedLessonData/Live/scenes directory, and double-click goodPoints.mb. Live loads a scene with the same track points, carefully created to avoid problems. When you click Solve in the goodPoints scene, your Overall Pixel Slip will read about 1.0.
2
Play the animation and tumble the perspective view while the animation plays so you can see how the camera moves. You need to judge whether the camera moves the way you expect. You know the camera starts above the set and moves down, so it should start above the locators and sweep down in the same way. Compare the frames in the following illustration.
INSTANT MAYA UNLIMITED 86
LIVE | 4 Track and solve
Frame 1
Frame 100
In this case, the camera starts below the locators and moves up instead of down. It also makes a series of abrupt movements. This solution is incorrect. 3
Stop playing the animation.
4
For further evaluation, examine the graphs in the panel on the lower left. This is the Locator Summary. The Locator Summary graphs the pixel slip of each point over time. You already looked at the overall pixel slip, but the Locator Summary lets you find which point has the most pixel slip and on which frames.
If one point had a very red and yellow graph, you could conclude that the point was the source of the problem solution. In this case, many points have red and yellow areas, but those areas appear mainly in the first 100 frames. Because red and yellow areas all occur within the first 100 frames, you can conclude that the solver does not have enough information for those frames. To improve the information, you’ll need to add one or more track points for those frames.
INSTANT MAYA UNLIMITED 87
LIVE | 4 Track and solve
How many points you’ll need is not important to fixing this problem. Rather, choosing the right points is what will help the solver. In the following steps, you’ll load another set of points into your scene. These points will illustrate which types of points to choose.
Note The other panels in the layout are the Graph Editor and the shotCamera. The Graph Editor is for advanced used. It can be helpful for examining the camera animation curves so that you can pinpoint problem areas. The shotCamera panel is useful in later stages, after you have a correct solution. You can ignore both of these panels for now.
Solve again with more track points To help you improve the solution, we have created another set of track points for you to import. 1
Choose Track > Import Tracked Points.
2
Navigate to the UnlimitedLessonData/Live/points directory and double-click fence_2.txt. Live loads five more track points.
3
Click Solve. While the solver runs, examine the following illustration to learn about the points you just loaded and why they were chosen to improve the solution. Points far from the camera
Points spread across the film set
INSTANT MAYA UNLIMITED 88
LIVE | 4 Track and solve
In general, having a diversity of points, such as points far and near the camera, is critical to helping the solver. 4
When the solver finishes, solution_rf1 appears in the solution list. Check the Overall Pixel Slip in the Solve control panel. It reads about 0.322, so the new points have made an improvement. If you have a larger Overall Pixel Slip, the problem may be that initial1 was selected when you solved again. Try selecting solution_rf instead and clicking Solve again. The solution you have selected when you click Solve can affect the outcome of the solver.
5
Play the animation and watch in the perspective view. In this case, viewing from below the grid is best because the locators and camera are below the grid in this solution. You must ignore where Live has placed the camera and locators relative to the perspective grid. Only look at the arrangement of the locators and the movement of the camera. They should resemble the arrangement of points and the camera motion as seen in the shot. For example, notice the points along the fence are aligned along a plane, just as they are in the shot. If you compare frames 80 and 180, you’ll see that the camera now moves downward relative to the locators. This movement is what you would expect the camera to do for this shot. Frame 80
Frame 180
At this point, you can assume that your matchmove is complete and accurate. However, to be absolutely sure, you need to play the animation with a model placed in front of the camera. If the model does not appear to slip relative to the background, then your matchmove is accurate. To learn about this type of testing, continue with the next lesson. 6
If you plan to continue with the next lesson, we recommend you first save your scene into the current scenes directory.
INSTANT MAYA UNLIMITED 89
LIVE | 4 Track and solve
Beyond the lesson In this lesson you learned the Live workflow. However, we made numerous decisions for you regarding which points to track and how to improve the solution. With more practise, you will learn these decision-making skills. Also see Chapter 4, “Shot Strategy,” in the Live user guide for advice on making these decisions. In general, you can expect to run the solver several times to find a correct solution. Before each solve, make improvements by adding track points in a variety of places and by deleting regions from the track data if they are not accurate. Even if one track point is off alignment on one frame, it could result in an incorrect solution. Your solution has the correct camera movement, but you may wonder why the camera and locators are placed below the perspective view grid. If you want to control where the solution is placed within the scene, you need to give the solver more information, called survey constraints. Continue with the next lesson to learn more.
Exporting and rendering solutions With the camera movement solved, you can create your animation using the solved camera to make sure the animation does not move out of the camera view. If your animators use Maya Complete or another software product, you must export the camera solution from Live (Scene > Export Scene As). You can export to Maya Complete, Softimage 3D, or Discreet Logic’s Inferno and Flame. When you render the animation, we recommend you do so without the image plane background. A better workflow is to render the animation created in Maya separately and then use compositing software to combine it with the live footage background. However, if you do want to render the image plane, you must turn off the Use Cache option on the Setup control panel. The Use Cache option utilizes a Roto node, which does not render. By turning Use Cache off, Live switches to the standard Maya image plane, which is renderable.
INSTANT MAYA UNLIMITED 90
LIVE | 4 Solving with survey data
LESSON 2: SOLVING WITH SURVEY DATA This optional lesson is a continuation of the previous lesson. In this lesson, you’ll learn how to change the positioning of the camera and locators within the Maya scene. You typically need to do this so you can more easily model and animate objects you want to match up with the live shot. For example, the objective in this shot is to replace the filmed fence with a fence modeled in Maya. Suppose you had taken measurements of the fence from the film set and used the measurements to model a fence in Maya. The locators created by Live would not match the same scale that you used for the model. Also, the locators and camera Live created are not near the perspective view grid, which is a convenient reference for modeling and animating. To solve these issues, you can incorporate the measurements you surveyed from the set into the Live solver. You do this with the survey constraints feature. Even if you do not have survey measurements, you can use estimates to change the spacing between locators and their orientation within the Maya scene.
Create a Distance constraint Live has a variety of survey constraints. As your first example, you will create a Distance survey constraint. The Distance constraint defines the distance between two tracked points. Based on that one distance, the solver can establish the distances between all the locators. 1
Open the Live scene you created in the previous lesson.
2
In the Solve control panel, click the Survey option to open the survey constraint settings.
3
Choose Distance from the Constraint Type menu. Now you’ll need to specify two points that you want to constrain to a distance.
4
To help select the points, open the Outliner (Window > Outliner).
INSTANT MAYA UNLIMITED 91
LIVE | 4 Solving with survey data
5
Select the following track points in the Outliner under clip1TrackedPointVisibilityGroup > clip1TrackedPointGroup: fenceCorner tileInFront
6
In the Solve Survey control panel, click Create.
7
Enter 2 in the Distance setting. With this constraint, Live will force the locators for fenceCorner and tileInFront to be 2 units apart. Live does not incorporate the constraint until you run the solver again and create a new solution. You will do this later. This constraint is not based on a film set measurement; it is simply an estimate. Using estimates to control the space between locators is often useful, but be careful not to use too many estimates. Too many estimates can prevent the solver from finding a solution.
Create a Plane constraint for the ground In addition to the space between locators, you may want them to be repositioned within the scene. For example, you may want the flower locators in the solution to rest on top of the perspective view grid, just as the flowers in the shot rest on the ground. In the current solution, the flower locators rest below the grid.
A convenient way to bring points onto the grid is to use a Plane constraint, which aligns locators onto a plane. 1
Choose Plane from the Constraint Type menu.
INSTANT MAYA UNLIMITED 92
LIVE | 4 Solving with survey data
2
Select the following track points in the Outliner under clip1TrackedPointVisibilityGroup > clip1TrackedPointGroup: flower1 fenceCorner flower2 tileInFront In the shot, these points correspond to points on the ground.
3
Click Create. Live places the Plane constraint on the perspective view grid by default.
4
In the Solve Survey control panel, change the Name setting to ground. Because you will later create another Plane constraint, you should give this constraint a unique name.
Register the solution To incorporate your survey constraints, you could solve from scratch (click Solve). However, you do not need to. You already have an accurate solution; you only want to incorporate the survey constraints. For this reason, Live lets you run the last step of solving: Register. In this step, the solver applies survey constraints to the solution as a whole without changing the relative positions of locators and the camera. 1
Click the Solve option to switch back to the Solve settings.
2
Make sure solution_rf1 is selected from the solution list. This is the most accurate solution so far, so you want Live to apply the survey constraints to this solution.
3
Click the Register button.
INSTANT MAYA UNLIMITED 93
LIVE | 4 Solving with survey data
When the solver finishes, registered appears in the solution list. In the perspective view, you can see the flower, fence corner, and tile locators aligned with the grid.
If you dolly in the view, you’ll also see that the locators for the points you constrained by distance—fenceCorner and tileInFront—are now about two grid units apart.
Create a fence Plane constraint and register the solution A top view reveals an illogical placement of the fence locators. Instead of being aligned with the XY plane, they are at an angle. To correct this problem, you need another Plane constraint that represents the fence.
1
Click the Survey option to switch to the Survey settings.
INSTANT MAYA UNLIMITED 94
LIVE | 4 Solving with survey data
2
Make sure the Constraint Type is still set to Plane.
3
Select the following track points in the Outliner under clip1TrackedPointVisibilityGroup > clip1TrackedPointGroup: fenceCorner fenceX4 fenceX1 fenceRailSpot fencePostEdge fenceLeft1 fenceLeft2 These are the points that are on the front of the fence.
4
Click Create.
5
Change the Name setting to fence.
6
Rotate the fence plane by entering 90 in the Rotate X attribute in the Channel box. Because the real fence is at a 90 degree angle to the backyard ground, you must rotate the fence constraint the same way in Maya.
In this case, only the plane’s rotation matters, not where you move it. No matter where you move the fence Plane constraint, the fence points will remain on the grid because the solver must obey the ground constraint you created. The scale of the Plane constraint never matters because the solver treats it as infinitely large. 7
Switch to the Solve control panel, select registered from the solution list, and click the Register button. The solver creates registered1 with the fence points aligned with the XY plane.
INSTANT MAYA UNLIMITED 95
LIVE | 4 Solving with survey data
Evaluate the solution with imported geometry The best evaluation of your solution is to set an object in front of the solved camera and see if it matches the background as you play the animation. In this case, we will import a fence modeled in Maya.
Reorient the solution with fenceCorner at the origin Before you load the modeled fence, do the following steps to add one more survey constraint. You’ll add a Point constraint to orient the solution so fenceCorner is at the origin. You’ll need fenceCorner at the origin because the fence model has its corner at the origin and you want the two to match exactly. 1
Switch to the Survey settings.
2
Choose Points from the Constraint Type menu.
3
Select the following track point in the Outliner under clip1TrackedPointVisibilityGroup > clip1TrackedPointGroup: fenceCorner
4
Click Create. Maya creates a Point constraint in your scene, located at the origin (0,0,0) by default.
5
Switch to the Solve control panel, select registered1 from the solution list, and click the Register button. The solver creates registered2 with fenceCorner at the origin.
Import a modeled fence You will now import a fence that has been modeled to exactly match the fence that was filmed. 1
Choose File > Import.
INSTANT MAYA UNLIMITED 96
LIVE | 4 Solving with survey data
2
Navigate to the UnlimitedLessonData/Live/scenes directory in the Import browse window.
3
Double-click fenceModel.mb to import it.
Evaluate the solution 1
Hide the Plane constraints by selecting them and choosing Display > Hide > Hide Selection. By hiding them, you can see the fence better.
2
Enlarge the shotCamera view panel, which is in the upper right of the Solve panel layout. This panel shows the view from the solved Maya camera.
In frame 1, you can see that the modeled fence accurately matches the fence that was filmed. To quickly see if it matches well in the other frames, you can scrub through the shot in the Time Slider. 3
To scrub through the shot, drag slowly from left to right in the Time Slider. The fence model does not appear to slip in relation to the background, so this confirms that the solution is accurate. If you rendered a sequence of the camera moving around the modeled fence, you could composite the sequence with the original background and they would exactly match. Although scrubbing tends to skip frames, it gives a preliminary confirmation that the fence model matches the background in all frames.
4
To evaluate the solution in a more accurate playback, select Window > Playblast.
INSTANT MAYA UNLIMITED 97
LIVE | 4 Solving with survey data
The Playblast movie is an approximation of how the rendered sequence will appear. In this movie, you can look for subtle mismatches between the model and the background, such as momentary jitter.
Note As an alternative to the Playblast, you could play the animation in Maya, provided you allocate enough memory in the Setup Cache control panel. If you have memory allocated for all 240 frames, the playback will be as fast and accurate as the Playblast movie. If you do use the Playblast, you’ll need approximately 20 Mbytes of free space in your computer’s temporary directory.
Beyond the lesson Survey constraints are useful not only for orienting your solution, but also for the initial creation of a solution. In these lessons, you solved using track data alone, but this shot is fairly simple. In more complex shots, the solver may fail unless you use survey constraints to broaden the information that the solver can use. You cannot tell in advance which survey constraints are needed to solve a shot. However, it is a good idea to plan for some of the survey constraints before you start tracking. A common example is the Plane constraint, because most shots have coplanar or approximately coplanar points in them. Be careful not to add too many estimated survey constraints, because they may conflict with each other. Also, when you create a Plane constraint for points that are only approximately coplanar, we recommend you turn on Registration Only in the Solve Survey control panel. This option keeps the solver from forcing the points to be perfectly coplanar.
Other constraints Live also includes camera constraints and infinite points to help with solving. Camera constraints help control the focal length, translation, and rotation of the solved camera. You set them in the Solve control panel Camera settings.
INSTANT MAYA UNLIMITED 98
LIVE | 4 Solving with survey data
Infinite points are tracked points that you designate as infinitely far from the camera, such as a cloud, mountain, or any feature in the distant background. Knowing a point is infinite, the solver can use it exclusively for calculating camera movement. Infinite points are especially helpful for zoom shots, when the camera doesn’t move.
INSTANT MAYA UNLIMITED 99
LIVE | 4 Solving with survey data
INSTANT MAYA UNLIMITED 100
animate cloth 27 cloth character 26 Attach Fur Description 61
B Base Color 62 Base Resolution 32, 37, 46, 57
C cache Cloth 37 for Live images 74, 98 camera constraints 98 cloth animating 27 properties 34 simulation 36 stationary 58 cloth solver 36 exporting 47 Collision Depth 35 collision object 35 Collision Offset 35, 38, 56 Color Feedback Enable 62 constraints mesh 52 CpClothPlugin.mll 28 CpClothPlugin.so 28 cpDefaultProperty 34 cpPropertyBelt 45 cpSolver 36 cpStitcher 32
creasing subdivision surface 22 Create Cloth Property 34 Create Collision Object 35 Create Garment 32 Create Panel 30 Create Property 45 Create Seam 33 cross-hair in track box 76 curves duplicating 40 cutting subdivision surface 18
D Delete Cache 55 Delete Region 80 Density fur 64 detail subdivision surface 18 Display Level 19 dress-up pose 26, 54
E edges selecting subdivision surface 20 Export Selection 47 exporting cloth solver 47 garments 47 extrusion manipulator subdivision surfaces 16
F filmback for Live 72 fingernails 20 fingers 12 Fit to Surface 37 Frame Samples 55 Full Crease Edge/Vertex 22 Full Res Image 71 fur 59 default fur description 61 feedback 61 rendering 63 Fur Accuracy 62
G garments 26 constructing 26 creating 31 fitting 26 importing and exporting 47
H hands 10 hole creating subdivision surface 18
I image cache in Live 74, 98 image plane and rendering 90 Import Tracked Points 82, 88 importing cloth 48 garments 47
INSTANT MAYA UNLIMITED 101
ANIMATION
A
INDEX
importStart.mb 48 Inclination 62 interpenetration eliminating 56
P
Length 62 level of detail subdivision surface 18 Live 67 control panels 70 starting 70 load images into Live 71 loading Cloth 28 Fur 59 Live 70 local simulation 37
panels changing shape after simulation 37 creating in cloth 29 seaming 32 pants, creating 39 pantsFinal.mb 48 pantsMtl 46 pantsStart.mb 39 Plug-in Manager 70 Polar 62 Polygon Proxy Mode 11 Polygons to Subdiv 11 positioning cloth 49 Predefined Filmbacks 72 properties cloth 34
M
R
match moving 67 mayaLive.mll 70 mayalive.so 70 mcc file 56 Mesh creating a constraint 53 mesh constraints 52 Move Tool N (normal) manipulator 21
Refine Selected Components 21, 23 Relax Frame Length 55 render image plane 90 resolution 37 Resolution Factor 44 ridges subdivision surface 23
L
N New Matchmove 70
INSTANT MAYA UNLIMITED 102
S Save as Initial Cloth State 50 Scraggle 62 scrubbing the Time Slider 37
seams creating in garments 32 displaying 33 Setup Cache control panel 74, 98 shirt, creating with cloth 29 shirtFinal.mb 47 shirtMtl 38 shirtStart.mb 29 shotCamera view panel 73 Show Cloth 31 simulation cloth 36 increasing speed 46 solver cloth 36 deleting 52 exporting 47 selecting current 51 transferring garment to 52 Solver Scale 36 Standard Mode 18 Start Simulation 36, 37 Start Track button 76 stitcher node 32 subdivision surfaces 9 converting polygons 10 cutting 18 Extrude Face 14 extrusion manipulator 16 selecting faces 14 selecting vertices 17 Split Polygon Tool 12 survey constraints 98
T tableClothStart.mb 58 Thickness 54, 57 Thickness Force 54, 57
INDEX
Tip Color 62 Tip Opacity 62 Tip Width 62 track box tool 75 Track control panel 73 track point 72 Track Summary panel 78 Tracking Direction 76 Transfer Garment 52
U U Bend Resistance 34 U Scale 45 Update Cloth State 54 Use Cache option 90 Use Namespaces 49
V V Bend Resistance 34 vertices subdivision surface 17
W walk cycle 54 Warning Cycle... messages 50
INSTANT MAYA UNLIMITED 103
INDEX
INSTANT MAYA UNLIMITED 104
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
HIGHEND3D > Maya > Tips & Tutorials
[Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Tools - Tips & Tutorials - Users Links
http://www.highend3d.com/maya/tutorials/denis1/ (1 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
How to create a realistic looking turtle - Modeling part 1 by Denis Zen http://www.highend3d.com/artists/2.3d#denis_zen Click here to download the project files What follows is the first part of a tutorial which will show you how to model, texture, illuminate and animate a turtle. At the end your turtle should look like the one in the picture below:
Ready? Let’s start. The first thing you need is…a turtle to take some reference photos. If you have any, you can use the images included in this tutorial. I used them to draw the reference profiles, to model the different parts of the turtle and of course to get the images I used for the texture maps. Let’s see how I did. First, you have to load the images in Maya workspace to draw the different profiles; to do this you have to create an Image Plane for the side and the top camera: (Tip - If you want, you can speed your work creating in the shelf the thumbnails of the commands you use the most by pressing Alt+Ctrl+Shift while selecting the command from the menu).
http://www.highend3d.com/maya/tutorials/denis1/ (2 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
The thumbnails in the shelf
Window > Rendering Editors > Multilister
In the Multilister, click the Cameras tab and doubleclik on top shape.
The Attribute Editor of the side camera opens; scrool down until you see the Environnement tab; open it and click the Create button near Image Plane:
A new window opens: set the parameters as follows: Image Plane Attributes Display: looking through camera (if you want to see the image only in the top camera view, otherwise select in all views) Display Mode: RGB Image Plane: Fixed (this way when you move the camera, the Image Plane and the refence curves you draw will follow it) Type: Image File Image Name: here you have to load the file you will use as reference (in this case load the file bottom.tga) Placement Extras Center: 0 0 0 Width: 10 Height: 10
http://www.highend3d.com/maya/tutorials/denis1/ (3 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
With the image in the workspace, draw the top and bottom profiles of the tortoise-shell with the CV Curve Tool: Create>CV Curve Tool http://www.highend3d.com/maya/tutorials/denis1/ (4 of 14) [2000-07-11 19.31.42]
Make sure the curve degree is set to 3 Cubic. If not, select it or click the Reset Tool button.
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
( Tip – When you draw a curve you have to use less CV as possible; this way you will control the curve easier and your model will be "lighter" too. In this case you don’t need to pay great attention to this because the curves you draw will only be a reference). Once you have drawn the top and bottom profiles rename them bottomProfile and topProfile (Tip – When you rename something in Maya, it’s better not to use spaces or underscore. Try to use compound words with capital letters; this will work better especially when you will use expressions). Now, since you don’t need to modify them any more and since they are only reference curves, you can template them. Before doing this it’s better to assign these and the other profile curves we will create to a level. The use of the layers is extremely important; using the Layer Editor you can hide, template or select the different parts of your model very easily. So to assign the curves to a new layer:
1. Window>Layer Editor… 2. Click the New Layer button
3. Click the Rename button and rename the layer referenceProfiles 4. Select the bottomProfile and the topProfile 5. Click on the Assign to Current button.
http://www.highend3d.com/maya/tutorials/denis1/ (5 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
Create an Image Plane for the side camera (load the file side.tga) in the same way, draw the sideProfile and the curveProfile and assign them to the referenceProfile layer. Once you have drawn all the reference profiles you need, click on the Template button.
Top and bottom profiles - Side and curveProfiles - Perspective view
Now you can begin to draw the curves you will use to create the tortoise-shell surface. Create an Image Plane for the front camera loading the file front.tga and draw the profile as you did before. Rename it lateralProfile.
The Image Plane for the front camera - The lateralProfile
To draw the lateralProfile correctly, use the reference profiles you drew:
http://www.highend3d.com/maya/tutorials/denis1/ (6 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
Use this image as reference.
use the topProfile to adjust the part of the lateralProfile that will become the top part of the tortoise-shell (the green one in the reference picture)
use the sideProfile to adjust the part of the lateralProfile that will become the side part of the tortoise-shell (the red one in the reference picture). Use the curveProfile to decide where to "bend" the lateralProfile.
http://www.highend3d.com/maya/tutorials/denis1/ (7 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
Use this image to "bend"the lateralProfile
use the bottomProfile to adjust the part of the lateralProfile that will become the bottom part of the tortoise-shell (the light blue one in the reference picture).
(Tip – When you draw the lateralProfile, make sure that the first 2 CVs of this curve have the same value in y – and the same for the last 2 CVs -; this will later ensure the tangency of the two parts of the tortoise shell).
http://www.highend3d.com/maya/tutorials/denis1/ (8 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
The Y values of the first and last 2 CVs
Duplicate the lateralProfile and moving the CV create the other profiles as you can see in the pictures below. At the beginning, you don’t need to many lateralprofiles; 12 could be a good number.
Note how the lateralProfiles follow the curveProfile. - The 12 lateralProfiles you will use to build the tortoise-shell
http://www.highend3d.com/maya/tutorials/denis1/ (9 of 14) [2000-07-11 19.31.42]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
Use this image as reference for the lateralProfiles that will build the front part of the tortoise-shell. (The light blue area gives you an idea of how to move the CVs of those curves).
Since the tortoise-shell is symmetrical, you can simply obtain the curves for the right part of the tortoise-shell by grouping and duplicating the 12 curves you created. (Tip – Nothing in nature is perfectly symmetrical; real world objects and human beings have little differences that make them not exactly symmetrical. This is very important if you want your 3D model to appear photorealistic. So when the tortoise shell is finished, move some CVs to create little differences between the right and left part of your tortoise-shell). 1. Select all the lateralProfiles except the first and the last (otherwise, after the duplication, you will have 2 pairs of curves you won’t use)
2. Edit > Group
3. Rename the group leftCurves
4. Modify > Center Pivot (to center the Pivot of this new group)
Group all the curves except the first and the last.
Select one of the lateralProfiles and then press Shift. This way you have selected the leftCurves group. You will now change the position of the Pivot of leftCurves to be sure that the duplicated group is tangent to this one. With leftCurves still selected:
1. Display > NURBS Components > CVs http://www.highend3d.com/maya/tutorials/denis1/ (10 of 14) [2000-07-11 19.31.43]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
2. press W on your keyboard to show the Move Tool icon 3. press Insert on your keyboard. (Note the different aspect of the pivot when pressing Insert)
4. Press V (shortcut for the Snap to points) and middleclick over one of the starting CVs of one of the lateralProfiles; the pivot will immediately snap to it 5. Press Insert again to definitively change the position of the pivot
The starting position of the pivot - Snap to point - The new position of the pivot on a starting point
Normal - Whith Insert pressed
Before you duplicate leftCurves it’s better to reset all the values in the Channel Box using Freeze Transformations. So, with leftCurves selected:
1. Modify > Freeze Trasformations
2. Edit > Duplicate Click Reset in the Duplicate Option window) 3. Set the Scale X : –1 (this will mirror the new group along the Z axis) 4. Rename the new group rightCurves
http://www.highend3d.com/maya/tutorials/denis1/ (11 of 14) [2000-07-11 19.31.43]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
Using the two groups of curves you can build the tortoise-shell using the Loft command; this will build a surface, a skin through the curves you created. Starting from the first curve on the back select all the other curves in a clockwise direction; doing this the opening of the surface will remain on the back.
The starting curve on the back of the model.
When all the curves are selected: Surfaces > Loft
http://www.highend3d.com/maya/tutorials/denis1/ (12 of 14) [2000-07-11 19.31.43]
In the Loft Option window click the Reset button and then check the close option box.
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
Loft Option window.
Click the Loft button and the tortoise-shell will be created. (Tip – Remember that since history is on in the Status Line, changing the shape of any of the curves will automatically change the shape of the tortoise-shell).
The Status Line.
Three different views of the tortoise-shell.
Once you have created the tortoise-shell using the "right number" of profiles, you can modify your model moving the CVs; if you need more detail you can insert new Isoparms. ● In the first case (to move the CVs) select the model, rightClick on it and in the menu select Control Vertex. ●
In the second case (to add more detail) select the model, rightClick on it or anywhere in the workspace and in the menu select Isoparm; click one existing Isoparm and drag until the zone where you need more detail (to add more than one Isoparm use Shift). To add this new Isoparm to the model: Edit Surfaces > Insert Isoparms.
>> Continued on Part 2 >> http://www.highend3d.com/maya/tutorials/denis1/ (13 of 14) [2000-07-11 19.31.43]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 1
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board
Produced by Will McCullough. Copyright © 1999-2000 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/denis1/ (14 of 14) [2000-07-11 19.31.43]
Contact Us
Advertise
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
HIGHEND3D > Maya > Tips & Tutorials
[Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Tools - Tips & Tutorials - Users Links
The starting Isoparm - The new Isoparm
Doing this you can modify the starting model and get a more detailed (and realistic) tortoise-shell.
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (1 of 9) [2000-07-11 19.33.26]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
The starting model - A more detailed model (Note how the right part of the tortoise-shell is different from the left part).
When you are satisfied with your model, create a new layer, call it tortoise-shell, assign your tortoise-shell to it and hide it. Save the scene. Using the same tecnique we will build the head of the turtle. To draw the reference curves, load the files head_top.tga and head_side.tga.
The headProfiles drawn from the reference files.
This time you can use a NURBS Primitive, a Circle, as starting profile for the head: Create > NURBS Primitive > Circle To increase its number of sections you can use different ways (NURBS Circle Option window, Attribute Editor…); this time we will modify it in the Channel Box. So, after you create the circle, click the word makeNurbCircle in the Channel Box and near the word Sections type 12. (To show the Channel Box: Options > Channel Box)
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (2 of 9) [2000-07-11 19.33.26]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
The Channel Box
Rename the circle headProfile and move its CVs since you obtain a curve like the green one in the pictures below.
The starting profile of the head – side view front view
Duplicate the headProfile to obtain all the other curves you need to build the head. Using the reference profiles you drew, move the CVs to deform the duplicated curves.
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (3 of 9) [2000-07-11 19.33.26]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
All the curves for the head; side view - front view - top view; don’t follow the dotted line when you move the CVs. You will use it later to position the eyes of the turtle.
Pay attention at the curves at the beginning of the neck; deform them as shown in the picture below:
The curves of the starting part of the neck - A closer view of the curves of the neck
The numbers indicate the order of creation and expecially the order you have to follow when you will use the Loft command. This way you will obtain the "fold" of the skin of the neck, as you can see in the picture below.
The neck-skin "folder" - A closer view
Rename the loftSurface head and assign it to a layer (This way you will hide, template or select the head easier). Now, let’s build the eyes. To start, template the head you’ve just created;
1. Rightclick on the head or anywhere in the workspace 2. Actions > Template. This way you have a reference to place the eyes and since it’s in template mode you won’t be able to select it.
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (4 of 9) [2000-07-11 19.33.26]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2 To build the eyelids:
1. Create > NURBS Primitives > Sphere 2. Scale it x:0.4 y:0.45 z:0.2 and 3. Rotate it x:32 z:-90
4. Rename it upperEyelid and assign it to a layer called leftEye Since this is the upper eyelid, we don’t need all the sphere but only a part of it, and since we want it to move, we will use a very useful characteristic of the NURBS Sphere: the End Sweep value. Keeping in mind that NURBS surfaces are always open, using the End Sweep channel in the Channel Box we can control how much the sphere surface is open and since all the channels are keyable we can control the movement.
End Sweep:210 - End Sweep:250
So, using the Channel Box:
1. Click makeNurbSphere in the INPUTS section 2. Change the End Sweep value of the upperEyelid to 210
The upperEyelid values in the Channel Box.
To place the eyelid use the picture below as reference.
Front view - Side view
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (5 of 9) [2000-07-11 19.33.26]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2 To build the other eyelid, the lower one, just duplicate the upperEyelid and change its x and z rotation value: 1. Rotate X:-32 2. Rotate Z:90
3. Change its End Sweep value to 200. 4. Rename it lowerEyelid.
If you duplicated the upperEyelid using the default setting in the Duplication Options window, you have probably noticed that if you select the duplicated upperEyelid, the INPUT part of the Channel Box doesn’t appear. This is because you duplicated only the shape and initialShadingGroup node, as you can see in the Hypergraph (Window > Hypergraph…) if you select the duplicated upperEyelid and click the Up and Downstream Connections button:
Duplication using the default settings.
To duplicate the node that contains the "DNA" (so the End Sweep value, too) of an object you have to tick the Duplicate Upstream Graph in the Duplication Options window:
The Duplication Options window.
Duplication using the Duplicate Upstream Graph option.
To give depth to the eyelids we will use the Bevel tool. Select the upperEyelid and rightclick over it or anywhere in the workspace. From the menu select Isoparm and select the last one on the upper part of eyelid:
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (6 of 9) [2000-07-11 19.33.26]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
The Isoparm you have to select.
From the Surfaces menu select Bevel
Set the values as in the picture below:
Use these settings.
Click Bevel and rename the beveledSurface, upperDepth. Use the same values for the lowerEyelid, too and rename the new beveledSurface, lowerDepth. If everything went right you got something similar to the picture below:
The upper and lowerEyelids with the beveledSurfaces.
To create the eyeball we will use a NURBS Sphere and detach it using one of its Isoparms:
1. Create > NURBS Primitives > Sphere 2. Rename it pupil.
3. Go to the top view, rotate the pupil 90 degrees in Z, 4. Scale it and position it near the eyelids.
5. Rightclick on the pupil and from the menu choose Isoparm. 6. Select the Isoparm shown in the picture below 7. Edit Surfaces > Detach Surfaces 8. Delete the bigger part (the white one in the picture below).
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (7 of 9) [2000-07-11 19.33.27]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
The Isoparm you have to select (the yellow one) - The bigger (white) part to delete.
To build the other part of the turtle eye we will duplicate, resize and detach the eyeball we’ve just created.
2. Edit > Duplicate
1. Select the pupil Click the Reset button first and then Duplicate
3. Resize the duplicated pupil to make it a little bigger and rename it iris 4. Right click on the iris and select Isoparm 5. Choose the Isoparm shown in the picture below 6. Edit Surfaces > Detach Surfaces 7. Delete the bigger one (the green one in the picture)
The isoparm to select (the yellow one) - The bigger (green) part to delete
To give depth to the iris
1. Select the iris 2. Right click on it or anywhere in the workspace and select Isoparm 3. Choose the isoparm shown in the picture below
4. Surfaces > Bevel (you can use the same values you used for the eyelids; take care that the beveledSurface intersects the pupil as shown in the picture below).
5. With the beveledSurface still selected Edit > Delete by Type > History 6. Press Shift and select the iris, too 7. Edit > Parent
The isoparm to select - The beveledSurface - Note the intersection - The eye, as now appears
To build the eyebrow we only need the eyelids and the head, so, using the Hypergraph we will hide all the other parts. To better identify the different parts of the eye in the Hypergraph, we will group them. We will create two groups: one for the moving part of the eye (iris+beveledSurface+pupil) and one for the other parts (eyelids+beveledSurfaces).
1. Window > Hypergraph http://www.highend3d.com/maya/tutorials/denis1/part2.3d (8 of 9) [2000-07-11 19.33.27]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 2
2. Select iris (and you automatically select the beveledSurface which is parented) + pupil 3. Edit >Group
4. Rename the group eyeball (Tip – To rename an object within the Hypergraph double click on it while pressing Ctrl) >> Continued on Part 3 >>
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board Contact Us Advertise
Produced by Will McCullough. Copyright © 1999-2000 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/denis1/part2.3d (9 of 9) [2000-07-11 19.33.27]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
HIGHEND3D > Maya > Tips & Tutorials
[Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Tools - Tips & Tutorials - Users Links
To create the other group: 1. Select upperEyelid + lowerEyelid + the beveled surfaces 2. Edit >Group
3. Rename the group eye
Now we have to parent the eyeball and the eye:
1. Select the eyeball
2. Press Shift and select the eye 3. Edit > Parent http://www.highend3d.com/maya/tutorials/denis1/part3.3d (1 of 11) [2000-07-11 19.34.44]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
If everything went right your Hypergraph should look like the one in the picture below:
The two groups in the Hypergraph
Now we will hide all the parts except the eyelids. To hide an object using the Hypergraph, simply rightclick on it and choose Hide. The Hypergraph with the hidden objects
Using the Isoparms of the eyelids we will build the curve to project on the head surface; than, with these two curves (the one from the the eyelids and its projection) we will create the eyebrow surface. To start:
1. Select the upperEyelid
2. Rightclick on the upperEyelid or anywhere in the workspace and select Isoparm in the menu http://www.highend3d.com/maya/tutorials/denis1/part3.3d (2 of 11) [2000-07-11 19.34.44]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
3. Select the isoparm shown in the picture below 4. Edit Curves > Duplicate Surface Curves
The isoparm to select and to duplicate
1. Repeat the 4 steps above for the lowerEyelid
2. Show > Surfaces (the option box must be unchecked) With no surfaces visible we can better work with the duplicated curves. 1. Select the two curves
2. Edit Curves > Attach Curves In the Attach Curves Otions window set the values as in the picture below 3. Edit > Delete by Type > History 4. Rename the new curve eyebrowCurve
Choosing the Blend option the new curve would’t match the eyelids outline. Note the difference
Let’s project the curve on the head surface. To do this we have to show the surfaces again: Show > Surfaces (this time the option box must be checked) To get a useful (to correctly build the eyebrow) projection of the eyebrowCurve we have to move a little bit away this curve from the eyelids. http://www.highend3d.com/maya/tutorials/denis1/part3.3d (3 of 11) [2000-07-11 19.34.45]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
Go to the top view and move the eyebrowCurve a little bit as shown in the picture below:
Move the curve a little bit away from the eyelids
With the curve still selected: 1. Go to the side view 2. Press Shift and select the head
3. Edit Surfaces > Project Curve On Surface In the Project Curve Options window be sure that Active View is on. This way the projection occurs in the direction of the normals in the active view.
The result should look like the picture below:
Projecting one curve we have created the curve for the right part, too (the green one).
Using one of these two projection and one isoparm per eyelid we finally build the eyebrow. Go to the perspective view
1. Delete the eyebrowCurve
2. Edit Surfaces > Surface Fillet > Fillet Blend Tool
3. Click on the upperEyelid and select the Isoparm on its outline 4. Click on the lowerEyelid and select the Isoparm on its outline 5. Press Enter
6. Select the left curve you just projected on the head (the white one in the picture above) 7. Press Enter http://www.highend3d.com/maya/tutorials/denis1/part3.3d (4 of 11) [2000-07-11 19.34.45]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
Oops! You probably got that horrible thing you can see in the picture below:
The 2 Isoparms and the The horrible thing curve used for the Fillet Blend Tool
Don’t worry! You just need to reverse some surfaces:
1. Window > Hypergraph 2. Select upperEyelid
3. Edit Surfaces > Reverse Surface Direction 4. Select lowerEyelid 5. Edit Surfaces > Reverse Surface Direction 6. Rename the freeformBlendSurface1 eyebrow
The correct eyebrow.
Changing the shape of the projected curve, we can adjust the shape of the eyebrow around the lowerEyelid. To better select only the curves we will use the "filters" in the Status Line; click on the 8th icon in the Status Line to disable surfaces selection
Click the 8th icon (the green one) to disable surface selection
1. Select the projected curve on the head
2. Rightclick on it (once you select an item you can rightclick anywhere in the workspace and get the corresponding marking menu; this time, for example, you better http://www.highend3d.com/maya/tutorials/denis1/part3.3d (5 of 11) [2000-07-11 19.34.45]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
rightclick away from the curve, otherwise you will get the head CVs instead of the curves') and choose Control Vertex. Moving the CVs change the shape of the eyebrow; use the pictures below as reference:
The starting eyebrow - The correct eyebrow
A closer view - The CVs of the projected curve - The correct eyebrow
It’s time to turn on the visibility of all the other parts of the eye.
1. Window > Hypergraph
2. Rightclick on the hidden parts of the eye and select Show When you Show the two beveledSurfaces of the eyelids, you probably get something like the picture below:
http://www.highend3d.com/maya/tutorials/denis1/part3.3d (6 of 11) [2000-07-11 19.34.45]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
As they appear
This is because you reversed the eyelids surface; to get the right beveledSurfaces just change their Width into negative:
The new (negative) value - The right beveledSurface - The eye with all its parts
To duplicate the eye we will use a Tip that lets you duplicate and rename complex hierarchies at the same time. Before doing this let’schange the Pivot of the eye group. 1. Go to the Top view 2. Select the eye in the Hypergraph
3. Modify > Center Pivot
4. Press Insert on your keyboard 5. Move the Pivot as shown in the picture below 6. Press Insert again
http://www.highend3d.com/maya/tutorials/denis1/part3.3d (7 of 11) [2000-07-11 19.34.45]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
The new position of the eye Pivot
It’s time to duplicate the eye.
1. Window > Hypergraph 2. Select eye 3. File > Export Selection 4. Use eye as File name Now you will import the eye you just exported and add a prefix to identify it as the right eye: File > Import
Set the values as in the picture below:
How to set the Import Options
In the Hypergraph you have now a new hierarchy:
http://www.highend3d.com/maya/tutorials/denis1/part3.3d (8 of 11) [2000-07-11 19.34.46]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
In the Hypergraph select right_eye and in the Channel Box set Scale Z: -1; this mirrors the right_eye moving it in the right position (this is the reason why we moved the eye Pivot). As you notice, the right_eyebrow and the two beveledSurfaces of the right eyelids have some problems. For the beveledSurfaces of the right_upper/lower eyelids just change its Depth value in the Channel Box from positive (0.02) to negative (-0.02). For the right_eyebrow it’s better to delete it and build a new one. Using the Fillet Blend Tool (Edit Surfaces > Surface Fillet > Fillet Blend Tool) as you did before, build the right_eyebrow again. If you got something you didn’t expect, don’t worry…just reverse the Surfaces direction (Edit Surfaces > Reverse Surface Direction). This time you need to reverse the direction of the projected curve, too (Edit Curves > Reverse Curve Direction).
http://www.highend3d.com/maya/tutorials/denis1/part3.3d (9 of 11) [2000-07-11 19.34.46]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3
Before - After reversing curve and surfaces
Before assign the eyes to a level in the Layer Editor add a prefix to the other eye:
1. Window > Hypergraph 2. Select eye
3. Modify > Prefix Hierarchy Names… Wtite left_ in the field in the Prefix Hierarchy window. Create a new layer in the Layer Editor, call it eyes and assign right_eye and left_eye to it. It’s time to create the skin that covers the hole in the middle of the tortoise shell (the hole of a real tortoise-shell), where the body of the turtle is into and where the head comes from (since there will be a skin to cover this hole, we don’t need to make it). To do this we need to draw the outline of this skin in the tortoise-shell using the CV Curve Tool and the Making the selected object Live. (16th icon in the Status Line, the green one in picture below).
The Make Live icon
1. Using the Layer Editor show the tortoise-shell 2. Select it 3. Click the Make Live icon
4. Click the CV Curve Tool icon and draw a curve similar to the one in the picture below 5. Click the Make Live icon again.
http://www.highend3d.com/maya/tutorials/denis1/part3.3d (10 of 11) [2000-07-11 19.34.46]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 3 Use these images as refence
To build the skin we will use a Boundary Surface, but first we have to tile the curve in four parts. 1. Select the curve you just created 2. Rightclick somewhere in the workspace and select Curve Point 3. Click four times in the selected curve to add four Curve Points
4. Edit Curves > Detach Curves
Add four Curve Points to tile the curve - Select the four parts following this order
1. Select the four parts of the curve as shown in the right picture above (follow the same order) 2. Surfaces > Boundary 3. Rename the boundarySurface1 frontSkin 4. Open the Layer Editor 5. Select the tortoise-shell layer 6. With frontSkin still selected click Assign to Current >> Continued on Part 4 >>
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board
Produced by Will McCullough. Copyright © 1999-2000 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/denis1/part3.3d (11 of 11) [2000-07-11 19.34.46]
Contact Us
Advertise
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
HIGHEND3D > Maya > Tips & Tutorials
[Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Tools - Tips & Tutorials - Users Links
The boundary Surface in the front part of the tortoise-shell
In the same way create the skin in the back of the tortoise-shell and rename it backSkin. Create a new layer, call it skin and assign the frontSkin and the backSkin to it.
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (1 of 11) [2000-07-11 19.36.28]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
The boundary Surface in the back part of the tortoise-shell - What we have modelled until now
As last step we will model the legs. Using the Layer Editor, hide all the parts of the turtle and import the file legReferenceCurve.mb in your scene. Using the Template curve as reference, start from the "fingers" and draw the curves you will use to create the leg skin. Start drawing the more detailed curve (the white one in the picture below); duplicate it 3 times and delete the "corner points" as shown in the picture below; to delete a CV: 1. Select the curve
2. Rightclick on it or somewhere in the workspace 3. Select Control Vertex from the menu 4. Select the CVs you want to delete 5. Press Backspace on your keyboard
Duplicate one of these less detailed curves and repeat these 5 steps to delete other CVs to obtain a new curve (the green one in the picture) with less CVs. Doing this you will obtain a smooth surface that simulate the skin between the fingers of the turtle leg.
The more detailed curve and the CVs to delete
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (2 of 11) [2000-07-11 19.36.28]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
All the curves (Top view) - All the curves (Perspective view)
The different detail of the curves creates a smooth surface (yellow zone) To create the curves "behind" the green one, just duplicate this curve and Move the CVs.
Once you have all the curves: 1. Select all of them
2. Surfaces > Loft
With the loftedSurface still selected:
1. Display NURBS Components > CVs 2. Press W (to show the Move tool icon) 3. Press Insert
4. Pressing V (shortcut for snap to points) Middleclick on one of the CVs of the border of the loftedSurface 5. Press Insert
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (3 of 11) [2000-07-11 19.36.29]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
Pivot on the border. This way the mirrored surface will be perfectly aligned with this one. - Pivot on the border; closer view
To mirror the surface we just created:
1. Select the surface 2. Edit > Duplicate
3. Set Scale Y to –1 in the Channel Box 4. Select both surfaces
5. Edit Surfaces > Attach Surfaces Deselect the Keep Originals option box 6. Click Attach 7. Edit > Delete by Type > History 8. Rename it leftFrontLeg
The 2 surfaces - The attached surface - The result
To complete the leg we have to model the nails. Go to the side view and draw a profile like the one in the picture below. Pay attention to the first 2 CVs: they must have the same Y value to ensure the tangency.
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (4 of 11) [2000-07-11 19.36.29]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
Right curve - Right curve; closer view
To build the nail we will Revolve this curve, but before doing this we have to change the Pivot position. 1. Select the curve
2. Display > NURBS Components > CVs 3. Press W 4. Press Insert
5. Press V and middleclick on the last CV of the curve 6. Press Insert 7. Surfaces > Revolve 8. Rename the revolvedSurface nail
The revolvedSurface - Using a curve with different Y values for the first 2 CVs you obtain an unreal nail (Note the unreal point of the object. Pay great attention to these details if you want your model to look realistic)
Using a Lattice deformer we will give the right shape to the nail.
1. Select the nail
2. Deform > Create Lattice 3. Rightclick somewhere in the workspace and select Lattice Point in the menu 4. Move the CVs untill you get a shape like the one in the picture below
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (5 of 11) [2000-07-11 19.36.29]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
Lattice deformer - After moving the CVs
Once you get the right shape select the nail and Edit > Delete by Type > History. Duplicate it 4 times and position all the nails in the right position.
The complete leg The complete leg – perspective view
Move the CVs of the surface of the leg so it wraps the nails. (Tip – You don’t need to be too extremely precise; the texture will help you later as you can see in the picture below) When you are ready, select all the nails and, last, the leftFrontLeg and press P.
A good texture "hides" imprecise modelling
To build the back leg we just deform the leftFrontLeg with a Lattice. So:
1. Select the leftFrontLeg 2. Edit > Duplicate 3. Deform > Create Lattice Before moving the Lattice points to deform the leg we will change the Lattice Divisions; we can do this in the Channel Box. Select the Lattice and change the values as in the picture below:
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (6 of 11) [2000-07-11 19.36.29]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
Try using these values
To move the Lattice points:
1. Select the Lattice 2. Rightclick somewhere in the workspace 3. Select Lattice Point from the menu
4. Select and move the CVs until you get a shape like the one in the picture below:
The starting leg - Moving the Lattice points - The final leg
Once you are ready, Select the leg, Delete its History and rename it leftBackLeg. Now it’s time to add detail to the legs to make them more realistic. Using Artisan we will pull and push the legs surfaces as you can see in the pictures below:
leftFrontLeg - leftBackLeg
Before using Artisan you better rebuild the leg surface. To work better, you can create two new layers call them frontLegs and backLegs and assign the two legs to them. Using the Layer Editor, hide the leftBackLeg.
1. Select leftFrontLeg
2. Press the down arrow in your keyboard (this will deselect the all the nails)
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (7 of 11) [2000-07-11 19.36.30]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
3. Edit Surfaces > Rebuild Surfaces
Set the values as shown in the picture below:
(Tip – Since you will use Artisan it’s better to increase the number of spans in both U and V; this way you can deform the surface more precisely. Then, when you are satisfied, you can rebuild the surface again, and get a"lighter"surface).
1. Edit Surfaces > Sculpt Surfaces Tool
In the Tool Settings window set the different values of the Sculpt tab to get the brush you need; (use the smooth option very often to get a more realistic surface).
Once you are ready, rebuild the surface: the purpose is to get the same shape (or very similar) but with less Isoparms as possible. To do this you have to make attempts; change the Number of Spans value until you get a "good"surface. Now hide the leftFrontLeg and show the leftBackLeg. Repeat the same steps and add detail to this leg, too.
The starting leg; Spans UV:10-98 Rebuild Surface; Spans UV:35-40 Rebuild Surface Spans UV:15-30
Now we will duplicate the leftFrontLeg and leftBackLeg and add them to the turtle. Using the Layer Editor show the legs. 1. Go to the Top view
2. Select the leftFrontLeg 3. Modify > Freeze Transformations (this will reset all the values in the Channel Box and help you to work better)
4. Rotate it 90deg in Z
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (8 of 11) [2000-07-11 19.36.30]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
5. Edit > Duplicate 6. Set Scale Y: -1
7. Modify > Freeze Transformations 8. Rename it rightFrontLeg Repeat these steps with the leftBackLeg and rename it rightBackLeg. Move the legs as shown in the pictures below:
Pay attention to the right position of the legs
Using the back legs Isoparms we will build the backside of the turtle:
1. Edit Surfaces > Surface Fillet > Fillet Blend Tool 2. Select a Isoparm in the leftBackLeg (the one in picture A below) 3. Press Enter 4. Select a Isoparm in the rightBackLeg (the one in picture A below) 5. Press Enter 6. Rename the freeformBlendSurface backside
A) Selecting these Isoparm you’ll get a rounded backside (Right)
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (9 of 11) [2000-07-11 19.36.30]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
B) Selecting these Isoparm, you’ll get this backside (Wrong)
The backside surface is tangent to the legs and will remain tangent when we move the legs. As last step, we will build the tail and add it to the turtle. Go to the side wiew and draw a curve like the one in the picture below:
Move its Pivot as shown in the picture below:
Revolve it around its Z axis: Surfaces > Revolve
Check Z in the Axis Preset line on the top of the window
Using the Lattice deformer get a shape like the one in the picture below and rename it tail.
Finally position it in the backside:
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (10 of 11) [2000-07-11 19.36.30]
Maya Tutorials - Creating a realistic looking turtle - Modeling part 4
Compliments! You have modelled your first complex object with Maya.
The result
In the next tutorial I will explain different tecniques to make photorealistic and seamless texture maps. Bye!
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board Contact Us Advertise
Produced by Will McCullough. Copyright © 1999-2000 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/denis1/part4.3d (11 of 11) [2000-07-11 19.36.30]
Maya Tutorials - Creating motion-blurred shadows in Maya
HIGHEND3D > Maya > Tips & Tutorials
Creating motion-blurred shadows in Maya
As you all noticed, Maya doesn't provide at all motion blur with shadows. T
[Maya] - Mel Scripts - Forums - Hardware Tests - List Servers - List Archive - Game Archive - Dev Archive - Plugins - Shaders - Tools - Tips & Tutorials - Users Links
his tutorial shows how to generate motion blurred shadows in a separate pass(es), to be composited or just remapped into an attribute of a material (mainly the diffuse attr). It's been tested with depthmap shadows, but I don't think ray-traced ones would be a problem.
But let's get into the character... C
onsidering that a depthmap shadow is just a generated mage from light's point of view, what if we set a camera at the very light source's location, and render the sequence from that cam, with motion blur on.
For my test, I used a directionnal light (sun light source). I have created a camera, point & orient
constrained to that dir light.
N
ow, in order to match with real generated depth shadows (dir light provides parrallel rays, in other words, it's like generated from an orthogonal view), we must set the focal length attribute so that the perspective looks like the dir light point of view. You can visualize that by opening 2 windows of your 'shadow' camera and the real dir light (with Look through selected).
A
djust the 'shadow cam' focal length so that its point of view lies as exactly as possible with the point of view from the dir light.
B
e careful to set the same parameters of film aspect ratio for both cameras (the one that renders shadows, and the renderable cam) orelse your projection will not fit exactly with the objects (the shadows will be a bit 'offseted' from the 'supposed to cast shadow objects')
http://www.highend3d.com/maya/tutorials/emmanuel3/ (1 of 3) [2000-07-11 19.15.29]
Maya Tutorials - Creating motion-blurred shadows in Maya
When this is done, you may have to determine what object is in shadow casted by your moving
object, so that you'll render it or them in a separate pass.
C
reate 2 shading map shaders. One black, and the other white (to generate a mask), and apply the white shader to the objects that are NOT shadowed by the motion blurred object, and apply the black shading map to the moving object.
Now you just have to render from the 'shadow cam' the whole sequence with your moving object(s).
You'll get a 'mask' sequence of the moving object (now moving shadow).
here are sample frames of the rendered animation from 'shadow light source cam'
This done, remap the motion blurred shadow sequence with a perspective projection (set to the 'light source' cam, with fit to resolution), and plug it into the diffuse of your, say ground material, and do the same for the diffuse attr. of your shadowed objects.
Now you have a perfect motion blurred shadow, with your motion blurred object (obviously, it's better with than without, huh?!!)
http://www.highend3d.com/maya/tutorials/emmanuel3/ (2 of 3) [2000-07-11 19.15.29]
Maya Tutorials - Creating motion-blurred shadows in Maya
maya default shadow
motion blurred shadow
O
k, that's it. For other light sources, I have obtained very convincing results with spot lights, but I didn't try with a point light which is much more complicated than that (but I'll give you some news about that stuff when I'll get some time to do some more tests)
L
imitations: unfortunately, the produced images are not exactly like the real ones provided by maya light sources. Simply because of the projection through a camera...
If you have any questions, critics or comments, let me know at [email protected] Emmanuel Campin - june 2000
About Us
Partners & Sponsors
Terms & Conditions
Advisory Board Contact Us Advertise
Produced by Will McCullough. Copyright © 1999-2000 HIGHEND Network All rights reserved. All other marks are property of their respective owners.
http://www.highend3d.com/maya/tutorials/emmanuel3/ (3 of 3) [2000-07-11 19.15.29]
Rocket Launch Maya’s particle system is a powerful and extensive collection of tools and features for simulating a variety of effects such as dust, sand, fire, clouds, explosions, smoke, and liquids. Effects such as these are found in countless feature film and broadcast shots and have become part of every day effects work for many in the industry. This tutorial explains how to set up and render a rocket launching. The focus is placed on setting up the smoke trail of the rocket using software particles.
A Taste of Maya
The following topics are discussed: ■
What are particles in Maya?
■
Creating particles and emitters
■
Parenting an emitter to animated geometry
■
Adjusting particle attributes
■
Adding fields to affect particle motion
■
Keyframing emission rate in the Graph Editor
■
Changing particle radius with respect to particle age
■
Assigning shaders to particles with Hypershade
■
Rendering considerations.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Before you start: This tutorial requires Maya scene files. If you haven’t installed the tutorial files go to the “Try Maya” section of the “Taste of Maya” CDROM to install.
Note:
Starting Maya: You can start Maya by double-clicking the Maya 2.5 Evaluation icon on the desktop or from Start → Programs → Maya 2.5 Evaluation → Maya. In Maya: Once the tutorial files have been installed you will need to set the current project in order to access the Maya scene files. To set the current project from within Maya select File → Project → Set... and Navigate to the directory where you installed the Maya scene files. Select the directory: Maya_tutorial_data and press OK.
Rocket Trail To create the smoke trail in the above image three different particle objects that each have slightly different motion and shading characteristics. All three particle objects will be emitted from one emitter that is parented to the rocket. “thick” particles: provides base layer of particles for chunky appearance “softer” particles: provides a layer of wispiness “trail” particles: used to simulate the streaking effect in the smoke trail.
Once you tune the motion and emission of the particles using fields and animation curves, lighting and shading will be added then you will render.
What is a Particle Object in Maya? Particles in Maya differ from geometry in the following ways: ■
Particles are points in space. They require special handling at render time because they do not contain surface information.
■
Particles can be rendered using hardware or software rendering methods. The particle Render Type attribute controls which of these two methods is used. The rocket example uses software render types only. Software render types render slower but allow for details such as shadows, detailed texturing, and reflections.
■
In Maya, Individual particles belong to a common collection called the particleShape object. Just as CVs of a geometric object belong to their shape node, individual particles can be thought of as components to the particleShape node.
Creating the Thrust Emitter A particle emitter is like a cannon that fires particles into space. 1 Open scene file and playback ■ File → Open; select rocket_start.ma This file contains a rocket on a launch pad. The rocket launch has already been keyframed. Playback to see the rocket launching. 2 Add a directional emitter ■ Press F4 to switch to the Dynamics menus ■
Use the Outliner to select thrust (within the rocket group)
2 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
■
Rocket Launch
Select Particles → Add Emitter → ❐, and set the following: Emitter Name to thrustEmit; Emitter Type to Directional; Max Distance to 5 Min Distance to 1 Rate to 45; Spread to 0.15; Direction X, Y, and Z to -1, 0, 0 respectively; Speed to 150;
■
Press Add then Close Min and Max distance determine a distance from the emitter in which emission can occur. The values are used here keep the particles from overlapping with the tail of the rocket. Rate is the number of particles per second emitted, Speed controls how quickly the particles leave the emitter.
3 View and rename what was created ■ Press play on the timeline to watch the particles emit.
Particles trailing behind the rocket Make sure Playback Speed is set to Free in Options → General Preferences → Animation. Otherwise, the emitter may appear to “sputter” particles instead of providing a constant emission.
Note:
■
■
Open Window → Outliner to see the newly created particle object called particle1 and thrustEmit emitter. Double click on particle1 in the Outliner and rename it thick
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 3
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Outliner showing emitter and associated particle object ■
Select the particle object and set Level of Detail to 0.25 in the Channel Box. Level of detail controls what percentage of the particles will be displayed on the screen and in the final render. Lowering this value lets you quickly evaluate motion while testing. Remember to set this back to 1 when rendering. Using level of detail is very important to working with particles efficiently. To create a “stand-alone” emitter that does not get placed within an object hierarchy you can use Particles → Create Emitter. This emitter can still be parented to an object later if desired.
Tip:
Adjusting particle attributes Now that the emitter is in place, you can begin to make some preliminary changes to the particles so they are easier to see and so they behave more like a smoke trail would. 1 Open the Attribute Editor for thick particles The Attribute Editor window for the thickShape object is where most particle attributes are adjusted. Changes made here affect every particle component that belongs to the currently selected particle object. ■
Continue on from the last step or open the file rocket_thick.ma
■
Select thick in the Outliner
■
Ctrl - a to open the Attribute Editor
4 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Attribute Editor window for thick particles 2 Set the Particle Render Type and associated attributes ■ Set Particle Render Type to Cloud (under Render Attributes) ■
Click the Current Render Type button A list of attributes associated with the cloud render type is displayed. Change the following settings: Surface Shading to 0.8 Threshold to 8.250
These settings control some rendering properties of these clouds that will be more important later on. You will not see any change in the perspective window.
Setting thick particles to cloud and adjusting some attributes 3 Add per object lifespan Adding a lifespan attribute allows you to control how many seconds each particle will be displayed in the scene. ■
Press the Lifespan button under Add Dynamic Attributes
■
Choose Add Per Object Lifespan Attribute
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 5
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
■
Set lifespan to 5 in the Render Attributes section of the Attribute Editor
Adding Fields Fields act like forces to move the particles around in different ways. Here you will add gravity, turbulence, and radial fields and connect them using three different methods. 1 Create gravity and connect it using Connect/Add Here you will create a “stand-alone” field and connect the field to the particles so they fall more realistically. ■
Make sure nothing is selected
■
Choose Fields → Create Gravity
■
In the Outliner select the thick particles then Ctrl-select the gravityField1
■
Choose Connect/Add → Connect to Field This connects the gravity field to the particles. If you switch to wireframe mode (press 4) and select only gravityField1, the particles highlight in pink to indicate a connection is present.
2 Playback and adjust particle conserve attribute As you playback, the particles quickly fall instead of just floating. To obtain a look of ejecting and easing to a stop, you can adjust the amount of momentum the particles conserve each frame. ■
Open the Attribute Editor for thickShape
■
Adjust the Conserve attribute near the top of the Attribute Editor. A value of 0.1 works well. This means that each frame each particle keeps only 10 percent of the velocity it had in the previous frame. Try experimenting with other conserve values.
3 Create turbulence and connect it using dynamic relationships Now you will apply some turbulence so the particles scatter a little bit and will use the Dynamic Relationships Editor to connect the field. This editor can be used for managing many types of dynamics connections including fields, collisions, and emission. ■
Rewind to Frame 1 and make sure nothing is selected
■
Choose Fields → Create Turbulence - ❐ Set the following: Magnitude to 100 Attenuation to 1
Press Create then Close 6 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
An Attenuation of 1 causes the field influence to diminish over distance causing particles further away from the field to be less turbulent. ■
Press W to invoke the Move tool then translate the field’s icon to roughly the same location as the thrustEmit object (near the back end of the rocket).
■
With the field still selected, Ctrl-select the thrust geometry object in the Outliner (not the emitter), then Edit → Parent This causes the field to follow along with the rocket.
Outliner showing parenting of turbulence field ■
Open Windows→Relationship Editors → Dynamic Relationships...
■
Make sure the Selection Mode in this Editor is set to Fields
■
Highlight thick on the left side and turbulenceField1 on the right
■
Notice that gravityField1 is also highlighted confirming it is connected as expected.
Dynamic Relationships Editor showing gravity and turbulence connected 4 Add a radial field to push the particles outward. The next step is to make the particles expand slightly after they have left the rocket. This can be achieved by adding a radial field. ■
Select thick then choose Fields → Add Radial - ❐
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 7
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Set the following options: Magnitude to 0.8 Attenuation to 0.5 Apply Per Vertex to On Use Max Distance to On Max Distance to 8
Press Add then Close Add Radial is used here so the field is automatically parented to the particles. Turning apply per vertex on causes each individual particle to behave as though there is an independent radial field attached to it. This keeps all the particles pushing away from each other. ■
Use Window Relationship Editors → Dynamic Relationships to connect thick particles to radialField1.
■
Playback to test the motion.
■
The file rocket_with_fields.ma is a set up version of this scene up to this point.
Particles pushed away from the center by a radial field
Changing Each Particle’s Radius Over Time Currently every particle in thick has the same radius (1.0) You can give each particle its own radius value and change that radius value over the course of the particle’s lifespan by adding a per particle radius attribute (radiusPP) that is controlled by a ramp. This way you can make the particles exit small, then grow, then get smaller again by the time they die, similar to how puffs of smoke behave. 1 Add radiusPP to thick in the Attribute Editor ■ Select thick and open the Attribute Editor ■
Click the thickShape tab at the top of the Attribute Editor
■
Click the General button under Add Dynamic Attributes
■
Click the Particle tab on the resulting window and select radiusPP then press OK
8 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Adding a radiusPP attribute The particles disappear because radiusPP is currently 0. In cases such as this where a radius and radiusPP attribute are present, the radiusPP values override the radius attribute.
Note:
radiusPP shown in thick’s Attribute Editor 2 Assign a pre made ramp to thick’s radiusPP Since radiusPP is currently 0, you need to assign a value to it so the particles grow and shrink. Assigning a pre-made ramp is a quick way of doing this. A ramp is just a gradation between values. ■
In the Attribute Editor for thick, RMB in the field next to radiusPP, and select Create Ramp - ❐
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 9
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Selecting a premade ramp from the Create Ramp Options Box ■
Set Map To to RadiusRamp. This is a gradation of values that has been set up for you so the radius grows and shrinks at the right times. Leave InputU and InputV as they are. Then press OK
■
Rewind and playback. The file rocket_radiusPP.ma contains a setup version of the scene up to this point.
Particles with changing radius values
The Takeoff Burst A rocket exudes more smoke at initial takeoff. Therefore, you will need to animate the emission rate on the thrustEmit emitter to simulate this. 1 Open file or continue on from above steps ■ rocket_radiusPP.ma can be used as a starting point 2 Keyframe thrustEmit rate ■ Select Windows → Saved Layouts → Persp/Graph/Outliner ■
Select thrustEmit and open the Channel Box
■
Use the timeline to go to frame 18
■
Set rate to 0 in the Channel Box
■
RMB click on rate in the Channel Box, choose Key Selected
10 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
This keyframes the rate to 0 at frame 18 ■
Set 4 more keyframes using the values below. frame 22: rate = 10 frame 26: rate = 6 frame 39: rate = 40 frame 70: rate = 0
■
The goal is to have an animation curve in the Graph Editor that looks similar to the picture below. Note that the last two keyframes in the picture below use stepped tangents. For more information about adjusting keyframe tangents and weights in the Graph Editor refer to the online documentation.
Animation curve in the Graph Editor controlling emission rate Tip:
If there are too many particles for you to see what is happening or if the playback is too slow you can temporarily lower your emission rate in the Graph Editor or lower the Level Of Detail attribute on the particle object. Temporarily setting the Render Type to Points will also help.
The result of the keyframed emission rate
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 11
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Rendering Now the focus will shift to getting these particles to render like smoke. You will use a scene file that has some additional particle objects added to it and which has lighting set up for you. Your task is to assign the appropriate shaders to the particles. 1 Open file and analyze contents ■ Open rocket_render.ma This file contains 2 additional particle objects that are emitting from the same emitter as the thick particles. softer: These particles are slightly larger than the thick particles
■
trail: Tube render type particles whose length is determined by how fast they are moving. These particles will create trailing streaks behind the rocket. There are display layers for each particle object. Use these display layers to toggle the visibility of the particles on and off. This helps you to manage the number of particles displayed on the screen and aids in speeding test renders. The launcher has been templated to speed test renders.
Render speed considerations ■ You will be doing some test renders in with this scene. Keep in mind that the speed of the render will be greatly affected by the number of particles and the percentage of screen space those particles occupy. It is best to choose framings for test rendering that keep this in mind. Also, don’t forget to use the level of detail attribute and the display layers in your scene to help manage the speed of your renders. Assigning Shaders for the Particles You will use two volumetric particle cloud shaders that are provided within the scene file. ■
thickCloud: Provides a chunky edge appearance to the thick particles. This will be applied to thickParticles
■
softCloud: More transparent than thickCloud. Provides a softer boundary overlaying the
thickCloud and also tones down the brighter highlights found in the thickCloud. This will be assigned to softer and trail particles. 2 Using Hypershade The Hypershade window is where you build and assign shaders in Maya. ■
Open Windows → Outliner and select thick
■
Shift-select the thickClouds shader in the Hypershade window
■
RMB on the text label of thickCloud shader and select Assign Material to Selection
■
Repeat the process for softer and trail except assign the softCloud shader to both of them instead.
12 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
The RMB menu for assigning shaders in Hypershade 3 Test Rendering individual layers To get an idea of what each shader and particle object is contributing to the image, use the display layers to display only one particle object at a time then render a frame. Generally when adjusting shaders, it is best to focus on one particle object at a time. This keeps rendering times lower and helps you to see what is going on. ■
Make sure the layer bar is displayed (Options → Layer Bar)
■
Play up to frame 40,
■
Hide softer and trail using the layer bar RMB in the Layer Bar on softerLayer, trailLayer and toggle visible off.
■ ■
■
In the Render View Window choose Render → Render → Current (persp) Repeat the process (two particle layers hidden, one visible) so you have rendered one still image of each particle object. Finally, test render a frame with all three particle objects visible so you can see how they appear when combined.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 13
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Default shading
Softer
Thick
Trail
A small render of each particle object and the default particle shader
Thick, Softer and Trail Combined
The three particle layers combined. Tip:
Press the 1:1 button in the Render View window to view the Render at the accurate aspect ratio.
Final Rendering Considerations You have now completed the steps in this tutorial. This final section discusses some other options that are important to consider when rendering this type of shot in Maya. Rendering in Maya is done using Windows → Render View.
14 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
Lighting The lighting in this scene is set up so the particles are lit independently of other objects. Two directional lights illuminate the rocket and one spotlight illuminates the particles. There is also a colored point light that is parented to the back of the rocket. ■
Lights can be created using the Lights menu under the Rendering menuset. Press t with the light selected to invoke special manipulators.
■
A spotlight with linear decay, a slight color tint, wide cone, and high intensity work well for this shot.
■
Setting Illuminates by Default to OFF on the lights allows you to set up light linking relationship so certain lights only shine on certain objects. Light linking is done using Window → Relationship Editors → Light Linking → Light Centric. Pick the desired light on the left and the objects you want it to illuminate on the right.
Setting up light linking
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 15
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch
■
Experiment with the placement of lights in the scene or try creating some of your own to see how they affect the rendered image.
■
Raytraced Shadows: In order for the particles to have self shadowing the scene must be raytraced with raytraced shadows on the lights. To enable raytraced shadows select the light and enable raytraced shadows in the shadow section of the Attribute Editor. This is another benefit to linking lights. You can use depth map shadowing (which render faster) on lights linked to geometry in the scene.
Render Globals Settings The Render Globals window (Windows → Render Globals) is where many important rendering controls are set. For the rocket scene, the following settings are especially important to note. You should open the Render Globals window so you can see where these settings are found and experiment with them to see the results they produce. ■
Raytracing: Enabled under Raytracing Options, required to obtain particle self-shadowing as mentioned above. Raytracing a scene slows things down considerably since much more computation is being done. Therefore, it is best to leave raytracing off until you are tuning the particle shadows for the final look.
Without Raytraced Shadows
With Raytraced Shadows
■
In the above image, The upper smoke image is lit from above and rendered without raytracing. The lower smoke trail was raytraced with raytraced shadows, it contains shadows within the smoke volume.
■
Motion Blur: 2D motion blur adds realism for the rocket motion. Note that particles do not get
motion blurred. Keep this off when test rendering. ■
Anti-Aliasing Quality: Set to 3D Motion Blur Production when rendering the final shot, use
Preview quality when doing test renderings. ■
Shadows obey light linking: Located in the Render Options section, this option must be enabled so shadows from particles do not cast onto the rocket (the rocket is lit by different lights).
■
The scene file rocket_final.ma contains all of the above render global settings and is set up for a final quality render pass.
Better Illumination Better Illumination is a checkbox option found on the particle object just below the render type setting in the Attribute Editor. Enable this option when doing final renders only. This option is for cloud particles
16 A Taste of Maya
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
Questions? visit www.aliaswavefront.com/tasteofmaya
Rocket Launch Conclusion
only and increases the quality of the lighting on the particles and helps to prevent artifacts and shadow popping.
CONCLUSION You have now seen how a typical software particle workflow session is done in Maya. To recap, this tutorial covered the following areas: ■
Creating particles and emitters
■
Parenting an emitter to animated geometry
■
Adjusting particle attributes
■
Adding fields to affect particle motion
■
Keyframing emission rate in the Graph Editor
■
Changing particle radius with respect to particle age
■
Assigning shaders to particles
■
Rendering considerations.
January 2000, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved. By using this tutorial, you have agreed to the terms and conditions which can be found in the setup.exe file in the Install Tutorials folder of the Taste of Maya CD-ROM.
A Taste of Maya 17
Working in Maya
Working in Maya 1 Understanding Maya Starting and exiting Maya
7
7
Understanding the Maya window
8
Hiding elements of the Maya window
10
Displaying menus as separate windows Displaying help
11
Working with window options
13
Using sliders and data boxes
13
Setting check boxes and radio buttons Selecting menu item option boxes
14
14
Saving and restoring window options
15
Displaying window tabs and sections
17
2 Using Maya
19
Selecting a menu set Main menu bar
19
21
Selecting a menu Viewing a sub-menu
21 22
Opening an options window View menus Using the Status Line Marking menus
22
23 24
26
Hotkeys and marking menus Hotbox
10
28
29 Using Maya: Basics 3
Working in Maya Contents Displaying recent commands Changing Hotbox settings Changing the view
32
40
Customizing a zone
41
Turning off the hotbox
44
Editing a marking menu Hotkey Editor
31
45
45
What are categories?
48
Creating a hotkey
50
Deleting a hotkey
52
Creating a hotkey for a view menu function Feedback Line
56
Numerical Input Line Command Line
57
57
Playback Range
58
3 Viewing your Scene Working in 3D space
59
59
XYZ coordinate space
59
Orienting the XYZ system World coordinates
62
Local coordinates
62
What is a view?
62
Creating a new camera Moving the camera
Setting a perspective view Using Maya: Basics
63
64
Looking through a camera
4
60
66
65
52
Working in Maya Contents Creating a new perspective view Setting an orthographic view
67
67
Creating a new orthographic view Arranging the views
69
Laying out the views
71
Setting a bookmark
68
72
Creating a bookmark
73
Deleting a bookmark
74
Changing a bookmark’s name What are manipulators?
77
77
Using Maya: Basics 5
Working in Maya Contents
6
Using Maya: Basics
Working in Maya
1
Understanding Maya Maya is rich with features for creating professional 3D animation. Regardless of your animation experience, you’ll find abundant tools and techniques to suit your artistic desires. An understanding of the Maya interface is essential to developing a work style tuned to your preferences. This chapter includes these introductory topics: •
“Starting and exiting Maya” on page 3
•
“Understanding the Maya window” on page 4
•
“Hiding elements of the Maya window” on page 6
•
“Working with window options” on page 9
Starting and exiting Maya You can start and exit Maya from the desktop or in a UNIX command line.
To start Maya from the desktop: 1
Double-click the Maya icon:
2
The Maya window appears. The Maya icon changes to this icon when Maya is running:
To start Maya from a UNIX command line: 1
Enter maya.
2
The Maya window appears.
Using Maya: Basics
3
Understanding Maya Understanding the Maya window
To exit Maya: 1
Select File → Quit. If you haven’t saved the scene, you’ll be prompted to save the scene.
2
Click Yes to save the scene and exit or No to exit without saving.
Understanding the Maya window The following figure shows the Maya window—the hub of your animation work. The items in the figure are summarized in the table that follows. Title bar
Feedback Line Shelf
Channel Box
Numerical Input Line
Menu bar Status Line Minibar View menus
Workspace
Time Slider Command Line
Help Line
4
Using Maya: Basics
Script Editor button
Understanding Maya Understanding the Maya window
Purpose
Title bar
Shows the version of Maya, project name, scene, and selected object. For details on projects, see “Managing your Projects” on page 195.
Menu bar
Provides menu items. See “Main menu bar” on page 17.
Status Line
Displays icons, buttons, and other items pertinent to workspace operations. Also displays the menu selector that specifies which menus appear in the menu bar. See “Using the Status Line” on page 20.
Shelf
Shows commonly used tool icons for easy access. You can customize shelves to include the tools of your choice. See “What are shelves?” on page 79.
Minibar
Displays icons for these tools from left to right: Select, Move, Rotate, Scale, and Show Manipulator. See Chapter 11, “Transforming Objects.”
Numerical Input Line
Lets you enter exact transformation values from the keyboard. See “Numerical Input Line” on page 53.
Feedback Line
Gives information about a selected object as you use certain tools, for instance, Select, Move, Rotate, and Scale. See “Feedback Line” on page 52.
View menus
Provides menu items specific to the workspace view below the menu. See “The View Menu” on page 273.
Workspace
Displays one or more views of the scene: top, perspective, front, and side. See “What is a view?” on page 58.
Command Line
Lets you enter MEL commands instead of using the user interface. See “Command Line” on page 53.
Help Line
Gives simple instructions as you use many tools and features. See “Displaying help” on page 7.
Time Slider
Displays animation playback controls. See Using Maya: Animation.
Channel Box
Lets you enter attribute values precisely. See Chapter 13, “Working with General Editors.”
Using Maya: Basics
Working in Maya
Window item
5
Understanding Maya Understanding the Maya window
Window item
Purpose
Script Editor button
Displays a window that lists error messages and lets you enter MEL commands. See Using MEL for details.
Hiding elements of the Maya window You can hide elements of the Maya window to simplify its display. For example, you can hide the display of the Command Line.
To hide an element of the Maya window: 1
From the Options menu, turn off the checkbox of your choice.
For example, turn off Options → Command Line. 2
The element no longer appears in the Maya window.
Displaying menus as separate windows You can display menus as separate windows. This is helpful when you use a menu repeatedly.
To display a menu as a separate window: 1
6
Click the dotted line at the top of the menu.
Using Maya: Basics
Understanding Maya Displaying help The menu appears as a separate window. Drag the window to a new position.
Click Click here here to to Click here to tear menu tear off off menu tear-off menu
Working in Maya
2
Drag the window
When you tear-off a menu, the main Maya window pops to the front. Other Maya windows (except torn-off menus) are pushed to the back. To move the other windows to the front, select Window → Raise Application Windows.
Displaying help There are two ways to display helpful information as you work: the Help Line and the online documentation. The Help Line displays the name of tools and actions, and gives brief instructions as you use many tools or selections. The online documentation displays the Maya user guides in HTML format. The online documentation provides a handy search mechanism for finding words throughout the entire Maya documentation set.
Using Maya: Basics
7
Understanding Maya Displaying help
To use the Help Line: Move the mouse pointer over an icon or button. The Help Line displays the name of the tool or action associated with an icon or button. Here’s an example: Rotate tool
Name of the icon or button
After you select a tool or action, the Help Line explains what you need to do next. If you click the Rotate tool, for instance, the following instruction appears:
Instruction for using the Rotate tool
If you use a tool with a modifier key, the Help Line displays the purpose of the modifier key. For information on using tools with modifier keys, see Chapter 11, “Transforming Objects.”
To display the online documentation: 1
Select Help → Help. This starts a web browser that displays links to Maya user guides.
2
Click the desired topic.
or Click Search Engine to search for a word or text string.
8
Using Maya: Basics
Understanding Maya Working with window options
To display the version and release date of Maya: Working in Maya
Select Help → Product Information.
Note If errors appear in the console window when you use the online documentation, enter the command which netscape in a UNIX shell to see if the correct version of your web browser is running. If incorrect, set the PATH environment variable to the correct location.
Working with window options Maya windows have buttons, sliders, data boxes and other features that let you set options. The following topics describe option features you’ll encounter throughout Maya.
Using sliders and data boxes Many windows have sliders and data boxes for changing the numerical value of options. Most sliders have corresponding data boxes that let you set the slider value from your keyboard. If you type a value in an data box, remember to press Enter.
Example 1
Select Options → General Preferences → Manipulator.
Data box Slider
Using Maya: Basics
9
Understanding Maya Working with window options 2
Drag the Global Scale slider bar to change the value.
3
Enter a different value for Global Scale in the data box. The slider changes position according to the value you entered.
4
Click Save or Close.
Setting check boxes and radio buttons Many windows have check boxes and radio buttons. Check boxes let you turn multiple selections on or off. Radio buttons let you choose one option from several choices. When you turn on a radio button for an option, the others turn off.
Radio buttons
Check boxes
Selecting menu item option boxes To the right of some menu entries is a shaded square (❐) called an option box. You can select the shaded square to display a window that lets you specify the menu item’s operation.
Example Select Edit → Duplicate-❒. The following options window appears:
10
Using Maya: Basics
Understanding Maya Working with window options
Working in Maya
Click here to display the Duplicate Options window
You can also double-click icons on the Maya window’s Minibar to display an options window for the tool represented by that icon. For instance, if you double-click the following icon in the Minibar, Maya displays an options window for the Rotate tool:
Double-click here to display an options window for the Rotate tool
Note that the right-most part of the Minibar displays the icon for the active tool or last tool or menu entry in use. Only some Maya menu entries have icons, so this part of the Minibar is often empty.
Saving and restoring window options Many windows have buttons you can use to restore or save your option selections. The following example shows four common buttons:
Using Maya: Basics
11
Understanding Maya Working with window options
Refresh
If you change a number in a data box but haven’t pressed your keyboard’s Return key or changed another option setting, you can click Refresh to return the box to its prior value.
Save
Accepts your changes and saves them for future use of the window.
Revert to Saved
Returns settings to the previously saved settings.
Close
Accepts your changes, but doesn’t save them for future use. For more information, see “Setting the Startup State” on page 126.
Reset
Returns settings to original Maya settings. Reset Tool also does this.
A few windows don’t have Save or Close buttons.To close these windows, double-click the icon in the upper left corner.
12
Using Maya: Basics
Understanding Maya Working with window options
Double-click here
Many windows have multiple pages called tabs. For example, if you select Options → General Preferences, the General Preferences window displays several tabs. When you click a tab, Maya displays options specific to the tab. Click here to display Select options
Hidden tab indicator
If a hidden tab indicator appears to the right or left of the tabs, the window has other tabs that are hidden in the window.
To display hidden tabs: Drag a side or corner of the window to expand its width.
or Click the hidden tab marker and select a tab from the menu that appears.
Using Maya: Basics
13
Working in Maya
Displaying window tabs and sections
Understanding Maya Working with window options
Click here to display hidden tab menu
Some windows have sections marked by triangles. You can click a triangle to expand or collapse the section’s contents. In the following example, clicking the triangle beside the Transform Attributes section displays options for moving, rotating, or scaling an object.
Click here
14
Using Maya: Basics
This chapter describes some of the more general workflows in using Maya. The following topics are described in this chapter: •
“Selecting a menu set” on page 15
•
“Main menu bar” on page 17
•
“Using the Status Line” on page 20
•
“Marking menus” on page 22
•
“Hotkeys and marking menus” on page 24
•
“Hotbox” on page 25
•
“Hotkey Editor” on page 41
•
“Feedback Line” on page 52
•
“Numerical Input Line” on page 53
•
“Command Line” on page 53
•
“Playback Range” on page 54
Selecting a menu set Maya consists of four basic menu sets: Animation, Modeling, Dynamics, and Rendering. Each menu set contains a series of menu items with a variety of tools. When you start Maya, the default menu set is Animation. To change menu sets, click on the Animation button under the main menu and select a new menu set from the pull-down menu. The menu items change depending on the menu set selected.
Using Maya: Basics
15
Working in Maya
2
Using Maya
Using Maya Selecting a menu set
Click here...
... to open this series of menu sets
... and see these modeling menu items
Animation
Use the Animation menu set to create character animation with Keying, motion paths, and inverse kinematics. For more information, see Using Maya: Animation.
Modeling
The Modeling menu set gives you tools for polygonal and NURBS modeling. For more information, see Using Maya: Modeling.
Dynamics
Use the Dynamics menu set to create particle emitters and fields. You can also define objects as soft or rigid, then let them interact in a simulation environment. For more information, see Using Maya: Dynamics.
Rendering
Use the Rendering menu set to add and refine scene lighting, shading, and special camera characteristics. It provides both hardware and software rendering. For more information, see Using Maya: Rendering.
16
Using Maya: Basics
Using Maya Main menu bar
Main menu bar
The common menu options are File, Edit, Modify, Display, Window, Options, Tests, and Help. These menu items display regardless of the menu set you choose.
Selecting a menu To select a menu, click on its title to open its pop-up menu.
Click here...
... to display the Edit menu items
Using Maya: Basics
17
Working in Maya
The main menu bar is located along the top of the Maya window. It contains common menu options as well as a menu set that is determined by the menu set you select.
Using Maya Main menu bar
Viewing a sub-menu If Maya displays a right-pointing triangle to the right of the menu item, a sub-menu exists for that item. This is called a hierarchial or cascading menu. To view the sub-menu, click on the arrow.
Click here
Opening an options window Some menu items have an options box (❐) to the right of their names. If you click the options box, Maya opens an options window where you can change default settings for a tool or action.
18
Using Maya: Basics
Using Maya Main menu bar
View menus
•
View—Select a camera, view or bookmark. You can also edit various camera attributes for that view, including the angle of view, focal length and film back properties. For more information, see Chapter 3, “Viewing your scene.”
•
Shading—Select shading, specify shade options, and select hardware texturing. For more information, see “The Shading Menu” on page 276.
•
Lighting—Set lighting options. For more information, see “The Lighting Menu” on page 279.
•
Show—Specify which object components to display. For more information, see “The Show Menu” on page 280.
•
Panels—Select views, layouts, and panels. You can also edit panels and tear off menus. For more information, see “Assigning panels” on page 172, “Laying out the views” on page 67, and “Displaying menus as separate windows” on page 6.
Using Maya: Basics
19
Working in Maya
In addition to the main menu bar at the top of the Maya window, each of the views has a menu bar. This is called a view menu.
Using Maya Using the Status Line
Using the Status Line The Status Line
The Status Line provides feedback on settings that affect the way the tools behave. The displayed information consists of: •
the current menu set,
•
the selection mode and selectable items,
•
the snap mode, the history of the selected lead object (visible by pressing the input and output buttons),
•
the construction history flag, and
•
the working layer. To change these settings, press the button or menu that displays the corresponding information. For instance, to change the current menu set, click the current set to display a pull-down menu. To change selection mode, press the component selection switch (to go in component selection mode) or object selection switch (to go in object selection mode). For more information on changing selection mode, please see “Limiting object and component selection” on page 240. For information on locking a current selection, see “Locking a transform tool or manipulator” on page 250.
Snapping buttons Snap to Grids Snap to Points
Snap to View Plane Snap to Curves Snap to Grids
Snaps a CV or pivot point of a selected object to a grid corner.
Snap to Curves
Snaps a CV or pivot point of a selected object to a curve or curve on surface.
20
Using Maya: Basics
Using Maya Using the Status Line Snaps a CV or pivot point of a selected object to a point.
Snap to View Planes
Snaps a CV or pivot point of a selected object to a view plane.
Working in Maya
Snap to Points
For more information on these snapping modes, see “Snapping with the Move Tool” on page 286.
Other buttons Make Live List of operations performed with the related object Construction History
Manage Layer Sets List of operations performed on the related object Make Live
Makes the selected object “live”. After making a surface “live,” you can create curves on surface on it. For more information, see “Using Make Live” on page 311. For more information on drawing a curve on surface, see Using Maya: Modeling
Operations performed on selected object
Clicking this button gives you a choice of Selecting, Enabling or Disabling all operations listed, or you can view the appropriate complete, historical list.
Operations performed with selected object
Clicking this button gives you a choice of Selecting, Enabling or Disabling all operations listed, or you can view the appropriate complete, historical list.
Construction History
Turns an object’s construction history on or off.
Manage Layer Sets
Select a layer. For more information about layers, see “Layering a scene” on page 245.
Universe
Displays all existing layers.
Using Maya: Basics
21
Using Maya Marking menus
Hint When you move the pointer over the buttons on the Status line, the Help line displays the name of the button.
Marking menus Marking menus let you quickly access various tools and actions. Marking menus are also convenient— you can use them from any part of the Maya workspace. Marking menus are found in many areas within Maya, including: •
In each zone in the Hotbox. For more information, see “To use a marking menu in the Hotbox:” on page 22.
•
Under hotkeys. For more information, see “To use a marking menu with a hotkey:” on page 23.
•
On the right mouse button in different views. For more information, see “To use a marking menu with the right mouse button:” on page 24. You can customize marking menus to execute commands you have written. For information, see “Customizing a marking menu” on page 98.
To use a marking menu in the Hotbox: 1
Press and hold the spacebar. Maya displays the Hotbox. Click here in the North Zone
22
Using Maya: Basics
Using Maya Marking menus 2
Click in the North zone. Working in Maya
Note The menu that displays depends on how you have set up the marking menus. For more information, see “Creating a Marking menu” on page 99. The following figure appears:
... to here to select this menu item Drag from here...
3
To close the marking menu, release the mouse button.
4
To select a menu item, drag the sun icon.
To use a marking menu with a hotkey: Many hotkeys have an associated marking menu. For example, the hotkey w is associated with the Move Tool. 1
Select an object.
2
Press and hold the w key on the keyboard, then the left mouse button. The following menu appears:
3
Click-drag to select a function. For more information on hotkeys and marking menus, see “Creating a Marking menu” on page 99. For a list of all hotkeys and their marking menus, see “Hotkeys and marking menus” on page 24.
Using Maya: Basics
23
Using Maya Hotkeys and marking menus
To use a marking menu with the right mouse button: The marking menu that appears depends on the type of object you are working with. If you have not selected an object, press the right mouse button to display a pop-up menu. Choose Select All. If you have selected an object, press the right mouse button anywhere in the view. The following tool appears:
Hotkeys and marking menus Hotkeys are invoked by pressing the left mouse button.
24
Hotkey
Action on Marking Menu
a
Select All History/Select All Future
d
High/Medium/Low Quality Display
e
Rotate X, Y, and Z
h
Animation, Modeling, Dynamics, Rendering
q
Select Mask
r
Scale X, Y, Z and Scale XYZ
w
Translate X, Y, Z and Translate XYZ
Using Maya: Basics
Using Maya Hotbox
Hotbox
Tip Try using the Hotbox instead of the main menu bar and view menu bars. This lets you turn off the main and view menu bars and gives you more screen space. The Hotbox has five zones: North, South, East, West, and Center. They are defined by diagonal lines. North zone
West zone
Center zone
East zone
South zone
Each zone contains marking menus. Use these menus to change selection masks, control panel visibility, and panel types. These zone menus can be customized. For information on how to do this, see “Customizing a zone” on page 37. The following illustration shows the Hotbox with the Animation menu options displayed. This is the default setting.
Using Maya: Basics
25
Working in Maya
The Hotbox gives you quick access to all commands found on both the main menu and view menu bars. Press and hold the Space bar on the keyboard; you don’t have to use the mouse, Maya displays the Hotbox at the location of the pointer.
Using Maya Hotbox
To display the Hotbox: Press and hold the Space bar. The following menu appears:
Common menu set Current view menu bar Displays recently issued menu items Animation Tools
Warning If you press the Space bar but do not hold it down, Maya changes the number of views displayed. For example, if you are in a perspective view, then press the Space bar, Maya displays the four basic views. Common menu set
The main menu items common to all function sets. For more information, see “Main menu bar” on page 17.
Current view menu bar
The contents of the view menu bar in the Hotbox depends on which view or window the pointer is in. For example, if the pointer is in the Set Editor window, the view menu bar appears like this:
26
Using Maya: Basics
Using Maya Hotbox
Working in Maya
Current view menu bar
Recent Commands
This menu displays the last sixteen most recently issued actions. For more information, see “Displaying recent commands” on page 27. Only commands invoked from the menus in the main menu bar are added to the recent command list. Commands invoked from the command line, the shelf, or any other menus are not added to the list.
Tip If you want to display more than sixteen previously issued commands, you must use a MEL script. For more information, see Using MEL. Hotbox Controls
This menu contains items you use to control the appearance and contents of the Hotbox.
Displaying recent commands The Hotbox lets you select up to sixteen previously issued commands. This eliminates the need of having to work through hierarchial or cascading menus.
Using Maya: Basics
27
Using Maya Hotbox
Click here
Click here to create another cylinder
You can now select a command to repeat.
Changing Hotbox settings One of the advantages of the Hotbox is that you can change its contents while you are working. With the Hotbox Controls menu, you can change a variety of Hotbox settings. For example, you can specify which function sets you want to display and if you want common menus to display.
To change a Hotbox option: 1
28
While pressing the Spacebar, click Hotbox Controls.
Using Maya: Basics
Using Maya Hotbox
Working in Maya
Click-drag here... ... to here
2
Click-drag an option.
Using Maya: Basics
29
Using Maya Hotbox
To specify what function sets appear: One of the main features of the Hotbox is its ability to display multiple menu items. For example, if you are going back and forth between the Modeling and Rendering function sets, the Hotbox can display all associated menu items. In the following example, the Hotbox displays the Modeling menu items. 1
Press and hold the Spacebar. The following menu appears:
Click and hold here
2
With the pointer on Hotbox Controls, click and hold any mouse button. The following menu appears: Click-drag from here... ... to here to display Modeling
3
30
Drag to the Show Modeling menu item.
Using Maya: Basics
Using Maya Hotbox
To turn off common menus: Working in Maya
By default, common menus appear in the hotbox. Click here
To turn off these menus, click on the box beside Show Common Menus in the Hotbox Controls menu.
To turn a view specific menu on and off: If you do not want the view-specific menus to appear when using the Hotbox, you can turn them off. In the following example, Edit, View, Tangents, Options, and Panels appear twice in the view. These menu items appear here and in the Hotbox
To turn off the menus, click Show Pane Specific Menus.
Using Maya: Basics
31
Using Maya Hotbox
Click here
In the following example, Edit, View, Tangents, Options, and Panels now appear once in the view.
Note You can also do the reverse (turn off the view menus in the view). See “Panels options” on page 148.
To change the transparency: You can make the Hotbox transparent to minimize the amount of the scene or object it obscures. 1
32
Click-drag on Set Transparency.
Using Maya: Basics
Using Maya Hotbox
Working in Maya
2
Select a new transparency percentage. The default is 50%.
Transparency of 0% The following shows a setting of 0%. Note that the boxes appear as part of the Hotbox and will partially obscure the scene or object.
Transparency of 100% The following shows a setting of 100%. Note that the boxes do not appear as part of the Hotbox. This means that you can still see your object or scene through the Hotbox.
Using Maya: Basics
33
Using Maya Hotbox
Changing the style of the Hotbox You can use the Hotbox Style Settings to change the display of the Hotbox so that it fits your working style. Select the Hotbox Controls to: •
make all of the menu rows visible
•
display just the five marking menu zones
•
make the centre zone (A|W) active everywhere
Click here to display a marking menu Click here to change the style Click here to display a marking menu
To change the style: While pressing the Space bar, click-hold on the Hotbox Controls.
34
Using Maya: Basics
Using Maya Hotbox
Working in Maya
Click-hold here
The following menu appears:
Click here to change the window style Click-drag here
To set window options: To give yourself more drawing space, you can turn off the Main and Pane menu bars. To do this, press the Space bar and select Hotbox Controls → Window Options. The following cascading menu appears:
Click here to turn off the Main Menu bar Click here
Click here to turn off the Pane menu bars
Using Maya: Basics
35
Using Maya Hotbox
Changing the view Use the Hotbox to change to another view. While pressing the Space bar, click and hold on the Center zone.
Click and hold here...
Click-drag from here...
36
Using Maya: Basics
... to here to display a perspective view
Using Maya Hotbox
Customizing a zone
You can customize a marking menu in the Marking Menus editor. For more information, see “Customizing a marking menu” on page 98.
North Zone West zone Center zone
East zone
South zone
Default marking menus The following marking menus are the default settings for each of the five marking menus. North zone
Changes to a new window layout.
Using Maya: Basics
37
Working in Maya
The Hotbox has five zones: North, South, East, West, and Center. Each zone contains marking menus that let you change selection masks, control panel visibility, and panel types.
Using Maya Hotbox South zone
Changes a view in the current panel.
East zone
Turns parts of the interface display on and off.
West zone
Switches between preset selection masks.
Center Zone
Switches between views.
38
Using Maya: Basics
Using Maya Hotbox
To select a menu item from a marking menu:
1
Working in Maya
In the following example, a tool is selected from the South Zone. While pressing the Space bar, click in the South Zone.
Click here
The following menu appears:
... to here to display the Graph Editor
Click-drag from here...
2
From the center of the menu, click-drag to the Graph Editor.
Using Maya: Basics
39
Using Maya Hotbox
Turning off the hotbox You can disable the Hotbox so it does not appear when you press the Space bar.
To disable the Hotbox: 1
Select Options → Customize UI → Hotkeys. The following window appears:
Click-drag to display Miscellaneous
2
Under Miscellaneous, select Pop HotBox, then Unmap Key. Maya removes the word Press from the window. This turns off the hotkey functionality.
Note For more information on Press and Release, see “Specifying a key event” on page 44.
40
Using Maya: Basics
Using Maya Hotkey Editor 3
For information on using hotkeys, see “Creating a hotkey” on page 46.
Editing a marking menu The Hotbox supports a different menu for each mouse button in each of the five zones. This lets you create three menus per zone, for a total of fifteen marking menus. This gives you approximately 120 commands. For more information on using the Marking Menu, see “Marking menus” on page 22.
Hotkey Editor If you use a function frequently you may want to assign it to a hotkey. For example, if you select File → Import frequently, you can assign a hotkey to it. This decreases your reliance on the main menu. The Hotkey Editor lists all the menu items in the main menu bar and many commonly-used functions in Maya. You can use it to assign a hotkey to these functions or your own functions.
To display the Hotkeys editor: 1
Select Options → Customize UI → Hotkeys. The following window appears:
Using Maya: Basics
41
Working in Maya
Click the Save button, then the Close button. Now, when you press the Spacebar, the Hotbox will not display.
Using Maya Hotkey Editor
Category
Mapped function Unmapped function
Specifying the Display Mask options Select a mask option to display either mapped or unmapped main menu functions and their hotkeys. Show All
Shows mapped and unmapped hotkeys. Mapped main menu functions appear at the top of the window. Unmapped functions appear after the mapped functions.
Show Mapped
Shows mapped hotkeys.
Show Unmapped
Shows unmapped hotkeys.
42
Using Maya: Basics
Using Maya Hotkey Editor
Sorting the Hotkeys
By Category
Sorts the hotkeys by category. For more information, see “What are categories?” on page 44.
By Key
Sorts the hotkeys by key and in alphabetical order. All the mapped functions appear at the top of the window; unmapped functions appear at the bottom.
Note If you want to sort all mapped hotkeys by key, select Show Mapped, then By Key. This also displays which hotkeys have associated marking menus. For more information, see “Assigning a marking menu to a hotkey” on page 113.
Specifying a key This lets you specify a particular key. Key
Enter any letter from A to Z or a number from 0 to 9. You cannot use more than one letter or number.
Special Keys
Specify a task to other keys on the keyboard. For example, if you want the right arrow key to act as the trigger, specify it here.
Specifying a hotkey modifier Select either Alt or Ctrl for the hotkey modifier. For example, Alt-B.
Using Maya: Basics
43
Working in Maya
Select a sorting method.
Using Maya Hotkey Editor
Specifying a key event Use Press and Release to associate a function with the press or a release of a key. For example, you can create a hotkey to instruct Maya to snap to a curve when you press a key, then turn off the snapping when you release it.
Setting a Command Object Setting If the command you want to associate with a hotkey does not appear in the Hotkey Editor window, you can specify it using a MEL script. Annotation
Contains a description used in the Hotkey window.
Command(s)
Contains the MEL script that makes up the function.
What are categories? Maya is made up of four menu sets: Animation, Modeling, Dynamics, and Rendering. In addition, there are eight main menu items that remain displayed regardless of the function set you choose: File, Edit, Modify, Display, Window, Options, Test, and Help. The Hotkey Editor lists all of the available main menu functions starting with the File menu and ending with Miscellaneous. Each category displays all associated functionality for a main menu item.
Main menu categories In the following figure, the Options main menu item and its associated functions are reflected in the Options menu category.
44
Using Maya: Basics
Using Maya Hotkey Editor
Working in Maya
Options category
Functions associated with Options
User-defined categories User-defined categories list all hotkey combinations you have created. It does not include hotkeys supplied by Maya. For example, if you assign a hotkey to a function not listed in the Hotkey Editor, Maya displays it in this category.
Using Maya: Basics
45
Using Maya Hotkey Editor
Creating a hotkey The Hotkey Editor contains all of the functions found in the main menu. This lets you assign a hotkey to any main menu function you use frequently. In the following example, the File → Import function is assigned to the hotkey combination Alt-P.
To create a hotkey: 1
Select Options → Customize UI → Hotkeys.
2
Select File → Import.
Click here to select the function
3
In the Key box, enter p. This is the key identifier.
Enter key identifier here Select modifier Select action key
Click here to verify that alt-P is available
4
46
Select a modifier.
Using Maya: Basics
Using Maya Hotkey Editor 5
Hotkey setup for File → Import
Hint To remove the hotkey mapping from the key, click Unmap Key.
To restore system defaults: 1
To restore the main menu functions to their default settings, click Restore Defaults.
Click here
The following message appears:
2
Click Yes. Maya removes all the hotkeys you have assigned to the main menu functions.
Using Maya: Basics
47
Working in Maya
Select either Press or Release, then click Apply New Settings. Maya applies the hotkey combination to the main menu function.
Using Maya Hotkey Editor
Deleting a hotkey You can delete any user-defined function menu in the Hotkey window.
Warning You cannot delete any of the default commands from the Hotkey Editor. You cannot undelete a hotkey once you have deleted it.
To delete a hotkey: 1
Select the function you want to delete.
2
Click Delete Selected.
Hint You can delete multiple commands.
Creating a hotkey for a view menu function The Hotkey Editor does not contain menu items for the following window view menu bars:
However, you can create a hotkey for these functions with the Script Editor and the Hotkey Editor. You can also assign a hotkey to a view. For more information on views, see “Creating a layout” on page 180. You can also use the Hotkey Editor to create your own hotkeys, using MEL commands you write yourself. For more information, see Using MEL. In the following example, you create a hotkey for the Smooth Shade Selected Items function from the Shading panel.
To create a hotkey for a panel function: 1
48
Select Window → General Editors → Script Editor. The following window appears:
Using Maya: Basics
Using Maya Hotkey Editor
Working in Maya
Tip If the Script Editor displays MEL code from previous functions, select Edit → Clear History. This erases the code from the window. 2
Select Edit → Echo All Commands. This instructs Maya to display all MEL commands used to execute any menu function.
3
Select Shading. The following menu appears:
Using Maya: Basics
49
Using Maya Hotkey Editor
Click here
4
Select Smooth Shaded Selected Items. Maya echoes the MEL commands in the Script Editor window.
Function code
50
5
Select Options → Customize UI → Hotkeys. The Hotkey Editor window appears.
6
Using the left mouse button, click-drag on the MEL commands in the Script Editor window.
Using Maya: Basics
Using Maya Hotkey Editor
Working in Maya
Click-drag from here... ... to here
7
Using the middle mouse button, paste the MEL commands into the Command(s) field in the Hotkey Editor window. Type name here
Paste MEL code here
8
Enter a name in the Annotation box. Use a name that describes the hotkey’s function.
9
Select Create Command Object. The Hotkeys editor displays the function in the User Defined category.
10 Enter p in the Key box, then select Alt as the modifier. The default action is Press.
Using Maya: Basics
51
Using Maya Feedback Line
11 Click Apply New Settings. The Hotkeys editor displays the function and its hotkey in the User Defined category.
Hint To delete the hotkey, click Delete Selected.
Feedback Line The Feedback line is directly above the view menu. It displays information on object transformations. For example, if you scale an object from coordinates 3 3 3 to 3 4 6, the feedback line reflects this change. Similarly, if you scale the object along the X-axis, the feedback line displays the change. The feedback line also reflects any changes you make using either the Command Line or the Numerical Input Line. In the following example, the NURBS cube has been scaled along all three axes.
52
Using Maya: Basics
Using Maya Numerical Input Line
Working in Maya
Numerical Input Line Use the Numerical input line to enter precise values for transformations. This can give more accurate positions than the mouse. For example, you can enter exact values for moving, scaling, or rotating.
Coordinates entered in the Numerical Input line
Command Line You can use the Command Line to enter MEL commands. This can serve as an alternative to using the Maya user interface. Enter commands in the pink area. Any feedback is displayed in the grey area.
Using Maya: Basics
53
Using Maya Playback Range
Enter command
Command response
Playback Range The Playback Range includes the Range Slider and the Time Slider. It represents the current working area for setting up and testing animation. For more information, see Using Maya: Animation.
Time Slider
54
Using Maya: Basics
Range Slider
This chapter introduces some basic concepts of 3D space. It also includes information on the various tasks you can perform using Maya viewing tools, such as orthographic and perspective views and cameras. The following topics are described in this chapter: •
“Working in 3D space” on page 55
•
“What is a view?” on page 58
•
“Setting a perspective view” on page 62
•
“Setting an orthographic view” on page 63
•
“Arranging the views” on page 65
•
“Laying out the views” on page 67
•
“Setting a bookmark” on page 68
•
“What are manipulators?” on page 73
Working in 3D space In traditional character animation, an animator works in a two-dimensional (2D) medium. A character can have length and width, but not depth. Maya lets you work in three dimensions (3D).
XYZ coordinate space Maya’s 3D coordinate system lets you create characters and scenes with dimensionally accurate values. In the XYZ coordinate system, the origin is the center, with coordinates 0,0,0. All points are defined by one coordinate along the X-axis, one along the Y-axis, and one along the Z-axis. One direction along each axis is positive and the other direction is negative. You can place points with your mouse, or enter values in the Numerical input line. If you are not familiar with working in a 3D environment, you need to know the principles behind the XYZ coordinate system.
Using Maya: Basics
55
Working in Maya
3
Viewing your Scene
Viewing your Scene Working in 3D space
Orienting the XYZ system You can orient the XYZ system in either Z-up or Y-up.
Y-up A Y-up world has X set up as the horizontal and Z as the depth of the scene. This orientation is often used by animators (and games developers) who have evolved from the 2D world of vertical (Y) and horizontal (X) to include movement towards or away from the camera (Z). + Y-axis - Z-axis - X-axis
+ X-axis
- Y-axis + Z-axis
Y-up character model
56
Using Maya: Basics
Viewing your Scene Working in 3D space
Z-up
+ Z-axis - Y-axis - X-axis
+ X-axis
- Z-axis + Y-axis
Z-up chair model
Using Maya: Basics
57
Working in Maya
A Z-up world begins with a ground plane that represents the X and Y directions, with Z representing the up direction. This orientation is used by designers, whose main concern is the ground plane where their plans are placed.
Viewing your Scene What is a view?
Changing the orientation/up axis You can change the scene orientation with the Options menu or MEL commands. Note that, along with changing the up axis, every menu action or tool has an equivalent line command.
To specify the orientation: •
Select Options → General Preferences. Under the World Coordinate System section, select Y or Z. For more information, see “General options” on page 126.
•
To change the orientation to Z-up, enter the following in the Command line: upAxis -ax z
•
To change the orientation to Y-up, enter the following in the Command line: upAxis -ax y
World coordinates World coordinates represent space in the view. For example, when you move a camera you move it in terms of world coordinates. The center of the world coordinate system is located at the Origin. World space is a coordinate system used to represent an object in terms you define. For example, a model car might be defined in terms of millimeters. World coordinates are also known as “modeling coordinates.”
Local coordinates Local coordinates represent the space around an entity. The origin of a local coordinate system is the center of the entity. The location of the entity in world coordinate is also the location of the entity’s local coordination in world coordinates.
What is a view? In Maya, you are always looking through a camera for either perspective or orthographic views. Think of it as being a director on a movie set and looking through a camera lens. Your field of view is restricted to what you can see through that lens. If you want to view the scene from another angle,
58
Using Maya: Basics
Viewing your Scene What is a view?
It’s the same in Maya. Whatever part of a scene you see depends on the camera you are looking through at the time. You can also use Look Through Selected to look through a light or object. For a light, this can help you plan its exact area of illumination. For an object, it can also be a helpful tool. For example, you could select a character’s eyes and animate a scene through their view. In the following example, you are looking at a cylinder through a second perspective camera view.
Perspective camera
Creating a new camera If you change a view by either tumbling, tracking, dollying, or zooming in and out, you are still looking at the scene or object through the same camera. To look at the scene or object through a second camera, you will have to change the view, then create the camera. For more information on creating a new camera, see “Setting a bookmark” on page 68.
Using Maya: Basics
59
Working in Maya
you could move the camera you are looking through, but then you would have to move it back again. Instead, you can create, orient, and look through a second camera.
Viewing your Scene What is a view?
Moving the camera You can move a camera to get a different view of the object without creating a new camera. To move a camera, you can use the Common Tools menu or the mouse with the Alt key.
Note To select the Roll, Zoom, Azimuth Elevation, and Yaw-Pitch tools, use the Common Tools menu. You cannot select these tools with the mouse and the Alt key.
To select a tool: 1
Select View → Camera Tools. The following cascading menu appears:
60
Using Maya: Basics
Viewing your Scene What is a view?
Camera Tools Revolves the camera by varying the azimuth and elevation angles in the perspective window. You can also press Alt and the left mouse button.
Track Tool
When tracking across the display, slides the view either horizontally or vertically. You can also press Alt and the middle mouse button.
Dolly Tool
Moves into or away from the view. You can also press Alt and the left and middle mouse buttons together.
Working in Maya
Tumble Tool
You can only use the Dolly tool in a Perspective window. Changes the focal length on a camera. Zooming in is like using a telephoto lens. Zooming out is like using a wide angle lens.
Zoom Tool
You can only use zoom in a perspective view. To move in or out without changing the viewing angle, use the Dolly tool. Roll Tool
Rotates the display around its horizontal axis.
Azimuth Elevation Tool
Revolves the camera about the center of interest in the perspective view.
Yaw Pitch Tool
Changes from an orthographic view to a perspective view.
To use a camera tool: 1
Select the tool you want to use. For information on changing a tool’s properties, see “Specifying tool settings” on page 167.
2
Click-drag the left (or middle) mouse button to see the effect of the tool.
Looking through a camera To switch the view to a new camera, you can use the Look Through Selected action.
To look through a camera: 1
Select Panels → Perspective.
2
Select a camera.
3
Select Panels → Look Through Selected.
Using Maya: Basics
61
Viewing your Scene Setting a perspective view
Tip You can also use the Hypergraph to select a view. In the Hypergraph window, select the name of a view, then select Panel → Look Through Selected. For more information, see Using Maya: Hypergraph, Sets & Expressions.
Setting a perspective view Each model view is linked to a camera that “looks” at your scene. The camera’s position, orientation, and attributes determine what you see through that particular camera. Use Perspective to switch to another perspective camera or create a new perspective view. Unlike with an orthographic view, a perspective view shows depth.
To use a perspective view: 1
Select Panels → Perspective. The following cascading menu appears:
2
To view a perspective view, select persp. To create a new perspective camera view based on changes you have made to the display, select New.
62
Using Maya: Basics
Viewing your Scene Setting an orthographic view
Creating a new perspective view Working in Maya
When building an object or scene, it is often useful to view the object from several different perspectives. Use the New function to create a new perspective camera.
To create a new perspective camera view: 1
Change the view of the object. For example, if you want to tumble the display, press Alt - left mouse button.
2
Select Panels → Perspective → New. Maya creates a new camera in the default home perspective position.
3
To view the original perspective camera, select View → Previous View or View → Default Home. To view the new perspective camera, select Panels → Perspective. The following cascading menu appears:
Name of the new perspective view
Setting an orthographic view An orthographic camera shows the 3D workspace from the top, front, and side views. These views offer the most analytical view of the world space. However, they do not show depth. Use Orthographic to either switch to an orthographic camera or create a new orthographic camera.
To switch to an orthographic view: 1
Select Panels → Orthographic. The following cascading menu appears:
Using Maya: Basics
63
Viewing your Scene Setting an orthographic view
2
Select front, side, or top as the active window. To create a new orthographic camera, select New. Maya then places the camera in the active view.
Creating a new orthographic view Use New to create a new orthographic view.
To create a new camera view:
64
1
Select Panels → Orthographic → New. The following cascading menu appears:
2
Select on the new view — Front, Side, or Top. Maya changes the view.
3
Select Panels → Orthographic. The view you just created appears in the following cascading menu:
Using Maya: Basics
Viewing your Scene Arranging the views
Working in Maya
New orthographic view
Arranging the views Use Panels to change a camera view or to view a scene or object through a selected camera.
Display Panel selections Select Panels. The following cascading menu appears:
•
Perspective — lets you change to a perspective view or to create a new view.
•
Orthographic — lets you change a perspective view to orthographic, select a
new orthographic view, or create a new orthographic view. •
Look Through Selected — lets you look through a selected camera, object, or
light. •
Panel — displays a cascading menu, which contains the following tools:
Using Maya: Basics
65
Viewing your Scene Arranging the views Outliner — lets you see objects and their attributes from a high-level perspective. For more information, see Chapter 14, “Outliner.” Graph Editor and Dope Sheet — let you edit keys, motion tangents, and animation curves. For more information, see Using Maya: Animation. Hypergraph — gives you an overview of your entire scene, all objects it contains, and the relationships between those objects. For more information, see Using Maya: Hypergraph, Sets & Expressions. Texture View — lets you map textures to a polygonal model. For more information, see Using Maya: Modeling. Multi-Lister, Render View, and Shading Group Editor — let you create and edit rendering nodes, assign shading groups to geometry, preview a rendered image, and key animatable rendering attributes. For more information, see Using Maya: Rendering. Set Editor — lets you group and manipulate objects as sets. For more information, see Using Maya: Hypergraph, Sets & Expressions. Blend Shape — lets you create character deformations. For more information, see Using Maya: Animation. Dynamic Relationships — shows the connections between dynamics elements such as particle emitters, collisions, and so on. For more information, see Using Maya: Animation. Devices — lets you use external tools and plug-ins for special devices, such as Motion Capture. •
Layouts — lets you specify how different camera views appear in the Maya
window. •
Saved Layouts — displays the current layouts set up in the Panel Editor.
•
Tear Off — copies the current camera view.
•
Tear Off Copy — copies a camera view, beginning with the current view and
ending with the last camera view. •
Panel Editor — opens the Panel Editor, which lets you create new panels,
relabel existing panels, rename layouts, and change layout configurations.
66
Using Maya: Basics
Viewing your Scene Laying out the views
Laying out the views
Use the Viewing Pane Arrangement to control how Maya displays the four basic views. The top, front, and side views are 2D orthographic views that allow you to view your work analytically. The fourth view is perspective and allows you to view the scene in 3D. You can place any tool in a view. For more information, see “Assigning panels” on page 172. In the following example, the display is changed to a 3 left split layout.
To set the views: 1
Select Panels → Layouts. The following cascading menu appears:
Click here to change the display
Click here to return to the previous display
Click here to display the next arrangement
2
Select 3 Left Split. The Maya window changes to the following three views: Using Maya: Basics
67
Working in Maya
Because much of your 3D work takes place in a modeling view window, you want to be able to view an object from the top, front, side, and in perspective. In 3D, it is sometimes difficult to see exactly where an object lies. The four views enable you to confirm the positioning of objects from more than one camera angle.
Viewing your Scene Setting a bookmark
You can now view an object or scene in three different views.
Tips If you want one view to occupy the entire Maya window, select the view, then press the space bar quickly. (If you press the space bar for too long, Maya displays the HotBox.) To switch to a perspective view, select Panels → Perspective. To switch to another orthographic view, select Panels → Orthographic → and the name of the orthographic panel you want selected. To rename and delete a camera, use the Outliner. See Chapter 14, “Outliner.”
Setting a bookmark You can use bookmarks to mark a view for later use. This lets you maintain a number of key points of view for any scene. Maya has four predefined bookmarks. These are the same as the perspective and orthographic views. Use Predefined Bookmarks to change the perspective of an object.
Note You cannot change positions for the predefined bookmarks.
68
Using Maya: Basics
Viewing your Scene Creating a bookmark
Changing the view to a predefined bookmark: Working in Maya
Select View → Predefined Bookmarks. A cascading menu opens from which you can choose one of the standard default views: Perspective, Front, Top, and Side.
Creating a bookmark To create a new bookmark: 1
Select an object and change the view.
2
Select View → Bookmarks. The following cascading window menu appears.
3
Select View → Bookmarks → Edit Bookmarks. The following window appears:
Using Maya: Basics
69
Viewing your Scene Creating a bookmark
Type name of new bookmark here
4
Type the name of the new bookmark and select Apply.
5
To access the new bookmark, select View → Bookmarks.
6
Select the bookmark that you want to view the object through.
Tip To create a bookmark with system- assigned name, select Edit Bookmarks, the Bookmark Editor appears, and click New Bookmark. Maya assigns the view to the first bookmark under the name cameraView1.
Deleting a bookmark You delete a bookmark from the command line or the Multilister.
Enter the following command from the Command Line delete
Where is, enter the name of the bookmark you want to delete.
From the Multilister 1
Select Window → Multilister. The following window appears:
70
Using Maya: Basics
Viewing your Scene Creating a bookmark
Working in Maya
Click here
2
Click the Cameras tab. The following window appears:
Using Maya: Basics
71
Viewing your Scene Creating a bookmark
Click here to display associated bookmarks
Bookmarks
3
Click the bookmark you want to delete.
4
Select Edit → Delete Highlighted from the Multilister menu. Maya removes the bookmark from the window.
5
72
To undo the deletion, select Edit → Undo.
Using Maya: Basics
Viewing your Scene What are manipulators?
Changing a bookmark’s name Working in Maya
You can change the name of a bookmark.
To change the name of a bookmark: 1
Select View → Bookmarks → Edit Bookmarks.
2
Select the name of the bookmark you want to change. The following window appears:
3
Enter the new name of the bookmark, then click Apply.
4
To view the renamed bookmark, select View → Bookmarks. A list of bookmarks appear. Select the renamed bookmark.
What are manipulators? A manipulator lets you edit the parameters or attributes of an object. For example, you can use a manipulator to change the sweep angle of a revolved surface. Manipulators give you a visual and interactive way to change parameters. Manipulators are used by a variety of tools in Maya. Usually, a manipulator is created by a tool and then deleted when you exit the tool. However, there are some exceptions to this.
Using Maya: Basics
73
Viewing your Scene What are manipulators?
Y handle
Z handle
Center handle X handle
Handles: A manipulator is made of several handles. For example the move manipulator has a center handle, plus handles to move it in X, Y and Z. You can change handle sizes with the manipulators display preferences in Options → General Preferences. For the transform manipulator, you can change the overall size of the manipulator in this property sheet. You can also use the + and - keys on the keyboard to change the size of the transform manipulators. The active (current) handle When you click-drag a manipulator handle, it becomes the active handle. This means you can use the middle mouse button, to move the handle without having to reselect it. If you click down away from the handle and drag, it still moves the manipulator. The active handle is drawn in yellow You can keyframe the attribute corresponding to this active handle. See the set keyframe menu item for more details. Numerical input and feedback When a manipulator is active, the parameters that the manipulator is changing are shown in the Feedback Line. Also, you may enter in the values into the Numerical Input Line at the top right of the window.
74
Using Maya: Basics
Viewing your Scene What are manipulators?
Working in Maya
Using Maya: Basics
75
Viewing your Scene What are manipulators?
76
Using Maya: Basics
Index
Numerics 3D space 59
A active handle of manipulator 78 Animation Menu 20 arranging viewing panes 71 Azimuth/Elevation 65
B bookmarks creating 73 deleting 74 in Multilister 76 naming 77 setting 72
coordinate space XYZ 59 coordinates world 62 creating bookmarks 73 camera 63 orthographic view 68 curve snapping 24
D data boxes 13 defaults restoring 51 delete bookmarks 74 deleting hotkey 52 documentation online 11 Dolly 65 Dynamics Menu 20
C E editing bookmarks 77 editing hotkeys 45 exiting Maya 7
Grid snapping 24
H help online 11 Help Line 9, 12 hiding Maya window elements 10 history construction 25 Hotbox 26 Center zone 29, 42 changing style 38 changing transparency 36 changing view 40 common menus toggle 35 controls 32 customizing a zone 41 default marking menus 41 disabling 44 East zone 29, 42 editing marking menus 45 North Zone 26 North zone 29, 41 recent commands 31 South zone 29, 42 view-specific menus toggle 36 West zone 29, 42
F
Index
camera as view 63 changing view 69 creating 63 look through 65 moving 64 orthographic 67 tools 65 categories 48 changing camera view 69 Channel Box 9 check boxes 14 Command Line 9, 57 construction history 25
G
Feedback Line 9, 56
Using Maya: Modeling
81
Index
Layers manage sets 25 line command 57 feedback 56 numerical input 57 look through camera 65 selected 65
Menu Animation 20 Dynamics 20 Modeling 20 Rendering 20 menu selection 21 Menu bar 9 Menu Set 19 menus cascading 22 displaying as windows 10 marking 26 option boxes 14 sub-menus 22 view 23 Minibar 9, 15 Modeling Menu 20 moving camera 64 Multilister 74 bookmarks 76
M
N
Main Menu 21 Make Live 25 Manage Layer Sets 25 manipulators 78 active handle 78 Marking menus 26 masking display of hotkeys 46 Maya hiding window elements 10 main menu 21 main window 8 manipulators 78 recent command list 31 selecting menu set 19 version and release date 13
Numerical Input Line 9 Numerical input line 57
hotkeys creating 50 creating for panel menu 52 deleting 52 editing 45 Editor 48 sorting 47 using display mask 46 with associated marking menu 28
L
82
Using Maya: Modeling
O option boxes 14 options saving and restoring 15 setting 13 options window 22 orientation Y-up 60 Z-up 61
orthographic camera 67 view 67 orthographic view new 68
P panes viewing arrangement 71 Perspective camera 66 view 66 playback range 58 points snapping 24
R radio buttons 14 range playback 58 Rendering Menu 20 restore defaults 51 restoring options settings 15 Roll 65
S saving option settings 15 Script Editor 10 sections window 18 selecting menu 21 setting bookmarks 72 Shelf 9
Index
sliders 13 Snap to curve 24 Grid 24 points 24 view plane 25 sorting hotkeys 47 starting Maya 7 Status Line 9, 24
T tabs window 17 Time Slider 9 Title bar 9 Track 65 Tumble 65
U
W window options 22 windows displaying menus as 10 option tabs and sections 17 restoring options 15 saving options 15 setting options 13 workspace 9 World coordinates 62
X XYZ coordinate space 59
Y Yaw Pitch 65 Y-up orientation 60
Universe 25
Z
V
Zoom 65 Z-up orientation 61
Index
version and release date 13 view as camera 63 orthographic 67 View menus workspace 9 view menus 23 view plane snapping 25 Viewing Pane Arrangement 71 views orthographic 62 perspective 62
Using Maya: Modeling
83
Index
84
Using Maya: Modeling